Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1767131rdb; Mon, 9 Oct 2023 02:06:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH/slBHSH6+pTMcywwzY/9kYu17rUDjcdUUopEHjwA10EhjrVRWEK1ViFfbZeM9jPZ5PaVt X-Received: by 2002:a17:90b:3891:b0:274:862f:3439 with SMTP id mu17-20020a17090b389100b00274862f3439mr11782582pjb.13.1696842402065; Mon, 09 Oct 2023 02:06:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696842402; cv=none; d=google.com; s=arc-20160816; b=axEwMk+XUykG9gwGhmang3A6Yyp6F8zi5GJwYVW0ySPu3IB+69lAXr1xRCftonBT0d Ds6zc/BbN71aL8VZWlfOW6p409jj9nK88E43oQELVbhUL9CoMcT4OymW7nfvxwo0wA1p P7e2mZb6lvrTbJIM2pJHDGoi+vawLbBPN4ullUsw/ujxapcUllPfJt1SYw9o2muyMSb+ je0o8BiYNlTNL2RiMiGkSdgnQFRGgRJ7ZSRnvmwZgj6+yVuwLwBpAmlXISL1iRHJ2rQD trAxjAhxuVCDrX01YufkLA/hH4u+J6lZa5c0YQXjaVOo04xDzSqytUuC/exv4TeZQ1+j 0cxA== 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:dkim-signature; bh=6yXs2gkpjduwZ+P2UYJQXSGNeyBU1a+rkA4sXx35cEE=; fh=4RguwSqxPCbM/iSO5VNWQ1sLgiyOax5Ig6YxsKswXrU=; b=Ac4vsOa9RBq/yBS8SBCGebvDgSxfO9An+3RflQ6lmqEjrhh1uB6/Fj1D3+D9yWcSxD auB8XcY8/fTEmWI+u+2KAVEO2gSEK4x3IOyB8BLJXKCxlRJ9oFxgbRav3AOX4+n5FAzL JOYkIy3E0hnQSsOhuXNyXNWje+VgBydY4QWHw7P0brOQyVVxAioicM9lyrU4e1YvTvHm VBTYvYGztu3WI6N48r9XmlMeYv0+Sf5yanEfrswYfocRvvxgWxzNC6PcaYVu+1dTvZSV RAJW85PYDnX54/3UJO1qZFD2hlwu8sQjp2yKs74Jku+LLvRnykZaMjsMmtCLAN1bT1+X ZYCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=UEfNIjZv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id lp13-20020a17090b4a8d00b0026cab818aa2si12121415pjb.100.2023.10.09.02.06.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 02:06:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=UEfNIjZv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 244A08085FA8; Mon, 9 Oct 2023 02:06:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345891AbjJIJGQ (ORCPT + 99 others); Mon, 9 Oct 2023 05:06:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345626AbjJIJF4 (ORCPT ); Mon, 9 Oct 2023 05:05:56 -0400 Received: from m15.mail.163.com (m15.mail.163.com [45.254.50.219]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A6394135 for ; Mon, 9 Oct 2023 02:05:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=6yXs2 gkpjduwZ+P2UYJQXSGNeyBU1a+rkA4sXx35cEE=; b=UEfNIjZvRWTQeoH2s4czH pOgcfYRoOxkamqTgznWzuY2Yq6Ef11BENiwff2ewdEpW9Ul0CghJ8i5AWc8N3goU 0wzYzJqVlbSUIVh4rpA6AEyFjUf9dNb05pY2+luBn5LY6KX/xrIrvhFCDIbCKp7L AzxEk7v2aLAtI+wGkMrS1s= Received: from icess-ProLiant-DL380-Gen10.. (unknown [183.174.60.14]) by zwqz-smtp-mta-g2-3 (Coremail) with SMTP id _____wDnLyQwwiNlJnJJAA--.42078S4; Mon, 09 Oct 2023 17:04:55 +0800 (CST) From: Ma Ke To: linus.walleij@linaro.org, neil.armstrong@linaro.org, sam@ravnborg.org, airlied@gmail.com, daniel@ffwll.ch Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Ma Ke Subject: [PATCH v2] drm/panel/panel-tpo-tpg110: fix a possible null pointer dereference Date: Mon, 9 Oct 2023 17:04:46 +0800 Message-Id: <20231009090446.4043798-1-make_ruc2021@163.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: _____wDnLyQwwiNlJnJJAA--.42078S4 X-Coremail-Antispam: 1Uf129KBjvdXoWrtF1rZr4fAFyxJw4kuFyDWrg_yoWfKwc_W3 W8XasrurW7uas7CF4Iva13Ar9IyFs8ZF4kZ3WSka4IkrykGF43XrZ8Wr909a4UuF17uFZ8 Aa4xCF1YvFnrGjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7xRKLvK7UUUUU== X-Originating-IP: [183.174.60.14] X-CM-SenderInfo: 5pdnvshuxfjiisr6il2tof0z/1tbivhgEC1ZcjCSMGAAAsf X-Spam-Status: No, score=3.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_SBL_CSS, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 09 Oct 2023 02:06:27 -0700 (PDT) X-Spam-Level: ** In tpg110_get_modes(), the return value of drm_mode_duplicate() is assigned to mode, which will lead to a NULL pointer dereference on failure of drm_mode_duplicate(). Add a check to avoid npd. Signed-off-by: Ma Ke --- drivers/gpu/drm/panel/panel-tpo-tpg110.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-tpo-tpg110.c b/drivers/gpu/drm/panel/panel-tpo-tpg110.c index 845304435e23..f6a212e542cb 100644 --- a/drivers/gpu/drm/panel/panel-tpo-tpg110.c +++ b/drivers/gpu/drm/panel/panel-tpo-tpg110.c @@ -379,6 +379,8 @@ static int tpg110_get_modes(struct drm_panel *panel, connector->display_info.bus_flags = tpg->panel_mode->bus_flags; mode = drm_mode_duplicate(connector->dev, &tpg->panel_mode->mode); + if (!mode) + return -ENOMEM; drm_mode_set_name(mode); mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; -- 2.37.2