From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C872221CC5B for ; Fri, 1 Aug 2025 21:14:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754082865; cv=none; b=GP15SK5W0EiiVl4kVBeFVrZcS+KYKayiW57q5M3IZeZ+NwaAWAVM6wh2phmAwM8z0K2D7JE8m+trEVdWb5gdz/sDmgVLGKP3wi8o4FlhDO+H5jaqxJvNbQLS7KBHC6N/x+8LBeL35kqhqvcoU7nFqhYIgN1XmILYvaHxCltDPZw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754082865; c=relaxed/simple; bh=y1AEVjbsL2BS+WnEoouveeKQFBU8EqTaIaPX7iArLTo=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=F7XkUHL7AT574b76ZqVhH0qyiVPDv4SIKLBzo6ouEP9X1d2ds/R+IkBPzS+PuX0fPv9EfBGsdrNlMMmwZfuN1zaL6WoqdKjzdj8GOAZIBAG+/IvSM7/06FLOaXSPdLA3seTPS4KU0H/gGJCeDXILdkhBWu6PpM9bYbOkZVN/W1g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kcQQ4o1S; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kcQQ4o1S" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2681C4CEE7; Fri, 1 Aug 2025 21:14:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1754082865; bh=y1AEVjbsL2BS+WnEoouveeKQFBU8EqTaIaPX7iArLTo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=kcQQ4o1SI9hAapXtV3G0UtZLWUl0cQU5LoCmvmz5oUxJTiAZNJM2fIpJeMEd7SFLw E1fI6r1u0jguQ0hXOsss/0CWi+6UJK2EnS6mUAdsT8h9wns/SrTpe4UsjX21dMHEu7 YYSwnYyDIjDvG0RIr1nJiksIvhiJubyi8EPhu1tt5oyCS/0j4E7RO85H5bLZLLIN64 RyWllaCKPR2T0zLLW+8eSBzeJy0GU5ybtU7+PrGDjOj8f/bM9Ra71SINTj0IMxs1ZB uf7DcS3HRptkZMsb9+lVsdYnr96ipuLwp4xI27Zhf5Uxbc12hsdIC2ZY7opq0U80wb tujSEOGJQ353g== Date: Fri, 1 Aug 2025 14:14:24 -0700 From: Jakub Kicinski To: Kuniyuki Iwashima Cc: Eric Dumazet , Andrew Lunn , "David S. Miller" , Paolo Abeni , Breno Leitao , Kuniyuki Iwashima , netdev@vger.kernel.org, syzbot+8aa80c6232008f7b957d@syzkaller.appspotmail.com Subject: Re: [PATCH v1 net] netdevsim: Fix wild pointer access in nsim_queue_free(). Message-ID: <20250801141424.4531c205@kernel.org> In-Reply-To: References: <20250731184829.1433735-1-kuniyu@google.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 1 Aug 2025 09:29:49 -0700 Kuniyuki Iwashima wrote: > > > hrtimer_cancel(&rq->napi_timer); > > > - local_bh_disable(); > > > - dev_dstats_rx_dropped_add(dev, rq->skb_queue.qlen); > > > - local_bh_enable(); > > > + > > > + if (likely(dev->reg_state != NETREG_UNINITIALIZED)) { > > > > I find this test about reg_state a bit fragile... > > > > I probably would have made dev_dstats_rx_dropped_add() a bit stronger, > > it is not used in a fast path. > > I thought I should avoid local_bh_disable() too, but yes, > it's unlikely and in the slow path. > > I'll use the blow diff in v2. Option 2 : if (rq->skb_queue.qlen) dev_dstats_rx_dropped_add(dev, rq->skb_queue.qlen); since there can't be any packets, yet. Up to you.