From: Pavankumar Kondeti Date: Thu, 16 Dec 2010 09:02:25 +0000 (+0530) Subject: USB: gadget: Remove suspended sysfs file before freeing cdev X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=daba58035a044cae75488175a96cc18362a64518;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git USB: gadget: Remove suspended sysfs file before freeing cdev cdev struct is accessed in suspended sysfs show function. So remove sysfs file before freeing the cdev in composite_unbind. Signed-off-by: Pavankumar Kondeti Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 7b5cc16e4a0b..96413a240fdf 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -1047,9 +1047,9 @@ composite_unbind(struct usb_gadget *gadget) kfree(cdev->req->buf); usb_ep_free_request(gadget->ep0, cdev->req); } + device_remove_file(&gadget->dev, &dev_attr_suspended); kfree(cdev); set_gadget_data(gadget, NULL); - device_remove_file(&gadget->dev, &dev_attr_suspended); composite = NULL; }