Date: Fri, 13 May 2016 08:46:13 +0000 (UTC) From: Garrett Cooper <ngie@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r299626 - stable/9/sys/kern Message-ID: <201605130846.u4D8kDC0068469@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ngie Date: Fri May 13 08:46:13 2016 New Revision: 299626 URL: https://svnweb.freebsd.org/changeset/base/299626 Log: MFstable/10 r299625: MFC r298677: r298677 (by cem): subr_mbpool: Don't free bogus pointer in error paths An mbpool is allocated with a contiguous array of mbpages. Freeing an individual mbpage has never been valid. Don't do it. This bug has been present since this code was introduced in r117624 (2003). CID: 1009687 Modified: stable/9/sys/kern/subr_mbpool.c Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) Modified: stable/9/sys/kern/subr_mbpool.c ============================================================================== --- stable/9/sys/kern/subr_mbpool.c Fri May 13 08:44:59 2016 (r299625) +++ stable/9/sys/kern/subr_mbpool.c Fri May 13 08:46:13 2016 (r299626) @@ -209,16 +209,13 @@ mbp_alloc_page(struct mbpool *p) pg = &p->pages[p->npages]; error = bus_dmamem_alloc(p->dmat, &pg->va, BUS_DMA_NOWAIT, &pg->map); - if (error != 0) { - free(pg, M_MBPOOL); + if (error != 0) return; - } error = bus_dmamap_load(p->dmat, pg->map, pg->va, p->page_size, mbp_callback, &pg->phy, 0); if (error != 0) { bus_dmamem_free(p->dmat, pg->va, pg->map); - free(pg, M_MBPOOL); return; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605130846.u4D8kDC0068469>