net: renesas: rswitch: fix leaked pointer on error path
authorNikita Yushchenko <nikita.yoush@cogentembedded.com>
Sun, 8 Dec 2024 09:50:03 +0000 (14:50 +0500)
committerJakub Kicinski <kuba@kernel.org>
Wed, 11 Dec 2024 03:02:47 +0000 (19:02 -0800)
commitbb617328bafa1023d8e9c25a25345a564c66c14f
treeccb0a2bcdf7b3d8b096ac38994f32ee8e8eba986
parent0c9547e6ccf40455b0574cf589be3b152a3edf5b
net: renesas: rswitch: fix leaked pointer on error path

If error path is taken while filling descriptor for a frame, skb
pointer is left in the entry. Later, on the ring entry reuse, the
same entry could be used as a part of a multi-descriptor frame,
and skb for that new frame could be stored in a different entry.

Then, the stale pointer will reach the completion routine, and passed
to the release operation.

Fix that by clearing the saved skb pointer at the error path.

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-4-nikita.yoush@cogentembedded.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/renesas/rswitch.c