* [PATCH] [net] Fix memory leak in htc_connect_service
@ 2023-05-05 8:55 Takeshi Misawa
2023-05-05 8:57 ` Kalle Valo
0 siblings, 1 reply; 3+ messages in thread
From: Takeshi Misawa @ 2023-05-05 8:55 UTC (permalink / raw)
To: netdev, linux-wireless
Cc: Toke Høiland-Jørgensen, Kalle Valo, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Vasanthakumar Thiagarajan, Sujith, John W. Linville,
Senthil Balasubramanian, linux-kernel
Timeout occurs in htc_connect_service(), then this function returns
without freeing skb.
Fix this by going to err path.
syzbot report:
https://syzkaller.appspot.com/bug?id=fbf138952d6c1115ba7d797cf7d56f6935184e3f
BUG: memory leak
unreferenced object 0xffff88810a980800 (size 240):
comm "kworker/1:1", pid 24, jiffies 4294947427 (age 16.220s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<ffffffff83b971c6>] __alloc_skb+0x206/0x270 net/core/skbuff.c:552
[<ffffffff82eb3731>] alloc_skb include/linux/skbuff.h:1270 [inline]
[<ffffffff82eb3731>] htc_connect_service+0x121/0x230 drivers/net/wireless/ath/ath9k/htc_hst.c:259
[<ffffffff82ec03a5>] ath9k_htc_connect_svc drivers/net/wireless/ath/ath9k/htc_drv_init.c:137 [inline]
[<ffffffff82ec03a5>] ath9k_init_htc_services.constprop.0+0xe5/0x390 drivers/net/wireless/ath/ath9k/htc_drv_init.c:157
[<ffffffff82ec0747>] ath9k_htc_probe_device+0xf7/0x8a0 drivers/net/wireless/ath/ath9k/htc_drv_init.c:959
[<ffffffff82eb3ef5>] ath9k_htc_hw_init+0x35/0x60 drivers/net/wireless/ath/ath9k/htc_hst.c:521
[<ffffffff82eb68dd>] ath9k_hif_usb_firmware_cb+0xcd/0x1f0 drivers/net/wireless/ath/ath9k/hif_usb.c:1243
[<ffffffff82aa835b>] request_firmware_work_func+0x4b/0x90 drivers/base/firmware_loader/main.c:1107
[<ffffffff8129a35a>] process_one_work+0x2ba/0x5f0 kernel/workqueue.c:2289
[<ffffffff8129ac7d>] worker_thread+0x5d/0x5b0 kernel/workqueue.c:2436
[<ffffffff812a4fa9>] kthread+0x129/0x170 kernel/kthread.c:376
[<ffffffff81002dcf>] ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
Fixes: fb9987d0f748 ("ath9k_htc: Support for AR9271 chipset.")
Reported-and-tested-by: syzbot+b68fbebe56d8362907e8@syzkaller.appspotmail.com
Signed-off-by: Takeshi Misawa <jeantsuru.cumc.mandola@gmail.com>
---
drivers/net/wireless/ath/ath9k/htc_hst.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c b/drivers/net/wireless/ath/ath9k/htc_hst.c
index ca05b07a45e6..6878da6d15b4 100644
--- a/drivers/net/wireless/ath/ath9k/htc_hst.c
+++ b/drivers/net/wireless/ath/ath9k/htc_hst.c
@@ -285,7 +285,8 @@ int htc_connect_service(struct htc_target *target,
if (!time_left) {
dev_err(target->dev, "Service connection timeout for: %d\n",
service_connreq->service_id);
- return -ETIMEDOUT;
+ ret = -ETIMEDOUT;
+ goto err;
}
*conn_rsp_epid = target->conn_rsp_epid;
--
2.39.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] [net] Fix memory leak in htc_connect_service
2023-05-05 8:55 [PATCH] [net] Fix memory leak in htc_connect_service Takeshi Misawa
@ 2023-05-05 8:57 ` Kalle Valo
2023-05-05 14:03 ` Takeshi Misawa
0 siblings, 1 reply; 3+ messages in thread
From: Kalle Valo @ 2023-05-05 8:57 UTC (permalink / raw)
To: Takeshi Misawa
Cc: netdev, linux-wireless, Toke Høiland-Jørgensen,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Vasanthakumar Thiagarajan, Sujith, John W. Linville,
Senthil Balasubramanian, linux-kernel
Takeshi Misawa <jeantsuru.cumc.mandola@gmail.com> writes:
> Timeout occurs in htc_connect_service(), then this function returns
> without freeing skb.
>
> Fix this by going to err path.
>
> syzbot report:
> https://syzkaller.appspot.com/bug?id=fbf138952d6c1115ba7d797cf7d56f6935184e3f
> BUG: memory leak
> unreferenced object 0xffff88810a980800 (size 240):
> comm "kworker/1:1", pid 24, jiffies 4294947427 (age 16.220s)
> hex dump (first 32 bytes):
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> backtrace:
> [<ffffffff83b971c6>] __alloc_skb+0x206/0x270 net/core/skbuff.c:552
> [<ffffffff82eb3731>] alloc_skb include/linux/skbuff.h:1270 [inline]
> [<ffffffff82eb3731>] htc_connect_service+0x121/0x230 drivers/net/wireless/ath/ath9k/htc_hst.c:259
> [<ffffffff82ec03a5>] ath9k_htc_connect_svc drivers/net/wireless/ath/ath9k/htc_drv_init.c:137 [inline]
> [<ffffffff82ec03a5>] ath9k_init_htc_services.constprop.0+0xe5/0x390 drivers/net/wireless/ath/ath9k/htc_drv_init.c:157
> [<ffffffff82ec0747>] ath9k_htc_probe_device+0xf7/0x8a0 drivers/net/wireless/ath/ath9k/htc_drv_init.c:959
> [<ffffffff82eb3ef5>] ath9k_htc_hw_init+0x35/0x60 drivers/net/wireless/ath/ath9k/htc_hst.c:521
> [<ffffffff82eb68dd>] ath9k_hif_usb_firmware_cb+0xcd/0x1f0 drivers/net/wireless/ath/ath9k/hif_usb.c:1243
> [<ffffffff82aa835b>] request_firmware_work_func+0x4b/0x90 drivers/base/firmware_loader/main.c:1107
> [<ffffffff8129a35a>] process_one_work+0x2ba/0x5f0 kernel/workqueue.c:2289
> [<ffffffff8129ac7d>] worker_thread+0x5d/0x5b0 kernel/workqueue.c:2436
> [<ffffffff812a4fa9>] kthread+0x129/0x170 kernel/kthread.c:376
> [<ffffffff81002dcf>] ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
>
> Fixes: fb9987d0f748 ("ath9k_htc: Support for AR9271 chipset.")
> Reported-and-tested-by: syzbot+b68fbebe56d8362907e8@syzkaller.appspotmail.com
> Signed-off-by: Takeshi Misawa <jeantsuru.cumc.mandola@gmail.com>
> ---
> drivers/net/wireless/ath/ath9k/htc_hst.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
The title should begin with "wifi: ath9k:", see more info from the wiki
link below.
Also ath9k patches go to ath-next, not to the net tree.
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] [net] Fix memory leak in htc_connect_service
2023-05-05 8:57 ` Kalle Valo
@ 2023-05-05 14:03 ` Takeshi Misawa
0 siblings, 0 replies; 3+ messages in thread
From: Takeshi Misawa @ 2023-05-05 14:03 UTC (permalink / raw)
To: Kalle Valo
Cc: netdev, linux-wireless, Toke Høiland-Jørgensen,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Vasanthakumar Thiagarajan, Sujith, John W. Linville,
Senthil Balasubramanian, linux-kernel
Thank you for your advice.
I will resend the modified patch later.
Regards,
On Fri, May 5, 2023 at 5:57 PM Kalle Valo <kvalo@kernel.org> wrote:
>
> Takeshi Misawa <jeantsuru.cumc.mandola@gmail.com> writes:
>
> > Timeout occurs in htc_connect_service(), then this function returns
> > without freeing skb.
> >
> > Fix this by going to err path.
> >
> > syzbot report:
> > https://syzkaller.appspot.com/bug?id=fbf138952d6c1115ba7d797cf7d56f6935184e3f
> > BUG: memory leak
> > unreferenced object 0xffff88810a980800 (size 240):
> > comm "kworker/1:1", pid 24, jiffies 4294947427 (age 16.220s)
> > hex dump (first 32 bytes):
> > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> > backtrace:
> > [<ffffffff83b971c6>] __alloc_skb+0x206/0x270 net/core/skbuff.c:552
> > [<ffffffff82eb3731>] alloc_skb include/linux/skbuff.h:1270 [inline]
> > [<ffffffff82eb3731>] htc_connect_service+0x121/0x230 drivers/net/wireless/ath/ath9k/htc_hst.c:259
> > [<ffffffff82ec03a5>] ath9k_htc_connect_svc drivers/net/wireless/ath/ath9k/htc_drv_init.c:137 [inline]
> > [<ffffffff82ec03a5>] ath9k_init_htc_services.constprop.0+0xe5/0x390 drivers/net/wireless/ath/ath9k/htc_drv_init.c:157
> > [<ffffffff82ec0747>] ath9k_htc_probe_device+0xf7/0x8a0 drivers/net/wireless/ath/ath9k/htc_drv_init.c:959
> > [<ffffffff82eb3ef5>] ath9k_htc_hw_init+0x35/0x60 drivers/net/wireless/ath/ath9k/htc_hst.c:521
> > [<ffffffff82eb68dd>] ath9k_hif_usb_firmware_cb+0xcd/0x1f0 drivers/net/wireless/ath/ath9k/hif_usb.c:1243
> > [<ffffffff82aa835b>] request_firmware_work_func+0x4b/0x90 drivers/base/firmware_loader/main.c:1107
> > [<ffffffff8129a35a>] process_one_work+0x2ba/0x5f0 kernel/workqueue.c:2289
> > [<ffffffff8129ac7d>] worker_thread+0x5d/0x5b0 kernel/workqueue.c:2436
> > [<ffffffff812a4fa9>] kthread+0x129/0x170 kernel/kthread.c:376
> > [<ffffffff81002dcf>] ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
> >
> > Fixes: fb9987d0f748 ("ath9k_htc: Support for AR9271 chipset.")
> > Reported-and-tested-by: syzbot+b68fbebe56d8362907e8@syzkaller.appspotmail.com
> > Signed-off-by: Takeshi Misawa <jeantsuru.cumc.mandola@gmail.com>
> > ---
> > drivers/net/wireless/ath/ath9k/htc_hst.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
>
> The title should begin with "wifi: ath9k:", see more info from the wiki
> link below.
>
> Also ath9k patches go to ath-next, not to the net tree.
>
> --
> https://patchwork.kernel.org/project/linux-wireless/list/
>
> https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-05-05 14:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-05 8:55 [PATCH] [net] Fix memory leak in htc_connect_service Takeshi Misawa
2023-05-05 8:57 ` Kalle Valo
2023-05-05 14:03 ` Takeshi Misawa
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.