From mboxrd@z Thu Jan 1 00:00:00 1970 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 EA01118C91B; Tue, 10 Sep 2024 10:35:22 +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=1725964523; cv=none; b=cbTbT114W9vlYav4JV6G+C+Z+qPLEpq8bO3mp7sN9cKBDYUAXcIumNSG7XCYxVKHNWahNSieqI2aE3HDirUSH6I/ttXeIvnEP8eBGr0XaKLZTnQuZzejlLnkNhtDsr0aMrN1fEpdX5E94+e1cerJK4tWbSksZ7trVteKNzLegyc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725964523; c=relaxed/simple; bh=JkNCxfBmqFei7oUET/PsgF0I5NSca6Z9cTlqjgwDCw4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bU6bH4F4o+P2AWf9GZYp3epQuOumLqJgAcmQcRnSZxWOKifgNiCJU6zk+zaJw9PcbQfyOcDJw+KHtpSEmNkmpla8Kdlqu9F5lzgzPS4juNFbCy6E+7UCn7ogiD0D70TXRKUaprGscTSfL5MHiTgv1UrfSudiZ4bs/yXf0VrcvyA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=kJj9S/nG; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="kJj9S/nG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72BFAC4CEC3; Tue, 10 Sep 2024 10:35:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1725964522; bh=JkNCxfBmqFei7oUET/PsgF0I5NSca6Z9cTlqjgwDCw4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kJj9S/nGDEfZQvcTnSzy/Rq3qPfnySQCjPz8SFEKeD5n8ei7vGfvPoIWzLs8hsRvF fR7HvfLahJZOxh7gEzA6CVRhNjdM5nQpzRO4MJGQROWHsXwF0puiI8Wgzb0uyI4oP2 RJCFmEYv4214H+xaybU8JaGGdpgvcQrmrdsK6pmg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot+24c0361074799d02c452@syzkaller.appspotmail.com, Camila Alvarez , Silvan Jegen , Jiri Kosina , Sasha Levin Subject: [PATCH 6.6 184/269] HID: cougar: fix slab-out-of-bounds Read in cougar_report_fixup Date: Tue, 10 Sep 2024 11:32:51 +0200 Message-ID: <20240910092614.691352232@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240910092608.225137854@linuxfoundation.org> References: <20240910092608.225137854@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Camila Alvarez [ Upstream commit a6e9c391d45b5865b61e569146304cff72821a5d ] report_fixup for the Cougar 500k Gaming Keyboard was not verifying that the report descriptor size was correct before accessing it Reported-by: syzbot+24c0361074799d02c452@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=24c0361074799d02c452 Signed-off-by: Camila Alvarez Reviewed-by: Silvan Jegen Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- drivers/hid/hid-cougar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hid/hid-cougar.c b/drivers/hid/hid-cougar.c index cb8bd8aae15b..0fa785f52707 100644 --- a/drivers/hid/hid-cougar.c +++ b/drivers/hid/hid-cougar.c @@ -106,7 +106,7 @@ static void cougar_fix_g6_mapping(void) static __u8 *cougar_report_fixup(struct hid_device *hdev, __u8 *rdesc, unsigned int *rsize) { - if (rdesc[2] == 0x09 && rdesc[3] == 0x02 && + if (*rsize >= 117 && rdesc[2] == 0x09 && rdesc[3] == 0x02 && (rdesc[115] | rdesc[116] << 8) >= HID_MAX_USAGES) { hid_info(hdev, "usage count exceeds max: fixing up report descriptor\n"); -- 2.43.0