summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfanchaoting <fanchaoting@cn.fujitsu.com>2013-03-21 09:15:30 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-04-05 10:04:30 -0700
commit75e4839c59268b4880b82fa9584980478ef8ca29 (patch)
tree53983ab75f76f64d684f2ff1b899dd831b54877f
parente92c5efcb2af2afe9a7fa297dcc325f8d04469b3 (diff)
downloadlinux-3.10-75e4839c59268b4880b82fa9584980478ef8ca29.tar.gz
linux-3.10-75e4839c59268b4880b82fa9584980478ef8ca29.tar.bz2
linux-3.10-75e4839c59268b4880b82fa9584980478ef8ca29.zip
pnfs-block: removing DM device maybe cause oops when call dev_remove
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@cn.fujitsu.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--fs/nfs/blocklayout/blocklayoutdm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/nfs/blocklayout/blocklayoutdm.c b/fs/nfs/blocklayout/blocklayoutdm.c
index 737d839bc17..6fc7b5cae92 100644
--- a/fs/nfs/blocklayout/blocklayoutdm.c
+++ b/fs/nfs/blocklayout/blocklayoutdm.c
@@ -55,7 +55,8 @@ static void dev_remove(struct net *net, dev_t dev)
bl_pipe_msg.bl_wq = &nn->bl_wq;
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;
@@ -66,7 +67,6 @@ static void dev_remove(struct net *net, 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(&nn->bl_wq, &wq);
if (rpc_queue_upcall(nn->bl_device_pipe, msg) < 0) {