提交 361916a9 编写于 作者: D Dean Nelson 提交者: Linus Torvalds

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: NDean Nelson <dcn@sgi.com>
Cc: <stable@kernel.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 fb9a6800
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* License. See the file "COPYING" in the main directory of this archive * License. See the file "COPYING" in the main directory of this archive
* for more details. * for more details.
* *
* Copyright (c) 2004-2008 Silicon Graphics, Inc. All Rights Reserved. * Copyright (c) 2004-2009 Silicon Graphics, Inc. All Rights Reserved.
*/ */
/* /*
...@@ -514,7 +514,8 @@ struct xpc_channel_uv { ...@@ -514,7 +514,8 @@ struct xpc_channel_uv {
/* partition's notify mq */ /* partition's notify mq */
struct xpc_send_msg_slot_uv *send_msg_slots; struct xpc_send_msg_slot_uv *send_msg_slots;
struct xpc_notify_mq_msg_uv *recv_msg_slots; void *recv_msg_slots; /* each slot will hold a xpc_notify_mq_msg_uv */
/* structure plus the user's payload */
struct xpc_fifo_head_uv msg_slot_free_list; struct xpc_fifo_head_uv msg_slot_free_list;
struct xpc_fifo_head_uv recv_msg_list; /* deliverable payloads */ struct xpc_fifo_head_uv recv_msg_list; /* deliverable payloads */
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* License. See the file "COPYING" in the main directory of this archive * License. See the file "COPYING" in the main directory of this archive
* for more details. * for more details.
* *
* Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved. * Copyright (c) 2008-2009 Silicon Graphics, Inc. All Rights Reserved.
*/ */
/* /*
...@@ -1010,8 +1010,8 @@ xpc_allocate_recv_msg_slot_uv(struct xpc_channel *ch) ...@@ -1010,8 +1010,8 @@ xpc_allocate_recv_msg_slot_uv(struct xpc_channel *ch)
continue; continue;
for (entry = 0; entry < nentries; entry++) { for (entry = 0; entry < nentries; entry++) {
msg_slot = ch_uv->recv_msg_slots + entry * msg_slot = ch_uv->recv_msg_slots +
ch->entry_size; entry * ch->entry_size;
msg_slot->hdr.msg_slot_number = entry; msg_slot->hdr.msg_slot_number = entry;
} }
...@@ -1308,9 +1308,8 @@ xpc_handle_notify_mq_msg_uv(struct xpc_partition *part, ...@@ -1308,9 +1308,8 @@ xpc_handle_notify_mq_msg_uv(struct xpc_partition *part,
/* we're dealing with a normal message sent via the notify_mq */ /* we're dealing with a normal message sent via the notify_mq */
ch_uv = &ch->sn.uv; ch_uv = &ch->sn.uv;
msg_slot = (struct xpc_notify_mq_msg_uv *)((u64)ch_uv->recv_msg_slots + msg_slot = ch_uv->recv_msg_slots +
(msg->hdr.msg_slot_number % ch->remote_nentries) * (msg->hdr.msg_slot_number % ch->remote_nentries) * ch->entry_size;
ch->entry_size);
BUG_ON(msg->hdr.msg_slot_number != msg_slot->hdr.msg_slot_number); BUG_ON(msg->hdr.msg_slot_number != msg_slot->hdr.msg_slot_number);
BUG_ON(msg_slot->hdr.size != 0); BUG_ON(msg_slot->hdr.size != 0);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册