Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1731026

[PATCH 3.18 07/19] driver core: bus: Fix a potential double free

From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject [PATCH 3.18 07/19] driver core: bus: Fix a potential double free
Date 2017-09-12 19:00 +0200
Message-ID <uoWHy-3KO-63@gated-at.bofh.it> (permalink)
References <uoWHv-3KO-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


3.18-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

commit 0f9b011d3321ca1079c7a46c18cb1956fbdb7bcb upstream.

The .release function of driver_ktype is 'driver_release()'.
This function frees the container_of this kobject.

So, this memory must not be freed explicitly in the error handling path of
'bus_add_driver()'. Otherwise a double free will occur.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/base/bus.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -722,7 +722,7 @@ int bus_add_driver(struct device_driver
 
 out_unregister:
 	kobject_put(&priv->kobj);
-	kfree(drv->p);
+	/* drv->p is freed in driver_release()  */
 	drv->p = NULL;
 out_put_bus:
 	bus_put(bus);

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 3.18 00/19] 3.18.71-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-09-12 19:00 +0200
  [PATCH 3.18 02/19] USB: serial: option: add support for D-Link DWM-157 C1 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-09-12 19:00 +0200
  [PATCH 3.18 07/19] driver core: bus: Fix a potential double free Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-09-12 19:00 +0200
  [PATCH 3.18 05/19] USB: core: Avoid race of async_completed() w/ usbdev_release() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-09-12 19:20 +0200
  [PATCH 3.18 03/19] usb: Add device quirk for Logitech HD Pro Webcam C920-C Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-09-12 19:30 +0200
  [PATCH 3.18 11/19] workqueue: Fix flag collision Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-09-12 19:30 +0200
  [PATCH 3.18 04/19] usb:xhci:Fix regression when ATI chipsets detected Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-09-12 19:30 +0200
  [PATCH 3.18 12/19] cs5536: add support for IDE controller variant Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-09-12 19:30 +0200
  [PATCH 3.18 10/19] cma: fix calculation of aligned offset Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-09-12 19:30 +0200
  [PATCH 3.18 14/19] scsi: sg: recheck MMAP_IO request length with lock held Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-09-12 19:30 +0200
  [PATCH 3.18 17/19] ALSA: msnd: Optimize / harden DSP and MIDI loops Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-09-12 19:30 +0200
  [PATCH 3.18 01/19] usb: quirks: add delay init quirk for Corsair Strafe RGB keyboard Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-09-12 19:30 +0200
  Re: [PATCH 3.18 00/19] 3.18.71-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2017-09-13 02:20 +0200
  Re: [PATCH 3.18 00/19] 3.18.71-stable review Guenter Roeck <linux@roeck-us.net> - 2017-09-13 16:40 +0200

csiph-web