]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
bnxt: prevent skb UAF after handing over to PTP worker
authorJakub Kicinski <kuba@kernel.org>
Wed, 21 Sep 2022 20:10:05 +0000 (13:10 -0700)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 23 Nov 2022 14:11:48 +0000 (15:11 +0100)
commit2718005c8c37de68e05445be4785e817cb4d991e
tree22bc1e46bfe76bb046bfeebdf5331e9c2a4c71a5
parent3fcb6bdb7d13adddce5c84dce76abf4c7f535fb9
bnxt: prevent skb UAF after handing over to PTP worker

BugLink: https://bugs.launchpad.net/bugs/1995420
[ Upstream commit c31f26c8f69f776759cbbdfb38e40ea91aa0dd65 ]

When reading the timestamp is required bnxt_tx_int() hands
over the ownership of the completed skb to the PTP worker.
The skb should not be used afterwards, as the worker may
run before the rest of our code and free the skb, leading
to a use-after-free.

Since dev_kfree_skb_any() accepts NULL make the loss of
ownership more obvious and set skb to NULL.

Fixes: 83bb623c968e ("bnxt_en: Transmit and retrieve packet timestamps")
Reviewed-by: Andy Gospodarek <gospo@broadcom.com>
Reviewed-by: Michael Chan <michael.chan@broadcom.com>
Link: https://lore.kernel.org/r/20220921201005.335390-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/net/ethernet/broadcom/bnxt/bnxt.c