From: zjp734690220@163.com
To: marcel@holtmann.org, johan.hedberg@gmail.com, luiz.dentz@gmail.com
Cc: linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org,
zhongjupeng <zhongjupeng@yulong.com>
Subject: [PATCH] bluetooth: fix memory leak in btusb_mtk_wmt_recv
Date: Fri, 29 Jan 2021 10:08:27 +0800 [thread overview]
Message-ID: <20210129020827.27784-1-zjp734690220@163.com> (raw)
From: zhongjupeng <zhongjupeng@yulong.com>
In btusb_mtk_wmt_recv if skb_clone fails, the alocated skb should be
released.
Signed-off-by: zhongjupeng <zhongjupeng@yulong.com>
---
drivers/bluetooth/btusb.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index ffec6bc..cf21bba 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -3217,8 +3217,10 @@ static void btusb_mtk_wmt_recv(struct urb *urb)
*/
if (test_bit(BTUSB_TX_WAIT_VND_EVT, &data->flags)) {
data->evt_skb = skb_clone(skb, GFP_ATOMIC);
- if (!data->evt_skb)
+ if (!data->evt_skb) {
+ kfree_skb(skb);
goto err_out;
+ }
}
err = hci_recv_frame(hdev, skb);
--
1.9.1
next reply other threads:[~2021-01-29 2:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-29 2:08 zjp734690220 [this message]
2021-01-29 3:27 ` bluetooth: fix memory leak in btusb_mtk_wmt_recv bluez.test.bot
[not found] ` <949194D0-DD66-4626-8577-9F228D142BF9@holtmann.org>
[not found] ` <20210130153909.00001f48@163.com>
[not found] ` <20210201120853.00002791@163.com>
2021-02-01 10:45 ` [PATCH] " Marcel Holtmann
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=20210129020827.27784-1-zjp734690220@163.com \
--to=zjp734690220@163.com \
--cc=johan.hedberg@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.org \
--cc=zhongjupeng@yulong.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 NNTP newsgroup(s).