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  linux-cve-announce  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]
Message-ID: <94aa3e7fcbb225da66961a21c940406ada2bbd0b.camel@suse.com>
Date:   Thu, 22 Apr 2021 14:26:42 +0200
From:   Oliver Neukum <oneukum@...e.com>
To:     syzbot <syzbot+d1e69c888f0d3866ead4@...kaller.appspotmail.com>,
        gregkh@...uxfoundation.org, johan@...nel.org,
        linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org,
        mathias.nyman@...ux.intel.com, stern@...land.harvard.edu,
        syzkaller-bugs@...glegroups.com
Subject: Re: [syzbot] memory leak in usb_set_configuration (2)

Am Mittwoch, den 21.04.2021, 08:12 -0700 schrieb syzbot:
> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    9cdbf646 Merge tag 'io_uring-5.12-2021-04-16' of git://git..
> git tree:       upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=136ce5a6d00000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=fd35e661e44323ea
> dashboard link: https://syzkaller.appspot.com/bug?extid=d1e69c888f0d3866ead4
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=16ecba29d00000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=143cf955d00000
> 
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+d1e69c888f0d3866ead4@...kaller.appspotmail.com

#syz test: https://github.com/google/kasan.git 9cdbf646

>From 1704504f905fe8e3eb83d63cbbbe9af60f002585 Mon Sep 17 00:00:00 2001
From: Oliver Neukum <oneukum@...e.com>
Date: Thu, 22 Apr 2021 14:14:21 +0200
Subject: [PATCH] cpia2: unregister device on probe error

The v4l2 device must be unregistered in case probe() fails,
lest we get a leak.

Signed-off-by: Oliver Neukum <oneukum@...e.com>
---
 drivers/media/usb/cpia2/cpia2_usb.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/media/usb/cpia2/cpia2_usb.c b/drivers/media/usb/cpia2/cpia2_usb.c
index 3ab80a7b4498..db3b5d6d2d9a 100644
--- a/drivers/media/usb/cpia2/cpia2_usb.c
+++ b/drivers/media/usb/cpia2/cpia2_usb.c
@@ -844,15 +844,13 @@ static int cpia2_usb_probe(struct usb_interface *intf,
 	ret = set_alternate(cam, USBIF_CMDONLY);
 	if (ret < 0) {
 		ERR("%s: usb_set_interface error (ret = %d)\n", __func__, ret);
-		kfree(cam);
-		return ret;
+		goto error;
 	}
 
 
 	if((ret = cpia2_init_camera(cam)) < 0) {
 		ERR("%s: failed to initialize cpia2 camera (ret = %d)\n", __func__, ret);
-		kfree(cam);
-		return ret;
+		goto error;
 	}
 	LOG("  CPiA Version: %d.%02d (%d.%d)\n",
 	       cam->params.version.firmware_revision_hi,
@@ -872,11 +870,14 @@ static int cpia2_usb_probe(struct usb_interface *intf,
 	ret = cpia2_register_camera(cam);
 	if (ret < 0) {
 		ERR("%s: Failed to register cpia2 camera (ret = %d)\n", __func__, ret);
-		kfree(cam);
-		return ret;
+		goto error;
 	}
 
 	return 0;
+error:
+	v4l2_device_unregister(&cam->v4l2_dev);
+	kfree(cam);
+	return ret;
 }
 
 /******************************************************************************
-- 
2.26.2



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