stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] usb: gadget: printer: enqueue printer's response for setup" failed to apply to 3.14-stable tree
@ 2015-04-30 20:53 gregkh
  2015-05-05 10:30 ` [PATCH] usb: gadget: printer: enqueue printer's response for setup request Andrzej Pietrasiewicz
  0 siblings, 1 reply; 4+ messages in thread
From: gregkh @ 2015-04-30 20:53 UTC (permalink / raw)
  To: andrzej.p, balbi, stable; +Cc: stable


The patch below does not apply to the 3.14-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

>From eb132ccbdec5df46e29c9814adf76075ce83576b Mon Sep 17 00:00:00 2001
From: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Date: Tue, 3 Mar 2015 10:52:05 +0100
Subject: [PATCH] usb: gadget: printer: enqueue printer's response for setup
 request

Function-specific setup requests should be handled in such a way, that
apart from filling in the data buffer, the requests are also actually
enqueued: if function-specific setup is called from composte_setup(),
the "usb_ep_queue()" block of code in composite_setup() is skipped.

The printer function lacks this part and it results in e.g. get device id
requests failing: the host expects some response, the device prepares it
but does not equeue it for sending to the host, so the host finally asserts
timeout.

This patch adds enqueueing the prepared responses.

Cc: <stable@vger.kernel.org> # v3.4+
Fixes: 2e87edf49227: "usb: gadget: make g_printer use composite"
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>

diff --git a/drivers/usb/gadget/legacy/printer.c b/drivers/usb/gadget/legacy/printer.c
index 90545980542f..6385c198c134 100644
--- a/drivers/usb/gadget/legacy/printer.c
+++ b/drivers/usb/gadget/legacy/printer.c
@@ -1031,6 +1031,15 @@ unknown:
 		break;
 	}
 	/* host either stalls (value < 0) or reports success */
+	if (value >= 0) {
+		req->length = value;
+		req->zero = value < wLength;
+		value = usb_ep_queue(cdev->gadget->ep0, req, GFP_ATOMIC);
+		if (value < 0) {
+			ERROR(dev, "%s:%d Error!\n", __func__, __LINE__);
+			req->status = 0;
+		}
+	}
 	return value;
 }
 


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] usb: gadget: printer: enqueue printer's response for setup request
  2015-04-30 20:53 FAILED: patch "[PATCH] usb: gadget: printer: enqueue printer's response for setup" failed to apply to 3.14-stable tree gregkh
@ 2015-05-05 10:30 ` Andrzej Pietrasiewicz
  2015-05-05 12:04   ` Jiri Slaby
  0 siblings, 1 reply; 4+ messages in thread
From: Andrzej Pietrasiewicz @ 2015-05-05 10:30 UTC (permalink / raw)
  To: stable
  Cc: Andrzej Pietrasiewicz, Felipe Balbi, Greg Kroah-Hartman,
	Sebastian Andrzej Siewior, Marek Szyprowski

This is eb132ccbdec5df46e29c9814adf76075ce83576b
"usb: gadget: printer: enqueue printer's response for setup request"
ported to stable.

Function-specific setup requests should be handled in such a way, that
apart from filling in the data buffer, the requests are also actually
enqueued: if function-specific setup is called from composte_setup(),
the "usb_ep_queue()" block of code in composite_setup() is skipped.

The printer function lacks this part and it results in e.g. get device id
requests failing: the host expects some response, the device prepares it
but does not equeue it for sending to the host, so the host finally asserts
timeout.

This patch adds enqueueing the prepared responses.

Fixes: 2e87edf49227: "usb: gadget: make g_printer use composite"
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
[ported to stable]
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
---
 drivers/usb/gadget/printer.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c
index bf7a56b..a0dfdbd 100644
--- a/drivers/usb/gadget/printer.c
+++ b/drivers/usb/gadget/printer.c
@@ -975,6 +975,15 @@ unknown:
 		break;
 	}
 	/* host either stalls (value < 0) or reports success */
+	if (value >= 0) {
+		req->length = value;
+		req->zero = value < wLength;
+		value = usb_ep_queue(cdev->gadget->ep0, req, GFP_ATOMIC);
+		if (value < 0) {
+			ERROR(dev, "%s:%d Error!\n", __func__, __LINE__);
+			req->status = 0;
+		}
+	}
 	return value;
 }
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] usb: gadget: printer: enqueue printer's response for setup request
  2015-05-05 10:30 ` [PATCH] usb: gadget: printer: enqueue printer's response for setup request Andrzej Pietrasiewicz
@ 2015-05-05 12:04   ` Jiri Slaby
  2015-05-05 12:14     ` [PATCH RESEND] " Andrzej Pietrasiewicz
  0 siblings, 1 reply; 4+ messages in thread
