]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: mctp: take ownership of skb in mctp_local_output
authorJeremy Kerr <jk@codeconstruct.com.au>
Tue, 20 Feb 2024 08:10:53 +0000 (16:10 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 6 Mar 2024 14:48:34 +0000 (14:48 +0000)
commitcbebc55ceacef1fc0651e80e0103cc184552fc68
treee64a63a37a9559775260fdeee43e05340caf45a6
parenta0a1db40b23e8ff86dea2786c5ea1470bb23ecb9
net: mctp: take ownership of skb in mctp_local_output

[ Upstream commit 3773d65ae5154ed7df404b050fd7387a36ab5ef3 ]

Currently, mctp_local_output only takes ownership of skb on success, and
we may leak an skb if mctp_local_output fails in specific states; the
skb ownership isn't transferred until the actual output routing occurs.

Instead, make mctp_local_output free the skb on all error paths up to
the route action, so it always consumes the passed skb.

Fixes: 833ef3b91de6 ("mctp: Populate socket implementation")
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20240220081053.1439104-1-jk@codeconstruct.com.au
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/net/mctp.h
net/mctp/route.c