From patchwork Thu Mar 14 07:27:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kangjie Lu X-Patchwork-Id: 10852277 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 2BB22139A for ; Thu, 14 Mar 2019 07:33:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 134EA2A20E for ; Thu, 14 Mar 2019 07:33:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0504A2A212; Thu, 14 Mar 2019 07:33:53 +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 9DBF72A20E for ; Thu, 14 Mar 2019 07:33:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727066AbfCNHdv (ORCPT ); Thu, 14 Mar 2019 03:33:51 -0400 Received: from mta-p6.oit.umn.edu ([134.84.196.206]:57206 "EHLO mta-p6.oit.umn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727001AbfCNHdv (ORCPT ); Thu, 14 Mar 2019 03:33:51 -0400 Received: from localhost (unknown [127.0.0.1]) by mta-p6.oit.umn.edu (Postfix) with ESMTP id E1137B63 for ; Thu, 14 Mar 2019 07:27:20 +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 ejmz_jT2mF0J for ; Thu, 14 Mar 2019 02:27:20 -0500 (CDT) Received: from mail-io1-f70.google.com (mail-io1-f70.google.com [209.85.166.70]) (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 BDCB2A39 for ; Thu, 14 Mar 2019 02:27:20 -0500 (CDT) Received: by mail-io1-f70.google.com with SMTP id n23so3625223ioj.10 for ; Thu, 14 Mar 2019 00:27:20 -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; bh=djLP/qUyS3huRIWZoxZzkniDQRI72bSE9Cei/axWzzE=; b=Sz8QIu6HXqnsW9UCYVt09gM9pKDkVKhutg8q6tOtGVH6UcZ6Jce43GocCAuR4RbxXr sH304frP/+DthfT5AYLxCB6+NxJxmL6VDntkY1Qf4ubrBl/i2XYYPi8cOXSkMKm5VxDJ BCdlIzW7XAVcsfYfebRjR1uQ8TSABetMTwvYayBeN25yPjtHj0avspntgUSBo6e1gTii dvtmvIQXvlOl2FYb/VEfvqn5QK4Ys1t73ghPzLgt8FF4DaqaDkomvnmAOxaYIxT6RYiP +G0XYJL4jMg9LrQJrlEy7VTFWeqBrIWGHRwuNUv2ft5IKncwIgKiCdU4MKjm2WcobjAj m9Qw== 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; bh=djLP/qUyS3huRIWZoxZzkniDQRI72bSE9Cei/axWzzE=; b=Md6mhog/sMxU7M6WtWBihCmanKXvY599Vo0NrdB/yMM8pOSJcLJnUoJHVZ1r+7nJsZ D3dBuPJ2HoA9JZihZ+WG2H7L1Yk+i4GsNlP1UQ0LBSDRUGSwWxoOaOT+gB7iVJHfmwQa pxwYdQ08ylQnUy4MKQP8r/9SAa52g0hkIMmqI1YWTYlykfTnrRSGg2+Z08LeLtvIidIo nIAT0Isp8LTGeOt5GumGfigt27JLBf0P27VEgczRxoPS7ojQSD12r5doYilzNQ6WHENw s0/ACqOky35zzPwx5YVZGIjOR4xaHAxeDvlUQ/tnP9/anWnvf8rnSwoxTjKZYOt1XMx1 0blw== X-Gm-Message-State: APjAAAWxTRfRnG1m7NIfM4Ge43DSFDrTue16f6CBqsSlqusUT2ZDl2y9 BnrgOC9Qd3wL/uEeSe99LazFIO4dAPp20zXK/ohPU5K8EKxhq26SRarDSGaQzKDj1yKFdZsj80s lEjqQQ6zJ1MIXOMdLmUdXUvQ3 X-Received: by 2002:a02:568a:: with SMTP id u10mr26969559jad.130.1552548440324; Thu, 14 Mar 2019 00:27:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqwYcTR0fi44fVKoNPOSbal03VlGI8u4mdLJJZm7omm1LFJaYn/eHgk/xg3ImdD41Ho286JVzg== X-Received: by 2002:a02:568a:: with SMTP id u10mr26969544jad.130.1552548440071; Thu, 14 Mar 2019 00:27:20 -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 n4sm5815711ioa.26.2019.03.14.00.27.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Mar 2019 00:27:19 -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: Thu, 14 Mar 2019 02:27:11 -0500 Message-Id: <20190314072713.20666-1-kjlu@umn.edu> X-Mailer: git-send-email 2.17.1 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 --- 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)) + return -ENOMEM; retval = platform_driver_register(&u132_platform_driver); return retval; }