From: Randy Dunlap Date: Thu, 7 Dec 2006 04:38:23 +0000 (-0800) Subject: [PATCH] I2O: handle __copy_from_user X-Git-Tag: v2.6.20-rc1~145^2^2~129 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d69b7d3d115d0db3ddd87f09e496db7ecf72650;p=linux-2.6 [PATCH] I2O: handle __copy_from_user Handle __copy_from_user() return value. Noticed by inspection, not from build warning. Signed-off-by: Randy Dunlap Cc: Markus Lidel Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/message/i2o/i2o_config.c b/drivers/message/i2o/i2o_config.c index 7d23e082bf..685d7a4507 100644 --- a/drivers/message/i2o/i2o_config.c +++ b/drivers/message/i2o/i2o_config.c @@ -265,7 +265,11 @@ static int i2o_cfg_swdl(unsigned long arg) return -ENOMEM; } - __copy_from_user(buffer.virt, kxfer.buf, fragsize); + if (__copy_from_user(buffer.virt, kxfer.buf, fragsize)) { + i2o_msg_nop(c, msg); + i2o_dma_free(&c->pdev->dev, &buffer); + return -EFAULT; + } msg->u.head[0] = cpu_to_le32(NINE_WORD_MSG_SIZE | SGL_OFFSET_7); msg->u.head[1] =