public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Cong Wang <xiyou.wangcong@gmail.com>
To: "Alan J. Wylie" <alan@wylie.me.uk>
Cc: "Holger Hoffstätte" <holger@applied-asynchrony.com>,
	"Jamal Hadi Salim" <jhs@mojatatu.com>,
	regressions@lists.linux.dev, "Jiri Pirko" <jiri@resnulli.us>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Octavian Purdila" <tavip@google.com>,
	"Toke Høiland-Jørgensen" <toke@redhat.com>,
	stable@vger.kernel.org, "Greg KH" <gregkh@linuxfoundation.org>
Subject: Re: [REGRESSION] 6.14.3 panic - kernel NULL pointer dereference in htb_dequeue
Date: Wed, 23 Apr 2025 12:32:58 -0700	[thread overview]
Message-ID: <aAlAakEUu4XSEdXF@pop-os.localdomain> (raw)
In-Reply-To: <20250423105131.7ab46a47@frodo.int.wylie.me.uk>

On Wed, Apr 23, 2025 at 10:51:49AM +0100, Alan J. Wylie wrote:
> On Tue, 22 Apr 2025 14:49:27 -0700
> Cong Wang <xiyou.wangcong@gmail.com> wrote:
> 
> > Although I am still trying to understand the NULL pointer, which seems
> > likely from:
> > 
> >  478                         if (p->inner.clprio[prio].ptr == cl->node + prio) {
> >  479                                 /* we are removing child which is pointed to from
> >  480                                  * parent feed - forget the pointer but remember
> >  481                                  * classid
> >  482                                  */
> >  483                                 p->inner.clprio[prio].last_ptr_id = cl->common.classid;
> >  484                                 p->inner.clprio[prio].ptr = NULL;
> >  485                         }
> > 
> > Does the following patch work? I mean not just fixing the crash, but
> > also not causing any other problem.
> 
> > ---
> > 
> > diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
> > index 4b9a639b642e..0cdc778fddef 100644
> > --- a/net/sched/sch_htb.c
> > +++ b/net/sched/sch_htb.c
> > @@ -348,7 +348,8 @@ static void htb_add_to_wait_tree(struct htb_sched *q,
> >   */
> >  static inline void htb_next_rb_node(struct rb_node **n)
> >  {
> > -	*n = rb_next(*n);
> > +	if (*n)
> > +		*n = rb_next(*n);
> >  }
> >  
> >  /**
> 
> There's been three of these: 
> 
> Apr 23 08:08:32 bilbo kernel: WARNING: CPU: 0 PID: 0 at htb_deactivate+0xd/0x30 [sch_htb]
> Apr 23 08:08:32 bilbo kernel: WARNING: CPU: 0 PID: 0 at htb_deactivate+0xd/0x30 [sch_htb]
> Apr 23 10:41:36 bilbo kernel: WARNING: CPU: 1 PID: 0 at htb_deactivate+0xd/0x30 [sch_htb]
> 
> But no panic.
> 
> I've run scripts/decode.sh on the last one.
> 

Thanks a lot for testing! This helped a lot to verify how far we can go
beyond the panic and what I still missed. To me it looks a bit
complicated for -stable if we make everything idempotent along the path.

Do you mind testing the following one instead? Please revert the
above one for htb_next_rb_node(). I think maybe this is the safest fix
we could have for -stable.

Thanks!

--------->

diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 4b9a639b642e..3786abbdc4c3 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -1487,7 +1487,8 @@ static void htb_qlen_notify(struct Qdisc *sch, unsigned long arg)
 
 	if (!cl->prio_activity)
 		return;
-	htb_deactivate(qdisc_priv(sch), cl);
+	if (!cl->leaf.q->q.qlen)
+		htb_deactivate(qdisc_priv(sch), cl);
 }
 
 static inline int htb_parent_last_child(struct htb_class *cl)

  reply	other threads:[~2025-04-23 19:33 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-21  9:40 [REGRESSION] 6.14.3 panic - kernel NULL pointer dereference in htb_dequeue Alan J. Wylie
2025-04-21 11:50 ` Holger Hoffstätte
2025-04-21 12:10   ` Alan J. Wylie
2025-04-21 19:06     ` Alan J. Wylie
2025-04-21 19:47       ` Holger Hoffstätte
2025-04-21 20:09         ` Alan J. Wylie
2025-04-22 16:51           ` Alan J. Wylie
2025-04-22 17:20             ` Holger Hoffstätte
2025-04-22 20:42               ` Cong Wang
2025-04-22 20:47                 ` Alan J. Wylie
2025-04-22 21:49                   ` Cong Wang
2025-04-23  9:51                     ` Alan J. Wylie
2025-04-23 19:32                       ` Cong Wang [this message]
2025-04-24  6:53                         ` Alan J. Wylie
2025-04-24 12:53                         ` Alan J. Wylie
2025-04-25 16:08                           ` Cong Wang
2025-04-27 19:11                           ` Cong Wang
2025-04-27 19:42                             ` Alan J. Wylie
2025-04-27 20:35                               ` Alan J. Wylie
2025-04-28 21:02                                 ` Cong Wang
2025-04-28 21:34                                   ` Alan J. Wylie
2025-04-28 23:59                                     ` Cong Wang
2025-04-28 11:45               ` Greg KH
2025-04-28 12:28                 ` Holger Hoffstätte
2025-04-28 23:38                 ` Cong Wang

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=aAlAakEUu4XSEdXF@pop-os.localdomain \
    --to=xiyou.wangcong@gmail.com \
    --cc=alan@wylie.me.uk \
    --cc=gregkh@linuxfoundation.org \
    --cc=holger@applied-asynchrony.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=regressions@lists.linux.dev \
    --cc=stable@vger.kernel.org \
    --cc=tavip@google.com \
    --cc=toke@redhat.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