From patchwork Sat Mar 9 04:43:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kangjie Lu X-Patchwork-Id: 10845767 X-Patchwork-Delegate: jikos@jikos.cz 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 033CC1823 for ; Sat, 9 Mar 2019 04:49:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D2FAC2CC0B for ; Sat, 9 Mar 2019 04:49:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C0BCB2CA85; Sat, 9 Mar 2019 04:49:04 +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 4CC35301A2 for ; Sat, 9 Mar 2019 04:49:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726400AbfCIEtD (ORCPT ); Fri, 8 Mar 2019 23:49:03 -0500 Received: from mta-p8.oit.umn.edu ([134.84.196.208]:47402 "EHLO mta-p8.oit.umn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726352AbfCIEtD (ORCPT ); Fri, 8 Mar 2019 23:49:03 -0500 X-Greylist: delayed 310 seconds by postgrey-1.27 at vger.kernel.org; Fri, 08 Mar 2019 23:49:02 EST Received: from localhost (unknown [127.0.0.1]) by mta-p8.oit.umn.edu (Postfix) with ESMTP id 4DE52C5C for ; Sat, 9 Mar 2019 04:43:52 +0000 (UTC) X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p8.oit.umn.edu ([127.0.0.1]) by localhost (mta-p8.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CZyNeivhFJUQ for ; Fri, 8 Mar 2019 22:43:52 -0600 (CST) Received: from mail-it1-f200.google.com (mail-it1-f200.google.com [209.85.166.200]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mta-p8.oit.umn.edu (Postfix) with ESMTPS id 1F251C52 for ; Fri, 8 Mar 2019 22:43:52 -0600 (CST) Received: by mail-it1-f200.google.com with SMTP id j18so13546536itl.6 for ; Fri, 08 Mar 2019 20:43:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umn.edu; s=google; h=from:to:cc:subject:date:message-id; bh=58vOdLLRCNUL+gkqvy6G/8NqXcDukitu6vhvUvGr0WI=; b=M34iWCmwC/uSUePuFtnjJXSUvoxeyDtGKxE+FRSE0CqIPx2Asp9wpxH1TzdUJZ60fV PJRMgbxVN5dwMAV8DBtBG4jG78BYB9ehSfHKB50dE13tUG9fv3n52OlP/fjQGk2P5eDo JiDZ41+i6X6OJqkEg1MGlONt7VOe29qpATEIMM+EEHNXtjpke2b+DYJQASOVzcys3Sqt zw+O3Q5PtGHUbs6TBYRpWGfnljQY86mfUcJn6bHlFWKh0dcmoFWFG5A/DWBrTVn28IOV U4+D8Mv785L9Ezrl+H9Lvz/ePa4TRggvqpLfLXHVQiGnqGQ8/EGP0puyFM7OGMDVf+5D mCvQ== 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=58vOdLLRCNUL+gkqvy6G/8NqXcDukitu6vhvUvGr0WI=; b=NdqYZzzaFQl6QWpEwteWLjhIKnsEfvXtsy35b5BJRGz7ydk2IONKopiWe/wLzOsfxl EQ4ppQi1T0Qzau9UQUNcPIrj5A91hZegYkaV87itzHcgOO7oU83gUMi12aMw6fw7jkEV HZVS0ueXDZyploECmPRkJtvHueDvmZyCyMxjPoTgLIEhDW7KCxjjMh2hOoBbUIjZN4RE XL+QFnSfBNXrI8iqQtvivvVPZ5LEzw1E9e8jdDVxhsK9cZ6xqgzWAOfU9o4iuhloa34c NFXqa7Pi1o7O5UrKCeqyoDNIxdoc6/OU5AXJ4+10iRoTf74XqWQ2NKoxyfKzJAiqo2De 765A== X-Gm-Message-State: APjAAAWaEE15VAjaIb7ebj8t2to2mDhS0iQjPZfHGt495JxSaiLjD8Nm Pj7+wE2948FBayGYSY0wCepr7RpIRMNRKsZrusrIlHUWHvcUSQgwsuxDdBS8IWQW2p9xsuztzW6 cDc47sjIgxW8mErDRm6tuR27hC2g= X-Received: by 2002:a5e:9611:: with SMTP id a17mr11183071ioq.2.1552106631336; Fri, 08 Mar 2019 20:43:51 -0800 (PST) X-Google-Smtp-Source: APXvYqy4AxNBQ+Ic6pRBAM/LsLRgmvMcZyMRwA6yuxBXRQLnqikpEEm3UriiMIyA4wmljxd5qwxRMQ== X-Received: by 2002:a5e:9611:: with SMTP id a17mr11183064ioq.2.1552106631106; Fri, 08 Mar 2019 20:43:51 -0800 (PST) Received: from bee.dtc.umn.edu (cs-bee-u.cs.umn.edu. [128.101.106.63]) by smtp.gmail.com with ESMTPSA id i198sm4982974iti.18.2019.03.08.20.43.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Mar 2019 20:43:50 -0800 (PST) From: Kangjie Lu To: kjlu@umn.edu Cc: pakki001@umn.edu, Jiri Kosina , Benjamin Tissoires , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] hid: logitech: check the return value of create_singlethread_workqueue Date: Fri, 8 Mar 2019 22:43:45 -0600 Message-Id: <20190309044345.7018-1-kjlu@umn.edu> X-Mailer: git-send-email 2.17.1 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP create_singlethread_workqueue may fail and return NULL. The fix checks if it is NULL to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu --- drivers/hid/hid-logitech-hidpp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c index 15ed6177a7a3..efbc39b92aa2 100644 --- a/drivers/hid/hid-logitech-hidpp.c +++ b/drivers/hid/hid-logitech-hidpp.c @@ -2156,6 +2156,9 @@ static int hidpp_ff_init(struct hidpp_device *hidpp, u8 feature_index) /* init the hardware command queue */ data->wq = create_singlethread_workqueue("hidpp-ff-sendqueue"); + if (!data->wq) + return -ENOMEM; + atomic_set(&data->workqueue_size, 0); /* initialize with zero autocenter to get wheel in usable state */