Jeremy Kerr ce1219c3f7 net: mctp: handle skb cleanup on sock_queue failures
Currently, we don't use the return value from sock_queue_rcv_skb, which
means we may leak skbs if a message is not successfully queued to a
socket.

Instead, ensure that we're freeing the skb where the sock hasn't
otherwise taken ownership of the skb by adding checks on the
sock_queue_rcv_skb() to invoke a kfree on failure.

In doing so, rather than using the 'rc' value to trigger the
kfree_skb(), use the skb pointer itself, which is more explicit.

Also, add a kunit test for the sock delivery failure cases.

Fixes: 4a992bbd3650 ("mctp: Implement message fragmentation & reassembly")
Cc: stable@vger.kernel.org
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Link: https://patch.msgid.link/20241218-mctp-next-v2-1-1c1729645eaa@codeconstruct.com.au
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2024-12-19 11:52:49 +01:00
..
2024-11-11 10:32:06 -08:00
2024-10-04 12:42:32 +01:00
2024-06-14 19:08:50 -07:00
2024-10-08 15:33:49 -07:00
2024-10-15 18:52:26 -07:00
2024-01-11 10:07:29 -08:00
2024-12-10 18:44:25 -08:00
2024-11-21 08:28:08 -08:00
2024-12-10 18:44:25 -08:00
2024-11-18 11:52:49 +00:00
2024-10-10 08:30:21 -07:00
2024-10-08 15:16:59 +02:00
2024-10-10 08:30:21 -07:00
2024-11-21 08:28:08 -08:00