summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorWei Yongjun <weiyongjun1@huawei.com>2022-11-14 11:05:19 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-11-25 17:40:24 +0100
commit0ef17d966445358a55c5f4ccf2c73cca3e39192b (patch)
tree8b99d8d2955b9148a2311fa737dca52b5861111c /net
parentbf47ca1b35fc1f55091ffaff5fbe41ea0c6f59a1 (diff)
downloadlinux-0ef17d966445358a55c5f4ccf2c73cca3e39192b.tar.gz
linux-0ef17d966445358a55c5f4ccf2c73cca3e39192b.tar.bz2
linux-0ef17d966445358a55c5f4ccf2c73cca3e39192b.zip
net/x25: Fix skb leak in x25_lapb_receive_frame()
[ Upstream commit 2929cceb2fcf0ded7182562e4888afafece82cce ] x25_lapb_receive_frame() using skb_copy() to get a private copy of skb, the new skb should be freed in the undersized/fragmented skb error handling path. Otherwise there is a memory leak. Fixes: cb101ed2c3c7 ("x25: Handle undersized/fragmented skbs") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Acked-by: Martin Schiller <ms@dev.tdt.de> Link: https://lore.kernel.org/r/20221114110519.514538-1-weiyongjun@huaweicloud.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net')
-rw-r--r--net/x25/x25_dev.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/x25/x25_dev.c b/net/x25/x25_dev.c
index 30f71620d4e3..24f2676e3b66 100644
--- a/net/x25/x25_dev.c
+++ b/net/x25/x25_dev.c
@@ -122,7 +122,7 @@ int x25_lapb_receive_frame(struct sk_buff *skb, struct net_device *dev,
if (!pskb_may_pull(skb, 1)) {
x25_neigh_put(nb);
- return 0;
+ goto drop;
}
switch (skb->data[0]) {