From: Greg KH on
2.6.32-stable review patch. If anyone has any objections, please let us know.

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


From: Wu Fengguang <fengguang.wu(a)intel.com>


commit c85e9a97c4102ce2e83112da850d838cfab5ab13 upstream

devmem: fix kmem write bug on memory holes

[ cebbert(a)redhat.com : backport to 2.6.32 ]

write_kmem() used to assume vwrite() always return the full buffer length.
However now vwrite() could return 0 to indicate memory hole. This
creates a bug that "buf" is not advanced accordingly.

Fix it to simply ignore the return value, hence the memory hole.

Signed-off-by: Wu Fengguang <fengguang.wu(a)intel.com>
Cc: Andi Kleen <andi(a)firstfloor.org>
Cc: Benjamin Herrenschmidt <benh(a)kernel.crashing.org>
Cc: Christoph Lameter <cl(a)linux-foundation.org>
Cc: Ingo Molnar <mingo(a)elte.hu>
Cc: Tejun Heo <tj(a)kernel.org>
Cc: Nick Piggin <npiggin(a)suse.de>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu(a)jp.fujitsu.com>
Cc: <stable(a)kernel.org>
Signed-off-by: Andrew Morton <akpm(a)linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds(a)linux-foundation.org>
Cc: Chuck Ebbert <cebbert(a)redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)suse.de>

---
drivers/char/mem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -593,7 +593,7 @@ static ssize_t write_kmem(struct file *
break;
}
}
- len = vwrite(kbuf, (char *)p, len);
+ vwrite(kbuf, (char *)p, len);
count -= len;
buf += len;
virtr += len;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/