Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp1185717rdh; Fri, 27 Oct 2023 07:07:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFZAIcujAaKUkKj3hFSixDIW4GujQzPxnLwn/dTzeWprqoTdJAg55j6gfmkolFYmuxxalp2 X-Received: by 2002:a25:11c5:0:b0:da0:454d:cf57 with SMTP id 188-20020a2511c5000000b00da0454dcf57mr9165792ybr.16.1698415676290; Fri, 27 Oct 2023 07:07:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698415676; cv=none; d=google.com; s=arc-20160816; b=YlQHTXYBzx8sA+5DjNrkWvP0Lk5/j0YDjw4TD6SKmsL0OfhkevB3+Tw0h1LwNvSJ7L wt/GUuNBru06LvUB5ETFQM+4ig8SbIzfMPE7yo9FyU6r8VqFOt1yStztyxPqcBylS1Ml YbZjV7OezJX1Wadj9Cwgdt0qTdUYh6IFXSRBpRU01J0Tm8fQFwbMbaHE1G+E5SzKiDuP zqiCwcp263meDGdyrDRYzPogAthjUAGbRMnMLfnRlqjCXHRuJBZFifXQvdZB2ZvE4ll1 QH+5F91DYqsJ4ouuO/TZ9uZxNavmywF7PCo5oHsqlU8p94NC6ZrHBOC52ollb1t51FVc znuQ== 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=qegBKtGW+YBLRz6D1T17k35VpwmQBPQSk8faL/IL4fg=; fh=GWZr6nJ7/tgXF+y58lcBq9MMz2YElPX3K9Z/hF1+IMY=; b=Hc30nEXh59QBrA7Aoupd9ir1eEQeD9EFlG9WWJwPmDvM4JY24Vni4H2yT7vyRtQdZ8 MNAI7sxxCJIWkeE2rkDaY5k/IsxeaH2/v+cdIOvXQRWSfZWJCCu9YfSxBEUN6ZYaFqAe CpNt+mzcpMgVFj8PKz+lMkZ2I7aRaXJbCUsPESqEfdsAs9ck59wa49y+uWODhDRdyvX0 GKMCFWkLmN/yrfloN4OJObXwQy1lT9Nte2QZv4ogKFDVERPzTuZcDNj9Dpkxd0qCAHcn AgdtY09g3FA3Caik9Bvmxo94TXK6dEoSqzF/bolNgrKGdPreO0Np6VVtJ8erj/sPU3T9 AWbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=JP8JwkR4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id a190-20020a25cac7000000b00d81705798easi3051828ybg.437.2023.10.27.07.07.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 07:07:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=JP8JwkR4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 267FB823524B; Fri, 27 Oct 2023 07:07:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345943AbjJ0OHp (ORCPT + 99 others); Fri, 27 Oct 2023 10:07:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345517AbjJ0OHo (ORCPT ); Fri, 27 Oct 2023 10:07:44 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CBAED6; Fri, 27 Oct 2023 07:07:42 -0700 (PDT) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39RDUrNi003793; Fri, 27 Oct 2023 14:07:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=corp-2023-03-30; bh=qegBKtGW+YBLRz6D1T17k35VpwmQBPQSk8faL/IL4fg=; b=JP8JwkR42KWSh5llMK3M7lEJxF2RZs9AHLFsI73E0gU1olZWnfGIlv6v9e8nBABsaVny +U4OBKrZdWWrLBTq6R37ax2NEuXaouMYQBLGdB+hro2WwdfZHgOuCQUUCnBjnyD6B6uc MBQTA+sTPijjwikOUlLZumjsOYE5qjj9B+wEi8Mxcw3Jbj6JpWVVY6oF47yAX3sdBQCL JJlRi7GmXlxz7c7LM7f/iYI1nLn0fEl3IZmnNBSAwYecHf+dRb/Vg7ZXeEUj4Zz1HYda mguQvQELTtFoUyVF4t+gpW/il1J24gtG4vgzm3UJNSQg5KjvL/bWr1RTws/G3eB32jch RQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3tywtb9na8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 27 Oct 2023 14:07:35 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 39RDU6Js009260; Fri, 27 Oct 2023 14:07:34 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3tywqjsvx0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 27 Oct 2023 14:07:34 +0000 Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 39RE7X5G024280; Fri, 27 Oct 2023 14:07:33 GMT Received: from ca-dev112.us.oracle.com (ca-dev112.us.oracle.com [10.129.136.47]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 3tywqjsvwf-1; Fri, 27 Oct 2023 14:07:33 +0000 From: Harshit Mogalapalli To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter , Umesh Nerlige Ramappa , Lionel Landwerlin , Matt Roper , Andrzej Hajda , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: dan.carpenter@linaro.org, kernel-janitors@vger.kernel.org, error27@gmail.com, harshit.m.mogalapalli@oracle.com Subject: [PATCH] i915/perf: Fix NULL deref bugs with drm_dbg() calls Date: Fri, 27 Oct 2023 07:07:28 -0700 Message-ID: <20231027140729.2505993-1-harshit.m.mogalapalli@oracle.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-27_12,2023-10-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxlogscore=999 mlxscore=0 spamscore=0 suspectscore=0 adultscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2310240000 definitions=main-2310270122 X-Proofpoint-ORIG-GUID: 4GRjFS4CGswat8B1YuhYes0lrVZjnjI_ X-Proofpoint-GUID: 4GRjFS4CGswat8B1YuhYes0lrVZjnjI_ X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.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 (agentk.vger.email [0.0.0.0]); Fri, 27 Oct 2023 07:07:53 -0700 (PDT) When i915 perf interface is not available dereferencing it will lead to NULL dereferences. Fix this by using DRM_DEBUG() which the scenario before the commit in the Fixes tag. Fixes: 2fec539112e8 ("i915/perf: Replace DRM_DEBUG with driver specific drm_dbg call") Signed-off-by: Harshit Mogalapalli --- This is found using smatch(static analysis tool), only compile tested. --- drivers/gpu/drm/i915/i915_perf.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c index 2f3ecd7d4804..bb48c96b7950 100644 --- a/drivers/gpu/drm/i915/i915_perf.c +++ b/drivers/gpu/drm/i915/i915_perf.c @@ -4228,8 +4228,7 @@ int i915_perf_open_ioctl(struct drm_device *dev, void *data, int ret; if (!perf->i915) { - drm_dbg(&perf->i915->drm, - "i915 perf interface not available for this system\n"); + DRM_DEBUG("i915 perf interface not available for this system\n"); return -ENOTSUPP; } @@ -4608,8 +4607,7 @@ int i915_perf_add_config_ioctl(struct drm_device *dev, void *data, int err, id; if (!perf->i915) { - drm_dbg(&perf->i915->drm, - "i915 perf interface not available for this system\n"); + DRM_DEBUG("i915 perf interface not available for this system\n"); return -ENOTSUPP; } @@ -4774,8 +4772,7 @@ int i915_perf_remove_config_ioctl(struct drm_device *dev, void *data, int ret; if (!perf->i915) { - drm_dbg(&perf->i915->drm, - "i915 perf interface not available for this system\n"); + DRM_DEBUG("i915 perf interface not available for this system\n"); return -ENOTSUPP; } -- 2.39.3