Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4020097ybv; Tue, 25 Feb 2020 11:35:22 -0800 (PST) X-Google-Smtp-Source: APXvYqz1vuLUtLEOoxp5zwqtWv0X1Ezbxm0dOVt4WMWljXNesLDjK4xzuEU8V+MetVNnzkybnnrb X-Received: by 2002:a9d:34c:: with SMTP id 70mr146517otv.174.1582659322234; Tue, 25 Feb 2020 11:35:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582659322; cv=none; d=google.com; s=arc-20160816; b=0LxJJva/IoxnwElGNEFyOHtLvp3sJlgzcjJ+AWbrBnp9ndy4lmjJRb5TszulNyW4V6 HyNs8Hgp4t5NkhRnFVE4YLQnwl2eaNDzHy2lSDiZjwU6zHgL7EzsdvMfL4qqTeLCLwd3 CoXfEgg8v+TAKdCX9ZeWSxhCNoipBFfdKy/l3nPjKGi9+aoxr8b48sajQMLW9BXFxIhb 3P90DZgtCmj8UHbG9BUUp/Q3rTpg5aU3goVorOM+tTZlRvQ/e9Btc+6RRRNY7zSnG934 +r007tUjl+kAqqvZoSznInDkFB/lqZPNeUUsQyADUFTx1rfsALEfaF9qJ5S1PQRDZFch QSUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=SrE9mLiixlRkdFckz36Lkqd/7Z1i3Q/YIvtYXnP355o=; b=WSRuhLiyBDKvOo95q2HaLhvJHAYWV2K4DZTACNBuOuWlRFd7cast4tqa3x149FuA9U 6QIxOWd1tR0wfhoWZ8+mU1VIC80P618jBGGy7sGVx1M3ZExERU9+pB44deKck0sIhsXC 3DKaFAcS0huE3Do9SY0D8YsrSypkqGChh7Tsonnc1dtO3BD0Sa7UZZ01BIsSr630q9CF olFncoBi14J33JebURdDgx4Xj+233sattxFbGVkA7Im7C1pp4oJvsK0Dg3u7hxfLrA// erwvP17IcPUla5MOD/3FqllubxU04d4+fmM9gnopLW3r8TAuoPCDeAC+CYPToVUydBuI CyLA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v141si64331oif.161.2020.02.25.11.35.09; Tue, 25 Feb 2020 11:35:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730968AbgBYTMw (ORCPT + 99 others); Tue, 25 Feb 2020 14:12:52 -0500 Received: from smtp1.de.adit-jv.com ([93.241.18.167]:53783 "EHLO smtp1.de.adit-jv.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728515AbgBYTMw (ORCPT ); Tue, 25 Feb 2020 14:12:52 -0500 Received: from localhost (smtp1.de.adit-jv.com [127.0.0.1]) by smtp1.de.adit-jv.com (Postfix) with ESMTP id 0D6353C009D; Tue, 25 Feb 2020 20:12:50 +0100 (CET) Received: from smtp1.de.adit-jv.com ([127.0.0.1]) by localhost (smtp1.de.adit-jv.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Xi8uvvwKm-pQ; Tue, 25 Feb 2020 20:12:44 +0100 (CET) Received: from HI2EXCH01.adit-jv.com (hi2exch01.adit-jv.com [10.72.92.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by smtp1.de.adit-jv.com (Postfix) with ESMTPS id 4C76E3C005E; Tue, 25 Feb 2020 20:12:44 +0100 (CET) Received: from lxhi-065.adit-jv.com (10.72.93.66) by HI2EXCH01.adit-jv.com (10.72.92.24) with Microsoft SMTP Server (TLS) id 14.3.468.0; Tue, 25 Feb 2020 20:12:43 +0100 Date: Tue, 25 Feb 2020 20:12:41 +0100 From: Eugeniu Rosca To: Alan Stern CC: , , , Greg Kroah-Hartman , Thinh Nguyen , "Lee, Chiasheng" , Mathieu Malaterre , Kai-Heng Feng , Hardik Gajjar , , Eugeniu Rosca , Eugeniu Rosca Subject: Re: [PATCH] usb: hub: Fix unhandled return value of usb_autopm_get_interface() Message-ID: <20200225191241.GA32410@lxhi-065.adit-jv.com> References: <20200225130846.20236-1-erosca@de.adit-jv.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: X-Originating-IP: [10.72.93.66] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Alan, Many thanks for the prompt review. On Tue, Feb 25, 2020 at 10:32:32AM -0500, Alan Stern wrote: > On Tue, 25 Feb 2020, Eugeniu Rosca wrote: > > + int r = usb_autopm_get_interface(intf); > > + > > + if (!r) > > + hub->quirk_disable_autosuspend = 1; > > + else > > + dev_dbg(&intf->dev, "disable autosuspend err=%d\n", r); > > } > > > > if (hub_configure(hub, &desc->endpoint[0].desc) >= 0) > > This change is not necessary, because the resume operation cannot fail > at this point (interfaces are always powered-up during probe). Agreed to avoid unneeded complexity. > A better solution would be to call usb_autpm_get_interface_no_resume() > instead. Pushed to https://lore.kernel.org/lkml/20200225183057.31953-1-erosca@de.adit-jv.com > > On the other hand, the other places that call > usb_autopm_get_interface() without checking should be audited. Some of > them almost certainly need to be fixed. A quick 'git grep' outputs below list of auditable candidates [1]. With no relevant devices at hand, I would avoid touching these drivers, since oftentimes even legitimate patches introduce regressions w/o testing. If anybody volunteers with testing, I guess it should be quick to either convert usb_autpm_get_interface to *_no_resume variant or handle the return value in place in below instances. [1] (v5.6-rc3) git grep -En "[^=]\s+usb_autopm_get_interface\(" drivers/input/touchscreen/usbtouchscreen.c:1788: usb_autopm_get_interface(intf); drivers/media/usb/stkwebcam/stk-webcam.c:628: usb_autopm_get_interface(dev->interface); drivers/net/usb/hso.c:1308: usb_autopm_get_interface(serial->parent->interface); drivers/net/usb/r8152.c:5231: usb_autopm_get_interface(tp->intf); sound/usb/usx2y/us122l.c:192: usb_autopm_get_interface(iface); -- Best Regards Eugeniu Rosca