Linux-USB Archive on lore.kernel.org
 help / color / Atom feed
From: Oliver Neukum <oneukum@suse.com>
To: Johan Hovold <johan@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] USB: cdc-acm: fix unprivileged TIOCCSERIAL
Date: Thu, 08 Apr 2021 13:35:24 +0200
Message-ID: <a84e1199ea7534a20ccd313c011b798ee8306472.camel@suse.com> (raw)
In-Reply-To: <YG7P8EJ1obdM01J8@hovoldconsulting.com>

Am Donnerstag, den 08.04.2021, 11:42 +0200 schrieb Johan Hovold:
> On Thu, Apr 08, 2021 at 09:48:38AM +0200, Oliver Neukum wrote:
> > Am Mittwoch, den 07.04.2021, 12:28 +0200 schrieb Johan Hovold:
> > > TIOCSSERIAL is a horrid, underspecified, legacy interface which for most
> > > serial devices is only useful for setting the close_delay and
> > > closing_wait parameters.
> > > 
> > > A non-privileged user has only ever been able to set the since long
> > > deprecated ASYNC_SPD flags and trying to change any other *supported*
> > > feature should result in -EPERM being returned. Setting the current
> > > values for any supported features should return success.
> > > 
> > > Fix the cdc-acm implementation which instead indicated that the
> > > TIOCSSERIAL ioctl was not even implemented when a non-privileged user
> > > set the current values.
> > 
> > Hi,
> > 
> > the idea here was that you are setting something else, if you are
> > not changing a parameter that can be changed. That conclusion is
> > dubious, but at the same time, this implementation can change
> > only these two parameters. So can the test really be dropped
> > as opposed to be modified?
> 
> The de-facto standard for how to handle change requests for
> non-supported features (e.g. changing the I/O port or IRQ) is to simply
> ignore them and return 0.
> 
> For most (non-legacy) serial devices the only relevant parameters are
> close_delay and closing_wait. And as we need to return -EPERM when a
> non-privileged user tries to change these, we cannot drop the test.
> 
> (And returning -EOPNOTSUPP was never correct as the ioctl is indeed
> supported.)

OK, thanks for clarification. Yes the fix makes sense.

	Regards
		Oliver



  reply index

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-07 10:28 [PATCH 0/3] USB: cdc-acm: TIOCSSERIAL fixes Johan Hovold
2021-04-07 10:28 ` [PATCH 1/3] Revert "USB: cdc-acm: fix rounding error in TIOCSSERIAL" Johan Hovold
2021-04-07 11:04   ` Anthony Mallet
2021-04-07 11:25     ` Johan Hovold
2021-04-07 10:28 ` [PATCH 2/3] USB: cdc-acm: fix unprivileged TIOCCSERIAL Johan Hovold
2021-04-08  7:48   ` Oliver Neukum
2021-04-08  9:42     ` Johan Hovold
2021-04-08 11:35       ` Oliver Neukum [this message]
2021-04-07 10:28 ` [PATCH 3/3] USB: cdc-acm: fix TIOCGSERIAL implementation Johan Hovold
2021-04-08  8:36   ` Oliver Neukum
2021-04-08  9:48     ` Johan Hovold
2021-04-08 11:34       ` Oliver Neukum
2021-04-08 11:54         ` Johan Hovold
2021-04-08 11:59           ` Oliver Neukum
2021-04-08 12:07             ` Greg Kroah-Hartman

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=a84e1199ea7534a20ccd313c011b798ee8306472.camel@suse.com \
    --to=oneukum@suse.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@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

Linux-USB Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-usb/0 linux-usb/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-usb linux-usb/ https://lore.kernel.org/linux-usb \
		linux-usb@vger.kernel.org
	public-inbox-index linux-usb

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-usb


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git