public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [GIT PATCH] driver core fixes against 2.6.25-rc6 git
@ 2008-03-25  6:05 Greg KH
  2008-03-25  6:16 ` [PATCH 1/2] UIO: add pgprot_noncached() to UIO mmap code Greg Kroah-Hartman
  2008-03-25  6:16 ` [PATCH 2/2] driver core: debug for bad dev_attr_show() return value Greg Kroah-Hartman
  0 siblings, 2 replies; 3+ messages in thread
From: Greg KH @ 2008-03-25  6:05 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton; +Cc: linux-kernel

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] UIO: add pgprot_noncached() to UIO mmap code
  2008-03-25  6:05 [GIT PATCH] driver core fixes against 2.6.25-rc6 git Greg KH
@ 2008-03-25  6:16 ` Greg Kroah-Hartman
  2008-03-25  6:16 ` [PATCH 2/2] driver core: debug for bad dev_attr_show() return value Greg Kroah-Hartman
  1 sibling, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2008-03-25  6:16 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jean-Samuel Chenard, Hans J Koch, stable, Greg Kroah-Hartman

From: Jean-Samuel Chenard <jsamch@gmail.com>

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.

Signed-off-by: Jean-Samuel Chenard <jsamch@gmail.com>
Signed-off-by: Hans J Koch <hjk@linutronix.de>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/uio/uio.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index e8a01f2..1175908 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -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,
-- 
1.5.4.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] driver core: debug for bad dev_attr_show() return value.
  2008-03-25  6:05 [GIT PATCH] driver core fixes against 2.6.25-rc6 git Greg KH
  2008-03-25  6:16 ` [PATCH 1/2] UIO: add pgprot_noncached() to UIO mmap code Greg Kroah-Hartman
@ 2008-03-25  6:16 ` Greg Kroah-Hartman
  1 sibling, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2008-03-25  6:16 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andrew Morton, balajirrao, Greg Kroah-Hartman

From: Andrew Morton <akpm@linux-foundation.org>

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

Cc: <balajirrao@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/base/core.c |    5 +++++
 fs/sysfs/file.c     |    8 +++++++-
 2 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index 7de543d..24198ad 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -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;
 }
 
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index a271c87..baa663e 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -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;
-- 
1.5.4.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-03-25  6:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-25  6:05 [GIT PATCH] driver core fixes against 2.6.25-rc6 git Greg KH
2008-03-25  6:16 ` [PATCH 1/2] UIO: add pgprot_noncached() to UIO mmap code Greg Kroah-Hartman
2008-03-25  6:16 ` [PATCH 2/2] driver core: debug for bad dev_attr_show() return value Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox