* [PATCH] NFC: pn533: fix use-after-free and memleaks
[not found] <000000000000f0d74d0594536e2c@google.com>
@ 2019-10-07 16:40 ` Johan Hovold
2019-10-09 0:03 ` Jakub Kicinski
0 siblings, 1 reply; 2+ messages in thread
From: Johan Hovold @ 2019-10-07 16:40 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, Andrey Rusalin, Lars Poeschel, linux-usb,
Johan Hovold, syzbot+cb035c75c03dbe34b796, stable
The driver would fail to deregister and its class device and free
related resources on late probe errors.
Reported-by: syzbot+cb035c75c03dbe34b796@syzkaller.appspotmail.com
Fixes: 32ecc75ded72 ("NFC: pn533: change order operations in dev registation")
Cc: stable <stable@vger.kernel.org> # 4.11
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/nfc/pn533/usb.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/nfc/pn533/usb.c b/drivers/nfc/pn533/usb.c
index c5289eaf17ee..e897e4d768ef 100644
--- a/drivers/nfc/pn533/usb.c
+++ b/drivers/nfc/pn533/usb.c
@@ -547,18 +547,25 @@ static int pn533_usb_probe(struct usb_interface *interface,
rc = pn533_finalize_setup(priv);
if (rc)
- goto error;
+ goto err_deregister;
usb_set_intfdata(interface, phy);
return 0;
+err_deregister:
+ pn533_unregister_device(phy->priv);
error:
+ usb_kill_urb(phy->in_urb);
+ usb_kill_urb(phy->out_urb);
+ usb_kill_urb(phy->ack_urb);
+
usb_free_urb(phy->in_urb);
usb_free_urb(phy->out_urb);
usb_free_urb(phy->ack_urb);
usb_put_dev(phy->udev);
kfree(in_buf);
+ kfree(phy->ack_buffer);
return rc;
}
--
2.23.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] NFC: pn533: fix use-after-free and memleaks
2019-10-07 16:40 ` [PATCH] NFC: pn533: fix use-after-free and memleaks Johan Hovold
@ 2019-10-09 0:03 ` Jakub Kicinski
0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2019-10-09 0:03 UTC (permalink / raw)
To: Johan Hovold
Cc: netdev, linux-kernel, Andrey Rusalin, Lars Poeschel, linux-usb,
syzbot+cb035c75c03dbe34b796, stable
On Mon, 7 Oct 2019 18:40:59 +0200, Johan Hovold wrote:
> The driver would fail to deregister and its class device and free
> related resources on late probe errors.
>
> Reported-by: syzbot+cb035c75c03dbe34b796@syzkaller.appspotmail.com
> Fixes: 32ecc75ded72 ("NFC: pn533: change order operations in dev registation")
> Cc: stable <stable@vger.kernel.org> # 4.11
> Signed-off-by: Johan Hovold <johan@kernel.org>
Applied to net, thank you
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-10-09 0:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <000000000000f0d74d0594536e2c@google.com>
2019-10-07 16:40 ` [PATCH] NFC: pn533: fix use-after-free and memleaks Johan Hovold
2019-10-09 0:03 ` Jakub Kicinski
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).