write_parport_ref_nonblock increase mos_parport refcount without decrease it when return -ENOMEM code, so need a decrement before function return -ENOMEM. Signed-off-by: Lin Yi <teroincn@xxxxxxx> --- drivers/usb/serial/mos7720.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c index fc52ac7..6abb335 100644 --- a/drivers/usb/serial/mos7720.c +++ b/drivers/usb/serial/mos7720.c @@ -371,12 +371,14 @@ static int write_parport_reg_nonblock(struct mos7715_parport *mos_parport, urbtrack->urb = usb_alloc_urb(0, GFP_ATOMIC); if (!urbtrack->urb) { kfree(urbtrack); + kref_put(&mos_parport->ref_count, destroy_mos_parport); return -ENOMEM; } urbtrack->setup = kmalloc(sizeof(*urbtrack->setup), GFP_ATOMIC); if (!urbtrack->setup) { usb_free_urb(urbtrack->urb); kfree(urbtrack); + kref_put(&mos_parport->ref_count, destroy_mos_parport); return -ENOMEM; } urbtrack->setup->bRequestType = (__u8)0x40; -- 1.9.1