From owner-freebsd-hackers@FreeBSD.ORG Sun Feb 20 21:03:59 2005 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E8F1816A4CE for ; Sun, 20 Feb 2005 21:03:59 +0000 (GMT) Received: from cyrus.watson.org (cyrus.watson.org [204.156.12.53]) by mx1.FreeBSD.org (Postfix) with ESMTP id A5AAB43D1D for ; Sun, 20 Feb 2005 21:03:59 +0000 (GMT) (envelope-from robert@fledge.watson.org) Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by cyrus.watson.org (Postfix) with SMTP id E130846B8A; Sun, 20 Feb 2005 16:03:58 -0500 (EST) Date: Sun, 20 Feb 2005 21:02:25 +0000 (GMT) From: Robert Watson X-Sender: robert@fledge.watson.org To: Max Laier In-Reply-To: <200502201936.31366.max@love2party.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-hackers@freebsd.org Subject: Re: Small bug fix from DragonFly / review requested X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Feb 2005 21:04:00 -0000 On Sun, 20 Feb 2005, Max Laier wrote: > Joerg Sonnenberger has discovered a problem in the snc(4) driver that > might result in packets showing up on bpf multiple times. See the > changelog for sys/dev/netif/snc/dp83932.c in their source tree[1]. > > Attached is a fix for HEAD. I am almost sure that it is right, but I'd > welcome a review as there might be a chance that sonicput() and the TX > interrupt free the mbuf before it gets to bpf. From my reading it seems > that the mbuf is "safe" until sc->mtd_free is altered (see comment). This change seems fine -- in the current world order, Giant will prevent the driver from preempting itself and freeing the mbuf, and if we get per-softc locking for snc, presumably that locking will provide the same protection. It may be worth annotating that we rely on non-preemption by the interrupt handler to avoid the mbuf being freed with a comment. Robert N M Watson