Re: [PATCH] u_serial.c - Force destroy tty_port in gserial_free_port

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

 



On Thu, 9 Oct 2014, Andre Wolokita wrote:

> Issuing a modprobe -r g_serial command to the target
> over the gadget serial communications line causes
> modprobe to enter uninterruptable sleep, leaving the
> system in an unstable state.
> 
> The associated tty_port.count won't drop to 0 because
> the command is issued over the very line being removed.
> 
> Destroying the tty_port will ensure that resources are
> freed and modprobe will not hang.

You know, this last paragraph doesn't explain anything.  The existing 
code already calls tty_port_destroy; all you did was move that call 
down a couple of lines.  You need to explain why _moving_ the function 
call is important, not why _calling_ the function is important.

Alan Stern

> --- a/drivers/usb/gadget/function/u_serial.c
> +++ b/drivers/usb/gadget/function/u_serial.c
> @@ -1074,10 +1074,10 @@ static int gs_closed(struct gs_port *port)
>  static void gserial_free_port(struct gs_port *port)
>  {
>         tasklet_kill(&port->push);
> +       tty_port_destroy(&port->port);
>         /* wait for old opens to finish */
>         wait_event(port->port.close_wait, gs_closed(port));
>         WARN_ON(port->port_usb != NULL);
> -       tty_port_destroy(&port->port);
>         kfree(port);
>  }

--
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