summaryrefslogtreecommitdiffstats
path: root/sys/dev/fxp
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1996-09-20 11:05:39 +0000
committerdg <dg@FreeBSD.org>1996-09-20 11:05:39 +0000
commit535db4f5b39884d41e8b795cba6fb9709f170ce8 (patch)
tree282d4ed9a5acbdaa654883acb4e8ef99a7837bd9 /sys/dev/fxp
parent789349c3b08a5d1d6885c640e73d2f3957d63339 (diff)
downloadFreeBSD-src-535db4f5b39884d41e8b795cba6fb9709f170ce8.zip
FreeBSD-src-535db4f5b39884d41e8b795cba6fb9709f170ce8.tar.gz
Fixed a bug in the receive buffer allocation code that resulted in a
panic if an mbuf cluster couldn't be allocated. This was caused by a failure to re-initialize m_data when the old mbuf/mbcluster was recycled.
Diffstat (limited to 'sys/dev/fxp')
-rw-r--r--sys/dev/fxp/if_fxp.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/sys/dev/fxp/if_fxp.c b/sys/dev/fxp/if_fxp.c
index 28d0686..7a4c452 100644
--- a/sys/dev/fxp/if_fxp.c
+++ b/sys/dev/fxp/if_fxp.c
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: if_fxp.c,v 1.16 1996/09/19 09:15:20 davidg Exp $
+ * $Id: if_fxp.c,v 1.17 1996/09/20 04:11:53 davidg Exp $
*/
/*
@@ -979,21 +979,30 @@ fxp_add_rfabuf(sc, oldm)
MCLGET(m, M_DONTWAIT);
if ((m->m_flags & M_EXT) == 0) {
m_freem(m);
+ if (oldm == NULL)
+ return 1;
m = oldm;
+ m->m_data = m->m_ext.ext_buf;
}
} else {
+ if (oldm == NULL)
+ return 1;
m = oldm;
+ m->m_data = m->m_ext.ext_buf;
}
- if (m == NULL)
- return 1;
+ /*
+ * Get a pointer to the base of the mbuf cluster and move
+ * data start past it.
+ */
rfa = mtod(m, struct fxp_rfa *);
+ m->m_data += sizeof(struct fxp_rfa);
+ rfa->size = MCLBYTES - sizeof(struct fxp_rfa);
+
rfa->rfa_status = 0;
rfa->rfa_control = FXP_RFA_CONTROL_EL;
rfa->link_addr = -1;
rfa->rbd_addr = -1;
rfa->actual_size = 0;
- rfa->size = MCLBYTES - sizeof(struct fxp_rfa);
- m->m_data += sizeof(struct fxp_rfa);
/*
* If there are other buffers already on the list, attach this
* one to the end by fixing up the tail to point to this one.
OpenPOWER on IntegriCloud