* [PATCH] nfc: nfcmrvl: fix memory leak in nfcmrvl_usb_nci_send()
@ 2026-08-30 18:11 pavankumaryalagada
2026-09-08 19:48 ` Yalagada Pavan Kumar
0 siblings, 1 reply; 2+ messages in thread
From: pavankumaryalagada @ 2026-08-30 18:11 UTC (permalink / raw)
To: oe-linux-nfc
Cc: linux-kernel, david, johan, pavankumaryalagada, xujialu,
bartosz.golaszewski, kuba, u.kleine-koenig, skhan,
syzkaller-bugs, bzhao, syzbot+b197a0fb4e741cc5030e
From: Yalagada Pavan Kumar <pavankumaryalagada@gmail.com>
nfcmrvl_usb_nci_send() gets an skb from the NCI core and sends it
over USB. If the URB allocation or submission fails, the skb is
left allocated and leaks.
Free the skb when URB allocation or submission fails.
Fixes: f26e30cc6b50 ("NFC: nfcmrvl: Initial commit for Marvell NFC driver")
Reported-by: syzbot+b197a0fb4e741cc5030e@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=b197a0fb4e741cc5030e
Tested-by: syzbot+b197a0fb4e741cc5030e@syzkaller.appspotmail.com
Signed-off-by: Yalagada Pavan Kumar <pavankumaryalagada@gmail.com>
---
drivers/nfc/nfcmrvl/usb.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/nfc/nfcmrvl/usb.c b/drivers/nfc/nfcmrvl/usb.c
index c7f2afe00b93..7a4094797ba4 100644
--- a/drivers/nfc/nfcmrvl/usb.c
+++ b/drivers/nfc/nfcmrvl/usb.c
@@ -224,12 +224,16 @@ static int nfcmrvl_usb_nci_send(struct nfcmrvl_private *priv,
unsigned int pipe;
int err;
- if (!drv_data->bulk_tx_ep)
+ if (!drv_data->bulk_tx_ep) {
+ kfree_skb(skb);
return -ENODEV;
+ }
urb = usb_alloc_urb(0, GFP_ATOMIC);
- if (!urb)
+ if (!urb) {
+ kfree_skb(skb);
return -ENOMEM;
+ }
pipe = usb_sndbulkpipe(drv_data->udev,
drv_data->bulk_tx_ep->bEndpointAddress);
@@ -254,6 +258,7 @@ static int nfcmrvl_usb_nci_send(struct nfcmrvl_private *priv,
"urb %p submission failed (%d)\n", urb, -err);
kfree(urb->setup_packet);
usb_unanchor_urb(urb);
+ kfree_skb(skb);
} else {
usb_mark_last_busy(drv_data->udev);
}
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] nfc: nfcmrvl: fix memory leak in nfcmrvl_usb_nci_send()
2026-08-30 18:11 [PATCH] nfc: nfcmrvl: fix memory leak in nfcmrvl_usb_nci_send() pavankumaryalagada
@ 2026-09-08 19:48 ` Yalagada Pavan Kumar
0 siblings, 0 replies; 2+ messages in thread
From: Yalagada Pavan Kumar @ 2026-09-08 19:48 UTC (permalink / raw)
To: david
Cc: linux-kernel, johan, xujialu, bartosz.golaszewski, kuba,
u.kleine-koenig, skhan, syzkaller-bugs, bzhao, oe-linux-nfc,
syzbot+b197a0fb4e741cc5030e
Hi David,
Could you please review this patch when you get a chance?
Thanks,
Pavan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-08 19:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-30 18:11 [PATCH] nfc: nfcmrvl: fix memory leak in nfcmrvl_usb_nci_send() pavankumaryalagada
2026-09-08 19:48 ` Yalagada Pavan Kumar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®