]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
sched: address a potential NULL pointer dereference in the GRED scheduler.
authorJun Yang <juny24602@gmail.com>
Wed, 5 Mar 2025 15:44:10 +0000 (23:44 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 22 Mar 2025 19:54:10 +0000 (12:54 -0700)
commit68896dd50180b38ea552e49a6a00b685321e5769
tree0544b1bef738415f77fcb98da58d7e952a30f76f
parent0befa32ac3f910296661f6daa28100fed18ce7da
sched: address a potential NULL pointer dereference in the GRED scheduler.

[ Upstream commit 115ef44a98220fddfab37a39a19370497cd718b9 ]

If kzalloc in gred_init returns a NULL pointer, the code follows the
error handling path, invoking gred_destroy. This, in turn, calls
gred_offload, where memset could receive a NULL pointer as input,
potentially leading to a kernel crash.

When table->opt is NULL in gred_init(), gred_change_table_def()
is not called yet, so it is not necessary to call ->ndo_setup_tc()
in gred_offload().

Signed-off-by: Jun Yang <juny24602@gmail.com>
Reviewed-by: Cong Wang <xiyou.wangcong@gmail.com>
Fixes: f25c0515c521 ("net: sched: gred: dynamically allocate tc_gred_qopt_offload")
Link: https://patch.msgid.link/20250305154410.3505642-1-juny24602@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/sched/sch_gred.c