Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp960339lqt; Tue, 19 Mar 2024 08:46:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUyyijO0ZRLa+VyiRXqahtBDXBKjHuTi9+LQ2I7/a/20FeY7HpLYdso+ERkAYw51HqzZQZh0Xn2Xqqocoeh8/zimzZg4pCHgM6RSyor7A== X-Google-Smtp-Source: AGHT+IHojJ0FsAaNZuRxMPQB2leZibezvwDddkBdSlRG0SZw+YyvmaexJM22d+5ogRt7feQb9Jci X-Received: by 2002:a92:da81:0:b0:366:c0b4:5605 with SMTP id u1-20020a92da81000000b00366c0b45605mr2967862iln.11.1710863201849; Tue, 19 Mar 2024 08:46:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710863201; cv=pass; d=google.com; s=arc-20160816; b=WqM4wP3Pr55uSq0zL1jXsHOmOEUp6j6X52Wr2//YIRyX5Dg7T1jJNRQZx5uMUf60Pt ZbVSAjEWgErci/TyJDxz49x7ktkDqFrlY4QoIhFEY/pSK/Bk7N/Xx2L4/KCZhleuxwnp FH89dklvmAbZNYuNWV2GBLej4Wjt/+8QOkelqYSxQs2sHwL0+1JoRfqogEDjneu5YOpr QWe1DB8mLC11nW6bSvno8sIkdldCLUxSSppp7kKyI8jjt6fJ+QnPSCJ8M32iIrJbX+9W d6GwllpwsDZGxE3pjegrVXa0g4zHcqsRUdjI2SKmoKNxYh80drPE7fAWV6l/3T72N7/M k9bg== 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=9bdzPzfNtXlNXgacV1UiH7iXLqRDK05i+wTZr4NIDkQ=; fh=5qsHs8qC/422sBG1udFV+tBqQPrcHbREGlxxrs+x4+o=; b=EHB7J86fxSDVg1B2DvwLoLcuIg28PUsUpaM+zVSv0Pz/GNp3ZfPaqQNSZ8xBzxnAi1 PWiDbEbI4akKRuFTvOTCEz4iywhWJ5dWUP3g2xvjDBSTyQ2nIWfRR+uQwwQY9Jemr3AG jzd72qS8Z2mIZdfK/uDbloJMdV/BexQPIPblhJ60HkCMB5MmBZr9Ha2St25DytvDPYOO /J9w2bJ1W7Q9rTdeJO0MoXHyMfTLUSJjHF/vgWy1b8HUgvXYTSfQaud9yyohdO5xmOZj udXAbz2iMW2x/6fdFHLD8wRAMztgQ84Z+/qYKkpp7DTEdF7M0Oag8h4k4hTLHZiqJj5R UdNQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FDwpXITz; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-107736-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107736-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. [139.178.88.99]) by mx.google.com with ESMTPS id q38-20020a635c26000000b005d81875c4cfsi10339607pgb.882.2024.03.19.08.46.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 08:46:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-107736-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FDwpXITz; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-107736-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107736-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 5581A28397F for ; Tue, 19 Mar 2024 15:46:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6F06281AC1; 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="FDwpXITz" 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 8AE30657AD; 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=tUjI39Tai9YQfqEGc10dXP46UgPZ5FXwIJC+yhH526251fZryXNUQj7vPDdq6/Za24J3OqatX+wy09zD0W6cqTvjmMK3v7VnbTGpGckQZ2x+uf+tyllnkElomaa73ZUHPtOSmaDJBhs6kmU0uLNYDn2iez3yiQFpSHvpRhoJNyg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710863173; c=relaxed/simple; bh=71GoqhGH8N8bnYtZsq9ijp622SfqGqj12oKJWg3VC74=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TcTP2qPNdllX5k3Yzn+ucmuUE9Itmx067gASSvujHiFv45pFJLH+A9AohIa5+QU/Xi58kwriJnMk0XZm2Tjp134OuThuW65qt7syANTbtUYoMJNjcxBIcJGBJSN1lgvpyYMT4tQxfaS644YbXHgLhrHVq5AjUxn4b+7fqLNy96E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FDwpXITz; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B12BC433F1; 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=71GoqhGH8N8bnYtZsq9ijp622SfqGqj12oKJWg3VC74=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FDwpXITzgKpJYpScRM4cJlp8JdccJ61kLQnExKuxUbGRi3xpVwvEiFUhKz5MoQBBY IOvfBRWJ2ZAGTm2uk5U4G9wFRkMyCudQTWi5Dwbg+0fw7IGEb/eMQOiFzOQ3sJ8gWl MD735TzjhiMaTEFXt/25AYj/8RB3r4Kx1wCCTdjhXCzsmRJanXWYiMZe/Y4la76Nk4 XhkOiGTG0xq17xMARVI3+SM3SU2Q9Gix/LEOXKbom4XLhR7Yq5cmzMPYnhd4HDonMf 4kINiBELTVNk4g6BJHCT3j9zuklxE6E423+9xUZSizgVImeDqrp6XUkLrIxlda370p LiMRwkt1VLsBQ== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1rmbfQ-000000000eX-1tKc; 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 2/2] Bluetooth: qca: fix NULL-deref on non-serdev setup Date: Tue, 19 Mar 2024 16:46:11 +0100 Message-ID: <20240319154611.2492-3-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-kernel@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 setup() is called for a non-serdev controller. Fixes: e9b3e5b8c657 ("Bluetooth: hci_qca: only assign wakeup with serial port support") Cc: stable@vger.kernel.org # 6.2 Cc: Zhengping Jiang Signed-off-by: Johan Hovold --- drivers/bluetooth/hci_qca.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c index 84f728943962..6a69a7f9ef64 100644 --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c @@ -1960,8 +1960,10 @@ static int qca_setup(struct hci_uart *hu) qca_debugfs_init(hdev); hu->hdev->hw_error = qca_hw_error; hu->hdev->cmd_timeout = qca_cmd_timeout; - if (device_can_wakeup(hu->serdev->ctrl->dev.parent)) - hu->hdev->wakeup = qca_wakeup; + if (hu->serdev) { + if (device_can_wakeup(hu->serdev->ctrl->dev.parent)) + hu->hdev->wakeup = qca_wakeup; + } } else if (ret == -ENOENT) { /* No patch/nvm-config found, run with original fw/config */ set_bit(QCA_ROM_FW, &qca->flags); -- 2.43.2