From patchwork Tue Nov 22 09:18:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiasheng Jiang X-Patchwork-Id: 24222 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2102652wrr; Tue, 22 Nov 2022 01:41:41 -0800 (PST) X-Google-Smtp-Source: AA0mqf4kyn+OsiUf9LAmgsPAD0GccsUCrRC/J8gnLrMQd60hweOzvGKtLQ5JakSgZgHSd23jpkaF X-Received: by 2002:a17:906:19d5:b0:780:93d2:8510 with SMTP id h21-20020a17090619d500b0078093d28510mr5207020ejd.457.1669110101592; Tue, 22 Nov 2022 01:41:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669110101; cv=none; d=google.com; s=arc-20160816; b=mRlYktxP6EYB/sE3K50bXKpxj4GLmj611RbbVP7Dov0KQIZQXbdmGWAbSrcc4nbsZg B+d6rjBqoigWkIPQvNV5B8aBUMs5Rtr0naLzjCE/GvjvVXhmHVGVu+yOCd/Ed9AZqW4E 0TRs0ObmyxTD2xIIKlHkvitLmvLt3xoncW+8xgFGvkzyeRcFqDDywRfEN1Stf4wP0/Bk hAwIejAUChp6srVWXDQZiAm7FE9cMH/koQdno8NQNcuMSRJXVekh8MORZLw8oRKEApPi FiprfD4TVjaDgrz3svLeQCzkXsFlKNP1yp91KbnKZSMsxXQ6L6e44k3ctYDHrWaLqqUW Zq+g== 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 :message-id:date:subject:cc:to:from; bh=azoEtd7ZEnmDT4tAtdLOxw0PFkLgCmRDcrbvNiwi6T0=; b=CjBRpvVSKbtmBGe2p0nebtC0+VMN6fNkiYIxSk11dT1m1wzwB5cJ9s+8qLSoMLtMwB I4WjTrRvdIb0cgOdPXrZytCD2yThj7niJOa/Ag4PsrbBu1WCRruYcc+ZxLay7xQuaimy Jj4e+xmLsVNsAoZu10NJsbCAGPM/0WCjruyHWiBvSPCdvjUXbeRMA4BRB8rinVBZiaG3 ERN0mptOZcKJO+d3hmtenUCHPIin0VCDWcy6h4C8dskQbBNjlVYCeSKeh1eWiwbH1Jq8 nsMnNdtSL3+/mZxd8kx7Jy6S3ylw3GeUkDA9N3MS/n4fBIQsDOCk867EaXXUMWMcM8g6 gpRg== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qa35-20020a17090786a300b007adadff675fsi12546407ejc.313.2022.11.22.01.41.17; Tue, 22 Nov 2022 01:41:41 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232836AbiKVJTi (ORCPT + 99 others); Tue, 22 Nov 2022 04:19:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233040AbiKVJTP (ORCPT ); Tue, 22 Nov 2022 04:19:15 -0500 Received: from cstnet.cn (smtp23.cstnet.cn [159.226.251.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 66B1949B60 for ; Tue, 22 Nov 2022 01:19:07 -0800 (PST) Received: from localhost.localdomain (unknown [124.16.138.125]) by APP-03 (Coremail) with SMTP id rQCowAAHDpYBlHxjrWbEAA--.49387S2; Tue, 22 Nov 2022 17:18:58 +0800 (CST) From: Jiasheng Jiang To: maximlevitsky@gmail.com, oakad@yahoo.com, ulf.hansson@linaro.org, christophe.jaillet@wanadoo.fr, axboe@kernel.dk, hare@suse.de Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Jiasheng Jiang Subject: [PATCH] memstick/ms_block: Add check for alloc_ordered_workqueue Date: Tue, 22 Nov 2022 17:18:56 +0800 Message-Id: <20221122091856.47606-1-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CM-TRANSID: rQCowAAHDpYBlHxjrWbEAA--.49387S2 X-Coremail-Antispam: 1UD129KBjvdXoWrtw1UZFykAryxWr4kXFyxXwb_yoWfurXEkr yxZF48tFW0k3W8AryUAryruF9ayw40gryFqayrtwsxJrW7CF15Zr1jv345ur18uFWUCry3 Ca4DX34rZw1UKjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbwAFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j 6F4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oV Cq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0 I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Gr0_Cr1lOx8S6xCaFVCjc4AY6r1j6r 4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCF04k20xvY0x0EwIxG rwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4 vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IY x2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26c xKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAF wI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JUq38nUUUUU= X-Originating-IP: [124.16.138.125] X-CM-SenderInfo: pmld2xxhqjqxpvfd2hldfou0/ X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750188793869141844?= X-GMAIL-MSGID: =?utf-8?q?1750188793869141844?= As the alloc_ordered_workqueue may return NULL pointer, it should be better to add check for the return value. Fixes: 0ab30494bc4f ("memstick: add support for legacy memorysticks") Signed-off-by: Jiasheng Jiang --- drivers/memstick/core/ms_block.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/memstick/core/ms_block.c b/drivers/memstick/core/ms_block.c index ba8414519515..ccfdb3dea30a 100644 --- a/drivers/memstick/core/ms_block.c +++ b/drivers/memstick/core/ms_block.c @@ -2116,6 +2116,9 @@ static int msb_init_disk(struct memstick_dev *card) dbg("Set total disk size to %lu sectors", capacity); msb->io_queue = alloc_ordered_workqueue("ms_block", WQ_MEM_RECLAIM); + if (!msb->io_queue) + goto out_cleanup_disk; + INIT_WORK(&msb->io_work, msb_io_work); sg_init_table(msb->prealloc_sg, MS_BLOCK_MAX_SEGS+1);