Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp4028067pxp; Tue, 15 Mar 2022 10:54:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmIJPyfOx90A+UzumHrTfj6fsyrZvzJs50vaBzTAbaeDcFy6XtFonaXQp2UXtI5k+0gKKG X-Received: by 2002:a17:90a:4a91:b0:1be:e51a:47df with SMTP id f17-20020a17090a4a9100b001bee51a47dfmr5992510pjh.40.1647366893311; Tue, 15 Mar 2022 10:54:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647366893; cv=none; d=google.com; s=arc-20160816; b=zO6FxdfJR7OCyPwnz6usQ8IxML9OzhI24BQ4xqXeHyqZJjWqPOwWpr+IbbzuRxJiCP nFPTGCBLEU700CmzRo6xbmLx4cgh9PAsl1ubXYq4/P6cZlOwZSWCDmMtMMm/z6uXpfaS gD9JWN1pPpdCo7jj5/sUdDZnEvYI/QHhXqHBRG+HlalYElOlIqFRRr7J5wtcMf4koRtW nVyHBz8q8SxfuKMfEb8QDkQZRXSKv/OznhMwiCu1VOiohhjJqYvXL/u1bR7g0CHmJDlD uVONHXaPZ9ct7bdzsn2ru2XtN7/48/s28iBrXiXuv35g6h5p5pMASYfta1oJ+hX4i4Ql ku7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IVGkZoeu2FO2m4CxJ7LoxayLjXgJsMYQgv2PaYpe8OA=; b=zM4wqFzUVuRajrqS/pEfFX4QghHSx8O3a47ySzf3XkGOlkvsUxnIii9LsQCtODk362 EyomAI8Pjw8BW/S4v9k/asO9sB/mbt8Nt1hTbz7sQ41Uyhq/HxlwsuKRWxfP+aSCVP/7 HrPeShyzMILB2+X8h5SHIP5D5oemGY1m7T7812AH0+FRLcBEUsoudUvHQZQZlQBX8q3u GRhPokutrGcNtfOjIZ1gb+Wmsc5HNdbX0oqKpLW7YkvQ2bgul7IrsCfO+q2xu6iecfSz 2wCmYkHAH/oKxwG9QsaSB61Pzm2WEEGB8dcVuNkgPgsQxQB5Bj9dCJ/0NU9bmssRUBRY hGVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xxaxujiS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q192-20020a632ac9000000b003809a90f28fsi18196107pgq.538.2022.03.15.10.54.37; Tue, 15 Mar 2022 10:54:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xxaxujiS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236131AbiCNMYF (ORCPT + 99 others); Mon, 14 Mar 2022 08:24:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236182AbiCNMQZ (ORCPT ); Mon, 14 Mar 2022 08:16:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C91CA344EA; Mon, 14 Mar 2022 05:12:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A81AF612FC; Mon, 14 Mar 2022 12:12:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06E99C340EC; Mon, 14 Mar 2022 12:12:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647259926; bh=KDeKeSrBscd88xlJvU6ol2p8TedSnBm20d6bP+U4DyY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xxaxujiSePbL/tNqY5cMiCBobGZIRmdb12pAgCrqSOebgF4udM4ekFReHk2g50YST yFkSV0XPLcGmfOeda3WyFhpa6TJmWlFyaBpXf7KAP6hR2LKFJlM2W+/3VQy68uC/yy wV3EXltK/D5CR+bj6QTs9PqHFhapSCoXglNxFSeY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, TOTE Robot , Jia-Ju Bai , Silvan Jegen , Jiri Kosina , Sasha Levin Subject: [PATCH 5.16 010/121] HID: nintendo: check the return value of alloc_workqueue() Date: Mon, 14 Mar 2022 12:53:13 +0100 Message-Id: <20220314112744.413091251@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220314112744.120491875@linuxfoundation.org> References: <20220314112744.120491875@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jia-Ju Bai [ Upstream commit fe23b6bbeac40de957724b90a88d46fb336e29a9 ] The function alloc_workqueue() in nintendo_hid_probe() can fail, but there is no check of its return value. To fix this bug, its return value should be checked with new error handling code. Fixes: c4eae84feff3e ("HID: nintendo: add rumble support") Reported-by: TOTE Robot Signed-off-by: Jia-Ju Bai Reviewed-by: Silvan Jegen Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- drivers/hid/hid-nintendo.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/hid/hid-nintendo.c b/drivers/hid/hid-nintendo.c index b6a9a0f3966e..2204de889739 100644 --- a/drivers/hid/hid-nintendo.c +++ b/drivers/hid/hid-nintendo.c @@ -2128,6 +2128,10 @@ static int nintendo_hid_probe(struct hid_device *hdev, spin_lock_init(&ctlr->lock); ctlr->rumble_queue = alloc_workqueue("hid-nintendo-rumble_wq", WQ_FREEZABLE | WQ_MEM_RECLAIM, 0); + if (!ctlr->rumble_queue) { + ret = -ENOMEM; + goto err; + } INIT_WORK(&ctlr->rumble_worker, joycon_rumble_worker); ret = hid_parse(hdev); -- 2.34.1