From: Oliver Neukum <[email protected]> if a driver returns an error in fill_read_buffer(), the buffer will be marked as filled. Subsequent reads will return eof. But there is no data because of an error, not because it has been read. Not marking the buffer filled is the obvious fix. Signed-off-by: Oliver Neukum <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> --- fs/sysfs/file.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index 46618f8..c0e1176 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c @@ -83,7 +83,8 @@ remove_from_collection(struct sysfs_buffer *buffer, struct inode *node) * Allocate @buffer->page, if it hasn't been already, then call the * kobject's show() method to fill the buffer with this attribute's * data. - * This is called only once, on the file's first read. + * This is called only once, on the file's first read unless an error + * is returned. */ static int fill_read_buffer(struct dentry * dentry, struct sysfs_buffer * buffer) { @@ -101,12 +102,13 @@ static int fill_read_buffer(struct dentry * dentry, struct sysfs_buffer * buffer buffer->event = atomic_read(&sd->s_event); count = ops->show(kobj,attr,buffer->page); - buffer->needs_read_fill = 0; BUG_ON(count > (ssize_t)PAGE_SIZE); - if (count >= 0) + if (count >= 0) { + buffer->needs_read_fill = 0; buffer->count = count; - else + } else { ret = count; + } return ret; } -- 1.4.4.4 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- References:
- [GIT PATCH] Driver core patches for 2.6.20
- From: Greg KH <[email protected]>
- [PATCH 1/28] Kobject: make kobject apis more robust in handling NULL pointers
- From: Greg KH <[email protected]>
- [PATCH 2/28] Driver core: convert pcmcia code to use struct device
- From: Greg KH <[email protected]>
- [PATCH 3/28] Driver core: convert SPI code to use struct device
- From: Greg KH <[email protected]>
- [PATCH 4/28] Network: convert network devices to use struct device instead of class_device
- From: Greg KH <[email protected]>
- [PATCH 5/28] driver core: Remove device_is_registered() in device_move().
- From: Greg KH <[email protected]>
- [PATCH 6/28] driver core: Allow device_move(dev, NULL).
- From: Greg KH <[email protected]>
- [PATCH 7/28] MODULES: add the module name for built in kernel drivers
- From: Greg KH <[email protected]>
- [PATCH 8/28] Modules: only add drivers/ direcory if needed
- From: Greg KH <[email protected]>
- [PATCH 9/28] PCI: add the sysfs driver name to all modules
- From: Greg KH <[email protected]>
- [PATCH 10/28] SERIO: add the sysfs driver name to all modules
- From: Greg KH <[email protected]>
- [PATCH 11/28] USB: add the sysfs driver name to all modules
- From: Greg KH <[email protected]>
- [PATCH 12/28] /sys/modules/*/holders
- From: Greg KH <[email protected]>
- [PATCH 13/28] driver core fixes: make_class_name() retval checks
- From: Greg KH <[email protected]>
- [PATCH 14/28] driver core fixes: device_register() retval check in platform.c
- From: Greg KH <[email protected]>
- [PATCH 15/28] driver core: Don't stop probing on ->probe errors.
- From: Greg KH <[email protected]>
- [PATCH 16/28] driver core: Change function call order in device_bind_driver().
- From: Greg KH <[email protected]>
- [PATCH 17/28] Driver core: fix race in sysfs between sysfs_remove_file() and read()/write()
- From: Greg KH <[email protected]>
- [PATCH 18/28] sysfs: suppress lockdep warnings
- From: Greg KH <[email protected]>
- [PATCH 19/28] sysfs: kobject_put cleanup
- From: Greg KH <[email protected]>
- [PATCH 20/28] kobject: kobject_put cleanup
- From: Greg KH <[email protected]>
- [GIT PATCH] Driver core patches for 2.6.20
- Prev by Date: [PATCH 22/28] HOWTO: Add a reference to Harbison and Steele
- Next by Date: [PATCH 24/28] Driver core: add uevent vars for devices of a class
- Previous by thread: [PATCH 20/28] kobject: kobject_put cleanup
- Next by thread: [PATCH 22/28] HOWTO: Add a reference to Harbison and Steele
- Index(es):