linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Neukum <oneukum@suse.de>
To: Joakim Tjernlund <joakim.tjernlund@infinera.com>,
	"linux-usb @ vger . kernel . org" <linux-usb@vger.kernel.org>
Cc: stable@vger.kernel.org
Subject: Re: [PATCH] cdc-acm: acm_init: Set initial BAUD to B0
Date: Mon, 13 Jul 2020 12:08:59 +0200	[thread overview]
Message-ID: <1594634939.2541.3.camel@suse.de> (raw)
In-Reply-To: <20200710093518.22272-1-joakim.tjernlund@infinera.com>

Am Freitag, den 10.07.2020, 11:35 +0200 schrieb Joakim Tjernlund:
> 


Hi,

> --- a/drivers/usb/class/cdc-acm.c
> +++ b/drivers/usb/class/cdc-acm.c
> @@ -1999,19 +1999,19 @@ static int __init acm_init(void)
>  	acm_tty_driver->subtype = SERIAL_TYPE_NORMAL,
>  	acm_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
>  	acm_tty_driver->init_termios = tty_std_termios;
> -	acm_tty_driver->init_termios.c_cflag = B9600 | CS8 | CREAD |
> +	acm_tty_driver->init_termios.c_cflag = B0 | CS8 | CREAD |
>  								HUPCL | CLOCAL;
>  	tty_set_operations(acm_tty_driver, &acm_ops);
>  
> -	retval = tty_register_driver(acm_tty_driver);
> +	retval = usb_register(&acm_driver);


No,

you cannot do that. This means that probe() is now live.
Probe() in turn does this:

        tty_dev = tty_port_register_device(&acm->port, acm_tty_driver, minor,
                        &control_interface->dev);
        if (IS_ERR(tty_dev)) {
                rv = PTR_ERR(tty_dev);
                goto alloc_fail6;
        }


That is just not a good idea when the tty is not already registered.
You are opening up a race.

	Regards
		Oliver


  parent reply	other threads:[~2020-07-13 10:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-10  9:35 [PATCH] cdc-acm: acm_init: Set initial BAUD to B0 Joakim Tjernlund
2020-07-10  9:54 ` Johan Hovold
2020-07-10 10:16   ` Joakim Tjernlund
2020-07-10 10:36     ` Greg KH
2020-07-10 10:48       ` Joakim Tjernlund
2020-07-10 12:37     ` Johan Hovold
2020-07-10 10:34 ` Greg KH
2020-07-10 10:40   ` Joakim Tjernlund
2020-07-10 10:46   ` Joakim Tjernlund
2020-07-10 12:41     ` Johan Hovold
2020-07-10 16:05       ` Joakim Tjernlund
2020-07-10 16:08         ` Joakim Tjernlund
2020-07-13 12:29         ` Johan Hovold
2020-07-13 10:08 ` Oliver Neukum [this message]
2020-07-13 20:26   ` Joakim Tjernlund
2020-07-14  7:02     ` Oliver Neukum
2020-07-14  9:06       ` Joakim Tjernlund

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=1594634939.2541.3.camel@suse.de \
    --to=oneukum@suse.de \
    --cc=joakim.tjernlund@infinera.com \
    --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;
as well as URLs for NNTP newsgroup(s).