Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp1566693img; Tue, 19 Mar 2019 10:21:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqxhQ3YsBoN/j0+tNz5ZrA2jWPpJLpwu5InSO0Gi9CyBjVyJ85COH3IzGA7DyUpMP4J2+sjY X-Received: by 2002:a62:3585:: with SMTP id c127mr3405493pfa.71.1553016101645; Tue, 19 Mar 2019 10:21:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553016101; cv=none; d=google.com; s=arc-20160816; b=DdJXIv8uska2hNBfS23ZN6X3ha+iHrfWNMLQb3JQ6zwCyAv1IhkBmFgXYiQfCg7z3t kfT3CQIts1vokQz1JetD1tU/a9lPWl1NgkVY+ZrhY/hEYM8zhewOl7jhriwB0ZrvG5vp MCs8E2Kiq3FEGHFqAsguJVYI+hWnML6BdUswPDiaplC9uG0IhTF0NPeXmueY+vDE1JSo AR7NIHIwBC2yv/ZEhyhQIcTYlh2Dxk9wQWGF7wx538c/T3MpY6wBh0A0WPcbSOwULIes 1f1UXx25ixdWVxUEC8W0Hyqiof+oskjnSKMneXl65aftGzpq2KQ++NWvUzVOE4dMUOTj cFYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=KaR3N1FpAReCIY2t+BDFxfPRzj3N4WbhEtnv+BeiWXs=; b=fLRn8eEC1oNS0awjRdCUdm1huQ+Qzbze3UK/mkHP2+rG1IhrFXUp8SuUHFsGJUwhWQ JgZ4AIQ+UENUh0BbcJ0NOgnstyXXfg/jcQMs+TAxeQDAbA5dHqEzuFdE1c/AiCp7CJYw zBNNr+Dhd8YIzVxKE9cb0YjD6Mzh4F35ETktnhBGKr2tQf8VuNX7efIQHyeMlz7qBw1Y G+xUisLpjGXJmG0YhlDhe8aNj/iB21wBzkyyx+xq/sWC5Nz0LsfCW1w0rnyVbTb51KfX Rluor3b6ziyK76Ial551/2c72usDTA99STBgxiRuquvIJ7mGyIo9a53GjUBp0Jb79xGh VIcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@umn.edu header.s=google header.b=jDkbwlbY; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=umn.edu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x2si12344675plo.360.2019.03.19.10.21.26; Tue, 19 Mar 2019 10:21:41 -0700 (PDT) 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; dkim=pass header.i=@umn.edu header.s=google header.b=jDkbwlbY; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=umn.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727876AbfCSRUL (ORCPT + 99 others); Tue, 19 Mar 2019 13:20:11 -0400 Received: from mta-p6.oit.umn.edu ([134.84.196.206]:39036 "EHLO mta-p6.oit.umn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726857AbfCSRUJ (ORCPT ); Tue, 19 Mar 2019 13:20:09 -0400 Received: from localhost (unknown [127.0.0.1]) by mta-p6.oit.umn.edu (Postfix) with ESMTP id 5DC649D2 for ; Tue, 19 Mar 2019 17:20:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p6.oit.umn.edu ([127.0.0.1]) by localhost (mta-p6.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pcxd05eQzQoj for ; Tue, 19 Mar 2019 12:20:08 -0500 (CDT) Received: from mail-it1-f197.google.com (mail-it1-f197.google.com [209.85.166.197]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mta-p6.oit.umn.edu (Postfix) with ESMTPS id 1C6FFCF6 for ; Tue, 19 Mar 2019 12:20:08 -0500 (CDT) Received: by mail-it1-f197.google.com with SMTP id j18so18033733itl.6 for ; Tue, 19 Mar 2019 10:20:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umn.edu; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=KaR3N1FpAReCIY2t+BDFxfPRzj3N4WbhEtnv+BeiWXs=; b=jDkbwlbYbZQF10eYeuIU+41YpctUp0Dey0hWrqqBCHGB+H8PkLJqiQE+22rEqxyOUd hMoF40utaTpw0Ptkrn/Ag+VQfMl5DcEoArXp3E9oM+Ij0Bw2y/6mwhOQw5B4gjLqnYOl umXzmBS3P0lD39i1pbhyiXOh3GyDh4KqTRxFOnhrkjVBgjsPaAml65an1w69I+4DsA4J h4vopvwDgT46K1pQS3DB2TIAnVo8aL9YVjMcFm701yXEIKVvnCG169vdO3TRqiCHQFhT FvODkzR5v+OUq1C4ezAY5s/ttpFAex4fc9QHLHbGT06+KD6BRI62pl9LtOESaMtE0NHx 1t7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=KaR3N1FpAReCIY2t+BDFxfPRzj3N4WbhEtnv+BeiWXs=; b=NYII0gRogpUulxPm66KrmkHhcyBOFIVssA403XkZfRKbvUgfZKvuvBScg7w+48g5s+ AsQNVdPsZYgAnF4ZsxIBv58EQePU/99qxppsuFXQAZtSTADD2lXkU+uZksKw8Jjhq57e koJ43obzGh6WIEMIzlTSIoc64mZIaoU+uDH+7sgMBnsf79BUzXA9Pq3cm/VjkkjH0bHC /ODYyOx7QrPYb37FfW6F8ESJEETQShMDX0tmDZjZjaTFkFPfGepiAlVrAqwtf6KnJGkd W3SQh9r9qm7LgTr1q36H4pOSy1kkixk625lLmwxWA7Zi+jP9vctxizQ0T2acmeCTNTno cQlA== X-Gm-Message-State: APjAAAV/D0Mpexw0N1BrKCjMXFfacmqBhuO18zLs8iWuxewR4dDpV/3x Cv4j0yCSg4Ff6QpvawFOFTpOWuQWOeLkbzP4YpLB2O6X4/lPrHArWCFEk9VcMt3OkmLVjrccH/7 KpWRA26As2X5X6VO6ed6Ef0sCP5W6 X-Received: by 2002:a6b:e402:: with SMTP id u2mr2302148iog.45.1553016007266; Tue, 19 Mar 2019 10:20:07 -0700 (PDT) X-Received: by 2002:a6b:e402:: with SMTP id u2mr2302125iog.45.1553016006934; Tue, 19 Mar 2019 10:20:06 -0700 (PDT) Received: from [128.101.106.63] (cs-bee-u.cs.umn.edu. [128.101.106.63]) by smtp.gmail.com with ESMTPSA id m2sm1862492itc.42.2019.03.19.10.20.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Mar 2019 10:20:06 -0700 (PDT) Subject: Re: [PATCH] usb: u132-hcd: fix potential NULL pointer dereference To: Greg Kroah-Hartman Cc: pakki001@umn.edu, Colin Ian King , Jia-Ju Bai , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org References: <20190314072713.20666-1-kjlu@umn.edu> <20190319135609.GA16254@kroah.com> From: Kangjie Lu Message-ID: <440c18a2-aa7c-9253-0ad8-27ac0a0440d6@umn.edu> Date: Tue, 19 Mar 2019 12:20:05 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <20190319135609.GA16254@kroah.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/19/19 8:56 AM, Greg Kroah-Hartman wrote: > On Thu, Mar 14, 2019 at 02:27:11AM -0500, Kangjie Lu wrote: >> In case create_singlethread_workqueue fails, the fix notifies >> callers the error to avoid potential NULL pointer dereferences. >> >> Signed-off-by: Kangjie Lu >> --- >> drivers/usb/host/u132-hcd.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c >> index 934584f0a20a..6d5b532b03f8 100644 >> --- a/drivers/usb/host/u132-hcd.c >> +++ b/drivers/usb/host/u132-hcd.c >> @@ -3203,6 +3203,8 @@ static int __init u132_hcd_init(void) >> return -ENODEV; >> printk(KERN_INFO "driver %s\n", hcd_name); >> workqueue = create_singlethread_workqueue("u132"); >> + if (unlikely(!workqueue)) > You only ever use unlikely/likely if you can actually measure the > difference with and without it. For stuff like this, it is not needed > at all, and in fact, the compiler and CPU already know this type of > thing, so it is going to be faster without it. > > And are you sure you properly unwound from anything that was > created/initialized above these lines? I didn't see what resources require release in this case. Given the existing error paths for usb_disabled() and platform_driver_register(), returning -ENOMEM looks like a consistent error handling. Let me know if it isn't. > > thanks, > > greg k-h