From patchwork Mon Dec 28 12:46:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 352728 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp9842251jai; Mon, 28 Dec 2020 07:46:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJxcYHzVYhTzHAGOd7euEEiefW5mZWCwMu0b479bm/VDLUQcc0RkTVHgKW2aNfF+JsZ2V3hx X-Received: by 2002:a17:906:934c:: with SMTP id p12mr42930244ejw.361.1609170411914; Mon, 28 Dec 2020 07:46:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609170411; cv=none; d=google.com; s=arc-20160816; b=KI7W3dSHv/fyDj6pHD2OQqO2EDr62+aVotmWZC4GFtI0pWt5QmErjiTnB1jVzcNs1Q RNom3x1q7hxJ/zo2xdBS7HbIlWs/U3hBKsNDE/roz7VZYUzHb6eHCmamGveEvRVYi5Lz bkJtIDkvMlMG3XxiEyCAQVNfnbbTD3qvkitA30IahJCXx0YNML9RhfwuRF0+Om+sEJb6 AkZL5XXtl3pHdpNM7aBCUwz6DdOZgGfFa2Ww+QaitnFbPzpxJq52DU5CM/Q0vj4oP+J1 OsqruW3SfQ30yv0K6cQjGUroaqWrFgN3WtwRGOMQxFdnrehxj05xTsitzsi5MxO0rizt Yv+g== 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=1jkOpX92OsOWXRmqntk9iZdO1VTHi9iR3zOBhW8iOCM=; b=Z4PnXG8WWRh+tLUYGHYU3awLFUxNI2/VG1hWaHdToJGtVp46wfUqiPM8PVKtUlfzkr cBF+euguUm3XQ1C9gkAUzItid1Z5ukrVVVMaiQgAW7UYnNmXKqNumPptv9zB+y8VVoqd aIqPss5ipTNsy9wO1uh3ZikwZJHsL2FxxVPESAmNTG5Liu0Oc7kzyjPCY8QJnC/ynAii wkn/J88SRzK2yLa88jh0THdzHhl1VDwVFl70YHTsEvXfVOjb9V7JxkW/yHMveCi32feF 7FSbQlK+KJJ5RVXM33yJG7qDhSF66esVxqp85NZqNcHYDzKfvXQkiOkVBo/Xp5NGCGV1 HkCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vLHVYhkw; 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 ca21si5767257ejb.587.2020.12.28.07.46.51; Mon, 28 Dec 2020 07:46:51 -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=vLHVYhkw; 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 S2405582AbgL1Pmb (ORCPT + 14 others); Mon, 28 Dec 2020 10:42:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:48642 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405680AbgL1Nrc (ORCPT ); Mon, 28 Dec 2020 08:47:32 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3B186206D4; Mon, 28 Dec 2020 13:46:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609163210; bh=oZHEHga3a4A0j+x16WE6ttuTxmINWbB2O/a7ejfUP8o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vLHVYhkwyvZJ3zObKNg0BII7YrFp/MiVpBq/goqw8bpvv2lfs25EVw0dXK2cVj3Vd SCqkKfRn9o5otkq+WXUuGLy3t43zwo3KiczYMXK1X5UIU1Vxn1r+EVeTd3lqOK/zbC C4FA92+lxPOCLN4Kgccnk6JPFEZ7vTAmR8rr+Uss= 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.4 178/453] slimbus: qcom-ngd-ctrl: Avoid sending power requests without QMI Date: Mon, 28 Dec 2020 13:46:54 +0100 Message-Id: <20201228124945.765286201@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124937.240114599@linuxfoundation.org> References: <20201228124937.240114599@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 ce265bf7de868..b60541c3f72da 100644 --- a/drivers/slimbus/qcom-ngd-ctrl.c +++ b/drivers/slimbus/qcom-ngd-ctrl.c @@ -1201,6 +1201,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) { @@ -1497,6 +1500,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);