mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
net: wireless: rockchip_wlan: realtek wifi: avoid illegal argument when called by ioctl SIOCDEVPRIVATE read
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 CNVD-C-2020-259506 Signed-off-by: Weiguo Hu <hwg@rock-chips.com> Change-Id: I27e7a453a0156371fb96c764df99e8a77dce87fa
This commit is contained in:
@@ -571,9 +571,6 @@ phy_RFSerialWrite(
|
||||
BB_REGISTER_DEFINITION_T *pPhyReg = &pHalData->PHYRegDef[eRFPath];
|
||||
u32 NewOffset;
|
||||
|
||||
if (eRFPath >= MAX_RF_PATH)
|
||||
return;
|
||||
|
||||
#if 0
|
||||
/* <Roger_TODO> We should check valid regs for RF_6052 case. */
|
||||
if (pHalData->RFChipID == RF_8225 && Offset > 0x24) /* 36 valid regs */
|
||||
@@ -645,6 +642,9 @@ PHY_QueryRFReg8188E(
|
||||
/* u8 RFWaitCounter = 0; */
|
||||
/* _irqL irqL; */
|
||||
|
||||
if (eRFPath >= MAX_RF_PATH)
|
||||
return 0;
|
||||
|
||||
#if (DISABLE_BB_RF == 1)
|
||||
return 0;
|
||||
#endif
|
||||
@@ -707,6 +707,9 @@ PHY_SetRFReg8188E(
|
||||
u32 Original_Value, BitShift;
|
||||
/* _irqL irqL; */
|
||||
|
||||
if (eRFPath >= MAX_RF_PATH)
|
||||
return;
|
||||
|
||||
#if (DISABLE_BB_RF == 1)
|
||||
return;
|
||||
#endif
|
||||
|
||||
@@ -339,9 +339,6 @@ phy_RFSerialWrite_8188F(
|
||||
BB_REGISTER_DEFINITION_T *pPhyReg = &pHalData->PHYRegDef[eRFPath];
|
||||
u32 NewOffset;
|
||||
|
||||
if (eRFPath >= MAX_RF_PATH)
|
||||
return;
|
||||
|
||||
Offset &= 0xff;
|
||||
|
||||
/* */
|
||||
@@ -395,6 +392,9 @@ PHY_QueryRFReg_8188F(
|
||||
{
|
||||
u32 Original_Value, Readback_Value, BitShift;
|
||||
|
||||
if (eRFPath >= MAX_RF_PATH)
|
||||
return 0;
|
||||
|
||||
#if (DISABLE_BB_RF == 1)
|
||||
return 0;
|
||||
#endif
|
||||
@@ -436,6 +436,9 @@ PHY_SetRFReg_8188F(
|
||||
{
|
||||
u32 Original_Value, BitShift;
|
||||
|
||||
if (eRFPath >= MAX_RF_PATH)
|
||||
return;
|
||||
|
||||
#if (DISABLE_BB_RF == 1)
|
||||
return;
|
||||
#endif
|
||||
|
||||
@@ -582,8 +582,6 @@ phy_RFSerialWrite(
|
||||
BB_REGISTER_DEFINITION_T *pPhyReg = &pHalData->PHYRegDef[eRFPath];
|
||||
u32 NewOffset;
|
||||
|
||||
if (eRFPath >= MAX_RF_PATH)
|
||||
return;
|
||||
|
||||
#if 0
|
||||
//<Roger_TODO> We should check valid regs for RF_6052 case.
|
||||
@@ -656,6 +654,9 @@ PHY_QueryRFReg8188E(
|
||||
//u8 RFWaitCounter = 0;
|
||||
//_irqL irqL;
|
||||
|
||||
if (eRFPath >= MAX_RF_PATH)
|
||||
return 0;
|
||||
|
||||
#if (DISABLE_BB_RF == 1)
|
||||
return 0;
|
||||
#endif
|
||||
@@ -720,6 +721,10 @@ PHY_SetRFReg8188E(
|
||||
//u1Byte RFWaitCounter = 0;
|
||||
u32 Original_Value, BitShift;
|
||||
//_irqL irqL;
|
||||
|
||||
if (eRFPath > MAX_RF_PATH)
|
||||
return;
|
||||
|
||||
|
||||
#if (DISABLE_BB_RF == 1)
|
||||
return;
|
||||
|
||||
@@ -277,9 +277,6 @@ phy_RFSerialWrite_8188F(
|
||||
BB_REGISTER_DEFINITION_T *pPhyReg = &pHalData->PHYRegDef[eRFPath];
|
||||
u32 NewOffset;
|
||||
|
||||
if (eRFPath >= MAX_RF_PATH)
|
||||
return;
|
||||
|
||||
Offset &= 0xff;
|
||||
|
||||
/* */
|
||||
@@ -333,6 +330,9 @@ PHY_QueryRFReg_8188F(
|
||||
{
|
||||
u32 Original_Value, Readback_Value, BitShift;
|
||||
|
||||
if (eRFPath >= MAX_RF_PATH)
|
||||
return 0;
|
||||
|
||||
#if (DISABLE_BB_RF == 1)
|
||||
return 0;
|
||||
#endif
|
||||
@@ -374,6 +374,9 @@ PHY_SetRFReg_8188F(
|
||||
{
|
||||
u32 Original_Value, BitShift;
|
||||
|
||||
if (eRFPath >= MAX_RF_PATH)
|
||||
return;
|
||||
|
||||
#if (DISABLE_BB_RF == 1)
|
||||
return;
|
||||
#endif
|
||||
|
||||
@@ -333,9 +333,6 @@ phy_RFSerialWrite_8723B(
|
||||
BB_REGISTER_DEFINITION_T *pPhyReg = &pHalData->PHYRegDef[eRFPath];
|
||||
u32 NewOffset;
|
||||
|
||||
if (eRFPath >= MAX_RF_PATH)
|
||||
return;
|
||||
|
||||
Offset &= 0xff;
|
||||
|
||||
/* */
|
||||
@@ -389,6 +386,9 @@ PHY_QueryRFReg_8723B(
|
||||
{
|
||||
u32 Original_Value, Readback_Value, BitShift;
|
||||
|
||||
if (eRFPath >= MAX_RF_PATH)
|
||||
return 0;
|
||||
|
||||
#if (DISABLE_BB_RF == 1)
|
||||
return 0;
|
||||
#endif
|
||||
@@ -430,6 +430,9 @@ PHY_SetRFReg_8723B(
|
||||
{
|
||||
u32 Original_Value, BitShift;
|
||||
|
||||
if (eRFPath >= MAX_RF_PATH)
|
||||
return;
|
||||
|
||||
#if (DISABLE_BB_RF == 1)
|
||||
return;
|
||||
#endif
|
||||
|
||||
@@ -345,9 +345,6 @@ phy_RFSerialWrite_8723B(
|
||||
BB_REGISTER_DEFINITION_T *pPhyReg = &pHalData->PHYRegDef[eRFPath];
|
||||
u32 NewOffset;
|
||||
|
||||
if (eRFPath >= MAX_RF_PATH)
|
||||
return;
|
||||
|
||||
|
||||
Offset &= 0xff;
|
||||
|
||||
@@ -402,6 +399,10 @@ PHY_QueryRFReg_8723B(
|
||||
{
|
||||
u32 Original_Value, Readback_Value, BitShift;
|
||||
|
||||
|
||||
if (eRFPath >= MAX_RF_PATH)
|
||||
return 0;
|
||||
|
||||
#if (DISABLE_BB_RF == 1)
|
||||
return 0;
|
||||
#endif
|
||||
@@ -443,6 +444,10 @@ PHY_SetRFReg_8723B(
|
||||
{
|
||||
u32 Original_Value, BitShift;
|
||||
|
||||
|
||||
if (eRFPath >= MAX_RF_PATH)
|
||||
return;
|
||||
|
||||
#if (DISABLE_BB_RF == 1)
|
||||
return;
|
||||
#endif
|
||||
|
||||
@@ -277,9 +277,6 @@ phy_RFSerialWrite_8703B(
|
||||
BB_REGISTER_DEFINITION_T *pPhyReg = &pHalData->PHYRegDef[eRFPath];
|
||||
u32 NewOffset;
|
||||
|
||||
if (eRFPath >= MAX_RF_PATH)
|
||||
return;
|
||||
|
||||
Offset &= 0xff;
|
||||
|
||||
/* */
|
||||
@@ -333,6 +330,9 @@ PHY_QueryRFReg_8703B(
|
||||
{
|
||||
u32 Original_Value, Readback_Value, BitShift;
|
||||
|
||||
if (eRFPath >= MAX_RF_PATH)
|
||||
return 0;
|
||||
|
||||
#if (DISABLE_BB_RF == 1)
|
||||
return 0;
|
||||
#endif
|
||||
@@ -374,6 +374,9 @@ PHY_SetRFReg_8703B(
|
||||
{
|
||||
u32 Original_Value, BitShift;
|
||||
|
||||
if (eRFPath >= MAX_RF_PATH)
|
||||
return;
|
||||
|
||||
#if (DISABLE_BB_RF == 1)
|
||||
return;
|
||||
#endif
|
||||
|
||||
@@ -278,9 +278,6 @@ phy_RFSerialWrite_8723D(
|
||||
BB_REGISTER_DEFINITION_T *pPhyReg = &pHalData->PHYRegDef[eRFPath];
|
||||
u32 NewOffset;
|
||||
|
||||
if (eRFPath >= MAX_RF_PATH)
|
||||
return;
|
||||
|
||||
Offset &= 0xff;
|
||||
|
||||
/* */
|
||||
@@ -334,6 +331,9 @@ PHY_QueryRFReg_8723D(
|
||||
{
|
||||
u32 Original_Value, Readback_Value, BitShift;
|
||||
|
||||
if (eRFPath >= MAX_RF_PATH)
|
||||
return 0;
|
||||
|
||||
#if (DISABLE_BB_RF == 1)
|
||||
return 0;
|
||||
#endif
|
||||
@@ -375,6 +375,9 @@ PHY_SetRFReg_8723D(
|
||||
{
|
||||
u32 Original_Value, BitShift;
|
||||
|
||||
if (eRFPath >= MAX_RF_PATH)
|
||||
return;
|
||||
|
||||
#if (DISABLE_BB_RF == 1)
|
||||
return;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user