From patchwork Tue Mar 19 17:34:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kangjie Lu X-Patchwork-Id: 10860081 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9D34B6C2 for ; Tue, 19 Mar 2019 17:34:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77A8A28807 for ; Tue, 19 Mar 2019 17:34:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6A1292963C; Tue, 19 Mar 2019 17:34:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 12CE228807 for ; Tue, 19 Mar 2019 17:34:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727248AbfCSReQ (ORCPT ); Tue, 19 Mar 2019 13:34:16 -0400 Received: from mta-p6.oit.umn.edu ([134.84.196.206]:60084 "EHLO mta-p6.oit.umn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726944AbfCSReP (ORCPT ); Tue, 19 Mar 2019 13:34:15 -0400 Received: from localhost (unknown [127.0.0.1]) by mta-p6.oit.umn.edu (Postfix) with ESMTP id 93C487CA for ; Tue, 19 Mar 2019 17:34:14 +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 OQrFkAZ2udk5 for ; Tue, 19 Mar 2019 12:34:14 -0500 (CDT) Received: from mail-it1-f198.google.com (mail-it1-f198.google.com [209.85.166.198]) (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 63226793 for ; Tue, 19 Mar 2019 12:34:14 -0500 (CDT) Received: by mail-it1-f198.google.com with SMTP id s3so6352915itl.0 for ; Tue, 19 Mar 2019 10:34:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umn.edu; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IHtAHbP+J9rk/HCsvQZ/OREEVmI9PQysYpbFZPNW7oc=; b=owdfHLZkR5fCbENNseTAksuJ6rsIBmDo8LZJtse/SdgML+YcmrTZytcwZt0aKCy83o rWFRmlMPOaEBLNRVYaIUErRxOuwgsGTJzwV1epTJapMhjOv1c1R3rhJY9dZTOPnC/9Xk o9qwgMDRlE4rZB84MJ9z5ZJw/oVpA/EUoZ0JuUZvuzIikVdNomP/VQclaLWyOu2H5OGC RI4XX0RQyFfn+a2weBPJeEcLBQ421OfYDgxIn9S4DA6+OalH3GGrfkHq2FDAReT3dj7H xyHLz8BYJPbmIPWsrx/9Jov0SlGdHVXwRxTPyZIxcz+AHBoDmm5u/x9sytLkAYH+U1xs 9S9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=IHtAHbP+J9rk/HCsvQZ/OREEVmI9PQysYpbFZPNW7oc=; b=llz7u2TEXQxATzoDJHBkQ5fOkZfoy8kKsCi4KbQouHFF5IU+vFXwQVNqlQ2v3gktKP k7kmP6NYC+Bn9D7/OiZyuVipuALe8A/neI1kYPRNeTSZkoa/T8DCe/Ek0jV4I9X4guD4 fBc63NMOqTb77l5v1G6WVAQCJoKh5sg+BELSvJWr7XV7VFM5GaNvl980NUpDO3RJgoxr QppD8DQ44MVgNd11WwBiDT6LMX3A1xX4ISaD3aJl2GWqUiK7zNsA16Tqk2z0E9r9aRil iqx5WtIkfE1Wy1i/BGddbslllhBvGN5aFLKs+TykvooHjDXNgxTFrosM3F7PfVFeYnUJ Kxnw== X-Gm-Message-State: APjAAAXB0k6LK4O/xmysvOR863g7tqx0c3ZDOvuqoAxpLD+EMXw4J2mJ WCOG8f5Y6J6vWPB/lZ/wZFnMEdFZbPgzDnL9bsHoN4+40VxkAnNmj7ZRP4q8vUAdgB6knhV6+Hk 1z5hQVcH4BeATFYBTreydiHdE X-Received: by 2002:a24:c301:: with SMTP id s1mr1989827itg.112.1553016853987; Tue, 19 Mar 2019 10:34:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqykk2EesaIbzRo8XM+d/y+gYsI0TBfxSAtf9FwIDBmN5wRjS1MX0brQ3WnJUh8lU1/ieIaiNA== X-Received: by 2002:a24:c301:: with SMTP id s1mr1989807itg.112.1553016853656; Tue, 19 Mar 2019 10:34:13 -0700 (PDT) Received: from bee.dtc.umn.edu (cs-bee-u.cs.umn.edu. [128.101.106.63]) by smtp.gmail.com with ESMTPSA id p11sm5777562ios.15.2019.03.19.10.34.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Mar 2019 10:34:12 -0700 (PDT) From: Kangjie Lu To: kjlu@umn.edu Cc: pakki001@umn.edu, Greg Kroah-Hartman , Colin Ian King , Jia-Ju Bai , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] usb: u132-hcd: fix potential NULL pointer dereference Date: Tue, 19 Mar 2019 12:34:06 -0500 Message-Id: <20190319173407.7279-1-kjlu@umn.edu> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190319135609.GA16254@kroah.com> References: <20190319135609.GA16254@kroah.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In case create_singlethread_workqueue fails, the fix notifies callers the error to avoid potential NULL pointer dereferences. Signed-off-by: Kangjie Lu Reviewed-by: Mukesh Ojha --- removed "unlikely" --- 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 (!workqueue) + return -ENOMEM; retval = platform_driver_register(&u132_platform_driver); return retval; }