Linux Serial subsystem development
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@ti.com>
To: Andre Wolokita <Andre.Wolokita@analog.com>
Cc: linux-usb@vger.kernel.org, balbi@ti.com,
	stern@rowland.harvard.edu, alan@linux.intel.com,
	linux-serial@vger.kernel.org
Subject: Re: [PATCH] u_serial.c - Force destroy tty_port in gserial_free_port
Date: Wed, 8 Oct 2014 20:06:42 -0500	[thread overview]
Message-ID: <20141009010642.GB4178@saruman> (raw)
In-Reply-To: <5435D59F.3050704@analog.com>

[-- Attachment #1: Type: text/plain, Size: 1597 bytes --]

Hi,

On Thu, Oct 09, 2014 at 11:23:59AM +1100, 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.

does anybody know if this is a valid usecase ? I'd expect us to return
-EBUSY in such a case, no ? In any case, using g_serial to rmmod
g_serial is, from what I can tell, not supported.

Let's wait to hear from Alan Cox or somebody else.

> 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.
> 
> Signed-off-by: Andre Wolokita <Andre.Wolokita@analog.com>
> ---
>  drivers/usb/gadget/function/u_serial.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c
> index ad0aca8..db631c4 100644
> --- 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);
>  }
> 
> -- 

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

           reply	other threads:[~2014-10-09  1:06 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <5435D59F.3050704@analog.com>]

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=20141009010642.GB4178@saruman \
    --to=balbi@ti.com \
    --cc=Andre.Wolokita@analog.com \
    --cc=alan@linux.intel.com \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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