All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] comedi: vmk80xx: fix expression for tx buffer size
@ 2022-06-06 10:52 Ian Abbott
  2022-06-07 16:16 ` Johan Hovold
  0 siblings, 1 reply; 4+ messages in thread
From: Ian Abbott @ 2022-06-06 10:52 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Ian Abbott, H Hartley Sweeten, Johan Hovold, stable

The expression for setting the size of the allocated bulk TX buffer
(`devpriv->usb_tx_buf`) is calling `usb_endpoint_maxp(devpriv->ep_rx)`,
which is using the wrong endpoint (should be `devpriv->ep_tx`).  Fix it.

Fixes: a23461c47482 ("comedi: vmk80xx: fix transfer-buffer overflow")
Cc: Johan Hovold <johan@kernel.org>
Cc: stable@vger.kernel.org # 5.10, 5.15+
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
 drivers/comedi/drivers/vmk80xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/comedi/drivers/vmk80xx.c b/drivers/comedi/drivers/vmk80xx.c
index 46023adc5395..4536ed43f65b 100644
--- a/drivers/comedi/drivers/vmk80xx.c
+++ b/drivers/comedi/drivers/vmk80xx.c
@@ -684,7 +684,7 @@ static int vmk80xx_alloc_usb_buffers(struct comedi_device *dev)
 	if (!devpriv->usb_rx_buf)
 		return -ENOMEM;
 
-	size = max(usb_endpoint_maxp(devpriv->ep_rx), MIN_BUF_SIZE);
+	size = max(usb_endpoint_maxp(devpriv->ep_tx), MIN_BUF_SIZE);
 	devpriv->usb_tx_buf = kzalloc(size, GFP_KERNEL);
 	if (!devpriv->usb_tx_buf)
 		return -ENOMEM;
-- 
2.35.1


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

* Re: [PATCH] comedi: vmk80xx: fix expression for tx buffer size
  2022-06-06 10:52 [PATCH] comedi: vmk80xx: fix expression for tx buffer size Ian Abbott
@ 2022-06-07 16:16 ` Johan Hovold
  2022-06-07 16:50   ` Ian Abbott
  0 siblings, 1 reply; 4+ messages in thread
From: Johan Hovold @ 2022-06-07 16:16 UTC (permalink / raw)
  To: Ian Abbott; +Cc: linux-kernel, Greg Kroah-Hartman, H Hartley Sweeten, stable

On Mon, Jun 06, 2022 at 11:52:37AM +0100, Ian Abbott wrote:
> The expression for setting the size of the allocated bulk TX buffer
> (`devpriv->usb_tx_buf`) is calling `usb_endpoint_maxp(devpriv->ep_rx)`,
> which is using the wrong endpoint (should be `devpriv->ep_tx`).  Fix it.

Bah. Good catch.

> Fixes: a23461c47482 ("comedi: vmk80xx: fix transfer-buffer overflow")
> Cc: Johan Hovold <johan@kernel.org>
> Cc: stable@vger.kernel.org # 5.10, 5.15+

I believe this one is needed in all stable trees (e.g. 4.9+).

> Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
> ---
>  drivers/comedi/drivers/vmk80xx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/comedi/drivers/vmk80xx.c b/drivers/comedi/drivers/vmk80xx.c
> index 46023adc5395..4536ed43f65b 100644
> --- a/drivers/comedi/drivers/vmk80xx.c
> +++ b/drivers/comedi/drivers/vmk80xx.c
> @@ -684,7 +684,7 @@ static int vmk80xx_alloc_usb_buffers(struct comedi_device *dev)
>  	if (!devpriv->usb_rx_buf)
>  		return -ENOMEM;
>  
> -	size = max(usb_endpoint_maxp(devpriv->ep_rx), MIN_BUF_SIZE);
> +	size = max(usb_endpoint_maxp(devpriv->ep_tx), MIN_BUF_SIZE);
>  	devpriv->usb_tx_buf = kzalloc(size, GFP_KERNEL);
>  	if (!devpriv->usb_tx_buf)
>  		return -ENOMEM;

Looks good otherwise:

Reviewed-by: Johan Hovold <johan@kernel.org>

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

* Re: [PATCH] comedi: vmk80xx: fix expression for tx buffer size
  2022-06-07 16:16 ` Johan Hovold
@ 2022-06-07 16:50   ` Ian Abbott
  2022-06-07 17:18     ` [PATCH v2] " Ian Abbott
  0 siblings, 1 reply; 4+ messages in thread
From: Ian Abbott @ 2022-06-07 16:50 UTC (permalink / raw)
  To: Johan Hovold; +Cc: linux-kernel, Greg Kroah-Hartman, H Hartley Sweeten, stable

