mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
USB: gadgetfs: Fix a potential memory leak in 'dev_config()'
'kbuf' is allocated just a few lines above using 'memdup_user()'. If the 'if (dev->buf)' test fails, this memory is never released. Signed-off-by: Christophe JAILLET <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
This commit is contained in:
parent
4242820277
commit
b6e7aeeaf2
1 changed files with 3 additions and 1 deletions
|
|
@ -1782,8 +1782,10 @@ dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
|
|||
|
||||
spin_lock_irq (&dev->lock);
|
||||
value = -EINVAL;
|
||||
if (dev->buf)
|
||||
if (dev->buf) {
|
||||
kfree(kbuf);
|
||||
goto fail;
|
||||
}
|
||||
dev->buf = kbuf;
|
||||
|
||||
/* full or low speed config */
|
||||
|
|
|
|||
Loading…
Reference in a new issue