]> git.itanic.dy.fi Git - linux-stable/commit
sfc: fix null pointer dereference in efx_hard_start_xmit
authorÍñigo Huguet <ihuguet@redhat.com>
Wed, 14 Sep 2022 11:11:35 +0000 (13:11 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Sep 2022 09:10:33 +0000 (11:10 +0200)
commitb3b41d4d95d3822b2e459ecbc80d030ea6aec5e7
treeaaeaddf47629326a37cb2c88f9d5b98da1f1dcb4
parentb4afd3878f961d3517f27b3213730fceef77945c
sfc: fix null pointer dereference in efx_hard_start_xmit

[ Upstream commit 0a242eb2913a4aa3d6fbdb86559f27628e9466f3 ]

Trying to get the channel from the tx_queue variable here is wrong
because we can only be here if tx_queue is NULL, so we shouldn't
dereference it. As the above comment in the code says, this is very
unlikely to happen, but it's wrong anyway so let's fix it.

I hit this issue because of a different bug that caused tx_queue to be
NULL. If that happens, this is the error message that we get here:
  BUG: unable to handle kernel NULL pointer dereference at 0000000000000020
  [...]
  RIP: 0010:efx_hard_start_xmit+0x153/0x170 [sfc]

Fixes: 12804793b17c ("sfc: decouple TXQ type from label")
Reported-by: Tianhao Zhao <tizhao@redhat.com>
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
Acked-by: Edward Cree <ecree.xilinx@gmail.com>
Link: https://lore.kernel.org/r/20220914111135.21038-1-ihuguet@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/sfc/tx.c