On 07/06/2022 17:16, Johan Hovold wrote:
> On Mon, Jun 06, 2022 at 11:52:37AM +0100, Ian Abbott wrote:
>> The expression for setting the size of the allocated bulk TX buffer
>> (`devpriv->usb_tx_buf`) is calling `usb_endpoint_maxp(devpriv->ep_rx)`,
>> which is using the wrong endpoint (should be `devpriv->ep_tx`).  Fix it.
> 
> Bah. Good catch.
> 
>> Fixes: a23461c47482 ("comedi: vmk80xx: fix transfer-buffer overflow")
>> Cc: Johan Hovold <johan@kernel.org>
>> Cc: stable@vger.kernel.org # 5.10, 5.15+
> 
> I believe this one is needed in all stable trees (e.g. 4.9+).

True.  I didn't think the patch it fixes had been applied yet, but I 
didn't look hard enough.  I'll send a v2 with amended Cc line.

> 
>> Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
>> ---
>>   drivers/comedi/drivers/vmk80xx.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/comedi/drivers/vmk80xx.c b/drivers/comedi/drivers/vmk80xx.c
>> index 46023adc5395..4536ed43f65b 100644
>> --- a/drivers/comedi/drivers/vmk80xx.c
>> +++ b/drivers/comedi/drivers/vmk80xx.c
>> @@ -684,7 +684,7 @@ static int vmk80xx_alloc_usb_buffers(struct comedi_device *dev)
>>   	if (!devpriv->usb_rx_buf)
>>   		return -ENOMEM;
>>   
>> -	size = max(usb_endpoint_maxp(devpriv->ep_rx), MIN_BUF_SIZE);
>> +	size = max(usb_endpoint_maxp(devpriv->ep_tx), MIN_BUF_SIZE);
>>   	devpriv->usb_tx_buf = kzalloc(size, GFP_KERNEL);
>>   	if (!devpriv->usb_tx_buf)
>>   		return -ENOMEM;
> 
> Looks good otherwise:
> 
> Reviewed-by: Johan Hovold <johan@kernel.org>

Thanks for the review!

-- 
-=( Ian Abbott <abbotti@mev.co.uk> || MEV Ltd. is a company  )=-
-=( registered in England & Wales.  Regd. number: 02862268.  )=-
-=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=-
-=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=-

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

* [PATCH v2] comedi: vmk80xx: fix expression for tx buffer size
  2022-06-07 16:50   ` Ian Abbott
@ 2022-06-07 17:18     ` Ian Abbott
  0 siblings, 0 replies; 4+ messages in thread
From: Ian Abbott @ 2022-06-07 17:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Ian Abbott, H Hartley Sweeten, Johan Hovold, stable

The expression for setting the size of the allocated bulk TX buffer
(`devpriv->usb_tx_buf`) is calling `usb_endpoint_maxp(devpriv->ep_rx)`,
which is using the wrong endpoint (should be `devpriv->ep_tx`).  Fix it.

Fixes: a23461c47482 ("comedi: vmk80xx: fix transfer-buffer overflow")
Cc: Johan Hovold <johan@kernel.org>
Cc: stable@vger.kernel.org # 4.9+
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: Johan Hovold <johan@kernel.org>
---
v2: Amended Cc: stable@vger.kernel.org line to apply to 4.9+.
    Added Reviewed-by: Johan Hovold

 drivers/comedi/drivers/vmk80xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/comedi/drivers/vmk80xx.c b/drivers/comedi/drivers/vmk80xx.c
index 46023adc5395..4536ed43f65b 100644
--- a/drivers/comedi/drivers/vmk80xx.c
+++ b/drivers/comedi/drivers/vmk80xx.c
@@ -684,7 +684,7 @@ static int vmk80xx_alloc_usb_buffers(struct comedi_device *dev)
 	if (!devpriv->usb_rx_buf)
 		return -ENOMEM;
 
-	size = max(usb_endpoint_maxp(devpriv->ep_rx), MIN_BUF_SIZE);
+	size = max(usb_endpoint_maxp(devpriv->ep_tx), MIN_BUF_SIZE);
 	devpriv->usb_tx_buf = kzalloc(size, GFP_KERNEL);
 	if (!devpriv->usb_tx_buf)
 		return -ENOMEM;
-- 
2.35.1


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

end of thread, other threads:[~2022-06-07 17:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-06 10:52 [PATCH] comedi: vmk80xx: fix expression for tx buffer size Ian Abbott
2022-06-07 16:16 ` Johan Hovold
2022-06-07 16:50   ` Ian Abbott
2022-06-07 17:18     ` [PATCH v2] " Ian Abbott

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.