Patch "net/sched: sch_fq: fix integer overflow of "credit"" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    net/sched: sch_fq: fix integer overflow of "credit"

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     net-sched-sch_fq-fix-integer-overflow-of-credit.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 2ac40ee9bede0ce4d94267f00855cd664980d1df
Author: Davide Caratti <dcaratti@xxxxxxxxxx>
Date:   Thu Apr 20 16:59:46 2023 +0200

    net/sched: sch_fq: fix integer overflow of "credit"
    
    [ Upstream commit 7041101ff6c3073fd8f2e99920f535b111c929cb ]
    
    if sch_fq is configured with "initial quantum" having values greater than
    INT_MAX, the first assignment of "credit" does signed integer overflow to
    a very negative value.
    In this situation, the syzkaller script provided by Cristoph triggers the
    CPU soft-lockup warning even with few sockets. It's not an infinite loop,
    but "credit" wasn't probably meant to be minus 2Gb for each new flow.
    Capping "initial quantum" to INT_MAX proved to fix the issue.
    
    v2: validation of "initial quantum" is done in fq_policy, instead of open
        coding in fq_change() _ suggested by Jakub Kicinski
    
    Reported-by: Christoph Paasch <cpaasch@xxxxxxxxx>
    Link: https://github.com/multipath-tcp/mptcp_net-next/issues/377
    Fixes: afe4fd062416 ("pkt_sched: fq: Fair Queue packet scheduler")
    Reviewed-by: Eric Dumazet <edumazet@xxxxxxxxxx>
    Signed-off-by: Davide Caratti <dcaratti@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/7b3a3c7e36d03068707a021760a194a8eb5ad41a.1682002300.git.dcaratti@xxxxxxxxxx
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/sched/sch_fq.c b/net/sched/sch_fq.c
index 2fb76fc0cc31b..5a1274199fe33 100644
--- a/net/sched/sch_fq.c
+++ b/net/sched/sch_fq.c
@@ -779,13 +779,17 @@ static int fq_resize(struct Qdisc *sch, u32 log)
 	return 0;
 }
 
+static struct netlink_range_validation iq_range = {
+	.max = INT_MAX,
+};
+
 static const struct nla_policy fq_policy[TCA_FQ_MAX + 1] = {
 	[TCA_FQ_UNSPEC]			= { .strict_start_type = TCA_FQ_TIMER_SLACK },
 
 	[TCA_FQ_PLIMIT]			= { .type = NLA_U32 },
 	[TCA_FQ_FLOW_PLIMIT]		= { .type = NLA_U32 },
 	[TCA_FQ_QUANTUM]		= { .type = NLA_U32 },
-	[TCA_FQ_INITIAL_QUANTUM]	= { .type = NLA_U32 },
+	[TCA_FQ_INITIAL_QUANTUM]	= NLA_POLICY_FULL_RANGE(NLA_U32, &iq_range),
 	[TCA_FQ_RATE_ENABLE]		= { .type = NLA_U32 },
 	[TCA_FQ_FLOW_DEFAULT_RATE]	= { .type = NLA_U32 },
 	[TCA_FQ_FLOW_MAX_RATE]		= { .type = NLA_U32 },



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux