From patchwork Thu Jun 23 03:50:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanley Chu X-Patchwork-Id: 585403 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61C1BC433EF for ; Thu, 23 Jun 2022 04:43:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231960AbiFWEn2 (ORCPT ); Thu, 23 Jun 2022 00:43:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243710AbiFWDvF (ORCPT ); Wed, 22 Jun 2022 23:51:05 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 526D83DDE8; Wed, 22 Jun 2022 20:51:01 -0700 (PDT) X-UUID: e9475722f96d40ea95b54e3eaa8033a8-20220623 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.6, REQID:ec151897-e2bd-4893-9d1d-0a0478c2fb54, OB:0, LO B:0,IP:0,URL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,RULE:Release_Ham,ACTI ON:release,TS:0 X-CID-META: VersionHash:b14ad71, CLOUDID:dfc047ea-f7af-4e69-92ee-0fd74a0c286c, C OID:IGNORED,Recheck:0,SF:nil,TC:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil ,QS:nil,BEC:nil,COL:0 X-UUID: e9475722f96d40ea95b54e3eaa8033a8-20220623 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1569367820; Thu, 23 Jun 2022 11:50:55 +0800 Received: from mtkmbs07n1.mediatek.inc (172.21.101.16) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.792.15; Thu, 23 Jun 2022 11:50:55 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 23 Jun 2022 11:50:54 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 23 Jun 2022 11:50:54 +0800 From: Stanley Chu To: , , , , , , CC: , , , , , , , , , , , , Subject: [PATCH v2 8/8] scsi: ufs-mediatek: Fix invalid access to vccqx Date: Thu, 23 Jun 2022 11:50:52 +0800 Message-ID: <20220623035052.18802-9-stanley.chu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20220623035052.18802-1-stanley.chu@mediatek.com> References: <20220623035052.18802-1-stanley.chu@mediatek.com> MIME-Version: 1.0 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Alice Chao NULL pointer access issue was found for the regulator released by ufs_mtk_vreg_fix_vccq(). Simply fix this issue by clearing the released vreg pointer in ufs_hba struct. Reviewed-by: Stanley Chu Signed-off-by: Alice Chao Signed-off-by: Stanley Chu --- drivers/ufs/host/ufs-mediatek.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c index 125d64e097f2..2404df9c3a01 100755 --- a/drivers/ufs/host/ufs-mediatek.c +++ b/drivers/ufs/host/ufs-mediatek.c @@ -758,6 +758,7 @@ static void ufs_mtk_vreg_fix_vccqx(struct ufs_hba *hba) regulator_disable((*vreg_off)->reg); devm_kfree(hba->dev, (*vreg_off)->name); devm_kfree(hba->dev, *vreg_off); + *vreg_off = NULL; } }