Skip to content

Commit

Permalink
usb: gadget: function: printer: Fix a memory leak for interface descr…
Browse files Browse the repository at this point in the history
…iptor

commit 2cc332e upstream.

When printer driver is loaded, the printer_func_bind function is called, in
this function, the interface descriptor be allocated memory, if after that,
the error occurred, the interface descriptor memory need to be free.

Reviewed-by: Peter Chen <peter.chen@nxp.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Zqiang <qiang.zhang@windriver.com>
Link: https://lore.kernel.org/r/20201210020148.6691-1-qiang.zhang@windriver.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Zqiang1211 authored and gregkh committed Jan 12, 2021
1 parent c4aa893 commit e698e14
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/usb/gadget/function/f_printer.c
Expand Up @@ -1162,6 +1162,7 @@ static int printer_func_bind(struct usb_configuration *c,
printer_req_free(dev->in_ep, req);
}

usb_free_all_descriptors(f);
return ret;

}
Expand Down

0 comments on commit e698e14

Please sign in to comment.