netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Kuniyuki Iwashima <kuniyu@google.com>
Cc: Eric Dumazet <edumazet@google.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Paolo Abeni <pabeni@redhat.com>, Breno Leitao <leitao@debian.org>,
	Kuniyuki Iwashima <kuni1840@gmail.com>,
	netdev@vger.kernel.org,
	syzbot+8aa80c6232008f7b957d@syzkaller.appspotmail.com
Subject: Re: [PATCH v1 net] netdevsim: Fix wild pointer access in nsim_queue_free().
Date: Fri, 1 Aug 2025 14:14:24 -0700	[thread overview]
Message-ID: <20250801141424.4531c205@kernel.org> (raw)
In-Reply-To: <CAAVpQUCDNGxtk2Hu0P6f0Ec2-2bOdn9H=uq_hpZ3_P-zcxoiLw@mail.gmail.com>

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.

  reply	other threads:[~2025-08-01 21:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-31 18:48 [PATCH v1 net] netdevsim: Fix wild pointer access in nsim_queue_free() Kuniyuki Iwashima
2025-08-01  7:35 ` Eric Dumazet
2025-08-01 16:29   ` Kuniyuki Iwashima
2025-08-01 21:14     ` Jakub Kicinski [this message]
2025-08-11  7:03 ` Vivek BalachandharTN

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250801141424.4531c205@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuni1840@gmail.com \
    --cc=kuniyu@google.com \
    --cc=leitao@debian.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=syzbot+8aa80c6232008f7b957d@syzkaller.appspotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).