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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170922134841.kxfwwn2yocjgnuad@mwanda>
Date:   Fri, 22 Sep 2017 16:48:41 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Mauro Carvalho Chehab <mchehab@...nel.org>
Cc:     Hans Verkuil <hans.verkuil@...co.com>,
        Bhumika Goyal <bhumirks@...il.com>,
        Arvind Yadav <arvind.yadav.cs@...il.com>,
        Sakari Ailus <sakari.ailus@...ux.intel.com>,
        Joe Perches <joe@...ches.com>, linux-media@...r.kernel.org,
        LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH] [media] stk-webcam: Fix use after free on disconnect

We free the stk_camera device too early.  It's allocate first in probe
and it should be freed last in stk_camera_disconnect().

Reported-by: Andrey Konovalov <andreyknvl@...gle.com>
Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
---
Not tested but these bug reports seem surprisingly straight forward.
Thanks Andrey!

diff --git a/drivers/media/usb/stkwebcam/stk-webcam.c b/drivers/media/usb/stkwebcam/stk-webcam.c
index c0bba773db25..e748c976d967 100644
--- a/drivers/media/usb/stkwebcam/stk-webcam.c
+++ b/drivers/media/usb/stkwebcam/stk-webcam.c
@@ -1241,7 +1241,6 @@ static void stk_v4l_dev_release(struct video_device *vd)
 	if (dev->sio_bufs != NULL || dev->isobufs != NULL)
 		pr_err("We are leaking memory\n");
 	usb_put_intf(dev->interface);
-	kfree(dev);
 }
 
 static const struct video_device stk_v4l_data = {
@@ -1391,6 +1390,7 @@ static void stk_camera_disconnect(struct usb_interface *interface)
 	video_unregister_device(&dev->vdev);
 	v4l2_ctrl_handler_free(&dev->hdl);
 	v4l2_device_unregister(&dev->v4l2_dev);
+	kfree(dev);
 }
 
 #ifdef CONFIG_PM

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