linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	linux-usb <linux-usb@vger.kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	linux-media@vger.kernel.org,
	linux-uvc-devel@lists.sourceforge.net,
	Sakari Ailus <sakari.ailus@iki.fi>
Subject: Re: Protecting uvcvideo againt USB device disconnect [Was: Re: Protecting usb_set_interface() against device removal]
Date: Wed, 19 Aug 2020 21:31:22 -0400	[thread overview]
Message-ID: <20200820013122.GA202178@rowland.harvard.edu> (raw)
In-Reply-To: <20200819230851.GA222844@roeck-us.net>

On Wed, Aug 19, 2020 at 04:08:51PM -0700, Guenter Roeck wrote:

> usb_set_interface() should not be called anymore after uvc_disconnect(),
> or at east I think so (is that documented anywhere ?).

It may be documented somewhere, but basically it goes without saying.  

A main feature of the device model design is that drivers get bound to 
devices by having their probe routine called, and they get unbound by 
having their disconnect routine called.  It should go without saying 
that once a driver is unbound from a device, it must not communicate 
with that device any more.

It might be nice if this requirement could be enforced (say in the USB 
core), but doing so is impractical.  It would require every I/O request 
to include some sort of cookie proving that the caller is authorized to 
make the request.  That's not how the kernel works; it trusts drivers 
to generally do the right thing without constant checking.

Alan Stern

  reply	other threads:[~2020-08-20  1:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-14 23:07 Protecting usb_set_interface() against device removal Guenter Roeck
2020-08-15  2:07 ` Alan Stern
2020-08-15  4:46   ` Guenter Roeck
2020-08-16  0:33   ` Protecting uvcvideo againt USB device disconnect [Was: Re: Protecting usb_set_interface() against device removal] Guenter Roeck
2020-08-16 12:18     ` Laurent Pinchart
2020-08-16 15:54       ` Guenter Roeck
2020-08-16 23:51         ` Laurent Pinchart
2020-08-17 11:00           ` Hans Verkuil
2020-08-19  1:30             ` Laurent Pinchart
2020-08-19  7:27               ` Hans Verkuil
2020-08-19 11:18                 ` Laurent Pinchart
2020-08-19 23:08               ` Guenter Roeck
2020-08-20  1:31                 ` Alan Stern [this message]
2020-08-20 10:15                 ` Laurent Pinchart
2020-08-20 14:19                   ` Guenter Roeck

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=20200820013122.GA202178@rowland.harvard.edu \
    --to=stern@rowland.harvard.edu \
    --cc=gregkh@linuxfoundation.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux-uvc-devel@lists.sourceforge.net \
    --cc=linux@roeck-us.net \
    --cc=sakari.ailus@iki.fi \
    /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).