Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Nov 2017 21:57:04 +0000 (UTC)
From:      Stephen Hurd <shurd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r326033 - head/sys/net
Message-ID:  <201711202157.vAKLv4EJ089117@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: shurd
Date: Mon Nov 20 21:57:04 2017
New Revision: 326033
URL: https://svnweb.freebsd.org/changeset/base/326033

Log:
  Fix off-by-one error in bit_nclear() usage
  
  bit_nclear() takes the bit numbers for the start and end bits, not the start
  and a count.  This was resulting in memory corruption past the end of the
  bitstr_t.
  
  Sponsored by:	Limelight Networks

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==============================================================================
--- head/sys/net/iflib.c	Mon Nov 20 21:56:25 2017	(r326032)
+++ head/sys/net/iflib.c	Mon Nov 20 21:57:04 2017	(r326033)
@@ -2025,7 +2025,7 @@ iflib_fl_setup(iflib_fl_t fl)
 	if_ctx_t ctx = rxq->ifr_ctx;
 	if_softc_ctx_t sctx = &ctx->ifc_softc_ctx;
 
-	bit_nclear(fl->ifl_rx_bitmap, 0, fl->ifl_size);
+	bit_nclear(fl->ifl_rx_bitmap, 0, fl->ifl_size - 1);
 	/*
 	** Free current RX buffer structs and their mbufs
 	*/



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