Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp7113987rwl; Mon, 9 Jan 2023 18:19:56 -0800 (PST) X-Google-Smtp-Source: AMrXdXvWf/m06GGwNXfLGmXUh8i1d+SOdx49lqCF3kCE9YkFeAKyqknBgRpjfC13laNuyCJYYrv5 X-Received: by 2002:a05:6a20:2a1c:b0:aa:7548:883d with SMTP id e28-20020a056a202a1c00b000aa7548883dmr70670921pzh.11.1673317195943; Mon, 09 Jan 2023 18:19:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673317195; cv=none; d=google.com; s=arc-20160816; b=HjMyS95xIJv0I2J5Sr24cAEb8NwKtyqdRSl3Uz/5eH5lWkcbyVMld5HdOk8Sls5Qda TSJJLiFCAUOpxuEV5QVQWM90ysPtDXRV3xKh3ZXNpWW56Qis6UYJYT62FL2kbCkefFEj P9w3bF8fuDrA846MO2U7PYdYKIe0tRnFynCu+XfSHZGPLG/QTzpwGIpsQGPa/ikJBpti 2E3wtsUxONXZXqz7EAnGbP9+xYL3GO2hOrq4PkcN3k6KnM0QsiKwabP9ZLSXYroScK+f Fdnx/Dqh8iDcZUqbUK8mypMsgYzL23yivTdISumzxewnGIyg+uJ9kwZaogcS6R6BUxem KT1A== 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=tP2j2TC4Yn7kESwF7XZV5NzAoR4w3YHUeCcRM1dYY4U=; b=at4LLFzMPGs/4aISy/jbAweo77ITHNqs29xmNcEaRbvGc7Sx3N2OL7CCvn2ek4LC3i lzQmxWo+62bvEW8ev006l8sNofRrGySdJxxh/CsZQkdjpKr9CKN0iU5e07j0xwVSJevY Vz5znnC8T3S+SX3U+SHE9pssw+CF3esQrQDMy+obpPFDFVNETw0wRp0LiAgV5uvzEbcK PV78wA8cwo9P/gFxxE1XqQmMDBHET2T7LrytrS61XkuozAYskid5uOBqkEmjrcHZKWO1 y4UR7erAXEh5UIEaqKvoWzGmPrDnRTrXZ6qL5vDahUs4vZ7Esz3nOKWSeC9dX6h/RUxz ca6A== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r191-20020a632bc8000000b0047867fcf9a7si10994526pgr.541.2023.01.09.18.19.49; Mon, 09 Jan 2023 18:19:55 -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 S230286AbjAJCRk (ORCPT + 55 others); Mon, 9 Jan 2023 21:17:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230171AbjAJCRJ (ORCPT ); Mon, 9 Jan 2023 21:17:09 -0500 Received: from cstnet.cn (smtp23.cstnet.cn [159.226.251.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5D2C1B85; Mon, 9 Jan 2023 18:17:07 -0800 (PST) Received: from localhost.localdomain (unknown [124.16.138.125]) by APP-03 (Coremail) with SMTP id rQCowABnbZWUyrxjM5xMCw--.51216S2; Tue, 10 Jan 2023 10:16:53 +0800 (CST) From: Jiasheng Jiang To: dmitry.baryshkov@linaro.org, d-gole@ti.com Cc: robdclark@gmail.com, quic_abhinavk@quicinc.com, sean@poorly.run, airlied@gmail.com, daniel@ffwll.ch, marijn.suijten@somainline.org, vkoul@kernel.org, dianders@chromium.org, marex@denx.de, vladimir.lypak@gmail.com, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jiasheng Jiang Subject: [PATCH v3] drm/msm/dsi: Add missing check for alloc_ordered_workqueue Date: Tue, 10 Jan 2023 10:16:51 +0800 Message-Id: <20230110021651.12770-1-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: rQCowABnbZWUyrxjM5xMCw--.51216S2 X-Coremail-Antispam: 1UD129KBjvdXoW7Jr18urW3GF47Gr4DWrWDCFg_yoWDWrb_uF 98JwnFgrW2k3ZFg3W2yr1Iyryjy3Z09F40vFZ8t3W3tFyDtr1ft3s2vrZ5Zr1DuF1xJF92 9asFv345JrsrGjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUb38FF20E14v26ryj6rWUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_Xr0_Ar1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Cr0_ Gr1UM28EF7xvwVC2z280aVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gr 1j6F4UJwAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv 7VC0I7IYx2IY67AKxVWUXVWUAwAv7VC2z280aVAFwI0_Gr0_Cr1lOx8S6xCaFVCjc4AY6r 1j6r4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02 628vn2kIc2xKxwCY02Avz4vE14v_Gr1l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7 v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF 1VAY17CE14v26r4a6rW5MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIx AIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI 42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWI evJa73UjIFyTuYvjfU54EEUUUUU 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 Add check for the return value of alloc_ordered_workqueue as it may return NULL pointer and cause NULL pointer dereference. Signed-off-by: Jiasheng Jiang --- Changelog: v2 -> v3: 1. Simply return -ENOMEM instead of using ret. 2. No change of the "goto fail". v1 -> v2: 1. Change the "goto fail" into "return ret" and drop the "fail" label. --- drivers/gpu/drm/msm/dsi/dsi_host.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index 89aadd3b3202..f167a45f1fbd 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -1977,6 +1977,9 @@ int msm_dsi_host_init(struct msm_dsi *msm_dsi) /* setup workqueue */ msm_host->workqueue = alloc_ordered_workqueue("dsi_drm_work", 0); + if (!msm_host->workqueue) + return -ENOMEM; + INIT_WORK(&msm_host->err_work, dsi_err_worker); msm_dsi->id = msm_host->id; -- 2.25.1