Commit 9bea3f29 authored by Florin Malita's avatar Florin Malita Committed by Linus Torvalds

spi: potential memleak in spidev_ioctl

'ioc' should be deallocated if __copy_from_user fails (found by Coverity
- CID 1644).
Signed-off-by: default avatarFlorin Malita <fmalita@gmail.com>
Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 6087b2da
...@@ -364,6 +364,7 @@ spidev_ioctl(struct inode *inode, struct file *filp, ...@@ -364,6 +364,7 @@ spidev_ioctl(struct inode *inode, struct file *filp,
break; break;
} }
if (__copy_from_user(ioc, (void __user *)arg, tmp)) { if (__copy_from_user(ioc, (void __user *)arg, tmp)) {
kfree(ioc);
retval = -EFAULT; retval = -EFAULT;
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment