[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <lsq.1365374742.457631868@decadent.org.uk>
Date: Sun, 07 Apr 2013 23:45:42 +0100
From: Ben Hutchings <ben@...adent.org.uk>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
CC: akpm@...ux-foundation.org,
"fanchaoting" <fanchaoting@...fujitsu.com>,
"Trond Myklebust" <Trond.Myklebust@...app.com>
Subject: [23/74] pnfs-block: removing DM device maybe cause oops when call
dev_remove
3.2.43-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: fanchaoting <fanchaoting@...fujitsu.com>
commit 4376c94618c26225e69e17b7c91169c45a90b292 upstream.
when pnfs block using device mapper,if umounting later,it maybe
cause oops. we apply "1 + sizeof(bl_umount_request)" memory for
msg->data, the memory maybe overflow when we do "memcpy(&dataptr
[sizeof(bl_msg)], &bl_umount_request, sizeof(bl_umount_request))",
because the size of bl_msg is more than 1 byte.
Signed-off-by: fanchaoting<fanchaoting@...fujitsu.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@...app.com>
[bwh: Backported to 3.2:
- In dev_remove(), msg is a structure not a pointer to it]
Signed-off-by: Ben Hutchings <ben@...adent.org.uk>
---
fs/nfs/blocklayout/blocklayoutdm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/fs/nfs/blocklayout/blocklayoutdm.c
+++ b/fs/nfs/blocklayout/blocklayoutdm.c
@@ -52,7 +52,8 @@ static void dev_remove(dev_t dev)
dprintk("Entering %s\n", __func__);
memset(&msg, 0, sizeof(msg));
- msg.data = kzalloc(1 + sizeof(bl_umount_request), GFP_NOFS);
+ msg.len = sizeof(bl_msg) + bl_msg.totallen;
+ msg.data = kzalloc(msg.len, GFP_NOFS);
if (!msg.data)
goto out;
@@ -63,7 +64,6 @@ static void dev_remove(dev_t dev)
memcpy(msg.data, &bl_msg, sizeof(bl_msg));
dataptr = (uint8_t *) msg.data;
memcpy(&dataptr[sizeof(bl_msg)], &bl_umount_request, sizeof(bl_umount_request));
- msg.len = sizeof(bl_msg) + bl_msg.totallen;
add_wait_queue(&bl_wq, &wq);
if (rpc_queue_upcall(bl_device_pipe->d_inode, &msg) < 0) {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists