Re: [PATCH v2 03/11] usbip: safe completion against usb_kill_urb()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 14, 2015 at 10:00 AM, Nobuo Iwata
<nobuo.iwata@xxxxxxxxxxxxxxx> wrote:
> stub_shutdown_connection() : drivers/usb/usbip/stub_dev.c
>      stub_device_cleanup_urbs() : drivers/usb/usbip/stub_main.c
> requests to kill pending URBs and clears priv lists.
>
> stub_complete() : drivers/usb/usbip/stub_tx.c might be called with URBs
> to have been requested to kill.
>
> To avoid kernel panic, this patch ignores killed URBs linked to cleared
> priv lists.
> To know the killed URBs in stub_complete(), sdev->ud.tcp_socket which
> cleared before stub_device_cleanup_urbs() is checked.
>
> Signed-off-by: Nobuo Iwata <nobuo.iwata@xxxxxxxxxxxxxxx>
> ---
>  drivers/usb/usbip/stub_tx.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/usbip/stub_tx.c b/drivers/usb/usbip/stub_tx.c
> index dbcabc9..f19f321 100644
> --- a/drivers/usb/usbip/stub_tx.c
> +++ b/drivers/usb/usbip/stub_tx.c
> @@ -97,7 +97,9 @@ void stub_complete(struct urb *urb)
>
>         /* link a urb to the queue of tx. */
>         spin_lock_irqsave(&sdev->priv_lock, flags);
> -       if (priv->unlinking) {
> +       if (sdev->ud.tcp_socket == NULL) {
> +               dev_info(&urb->dev->dev, "discard a urb for closed connection");
> +       } else if (priv->unlinking) {
>                 stub_enqueue_ret_unlink(sdev, priv->seqnum, urb->status);
>                 stub_free_priv_and_urb(priv);
>         } else {
> --
> 2.1.0
>

Looks good.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux