From: vh249@airwolf.cl.cam.ac.uk Date: Tue, 8 Mar 2005 09:39:04 +0000 (+0000) Subject: bitkeeper revision 1.1159.258.23 (422d72b8gvbXrWsyznqgyF7shPiduw) X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~17400^2~150 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=39b6d495a8198d758004156c7f5933d84286bb45;p=xen.git bitkeeper revision 1.1159.258.23 (422d72b8gvbXrWsyznqgyF7shPiduw) Fix error path handling not calling iounmap() after ioremap() Signed-off-by: Yann Droneaud Signed-off-by: Vincent Hanquez --- diff --git a/linux-2.6.10-xen-sparse/arch/xen/kernel/devmem.c b/linux-2.6.10-xen-sparse/arch/xen/kernel/devmem.c index ffda098851..456091775b 100644 --- a/linux-2.6.10-xen-sparse/arch/xen/kernel/devmem.c +++ b/linux-2.6.10-xen-sparse/arch/xen/kernel/devmem.c @@ -43,7 +43,7 @@ static ssize_t read_mem(struct file * file, char __user * buf, size_t count, loff_t *ppos) { unsigned long i, p = *ppos; - ssize_t read = 0; + ssize_t read = -EFAULT; void *v; if ((v = ioremap(p, count)) == NULL) { @@ -60,12 +60,12 @@ static ssize_t read_mem(struct file * file, char __user * buf, return count; } if (copy_to_user(buf, v, count)) - return -EFAULT; - iounmap(v); + goto out; - read += count; + read = count; *ppos += read; - +out: + iounmap(v); return read; } @@ -73,18 +73,18 @@ static ssize_t write_mem(struct file * file, const char __user * buf, size_t count, loff_t *ppos) { unsigned long p = *ppos; - ssize_t written = 0; + ssize_t written = -EFAULT; void *v; if ((v = ioremap(p, count)) == NULL) return -EFAULT; if (copy_to_user(v, buf, count)) - return -EFAULT; - iounmap(v); + goto out; - written += count; + written = count; *ppos += written; - +out: + iounmap(v); return written; }