Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Apr 2011 11:11:22 +0000 (UTC)
From:      Bernhard Schmidt <bschmidt@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r220710 - head/sys/dev/iwn
Message-ID:  <201104161111.p3GBBMod002939@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bschmidt
Date: Sat Apr 16 11:11:22 2011
New Revision: 220710
URL: http://svn.freebsd.org/changeset/base/220710

Log:
  Prevent double-free, also use the same error codes as OpenBSD.

Modified:
  head/sys/dev/iwn/if_iwn.c

Modified: head/sys/dev/iwn/if_iwn.c
==============================================================================
--- head/sys/dev/iwn/if_iwn.c	Sat Apr 16 11:06:09 2011	(r220709)
+++ head/sys/dev/iwn/if_iwn.c	Sat Apr 16 11:11:22 2011	(r220710)
@@ -1294,7 +1294,7 @@ iwn_alloc_rx_ring(struct iwn_softc *sc, 
 		if (data->m == NULL) {
 			device_printf(sc->sc_dev,
 			    "%s: could not allocate rx mbuf\n", __func__);
-			error = ENOMEM;
+			error = ENOBUFS;
 			goto fail;
 		}
 
@@ -1305,8 +1305,6 @@ iwn_alloc_rx_ring(struct iwn_softc *sc, 
 			device_printf(sc->sc_dev,
 			    "%s: bus_dmamap_load failed, error %d\n",
 			    __func__, error);
-			m_freem(data->m);
-			error = ENOMEM;	/* XXX unique code */
 			goto fail;
 		}
 
@@ -1361,6 +1359,7 @@ iwn_free_rx_ring(struct iwn_softc *sc, s
 			    BUS_DMASYNC_POSTREAD);
 			bus_dmamap_unload(ring->data_dmat, data->map);
 			m_freem(data->m);
+			data->m = NULL;
 		}
 		if (data->map != NULL)
 			bus_dmamap_destroy(ring->data_dmat, data->map);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201104161111.p3GBBMod002939>