Subject: CVE-2024-49938: wifi: ath9k_htc: Use __skb_set_length() for resetting urb before resubmit

From: Greg Kroah-Hartman <[email-masked]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

wifi: ath9k_htc: Use __skb_set_length() for resetting urb before resubmit

Syzbot points out that skb_trim() has a sanity check on the existing length of
the skb, which can be uninitialised in some error paths. The intent here is
clearly just to reset the length to zero before resubmitting, so switch to
calling __skb_set_length(skb, 0) directly. In addition, __skb_set_length()
already contains a call to skb_reset_tail_pointer(), so remove the redundant
call.

The syzbot report came from ath9k_hif_usb_reg_in_cb(), but there's a similar
usage of skb_trim() in ath9k_hif_usb_rx_cb(), change both while we're at it.

The Linux kernel CVE team has assigned CVE-2024-49938 to this issue.

Affected and fixed versions
===========================

	Fixed in 5.10.227 with commit b02eb7c86ff2
	Fixed in 5.15.168 with commit 012ae530afa0
	Fixed in 6.1.113 with commit 6a8752206704
	Fixed in 6.6.55 with commit e37e34883503
	Fixed in 6.10.14 with commit 2c230210ec0a
	Fixed in 6.11.3 with commit a9f4e28e8ada
	Fixed in 6.12-rc1 with commit 94745807f3eb

Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to
older supported kernel versions.  The official CVE entry at
	https://cve.org/CVERecord/?id=CVE-2024-49938
will be updated if fixes are backported, please check that for the most
up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
	drivers/net/wireless/ath/ath9k/hif_usb.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes.  Individual
changes are never tested alone, but rather are part of a larger kernel
release.  Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all.  If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
	https://git.kernel.org/stable/c/b02eb7c86ff2ef1411c3095ec8a52b13f68db04f
	https://git.kernel.org/stable/c/012ae530afa0785102360de452745d33c99a321b
	https://git.kernel.org/stable/c/6a875220670475d9247e576c15dc29823100a4e4
	https://git.kernel.org/stable/c/e37e348835032d6940ec89308cc8996ded691d2d
	https://git.kernel.org/stable/c/2c230210ec0ae6ed08306ac70dc21c24b817bb95
	https://git.kernel.org/stable/c/a9f4e28e8adaf0715bd4e01462af0a52ee46b01f
	https://git.kernel.org/stable/c/94745807f3ebd379f23865e6dab196f220664179