Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp1399701img; Tue, 19 Mar 2019 06:57:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqx6NYycqps7t1oCjib8rFIk8PhLW5GTbtknIy+ZYQE+dPrpmKxQZ/A6kJ4+H6X/zhKZbD2n X-Received: by 2002:aa7:8a95:: with SMTP id a21mr2084968pfc.14.1553003862049; Tue, 19 Mar 2019 06:57:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553003862; cv=none; d=google.com; s=arc-20160816; b=k3Y7qs+iAuEaCNEUB7Rce9+kqPF34GA3N02y/5ckbPfxqLXrTmQzOB3xpOYmo7ngMm HfnKKTNAfHDHMjMmOn47jbTRZNjGdQT29EcgtvMqw1/wnBYTS+V4SDH89nFrUZDDkt5Y D8PWupFmSFh6dtXef32J6cDptInazxZgCnV86RkXEm7vAGB8CQqjuGo2ofcPDtr4i6ku E/0HIr0aDRSlGiPbnDvnHq5NhE5529g/aWlqx0y5hhCGMdDJkl2nWzlxxVOCWQH+yl3n YGoYSG1TyAPFiOqK+PxM8CS3hHwVmGATSlqivK/239Oh11XMbD5olvtlG0zuhpujh4sH ebIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=jdfXlWwRUDy14RdKZquNolHN3VMm6a6Sgd+yGqYi2bU=; b=unSXcl3t6wFX8UyMpv7hujob0nJExXqyDp8Z7EVM0VhcPVLFUSjgJfPzS2UI33zTeB n93NKq5SqCgDsmzRV8/j8sybyTRvpNCbKM6U3C5gT1uPheLvIRxLikeMWG89TMulSjbs aQ/IOMlnzJ7bkrt1/YKKWlxoODrfEIWeit/WAp5g3v5SPj0G3+J/b67UlZSSTb3ZsGhr PgOyvqqnlOSslSIB4q/W2aukADFapaZCaOYiEG5MPKAMx4Vpk83kpxnUL2/josbYtCF0 UMWw3c/OXmeR6yMz/Hv775xUhCtXGqeaFqqelw25hVytAMDLB+9GnsIYnVg0vNqpd78D Q0Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OBSi7nmT; 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 c6si11348917pgd.106.2019.03.19.06.57.26; Tue, 19 Mar 2019 06:57:42 -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=@kernel.org header.s=default header.b=OBSi7nmT; 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 S1727241AbfCSN4M (ORCPT + 99 others); Tue, 19 Mar 2019 09:56:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:60780 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726464AbfCSN4M (ORCPT ); Tue, 19 Mar 2019 09:56:12 -0400 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 74BDA2085A; Tue, 19 Mar 2019 13:56:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553003772; bh=8t8/3Cwy38Eu38/Is7aZyv/pQQNZSsCulps/l3FJCok=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=OBSi7nmTh2q5l7s/1GdaO7rNHZNBWCNV5wUsVTe2jm59Z2d7iPaJpXWcYfh/cGxOQ uLBLYco6dlajZ21bDIrrLBNhLi1ZBBwDFEEjISUZHWRHHJPPIXwKrqDn+cX78IyrpB dsFTkck6YR73YMbTEtLMSTNE9FKBXNAr1V+U7jtg= Date: Tue, 19 Mar 2019 14:56:09 +0100 From: Greg Kroah-Hartman To: Kangjie Lu Cc: pakki001@umn.edu, Colin Ian King , Jia-Ju Bai , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] usb: u132-hcd: fix potential NULL pointer dereference Message-ID: <20190319135609.GA16254@kroah.com> References: <20190314072713.20666-1-kjlu@umn.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190314072713.20666-1-kjlu@umn.edu> User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? thanks, greg k-h