Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp52280ybg; Mon, 8 Jun 2020 16:11:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+bA6BgOJWcGXwbb9BkljvNOVt+Ojrj07wG+RV16ZSi7ujicKjSxBe2o+LXgWkC8CS2yuL X-Received: by 2002:a05:6402:a49:: with SMTP id bt9mr24662965edb.300.1591657913148; Mon, 08 Jun 2020 16:11:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591657913; cv=none; d=google.com; s=arc-20160816; b=gDgTl1li7zganZIXVJT8Js83RIMk+0pyBoWqCSS3oJ+BJoEqBTmWxP/eBIL26hymze VLBc3phR0PjfQ+pBnXaGrE3PXSo0b5Y4xrPPdk4Yy82bXnq+v5/fJo+TopjpMUIquT7J 6BhOKQkkPdv7dRqb/svMWCmRIDge9xDCiXo3Pc6SEA6PYIMvNu2qKP3NduntgvaXtceN pwTDTZ/10HW/wqlLHMOwJEefyKzZylsyLloocYNJIAOJhhAIIw/9CU25lELYOe1QTslA xxMRQxAFqb5OL/5VRiRysWmaSn2j7YXFG9VZX7BQq+FFhgacqcOHXxEN1zb3yf7yraWr zR+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GsWQVccQfsK0SAnyzPWyL2nlskphdra41i1DeSPatDc=; b=f5wu6xpQ0/NKV7WssqFS/LmqfYld96zjHGkER9vUJftEjm0V3Fczr5CkCN5MXHEyfh AujDFiAtkyCl+67hIctiLyKZWxbLvKfBDCTVeAHICB/tQv4R1jH6JGC1sADTdI7ik29f QVKiSttt/mCO8LllMpv+PZIeDuQkh+DBaUkp9H8zn0HGVB1gP+r6OlLOnR6ONsd183AI Qr+SdLgmll8xnOebCNOgo4ssv3ChUAvBofITr4+0VN4J0WdWcDry8GatTcRlO5024TrY PQaEG5cW/cY+E9AuDAPfCToei2X3WX+v0r7Unh+N1Acx8PnU4+Ny2Bs2r0pGM8J+FAd1 wrPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hz6sPk0S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h3si8973042edz.291.2020.06.08.16.11.30; Mon, 08 Jun 2020 16:11:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@kernel.org header.s=default header.b=hz6sPk0S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728259AbgFHXIt (ORCPT + 99 others); Mon, 8 Jun 2020 19:08:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:52522 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728018AbgFHXHu (ORCPT ); Mon, 8 Jun 2020 19:07:50 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F2B5020888; Mon, 8 Jun 2020 23:07:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591657669; bh=i46RftpKozMzFrPCBibhwcY0IyjVuViuW1HQ66oKYgU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hz6sPk0StMHKEAqNeGhUiGMl9VyhZZ83r09Y6r8QQIUOazlmgFPp4Yqz2wLks1WZg Kvp2GOy2wjWCrr32VbKJOSaVoSdcxC9GStl/dhTKCdhNCnu/hIrlxFdtcqXKnAvFdk zlTmHhlzPwFSjTqukUhn8pwatu8Q2iAexUN1bXuA= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Zijun Hu , Matthias Kaehlcke , Marcel Holtmann , Sasha Levin , linux-bluetooth@vger.kernel.org Subject: [PATCH AUTOSEL 5.7 079/274] Bluetooth: hci_qca: Fix suspend/resume functionality failure Date: Mon, 8 Jun 2020 19:02:52 -0400 Message-Id: <20200608230607.3361041-79-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608230607.3361041-1-sashal@kernel.org> References: <20200608230607.3361041-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zijun Hu [ Upstream commit feac90d756c03b03b83fabe83571bd88ecc96b78 ] @dev parameter of qca_suspend()/qca_resume() represents serdev_device, but it is mistook for hci_dev and causes succedent unexpected memory access. Fix by taking @dev as serdev_device. Fixes: 41d5b25fed0 ("Bluetooth: hci_qca: add PM support") Signed-off-by: Zijun Hu Reviewed-by: Matthias Kaehlcke Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin --- drivers/bluetooth/hci_qca.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c index 439392b1c043..0b1036e5e963 100644 --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c @@ -1953,8 +1953,9 @@ static void qca_serdev_remove(struct serdev_device *serdev) static int __maybe_unused qca_suspend(struct device *dev) { - struct hci_dev *hdev = container_of(dev, struct hci_dev, dev); - struct hci_uart *hu = hci_get_drvdata(hdev); + struct serdev_device *serdev = to_serdev_device(dev); + struct qca_serdev *qcadev = serdev_device_get_drvdata(serdev); + struct hci_uart *hu = &qcadev->serdev_hu; struct qca_data *qca = hu->priv; unsigned long flags; int ret = 0; @@ -2033,8 +2034,9 @@ static int __maybe_unused qca_suspend(struct device *dev) static int __maybe_unused qca_resume(struct device *dev) { - struct hci_dev *hdev = container_of(dev, struct hci_dev, dev); - struct hci_uart *hu = hci_get_drvdata(hdev); + struct serdev_device *serdev = to_serdev_device(dev); + struct qca_serdev *qcadev = serdev_device_get_drvdata(serdev); + struct hci_uart *hu = &qcadev->serdev_hu; struct qca_data *qca = hu->priv; clear_bit(QCA_SUSPENDING, &qca->flags); -- 2.25.1