linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 net] net/sched: mqprio: fix stack out-of-bounds write in tc entry parsing
@ 2025-07-29 15:39 maher azz
  2025-08-01 22:06 ` Jakub Kicinski
  0 siblings, 1 reply; 6+ messages in thread
From: maher azz @ 2025-07-29 15:39 UTC (permalink / raw)
  To: netdev
  Cc: linux-kernel, Jamal Hadi Salim, Cong Wang, jiri, davem,
	Eric Dumazet, kuba, pabeni, Simon Horman, Ferenc Fejes,
	Vladimir Oltean, MaherAzzouzi

From: Maher Azzouzi <maherazz04@gmail.com>

TCA_MQPRIO_TC_ENTRY_INDEX is validated using
NLA_POLICY_MAX(NLA_U32, TC_QOPT_MAX_QUEUE), which allows the value
TC_QOPT_MAX_QUEUE (16). This leads to a 4-byte out-of-bounds stack write in
the fp[] array, which only has room for 16 elements (0–15).

Fix this by changing the policy to allow only up to TC_QOPT_MAX_QUEUE - 1.

Fixes: f62af20bed2d ("net/sched: mqprio: allow per-TC user input of FP
adminStatus")

Signed-off-by: Maher Azzouzi <maherazz04@gmail.com>
---
 net/sched/sch_mqprio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sched/sch_mqprio.c b/net/sched/sch_mqprio.c
index 51d4013b6121..f3e5ef9a9592 100644
--- a/net/sched/sch_mqprio.c
+++ b/net/sched/sch_mqprio.c
@@ -152,7 +152,7 @@ static int mqprio_parse_opt(struct net_device
*dev, struct tc_mqprio_qopt *qopt,
 static const struct
 nla_policy mqprio_tc_entry_policy[TCA_MQPRIO_TC_ENTRY_MAX + 1] = {
        [TCA_MQPRIO_TC_ENTRY_INDEX]     = NLA_POLICY_MAX(NLA_U32,
-                                                        TC_QOPT_MAX_QUEUE),
+                                                        TC_QOPT_MAX_QUEUE - 1),
        [TCA_MQPRIO_TC_ENTRY_FP]        = NLA_POLICY_RANGE(NLA_U32,
                                                           TC_FP_EXPRESS,
                                                           TC_FP_PREEMPTIBLE),
--
2.34.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 net] net/sched: mqprio: fix stack out-of-bounds write in tc entry parsing
       [not found] <CAFQ-Uc_5nAo6ymVkCda5+_y+bT=GngFibankmfdL8_Mu-4cqfQ@mail.gmail.com>
@ 2025-07-29 16:02 ` Eric Dumazet
  0 siblings, 0 replies; 6+ messages in thread
From: Eric Dumazet @ 2025-07-29 16:02 UTC (permalink / raw)
  To: maher azz
  Cc: netdev, linux-kernel, Jamal Hadi Salim, Cong Wang, jiri, davem,
	kuba, pabeni, Simon Horman, Ferenc Fejes, Vladimir Oltean

On Tue, Jul 29, 2025 at 8:36 AM maher azz <maherazz04@gmail.com> wrote:
>
> From: Maher Azzouzi <maherazz04@gmail.com>
>
> TCA_MQPRIO_TC_ENTRY_INDEX is validated using
> NLA_POLICY_MAX(NLA_U32, TC_QOPT_MAX_QUEUE), which allows the value
> TC_QOPT_MAX_QUEUE (16). This leads to a 4-byte out-of-bounds stack write in
> the fp[] array, which only has room for 16 elements (0–15).
>
> Fix this by changing the policy to allow only up to TC_QOPT_MAX_QUEUE - 1.
>
> Fixes: f62af20bed2d ("net/sched: mqprio: allow per-TC user input of FP adminStatus")
>
> Signed-off-by: Maher Azzouzi <maherazz04@gmail.com>
>

Reviewed-by: Eric Dumazet <edumazet@google.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 net] net/sched: mqprio: fix stack out-of-bounds write in tc entry parsing
  2025-07-29 15:39 [PATCH v2 net] net/sched: mqprio: fix stack out-of-bounds write in tc entry parsing maher azz
@ 2025-08-01 22:06 ` Jakub Kicinski
       [not found]   ` <CAFQ-Uc-15B7eiE9uFWFzPDhj1sfbuzwmWMEA61UXbumybJ=yzw@mail.gmail.com>
  0 siblings, 1 reply; 6+ messages in thread
From: Jakub Kicinski @ 2025-08-01 22:06 UTC (permalink / raw)
  To: maher azz
  Cc: netdev, linux-kernel, Jamal Hadi Salim, Cong Wang, jiri, davem,
	Eric Dumazet, pabeni, Simon Horman, Ferenc Fejes, Vladimir Oltean

On Tue, 29 Jul 2025 16:39:26 +0100 maher azz wrote:
> From: Maher Azzouzi <maherazz04@gmail.com>
> 
> TCA_MQPRIO_TC_ENTRY_INDEX is validated using
> NLA_POLICY_MAX(NLA_U32, TC_QOPT_MAX_QUEUE), which allows the value
> TC_QOPT_MAX_QUEUE (16). This leads to a 4-byte out-of-bounds stack write in
> the fp[] array, which only has room for 16 elements (0–15).
> 
> Fix this by changing the policy to allow only up to TC_QOPT_MAX_QUEUE - 1.
> 
> Fixes: f62af20bed2d ("net/sched: mqprio: allow per-TC user input of FP
> adminStatus")

Don't wrap the Fixes tags;

> 

no empty lines between tags;

> Signed-off-by: Maher Azzouzi <maherazz04@gmail.com>

your email client is corrupting the emails, tabs get replaced with
spaces. Please add the review tag you received from Eric on v1 and
try sending v3 with git send-email?
-- 
pw-bot: cr

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 net] net/sched: mqprio: fix stack out-of-bounds write in tc entry parsing
       [not found]   ` <CAFQ-Uc-15B7eiE9uFWFzPDhj1sfbuzwmWMEA61UXbumybJ=yzw@mail.gmail.com>
@ 2025-08-04 10:49     ` Simon Horman
  2025-08-04 10:50       ` Vladimir Oltean
  0 siblings, 1 reply; 6+ messages in thread
From: Simon Horman @ 2025-08-04 10:49 UTC (permalink / raw)
  To: maher azz
  Cc: Jakub Kicinski, netdev, linux-kernel, Jamal Hadi Salim, Cong Wang,
	jiri, davem, Eric Dumazet, pabeni, Ferenc Fejes, Vladimir Oltean

On Sat, Aug 02, 2025 at 12:25:24AM +0100, maher azz wrote:
> Can someone please do it instead of me just keep me as the reporter please?
> this is too complicated, it gets rejected even if im missing a space or a
> newline
> 
> Thanks for your help and time to review this.

Sure, will do.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 net] net/sched: mqprio: fix stack out-of-bounds write in tc entry parsing
  2025-08-04 10:49     ` Simon Horman
@ 2025-08-04 10:50       ` Vladimir Oltean
  2025-08-04 11:04         ` Simon Horman
  0 siblings, 1 reply; 6+ messages in thread
From: Vladimir Oltean @ 2025-08-04 10:50 UTC (permalink / raw)
  To: Simon Horman
  Cc: maher azz, Jakub Kicinski, netdev, linux-kernel, Jamal Hadi Salim,
	Cong Wang, jiri, davem, Eric Dumazet, pabeni, Ferenc Fejes

On Mon, Aug 04, 2025 at 11:49:37AM +0100, Simon Horman wrote:
> On Sat, Aug 02, 2025 at 12:25:24AM +0100, maher azz wrote:
> > Can someone please do it instead of me just keep me as the reporter please?
> > this is too complicated, it gets rejected even if im missing a space or a
> > newline
> > 
> > Thanks for your help and time to review this.
> 
> Sure, will do.

Jakub already sent MessageID 20250802001857.2702497-1-kuba@kernel.org.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 net] net/sched: mqprio: fix stack out-of-bounds write in tc entry parsing
  2025-08-04 10:50       ` Vladimir Oltean
@ 2025-08-04 11:04         ` Simon Horman
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2025-08-04 11:04 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: maher azz, Jakub Kicinski, netdev, linux-kernel, Jamal Hadi Salim,
	Cong Wang, jiri, davem, Eric Dumazet, pabeni, Ferenc Fejes

On Mon, Aug 04, 2025 at 01:50:46PM +0300, Vladimir Oltean wrote:
> On Mon, Aug 04, 2025 at 11:49:37AM +0100, Simon Horman wrote:
> > On Sat, Aug 02, 2025 at 12:25:24AM +0100, maher azz wrote:
> > > Can someone please do it instead of me just keep me as the reporter please?
> > > this is too complicated, it gets rejected even if im missing a space or a
> > > newline
> > > 
> > > Thanks for your help and time to review this.
> > 
> > Sure, will do.
> 
> Jakub already sent MessageID 20250802001857.2702497-1-kuba@kernel.org.

Thanks, I hadn't noticed that.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-08-04 11:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-29 15:39 [PATCH v2 net] net/sched: mqprio: fix stack out-of-bounds write in tc entry parsing maher azz
2025-08-01 22:06 ` Jakub Kicinski
     [not found]   ` <CAFQ-Uc-15B7eiE9uFWFzPDhj1sfbuzwmWMEA61UXbumybJ=yzw@mail.gmail.com>
2025-08-04 10:49     ` Simon Horman
2025-08-04 10:50       ` Vladimir Oltean
2025-08-04 11:04         ` Simon Horman
     [not found] <CAFQ-Uc_5nAo6ymVkCda5+_y+bT=GngFibankmfdL8_Mu-4cqfQ@mail.gmail.com>
2025-07-29 16:02 ` Eric Dumazet

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).