Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp348333pxb; Thu, 30 Sep 2021 07:22:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrrd1Kk1yxSCJDC6eVa1udxLAM3seg/o4opexZa3pbOw5xPgCdJZH5LhE1XdleM9gm6a3N X-Received: by 2002:a17:902:b490:b0:13d:588b:d857 with SMTP id y16-20020a170902b49000b0013d588bd857mr5622018plr.16.1633011778722; Thu, 30 Sep 2021 07:22:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633011778; cv=none; d=google.com; s=arc-20160816; b=mZljDiMSl67TjSUAGYoccJr8EsnRbMk2IfohE7cY7bnRqCxtPmInaZV9WPc91ys1k0 tDDsaCLtoEljfa0vKjEtY6Ey0XM0qAxYNTQElL8aN3rTesCoCyQquYjjudQQJ6UN8ghn XC0lnfA/DkGnFXTgi+KzhMWysTdNNvsx8J0xxHf9d3VBBTxBrVYQGCjIkaHcHTOz9cLo cGIP9CLUM9t6laDrax8cOed8BzMJTIbi7mtJu3ALMX0GhGRcic27BNqWsXKMcTJMccMd 7bJqy7aYwglVoTLMALSiBqbiqGFiK+LhUtQqtyscLrqUojCm5BJTaxaQlPlKEfLnnXBz xnZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=A0kBNA83hCb4HCc/FO3KjbqdDYyweltNhd4aS4t5/kU=; b=QVm6Hb6fkX7filU8wb2jNCKUmPGGfIXtP52EN43daleq2Ctlc7tQopEtoBuX0zBPG4 FLKEk9kCGOumbSABoBd+9M7vlQ4gLwKE5WwxJ9YkCL7pkrvuoWQpintdkJeUik/KrvLj pzedkA9BkB/lRIXzRxNc17FlADAjmzwULJ6bmhWjX6l5FvZ356mGX+pR9kHV7DH29f56 j5J1gcU//yyJVTV8kCqCOvpAnGNsQT3h+5mbIW3iJTyg4bXd/d3FPPoZO/DQ2/Q/iQV+ kOpuHswGOdYiaoEKwY723KFfdmZtEUD+Uns8L3QUOZSWuKEADRYEewmgp62O+p4L8lea aG7w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g22si5736063pfj.172.2021.09.30.07.22.45; Thu, 30 Sep 2021 07:22:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349123AbhI3JGy (ORCPT + 99 others); Thu, 30 Sep 2021 05:06:54 -0400 Received: from mail-ot1-f42.google.com ([209.85.210.42]:39505 "EHLO mail-ot1-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348505AbhI3JGy (ORCPT ); Thu, 30 Sep 2021 05:06:54 -0400 Received: by mail-ot1-f42.google.com with SMTP id j11-20020a9d190b000000b00546fac94456so6413383ota.6; Thu, 30 Sep 2021 02:05:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=A0kBNA83hCb4HCc/FO3KjbqdDYyweltNhd4aS4t5/kU=; b=ZQ03FvJTEVQgULL5OLEhNdTmZvrPWMrXROd0pTRxLQZ+a6FeveJ+mcBQqrxogW1hQ5 mdz0OPDeb36InyIXjRXRuu1rvSZWm60yjIZtW80Sm3TfQ760acisFrq0bATbPppPGVtW cuWt529BWO7y9B5RDxBC+rgdaeTgp5PTMKPTgLjtvQD1R6DmxL3zdiltg22154XI5r89 1J8QwxfL47Jiv1P18MVOTs54AAS2ljT+v/lMkX9oEOZurxNi1lYYgBl2UXjpTUcJW8TJ pzdOlfzssehxDMidDcALXpEqUyEjK0/2p5gu7t38ywiP1V7mlIKnpifgk9aEGXf2aKAY cEbw== X-Gm-Message-State: AOAM530FwqgiVHJN65gBistiziBI4/Qc3LOQgMmGfk9atCYeMDIMVHTI LYLS80UoHF3AMorsAnkfTEsMvqoPEVXohcQk2nk= X-Received: by 2002:a05:6830:2784:: with SMTP id x4mr4274581otu.86.1632992711404; Thu, 30 Sep 2021 02:05:11 -0700 (PDT) MIME-Version: 1.0 References: <20210930010511.3387967-1-sathyanarayanan.kuppuswamy@linux.intel.com> <20210930010511.3387967-2-sathyanarayanan.kuppuswamy@linux.intel.com> <20210930014229.GA447956@rowland.harvard.edu> In-Reply-To: From: "Rafael J. Wysocki" Date: Thu, 30 Sep 2021 11:05:00 +0200 Message-ID: Subject: Re: [PATCH v2 1/6] driver core: Move the "authorized" attribute from USB/Thunderbolt to core To: Dan Williams Cc: "Kuppuswamy, Sathyanarayanan" , Alan Stern , Greg Kroah-Hartman , Borislav Petkov , X86 ML , Bjorn Helgaas , Thomas Gleixner , Ingo Molnar , Andreas Noever , "Michael S . Tsirkin" , Michael Jamet , Yehezkel Bernat , "Rafael J . Wysocki" , Mika Westerberg , Jonathan Corbet , Jason Wang , Andi Kleen , Kuppuswamy Sathyanarayanan , Linux Kernel Mailing List , Linux PCI , USB list , virtualization@lists.linux-foundation.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 30, 2021 at 6:59 AM Dan Williams wrote: > > On Wed, Sep 29, 2021 at 7:39 PM Kuppuswamy, Sathyanarayanan > wrote: > > > > > > > > On 9/29/21 6:55 PM, Dan Williams wrote: > > >> Also, you ignored the usb_[de]authorize_interface() functions and > > >> their friends. > > > Ugh, yes. > > > > I did not change it because I am not sure about the interface vs device > > dependency. > > > > This is was the rationale for has_probe_authorization flag. USB > performs authorization of child devices based on the authorization > state of the parent interface. > > > I think following change should work. > > > > diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c > > index f57b5a7a90ca..84969732d09c 100644 > > --- a/drivers/usb/core/driver.c > > +++ b/drivers/usb/core/driver.c > > @@ -334,7 +334,7 @@ static int usb_probe_interface(struct device *dev) > > if (udev->dev.authorized == false) { > > dev_err(&intf->dev, "Device is not authorized for usage\n"); > > return error; > > - } else if (intf->authorized == 0) { > > + } else if (intf->dev.authorized == 0) { > > == false Or even (!intf->dev.authorized). > > dev_err(&intf->dev, "Interface %d is not authorized for usage\n", > > intf->altsetting->desc.bInterfaceNumber); > > return error; > > @@ -546,7 +546,7 @@ int usb_driver_claim_interface(struct usb_driver *driver, > > return -EBUSY; > > > > /* reject claim if interface is not authorized */ > > - if (!iface->authorized) > > + if (!iface->dev.authorized) > > I'd do == false to keep it consistent with other conversions. But this looks odd, FWIW.