Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2294492lqt; Mon, 22 Apr 2024 07:07:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW8B+Q6/pBff9/Oq2dQxKUHwsxPBMFILOyHpJ2d6ai66b2rOAjrVWxd5ylGMavSpoRIdSLVq20UNlq+H8N2fiC3x0O2h4/oxf9RpA/7fg== X-Google-Smtp-Source: AGHT+IF5lm9IVHbbyU/E1Cz3jfUCL7L/NUqn2qqVetkmpK/kdarPLQNF6NLEXBiKAaulwvTCuDfZ X-Received: by 2002:a17:902:cec6:b0:1e4:145a:ee19 with SMTP id d6-20020a170902cec600b001e4145aee19mr13623738plg.50.1713794839254; Mon, 22 Apr 2024 07:07:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713794839; cv=pass; d=google.com; s=arc-20160816; b=xpKPVQ02kxs0MM8yUpekYAws+oaigK8wHQqfgoXIITRFtv3ikkaxnKH/Ni//CGUnM5 fOzDe94iNC98tMrkt2P6K8ZYLLCH2MsWwmMh6XK/ymYkiRyw888Yz1MSqIT3mIhi00+w EUetX6S+ynTSZ+o1b6MVch7+jGN2RD3Pnye5O5WtOcApDZwKUoG+ZH5Z1bxzH9ckjbSz HrMFmxkeCc28raAHdCRZZVu6UTs04cO5on7txDE20o6ueVFmJLEPbtVqFnui7AVATxSc zEBdD3bbB9fw6yTndJilI4DAHRYZB3k5ddwnidO80OIRTjlZQh5AiHu7eXfuG1zwFzAC 8R+w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=drl7t5TYcD8c9HjEOr80UsZ9ass+7ZZQvWRfw8/3KSk=; fh=5qsHs8qC/422sBG1udFV+tBqQPrcHbREGlxxrs+x4+o=; b=hM+81isfnhVVHB2m4ycZXV2mkyeeSfx+Ai+96uJ3VuAiRbm2flyyXhoJ6IG1BQynfz 7f8VMLfD1M9pQJ1Q/OClNwbg/9ye8CIAVtoEk6ybeQl5IiWy7E2t9qJBVgUG7FORiY8p 6cyPzHOHvIFZqcGQo/MFvb8dWATTqEhUKSIpyILaLzzsA+6mAqcuv34vN7pIhsjjz7+U 6RpqkMBeUOUUBi++EdB8B/6TQhMDagl23uaJd1ZccGQDOCiUCypa0DvU72uv07wozjfo 1Q+FsExh8aTlmxmlFTD1colvKLNeCtQKZwmn9hIdyjf//tKq6PLbiiBuBvJEa8svLMIz GSjg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=b7ssyDjF; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-bluetooth+bounces-3869-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-3869-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d23-20020a170902b71700b001e4398b9244si4376617pls.133.2024.04.22.07.07.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 07:07:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-3869-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=b7ssyDjF; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-bluetooth+bounces-3869-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-3869-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 757B7284EDC for ; Mon, 22 Apr 2024 13:59:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9FD5B1514DA; Mon, 22 Apr 2024 13:58:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="b7ssyDjF" X-Original-To: linux-bluetooth@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F3CE414F9EB; Mon, 22 Apr 2024 13:58:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713794327; cv=none; b=twbk7/4qxiUxNSLTM5Bkc516Nl10GjWGdbapYwX4tBXUYgIe5msFGJrbrh9Nv+0ygstG4g2mwJvyqJOenbs3sOyVLS2bJtpy2bLH06nkFMnUZG/hRXlTfj5jrcAKA4htZclyyZJ87JpIsWv+t8gIqW4oyjBRIXXSPreYlVAzwDs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713794327; c=relaxed/simple; bh=jiAYpkNG4v9YIdBtOvoPx060DTrkuniphhZyGAC5Sa4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EBHRhqzRPk4PnBzONspuDGAYyMBhGtQV6LWcksGp/jPXVzNPNb6BY2GFxdhuA4f+4GwPTsmfjIuijpBaqXyj/zS+Q9dpwtVa7Z/Y3bw6thvgHYg+OXU9jTApPNnh1XYeh+graoeQ1nvXUnX7wLn+PpRM3EAArtY+/TsNZ99iyQQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=b7ssyDjF; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8E93C32782; Mon, 22 Apr 2024 13:58:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713794326; bh=jiAYpkNG4v9YIdBtOvoPx060DTrkuniphhZyGAC5Sa4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b7ssyDjFNnuEEbZZv5Yua3MrMkFBm0BIBX0yMJwcvPZb8Mu29/jDTZY+XtD9kLEX+ stuID0AvLWgDIXAiaLP+miJtyjCSxvTxrmexWutYVA2sRST362kirux6pWoFrRjruI xfz0amXJx0yHk384BmEtyIDCbarUy8yqHxFVLzfywK7wxnjdGWJ9bXmTpSzjDrsje6 648kFFgdtmQ+D3E6myrUc2UfDDHvHP7w2abHViB3AR1bpzN27HzTlwzmCBOTs2l0pw nuliq4UUDA0BA+nMZmJW4mH8Hs5GMokhxP2jC7HlDzfwNqcyuQQfx2IqreJCIpOi79 u2OjptBtfzaUQ== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1ryuBu-0000000061l-1JDF; Mon, 22 Apr 2024 15:58:42 +0200 From: Johan Hovold To: Marcel Holtmann , Luiz Augusto von Dentz Cc: Zhengping Jiang , linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org Subject: [PATCH RESEND 1/2] Bluetooth: qca: fix NULL-deref on non-serdev suspend Date: Mon, 22 Apr 2024 15:57:47 +0200 Message-ID: <20240422135748.23081-2-johan+linaro@kernel.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240422135748.23081-1-johan+linaro@kernel.org> References: <20240422135748.23081-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Qualcomm ROME controllers can be registered from the Bluetooth line discipline and in this case the HCI UART serdev pointer is NULL. Add the missing sanity check to prevent a NULL-pointer dereference when wakeup() is called for a non-serdev controller during suspend. Just return true for now to restore the original behaviour and address the crash with pre-6.2 kernels, which do not have commit e9b3e5b8c657 ("Bluetooth: hci_qca: only assign wakeup with serial port support") that causes the crash to happen already at setup() time. Fixes: c1a74160eaf1 ("Bluetooth: hci_qca: Add device_may_wakeup support") Cc: stable@vger.kernel.org # 5.13 Signed-off-by: Johan Hovold --- drivers/bluetooth/hci_qca.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c index 92fa20f5ac7d..94c85f4fbf3b 100644 --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c @@ -1672,6 +1672,9 @@ static bool qca_wakeup(struct hci_dev *hdev) struct hci_uart *hu = hci_get_drvdata(hdev); bool wakeup; + if (!hu->serdev) + return true; + /* BT SoC attached through the serial bus is handled by the serdev driver. * So we need to use the device handle of the serdev driver to get the * status of device may wakeup. -- 2.43.2