moto_f_usbnet:Release skb if bulk_in is NULL

Ip link tearing down is later than the usbnet disabling.
Kernel will panic if bulk_in endpoint is NULL and ip stack still has data
Free the skb in this case.

Change-Id: Icc987551da4a8b9c1998b0c09f19fbed49ea58ee
Signed-off-by: a17671 <a17671@motorola.com>
Reviewed-on: https://gerrit.mot.com/1220589
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Igor Kovalenko <igork@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
a17671 2018-08-03 17:11:23 +08:00 • committed by Zonghua Liu
commit f3cbb755a7

View file

@ -349,6 +349,16 @@ static int usb_ether_xmit(struct sk_buff *skb, struct net_device *dev)
unsigned len;
int rc;
/*usbnet might be disabled before ip link down
* free the skb in this case
*/
if (NULL == context->bulk_in) {
dev_kfree_skb_any(skb);
USBNETDBG(context,
"%s:bulk_in end point is disabled\n", __func__);
return 0;
}
req = usb_get_xmit_request(STOP_QUEUE, dev);
if (!req) {