]> git.baikalelectronics.ru Git - 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)
committerJakub Kicinski <kuba@kernel.org>
Thu, 22 Sep 2022 14:33:17 +0000 (07:33 -0700)
commitc6fc58400e12811934f0cd8955da1c7ee6386765
tree3a8a2ac4e7ee88d6dfde72b4b9948c4c2708db81
parentea5f3a2d03e9b879932e414ec4025741f185b50c
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: bdd9258cb478 ("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