Skip to content

Commit a1a5435

Browse files
Weiguo Hurkhuangtao
authored andcommitted
net: wireless: rockchip_wlan: realtek wifi: avoid illegal argument when called by ioctl SIOCDEVPRIVATE write
Illegal argument will cause following kernel panic. Call trace: phy_RFSerialRead_8723B PHY_QueryRFReg_8723B rtw_hal_read_rfreg rtw_wx_read_rf _rtw_ioctl_wext_private rtw_ioctl dev_ifsioc dev_ioctl References: CNVD-C-2020-259506 Signed-off-by: Weiguo Hu <hwg@rock-chips.com> Change-Id: I27e7a453a0156371fb96c764df99e8a77dce87fa
1 parent a4bdf43 commit a1a5435

8 files changed

Lines changed: 25 additions & 0 deletions

File tree

drivers/net/wireless/rockchip_wlan/rtl8188eu/hal/rtl8188e/rtl8188e_phycfg.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,9 @@ PHY_QueryRFReg8188E(
642642
/* u8 RFWaitCounter = 0; */
643643
/* _irqL irqL; */
644644

645+
if (eRFPath >= MAX_RF_PATH)
646+
return 0;
647+
645648
#if (DISABLE_BB_RF == 1)
646649
return 0;
647650
#endif

drivers/net/wireless/rockchip_wlan/rtl8188fu/hal/rtl8188f/rtl8188f_phycfg.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,9 @@ PHY_QueryRFReg_8188F(
392392
{
393393
u32 Original_Value, Readback_Value, BitShift;
394394

395+
if (eRFPath >= MAX_RF_PATH)
396+
return 0;
397+
395398
#if (DISABLE_BB_RF == 1)
396399
return 0;
397400
#endif

drivers/net/wireless/rockchip_wlan/rtl8189es/hal/rtl8188e/rtl8188e_phycfg.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,9 @@ PHY_QueryRFReg8188E(
653653
//u8 RFWaitCounter = 0;
654654
//_irqL irqL;
655655

656+
if (eRFPath >= MAX_RF_PATH)
657+
return 0;
658+
656659
#if (DISABLE_BB_RF == 1)
657660
return 0;
658661
#endif

drivers/net/wireless/rockchip_wlan/rtl8189fs/hal/rtl8188f/rtl8188f_phycfg.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,9 @@ PHY_QueryRFReg_8188F(
330330
{
331331
u32 Original_Value, Readback_Value, BitShift;
332332

333+
if (eRFPath >= MAX_RF_PATH)
334+
return 0;
335+
333336
#if (DISABLE_BB_RF == 1)
334337
return 0;
335338
#endif

drivers/net/wireless/rockchip_wlan/rtl8723bs/hal/rtl8723b/rtl8723b_phycfg.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,9 @@ PHY_QueryRFReg_8723B(
386386
{
387387
u32 Original_Value, Readback_Value, BitShift;
388388

389+
if (eRFPath >= MAX_RF_PATH)
390+
return 0;
391+
389392
#if (DISABLE_BB_RF == 1)
390393
return 0;
391394
#endif

drivers/net/wireless/rockchip_wlan/rtl8723bu/hal/rtl8723b/rtl8723b_phycfg.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,10 @@ PHY_QueryRFReg_8723B(
398398
{
399399
u32 Original_Value, Readback_Value, BitShift;
400400

401+
402+
if (eRFPath >= MAX_RF_PATH)
403+
return 0;
404+
401405
#if (DISABLE_BB_RF == 1)
402406
return 0;
403407
#endif

drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/rtl8703b/rtl8703b_phycfg.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,9 @@ PHY_QueryRFReg_8703B(
391391
{
392392
u32 Original_Value, Readback_Value, BitShift;
393393

394+
if (eRFPath >= MAX_RF_PATH)
395+
return 0;
396+
394397
#if (DISABLE_BB_RF == 1)
395398
return 0;
396399
#endif

drivers/net/wireless/rockchip_wlan/rtl8723ds/hal/rtl8723d/rtl8723d_phycfg.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,9 @@ PHY_QueryRFReg_8723D(
331331
{
332332
u32 Original_Value, Readback_Value, BitShift;
333333

334+
if (eRFPath >= MAX_RF_PATH)
335+
return 0;
336+
334337
#if (DISABLE_BB_RF == 1)
335338
return 0;
336339
#endif

0 commit comments

Comments
 (0)