Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp437468lqm; Wed, 1 May 2024 05:35:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXSOuAbvOXGyplj6a8Dn+a7zUwm5NDfsjRG5dj5MWDGaK8caO3r9NhivXQmnwgsZjN2cAaaVTb/BmcQ0Soooxk2TclN3GZqqskoFzaZJA== X-Google-Smtp-Source: AGHT+IHRLnZYLVMWb/iJ4VWRRxqYJ7lsWN31+cAfDNsRq8EKdAaSlACM9etN7Z6wdrfur7ZFweQj X-Received: by 2002:a05:622a:115:b0:439:b41a:56c1 with SMTP id u21-20020a05622a011500b00439b41a56c1mr2484564qtw.34.1714566941003; Wed, 01 May 2024 05:35:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714566940; cv=pass; d=google.com; s=arc-20160816; b=oIDWLhZL0LRfAhImrCGQIJwnkRwx5Jc1u8acmTx5TiDat8ODAjdsMaks+TPZlsIeoj 46EzdNtD7Ugl38IT9uUARE+DGIDQQi2u8HLscPh6u3+NDSPKiISnXnJ+mxo5i+knld5Y edQ32tAIuuvJ6SOWU8rnJPq7fe5i43Hpa4qiXnx9RfQAsb3muUWvRmwWdXqavUVVv3If BkhNpJENDUWO9pTS8tDByDvGromfTLCOJ8Tgrf7bhFbtRg/nNowVK/annC0ZkvXvEFQo cISdLHcvNJGb1rAkGoWbtlmigt/TpC/XV2leZ4whXDUvG4ZJfGqBXMxSF+ZuL9crZ+fl Ek1A== 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=Sf76nwPfRdMcsIdcG6n/3hzWw8F3pHeR+d2pmFoZ4M8=; fh=M6Jm3fXW2du/VkilB0syeVATCOg/1MuX3r8ZIOZh3XI=; b=0koCuZ9hsIlIeDEYiGDNzp6Iglnxs5y1WQ/1MCIaGSbtgyRu40lbaYvpagNoLhFUM/ h2ypuCVZSFppYF8hiZoWBt6w5IvzJn2NwtdAK43UxW6KTyTXDEFVuWEvKpOoChdAWeH8 bvyw74qbrlHAjWawow4t56KKy7R18h/kZ16NDR5lBiw20ivPrUT3GGPBjLGzqSRBTFqS UfH9KidgR7vGGzy1QX59adGjyIif7gDXpp+V3NYIfK4pVfLfTQDix8k/hRdPjcd6phnJ SkL8+KT0Gc2vO209jc28Ge5M2JMXq9myZ652tqQxWj1gps4xre5tHEQ46dtAxK7DIQma qc3Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qTMc7JsX; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-bluetooth+bounces-4226-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-4226-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id er5-20020a05622a5e8500b0043678e92c3csi27666176qtb.536.2024.05.01.05.35.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 05:35:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-4226-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qTMc7JsX; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-bluetooth+bounces-4226-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-4226-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id B865B1C2125D for ; Wed, 1 May 2024 12:35:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 480F286634; Wed, 1 May 2024 12:35:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qTMc7JsX" 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 960361DFFB; Wed, 1 May 2024 12:35:14 +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=1714566914; cv=none; b=KJkM/CD0gKlS9CCC7KBBY6zABTK9dT8yewXHtCusO65naXM5sbfO00g+a5F/c0Nt25oOTFuvnrduo6A6h7RjVK3L8ihHRXdqDUFgj4O3ThGI5+c2CTZusk3KvJRxOy2Xn9YUM3cE0IbLCO4qZDvwE7wsaDB84PtAyr8cgZw2tco= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714566914; c=relaxed/simple; bh=+/0WsjYl9G9pdjlSPEHqHyblMh1LaeTcks5oxwjbiKk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=l022Pg06HiYCw2YTtfqaRl6UlbobVWpCPBjPbC3rnqQT7yh543Rx9PTRIJmOq/FSbH3sDq/egG3KyCMTkfquGPpERLy+9A13n3mlaKQVMMUpAyEfxEnPk3D2PGjRkTpjcGVEBKvIKIjAhdVaQ5hsz6hI5IA9VEm3C950rzh6UhI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qTMc7JsX; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2EFE2C4AF19; Wed, 1 May 2024 12:35:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714566914; bh=+/0WsjYl9G9pdjlSPEHqHyblMh1LaeTcks5oxwjbiKk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qTMc7JsXqc9iPsLa1w/O/X6JTsRjo3rYNdwrR59cQcgcEgNQM9Qujul5XXLjvZmgl GSJ7EGYwwj/L43ZXaXRmmv+L+BiUaCvZNvI8cjhv5iDWfPjnDUH+PNuCpmvtWlMj8y n7POqGaVo2pVNhqq79PstQIJppeG9vBk9oYitiYTwFsemN3/xgVC9ddytCIhgVmhcq GI8GB/XBWT1n+3B1VQhRmhCyBROKXQrh7LoqDeGwM0dG0awsl8B9ukmmctEHSDIicz 0tQet3T9ga/PssvPV+EPrJfE7beYVxrWlLhYD9tlzqliHz+JJVx0prxTOCcBrBuqAx HQExJ3PfxT6uA== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1s29B6-000000001l0-3yAb; Wed, 01 May 2024 14:35:16 +0200 From: Johan Hovold To: Marcel Holtmann , Luiz Augusto von Dentz Cc: Janaki Ramaiah Thota , linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org, Tim Jiang Subject: [PATCH 2/5] Bluetooth: qca: fix info leak when fetching board id Date: Wed, 1 May 2024 14:34:53 +0200 Message-ID: <20240501123456.6712-3-johan+linaro@kernel.org> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240501123456.6712-1-johan+linaro@kernel.org> References: <20240501123456.6712-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 Add the missing sanity check when fetching the board id to avoid leaking slab data when later requesting the firmware. Fixes: a7f8dedb4be2 ("Bluetooth: qca: add support for QCA2066") Cc: stable@vger.kernel.org # 6.7 Cc: Tim Jiang Signed-off-by: Johan Hovold --- drivers/bluetooth/btqca.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c index a508d79d9aaa..638074992c82 100644 --- a/drivers/bluetooth/btqca.c +++ b/drivers/bluetooth/btqca.c @@ -252,6 +252,11 @@ static int qca_read_fw_board_id(struct hci_dev *hdev, u16 *bid) goto out; } + if (skb->len < 3) { + err = -EILSEQ; + goto out; + } + *bid = (edl->data[1] << 8) + edl->data[2]; bt_dev_dbg(hdev, "%s: bid = %x", __func__, *bid); -- 2.43.2