From: Viresh Kumar Date: Mon, 24 Nov 2014 03:55:24 +0000 (+0530) Subject: greybus: es1-ap-usb: don't use 'es1' after it is freed X-Git-Tag: v4.9-rc1~119^2~378^2~21^2~1820 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=ecc25a7f58d9be842f591800f13f932396fb72af;p=karo-tx-linux.git greybus: es1-ap-usb: don't use 'es1' after it is freed greybus_remove_hd() will free memory allocated to 'es1' and so using it after the routine has returned isn't right. Signed-off-by: Viresh Kumar Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/es1-ap-usb.c b/drivers/staging/greybus/es1-ap-usb.c index bab6f259dd70..204784329716 100644 --- a/drivers/staging/greybus/es1-ap-usb.c +++ b/drivers/staging/greybus/es1-ap-usb.c @@ -293,6 +293,7 @@ static int check_urb_status(struct urb *urb) static void ap_disconnect(struct usb_interface *interface) { struct es1_ap_dev *es1; + struct usb_device *udev; int i; es1 = usb_get_intfdata(interface); @@ -329,9 +330,10 @@ static void ap_disconnect(struct usb_interface *interface) es1->svc_buffer = NULL; usb_set_intfdata(interface, NULL); + udev = es1->usb_dev; greybus_remove_hd(es1->hd); - usb_put_dev(es1->usb_dev); + usb_put_dev(udev); } /* Callback for when we get a SVC message */