Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e79cc615 authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Felipe Balbi
Browse files

usb: gadget: network: fix bind() error path



I think this is wrong since 72c973dd ("usb: gadget: add
usb_endpoint_descriptor to struct usb_ep"). If we fail to allocate an ep
or bail out early we shouldn't check for the descriptor which is
assigned at ep_enable() time.

Cc: Tatyana Brokhman <tlinder@codeaurora.org>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 391aa852
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -809,9 +809,9 @@ ecm_bind(struct usb_configuration *c, struct usb_function *f)
	/* we might as well release our claims on endpoints */
	if (ecm->notify)
		ecm->notify->driver_data = NULL;
	if (ecm->port.out_ep->desc)
	if (ecm->port.out_ep)
		ecm->port.out_ep->driver_data = NULL;
	if (ecm->port.in_ep->desc)
	if (ecm->port.in_ep)
		ecm->port.in_ep->driver_data = NULL;

	ERROR(cdev, "%s: can't bind, err %d\n", f->name, status);
+2 −3
Original line number Diff line number Diff line
@@ -319,10 +319,9 @@ eem_bind(struct usb_configuration *c, struct usb_function *f)
	if (f->hs_descriptors)
		usb_free_descriptors(f->hs_descriptors);

	/* we might as well release our claims on endpoints */
	if (eem->port.out_ep->desc)
	if (eem->port.out_ep)
		eem->port.out_ep->driver_data = NULL;
	if (eem->port.in_ep->desc)
	if (eem->port.in_ep)
		eem->port.in_ep->driver_data = NULL;

	ERROR(cdev, "%s: can't bind, err %d\n", f->name, status);
+2 −2
Original line number Diff line number Diff line
@@ -1259,9 +1259,9 @@ ncm_bind(struct usb_configuration *c, struct usb_function *f)
	/* we might as well release our claims on endpoints */
	if (ncm->notify)
		ncm->notify->driver_data = NULL;
	if (ncm->port.out_ep->desc)
	if (ncm->port.out_ep)
		ncm->port.out_ep->driver_data = NULL;
	if (ncm->port.in_ep->desc)
	if (ncm->port.in_ep)
		ncm->port.in_ep->driver_data = NULL;

	ERROR(cdev, "%s: can't bind, err %d\n", f->name, status);
+2 −2
Original line number Diff line number Diff line
@@ -803,9 +803,9 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f)
	/* we might as well release our claims on endpoints */
	if (rndis->notify)
		rndis->notify->driver_data = NULL;
	if (rndis->port.out_ep->desc)
	if (rndis->port.out_ep)
		rndis->port.out_ep->driver_data = NULL;
	if (rndis->port.in_ep->desc)
	if (rndis->port.in_ep)
		rndis->port.in_ep->driver_data = NULL;

	ERROR(cdev, "%s: can't bind, err %d\n", f->name, status);
+2 −2
Original line number Diff line number Diff line
@@ -370,9 +370,9 @@ geth_bind(struct usb_configuration *c, struct usb_function *f)
		usb_free_descriptors(f->hs_descriptors);

	/* we might as well release our claims on endpoints */
	if (geth->port.out_ep->desc)
	if (geth->port.out_ep)
		geth->port.out_ep->driver_data = NULL;
	if (geth->port.in_ep->desc)
	if (geth->port.in_ep)
		geth->port.in_ep->driver_data = NULL;

	ERROR(cdev, "%s: can't bind, err %d\n", f->name, status);