From: Jiri Slaby @ 2015-05-05 12:04 UTC (permalink / raw)
  To: Andrzej Pietrasiewicz, stable
  Cc: Felipe Balbi, Greg Kroah-Hartman, Sebastian Andrzej Siewior,
	Marek Szyprowski

On 05/05/2015, 12:30 PM, Andrzej Pietrasiewicz wrote:
> This is eb132ccbdec5df46e29c9814adf76075ce83576b
> "usb: gadget: printer: enqueue printer's response for setup request"
> ported to stable.

Ported to which stable -- where do you want this to be applied? Thanks.

> Function-specific setup requests should be handled in such a way, that
> apart from filling in the data buffer, the requests are also actually
> enqueued: if function-specific setup is called from composte_setup(),
> the "usb_ep_queue()" block of code in composite_setup() is skipped.
> 
> The printer function lacks this part and it results in e.g. get device id
> requests failing: the host expects some response, the device prepares it
> but does not equeue it for sending to the host, so the host finally asserts
> timeout.
> 
> This patch adds enqueueing the prepared responses.
> 
> Fixes: 2e87edf49227: "usb: gadget: make g_printer use composite"
> Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
> Signed-off-by: Felipe Balbi <balbi@ti.com>
> [ported to stable]
> Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
> ---
>  drivers/usb/gadget/printer.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c
> index bf7a56b..a0dfdbd 100644
> --- a/drivers/usb/gadget/printer.c
> +++ b/drivers/usb/gadget/printer.c
> @@ -975,6 +975,15 @@ unknown:
>  		break;
>  	}
>  	/* host either stalls (value < 0) or reports success */
> +	if (value >= 0) {
> +		req->length = value;
> +		req->zero = value < wLength;
> +		value = usb_ep_queue(cdev->gadget->ep0, req, GFP_ATOMIC);
> +		if (value < 0) {
> +			ERROR(dev, "%s:%d Error!\n", __func__, __LINE__);
> +			req->status = 0;
> +		}
> +	}
>  	return value;
>  }
>  
> 


-- 
js
suse labs

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH RESEND] usb: gadget: printer: enqueue printer's response for setup request
  2015-05-05 12:04   ` Jiri Slaby
@ 2015-05-05 12:14     ` Andrzej Pietrasiewicz
  0 siblings, 0 replies; 4+ messages in thread
From: Andrzej Pietrasiewicz @ 2015-05-05 12:14 UTC (permalink / raw)
  To: stable
  Cc: Andrzej Pietrasiewicz, Jiri Slaby, Felipe Balbi,
	Greg Kroah-Hartman, Sebastian Andrzej Siewior, Marek Szyprowski

This is eb132ccbdec5df46e29c9814adf76075ce83576b
"usb: gadget: printer: enqueue printer's response for setup request"
ported to stable 3.10 and 3.14.

Function-specific setup requests should be handled in such a way, that
apart from filling in the data buffer, the requests are also actually
enqueued: if function-specific setup is called from composte_setup(),
the "usb_ep_queue()" block of code in composite_setup() is skipped.

The printer function lacks this part and it results in e.g. get device id
requests failing: the host expects some response, the device prepares it
but does not equeue it for sending to the host, so the host finally asserts
timeout.

This patch adds enqueueing the prepared responses.

Fixes: 2e87edf49227: "usb: gadget: make g_printer use composite"
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
[ported to stable 3.10 and 3.14]
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
---
 drivers/usb/gadget/printer.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c
index bf7a56b..a0dfdbd 100644
--- a/drivers/usb/gadget/printer.c
+++ b/drivers/usb/gadget/printer.c
@@ -975,6 +975,15 @@ unknown:
 		break;
 	}
 	/* host either stalls (value < 0) or reports success */
+	if (value >= 0) {
+		req->length = value;
+		req->zero = value < wLength;
+		value = usb_ep_queue(cdev->gadget->ep0, req, GFP_ATOMIC);
+		if (value < 0) {
+			ERROR(dev, "%s:%d Error!\n", __func__, __LINE__);
+			req->status = 0;
+		}
+	}
 	return value;
 }
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-05-05 12:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-30 20:53 FAILED: patch "[PATCH] usb: gadget: printer: enqueue printer's response for setup" failed to apply to 3.14-stable tree gregkh
2015-05-05 10:30 ` [PATCH] usb: gadget: printer: enqueue printer's response for setup request Andrzej Pietrasiewicz
2015-05-05 12:04   ` Jiri Slaby
2015-05-05 12:14     ` [PATCH RESEND] " Andrzej Pietrasiewicz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).