* [BK PATCH] Driver Core fixes for 2.6.6-rc2 @ 2004-04-22 22:28 Greg KH 2004-04-22 22:30 ` [PATCH] " Greg KH 0 siblings, 1 reply; 4+ messages in thread From: Greg KH @ 2004-04-22 22:28 UTC (permalink / raw) To: torvalds, akpm; +Cc: linux-kernel Hi, Here are two driver core fixes for 2.6.6-rc2, along with a tipar.c driver fix. Please pull from: bk://kernel.bkbits.net/gregkh/linux/driver-2.6 thanks, greg k-h p.s. I'll send these as patches in response to this email to lkml for those who want to see them. drivers/base/firmware_class.c | 2 +- drivers/char/tipar.c | 2 +- drivers/i2c/chips/eeprom.c | 1 + drivers/scsi/qla2xxx/qla_os.c | 2 ++ fs/sysfs/bin.c | 16 +++++++++++++--- fs/sysfs/symlink.c | 6 +++--- 6 files changed, 21 insertions(+), 8 deletions(-) ----- <mebrown:michaels-house.net>: o sysfs module unload race fix for bin_attributes Linda Xie: o symlink doesn't support kobj name > 20 charaters (KOBJ_NAME_LEN) Romain Lievin: o tipar char driver: wrong timeout value ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] Driver Core fixes for 2.6.6-rc2 2004-04-22 22:28 [BK PATCH] Driver Core fixes for 2.6.6-rc2 Greg KH @ 2004-04-22 22:30 ` Greg KH 2004-04-22 22:30 ` Greg KH 0 siblings, 1 reply; 4+ messages in thread From: Greg KH @ 2004-04-22 22:30 UTC (permalink / raw) To: linux-kernel ChangeSet 1.1927, 2004/04/22 12:19:51-07:00, mebrown@michaels-house.net [PATCH] sysfs module unload race fix for bin_attributes - Add module locking to sysfs bin_attribute files. Update all in-tree users to set module owner. Compile tested. booted. stress tests pass: while true; do modprobe mymod; rmmod mymod; done & while true; do hexdump -C /sys/path/to/sysfs/binary/file; done drivers/base/firmware_class.c | 2 +- drivers/i2c/chips/eeprom.c | 1 + drivers/scsi/qla2xxx/qla_os.c | 2 ++ fs/sysfs/bin.c | 16 +++++++++++++--- 4 files changed, 17 insertions(+), 4 deletions(-) diff -Nru a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c --- a/drivers/base/firmware_class.c Thu Apr 22 15:27:17 2004 +++ b/drivers/base/firmware_class.c Thu Apr 22 15:27:17 2004 @@ -254,7 +254,7 @@ return retval; } static struct bin_attribute firmware_attr_data_tmpl = { - .attr = {.name = "data", .mode = 0644}, + .attr = {.name = "data", .mode = 0644, .owner = THIS_MODULE}, .size = 0, .read = firmware_data_read, .write = firmware_data_write, diff -Nru a/drivers/i2c/chips/eeprom.c b/drivers/i2c/chips/eeprom.c --- a/drivers/i2c/chips/eeprom.c Thu Apr 22 15:27:17 2004 +++ b/drivers/i2c/chips/eeprom.c Thu Apr 22 15:27:17 2004 @@ -155,6 +155,7 @@ .attr = { .name = "eeprom", .mode = S_IRUGO, + .owner = THIS_MODULE, }, .size = EEPROM_SIZE, .read = eeprom_read, diff -Nru a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c --- a/drivers/scsi/qla2xxx/qla_os.c Thu Apr 22 15:27:17 2004 +++ b/drivers/scsi/qla2xxx/qla_os.c Thu Apr 22 15:27:17 2004 @@ -402,6 +402,7 @@ .attr = { .name = "fw_dump", .mode = S_IRUSR | S_IWUSR, + .owner = THIS_MODULE, }, .size = 0, .read = qla2x00_sysfs_read_fw_dump, @@ -415,6 +416,7 @@ .attr = { .name = "nvram", .mode = S_IRUSR | S_IWUSR, + .owner = THIS_MODULE, }, .size = sizeof(nvram_t), .read = qla2x00_sysfs_read_nvram, diff -Nru a/fs/sysfs/bin.c b/fs/sysfs/bin.c --- a/fs/sysfs/bin.c Thu Apr 22 15:27:17 2004 +++ b/fs/sysfs/bin.c Thu Apr 22 15:27:17 2004 @@ -101,19 +101,27 @@ if (!kobj || !attr) goto Done; + /* Grab the module reference for this attribute if we have one */ + error = -ENODEV; + if (!try_module_get(attr->attr.owner)) + goto Done; + error = -EACCES; if ((file->f_mode & FMODE_WRITE) && !attr->write) - goto Done; + goto Error; if ((file->f_mode & FMODE_READ) && !attr->read) - goto Done; + goto Error; error = -ENOMEM; file->private_data = kmalloc(PAGE_SIZE, GFP_KERNEL); if (!file->private_data) - goto Done; + goto Error; error = 0; + goto Done; + Error: + module_put(attr->attr.owner); Done: if (error && kobj) kobject_put(kobj); @@ -123,10 +131,12 @@ static int release(struct inode * inode, struct file * file) { struct kobject * kobj = file->f_dentry->d_parent->d_fsdata; + struct bin_attribute * attr = file->f_dentry->d_fsdata; u8 * buffer = file->private_data; if (kobj) kobject_put(kobj); + module_put(attr->attr.owner); kfree(buffer); return 0; } ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Driver Core fixes for 2.6.6-rc2 2004-04-22 22:30 ` [PATCH] " Greg KH @ 2004-04-22 22:30 ` Greg KH 2004-04-22 22:30 ` Greg KH 0 siblings, 1 reply; 4+ messages in thread From: Greg KH @ 2004-04-22 22:30 UTC (permalink / raw) To: linux-kernel ChangeSet 1.1928, 2004/04/22 14:36:55-07:00, lkml@lievin.net [PATCH] tipar char driver: wrong timeout value this patch (2.4 & 2.6) fixes a bug about the timeout value. The formula used to calculate jiffies from timeout is wrong. The new formula is ok and takes care of integer computation/rounding. There is the same bug in the tiglusb.c module which will be fixed by another patch. drivers/char/tipar.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -Nru a/drivers/char/tipar.c b/drivers/char/tipar.c --- a/drivers/char/tipar.c Thu Apr 22 15:27:12 2004 +++ b/drivers/char/tipar.c Thu Apr 22 15:27:12 2004 @@ -121,7 +121,7 @@ /* ----- global defines ----------------------------------------------- */ -#define START(x) { x=jiffies+HZ/(timeout/10); } +#define START(x) { x = jiffies + (HZ * timeout) / 10; } #define WAIT(x) { \ if (time_before((x), jiffies)) return -1; \ if (need_resched()) schedule(); } ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Driver Core fixes for 2.6.6-rc2 2004-04-22 22:30 ` Greg KH @ 2004-04-22 22:30 ` Greg KH 0 siblings, 0 replies; 4+ messages in thread From: Greg KH @ 2004-04-22 22:30 UTC (permalink / raw) To: linux-kernel ChangeSet 1.1929, 2004/04/22 15:11:12-07:00, lxiep@us.ibm.com [PATCH] symlink doesn't support kobj name > 20 charaters (KOBJ_NAME_LEN) Since symlink.c uses "name" field of a kobj when it calculates the length, it gets a wrong value if the kobj's name has more than 20 charathers. A correct way to do that is to call kobject_name(kobj) instead of using kobj->name directly. fs/sysfs/symlink.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff -Nru a/fs/sysfs/symlink.c b/fs/sysfs/symlink.c --- a/fs/sysfs/symlink.c Thu Apr 22 15:27:07 2004 +++ b/fs/sysfs/symlink.c Thu Apr 22 15:27:07 2004 @@ -42,7 +42,7 @@ struct kobject * p = kobj; int length = 1; do { - length += strlen(p->name) + 1; + length += strlen(kobject_name(p)) + 1; p = p->parent; } while (p); return length; @@ -54,11 +54,11 @@ --length; for (p = kobj; p; p = p->parent) { - int cur = strlen(p->name); + int cur = strlen(kobject_name(p)); /* back up enough to print this bus id with '/' */ length -= cur; - strncpy(buffer + length,p->name,cur); + strncpy(buffer + length,kobject_name(p),cur); *(buffer + --length) = '/'; } } ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-04-22 22:33 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2004-04-22 22:28 [BK PATCH] Driver Core fixes for 2.6.6-rc2 Greg KH 2004-04-22 22:30 ` [PATCH] " Greg KH 2004-04-22 22:30 ` Greg KH 2004-04-22 22:30 ` Greg KH
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox