]> 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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Sep 2022 09:32:21 +0000 (11:32 +0200)
commit32afa1f23e42cc635ccf4c39f24514d03d1e8338
tree6ccabd3f8c7f0749a8bed916a502fb8467b8ef9e
parent0559d91ee3a2cd81b15ad5cd507539d6da867f88
bnxt: prevent skb UAF after handing over to PTP worker

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