From patchwork Mon Dec 28 12:43:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 352702 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp9818360jai; Mon, 28 Dec 2020 07:11:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJySOvNpx4/MF3n5j/mKTI00mdLrM0Y9VZcEcLGh9UQ5S1YU4WBpFnszSoFg1fUaUYaGWE+F X-Received: by 2002:a17:907:41e3:: with SMTP id nb3mr42677972ejb.378.1609168224954; Mon, 28 Dec 2020 07:10:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609168224; cv=none; d=google.com; s=arc-20160816; b=oIYrExWCHFUK5/wAhRSSE43iqjmaMjE7zHAmomSRA53332FpIYIxDfhNSk3gMfJ4LG cOmZSm/AqGgPAKzF2JYk2hBPaJ75ZCx08HxAn5x6m/yLQPq5Hdx3t8dd0IxpN7GWc2pD W/KtaNqVui13phB+o9znXK9/1Sy4hOp/B/EEqhAjN+HoP3VtF5ucjP6P/RGU4t03JK1s KdTpRFynRGKWCj1O94cbqVsVjZCU3G3AsvolLAFN2H5EHg7wZkslC7Zw2Cya2tpdPW0n 74y5X9cWchhqPiEsGm85kRCuV8TI/ZmiijwOEeusP+uwT7jwcmMhbNJ1iosBb14F3LX9 E97A== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ufPBxlnsBb7MIutHEUQwpQ3RVLWPbvUM4aQv/4fC0bw=; b=qGBNBwRjWKgZVeN/02aIsQyGdIXWLLJ3nO/e7Y6Jj8RYXrq9Pk71E4jDSnYu5FXf/G 37jijeKhmR4DkisH5k0wiQZqMR7Q5m/WFufFiqtEMBkaunBCDN/+DSV8en2tt8OImVYp 3xMtBYWKRmPbAiWiZRR80YYpwnPhBWsvvTbloLBrgyvQmljr/HXa9zgQEtrd6aanvDDy XmEH+oKmy6xL/Yg23iDBsNCWHHsurATk+ZILR2JD/KkOLR+LYhK1ZJ8ADyzBlAFXQ7cj Pv7rM+A1MXD85WjwrmXxyRNoC/9d/urhd0dwetJNLvMKyh6cbCDE9ZkBekXu9GnKi42/ a7lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Wuxxi6wB; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e20si18577079edr.131.2020.12.28.07.10.24; Mon, 28 Dec 2020 07:10:24 -0800 (PST) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Wuxxi6wB; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438967AbgL1OKM (ORCPT + 14 others); Mon, 28 Dec 2020 09:10:12 -0500 Received: from mail.kernel.org ([198.145.29.99]:44616 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438963AbgL1OKL (ORCPT ); Mon, 28 Dec 2020 09:10:11 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2F7DE206C3; Mon, 28 Dec 2020 14:09:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164570; bh=WZZNQL4waOwc5Rt/nP4qhfP11LZ1Qtc92pWShd0huvI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wuxxi6wBJDItqkSEMWwmssJXdapPK1/VwoXGuxDinhtQ3O5qM98Yugd97a4q1lKPb zqsEsaeDOkm7JsSZwG/KKZyuRiGTdZ3UAboTUaTR/ZpkoG4d/ZIVA1sz8Jv73mDMWO tiq3gJdFtVVOYcKeOnYMzrLuBGmvghm/WdLX5eZE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bjorn Andersson , Srinivas Kandagatla , Sasha Levin Subject: [PATCH 5.10 222/717] slimbus: qcom-ngd-ctrl: Avoid sending power requests without QMI Date: Mon, 28 Dec 2020 13:43:40 +0100 Message-Id: <20201228125031.618183747@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Bjorn Andersson [ Upstream commit 39014ce6d6028614a46395923a2c92d058b6fa87 ] Attempting to send a power request during PM operations, when the QMI handle isn't initialized results in a NULL pointer dereference. So check if the QMI handle has been initialized before attempting to post the power requests. Fixes: 917809e2280b ("slimbus: ngd: Add qcom SLIMBus NGD driver") Signed-off-by: Bjorn Andersson Signed-off-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20201127102451.17114-7-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/slimbus/qcom-ngd-ctrl.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.27.0 diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c index 218aefc3531cd..50cfd67c2871e 100644 --- a/drivers/slimbus/qcom-ngd-ctrl.c +++ b/drivers/slimbus/qcom-ngd-ctrl.c @@ -1205,6 +1205,9 @@ static int qcom_slim_ngd_runtime_resume(struct device *dev) struct qcom_slim_ngd_ctrl *ctrl = dev_get_drvdata(dev); int ret = 0; + if (!ctrl->qmi.handle) + return 0; + if (ctrl->state >= QCOM_SLIM_NGD_CTRL_ASLEEP) ret = qcom_slim_ngd_power_up(ctrl); if (ret) { @@ -1503,6 +1506,9 @@ static int __maybe_unused qcom_slim_ngd_runtime_suspend(struct device *dev) struct qcom_slim_ngd_ctrl *ctrl = dev_get_drvdata(dev); int ret = 0; + if (!ctrl->qmi.handle) + return 0; + ret = qcom_slim_qmi_power_request(ctrl, false); if (ret && ret != -EBUSY) dev_info(ctrl->dev, "slim resource not idle:%d\n", ret);