Date: Tue, 26 Apr 2016 23:58:55 +0000 (UTC) From: "Conrad E. Meyer" <cem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r298677 - head/sys/kern Message-ID: <201604262358.u3QNwtUO000331@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: cem Date: Tue Apr 26 23:58:55 2016 New Revision: 298677 URL: https://svnweb.freebsd.org/changeset/base/298677 Log: 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). Reported by: Coverity CID: 1009687 Sponsored by: EMC / Isilon Storage Division Modified: head/sys/kern/subr_mbpool.c Modified: head/sys/kern/subr_mbpool.c ============================================================================== --- head/sys/kern/subr_mbpool.c Tue Apr 26 23:23:44 2016 (r298676) +++ head/sys/kern/subr_mbpool.c Tue Apr 26 23:58:55 2016 (r298677) @@ -210,16 +210,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?201604262358.u3QNwtUO000331>