Message ID | 20231027140729.2505993-1-harshit.m.mogalapalli@oracle.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp630211vqb; Fri, 27 Oct 2023 07:08:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGx7zhErlqTtsliwYLdn5lge22cA8MMJWTWd0PUgEOUqcPUPzy48H7pJytHZHn6nuMNSZFQ X-Received: by 2002:a1f:2788:0:b0:48d:11d1:9feb with SMTP id n130-20020a1f2788000000b0048d11d19febmr1686418vkn.8.1698415688867; Fri, 27 Oct 2023 07:08:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698415688; cv=none; d=google.com; s=arc-20160816; b=whd5vefLUyOF3pkj3j0jGn4eNp6oDo80eb5IA0IbmNbo1ufw/lQctrrn4qinXpAKBy yBi6kM6+Ojo9GoY1hkBKMlSVrOoSe7BRUf8no9kQFi2vYUqWXJN7kgAEsopuWHX0cych fmuCZHJVqUq5On5srIm7UhWeezRyXqOGs1nlCV1UusSetATN+qhaMtNssYzpG7ZemBqP V2iyz5W0rwYXfmbITGbR143BFI+TJgil9HyYEjKtzbkhZOclWMhceHLDZzUrojKPQgtS 3k45FIZSFOsgZl4/qf62zMBjT9SY2j4fdms91UfMqb6MXJ1brFvy/tMWOdZdtRdDmwdz OpTQ== 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.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id l191-20020a1f25c8000000b00495b9a266dasi215985vkl.168.2023.10.27.07.08.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 07:08:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; 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.35 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 groat.vger.email (Postfix) with ESMTP id 4CBA18332E9E; Fri, 27 Oct 2023 07:07:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346052AbjJ0OHp (ORCPT <rfc822;a1648639935@gmail.com> + 25 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 <rfc822;linux-kernel@vger.kernel.org>); 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 <harshit.m.mogalapalli@oracle.com> To: Jani Nikula <jani.nikula@linux.intel.com>, Joonas Lahtinen <joonas.lahtinen@linux.intel.com>, Rodrigo Vivi <rodrigo.vivi@intel.com>, Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>, Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>, Lionel Landwerlin <lionel.g.landwerlin@intel.com>, Matt Roper <matthew.d.roper@intel.com>, Andrzej Hajda <andrzej.hajda@intel.com>, 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 groat.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 27 Oct 2023 07:07:58 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780917929274286146 X-GMAIL-MSGID: 1780917929274286146 |
Series |
i915/perf: Fix NULL deref bugs with drm_dbg() calls
|
|
Commit Message
Harshit Mogalapalli
Oct. 27, 2023, 2:07 p.m. UTC
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 <harshit.m.mogalapalli@oracle.com>
---
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(-)
Comments
On 27.10.2023 16:07, Harshit Mogalapalli wrote: > 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 <harshit.m.mogalapalli@oracle.com> Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com> Regards Andrzej > --- > 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; > } >
On 27/10/2023 15:11, Andrzej Hajda wrote: > On 27.10.2023 16:07, Harshit Mogalapalli wrote: >> 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 <harshit.m.mogalapalli@oracle.com> > > > Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com> Please hold off merging. >> --- >> 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"); What's that struct drm_device *dev function argument a few lines up? :) Although TBH all these these could just be removed since I doubt they are adding any value and ENOTSUPP is pretty clear. Regards, Tvrtko >> 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; >> } >
Hi Tvrtko, On 27/10/23 8:17 pm, Tvrtko Ursulin wrote: > > On 27/10/2023 15:11, Andrzej Hajda wrote: >> On 27.10.2023 16:07, Harshit Mogalapalli wrote: >>> 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 <harshit.m.mogalapalli@oracle.com> >> >> >> Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com> > > Please hold off merging. > >>> --- >>> 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"); > > What's that struct drm_device *dev function argument a few lines up? :) > > Although TBH all these these could just be removed since I doubt they > are adding any value and ENOTSUPP is pretty clear. > Thanks for checking. I will remove the dbg() calls and send a V2. Regards, Harshit > Regards, > > Tvrtko > >>> 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; >>> } >>
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; }