]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: renesas: rswitch: fix possible early skb release
authorNikita Yushchenko <nikita.yoush@cogentembedded.com>
Sun, 8 Dec 2024 09:50:01 +0000 (14:50 +0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 Dec 2024 17:13:16 +0000 (18:13 +0100)
commitf36e30822f1a4e6a2bbd936ced707af28ab356af
tree0e700ce6278f323e7da25d041b42feaf0bb75d8a
parent0dfcc215b4ce799df70a4ac330403404100b918d
net: renesas: rswitch: fix possible early skb release

[ Upstream commit 5cb099902b6b6292b3a85ffa1bb844e0ba195945 ]

When sending frame split into multiple descriptors, hardware processes
descriptors one by one, including writing back DT values. The first
descriptor could be already marked as completed when processing of
next descriptors for the same frame is still in progress.

Although only the last descriptor is configured to generate interrupt,
completion of the first descriptor could be noticed by the driver when
handling interrupt for the previous frame.

Currently, driver stores skb in the entry that corresponds to the first
descriptor. This results into skb could be unmapped and freed when
hardware did not complete the send yet. This opens a window for
corrupting the data being sent.

Fix this by saving skb in the entry that corresponds to the last
descriptor used to send the frame.

Fixes: d2c96b9d5f83 ("net: rswitch: Add jumbo frames handling for TX")
Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Link: https://patch.msgid.link/20241208095004.69468-2-nikita.yoush@cogentembedded.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/renesas/rswitch.c