From: Wei Yongjun <weiyongjun@huaweicloud.com>
To: Martin Schiller <ms@dev.tdt.de>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Andrew Hendry <andrew.hendry@gmail.com>,
Matthew Daley <mattjd@gmail.com>
Cc: Wei Yongjun <weiyongjun1@huawei.com>,
linux-x25@vger.kernel.org, netdev@vger.kernel.org
Subject: [PATCH net] net/x25: Fix skb leak in x25_lapb_receive_frame()
Date: Mon, 14 Nov 2022 11:05:19 +0000 [thread overview]
Message-ID: <20221114110519.514538-1-weiyongjun@huaweicloud.com> (raw)
From: Wei Yongjun <weiyongjun1@huawei.com>
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>
---
net/x25/x25_dev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/x25/x25_dev.c b/net/x25/x25_dev.c
index 5259ef8f5242..748d8630ab58 100644
--- a/net/x25/x25_dev.c
+++ b/net/x25/x25_dev.c
@@ -117,7 +117,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]) {
--
2.34.1
next reply other threads:[~2022-11-14 11:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-14 11:05 Wei Yongjun [this message]
2022-11-14 11:53 ` [PATCH net] net/x25: Fix skb leak in x25_lapb_receive_frame() Martin Schiller
2022-11-16 4:30 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221114110519.514538-1-weiyongjun@huaweicloud.com \
--to=weiyongjun@huaweicloud.com \
--cc=andrew.hendry@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-x25@vger.kernel.org \
--cc=mattjd@gmail.com \
--cc=ms@dev.tdt.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=weiyongjun1@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).