Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp961570lqt; Tue, 19 Mar 2024 08:48:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWTaorzR0rMYG8/zCoF5vSknSpbu3fMKXMEVFgbIaCuSwZN9rffhcQvMogWeibWqUZH2LBDCOrdWFy7UDgohGwaI4/CTmqnGAJdXU/iJA== X-Google-Smtp-Source: AGHT+IFDxLB4VucjAUNxkUjbOw8c0u45W35V4EI4+jt5LxuJz+WxAon1Q1mAqNK4Ua1XEEVzpW0R X-Received: by 2002:a05:6358:4041:b0:17b:f03e:2bfa with SMTP id a1-20020a056358404100b0017bf03e2bfamr19971308rwa.21.1710863328640; Tue, 19 Mar 2024 08:48:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710863328; cv=pass; d=google.com; s=arc-20160816; b=Yd75481lEVp1XYmnCNUIG+JswRo8LBp7PML2eTpVQbq3QauJPMnaoKQChJKNZ3BB/A D/7huIebp1/NFV57tFYqrZGTetkIpV09K0YN+kWgHGe1b8R1vdbvjTjbO+RLGDQT214u /aoSD9yRUp2Is6Uz06qRlgFEhq8oxi2Dm6DjaNtMG1Qa7mOJ7HU/7fUNW3ZeBQt9zXMq 3vF1YyQDHXUo3OXsxFD9kpXdNUovxa40RU0m8VU3isbAe3S32U68B/Er2o5AMuufzoBH QQM3U19rnDP14ArjurCdiJfiU/KAy0OcYtrgVZeokHMY1wnLHrBEg6e0vZhbWAfLCmI/ VIag== 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=MyTdG02Bogp7dgXzZyIorm0x+KQEAZGGvKJ6TPf9sE4=; fh=5qsHs8qC/422sBG1udFV+tBqQPrcHbREGlxxrs+x4+o=; b=otppcjQxQ3pbZNw3EuIxOuBmKb9WgCc7Nj8fcCmFeFYOb7wL77mISGjeDVgYGAcm1F k8/BO4e/Y8WvRbitNmDSxbc0hP/tgOm0MAx/zmx7uk8Wz3TSbFaf/roZd0HjJXSc6lHl B7hoUG4iERE1Y9loNmrmmvQQw8FjRv1PA2VWZD3tctBtrmeHxo97EvVeh50EC+jz8e+9 IbWQ8Hpb6f9LWVXRphsN+MxzfiZlpWQhfe4sXkrA1vgg1vuoMMlW02LqUK6N5beeBfCC Hx4AW8pghMNiPfh9GY8zB3PxR9a4gHnDlFyp+Vof2mpkfvgtwKKP5SR5ph8HK4IICX2t nJpQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AYoEadP+; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-bluetooth+bounces-2621-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-2621-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id s21-20020a656915000000b005e83b8037a0si6728217pgq.813.2024.03.19.08.48.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 08:48:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-2621-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AYoEadP+; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-bluetooth+bounces-2621-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-2621-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 5D4CEB231B7 for ; Tue, 19 Mar 2024 15:46:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 363FB81AA5; Tue, 19 Mar 2024 15:46:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AYoEadP+" 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 8AD892E400; Tue, 19 Mar 2024 15:46:13 +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=1710863173; cv=none; b=AjcWNPjBxK+bsVpUTtPqtnx9I/6KAzfeXUfnA3Wup47L7GL2yuhWmL5DhvwU34EqECiPLbHFa4GO7Y0yJrXS+LcWSocItqBkRqLCWEvm5XrTS4b9kn8jMCbceDSiMH+/SFwKzm5iXYzB+doySCrkYsWaq5hfhdI79O+Qfsey624= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710863173; c=relaxed/simple; bh=pd6u63f7QKmzAlsvJyOlOlrn80eFLOYslxGeKqxNvYw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=naNoGSkTYbOuWZmH2V+u4XYfv9sPRYuvicyOuAatoGKNF9ZjS8y9WtA0UHvKYPjT8q5LklHV/rJxpet0HDYg+28UVfS0BPOIF/ks10GpfUwzWlYnn5hWbYw4O+zyl11ar62KgAzBKdm97pM8zgidF25VRIC27ycDNtei2qqiBKM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AYoEadP+; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3FBB1C43394; Tue, 19 Mar 2024 15:46:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710863173; bh=pd6u63f7QKmzAlsvJyOlOlrn80eFLOYslxGeKqxNvYw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AYoEadP+Vi9xy8UPK80v19Sx5CBhULXg7DUaeWSBD1YcjvT9Gc7s8lE05390dPPRM VId9psPr15oh2Q9E+DHnmLlM5eEmcKrPJc9FX3RGu/RRzedznIy6/9K47EbQ9Mbjys VaeTzpjwN9/ULvyB4Ks+F6XxabSw3iA/6WXwzrumo31df1AZszM7ATOTb7HEv3xWnc ZzfrwjOAzZJeGog6wAfdIL9oMw7m1Je1IHhBkn663t2W04sVeF/CoQ8f+Z9qKpLDx9 XTPq9DbIRWy1eWFT+gAIpffbkkah+Uu9/Nag5OaLzIB1RJaXC+wvjpQWHEBu68RLxq xOQRRRalxZR0g== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1rmbfQ-000000000eV-1bvU; Tue, 19 Mar 2024 16:46:20 +0100 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 1/2] Bluetooth: qca: fix NULL-deref on non-serdev suspend Date: Tue, 19 Mar 2024 16:46:10 +0100 Message-ID: <20240319154611.2492-2-johan+linaro@kernel.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240319154611.2492-1-johan+linaro@kernel.org> References: <20240319154611.2492-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 c73481c57741..84f728943962 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