Skip to contentSkip to conversation

driver core fixes against 2.6.25-rc6 git

PATCH New Greg KH 1 participant 3 messages Mar 25, 2008

Subsystems (2)
lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 driver core fixes against 2.6.25-rc6 git

Here are 2 patches against your current git tree that do:
- fix UIO to work properly on ARM and other platforms
- remove BUG in sysfs and add better debugging for attributes that overflow the buffer provided by sysfs. Andrew asked that this patch go in now to help people out.

Both of these patches have been in -next and -mm for quite a while.

Please pull from:
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

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

 drivers/base/core.c |    5 +++++
 drivers/uio/uio.c   |    2 ++
 fs/sysfs/file.c     |    8 +++++++-
 3 files changed, 14 insertions(+), 1 deletions(-)

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

Andrew Morton (1):
driver core: debug for bad dev_attr_show() return value.

Jean-Samuel Chenard (1):
UIO: add pgprot_noncached() to UIO mmap code

#1 lore raw

PATCH 1/2 UIO: add pgprot_noncached() to UIO mmap code

From: Jean-Samuel Chenard <[email protected]>

Mapping of physical memory in UIO needs pgprot_noncached() to ensure that IO memory is not cached. Without pgprot_noncached(), it (accidentally) works on x86 and arm, but fails on PPC.

---
 drivers/uio/uio.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/uio/uio.c +2 -0
index e8a01f2..1175908 100644
@@ -470,6 +470,8 @@ static int uio_mmap_physical(struct vm_area_struct *vma)
 
 	vma->vm_flags |= VM_IO | VM_RESERVED;
 
+	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+
 	return remap_pfn_range(vma,
 			       vma->vm_start,
 			       idev->info->mem[mi].addr >> PAGE_SHIFT,
Signature · 1 line
1.5.4.3
#2 lore raw

PATCH 2/2 driver core: debug for bad dev_attr_show() return value.

In reply to Greg KH

From: Andrew Morton <[email protected]>

Try to find the culprit who caused
http://bugzilla.kernel.org/show_bug.cgi?id=10150

---
 drivers/base/core.c |    5 +++++
 fs/sysfs/file.c     |    8 +++++++-
 2 files changed, 12 insertions(+), 1 deletions(-)
drivers/base/core.c +5 -0
index 7de543d..24198ad 100644
@@ -19,6 +19,7 @@
 #include <linux/kdev_t.h>
 #include <linux/notifier.h>
 #include <linux/genhd.h>
+#include <linux/kallsyms.h>
 #include <asm/semaphore.h>
 
 #include "base.h"
@@ -68,6 +69,10 @@ static ssize_t dev_attr_show(struct kobject *kobj, struct attribute *attr,
 
 	if (dev_attr->show)
 		ret = dev_attr->show(dev, dev_attr, buf);
+	if (ret >= (ssize_t)PAGE_SIZE) {
+		print_symbol("dev_attr_show: %s returned bad count\n",
+				(unsigned long)dev_attr->show);
+	}
 	return ret;
 }
 
fs/sysfs/file.c +7 -1
index a271c87..baa663e 100644
@@ -12,6 +12,7 @@
 
 #include <linux/module.h>
 #include <linux/kobject.h>
+#include <linux/kallsyms.h>
 #include <linux/namei.h>
 #include <linux/poll.h>
 #include <linux/list.h>
@@ -86,7 +87,12 @@ static int fill_read_buffer(struct dentry * dentry, struct sysfs_buffer * buffer
 	 * The code works fine with PAGE_SIZE return but it's likely to
 	 * indicate truncated result or overflow in normal use cases.
 	 */
-	BUG_ON(count >= (ssize_t)PAGE_SIZE);
+	if (count >= (ssize_t)PAGE_SIZE) {
+		print_symbol("fill_read_buffer: %s returned bad count\n",
+			(unsigned long)ops->show);
+		/* Try to struggle along */
+		count = PAGE_SIZE - 1;
+	}
 	if (count >= 0) {
 		buffer->needs_read_fill = 0;
 		buffer->count = count;
Signature · 1 line
1.5.4.3