From patchwork Sat Sep 19 02:02:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhaumik Bhatt X-Patchwork-Id: 11786539 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B411792C for ; Sat, 19 Sep 2020 02:02:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8E54721707 for ; Sat, 19 Sep 2020 02:02:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="AhACZObO" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726353AbgISCCt (ORCPT ); Fri, 18 Sep 2020 22:02:49 -0400 Received: from m42-11.mailgun.net ([69.72.42.11]:55682 "EHLO m42-11.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726344AbgISCCs (ORCPT ); Fri, 18 Sep 2020 22:02:48 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1600480967; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=5/gpH+41gjffD6hpUwKvRo/De/Nf7sFSl2R2qixn3Qk=; b=AhACZObO6QZuoZD49LjrEyKx9e9tezTRcFxM3AwbpAS7GWalH3RUbQsnn6+/MKvNxAA1RvRo RSQE4rJOKtTBgW1pz4l1M/z/dL+UF1Li5Xyd3AzFNvub3g0wwXo++doxWaNfqTBYmHHnI2sf R15C8FxXrsYvCLzJkWSvFM7VhwY= X-Mailgun-Sending-Ip: 69.72.42.11 X-Mailgun-Sid: WyI1MzIzYiIsICJsaW51eC1hcm0tbXNtQHZnZXIua2VybmVsLm9yZyIsICJiZTllNGEiXQ== Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n02.prod.us-east-1.postgun.com with SMTP id 5f6566c77334da8678b08f91 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Sat, 19 Sep 2020 02:02:47 GMT Sender: bbhatt=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id BD146C433FF; Sat, 19 Sep 2020 02:02:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from malabar-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: bbhatt) by smtp.codeaurora.org (Postfix) with ESMTPSA id E0682C433C8; Sat, 19 Sep 2020 02:02:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E0682C433C8 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=bbhatt@codeaurora.org From: Bhaumik Bhatt To: manivannan.sadhasivam@linaro.org Cc: linux-arm-msm@vger.kernel.org, hemantk@codeaurora.org, jhugo@codeaurora.org, linux-kernel@vger.kernel.org, Bhaumik Bhatt Subject: [PATCH v1 05/10] bus: mhi: core: Disable IRQs when powering down Date: Fri, 18 Sep 2020 19:02:30 -0700 Message-Id: <1600480955-16827-6-git-send-email-bbhatt@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1600480955-16827-1-git-send-email-bbhatt@codeaurora.org> References: <1600480955-16827-1-git-send-email-bbhatt@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org While powering down, the device may or may not acknowledge the MHI RESET issued by host for graceful shutdown scenario which can lead to a rogue device sending an interrupt after the clean-up has been done. This can result in a tasklet being scheduled after it has been killed and access already freed memory causing a NULL pointer exception. Avoid this corner case by disabling the interrupts as a part of host clean up. Signed-off-by: Bhaumik Bhatt --- drivers/bus/mhi/core/pm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c index 1862960..3462d82 100644 --- a/drivers/bus/mhi/core/pm.c +++ b/drivers/bus/mhi/core/pm.c @@ -517,6 +517,7 @@ static void mhi_pm_disable_transition(struct mhi_controller *mhi_cntrl, for (i = 0; i < mhi_cntrl->total_ev_rings; i++, mhi_event++) { if (mhi_event->offload_ev) continue; + disable_irq(mhi_cntrl->irq[mhi_event->irq]); tasklet_kill(&mhi_event->task); }