linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pnfs-block: removing DM device maybe cause oops when call dev_remove
@ 2013-03-20  8:01 fanchaoting
  2013-03-20  8:28 ` Peng, Tao
  2013-03-20 19:27 ` Myklebust, Trond
  0 siblings, 2 replies; 5+ messages in thread
From: fanchaoting @ 2013-03-20  8:01 UTC (permalink / raw)
  To: Myklebust, Trond; +Cc: linux-nfs@vger.kernel.org

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>

---
 fs/nfs/blocklayout/blocklayoutdm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/nfs/blocklayout/blocklayoutdm.c b/fs/nfs/blocklayout/blocklayoutdm.c
index 737d839..8df9afa 100644
--- a/fs/nfs/blocklayout/blocklayoutdm.c
+++ b/fs/nfs/blocklayout/blocklayoutdm.c
@@ -55,7 +55,7 @@ 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->data = kzalloc(sizeof(bl_msg) + sizeof(bl_umount_request), GFP_NOFS);
        if (!msg->data)
                goto out;

--
1.7.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-03-21  1:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-20  8:01 [PATCH] pnfs-block: removing DM device maybe cause oops when call dev_remove fanchaoting
2013-03-20  8:28 ` Peng, Tao
2013-03-20 19:27 ` Myklebust, Trond
2013-03-21  1:15   ` fanchaoting
2013-03-21  1:40     ` Myklebust, Trond

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).