From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A3ADC433E1 for ; Thu, 20 Aug 2020 01:31:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 594982076E for ; Thu, 20 Aug 2020 01:31:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726796AbgHTBbZ (ORCPT ); Wed, 19 Aug 2020 21:31:25 -0400 Received: from netrider.rowland.org ([192.131.102.5]:42429 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1726646AbgHTBbY (ORCPT ); Wed, 19 Aug 2020 21:31:24 -0400 Received: (qmail 202460 invoked by uid 1000); 19 Aug 2020 21:31:22 -0400 Date: Wed, 19 Aug 2020 21:31:22 -0400 From: Alan Stern To: Guenter Roeck Cc: Laurent Pinchart , Hans Verkuil , linux-usb , Greg Kroah-Hartman , "linux-kernel@vger.kernel.org" , linux-media@vger.kernel.org, linux-uvc-devel@lists.sourceforge.net, Sakari Ailus Subject: Re: Protecting uvcvideo againt USB device disconnect [Was: Re: Protecting usb_set_interface() against device removal] Message-ID: <20200820013122.GA202178@rowland.harvard.edu> References: <20200815020739.GB52242@rowland.harvard.edu> <20200816003315.GA13826@roeck-us.net> <20200816121816.GC32174@pendragon.ideasonboard.com> <9bb20ed7-b156-f6c2-4d25-6acac1a0021b@roeck-us.net> <20200816235155.GA7729@pendragon.ideasonboard.com> <0684b71c-8ac5-8962-cbd5-c0bcaa8b6881@xs4all.nl> <20200819013002.GL2360@pendragon.ideasonboard.com> <20200819230851.GA222844@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200819230851.GA222844@roeck-us.net> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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