+ drivers-base-check-if-device-is-registered-before-removal.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     drivers/base: check if device is registered before removal

has been added to the -mm tree.  Its filename is

     drivers-base-check-if-device-is-registered-before-removal.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: drivers/base: check if device is registered before removal
From: Jaroslav Kysela <perex@xxxxxxx>

The platform device layer should play more nicely and if probe() fails for
a reason and if platform_device_register_simple() does not set IS_ERR(),
then platform_device_unregister() must be callable to free all resources.

The problematic change is in commit
f2eaae197f4590c4d96f31b09b0ee9067421a95c and this patch fixes it.

This fixes Jiri's oops.

Signed-off-by: Jaroslav Kysela <perex@xxxxxxx>
Cc: Jiri Kosina <jikos@xxxxxxxx>
Cc: Greg KH <greg@xxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 drivers/base/bus.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff -puN drivers/base/bus.c~drivers-base-check-if-device-is-registered-before-removal drivers/base/bus.c
--- a/drivers/base/bus.c~drivers-base-check-if-device-is-registered-before-removal
+++ a/drivers/base/bus.c
@@ -439,8 +439,10 @@ void bus_remove_device(struct device * d
 		sysfs_remove_link(&dev->kobj, "bus");
 		sysfs_remove_link(&dev->bus->devices.kobj, dev->bus_id);
 		device_remove_attrs(dev->bus, dev);
-		dev->is_registered = 0;
-		klist_del(&dev->knode_bus);
+		if (dev->is_registered) {
+			dev->is_registered = 0;
+			klist_del(&dev->knode_bus);
+		}
 		pr_debug("bus %s: remove device %s\n", dev->bus->name, dev->bus_id);
 		device_release_driver(dev);
 		put_bus(dev->bus);
_

Patches currently in -mm which might be from perex@xxxxxxx are

dereference-after-free-in-snd_hwdep_release.patch
drivers-base-check-if-device-is-registered-before-removal.patch
sound-usb-usbaudio-handle-return-value-of-usb_register.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux