diff options
author | Dean Nelson <dcn@sgi.com> | 2009-02-04 18:12:24 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-02-05 15:56:49 -0500 |
commit | 361916a943cd9dbda1c0b00879d0225cc919d868 (patch) | |
tree | e9b30d230248baa4dd3e9718b683e4aa74830f43 /drivers/misc/sgi-xp/xpc_uv.c | |
parent | fb9a68001175cc04bbbe711e6e29e1c6c353107b (diff) |
sgi-xp: fix writing past the end of kzalloc()'d space
A missing type cast results in writing way beyond the end of a kzalloc()'d
memory segment resulting in slab corruption. But it seems like the better
solution is to define ->recv_msg_slots as a 'void *' rather than a
'struct xpc_notify_mq_msg_uv *' and add the type cast.
Signed-off-by: Dean Nelson <dcn@sgi.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/misc/sgi-xp/xpc_uv.c')
-rw-r--r-- | drivers/misc/sgi-xp/xpc_uv.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/misc/sgi-xp/xpc_uv.c b/drivers/misc/sgi-xp/xpc_uv.c index f17f7d40ea2c..29c0502a96b2 100644 --- a/drivers/misc/sgi-xp/xpc_uv.c +++ b/drivers/misc/sgi-xp/xpc_uv.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * License. See the file "COPYING" in the main directory of this archive | 3 | * License. See the file "COPYING" in the main directory of this archive |
4 | * for more details. | 4 | * for more details. |
5 | * | 5 | * |
6 | * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved. | 6 | * Copyright (c) 2008-2009 Silicon Graphics, Inc. All Rights Reserved. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | /* | 9 | /* |
@@ -1010,8 +1010,8 @@ xpc_allocate_recv_msg_slot_uv(struct xpc_channel *ch) | |||
1010 | continue; | 1010 | continue; |
1011 | 1011 | ||
1012 | for (entry = 0; entry < nentries; entry++) { | 1012 | for (entry = 0; entry < nentries; entry++) { |
1013 | msg_slot = ch_uv->recv_msg_slots + entry * | 1013 | msg_slot = ch_uv->recv_msg_slots + |
1014 | ch->entry_size; | 1014 | entry * ch->entry_size; |
1015 | 1015 | ||
1016 | msg_slot->hdr.msg_slot_number = entry; | 1016 | msg_slot->hdr.msg_slot_number = entry; |
1017 | } | 1017 | } |
@@ -1308,9 +1308,8 @@ xpc_handle_notify_mq_msg_uv(struct xpc_partition *part, | |||
1308 | /* we're dealing with a normal message sent via the notify_mq */ | 1308 | /* we're dealing with a normal message sent via the notify_mq */ |
1309 | ch_uv = &ch->sn.uv; | 1309 | ch_uv = &ch->sn.uv; |
1310 | 1310 | ||
1311 | msg_slot = (struct xpc_notify_mq_msg_uv *)((u64)ch_uv->recv_msg_slots + | 1311 | msg_slot = ch_uv->recv_msg_slots + |
1312 | (msg->hdr.msg_slot_number % ch->remote_nentries) * | 1312 | (msg->hdr.msg_slot_number % ch->remote_nentries) * ch->entry_size; |
1313 | ch->entry_size); | ||
1314 | 1313 | ||
1315 | BUG_ON(msg->hdr.msg_slot_number != msg_slot->hdr.msg_slot_number); | 1314 | BUG_ON(msg->hdr.msg_slot_number != msg_slot->hdr.msg_slot_number); |
1316 | BUG_ON(msg_slot->hdr.size != 0); | 1315 | BUG_ON(msg_slot->hdr.size != 0); |