Skip to content

Commit

Permalink
wrong memory access in i2o_block_device_lock()
Browse files Browse the repository at this point in the history
This patch fixes access to memory that has not been allocated:
i2o_msg_get_wait() can returns errors different from I2O_QUEUE_EMPTY.  But the
result is checked only against this code.  If it is not I2O_QUEUE_EMPTY then
we dereference the error code as the pointer later.

Signed-off-by: Vasily Averin <vvs@sw.ru>
Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Markus Lidel <Markus.Lidel@shadowconnect.com>
Acked-by: Kirill Korotaev <dev@openvz.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Vasily Averin authored and Linus Torvalds committed Jul 17, 2007
1 parent 1725d71 commit 010904c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/message/i2o/i2o_block.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ static int i2o_block_device_lock(struct i2o_device *dev, u32 media_id)
struct i2o_message *msg;

msg = i2o_msg_get_wait(dev->iop, I2O_TIMEOUT_MESSAGE_GET);
if (IS_ERR(msg) == I2O_QUEUE_EMPTY)
if (IS_ERR(msg))
return PTR_ERR(msg);

msg->u.head[0] = cpu_to_le32(FIVE_WORD_MSG_SIZE | SGL_OFFSET_0);
Expand Down

0 comments on commit 010904c

Please sign in to comment.