Skip to content

Commit fc0f8fc

Browse files
Oliver Neukumgregkh
authored andcommitted
USB: memory leak in iowarrior.c
this is a classical memory leak in the ioctl handler. The buffer is simply never freed. This fixes it the obvious way. Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent 944dc18 commit fc0f8fc

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎drivers/usb/misc/iowarrior.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -495,8 +495,8 @@ static int iowarrior_ioctl(struct inode *inode, struct file *file,
495495

496496
/* verify that the device wasn't unplugged */
497497
if (!dev->present) {
498-
mutex_unlock(&dev->mutex);
499-
return -ENODEV;
498+
retval = -ENODEV;
499+
goto error_out;
500500
}
501501

502502
dbg("%s - minor %d, cmd 0x%.4x, arg %ld", __func__, dev->minor, cmd,
@@ -579,9 +579,10 @@ static int iowarrior_ioctl(struct inode *inode, struct file *file,
579579
retval = -ENOTTY;
580580
break;
581581
}
582-
582+
error_out:
583583
/* unlock the device */
584584
mutex_unlock(&dev->mutex);
585+
kfree(buffer);
585586
return retval;
586587
}
587588

0 commit comments

Comments
 (0)