From patchwork Wed Oct 13 08:11:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 12555071 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 D1BB4C433EF for ; Wed, 13 Oct 2021 08:11:58 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 680D060EE9 for ; Wed, 13 Oct 2021 08:11:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 680D060EE9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BF1D36E2A3; Wed, 13 Oct 2021 08:11:56 +0000 (UTC) Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by gabe.freedesktop.org (Postfix) with ESMTPS id 38F116E2A3; Wed, 13 Oct 2021 08:11:55 +0000 (UTC) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19D70UsM013092; Wed, 13 Oct 2021 08:11:50 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=S/DvPk8vP6Tg+9NoZgj6aiISxq7OBYerCNB0LC1UrkM=; b=eDwZTAVbymnwpspfc9z1deumRqnJ2aCziefmGT7lmxEsTHpbVYrjpVAVrTCrXEXXBy+e 3LZu7pzb7wUjj2twrsUqOOj/TiqbAzksjI+i+bjVUk3GxqAV2iSFA7FJJTCff15VcvpY vbQiJK1+1L48DFzSJkNEFMgjfYUcTqo/D7+/KYT4sAdh5tYAIIZwPPlcRkc/emcyCgDY qNtOq4rTcy6Eblu6uhu5Pw5fLyyY0DuOSOZnKvtKH6rHIeiqDfibBNB2Ac5EFPBzLEHJ sFCnCn0tUMf3TS8hKrkbywgOD6ocecRs2IBvkvpnav57HWc0N5z9z/Iw7cbcPmaW6q91 /w== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by mx0b-00069f02.pphosted.com with ESMTP id 3bnkbmt7um-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 13 Oct 2021 08:11:49 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 19D86RcZ024130; Wed, 13 Oct 2021 08:11:48 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2108.outbound.protection.outlook.com [104.47.70.108]) by aserp3030.oracle.com with ESMTP id 3bkyxt2jaf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 13 Oct 2021 08:11:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KLLzBz7idS9avs5W1cUdUI0gHyibAPmp0aTs+TF7Iuax42+OxK4IQ6DQFhfQpQAaJcbZfbdC6DmsKxL+/KslEbbybSwIFsudrUyE6bwgQU+4WhDVo7z2z74HNQf73bUcd5KjxUs6ZccuXyqnYBOqQS+c3OPhLtnosooZxPQptvHRQymhT0jiYxIgCIkBW5Lnv9jyHiZa8SQ9M33ZTf34R/ymXtMi+PqSj0RvMabVl23LpGMiIiGzJOoS9bdRyTM7iCf85JAYsEIsBoAVB4Ln2MZWtYqXFV/MM7yoqmuBoz4o0u1jzQlR9TLdFfMYgSXJIQ7yL6iazl5ZkDhoMms6BA== 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=S/DvPk8vP6Tg+9NoZgj6aiISxq7OBYerCNB0LC1UrkM=; b=gTWSHr2tFH9LQVgCEj5/1JB6x85VgXV6ud0fFcunfowLo2EYTju37S8r5U78UpcRXkyz8vEfoP1goKJuUCWk2X8kkJ4Y3Yas926IoGdZ1NYsivmxKm4tQATSd5WWMeAoMERYLXu6fXtFPVWf+bO4M8JCyPATi27XStTKlz94HYjneBxmCANLzzlefCFFZOb1JsPoZAPE1eI34JUjbtkavdAnuJgcXRFM/KGWl3maseILt5UpoSxrUYfu17vgDhWUplbmPXro83JxDIcaZiTbr3AArTuujk9OkDsKrzbzx/C4svKCUfl95GuXBxUOh/gIzR+9HMSW3Eu/73fzZz1KZA== 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=S/DvPk8vP6Tg+9NoZgj6aiISxq7OBYerCNB0LC1UrkM=; b=V86pTx9k41ZyhimG2kEitn0bKIi7inJIZVlPRLVL0Vp2dvP37g6ed+Aj2sRKlGKLjiAjYLf5Rw6/Qeoxae3ZXGYpSGwGFu8qORvrgi9qeiDDtwmruNL2cFz9JKnLOuZ3Qe8jjNqRHGVyLoId9Asg7/V3ptiRzEJB5Eo3dA5DbMY= 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 CO1PR10MB4643.namprd10.prod.outlook.com (2603:10b6:303:9c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.24; Wed, 13 Oct 2021 08:11:46 +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.4587.027; Wed, 13 Oct 2021 08:11:46 +0000 Date: Wed, 13 Oct 2021 11:11:33 +0300 From: Dan Carpenter To: Rob Clark Cc: Sean Paul , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, kernel-janitors@vger.kernel.org Subject: [PATCH 1/2] drm/msm: fix potential NULL dereference in cleanup Message-ID: <20211013081133.GF6010@kili> Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: Mutt/1.10.1 (2018-07-13) X-ClientProxiedBy: ZR0P278CA0145.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:41::15) To MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) MIME-Version: 1.0 Received: from kili (62.8.83.99) by ZR0P278CA0145.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:41::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.25 via Frontend Transport; Wed, 13 Oct 2021 08:11:43 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 62714bdb-a9b2-4e71-8929-08d98e2119b4 X-MS-TrafficTypeDiagnostic: CO1PR10MB4643: 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: HJg0sl5VkLfrS+8BIPexreDHhNjYDw5P7nwCX76YIoGOsSAowkSD/I+SufZwTrIPaEfZdak5WQTMjIMYqr4jeXk7qOsoL+OWpQGaRDsulR4lAyNmMj/PslUjZPtBSQAVnTqIXUZ7gyueVhz7bGUPhRSDKQyNRZ5qNP7kkS9Plmp/hKS+Qo1OO4KZZdNLq23n7QTQiOCotBc/DtB3JA2wbSPBGdvtf2iqCeowkgflqKzI7G+ACmcuScynlxaAxU+vbihw/GAkDeukuDnYEVPP4EN8Zo9T/jxcjLkKk69HGN4m/esQGs58JROQiMhB14Ut2eVZnhOesaxWRSbp08m5Y9Ma31MARd+1jANs+uhkgT/3juvSDZFy6UeT5BWKz8zoWxcYYXNNCgrShlI1g17RjjkjCmkYciE3krcwBccViXOBseHomL4u1mN5ML9uO805zMXUqM5ELDu/ChV63OWt6/xFdW3IaEArJYJdrh3mqqvJ5qIXhLwB9z/6Ppcjo8Lqew/s3G+IIv2rUjN5VbsZuXlJhbvMsUpUuuPdf0xBLQuZpbfsPHt4yFhGGo/rFbNKASypbY8MLnS2v9RV6Uv5fjnpN5VefSesr69CTlPWY3CpO91V8MXQLcB1xdeMpKXbwEi4Jjb40JKORlTA6x2cAmxO4Vr5l6Y11fUtpkZ8/H3oy0kgYqTMGQAqzTWDIJo788W+pkcHWuSOyfn4vWtqaQ== 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)(86362001)(66946007)(4326008)(66556008)(6666004)(54906003)(2906002)(6916009)(956004)(38350700002)(33716001)(6496006)(38100700002)(66476007)(83380400001)(186003)(508600001)(33656002)(1076003)(44832011)(4744005)(8676002)(26005)(5660300002)(316002)(9686003)(8936002)(55016002)(9576002)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0NoBQZmBnC1BiE7jFwnZeALkx/c4ZmRXfEh5gp8+ORYpfTsjs0SbDcDdwSlhWo4JknSl7MqDbHxcITCLRt6WdHAj/t3lScIEYt/kllUcqAzPoVjSRbe5jcYnM90FEvFVfH62QjIC5FzzbPYDT7HjSDxW/TOqcc0APzj/p4cKM3g6fF7jxK38TZo6WLwajDFzkAPzFW0CoaVrQLh5yoCfaDcBe0v/UwtS0Y0rnCqLiBWtaIvaFuYg2+ZBQIV1mDNK29bS59lAG67xz6asacMf9u+04QGroC9R7o3r5m63pdbVSJXYZuE9VH/yOENLov70xrOgyedbNVzN6CZJ20QMX3ACiNcmE9cbLVcCBG64aQ51oBC8QzkvDj6CWaJDnbklJRs8sopsdadophAK+nvB9jC5qe9Y3UpjLWfpM73BVgXlAOikx6GCSIpRTCozH1VH7Y9kw4bmhM4ituz/oGhAuzHm2mpIQS0/ifWEDMzCmv8K61v0FeAKefp/FcockPPdeltcsSH/cwWIaX36SGLWT1SRA8NdgbIxXL5qcMIS+UDtMKXy12EIUXbtTvH1CHVdqvAu2c6zLh+2eQBul44N1nAgdxXzZTv2eEojhqM/eBoetYzkQAQv38Vm4q3lrDSWnrhiQicq5L0M+c5CyYx1wE9nfLDfZ/sqZ6tTZj2xNEkRWuOIfSAQAfBQ1JaCnjzphL2AobrLjAyMRSfg8UVwacL9k08/Ja07enJQjYZBk4gZP8IxHYbervoFtlL8ytwwnqoFYJal1rv1WR9g0/nwsjJIV09x+s/+QwcHyVi/CoaNfqFZUhDdJaBVbrAXbPSRqFWEtb8zJ6y3+zAkUoPdsPP0c+cfLDh3AsFB20OwwpafHTHVRam3TE2NGarX6PCs+xRexzfJ5+KEVpx11gymkGS+gFjBXaK5xLk29nT8kr0wLjn0nyfm27MsWpe3zgCA/K/ztf7VqXE7zHtzU1ym7+OEaurKkOYIuGYC+BswI8brsf+wWGkN0+fcV3Bga0Q1go+J7kBGxhstiGTAX0YI2iKCuD4cWz0yARlSN/SyTobseSZ0LsCzx/YYnBMNdlH6ki+JReni8tuu1sWszKsOK3TU/pVA8ldgVfrfvfGWoqnzqOsmurArwwvPorT/A3P5LppslvRitvnqryN6ri5fJhJKSZLrV/WK6GjTQnDUCv6YUm19cItHToLgN8GnCvstZurSmJVa4CDdqsF/pVBt+9vWwu8b9x7nKpXIRKjM6J/H72CXe2P8eH33JOuQdtwu1qhVE8RtCWkAcP/gfIF2b4TTZ1/VHEYaqoxxd/PT6IGvZjpAtH7JrwXiDz2vRPpX X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 62714bdb-a9b2-4e71-8929-08d98e2119b4 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2365.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2021 08:11:46.7222 (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: 0H9kuJKc2+6lvsHqaJfrlPkXigJEY2CkkemeEbs+WKLw4g05+6wnqCsqcYWITxSQiA3V1bHAOy24Ex2m2Orb4LD16eCj4sDIYg0YOXSb5yE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4643 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10135 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110130054 X-Proofpoint-ORIG-GUID: qD8g9jWGBcyMTjtkFeEdsH_XNd0GaHHn X-Proofpoint-GUID: qD8g9jWGBcyMTjtkFeEdsH_XNd0GaHHn X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The "msm_obj->node" list needs to be initialized earlier so that the list_del() in msm_gem_free_object() doesn't experience a NULL pointer dereference. Fixes: 6ed0897cd800 ("drm/msm: Fix debugfs deadlock") Signed-off-by: Dan Carpenter --- drivers/gpu/drm/msm/msm_gem.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c index 40a9863f5951..49185d524be3 100644 --- a/drivers/gpu/drm/msm/msm_gem.c +++ b/drivers/gpu/drm/msm/msm_gem.c @@ -1132,6 +1132,7 @@ static int msm_gem_new_impl(struct drm_device *dev, msm_obj->flags = flags; msm_obj->madv = MSM_MADV_WILLNEED; + INIT_LIST_HEAD(&msm_obj->node); INIT_LIST_HEAD(&msm_obj->vmas); *obj = &msm_obj->base; From patchwork Wed Oct 13 08:13:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 12555077 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 CB129C433EF for ; Wed, 13 Oct 2021 08:13:36 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9920A60FDA for ; Wed, 13 Oct 2021 08:13:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9920A60FDA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AF31D6EA0E; Wed, 13 Oct 2021 08:13:35 +0000 (UTC) Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9EE076EA0E; Wed, 13 Oct 2021 08:13:34 +0000 (UTC) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19D7Gn17028774; Wed, 13 Oct 2021 08:13:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : content-type : in-reply-to : mime-version; s=corp-2021-07-09; bh=GNbtPbOvlaqdwqZpjkRYffboDtxY3BwlN2MQ1y51Z6E=; b=ypOrUxQKt51/l9M4SyNyqZm89Fb2+66dh1IDzRC6dA1ZsyW4hXaw4lfcIAwoi3lecBzx +yc1fKVLnO7z5C7Efbtm25EI0+PaSzbj+BHa3xniqB8u5pCiZ3D9+hTALgj/JHV7qF4H /tCKuC/diufajHg7YPMr0HnlpLLi/RLeRXOmZBwYMaa+yMyrhcP5PJuJ6FHqNomWcVNA f/dhxC8vK0qBvZ+CiULhLDERMCqnWYNcX3O93UyLZViCgMlCDtglG1jZDXctNNwPxCHC mJvoJSu03Em80hVrgm/IHPKnPuo5+KkdqTnfPca7gPQAyB/Z4IOKyccu6bUH7zmNeNq2 aw== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by mx0b-00069f02.pphosted.com with ESMTP id 3bnkbh25hc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 13 Oct 2021 08:13:31 +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 19D84l2B057870; Wed, 13 Oct 2021 08:13:29 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2101.outbound.protection.outlook.com [104.47.70.101]) by aserp3020.oracle.com with ESMTP id 3bmae0cngg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 13 Oct 2021 08:13:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E4jGpaEdTcVz+Szdwaa/q1EGrRmsKNjp37nzyBgNPPltxdqLyGTUma4EldgUo20YoyUHFKWAg1FQfK3P+Ti3pOh24d0o6TjXjLKhTPhoJYJRy48oCGzBgkrZI1aiMzOqwXSkKh6QwhceMJKqd63r4eh6veFoun8YNBer6VT85h3M0O11vYDUwj5ZCLgrbHaGRbey9TqIbcJ5lwpr1XpZuINTEliSoblv7DVmMZhrpUYGVCQPS2zko2CFHtvYF90KVHPUr9pBXTqdTFr0syhVLQAnpPjHJWrcc873tNEdAQJ8RFWMOvCDjS57XynFMvjCZCIiyx6vzO/YjqmpmGyiuQ== 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=GNbtPbOvlaqdwqZpjkRYffboDtxY3BwlN2MQ1y51Z6E=; b=RMOrE7SuumWFcl/inPiLDck3iXRFhTtGBWYW+syC09sXrFylPycmIFsjmpd/B8iqraWSTL+mL3l7s4FmcC/+r4mrRnKcq0ITsCFaGQmDIXCYvKcRsa3Rw1sz4Q5+QK50bNlXOyaU9hL8r5ZmaNUA0GX4wrLpYYHf//opfdnhjBSr2JHsEwtnHxD7OaXYuHXIqmfNnzJq/JWlkQyu5MW2lVXHiMBKlP+IfJCa1bgtfu5KDLg1e/03anqHzkqWkpsr+PviRrNjDK5bbPiktrr2RyWVF8n+MOT88ihvfuqAc/ruBYs5JS/FJ8+IwSmS+7HDeWLT7rz7hxPi/SDiXnnq4w== 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=GNbtPbOvlaqdwqZpjkRYffboDtxY3BwlN2MQ1y51Z6E=; b=tDOdkzuPpFvsC+xBNVi67Q6etvO9WUJXoTv+ljfggr8Ktdlu23jScn7LM84NG8SOw3CXxZ3za7drWfk3l6O/xnt+SMeW8CyXLnppoDR0YrBKj+0sawha+FzToL2TOOuSFJm/nRPDFJG6cyQMBAUQO+WNNh2fwXJXaD2yb6mxG04= 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 CO1PR10MB4643.namprd10.prod.outlook.com (2603:10b6:303:9c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.24; Wed, 13 Oct 2021 08:13:28 +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.4587.027; Wed, 13 Oct 2021 08:13:28 +0000 Date: Wed, 13 Oct 2021 11:13:15 +0300 From: Dan Carpenter To: Rob Clark Cc: Sean Paul , David Airlie , Daniel Vetter , David Brown , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, kernel-janitors@vger.kernel.org Subject: [PATCH 2/2] drm/msm: uninitialized variable in msm_gem_import() Message-ID: <20211013081315.GG6010@kili> Content-Disposition: inline In-Reply-To: <20211013081133.GF6010@kili> X-Mailer: git-send-email haha only kidding User-Agent: Mutt/1.10.1 (2018-07-13) X-ClientProxiedBy: ZR0P278CA0010.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:16::20) To MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) MIME-Version: 1.0 Received: from kili (62.8.83.99) by ZR0P278CA0010.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:16::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.25 via Frontend Transport; Wed, 13 Oct 2021 08:13:24 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5915c6f1-7f50-4bdc-7a6d-08d98e2155ee X-MS-TrafficTypeDiagnostic: CO1PR10MB4643: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xQ5mTK/ridokeV1U68JNobz0uMrXr6Jr446P/rvZKEldg2W/81EICVBF5foBnICQoX9+s9GeBKhHJYwMGasAwq0sfBMT4zRlnlibIHTa2tYs6aORZ2jWXBm1R9j3PJqt+Syhz2DNZGwUY4w4j68Koto+mSCbl9UraaFfPBamHdmt995b5sLlYUtuHLZmmi+sfb78PxoLT8c9Vz8lY/JvKlPxyHlPpLYifXmiqye5FLtqTEwc0BChAGq0P4dQDLjnXpXuIjdGEupnx2GNpn1ENrsvVD8uK6J3D3VEnLvrFssOsX9WJdi/Lha7Y+2adCftdsTFIAFsyt/s4/vmoM8agT2kLoSRUfbRod+e4+Qw+MmdiuDxBek9xfx12ajfSInhKx8HH1RKe4vC9tEcQ0UA+VFfjZteHVEkf3AXwnWyTnt774C2qcsTAm3fDpY3F/qjuT33IZwcFLQbHj7iGZhcJ/XLhtTyKKhAkr79PXrqejrHnN6AWz8vzcgpaV/VW77GUczkxSKm4TLDNACyH280yuSWsXQ0AbVE5y76Ma14QIg3sJVghexVmJmY5TA8aFXi/k2gHAq/x41WjMj5buplb3KZfr1MUJB6CpBFPMUXGBdXc/uaVityFUFIJYsS9Tqf42GjRcIuxIyNAqbZgQQMOGfMxDdptLSGtGS67LlMUNWGyZJ9teXFj2roFtLwOceW5TtxZnKSAlhS/D7kvk9urw== 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)(86362001)(66946007)(4326008)(66556008)(6666004)(54906003)(2906002)(6916009)(956004)(38350700002)(33716001)(6496006)(38100700002)(66476007)(83380400001)(186003)(508600001)(33656002)(1076003)(44832011)(8676002)(26005)(5660300002)(316002)(9686003)(8936002)(55016002)(9576002)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sh40HbT1XdcT4O/z7ER+pRHqvQwPieg16Zr7xzChYsNHAT6iAIn6HIjX4eIf8T+8jqHDrPod9KtNeI2fKHaRHFRZZceF1mht4K18vRfw9Bma1yurYL08ubQH/GHNqb/n6gD0pLJkddKlqTf5IJMp4rwIF6YzFtq0ComVHvXmKsQf5BIx9brozykih+WR18BdWdPDAKOyWlfmIdPyE2YnyViE2fJ07uB3Wd8N/+C5a8orXRxRPdi6qV6DVw4AbOV8miB3iiczi4dEc1KeTn9uIGetUjSOb6RGgSjPmKrc4SqquaiGCr+BjthucT9pBat/wUNIWETSofHwMjTjZm3Z9+pVrQJgGW2Lud6yQhay1lmRrHl3VWKnvAkVr8Yf2H5l9y8F3SDQQNtpF4lC+ROavbFhcrsGumni8GV+tgD+AiG+012J2G/eR19dNutGyLnb/P+dK9+pucLYdgk2b9Xx9f6df/pA0CpxwD98BlOObt5VK504K2iDwThFI8zFfGXqMIXP2bRuP52u7HH8gw/jqtoR1ao0w5cdtLPjn39TQwyPg8TlTmYfDWSO2OpFECbeD0C6C2urLUO88XJKA9UYQjQu7k/OtI6conKFiHOjaggOohXRz+ZQ7ISzErMSEO3c48+aLlkHmzGT8OWsMx2GiZB1Vu3FY6wL6vWFgG7l6FCbUaW7s3CX1k7Iw1iB7QvdlzXShqc9WNQDSEOlwKF8r8rCELVO1m17vaJ7V6Jd4+dCH6rQ1ZIOAstW9VO3RDT37eX6ibEV71xDehvXbz+nwhlEOltkVznyRO3nXMt6kJBCfAS5J8VUnTD4B53N5kYGa/Jxq3ahfCzNtPTsixXd/0KiLA6FWndNTMPZEABIQ3z9dpgqJBJUaEvCfKEWw86EaPTR5V+XxBqeGK09Ir2I1R0lQmFFEZ3aoi8iLTz/pcNKc+b8nhAQRoJDrOmvEWDJG1vWnTjVyEBJsTdxuJ8Bb/mueOkMkc5/XU9RA5pzGXcrucrO9M7gyRvoriSk/HBaLAF2DRHXfJ8RfU3jKs6DrdHsM6Tjgzrp7npyMzGvv9WvF5KdyZdBI7p2S6wc9ck8T9HxReMWNULR7M5XTApfXam57H8njgqzTPqawdVG50w/b49NNt5X1qpC3GBSPh6I3lgDx78slWPJ+aR2wzt32MN2HgHh9QAlf1at8N4e+npvq50FvLvlYxLJEGe4PmXRBLlqQXE5IW9CpXncI0xDp6q+LqPv2DRzkcw93apUeEoQ1bi6+jetJSCFTL5v+d7jf78xw3QycHlhSBGIg1NTVrL0pCtoI4ubzCIJ/t8a/b7MRp4MJDeVfQ84e63AmUc9 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5915c6f1-7f50-4bdc-7a6d-08d98e2155ee X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2365.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2021 08:13:27.9311 (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: bEYyeVE13h9EM2J2k1WY5ZLvR4IN/ZPX/muoc8BrdqBNDW9wW40hieXKzYPaulZniJanHO50jMlz2ZoOy/NNWbdLJSJaZ0iuAMyI2x/WGVk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4643 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10135 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 mlxscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110130054 X-Proofpoint-GUID: 91Z246DJ68FjtarPmns-YIDYd-BDg6vU X-Proofpoint-ORIG-GUID: 91Z246DJ68FjtarPmns-YIDYd-BDg6vU X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The msm_gem_new_impl() function cleans up after itself so there is no need to call drm_gem_object_put(). Conceptually, it does not make sense to call a kref_put() function until after the reference counting has been initialized which happens immediately after this call in the drm_gem_(private_)object_init() functions. In the msm_gem_import() function the "obj" pointer is uninitialized, so it will lead to a crash. Fixes: 05b849111c07 ("drm/msm: prime support") Signed-off-by: Dan Carpenter --- drivers/gpu/drm/msm/msm_gem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c index 49185d524be3..0e491cd21c53 100644 --- a/drivers/gpu/drm/msm/msm_gem.c +++ b/drivers/gpu/drm/msm/msm_gem.c @@ -1167,7 +1167,7 @@ struct drm_gem_object *msm_gem_new(struct drm_device *dev, uint32_t size, uint32 ret = msm_gem_new_impl(dev, size, flags, &obj); if (ret) - goto fail; + return ERR_PTR(ret); msm_obj = to_msm_bo(obj); @@ -1251,7 +1251,7 @@ struct drm_gem_object *msm_gem_import(struct drm_device *dev, ret = msm_gem_new_impl(dev, size, MSM_BO_WC, &obj); if (ret) - goto fail; + return ERR_PTR(ret); drm_gem_private_object_init(dev, obj, size);