]> git.itanic.dy.fi Git - linux-stable/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)
committerJakub Kicinski <kuba@kernel.org>
Thu, 22 Sep 2022 14:33:17 +0000 (07:33 -0700)
commitc31f26c8f69f776759cbbdfb38e40ea91aa0dd65
tree3a8a2ac4e7ee88d6dfde72b4b9948c4c2708db81
parent3aac7ada64d8c26ccc922f1ca966043c0dae88da
bnxt: prevent skb UAF after handing over to PTP worker

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>
drivers/net/ethernet/broadcom/bnxt/bnxt.c