TencentOS-kernel/drivers/staging
Atul Gopinathan f090832d64 staging: rtl8192e: Change state information from u16 to u8
commit e78836ae76d20f38eed8c8c67f21db97529949da upstream.

The "u16 CcxRmState[2];" array field in struct "rtllib_network" has 4
bytes in total while the operations performed on this array through-out
the code base are only 2 bytes.

The "CcxRmState" field is fed only 2 bytes of data using memcpy():

(In rtllib_rx.c:1972)
	memcpy(network->CcxRmState, &info_element->data[4], 2)

With "info_element->data[]" being a u8 array, if 2 bytes are written
into "CcxRmState" (whose one element is u16 size), then the 2 u8
elements from "data[]" gets squashed and written into the first element
("CcxRmState[0]") while the second element ("CcxRmState[1]") is never
fed with any data.

Same in file rtllib_rx.c:2522:
	 memcpy(dst->CcxRmState, src->CcxRmState, 2);

The above line duplicates "src" data to "dst" but only writes 2 bytes
(and not 4, which is the actual size). Again, only 1st element gets the
value while the 2nd element remains uninitialized.

This later makes operations done with CcxRmState unpredictable in the
following lines as the 1st element is having a squashed number while the
2nd element is having an uninitialized random number.

rtllib_rx.c:1973:    if (network->CcxRmState[0] != 0)
rtllib_rx.c:1977:    network->MBssidMask = network->CcxRmState[1] & 0x07;

network->MBssidMask is also of type u8 and not u16.

Fix this by changing the type of "CcxRmState" from u16 to u8 so that the
data written into this array and read from it make sense and are not
random values.

NOTE: The wrong initialization of "CcxRmState" can be seen in the
following commit:

commit ecdfa44610fa ("Staging: add Realtek 8192 PCI wireless driver")

The above commit created a file `rtl8192e/ieee80211.h` which used to
have the faulty line. The file has been deleted (or possibly renamed)
with the contents copied in to a new file `rtl8192e/rtllib.h` along with
additional code in the commit 94a799425eee (tagged in Fixes).

Fixes: 94a799425eee ("From: wlanfae <wlanfae@realtek.com> [PATCH 1/8] rtl8192e: Import new version of driver from realtek")
Cc: stable@vger.kernel.org
Signed-off-by: Atul Gopinathan <atulgopinathan@gmail.com>
Link: https://lore.kernel.org/r/20210323113413.29179-2-atulgopinathan@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-20 16:06:52 +08:00
..
android staging: android: ashmem: Fix lockdep warning for write operation 2021-03-16 16:33:02 +08:00
axis-fifo Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
board Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
clocking-wizard Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
comedi staging: comedi: cb_pcidas64: fix request_irq() warn 2021-05-20 16:06:47 +08:00
emxx_udc staging: emxx_udc: Fix passing of NULL to dma_alloc_coherent() 2021-03-16 16:38:34 +08:00
exfat exfat: Month timestamp metadata accidentally incremented 2021-04-12 12:51:17 +08:00
fbtft Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
fieldbus staging: fieldbus: anybuss: jump to correct label in an error path 2021-03-16 16:40:15 +08:00
fsl-dpaa2 Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
fwserial staging: fwserial: Fix error handling in fwserial_create 2021-04-12 12:52:46 +08:00
gasket staging: gasket: interrupt: fix the missed eventfd_ctx_put() in gasket_interrupt.c 2021-03-16 16:42:45 +08:00
gdm724x staging: gdm724x: Fix DMA from stack 2021-04-12 12:52:36 +08:00
goldfish Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
greybus staging: greybus: codecs: Fix reference counter leak in error handling 2021-03-16 16:42:45 +08:00
gs_fpgaboot Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
iio staging: iio: ad2s1210: Fix SPI reading 2021-03-16 16:28:18 +08:00
isdn Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
kpc2000 staging: kpc2000: fix error return code in kp2000_pcie_probe() 2021-03-16 16:28:18 +08:00
ks7010 staging: ks7010: prevent buffer overflow in ks_wlan_set_scan() 2021-04-12 12:53:09 +08:00
media media: imx: Fix csc/scaler unregister 2021-04-12 12:52:18 +08:00
most staging: most: sound: add sanity check for function argument 2021-04-12 12:52:46 +08:00
mt7621-dma staging/mt7621-dma: mtk-hsdma.c->hsdma-mt7621.c 2021-04-12 12:52:36 +08:00
mt7621-dts Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
mt7621-pci Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
mt7621-pci-phy Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
mt7621-pinctrl Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
netlogic Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
nvec Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
octeon staging/octeon: fix up merge error 2021-03-16 16:41:53 +08:00
octeon-usb Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
olpc_dcon Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
pi433 Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
qlge Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
ralink-gdma staging: ralink-gdma: fix kconfig dependency bug for DMA_RALINK 2021-03-16 16:41:38 +08:00
rtl8188eu staging: rtl8188eu: fix potential memory corruption in rtw_check_beacon_data() 2021-04-12 12:53:09 +08:00
rtl8192e staging: rtl8192e: Change state information from u16 to u8 2021-05-20 16:06:52 +08:00
rtl8192u staging: rtl8192u: fix ->ssid overflow in r8192_wx_set_scan() 2021-04-12 12:53:08 +08:00
rtl8712 staging: rtl8712: Fix possible buffer overflow in r8712_sitesurvey_cmd 2021-04-12 12:53:09 +08:00
rtl8723bs staging: rtl8723bs: wifi_regd.c: Fix incorrect number of regulatory rules 2021-04-12 12:52:14 +08:00
rts5208 Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
sm750fb staging: sm750fb: add missing case while setting FB_VISUAL 2021-03-16 16:30:13 +08:00
speakup speakup: fix uninitialized flush_lock 2021-03-16 16:43:08 +08:00
unisys Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
uwb Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
vc04_services staging: bcm2835-audio: Replace unsafe strcpy() with strscpy() 2021-04-12 12:52:47 +08:00
vme Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
vt6655 Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
vt6656 staging: vt6656: Power save stop wake_up_count wrap around. 2021-03-16 16:27:02 +08:00
wilc1000 net: wilc1000: clean up resource in error path of init mon interface 2021-03-16 16:38:40 +08:00
wlan-ng staging: wlan-ng: fix out of bounds read in prism2sta_probe_usb() 2021-03-16 16:36:03 +08:00
wusbcore Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
Kconfig Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
Makefile Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00