lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 10 Jan 2021 08:54:36 +0000
From:   Bui Quang Minh <minhquangbui99@...il.com>
To:     syzbot+57281c762a3922e14dfe@...kaller.appspotmail.com
Cc:     a.darwish@...utronix.de, bigeasy@...utronix.de,
        gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org,
        linux-usb@...r.kernel.org, stern@...land.harvard.edu,
        syzkaller-bugs@...glegroups.com, tglx@...utronix.de,
        minhquangbui99@...il.com
Subject: [PATCH] can: mcba_usb: Fix memory leak when cancelling urb

In mcba_usb_read_bulk_callback(), when we don't resubmit the urb, we
need to deallocate the transfer buffer that is allocated in
mcba_usb_start().

Reported-by: syzbot+57281c762a3922e14dfe@...kaller.appspotmail.com
Signed-off-by: Bui Quang Minh <minhquangbui99@...il.com>
---
 drivers/net/can/usb/mcba_usb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/can/usb/mcba_usb.c b/drivers/net/can/usb/mcba_usb.c
index df54eb7d4b36..7375c384cbd2 100644
--- a/drivers/net/can/usb/mcba_usb.c
+++ b/drivers/net/can/usb/mcba_usb.c
@@ -584,6 +584,8 @@ static void mcba_usb_read_bulk_callback(struct urb *urb)
 	case -EPIPE:
 	case -EPROTO:
 	case -ESHUTDOWN:
+		usb_free_coherent(urb->dev, urb->transfer_buffer_length,
+					urb->transfer_buffer, urb->transfer_dma);
 		return;
 
 	default:
-- 
2.17.1

Powered by blists - more mailing lists