]> git.ipfire.org Git - thirdparty/linux.git/commit
net: mctp: unshare packets when reassembling
authorMatt Johnston <matt@codeconstruct.com.au>
Thu, 6 Mar 2025 02:32:45 +0000 (10:32 +0800)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 11 Mar 2025 12:12:19 +0000 (13:12 +0100)
commitf5d83cf0eeb90fade4d5c4d17d24b8bee9ceeecc
tree3179df8aa9ef9dd3f494fed51c55d46ac13f4ba4
parent62531a1effa87bdab12d5104015af72e60d926ff
net: mctp: unshare packets when reassembling

Ensure that the frag_list used for reassembly isn't shared with other
packets. This avoids incorrect reassembly when packets are cloned, and
prevents a memory leak due to circular references between fragments and
their skb_shared_info.

The upcoming MCTP-over-USB driver uses skb_clone which can trigger the
problem - other MCTP drivers don't share SKBs.

A kunit test is added to reproduce the issue.

Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
Fixes: 4a992bbd3650 ("mctp: Implement message fragmentation & reassembly")
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250306-matt-mctp-usb-v1-1-085502b3dd28@codeconstruct.com.au
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
net/mctp/route.c
net/mctp/test/route-test.c