Commit 5bbd2846 authored by Sebastian Ott's avatar Sebastian Ott Committed by Greg Kroah-Hartman

s390/pci: fix possible information leak in mmio syscall

commit f0483044 upstream.

Make sure that even in error situations we do not use copy_to_user
on uninitialized kernel memory.
Signed-off-by: default avatarSebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a1e7c4d0
...@@ -64,8 +64,7 @@ SYSCALL_DEFINE3(s390_pci_mmio_write, unsigned long, mmio_addr, ...@@ -64,8 +64,7 @@ SYSCALL_DEFINE3(s390_pci_mmio_write, unsigned long, mmio_addr,
if (copy_from_user(buf, user_buffer, length)) if (copy_from_user(buf, user_buffer, length))
goto out; goto out;
memcpy_toio(io_addr, buf, length); ret = zpci_memcpy_toio(io_addr, buf, length);
ret = 0;
out: out:
if (buf != local_buf) if (buf != local_buf)
kfree(buf); kfree(buf);
...@@ -98,16 +97,16 @@ SYSCALL_DEFINE3(s390_pci_mmio_read, unsigned long, mmio_addr, ...@@ -98,16 +97,16 @@ SYSCALL_DEFINE3(s390_pci_mmio_read, unsigned long, mmio_addr,
goto out; goto out;
io_addr = (void *)((pfn << PAGE_SHIFT) | (mmio_addr & ~PAGE_MASK)); io_addr = (void *)((pfn << PAGE_SHIFT) | (mmio_addr & ~PAGE_MASK));
if ((unsigned long) io_addr < ZPCI_IOMAP_ADDR_BASE) {
ret = -EFAULT; ret = -EFAULT;
if ((unsigned long) io_addr < ZPCI_IOMAP_ADDR_BASE)
goto out; goto out;
}
memcpy_fromio(buf, io_addr, length); ret = zpci_memcpy_fromio(buf, io_addr, length);
if (ret)
if (copy_to_user(user_buffer, buf, length))
goto out; goto out;
if (copy_to_user(user_buffer, buf, length))
ret = -EFAULT;
ret = 0;
out: out:
if (buf != local_buf) if (buf != local_buf)
kfree(buf); kfree(buf);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment