[PATCH] spi: potential memleak in spidev_ioctl

From: Florin Malita
Date: Wed May 16 2007 - 19:35:50 EST


'ioc' should be deallocated if __copy_from_user fails (found by Coverity - CID 1644).

Signed-off-by: Florin Malita <fmalita@xxxxxxxxx>
---

spidev.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
index c0a6dce..2464f34 100644
--- a/drivers/spi/spidev.c
+++ b/drivers/spi/spidev.c
@@ -364,6 +364,7 @@ spidev_ioctl(struct inode *inode, struct file *filp,
break;
}
if (__copy_from_user(ioc, (void __user *)arg, tmp)) {
+ kfree(ioc);
retval = -EFAULT;
break;
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/