mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
net: qede: initialize extack in qede_flow_spec_to_rule()
qede_flow_spec_to_rule() declares a netlink_ext_ack on the stack
without initializing it. qede_parse_flow_attr() and
qede_flow_spec_validate() only set extack._msg on error paths via
NL_SET_ERR_MSG_MOD(), so on a successful parse the err_out block
reads an uninitialized pointer. If that garbage happens to be
non-NULL, DP_NOTICE("%s", extack._msg) dereferences it inside
vsnprintf, causing a page fault and kernel panic.
This manifests when configuring ethtool ntuple flow rules (ethtool -U
flow-type tcp4/udp4) on kernels built with CONFIG_INIT_STACK_NONE=y.
With CONFIG_INIT_STACK_ALL_ZERO=y the bug is masked because the
compiler zero-initializes extack, making _msg NULL.
Reproduced on RHEL 9.8 (kernel-5.14.0-687.47.1.el9_8) and mainline
(v7.3-rc6) with the following reproducer:
IFACE=ens2f0
ip link set $IFACE up
ethtool -K $IFACE ntuple on
for i in $(seq 1 100); do
ethtool -U $IFACE flow-type udp4 src-ip 192.168.2.$i action -1
done
The loop panics reliably after 10-15 iterations with:
BUG: unable to handle page fault
RIP: string+0x49/0xd0
Call Trace:
vsnprintf
qede_flow_spec_to_rule+0x2b6/0x4b0 [qede]
qede_add_cls_rule
ethtool_set_rxnfc
Zero-initialize extack so _msg is NULL unless explicitly set by an
error path.
Fixes: eb705d7345 ("net: qede: use faked extack in qede_flow_spec_to_rule()")
Signed-off-by: Anirudh Virdi <avirdi@redhat.com>
Reviewed-by: Asbjørn Sloth Tønnesen <ast@fiberby.net>
Reviewed-by: Daniel Machon <daniel.machon@microchip.com>
Link: https://patch.msgid.link/20261013105451.201211-1-avirdi@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
504bdcb8c1
commit
106e562966
|
|
@ -1991,8 +1991,8 @@ static int qede_flow_spec_to_rule(struct qede_dev *edev,
|
|||
struct ethtool_rx_flow_spec *fs)
|
||||
{
|
||||
struct ethtool_rx_flow_spec_input input = {};
|
||||
struct netlink_ext_ack extack = {};
|
||||
struct ethtool_rx_flow_rule *flow;
|
||||
struct netlink_ext_ack extack;
|
||||
__be16 proto;
|
||||
int err;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user