On Tue, 8 Nov 2016, Souptick Joarder wrote:
> In usb_parse_interface() when usb_parse_endpoint() fails it returns
> error whithout freeing alt->endpoint and we may have a memory leak.
> Fix this by freeing alt->endpoint before return.
>
> Signed-off-by: Souptick joarder <[email protected]>
NAK. alt->endpoint is deallocated in usb_release_interface_cache()
even if usb_parse_endpoint() fails.
Alan Stern
> ---
> drivers/usb/core/config.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
> index a2d90ac..6f599b6 100644
> --- a/drivers/usb/core/config.c
> +++ b/drivers/usb/core/config.c
> @@ -492,8 +492,10 @@ static int usb_parse_interface(struct device *ddev, int
> cfgno,
> break;
> retval = usb_parse_endpoint(ddev, cfgno, inum, asnum, alt,
> num_ep, buffer, size);
> - if (retval < 0)
> + if (retval < 0) {
> + kfree(alt->endpoint);
> return retval;
> + }
> ++n;
>
> buffer += retval;
>
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html