From patchwork Mon Oct 4 13:45:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 12533945 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E745AC433EF for ; Mon, 4 Oct 2021 13:48:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C949E61244 for ; Mon, 4 Oct 2021 13:48:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238878AbhJDNtu (ORCPT ); Mon, 4 Oct 2021 09:49:50 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:17352 "EHLO mx0b-00069f02.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238849AbhJDNtr (ORCPT ); Mon, 4 Oct 2021 09:49:47 -0400 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 194DZ3AV017893; Mon, 4 Oct 2021 13:45:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : content-type : mime-version; s=corp-2021-07-09; bh=JFNgeXGFTQK+LhV8oYwmj3Shc1PylF6JbU4Gt7ddCP8=; b=TTRKbvSfCEiCya+X1gLdHC32TudFTSFWDXw+8heyQGyfE5pvRtMoLYRWrMrLCvjcNpnk pcbb0DvD0+R/RYGI6ysPuExZZx1o3x6lTmQaTvvwJoYXyYKE7d85P+COgySeXaYh+OvL apeylmIqnfYmVmsbw/RnzypcLUeaceUHyUT7S8qLKsophgXKzmCGN+8ijiWe5HJ1LPmP pjfed1pzrc+I0oesrQUME22MMki0+6+4JLRXJQMK1ewIjQHowfkRvBDuZb4marfNLJxG 2m5+p0OEfKR+YyIgHBarxc35b958aLnOYj+bc5iFpvg8Nh/VGUYnWYp2aP57Ll1QJ+1R zw== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by mx0b-00069f02.pphosted.com with ESMTP id 3bfaj24aun-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 04 Oct 2021 13:45:47 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 194DeIvX113276; Mon, 4 Oct 2021 13:45:46 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam08lp2043.outbound.protection.outlook.com [104.47.74.43]) by aserp3020.oracle.com with ESMTP id 3bev8v5r15-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 04 Oct 2021 13:45:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mLwEpQF3qtaaEc0YnLG6hxyUKR2wc2inUAC0GQf1ZcoEsY/YEHR210ZrPnXkIHXIXgCavacrqcUsyiuh+1Q+B/0Pov+9GOMmYQxK1L9+FYX1Zp7BNyeqqfHHDjX2ZAL7kdqVu29lnZgE4D6xo61Dhx2O9Mq+NkRingFJZQLCvSpdiMy8fO/Y6MmDQEFylmQEFiy2OFaYEflBmjhwELBsJ6qOWMptn5TKE7/im+ye0xRZwRbrLYreq7fxQQLzHrAf2eGTsCJOcxCxFdNtiikjYpWNfyeoAtUmQQw5xONyV25xe4D42/avpQVt7FLaT5yiUg8T4ruE2CrHg237e/9mPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JFNgeXGFTQK+LhV8oYwmj3Shc1PylF6JbU4Gt7ddCP8=; b=bkscms5doT4guAXapzxUIpXO91MWIGGdS2iVjAPNLRfVQjfv4iHcAU/EONSUE0rvoT4MxD7RGfR68W3W5DbeOGyHfirhTr05bYIQDv8VVBC0DD/s+zsdLv3igmB6K4Yo0Hc256s9jgmQ4xPkANXFmDS4WCq2EOjSWF+5ZMDj9C9jDizZtak5s1K5Mr2HUOeUt1c/a5WI8MZSXEKWNPOziVi2DB9TBD0dG5wxOWtjr4fTQXV6dT9S80y4UzRBQzinhJfT17uECsj2Y6yekGk4WAw4quCqQSzDhPx8KXe/UKQW0sdW7aAO71NqgcWSqCjF50ShDGl0ZaQWUnybpfvIBA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JFNgeXGFTQK+LhV8oYwmj3Shc1PylF6JbU4Gt7ddCP8=; b=cwcNGBfdu+R+N/BuKMKDezcq3jzSFL+Z9Z36Y6IX4BS1CAcgHBurLSOM+S4X5CUr6afH21jtQC+6DDWIvJXpjRt9v7YcRbK+ib9niPJP21/CbgzxXh61HvoliPHHRgfXiWnCapq934doEaPMzsr2fTFKU2RDvZd3noHOa2x1J1w= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=oracle.com; Received: from MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) by MWHPR10MB1949.namprd10.prod.outlook.com (2603:10b6:300:10c::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.17; Mon, 4 Oct 2021 13:45:44 +0000 Received: from MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::d409:11b5:5eb2:6be9]) by MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::d409:11b5:5eb2:6be9%5]) with mapi id 15.20.4566.022; Mon, 4 Oct 2021 13:45:44 +0000 Date: Mon, 4 Oct 2021 16:45:30 +0300 From: Dan Carpenter To: Rob Clark , Jordan Crouse , Jonathan Marek Cc: Sean Paul , David Airlie , Daniel Vetter , Eric Anholt , Viresh Kumar , Akhil P Oommen , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, kernel-janitors@vger.kernel.org Subject: [PATCH] drm/msm: Fix potential Oops in a6xx_gmu_rpmh_init() Message-ID: <20211004134530.GB11689@kili> Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: Mutt/1.10.1 (2018-07-13) X-ClientProxiedBy: ZR0P278CA0160.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:41::18) To MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) MIME-Version: 1.0 Received: from kili (62.8.83.99) by ZR0P278CA0160.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:41::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.21 via Frontend Transport; Mon, 4 Oct 2021 13:45:38 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 87f81770-6c9d-478f-c8f6-08d9873d42f5 X-MS-TrafficTypeDiagnostic: MWHPR10MB1949: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3826; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AN0HHg9NSYBDb0XshhYpE8l0yaKk6QJ7/Fc5mmfVPQMetDsPH8xSmL2coNBwt2HSdOtifzkEZi8aKSY3kPU8zqVZNGDwMbDXfGiJ8mTjKnWj8ALTT7nTZBfZ6xlyx+i7D196QVUz05y05wSkBQFpTFCZT1mdLGPIyxWnRJs11AQA5tOGwiQQ0G5Kt+WC1vV4kZyOnCopy3AAark1wvNB9oJgr7Z/gFwqMrJtvhCbJq6qD/CdQmxdkFE/qdB0aFALAJ0geJOwK+3J9UWenX6GoUADiCf7PK1DA9hEvfHfkvs+GlIdoHpkC3AKapcumHs2MhA5zNePiylviMxLCMmq8gL9mc4hOoOjs+CQvnQGeUlDMemI0DKh6fkAQXkq4sxCj5p9SkNKR3prO2mewZM1cZ+YKuPfuy3FrhzAfJAWqK3ov/FsDIajz5uxBdX8f/NEF+ZDVPl/RzCrx99YpZfsPK8s/bJQGDYtB5efIyn3uKHEMPjucRKByNvr9ItsasT+ES4SxsNjESXyVMw1KdjfaqMz2HQE0Zkz1G4QgaFWaQA9pPoBcsKv3BDYzPztn1+ZKic4Ye1Cz+3Ntxxu2RnKFSrilHdKokuFowOHctJIZ3NBKQz9vi158a6VqJ9tlPS1GgC2ARnw8LCfzCe+m3upej05HXLOs++vXk3MX/wqbeWBXzujczsM3asLTpjAHHlnYqTkuGeQvSm4nUmqlgF9wg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2365.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(66556008)(33716001)(26005)(66476007)(66946007)(6666004)(8936002)(4326008)(54906003)(2906002)(44832011)(1076003)(316002)(9576002)(8676002)(110136005)(956004)(55016002)(186003)(38350700002)(83380400001)(6496006)(9686003)(33656002)(86362001)(52116002)(508600001)(38100700002)(7416002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: W3HSME7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xLARX1Cm+oh6IRI5Egx8DPXj2Hz6IDN++x6H+QkDEUk0mhl4tvQ5kG58jC3WsdB1pKi0nL0OpSVNbfwtPd686xlWVHUX/C22/VUwVZi3G3TXFNxCtpQHZZXUA2WvjAPAk2i1nhveQOwTvGNKlYyZv9aZTSxcmtivWTWaqNa6qVRY92YEcNjoxAo9pM2uFnUQAotXusjDc1K5rKq22DxR2IOnGGwL/I0AMH8hun5cAhlwcs7XlC0oDtyKY X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 87f81770-6c9d-478f-c8f6-08d9873d42f5 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2365.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2021 13:45:43.8782 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: cP/TX1QJQFpSeQpZGZNLyOzi5J79csDJ9jsmiJlg7rpgVjEOgak18fDK1/6I/wkOKR4JJzfNIuIIDDP4d3FS3v5PMtpg9MZuBI3D+UrAWhE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR10MB1949 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10126 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 adultscore=0 phishscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110040094 X-Proofpoint-GUID: mmPTEMYtdaFk2-k2v7-RnZ20jUAU9BXM X-Proofpoint-ORIG-GUID: mmPTEMYtdaFk2-k2v7-RnZ20jUAU9BXM Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org There are two problems here: 1) The "seqptr" is used uninitalized when we free it at the end. 2) The a6xx_gmu_get_mmio() function returns error pointers. It never returns true. Fixes: 64245fc55172 ("drm/msm/a6xx: use AOP-initialized PDC for a650") Fixes: f8fc924e088e ("drm/msm/a6xx: Fix PDC register overlap") Signed-off-by: Dan Carpenter Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c index a7c58018959f..3bd6e579ea89 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c @@ -512,11 +512,11 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu) struct adreno_gpu *adreno_gpu = &a6xx_gpu->base; struct platform_device *pdev = to_platform_device(gmu->dev); void __iomem *pdcptr = a6xx_gmu_get_mmio(pdev, "gmu_pdc"); - void __iomem *seqptr; + void __iomem *seqptr = NULL; uint32_t pdc_address_offset; bool pdc_in_aop = false; - if (!pdcptr) + if (IS_ERR(pdcptr)) goto err; if (adreno_is_a650(adreno_gpu) || adreno_is_a660_family(adreno_gpu)) @@ -528,7 +528,7 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu) if (!pdc_in_aop) { seqptr = a6xx_gmu_get_mmio(pdev, "gmu_pdc_seq"); - if (!seqptr) + if (IS_ERR(seqptr)) goto err; }