From: Ian Abbott <abbotti@mev.co.uk>
To: Johan Hovold <johan@kernel.org>,
H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH 5/5] comedi: vmk80xx: fix bulk and interrupt message timeouts
Date: Tue, 26 Oct 2021 15:35:44 +0100 [thread overview]
Message-ID: <fb1c3dcd-39cd-d4e2-e6f5-061dad6b2751@mev.co.uk> (raw)
In-Reply-To: <20211025114532.4599-6-johan@kernel.org>
On 25/10/2021 12:45, Johan Hovold wrote:
> USB bulk and interrupt message timeouts are specified in milliseconds
> and should specifically not vary with CONFIG_HZ.
>
> Note that the bulk-out transfer timeout was set to the endpoint
> bInterval value, which should be ignored for bulk endpoints and is
> typically set to zero. This meant that a failing bulk-out transfer
> would never time out.
>
> Assume that the 10 second timeout used for all other transfers is more
> than enough also for the bulk-out endpoint.
>
> Fixes: 985cafccbf9b ("Staging: Comedi: vmk80xx: Add k8061 support")
> Fixes: 951348b37738 ("staging: comedi: vmk80xx: wait for URBs to complete")
> Cc: stable@vger.kernel.org # 2.6.31
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
> drivers/comedi/drivers/vmk80xx.c | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/comedi/drivers/vmk80xx.c b/drivers/comedi/drivers/vmk80xx.c
> index 9c56918e3b76..4b00a9ea611a 100644
> --- a/drivers/comedi/drivers/vmk80xx.c
> +++ b/drivers/comedi/drivers/vmk80xx.c
> @@ -91,6 +91,7 @@ enum {
> #define IC6_VERSION BIT(1)
>
> #define MIN_BUF_SIZE 64
> +#define PACKET_TIMEOUT 10000 /* ms */
>
> enum vmk80xx_model {
> VMK8055_MODEL,
> @@ -169,10 +170,11 @@ static void vmk80xx_do_bulk_msg(struct comedi_device *dev)
> tx_size = usb_endpoint_maxp(devpriv->ep_tx);
> rx_size = usb_endpoint_maxp(devpriv->ep_rx);
>
> - usb_bulk_msg(usb, tx_pipe, devpriv->usb_tx_buf,
> - tx_size, NULL, devpriv->ep_tx->bInterval);
> + usb_bulk_msg(usb, tx_pipe, devpriv->usb_tx_buf, tx_size, NULL,
> + PACKET_TIMEOUT);
>
> - usb_bulk_msg(usb, rx_pipe, devpriv->usb_rx_buf, rx_size, NULL, HZ * 10);
> + usb_bulk_msg(usb, rx_pipe, devpriv->usb_rx_buf, rx_size, NULL,
> + PACKET_TIMEOUT);
> }
>
> static int vmk80xx_read_packet(struct comedi_device *dev)
> @@ -191,7 +193,7 @@ static int vmk80xx_read_packet(struct comedi_device *dev)
> pipe = usb_rcvintpipe(usb, ep->bEndpointAddress);
> return usb_interrupt_msg(usb, pipe, devpriv->usb_rx_buf,
> usb_endpoint_maxp(ep), NULL,
> - HZ * 10);
> + PACKET_TIMEOUT);
> }
>
> static int vmk80xx_write_packet(struct comedi_device *dev, int cmd)
> @@ -212,7 +214,7 @@ static int vmk80xx_write_packet(struct comedi_device *dev, int cmd)
> pipe = usb_sndintpipe(usb, ep->bEndpointAddress);
> return usb_interrupt_msg(usb, pipe, devpriv->usb_tx_buf,
> usb_endpoint_maxp(ep), NULL,
> - HZ * 10);
> + PACKET_TIMEOUT);
> }
>
> static int vmk80xx_reset_device(struct comedi_device *dev)
>
Looks good, thanks!
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
--
-=( 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 )=-
prev parent reply other threads:[~2021-10-26 14:36 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-25 11:45 [PATCH 0/5] comedi: misc fixes Johan Hovold
2021-10-25 11:45 ` [PATCH 1/5] comedi: ni_usb6501: fix NULL-deref in command paths Johan Hovold
2021-10-26 14:12 ` Ian Abbott
2021-10-27 8:54 ` Johan Hovold
2021-10-25 11:45 ` [PATCH 2/5] comedi: dt9812: fix DMA buffers on stack Johan Hovold
2021-10-26 14:27 ` Ian Abbott
2021-10-27 9:05 ` Johan Hovold
2021-10-25 11:45 ` [PATCH 3/5] comedi: vmk80xx: fix transfer-buffer overflows Johan Hovold
2021-10-26 14:32 ` Ian Abbott
2021-10-25 11:45 ` [PATCH 4/5] comedi: vmk80xx: fix bulk-buffer overflow Johan Hovold
2021-10-26 14:34 ` Ian Abbott
2021-10-25 11:45 ` [PATCH 5/5] comedi: vmk80xx: fix bulk and interrupt message timeouts Johan Hovold
2021-10-26 14:35 ` Ian Abbott [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fb1c3dcd-39cd-d4e2-e6f5-061dad6b2751@mev.co.uk \
--to=abbotti@mev.co.uk \
--cc=gregkh@linuxfoundation.org \
--cc=hsweeten@visionengravers.com \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®