* [GIT PATCH] Driver Core fixes for 2.6.19-rc2
@ 2006-10-18 19:58 Greg KH
2006-10-18 20:08 ` [PATCH 1/16] Documentation: feature-removal-schedule typo Greg KH
0 siblings, 1 reply; 17+ messages in thread
From: Greg KH @ 2006-10-18 19:58 UTC (permalink / raw)
To: Linus Torvalds, Andrew Morton; +Cc: linux-kernel
Here are some driver core and sysfs fixes for 2.6.19-rc2.
All of these patches have been in the -mm tree for a quite a while.
Please pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6.git/
or if master.kernel.org hasn't synced up yet:
master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6.git/
Patches will be sent as a follow-on to this message to lkml for people
to see.
thanks,
greg k-h
Documentation/HOWTO | 20 +++++
Documentation/feature-removal-schedule.txt | 2 -
drivers/base/bus.c | 108 +++++++++++++++++-----------
drivers/base/class.c | 5 +
drivers/base/core.c | 26 +++++--
drivers/base/dd.c | 4 +
drivers/base/dmapool.c | 13 +++
drivers/base/topology.c | 3 -
fs/sysfs/file.c | 7 --
9 files changed, 123 insertions(+), 65 deletions(-)
---------------
Akinobu Mita:
driver core: kmalloc() failure check in driver_probe_device
Alan Stern:
Driver core: Don't ignore error returns from probing
Cornelia Huck:
driver core fixes: sysfs_create_link() retval check in class.c
driver core fixes: bus_add_attrs() retval check
driver core fixes: bus_add_device() cleanup on error
driver core fixes: device_add() cleanup on error
driver core fixes: device_create_file() retval check in dmapool.c
driver core fixes: sysfs_create_group() retval in topology.c
Diego Calleja:
HOWTO: bug report addition
Dominik Brodowski:
Documentation: feature-removal-schedule typo
Duncan Sands:
Driver core: plug device probe memory leak
Hidetoshi Seto:
sysfs: remove duplicated dput in sysfs_update_file
sysfs: update obsolete comment in sysfs_update_file
Jeff Garzik:
Driver core: bus: remove indentation level
Jesper Juhl:
Driver core: Don't leak 'old_class_name' in drivers/base/core.c::device_rename()
Matthew Wilcox:
Fix dev_printk() is now GPL-only
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 1/16] Documentation: feature-removal-schedule typo
2006-10-18 19:58 [GIT PATCH] Driver Core fixes for 2.6.19-rc2 Greg KH
@ 2006-10-18 20:08 ` Greg KH
2006-10-18 20:08 ` [PATCH 2/16] Driver core: plug device probe memory leak Greg KH
0 siblings, 1 reply; 17+ messages in thread
From: Greg KH @ 2006-10-18 20:08 UTC (permalink / raw)
To: linux-kernel; +Cc: Dominik Brodowski, Greg Kroah-Hartman
From: Dominik Brodowski <linux@dominikbrodowski.net>
Fix typo in newly added feature remove schedule item.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: Kay Sievers <kay.sievers@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
Documentation/feature-removal-schedule.txt | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index 24f3c63..1ac3c74 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -255,7 +255,7 @@ Who: Stephen Hemminger <shemminger@osdl.
What: PHYSDEVPATH, PHYSDEVBUS, PHYSDEVDRIVER in the uevent environment
-When: Oktober 2008
+When: October 2008
Why: The stacking of class devices makes these values misleading and
inconsistent.
Class devices should not carry any of these properties, and bus
--
1.4.2.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 2/16] Driver core: plug device probe memory leak
2006-10-18 20:08 ` [PATCH 1/16] Documentation: feature-removal-schedule typo Greg KH
@ 2006-10-18 20:08 ` Greg KH
2006-10-18 20:08 ` [PATCH 3/16] Fix dev_printk() is now GPL-only Greg KH
0 siblings, 1 reply; 17+ messages in thread
From: Greg KH @ 2006-10-18 20:08 UTC (permalink / raw)
To: linux-kernel; +Cc: Duncan Sands, Duncan Sands, Greg Kroah-Hartman
From: Duncan Sands <duncan.sands@free.fr>
Make sure data is freed if the kthread fails to start.
Signed-off-by: Duncan Sands <baldrick@free.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/base/dd.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index b5f43c3..ef7db69 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -178,7 +178,7 @@ int driver_probe_device(struct device_dr
probe_task = kthread_run(really_probe, data,
"probe-%s", dev->bus_id);
if (IS_ERR(probe_task))
- ret = PTR_ERR(probe_task);
+ ret = really_probe(data);
} else
ret = really_probe(data);
--
1.4.2.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 3/16] Fix dev_printk() is now GPL-only
2006-10-18 20:08 ` [PATCH 2/16] Driver core: plug device probe memory leak Greg KH
@ 2006-10-18 20:08 ` Greg KH
2006-10-18 20:08 ` [PATCH 4/16] HOWTO: bug report addition Greg KH
0 siblings, 1 reply; 17+ messages in thread
From: Greg KH @ 2006-10-18 20:08 UTC (permalink / raw)
To: linux-kernel; +Cc: Matthew Wilcox, Greg Kroah-Hartman
From: Matthew Wilcox <matthew@wil.cx>
Make dev_printk usable from non-GPL modules again
dev_printk now calls dev_driver_string. We want even proprietary modules
to be calling dev_printk, so the export of dev_driver_string needs to be
non-GPL-only.
Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/base/core.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/base/core.c b/drivers/base/core.c
index b224bb4..aee3743 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -44,7 +44,7 @@ const char *dev_driver_string(struct dev
return dev->driver ? dev->driver->name :
(dev->bus ? dev->bus->name : "");
}
-EXPORT_SYMBOL_GPL(dev_driver_string);
+EXPORT_SYMBOL(dev_driver_string);
#define to_dev(obj) container_of(obj, struct device, kobj)
#define to_dev_attr(_attr) container_of(_attr, struct device_attribute, attr)
--
1.4.2.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 4/16] HOWTO: bug report addition
2006-10-18 20:08 ` [PATCH 3/16] Fix dev_printk() is now GPL-only Greg KH
@ 2006-10-18 20:08 ` Greg KH
2006-10-18 20:08 ` [PATCH 5/16] sysfs: remove duplicated dput in sysfs_update_file Greg KH
0 siblings, 1 reply; 17+ messages in thread
From: Greg KH @ 2006-10-18 20:08 UTC (permalink / raw)
To: linux-kernel; +Cc: Diego Calleja, Greg Kroah-Hartman
From: Diego Calleja <diegocg@gmail.com>
I suspect that not many people is subscribed to the bugzilla mailing list,
not surprising since the URLs doesn't seem to be in the tree :)
After fixing my english, I wonder if the following patch could be applied...
Signed-off-by: Diego Calleja <diegocg@gmail.com>
Acked-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
Documentation/HOWTO | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/Documentation/HOWTO b/Documentation/HOWTO
index d6f3dd1..8d51c14 100644
--- a/Documentation/HOWTO
+++ b/Documentation/HOWTO
@@ -395,6 +395,26 @@ bugme-janitor mailing list (every change
+Managing bug reports
+--------------------
+
+One of the best ways to put into practice your hacking skills is by fixing
+bugs reported by other people. Not only you will help to make the kernel
+more stable, you'll learn to fix real world problems and you will improve
+your skills, and other developers will be aware of your presence. Fixing
+bugs is one of the best ways to get merits among other developers, because
+not many people like wasting time fixing other people's bugs.
+
+To work in the already reported bug reports, go to http://bugzilla.kernel.org.
+If you want to be advised of the future bug reports, you can subscribe to the
+bugme-new mailing list (only new bug reports are mailed here) or to the
+bugme-janitor mailing list (every change in the bugzilla is mailed here)
+
+ http://lists.osdl.org/mailman/listinfo/bugme-new
+ http://lists.osdl.org/mailman/listinfo/bugme-janitors
+
+
+
Mailing lists
-------------
--
1.4.2.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 5/16] sysfs: remove duplicated dput in sysfs_update_file
2006-10-18 20:08 ` [PATCH 4/16] HOWTO: bug report addition Greg KH
@ 2006-10-18 20:08 ` Greg KH
2006-10-18 20:08 ` [PATCH 6/16] sysfs: update obsolete comment " Greg KH
0 siblings, 1 reply; 17+ messages in thread
From: Greg KH @ 2006-10-18 20:08 UTC (permalink / raw)
To: linux-kernel; +Cc: Hidetoshi Seto, Greg Kroah-Hartman
From: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Following function can drops d_count twice against one reference
by lookup_one_len.
<SOURCE>
/**
* sysfs_update_file - update the modified timestamp on an object attribute.
* @kobj: object we're acting for.
* @attr: attribute descriptor.
*/
int sysfs_update_file(struct kobject * kobj, const struct attribute * attr)
{
struct dentry * dir = kobj->dentry;
struct dentry * victim;
int res = -ENOENT;
mutex_lock(&dir->d_inode->i_mutex);
victim = lookup_one_len(attr->name, dir, strlen(attr->name));
if (!IS_ERR(victim)) {
/* make sure dentry is really there */
if (victim->d_inode &&
(victim->d_parent->d_inode == dir->d_inode)) {
victim->d_inode->i_mtime = CURRENT_TIME;
fsnotify_modify(victim);
/**
* Drop reference from initial sysfs_get_dentry().
*/
dput(victim);
res = 0;
} else
d_drop(victim);
/**
* Drop the reference acquired from sysfs_get_dentry() above.
*/
dput(victim);
}
mutex_unlock(&dir->d_inode->i_mutex);
return res;
}
</SOURCE>
PCI-hotplug (drivers/pci/hotplug/pci_hotplug_core.c) is only user of
this function. I confirmed that dentry of /sys/bus/pci/slots/XXX/*
have negative d_count value.
This patch removes unnecessary dput().
Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Acked-by: Maneesh Soni <maneesh@in.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
fs/sysfs/file.c | 5 -----
1 files changed, 0 insertions(+), 5 deletions(-)
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 146f1de..93218cc 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -483,11 +483,6 @@ int sysfs_update_file(struct kobject * k
(victim->d_parent->d_inode == dir->d_inode)) {
victim->d_inode->i_mtime = CURRENT_TIME;
fsnotify_modify(victim);
-
- /**
- * Drop reference from initial sysfs_get_dentry().
- */
- dput(victim);
res = 0;
} else
d_drop(victim);
--
1.4.2.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 6/16] sysfs: update obsolete comment in sysfs_update_file
2006-10-18 20:08 ` [PATCH 5/16] sysfs: remove duplicated dput in sysfs_update_file Greg KH
@ 2006-10-18 20:08 ` Greg KH
2006-10-18 20:08 ` [PATCH 7/16] driver core fixes: sysfs_create_link() retval check in class.c Greg KH
0 siblings, 1 reply; 17+ messages in thread
From: Greg KH @ 2006-10-18 20:08 UTC (permalink / raw)
To: linux-kernel; +Cc: Hidetoshi Seto, Greg Kroah-Hartman
From: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
And the obsolete comment should be updated (or totally removed).
Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
fs/sysfs/file.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 93218cc..298303b 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -488,7 +488,7 @@ int sysfs_update_file(struct kobject * k
d_drop(victim);
/**
- * Drop the reference acquired from sysfs_get_dentry() above.
+ * Drop the reference acquired from lookup_one_len() above.
*/
dput(victim);
}
--
1.4.2.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 7/16] driver core fixes: sysfs_create_link() retval check in class.c
2006-10-18 20:08 ` [PATCH 6/16] sysfs: update obsolete comment " Greg KH
@ 2006-10-18 20:08 ` Greg KH
2006-10-18 20:08 ` [PATCH 8/16] driver core fixes: bus_add_attrs() retval check Greg KH
0 siblings, 1 reply; 17+ messages in thread
From: Greg KH @ 2006-10-18 20:08 UTC (permalink / raw)
To: linux-kernel; +Cc: Cornelia Huck, Greg Kroah-Hartman
From: Cornelia Huck <cornelia.huck@de.ibm.com>
Check for return value of sysfs_create_link() in class_device_add().
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/base/class.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/drivers/base/class.c b/drivers/base/class.c
index b32b77f..0ff267a 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -562,7 +562,10 @@ int class_device_add(struct class_device
goto out2;
/* add the needed attributes to this device */
- sysfs_create_link(&class_dev->kobj, &parent_class->subsys.kset.kobj, "subsystem");
+ error = sysfs_create_link(&class_dev->kobj,
+ &parent_class->subsys.kset.kobj, "subsystem");
+ if (error)
+ goto out3;
class_dev->uevent_attr.attr.name = "uevent";
class_dev->uevent_attr.attr.mode = S_IWUSR;
class_dev->uevent_attr.attr.owner = parent_class->owner;
--
1.4.2.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 8/16] driver core fixes: bus_add_attrs() retval check
2006-10-18 20:08 ` [PATCH 7/16] driver core fixes: sysfs_create_link() retval check in class.c Greg KH
@ 2006-10-18 20:08 ` Greg KH
2006-10-18 20:09 ` [PATCH 9/16] driver core fixes: bus_add_device() cleanup on error Greg KH
0 siblings, 1 reply; 17+ messages in thread
From: Greg KH @ 2006-10-18 20:08 UTC (permalink / raw)
To: linux-kernel; +Cc: Cornelia Huck, Greg Kroah-Hartman
From: Cornelia Huck <cornelia.huck@de.ibm.com>
Check return value of bus_add_attrs() in bus_register().
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/base/bus.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 12173d1..b90f6e6 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -732,11 +732,15 @@ int bus_register(struct bus_type * bus)
klist_init(&bus->klist_devices, klist_devices_get, klist_devices_put);
klist_init(&bus->klist_drivers, NULL, NULL);
- bus_add_attrs(bus);
+ retval = bus_add_attrs(bus);
+ if (retval)
+ goto bus_attrs_fail;
pr_debug("bus type '%s' registered\n", bus->name);
return 0;
+bus_attrs_fail:
+ kset_unregister(&bus->drivers);
bus_drivers_fail:
kset_unregister(&bus->devices);
bus_devices_fail:
--
1.4.2.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 9/16] driver core fixes: bus_add_device() cleanup on error
2006-10-18 20:08 ` [PATCH 8/16] driver core fixes: bus_add_attrs() retval check Greg KH
@ 2006-10-18 20:09 ` Greg KH
2006-10-18 20:09 ` [PATCH 10/16] driver core fixes: device_add() " Greg KH
0 siblings, 1 reply; 17+ messages in thread
From: Greg KH @ 2006-10-18 20:09 UTC (permalink / raw)
To: linux-kernel; +Cc: Cornelia Huck, Greg Kroah-Hartman
From: Cornelia Huck <cornelia.huck@de.ibm.com>
Correct cleanup in the error path of bus_add_device().
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/base/bus.c | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index b90f6e6..d516f7d 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -372,19 +372,30 @@ int bus_add_device(struct device * dev)
pr_debug("bus %s: add device %s\n", bus->name, dev->bus_id);
error = device_add_attrs(bus, dev);
if (error)
- goto out;
+ goto out_put;
error = sysfs_create_link(&bus->devices.kobj,
&dev->kobj, dev->bus_id);
if (error)
- goto out;
+ goto out_id;
error = sysfs_create_link(&dev->kobj,
&dev->bus->subsys.kset.kobj, "subsystem");
if (error)
- goto out;
+ goto out_subsys;
error = sysfs_create_link(&dev->kobj,
&dev->bus->subsys.kset.kobj, "bus");
+ if (error)
+ goto out_deprecated;
}
-out:
+ return 0;
+
+out_deprecated:
+ sysfs_remove_link(&dev->kobj, "subsystem");
+out_subsys:
+ sysfs_remove_link(&bus->devices.kobj, dev->bus_id);
+out_id:
+ device_remove_attrs(bus, dev);
+out_put:
+ put_bus(dev->bus);
return error;
}
--
1.4.2.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 10/16] driver core fixes: device_add() cleanup on error
2006-10-18 20:09 ` [PATCH 9/16] driver core fixes: bus_add_device() cleanup on error Greg KH
@ 2006-10-18 20:09 ` Greg KH
2006-10-18 20:09 ` [PATCH 11/16] driver core fixes: device_create_file() retval check in dmapool.c Greg KH
0 siblings, 1 reply; 17+ messages in thread
From: Greg KH @ 2006-10-18 20:09 UTC (permalink / raw)
To: linux-kernel; +Cc: Cornelia Huck, Greg Kroah-Hartman
From: Cornelia Huck <cornelia.huck@de.ibm.com>
Check for return code of device_create_file() and correct cleanup in
the error case in device_add().
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/base/core.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/base/core.c b/drivers/base/core.c
index aee3743..365f709 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -433,14 +433,16 @@ int device_add(struct device *dev)
if (dev->driver)
dev->uevent_attr.attr.owner = dev->driver->owner;
dev->uevent_attr.store = store_uevent;
- device_create_file(dev, &dev->uevent_attr);
+ error = device_create_file(dev, &dev->uevent_attr);
+ if (error)
+ goto attrError;
if (MAJOR(dev->devt)) {
struct device_attribute *attr;
attr = kzalloc(sizeof(*attr), GFP_KERNEL);
if (!attr) {
error = -ENOMEM;
- goto PMError;
+ goto ueventattrError;
}
attr->attr.name = "dev";
attr->attr.mode = S_IRUGO;
@@ -450,7 +452,7 @@ int device_add(struct device *dev)
error = device_create_file(dev, attr);
if (error) {
kfree(attr);
- goto attrError;
+ goto ueventattrError;
}
dev->devt_attr = attr;
@@ -507,6 +509,8 @@ int device_add(struct device *dev)
device_remove_file(dev, dev->devt_attr);
kfree(dev->devt_attr);
}
+ ueventattrError:
+ device_remove_file(dev, &dev->uevent_attr);
attrError:
kobject_uevent(&dev->kobj, KOBJ_REMOVE);
kobject_del(&dev->kobj);
--
1.4.2.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 11/16] driver core fixes: device_create_file() retval check in dmapool.c
2006-10-18 20:09 ` [PATCH 10/16] driver core fixes: device_add() " Greg KH
@ 2006-10-18 20:09 ` Greg KH
2006-10-18 20:09 ` [PATCH 12/16] driver core fixes: sysfs_create_group() retval in topology.c Greg KH
0 siblings, 1 reply; 17+ messages in thread
From: Greg KH @ 2006-10-18 20:09 UTC (permalink / raw)
To: linux-kernel; +Cc: Cornelia Huck, Greg Kroah-Hartman
From: Cornelia Huck <cornelia.huck@de.ibm.com>
Check for device_create_file() return value in dma_pool_create().
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/base/dmapool.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/base/dmapool.c b/drivers/base/dmapool.c
index 33c5cce..b2efbd4 100644
--- a/drivers/base/dmapool.c
+++ b/drivers/base/dmapool.c
@@ -141,11 +141,20 @@ dma_pool_create (const char *name, struc
init_waitqueue_head (&retval->waitq);
if (dev) {
+ int ret;
+
down (&pools_lock);
if (list_empty (&dev->dma_pools))
- device_create_file (dev, &dev_attr_pools);
+ ret = device_create_file (dev, &dev_attr_pools);
+ else
+ ret = 0;
/* note: not currently insisting "name" be unique */
- list_add (&retval->pools, &dev->dma_pools);
+ if (!ret)
+ list_add (&retval->pools, &dev->dma_pools);
+ else {
+ kfree(retval);
+ retval = NULL;
+ }
up (&pools_lock);
} else
INIT_LIST_HEAD (&retval->pools);
--
1.4.2.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 12/16] driver core fixes: sysfs_create_group() retval in topology.c
2006-10-18 20:09 ` [PATCH 11/16] driver core fixes: device_create_file() retval check in dmapool.c Greg KH
@ 2006-10-18 20:09 ` Greg KH
2006-10-18 20:09 ` [PATCH 13/16] Driver core: Don't leak 'old_class_name' in drivers/base/core.c::device_rename() Greg KH
0 siblings, 1 reply; 17+ messages in thread
From: Greg KH @ 2006-10-18 20:09 UTC (permalink / raw)
To: linux-kernel; +Cc: Cornelia Huck, Greg Kroah-Hartman
From: Cornelia Huck <cornelia.huck@de.ibm.com>
Return the return value of sysfs_create_group() in topology_add_dev().
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/base/topology.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/drivers/base/topology.c b/drivers/base/topology.c
index 3ef9d51..28dccb7 100644
--- a/drivers/base/topology.c
+++ b/drivers/base/topology.c
@@ -97,8 +97,7 @@ static struct attribute_group topology_a
/* Add/Remove cpu_topology interface for CPU device */
static int __cpuinit topology_add_dev(struct sys_device * sys_dev)
{
- sysfs_create_group(&sys_dev->kobj, &topology_attr_group);
- return 0;
+ return sysfs_create_group(&sys_dev->kobj, &topology_attr_group);
}
static int __cpuinit topology_remove_dev(struct sys_device * sys_dev)
--
1.4.2.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 13/16] Driver core: Don't leak 'old_class_name' in drivers/base/core.c::device_rename()
2006-10-18 20:09 ` [PATCH 12/16] driver core fixes: sysfs_create_group() retval in topology.c Greg KH
@ 2006-10-18 20:09 ` Greg KH
2006-10-18 20:09 ` [PATCH 14/16] Driver core: Don't ignore error returns from probing Greg KH
0 siblings, 1 reply; 17+ messages in thread
From: Greg KH @ 2006-10-18 20:09 UTC (permalink / raw)
To: linux-kernel; +Cc: Jesper Juhl, Greg Kroah-Hartman
From: Jesper Juhl <jesper.juhl@gmail.com>
If kmalloc() fails to allocate space for 'old_symlink_name' in
drivers/base/core.c::device_rename(), then we'll leak 'old_class_name'.
Spotted by the Coverity checker.
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/base/core.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 365f709..41f3dca 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -809,8 +809,10 @@ int device_rename(struct device *dev, ch
if (dev->class) {
old_symlink_name = kmalloc(BUS_ID_SIZE, GFP_KERNEL);
- if (!old_symlink_name)
- return -ENOMEM;
+ if (!old_symlink_name) {
+ error = -ENOMEM;
+ goto out_free_old_class;
+ }
strlcpy(old_symlink_name, dev->bus_id, BUS_ID_SIZE);
}
@@ -834,9 +836,10 @@ int device_rename(struct device *dev, ch
}
put_device(dev);
- kfree(old_class_name);
kfree(new_class_name);
kfree(old_symlink_name);
+ out_free_old_class:
+ kfree(old_class_name);
return error;
}
--
1.4.2.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 14/16] Driver core: Don't ignore error returns from probing
2006-10-18 20:09 ` [PATCH 13/16] Driver core: Don't leak 'old_class_name' in drivers/base/core.c::device_rename() Greg KH
@ 2006-10-18 20:09 ` Greg KH
2006-10-18 20:09 ` [PATCH 15/16] Driver core: bus: remove indentation level Greg KH
0 siblings, 1 reply; 17+ messages in thread
From: Greg KH @ 2006-10-18 20:09 UTC (permalink / raw)
To: linux-kernel; +Cc: Alan Stern, Greg Kroah-Hartman
From: Alan Stern <stern@rowland.harvard.edu>
This patch (as797) fixes device_add() in the driver core. It needs to
pay attention when the driver for a new device reports an error.
At the same time, since bus_remove_device() undoes the effects of both
bus_add_device() and bus_attach_device(), it needs to check whether
the bus_attach_device step failed.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/base/bus.c | 6 ++++--
drivers/base/core.c | 5 ++++-
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index d516f7d..d7c5ea2 100644
--- a/drivers/base/bus.c
+++ b/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);
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 41f3dca..68ad11a 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -479,7 +479,8 @@ int device_add(struct device *dev)
if ((error = bus_add_device(dev)))
goto BusError;
kobject_uevent(&dev->kobj, KOBJ_ADD);
- bus_attach_device(dev);
+ if ((error = bus_attach_device(dev)))
+ goto AttachError;
if (parent)
klist_add_tail(&dev->knode_parent, &parent->klist_children);
@@ -498,6 +499,8 @@ int device_add(struct device *dev)
kfree(class_name);
put_device(dev);
return error;
+ AttachError:
+ bus_remove_device(dev);
BusError:
device_pm_remove(dev);
PMError:
--
1.4.2.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 15/16] Driver core: bus: remove indentation level
2006-10-18 20:09 ` [PATCH 14/16] Driver core: Don't ignore error returns from probing Greg KH
@ 2006-10-18 20:09 ` Greg KH
2006-10-18 20:09 ` [PATCH 16/16] driver core: kmalloc() failure check in driver_probe_device Greg KH
0 siblings, 1 reply; 17+ messages in thread
From: Greg KH @ 2006-10-18 20:09 UTC (permalink / raw)
To: linux-kernel; +Cc: Jeff Garzik, Greg Kroah-Hartman
From: Jeff Garzik <jeff@garzik.org>
Before potentially fixing up these functions, this cosmetic change
reduces the indentation level to make the code easier to read and
maintain.
No functional changes at all.
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/base/bus.c | 77 +++++++++++++++++++++++++++-------------------------
1 files changed, 40 insertions(+), 37 deletions(-)
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index d7c5ea2..7d8a7ce 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -518,34 +518,36 @@ int bus_add_driver(struct device_driver
struct bus_type * bus = get_bus(drv->bus);
int error = 0;
- if (bus) {
- pr_debug("bus %s: add driver %s\n", bus->name, drv->name);
- error = kobject_set_name(&drv->kobj, "%s", drv->name);
- if (error)
- goto out_put_bus;
- drv->kobj.kset = &bus->drivers;
- if ((error = kobject_register(&drv->kobj)))
- goto out_put_bus;
-
- error = driver_attach(drv);
- if (error)
- goto out_unregister;
- klist_add_tail(&drv->knode_bus, &bus->klist_drivers);
- module_add_driver(drv->owner, drv);
-
- error = driver_add_attrs(bus, drv);
- if (error) {
- /* How the hell do we get out of this pickle? Give up */
- printk(KERN_ERR "%s: driver_add_attrs(%s) failed\n",
- __FUNCTION__, drv->name);
- }
- error = add_bind_files(drv);
- if (error) {
- /* Ditto */
- printk(KERN_ERR "%s: add_bind_files(%s) failed\n",
- __FUNCTION__, drv->name);
- }
+ if (!bus)
+ return 0;
+
+ pr_debug("bus %s: add driver %s\n", bus->name, drv->name);
+ error = kobject_set_name(&drv->kobj, "%s", drv->name);
+ if (error)
+ goto out_put_bus;
+ drv->kobj.kset = &bus->drivers;
+ if ((error = kobject_register(&drv->kobj)))
+ goto out_put_bus;
+
+ error = driver_attach(drv);
+ if (error)
+ goto out_unregister;
+ klist_add_tail(&drv->knode_bus, &bus->klist_drivers);
+ module_add_driver(drv->owner, drv);
+
+ error = driver_add_attrs(bus, drv);
+ if (error) {
+ /* How the hell do we get out of this pickle? Give up */
+ printk(KERN_ERR "%s: driver_add_attrs(%s) failed\n",
+ __FUNCTION__, drv->name);
+ }
+ error = add_bind_files(drv);
+ if (error) {
+ /* Ditto */
+ printk(KERN_ERR "%s: add_bind_files(%s) failed\n",
+ __FUNCTION__, drv->name);
}
+
return error;
out_unregister:
kobject_unregister(&drv->kobj);
@@ -565,16 +567,17 @@ out_put_bus:
void bus_remove_driver(struct device_driver * drv)
{
- if (drv->bus) {
- remove_bind_files(drv);
- driver_remove_attrs(drv->bus, drv);
- klist_remove(&drv->knode_bus);
- pr_debug("bus %s: remove driver %s\n", drv->bus->name, drv->name);
- driver_detach(drv);
- module_remove_driver(drv);
- kobject_unregister(&drv->kobj);
- put_bus(drv->bus);
- }
+ if (!drv->bus)
+ return;
+
+ remove_bind_files(drv);
+ driver_remove_attrs(drv->bus, drv);
+ klist_remove(&drv->knode_bus);
+ pr_debug("bus %s: remove driver %s\n", drv->bus->name, drv->name);
+ driver_detach(drv);
+ module_remove_driver(drv);
+ kobject_unregister(&drv->kobj);
+ put_bus(drv->bus);
}
--
1.4.2.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 16/16] driver core: kmalloc() failure check in driver_probe_device
2006-10-18 20:09 ` [PATCH 15/16] Driver core: bus: remove indentation level Greg KH
@ 2006-10-18 20:09 ` Greg KH
0 siblings, 0 replies; 17+ messages in thread
From: Greg KH @ 2006-10-18 20:09 UTC (permalink / raw)
To: linux-kernel; +Cc: Akinobu Mita, Greg Kroah-Hartman
From: Akinobu Mita <akinobu.mita@gmail.com>
driver_probe_device() is missing kmalloc() failure check.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/base/dd.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index ef7db69..db01b95 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -171,6 +171,8 @@ int driver_probe_device(struct device_dr
drv->bus->name, dev->bus_id, drv->name);
data = kmalloc(sizeof(*data), GFP_KERNEL);
+ if (!data)
+ return -ENOMEM;
data->drv = drv;
data->dev = dev;
--
1.4.2.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
end of thread, other threads:[~2006-10-18 20:19 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-18 19:58 [GIT PATCH] Driver Core fixes for 2.6.19-rc2 Greg KH
2006-10-18 20:08 ` [PATCH 1/16] Documentation: feature-removal-schedule typo Greg KH
2006-10-18 20:08 ` [PATCH 2/16] Driver core: plug device probe memory leak Greg KH
2006-10-18 20:08 ` [PATCH 3/16] Fix dev_printk() is now GPL-only Greg KH
2006-10-18 20:08 ` [PATCH 4/16] HOWTO: bug report addition Greg KH
2006-10-18 20:08 ` [PATCH 5/16] sysfs: remove duplicated dput in sysfs_update_file Greg KH
2006-10-18 20:08 ` [PATCH 6/16] sysfs: update obsolete comment " Greg KH
2006-10-18 20:08 ` [PATCH 7/16] driver core fixes: sysfs_create_link() retval check in class.c Greg KH
2006-10-18 20:08 ` [PATCH 8/16] driver core fixes: bus_add_attrs() retval check Greg KH
2006-10-18 20:09 ` [PATCH 9/16] driver core fixes: bus_add_device() cleanup on error Greg KH
2006-10-18 20:09 ` [PATCH 10/16] driver core fixes: device_add() " Greg KH
2006-10-18 20:09 ` [PATCH 11/16] driver core fixes: device_create_file() retval check in dmapool.c Greg KH
2006-10-18 20:09 ` [PATCH 12/16] driver core fixes: sysfs_create_group() retval in topology.c Greg KH
2006-10-18 20:09 ` [PATCH 13/16] Driver core: Don't leak 'old_class_name' in drivers/base/core.c::device_rename() Greg KH
2006-10-18 20:09 ` [PATCH 14/16] Driver core: Don't ignore error returns from probing Greg KH
2006-10-18 20:09 ` [PATCH 15/16] Driver core: bus: remove indentation level Greg KH
2006-10-18 20:09 ` [PATCH 16/16] driver core: kmalloc() failure check in driver_probe_device Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox