aio: fix possible invalid memory access when DEBUG is enabled
authorZhao Hongjiang <zhaohongjiang@huawei.com>
Fri, 26 Apr 2013 03:03:53 +0000 (11:03 +0800)
committerBen Hutchings <ben@decadent.org.uk>
Mon, 13 May 2013 14:02:09 +0000 (15:02 +0100)
commit 91d80a84bbc8f28375cca7e65ec666577b4209ad upstream.

dprintk() shouldn't access @ring after it's unmapped.

Signed-off-by: Zhao Hongjiang <zhaohongjiang@huawei.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[bwh: Backported to 3.2: keep the second argument to kunmap_atomic()]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
fs/aio.c

index 3b65ee7..8cdd8ea 100644 (file)
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1112,9 +1112,9 @@ static int aio_read_evt(struct kioctx *ioctx, struct io_event *ent)
        spin_unlock(&info->ring_lock);
 
 out:
-       kunmap_atomic(ring, KM_USER0);
        dprintk("leaving aio_read_evt: %d  h%lu t%lu\n", ret,
                 (unsigned long)ring->head, (unsigned long)ring->tail);
+       kunmap_atomic(ring, KM_USER0);
        return ret;
 }