5.10.110-rc1 review
Subsystems (9)
Greg Kroah-Hartman
maintainerPATCH 306/599 drm/msm/dpu: add DSPP blocks teardown
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit d5c5e78f217172e87d8fb2c3418dd8b58b4adfcb ]
Add missing calls to dpu_hw_dspp_destroy() to free resources allocated for DSPP hardware blocks.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +8 -0
@@ -34,6 +34,14 @@ int dpu_rm_destroy(struct dpu_rm *rm) {int i; +for (i =0 ; i <ARRAY_SIZE (rm->dspp_blks); i++) { +struct dpu_hw_dspp *hw; + +if (rm->dspp_blks[i]) { + hw =to_dpu_hw_dspp (rm->dspp_blks[i]); +dpu_hw_dspp_destroy (hw); + } + }for (i =0 ; i <ARRAY_SIZE (rm->pingpong_blks); i++) {struct dpu_hw_pingpong *hw;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 307/599 drm/msm/dpu: fix dp audio condition
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit 1e0505a5a7a2fea243f8e6d7e13fcde65f9e41bc ]
DP audio enablement code which is comparing intf_type, DRM_MODE_ENCODER_TMDS (= 2) with DRM_MODE_CONNECTOR_DisplayPort (= 10). Which would never succeed. Fix it to check for DRM_MODE_ENCODER_TMDS.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +1 -1
@@ -1113,7 +1113,7 @@ static void _dpu_encoder_virt_enable_helper(struct drm_encoder *drm_enc) } -if (dpu_enc->disp_info.intf_type == DRM_MODE_CONNECTOR_DisplayPort && +if (dpu_enc->disp_info.intf_type ==DRM_MODE_ENCODER_TMDS && dpu_enc->cur_master->hw_mdptop && dpu_enc->cur_master->hw_mdptop->ops.intf_audio_select) dpu_enc->cur_master->hw_mdptop->ops.intf_audio_select(
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 308/599 dm crypt: fix get_key_size compiler warning if !CONFIG_KEYS
In reply to Greg Kroah-HartmanFrom: Aashish Sharma <[email protected]>
[ Upstream commit 6fc51504388c1a1a53db8faafe9fff78fccc7c87 ]
Explicitly convert unsigned int in the right of the conditional expression to int to match the left side operand and the return type, fixing the following compiler warning:
drivers/md/dm-crypt.c:2593:43: warning: signed and unsigned type in conditional expression [-Wsign-compare]
--- drivers/md/dm-crypt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-crypt.c +1 -1
@@ -2561,7 +2561,7 @@ static int crypt_set_keyring_key(struct crypt_config *cc, const char *key_stringstatic int get_key_size (char **key_string) { -return (*key_string[0 ] ==':' ) ? -EINVAL :strlen (*key_string) >>1 ; +return (*key_string[0 ] ==':' ) ? -EINVAL : (int )(strlen (*key_string) >>1 ); }#endif /* CONFIG_KEYS */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 309/599 scsi: pm8001: Fix command initialization in pm80XX_send_read_log()
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
[ Upstream commit 1a37b6738b58d86f6b144b3fc754ace0f2e0166d ]
Since the sata_cmd struct is zeroed out before its fields are initialized, there is no need for using "|=" to initialize the ncqtag_atap_dir_m field. Using a standard assignment removes the sparse warning:
warning: invalid assignment: |=
Also, since the ncqtag_atap_dir_m field has type __le32, use cpu_to_le32() to generate the assigned value.
--- drivers/scsi/pm8001/pm8001_hwi.c | 2 +- drivers/scsi/pm8001/pm80xx_hwi.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/pm8001/pm8001_hwi.c +1 -1
@@ -1804,7 +1804,7 @@ static void pm8001_send_read_log(struct pm8001_hba_info *pm8001_ha, sata_cmd.tag =cpu_to_le32 (ccb_tag); sata_cmd.device_id =cpu_to_le32 (pm8001_ha_dev->device_id); - sata_cmd.ncqtag_atap_dir_m |= ((0x1 <<7 ) | (0x5 <<9 )); + sata_cmd.ncqtag_atap_dir_m =cpu_to_le32 ((0x1 <<7 ) | (0x5 <<9 ));memcpy (&sata_cmd.sata_fis, &fis,sizeof (struct host_to_dev_fis )); res = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &sata_cmd,
drivers/scsi/pm8001/pm80xx_hwi.c +1 -1
@@ -1830,7 +1830,7 @@ static void pm80xx_send_read_log(struct pm8001_hba_info *pm8001_ha, sata_cmd.tag =cpu_to_le32 (ccb_tag); sata_cmd.device_id =cpu_to_le32 (pm8001_ha_dev->device_id); - sata_cmd.ncqtag_atap_dir_m_dad |= ((0x1 <<7 ) | (0x5 <<9 )); + sata_cmd.ncqtag_atap_dir_m_dad =cpu_to_le32 (((0x1 <<7 ) | (0x5 <<9 )));memcpy (&sata_cmd.sata_fis, &fis,sizeof (struct host_to_dev_fis )); res = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &sata_cmd,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 310/599 scsi: pm8001: Fix command initialization in pm8001_chip_ssp_tm_req()
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
[ Upstream commit cd2268a180117aa8ebb23e090ba204324b2d0e93 ]
The ds_ads_m field of struct ssp_ini_tm_start_req has the type __le32. Assigning a value to it should thus use cpu_to_le32(). This fixes the sparse warning:
warning: incorrect type in assignment (different base types)
expected restricted __le32 [addressable] [assigned] [usertype] ds_ads_m got int
--- drivers/scsi/pm8001/pm8001_hwi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/pm8001/pm8001_hwi.c +1 -1
@@ -4575,7 +4575,7 @@ int pm8001_chip_ssp_tm_req(struct pm8001_hba_info *pm8001_ha,memcpy (sspTMCmd.lun, task->ssp_task.LUN,8 ); sspTMCmd.tag =cpu_to_le32 (ccb->ccb_tag);if (pm8001_ha->chip_id != chip_8001) - sspTMCmd.ds_ads_m =0x08 ; + sspTMCmd.ds_ads_m =cpu_to_le32 (0x08 ); circularQ = &pm8001_ha->inbnd_q_tbl[0 ]; ret =pm8001_mpi_build_cmd (pm8001_ha, circularQ, opc, &sspTMCmd,sizeof (sspTMCmd),0 );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 311/599 scsi: pm8001: Fix payload initialization in pm80xx_set_thermal_config()
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
[ Upstream commit bb225b12dbcc82d53d637d10b8d70b64494f8c16 ]
The fields of the set_ctrl_cfg_req structure have the __le32 type, so use cpu_to_le32() to assign them. This removes the sparse warnings:
warning: incorrect type in assignment (different base types)
expected restricted __le32
got unsigned int
--- drivers/scsi/pm8001/pm80xx_hwi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/scsi/pm8001/pm80xx_hwi.c +5 -3
@@ -1199,9 +1199,11 @@ pm80xx_set_thermal_config(struct pm8001_hba_info *pm8001_ha)else page_code =THERMAL_PAGE_CODE_8H ; - payload.cfg_pg[0 ] = (THERMAL_LOG_ENABLE <<9 ) | - (THERMAL_ENABLE <<8 ) | page_code; - payload.cfg_pg[1 ] = (LTEMPHIL <<24 ) | (RTEMPHIL <<8 ); + payload.cfg_pg[0 ] = +cpu_to_le32 ((THERMAL_LOG_ENABLE <<9 ) | + (THERMAL_ENABLE <<8 ) | page_code); + payload.cfg_pg[1 ] = +cpu_to_le32 ((LTEMPHIL <<24 ) | (RTEMPHIL <<8 )); pm8001_dbg(pm8001_ha, DEV, "Setting up thermal config. cfg_pg 0 0x%x cfg_pg 1 0x%x\n",
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 312/599 scsi: pm8001: Fix le32 values handling in pm80xx_set_sas_protocol_timer_config()
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
[ Upstream commit ca374f5d92b8ae778f6a37dd3e7ed809bbf7a953 ]
All fields of the SASProtocolTimerConfig structure have the __le32 type. As such, use cpu_to_le32() to initialize them. This change suppresses many sparse warnings:
warning: incorrect type in assignment (different base types)
expected restricted __le32 [addressable] [usertype] pageCode got int
Note that the check to limit the value of the STP_IDLE_TMO field is removed as this field is initialized using the fixed (and small) value defined by the STP_IDLE_TIME macro.
The pm8001_dbg() calls printing the values of the SASProtocolTimerConfig structure fileds are changed to use le32_to_cpu() to present the values in human readable form.
--- drivers/scsi/pm8001/pm80xx_hwi.c | 52 +++++++++++++++----------------- 1 file changed, 25 insertions(+), 27 deletions(-)
drivers/scsi/pm8001/pm80xx_hwi.c +25 -27
@@ -1243,43 +1243,41 @@ pm80xx_set_sas_protocol_timer_config(struct pm8001_hba_info *pm8001_ha) circularQ = &pm8001_ha->inbnd_q_tbl[0 ]; payload.tag =cpu_to_le32 (tag); - SASConfigPage.pageCode =SAS_PROTOCOL_TIMER_CONFIG_PAGE ; - SASConfigPage.MST_MSI =3 <<15 ; - SASConfigPage.STP_SSP_MCT_TMO = (STP_MCT_TMO <<16 ) |SSP_MCT_TMO ; - SASConfigPage.STP_FRM_TMO = (SAS_MAX_OPEN_TIME <<24 ) | - (SMP_MAX_CONN_TIMER <<16 ) |STP_FRM_TIMER ; - SASConfigPage.STP_IDLE_TMO =STP_IDLE_TIME ; - -if (SASConfigPage.STP_IDLE_TMO >0x3FFFFFF ) - SASConfigPage.STP_IDLE_TMO =0x3FFFFFF ; - - - SASConfigPage.OPNRJT_RTRY_INTVL = (SAS_MFD <<16 ) | -SAS_OPNRJT_RTRY_INTVL ; - SASConfigPage.Data_Cmd_OPNRJT_RTRY_TMO = (SAS_DOPNRJT_RTRY_TMO <<16 ) - |SAS_COPNRJT_RTRY_TMO ; - SASConfigPage.Data_Cmd_OPNRJT_RTRY_THR = (SAS_DOPNRJT_RTRY_THR <<16 ) - |SAS_COPNRJT_RTRY_THR ; - SASConfigPage.MAX_AIP =SAS_MAX_AIP ; + SASConfigPage.pageCode =cpu_to_le32 (SAS_PROTOCOL_TIMER_CONFIG_PAGE ); + SASConfigPage.MST_MSI =cpu_to_le32 (3 <<15 ); + SASConfigPage.STP_SSP_MCT_TMO = +cpu_to_le32 ((STP_MCT_TMO <<16 ) |SSP_MCT_TMO ); + SASConfigPage.STP_FRM_TMO = +cpu_to_le32 ((SAS_MAX_OPEN_TIME <<24 ) | + (SMP_MAX_CONN_TIMER <<16 ) |STP_FRM_TIMER ); + SASConfigPage.STP_IDLE_TMO =cpu_to_le32 (STP_IDLE_TIME ); + + SASConfigPage.OPNRJT_RTRY_INTVL = +cpu_to_le32 ((SAS_MFD <<16 ) |SAS_OPNRJT_RTRY_INTVL ); + SASConfigPage.Data_Cmd_OPNRJT_RTRY_TMO = +cpu_to_le32 ((SAS_DOPNRJT_RTRY_TMO <<16 ) |SAS_COPNRJT_RTRY_TMO ); + SASConfigPage.Data_Cmd_OPNRJT_RTRY_THR = +cpu_to_le32 ((SAS_DOPNRJT_RTRY_THR <<16 ) |SAS_COPNRJT_RTRY_THR ); + SASConfigPage.MAX_AIP =cpu_to_le32 (SAS_MAX_AIP );pm8001_dbg (pm8001_ha,INIT ,"SASConfigPage.pageCode 0x%08x\n" , - SASConfigPage.pageCode); +le32_to_cpu (SASConfigPage.pageCode));pm8001_dbg (pm8001_ha,INIT ,"SASConfigPage.MST_MSI 0x%08x\n" , - SASConfigPage.MST_MSI); +le32_to_cpu (SASConfigPage.MST_MSI));pm8001_dbg (pm8001_ha,INIT ,"SASConfigPage.STP_SSP_MCT_TMO 0x%08x\n" , - SASConfigPage.STP_SSP_MCT_TMO); +le32_to_cpu (SASConfigPage.STP_SSP_MCT_TMO));pm8001_dbg (pm8001_ha,INIT ,"SASConfigPage.STP_FRM_TMO 0x%08x\n" , - SASConfigPage.STP_FRM_TMO); +le32_to_cpu (SASConfigPage.STP_FRM_TMO));pm8001_dbg (pm8001_ha,INIT ,"SASConfigPage.STP_IDLE_TMO 0x%08x\n" , - SASConfigPage.STP_IDLE_TMO); +le32_to_cpu (SASConfigPage.STP_IDLE_TMO));pm8001_dbg (pm8001_ha,INIT ,"SASConfigPage.OPNRJT_RTRY_INTVL 0x%08x\n" , - SASConfigPage.OPNRJT_RTRY_INTVL); +le32_to_cpu (SASConfigPage.OPNRJT_RTRY_INTVL));pm8001_dbg (pm8001_ha,INIT ,"SASConfigPage.Data_Cmd_OPNRJT_RTRY_TMO 0x%08x\n" , - SASConfigPage.Data_Cmd_OPNRJT_RTRY_TMO); +le32_to_cpu (SASConfigPage.Data_Cmd_OPNRJT_RTRY_TMO));pm8001_dbg (pm8001_ha,INIT ,"SASConfigPage.Data_Cmd_OPNRJT_RTRY_THR 0x%08x\n" , - SASConfigPage.Data_Cmd_OPNRJT_RTRY_THR); +le32_to_cpu (SASConfigPage.Data_Cmd_OPNRJT_RTRY_THR));pm8001_dbg (pm8001_ha,INIT ,"SASConfigPage.MAX_AIP 0x%08x\n" , - SASConfigPage.MAX_AIP); +le32_to_cpu (SASConfigPage.MAX_AIP));memcpy (&payload.cfg_pg, &SASConfigPage,sizeof (SASProtocolTimerConfig_t));
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 313/599 scsi: pm8001: Fix payload initialization in pm80xx_encrypt_update()
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
[ Upstream commit f8b12dfb476dad38ce755aaf5e2df46f06f1822e ]
All fields of the kek_mgmt_req structure have the type __le32. So make sure to use cpu_to_le32() to initialize them. This suppresses the sparse warning:
warning: incorrect type in assignment (different base types)
expected restricted __le32 [addressable] [assigned] [usertype] new_curidx_ksop got int
--- drivers/scsi/pm8001/pm80xx_hwi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/scsi/pm8001/pm80xx_hwi.c +4 -3
@@ -1403,12 +1403,13 @@ static int pm80xx_encrypt_update(struct pm8001_hba_info *pm8001_ha)/* Currently only one key is used. New KEK index is 1. * Current KEK index is 1. Store KEK to NVRAM is 1. */ - payload.new_curidx_ksop = ((1 <<24 ) | (1 <<16 ) | (1 <<8 ) | -KEK_MGMT_SUBOP_KEYCARDUPDATE ); + payload.new_curidx_ksop = +cpu_to_le32 (((1 <<24 ) | (1 <<16 ) | (1 <<8 ) | +KEK_MGMT_SUBOP_KEYCARDUPDATE ));pm8001_dbg (pm8001_ha,DEV ,"Saving Encryption info to flash. payload 0x%x\n" , - payload.new_curidx_ksop); +le32_to_cpu (payload.new_curidx_ksop)); rc =pm8001_mpi_build_cmd (pm8001_ha, circularQ, opc, &payload,sizeof (payload),0 );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 314/599 scsi: pm8001: Fix le32 values handling in pm80xx_chip_ssp_io_req()
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
[ Upstream commit 970404cc5744b1033b6ee601be4ef0e2d1fbcf72 ]
Make sure that the __le32 fields of struct ssp_ini_io_start_req are manipulated after applying the correct endian conversion. That is, use cpu_to_le32() for assigning values and le32_to_cpu() for consulting a field value. In particular, make sure that the calculations for the 4G boundary check are done using CPU endianness and *not* little endian values. With these fixes, many sparse warnings are removed.
While at it, add blank lines after variable declarations and in some other places to make this code more readable.
--- drivers/scsi/pm8001/pm80xx_hwi.c | 41 +++++++++++++++++++------------- 1 file changed, 25 insertions(+), 16 deletions(-)
drivers/scsi/pm8001/pm80xx_hwi.c +25 -16
@@ -4308,13 +4308,15 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha,struct ssp_ini_io_start_req ssp_cmd;u32 tag = ccb->ccb_tag;int ret; -u64 phys_addr, start_addr, end_addr; +u64 phys_addr, end_addr;u32 end_addr_high, end_addr_low;struct inbound_queue_table *circularQ;u32 q_index, cpu_id;u32 opc =OPC_INB_SSPINIIOSTART ; +memset (&ssp_cmd,0 ,sizeof (ssp_cmd));memcpy (ssp_cmd.ssp_iu.lun, task->ssp_task.LUN,8 ); +/* data address domain added for spcv; set to 0 by host, * used internally by controller * 0 for SAS 1.1 and SAS 2.0 compatible TLR
@@ -4325,7 +4327,7 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha, ssp_cmd.device_id =cpu_to_le32 (pm8001_dev->device_id); ssp_cmd.tag =cpu_to_le32 (tag);if (task->ssp_task.enable_first_burst) - ssp_cmd.ssp_iu.efb_prio_attr |=0x80 ; + ssp_cmd.ssp_iu.efb_prio_attr =0x80 ; ssp_cmd.ssp_iu.efb_prio_attr |= (task->ssp_task.task_prio <<3 ); ssp_cmd.ssp_iu.efb_prio_attr |= (task->ssp_task.task_attr &7 ); memcpy(ssp_cmd.ssp_iu.cdb, task->ssp_task.cmd->cmnd,
@@ -4357,21 +4359,24 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha, ssp_cmd.enc_esgl =cpu_to_le32 (1 <<31 ); }else if (task->num_scatter ==1 ) {u64 dma_addr =sg_dma_address (task->scatter); + ssp_cmd.enc_addr_low =cpu_to_le32 (lower_32_bits (dma_addr)); ssp_cmd.enc_addr_high =cpu_to_le32 (upper_32_bits (dma_addr)); ssp_cmd.enc_len =cpu_to_le32 (task->total_xfer_len); ssp_cmd.enc_esgl =0 ; +/* Check 4G Boundary */ - start_addr =cpu_to_le64 (dma_addr); - end_addr = (start_addr + ssp_cmd.enc_len) -1 ; - end_addr_low =cpu_to_le32 (lower_32_bits (end_addr)); - end_addr_high =cpu_to_le32 (upper_32_bits (end_addr)); -if (end_addr_high != ssp_cmd.enc_addr_high) { + end_addr = dma_addr +le32_to_cpu (ssp_cmd.enc_len) -1 ; + end_addr_low =lower_32_bits (end_addr); + end_addr_high =upper_32_bits (end_addr); + +if (end_addr_high !=le32_to_cpu (ssp_cmd.enc_addr_high)) {pm8001_dbg (pm8001_ha,FAIL ,"The sg list address start_addr=0x%016llx data_len=0x%x end_addr_high=0x%08x end_addr_low=0x%08x has crossed 4G boundary\n" , - start_addr, ssp_cmd.enc_len, + dma_addr, +le32_to_cpu (ssp_cmd.enc_len), end_addr_high, end_addr_low);pm8001_chip_make_sg (task->scatter,1 , ccb->buf_prd);
@@ -4380,7 +4385,7 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha,cpu_to_le32 (lower_32_bits (phys_addr)); ssp_cmd.enc_addr_high =cpu_to_le32 (upper_32_bits (phys_addr)); - ssp_cmd.enc_esgl =cpu_to_le32 (1 <<31 ); + ssp_cmd.enc_esgl =cpu_to_le32 (1U <<31 ); } }else if (task->num_scatter ==0 ) { ssp_cmd.enc_addr_low =0 ;
@@ -4388,8 +4393,10 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha, ssp_cmd.enc_len =cpu_to_le32 (task->total_xfer_len); ssp_cmd.enc_esgl =0 ; } +/* XTS mode. All other fields are 0 */ - ssp_cmd.key_cmode =0x6 <<4 ; + ssp_cmd.key_cmode =cpu_to_le32 (0x6 <<4 ); +/* set tweak values. Should be the start lba */ ssp_cmd.twk_val0 = cpu_to_le32((task->ssp_task.cmd->cmnd[2] << 24) | (task->ssp_task.cmd->cmnd[3] << 16) |
@@ -4411,20 +4418,22 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha, ssp_cmd.esgl =cpu_to_le32 (1 <<31 ); }else if (task->num_scatter ==1 ) {u64 dma_addr =sg_dma_address (task->scatter); + ssp_cmd.addr_low =cpu_to_le32 (lower_32_bits (dma_addr)); ssp_cmd.addr_high =cpu_to_le32 (upper_32_bits (dma_addr)); ssp_cmd.len =cpu_to_le32 (task->total_xfer_len); ssp_cmd.esgl =0 ; +/* Check 4G Boundary */ - start_addr =cpu_to_le64 (dma_addr); - end_addr = (start_addr + ssp_cmd.len) -1 ; - end_addr_low =cpu_to_le32 (lower_32_bits (end_addr)); - end_addr_high =cpu_to_le32 (upper_32_bits (end_addr)); -if (end_addr_high != ssp_cmd.addr_high) { + end_addr = dma_addr +le32_to_cpu (ssp_cmd.len) -1 ; + end_addr_low =lower_32_bits (end_addr); + end_addr_high =upper_32_bits (end_addr); +if (end_addr_high !=le32_to_cpu (ssp_cmd.addr_high)) {pm8001_dbg (pm8001_ha,FAIL ,"The sg list address start_addr=0x%016llx data_len=0x%x end_addr_high=0x%08x end_addr_low=0x%08x has crossed 4G boundary\n" , - start_addr, ssp_cmd.len, + dma_addr, +le32_to_cpu (ssp_cmd.len), end_addr_high, end_addr_low);pm8001_chip_make_sg (task->scatter,1 , ccb->buf_prd);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 315/599 scsi: pm8001: Fix le32 values handling in pm80xx_chip_sata_req()
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
[ Upstream commit fd6d0e376211d7ed759db96b0fbd9a1cee67d462 ]
Make sure that the __le32 fields of struct sata_cmd are manipulated after applying the correct endian conversion. That is, use cpu_to_le32() for assigning values and le32_to_cpu() for consulting a field value. In particular, make sure that the calculations for the 4G boundary check are done using CPU endianness and *not* little endian values. With these fixes, many sparse warnings are removed.
While at it, fix some code identation and add blank lines after variable declarations and in some other places to make this code more readable.
--- drivers/scsi/pm8001/pm80xx_hwi.c | 82 ++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 37 deletions(-)
drivers/scsi/pm8001/pm80xx_hwi.c +45 -37
@@ -4467,7 +4467,7 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha,u32 q_index, cpu_id;struct sata_start_req sata_cmd;u32 hdr_tag, ncg_tag =0 ; -u64 phys_addr, start_addr, end_addr; +u64 phys_addr, end_addr;u32 end_addr_high, end_addr_low;u32 ATAP =0x0 ;u32 dir;
@@ -4528,32 +4528,38 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha,pm8001_chip_make_sg (task->scatter, ccb->n_elem, ccb->buf_prd); phys_addr = ccb->ccb_dma_handle; - sata_cmd.enc_addr_low =lower_32_bits (phys_addr); - sata_cmd.enc_addr_high =upper_32_bits (phys_addr); + sata_cmd.enc_addr_low = +cpu_to_le32 (lower_32_bits (phys_addr)); + sata_cmd.enc_addr_high = +cpu_to_le32 (upper_32_bits (phys_addr)); sata_cmd.enc_esgl =cpu_to_le32 (1 <<31 ); }else if (task->num_scatter ==1 ) {u64 dma_addr =sg_dma_address (task->scatter); - sata_cmd.enc_addr_low =lower_32_bits (dma_addr); - sata_cmd.enc_addr_high =upper_32_bits (dma_addr); + + sata_cmd.enc_addr_low = +cpu_to_le32 (lower_32_bits (dma_addr)); + sata_cmd.enc_addr_high = +cpu_to_le32 (upper_32_bits (dma_addr)); sata_cmd.enc_len =cpu_to_le32 (task->total_xfer_len); sata_cmd.enc_esgl =0 ; +/* Check 4G Boundary */ - start_addr =cpu_to_le64 (dma_addr); - end_addr = (start_addr + sata_cmd.enc_len) -1 ; - end_addr_low =cpu_to_le32 (lower_32_bits (end_addr)); - end_addr_high =cpu_to_le32 (upper_32_bits (end_addr)); -if (end_addr_high != sata_cmd.enc_addr_high) { + end_addr = dma_addr +le32_to_cpu (sata_cmd.enc_len) -1 ; + end_addr_low =lower_32_bits (end_addr); + end_addr_high =upper_32_bits (end_addr); +if (end_addr_high !=le32_to_cpu (sata_cmd.enc_addr_high)) {pm8001_dbg (pm8001_ha,FAIL ,"The sg list address start_addr=0x%016llx data_len=0x%x end_addr_high=0x%08x end_addr_low=0x%08x has crossed 4G boundary\n" , - start_addr, sata_cmd.enc_len, + dma_addr, +le32_to_cpu (sata_cmd.enc_len), end_addr_high, end_addr_low);pm8001_chip_make_sg (task->scatter,1 , ccb->buf_prd); phys_addr = ccb->ccb_dma_handle; sata_cmd.enc_addr_low = -lower_32_bits (phys_addr); +cpu_to_le32 (lower_32_bits (phys_addr)); sata_cmd.enc_addr_high = -upper_32_bits (phys_addr); +cpu_to_le32 (upper_32_bits (phys_addr)); sata_cmd.enc_esgl =cpu_to_le32 (1 <<31 ); }
@@ -4564,7 +4570,8 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha, sata_cmd.enc_esgl =0 ; }/* XTS mode. All other fields are 0 */ - sata_cmd.key_index_mode =0x6 <<4 ; + sata_cmd.key_index_mode =cpu_to_le32 (0x6 <<4 ); +/* set tweak values. Should be the start lba */ sata_cmd.twk_val0 = cpu_to_le32((sata_cmd.sata_fis.lbal_exp << 24) |
@@ -4590,31 +4597,31 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha, phys_addr = ccb->ccb_dma_handle; sata_cmd.addr_low =lower_32_bits (phys_addr); sata_cmd.addr_high =upper_32_bits (phys_addr); - sata_cmd.esgl =cpu_to_le32 (1 <<31 ); + sata_cmd.esgl =cpu_to_le32 (1U <<31 ); }else if (task->num_scatter ==1 ) {u64 dma_addr =sg_dma_address (task->scatter); + sata_cmd.addr_low =lower_32_bits (dma_addr); sata_cmd.addr_high =upper_32_bits (dma_addr); sata_cmd.len =cpu_to_le32 (task->total_xfer_len); sata_cmd.esgl =0 ; +/* Check 4G Boundary */ - start_addr =cpu_to_le64 (dma_addr); - end_addr = (start_addr + sata_cmd.len) -1 ; - end_addr_low =cpu_to_le32 (lower_32_bits (end_addr)); - end_addr_high =cpu_to_le32 (upper_32_bits (end_addr)); + end_addr = dma_addr +le32_to_cpu (sata_cmd.len) -1 ; + end_addr_low =lower_32_bits (end_addr); + end_addr_high =upper_32_bits (end_addr);if (end_addr_high != sata_cmd.addr_high) {pm8001_dbg (pm8001_ha,FAIL ,"The sg list address start_addr=0x%016llx data_len=0x%xend_addr_high=0x%08x end_addr_low=0x%08x has crossed 4G boundary\n" , - start_addr, sata_cmd.len, + dma_addr, +le32_to_cpu (sata_cmd.len), end_addr_high, end_addr_low);pm8001_chip_make_sg (task->scatter,1 , ccb->buf_prd); phys_addr = ccb->ccb_dma_handle; - sata_cmd.addr_low = -lower_32_bits (phys_addr); - sata_cmd.addr_high = -upper_32_bits (phys_addr); - sata_cmd.esgl =cpu_to_le32 (1 <<31 ); + sata_cmd.addr_low =lower_32_bits (phys_addr); + sata_cmd.addr_high =upper_32_bits (phys_addr); + sata_cmd.esgl =cpu_to_le32 (1U <<31 ); } }else if (task->num_scatter ==0 ) { sata_cmd.addr_low =0 ;
@@ -4622,27 +4629,28 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha, sata_cmd.len =cpu_to_le32 (task->total_xfer_len); sata_cmd.esgl =0 ; } +/* scsi cdb */ sata_cmd.atapi_scsi_cdb[0 ] =cpu_to_le32 (((task->ata_task.atapi_packet[0 ]) | - (task->ata_task.atapi_packet[1 ] <<8 ) | - (task->ata_task.atapi_packet[2 ] <<16 ) | - (task->ata_task.atapi_packet[3 ] <<24 ))); + (task->ata_task.atapi_packet[1 ] <<8 ) | + (task->ata_task.atapi_packet[2 ] <<16 ) | + (task->ata_task.atapi_packet[3 ] <<24 ))); sata_cmd.atapi_scsi_cdb[1 ] =cpu_to_le32 (((task->ata_task.atapi_packet[4 ]) | - (task->ata_task.atapi_packet[5 ] <<8 ) | - (task->ata_task.atapi_packet[6 ] <<16 ) | - (task->ata_task.atapi_packet[7 ] <<24 ))); + (task->ata_task.atapi_packet[5 ] <<8 ) | + (task->ata_task.atapi_packet[6 ] <<16 ) | + (task->ata_task.atapi_packet[7 ] <<24 ))); sata_cmd.atapi_scsi_cdb[2 ] =cpu_to_le32 (((task->ata_task.atapi_packet[8 ]) | - (task->ata_task.atapi_packet[9 ] <<8 ) | - (task->ata_task.atapi_packet[10 ] <<16 ) | - (task->ata_task.atapi_packet[11 ] <<24 ))); + (task->ata_task.atapi_packet[9 ] <<8 ) | + (task->ata_task.atapi_packet[10 ] <<16 ) | + (task->ata_task.atapi_packet[11 ] <<24 ))); sata_cmd.atapi_scsi_cdb[3 ] =cpu_to_le32 (((task->ata_task.atapi_packet[12 ]) | - (task->ata_task.atapi_packet[13 ] <<8 ) | - (task->ata_task.atapi_packet[14 ] <<16 ) | - (task->ata_task.atapi_packet[15 ] <<24 ))); + (task->ata_task.atapi_packet[13 ] <<8 ) | + (task->ata_task.atapi_packet[14 ] <<16 ) | + (task->ata_task.atapi_packet[15 ] <<24 ))); }/* Check for read log for failed drive and return */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 316/599 scsi: pm8001: Fix NCQ NON DATA command task initialization
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
[ Upstream commit aa028141ab0bc62c44a84d42f09db35d82df82a2 ]
In the pm8001_chip_sata_req() and pm80xx_chip_sata_req() functions, all tasks with a DMA direction of DMA_NONE (no data transfer) are initialized using the ATAP value 0x04. However, NCQ NON DATA commands, while being DMA_NONE commands are NCQ commands and need to be initialized using the value 0x07 for ATAP, similarly to other NCQ commands.
Make sure that NCQ NON DATA command tasks are initialized similarly to other NCQ commands by also testing the task "use_ncq" field in addition to the DMA direction. While at it, reorganize the code into a chain of if - else if - else to avoid useless affectations and debug messages.
--- drivers/scsi/pm8001/pm8001_hwi.c | 14 +++++++------- drivers/scsi/pm8001/pm80xx_hwi.c | 13 ++++++------- 2 files changed, 13 insertions(+), 14 deletions(-)
drivers/scsi/pm8001/pm8001_hwi.c +7 -7
@@ -4220,22 +4220,22 @@ static int pm8001_chip_sata_req(struct pm8001_hba_info *pm8001_ha,u32 opc =OPC_INB_SATA_HOST_OPSTART ;memset (&sata_cmd,0 ,sizeof (sata_cmd)); circularQ = &pm8001_ha->inbnd_q_tbl[0 ]; -if (task->data_dir ==DMA_NONE ) { + +if (task->data_dir ==DMA_NONE && !task->ata_task.use_ncq) {ATAP =0x04 ;/* no data*/ pm8001_dbg (pm8001_ha,IO ,"no data\n" ); }else if (likely (!task->ata_task.device_control_reg_update)) { -if (task->ata_task.dma_xfer) { +if (task->ata_task.use_ncq && + dev->sata_dev.class !=ATA_DEV_ATAPI ) { +ATAP =0x07 ;/* FPDMA */ +pm8001_dbg (pm8001_ha,IO ,"FPDMA\n" ); + }else if (task->ata_task.dma_xfer) {ATAP =0x06 ;/* DMA */ pm8001_dbg (pm8001_ha,IO ,"DMA\n" ); }else {ATAP =0x05 ;/* PIO*/ pm8001_dbg (pm8001_ha,IO ,"PIO\n" ); } -if (task->ata_task.use_ncq && - dev->sata_dev.class !=ATA_DEV_ATAPI ) { -ATAP =0x07 ;/* FPDMA */ -pm8001_dbg (pm8001_ha,IO ,"FPDMA\n" ); - } }if (task->ata_task.use_ncq &&pm8001_get_ncq_tag (task, &hdr_tag)) { task->ata_task.fis.sector_count |= (u8) (hdr_tag <<3 );
drivers/scsi/pm8001/pm80xx_hwi.c +6 -7
@@ -4479,22 +4479,21 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha, q_index = (u32) (cpu_id) % (pm8001_ha->max_q_num); circularQ = &pm8001_ha->inbnd_q_tbl[q_index]; -if (task->data_dir ==DMA_NONE ) { +if (task->data_dir ==DMA_NONE && !task->ata_task.use_ncq) {ATAP =0x04 ;/* no data*/ pm8001_dbg (pm8001_ha,IO ,"no data\n" ); }else if (likely (!task->ata_task.device_control_reg_update)) { -if (task->ata_task.dma_xfer) { +if (task->ata_task.use_ncq && + dev->sata_dev.class !=ATA_DEV_ATAPI ) { +ATAP =0x07 ;/* FPDMA */ +pm8001_dbg (pm8001_ha,IO ,"FPDMA\n" ); + }else if (task->ata_task.dma_xfer) {ATAP =0x06 ;/* DMA */ pm8001_dbg (pm8001_ha,IO ,"DMA\n" ); }else {ATAP =0x05 ;/* PIO*/ pm8001_dbg (pm8001_ha,IO ,"PIO\n" ); } -if (task->ata_task.use_ncq && - dev->sata_dev.class !=ATA_DEV_ATAPI ) { -ATAP =0x07 ;/* FPDMA */ -pm8001_dbg (pm8001_ha,IO ,"FPDMA\n" ); - } }if (task->ata_task.use_ncq &&pm8001_get_ncq_tag (task, &hdr_tag)) { task->ata_task.fis.sector_count |= (u8) (hdr_tag <<3 );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 317/599 scsi: pm8001: Fix NCQ NON DATA command completion handling
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
[ Upstream commit 1d6736c3e162061dc811c76e605f35ef3234bffa ]
NCQ NON DATA is an NCQ command with the DMA_NONE DMA direction and so a register-device-to-host-FIS response is expected for it.
However, for an IO_SUCCESS case, mpi_sata_completion() expects a set-device-bits-FIS for any ata task with an use_ncq field true, which includes NCQ NON DATA commands.
Fix this to correctly treat NCQ NON DATA commands as non-data by also testing for the DMA_NONE DMA direction.
--- drivers/scsi/pm8001/pm8001_hwi.c | 3 ++- drivers/scsi/pm8001/pm80xx_hwi.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/scsi/pm8001/pm8001_hwi.c +2 -1
@@ -2365,7 +2365,8 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) len =sizeof (struct pio_setup_fis );pm8001_dbg (pm8001_ha,IO ,"PIO read len = %d\n" , len); - }else if (t->ata_task.use_ncq) { + }else if (t->ata_task.use_ncq && + t->data_dir !=DMA_NONE ) { len =sizeof (struct set_dev_bits_fis );pm8001_dbg (pm8001_ha,IO ,"FPDMA len = %d\n" , len);
drivers/scsi/pm8001/pm80xx_hwi.c +2 -1
@@ -2465,7 +2465,8 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) len =sizeof (struct pio_setup_fis );pm8001_dbg (pm8001_ha,IO ,"PIO read len = %d\n" , len); - }else if (t->ata_task.use_ncq) { + }else if (t->ata_task.use_ncq && + t->data_dir !=DMA_NONE ) { len =sizeof (struct set_dev_bits_fis );pm8001_dbg (pm8001_ha,IO ,"FPDMA len = %d\n" , len);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 318/599 scsi: pm8001: Fix abort all task initialization
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
[ Upstream commit 7f12845c8389855dbcc67baa068b6832dc4a396e ]
In pm80xx_send_abort_all(), the n_elem field of the ccb used is not initialized to 0. This missing initialization sometimes lead to the task completion path seeing the ccb with a non-zero n_elem resulting in the execution of invalid dma_unmap_sg() calls in pm8001_ccb_task_free(), causing a crash such as:
[ 197.676341] RIP: 0010:iommu_dma_unmap_sg+0x6d/0x280 [ 197.700204] RSP: 0018:ffff889bbcf89c88 EFLAGS: 00010012 [ 197.705485] RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffffffff83d0bda0 [ 197.712687] RDX: 0000000000000002 RSI: 0000000000000000 RDI: ffff88810dffc0d0 [ 197.719887] RBP: 0000000000000000 R08: 0000000000000000 R09: ffff8881c790098b [ 197.727089] R10: ffffed1038f20131 R11: 0000000000000001 R12: 0000000000000000 [ 197.734296] R13: ffff88810dffc0d0 R14: 0000000000000010 R15: 0000000000000000 [ 197.741493] FS: 0000000000000000(0000) GS:ffff889bbcf80000(0000) knlGS:0000000000000000 [ 197.749659] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 197.755459] CR2: 00007f16c1b42734 CR3: 0000000004814000 CR4: 0000000000350ee0 [ 197.762656] Call Trace: [ 197.765127] <IRQ> [ 197.767162] pm8001_ccb_task_free+0x5f1/0x820 [pm80xx] [ 197.772364] ? do_raw_spin_unlock+0x54/0x220 [ 197.776680] pm8001_mpi_task_abort_resp+0x2ce/0x4f0 [pm80xx] [ 197.782406] process_oq+0xe85/0x7890 [pm80xx] [ 197.786817] ? lock_acquire+0x194/0x490 [ 197.790697] ? handle_irq_event+0x10e/0x1b0 [ 197.794920] ? mpi_sata_completion+0x2d70/0x2d70 [pm80xx] [ 197.800378] ? __wake_up_bit+0x100/0x100 [ 197.804340] ? lock_is_held_type+0x98/0x110 [ 197.808565] pm80xx_chip_isr+0x94/0x130 [pm80xx] [ 197.813243] tasklet_action_common.constprop.0+0x24b/0x2f0 [ 197.818785] __do_softirq+0x1b5/0x82d [ 197.822485] ? do_raw_spin_unlock+0x54/0x220 [ 197.826799] __irq_exit_rcu+0x17e/0x1e0 [ 197.830678] irq_exit_rcu+0xa/0x20 [ 197.834114] common_interrupt+0x78/0x90 [ 197.840051] </IRQ> [ 197.844236] <TASK> [ 197.848397] asm_common_interrupt+0x1e/0x40
Avoid this issue by always initializing the ccb n_elem field to 0 in pm8001_send_abort_all(), pm8001_send_read_log() and pm80xx_send_abort_all().
--- drivers/scsi/pm8001/pm8001_hwi.c | 2 ++ drivers/scsi/pm8001/pm80xx_hwi.c | 1 + 2 files changed, 3 insertions(+)
drivers/scsi/pm8001/pm8001_hwi.c +2 -0
@@ -1727,6 +1727,7 @@ static void pm8001_send_abort_all(struct pm8001_hba_info *pm8001_ha, ccb->device = pm8001_ha_dev; ccb->ccb_tag = ccb_tag; ccb->task = task; + ccb->n_elem =0 ; circularQ = &pm8001_ha->inbnd_q_tbl[0 ];
@@ -1788,6 +1789,7 @@ static void pm8001_send_read_log(struct pm8001_hba_info *pm8001_ha, ccb->device = pm8001_ha_dev; ccb->ccb_tag = ccb_tag; ccb->task = task; + ccb->n_elem =0 ; pm8001_ha_dev->id |=NCQ_READ_LOG_FLAG ; pm8001_ha_dev->id |=NCQ_2ND_RLE_FLAG ;
drivers/scsi/pm8001/pm80xx_hwi.c +1 -0
@@ -1750,6 +1750,7 @@ static void pm80xx_send_abort_all(struct pm8001_hba_info *pm8001_ha, ccb->device = pm8001_ha_dev; ccb->ccb_tag = ccb_tag; ccb->task = task; + ccb->n_elem =0 ; circularQ = &pm8001_ha->inbnd_q_tbl[0 ];
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 319/599 RDMA/mlx5: Fix the flow of a miss in the allocation of a cache ODP MR
In reply to Greg Kroah-HartmanFrom: Aharon Landau <[email protected]>
[ Upstream commit 2f0e60d5e9f96341a0c8a01be8878cdb3b29ff20 ]
When an ODP MR cache entry is empty and trying to allocate it, increment the ent->miss counter and call to queue_adjust_cache_locked() to verify the entry is balanced.
--- drivers/infiniband/hw/mlx5/mr.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/hw/mlx5/mr.c +2 -0
@@ -575,6 +575,8 @@ struct mlx5_ib_mr *mlx5_mr_cache_alloc(struct mlx5_ib_dev *dev, ent = &cache->ent[entry];spin_lock_irq (&ent->lock);if (list_empty (&ent->head)) { +queue_adjust_cache_locked (ent); + ent->miss++;spin_unlock_irq (&ent->lock); mr =create_cache_mr (ent);if (IS_ERR (mr))
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 320/599 drm/amd/display: Remove vupdate_int_entry definition
In reply to Greg Kroah-HartmanFrom: Maíra Canal <[email protected]>
[ Upstream commit 3679b8518cd213c25d555553ef212e233faf698c ]
Remove the vupdate_int_entry definition and utilization to avoid the following warning by Clang:
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:410:2:
warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
vupdate_no_lock_int_entry(0),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:280:39:
note: expanded from macro 'vupdate_no_lock_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:404:2:
note: previous initialization is here
vupdate_int_entry(0),
^~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:269:39:
note: expanded from macro 'vupdate_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:411:2:
warning: initializer overrides prior initialization of this subobject
[-Winitializer-overrides]
vupdate_no_lock_int_entry(1),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:280:39:
note: expanded from macro 'vupdate_no_lock_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:405:2:
note: previous initialization is here
vupdate_int_entry(1),
^~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:269:39:
note: expanded from macro 'vupdate_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:412:2:
warning: initializer overrides prior initialization of this subobject
[-Winitializer-overrides]
vupdate_no_lock_int_entry(2),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:280:39:
note: expanded from macro 'vupdate_no_lock_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:406:2:
note: previous initialization is here
vupdate_int_entry(2),
^~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:269:39:
note: expanded from macro 'vupdate_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:413:2:
warning: initializer overrides prior initialization of this subobject
[-Winitializer-overrides]
vupdate_no_lock_int_entry(3),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:280:39:
note: expanded from macro 'vupdate_no_lock_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:407:2:
note: previous initialization is here
vupdate_int_entry(3),
^~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:269:39:
note: expanded from macro 'vupdate_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:414:2:
warning: initializer overrides prior initialization of this subobject
[-Winitializer-overrides]
vupdate_no_lock_int_entry(4),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:280:39:
note: expanded from macro 'vupdate_no_lock_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:408:2:
note: previous initialization is here
vupdate_int_entry(4),
^~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:269:39:
note: expanded from macro 'vupdate_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:415:2:
warning: initializer overrides prior initialization of this subobject
[-Winitializer-overrides]
vupdate_no_lock_int_entry(5),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:280:39:
note: expanded from macro 'vupdate_no_lock_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:409:2:
note: previous initialization is here
vupdate_int_entry(5),
^~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:269:39:
note: expanded from macro 'vupdate_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~6 warnings generated.
--- .../amd/display/dc/irq/dcn21/irq_service_dcn21.c | 14 -------------- 1 file changed, 14 deletions(-)
drivers/gpu/drm/amd/display/dc/irq/dcn21/irq_service_dcn21.c +0 -14
@@ -227,14 +227,6 @@ static const struct irq_source_info_funcs vupdate_no_lock_irq_info_funcs = { .funcs = &pflip_irq_info_funcs\ } -#define vupdate_int_entry (reg_num)\ - [DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\ - IRQ_REG_ENTRY(OTG, reg_num,\ - OTG_GLOBAL_SYNC_STATUS, VUPDATE_INT_EN,\ - OTG_GLOBAL_SYNC_STATUS, VUPDATE_EVENT_CLEAR),\ - .funcs = &vblank_irq_info_funcs\ - } -/* vupdate_no_lock_int_entry maps to DC_IRQ_SOURCE_VUPDATEx, to match semantic * of DCE's DC_IRQ_SOURCE_VUPDATEx. */
@@ -348,12 +340,6 @@ irq_source_info_dcn21[DAL_IRQ_SOURCES_NUMBER] = { dc_underflow_int_entry(6), [DC_IRQ_SOURCE_DMCU_SCP] = dummy_irq_entry(), [DC_IRQ_SOURCE_VBIOS_SW ] =dummy_irq_entry (), -vupdate_int_entry (0 ), -vupdate_int_entry (1 ), -vupdate_int_entry (2 ), -vupdate_int_entry (3 ), -vupdate_int_entry (4 ), -vupdate_int_entry (5 ),vupdate_no_lock_int_entry (0 ),vupdate_no_lock_int_entry (1 ), vupdate_no_lock_int_entry(2),
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 321/599 TOMOYO: fix __setup handlers return values
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 39844b7e3084baecef52d1498b5fa81afa2cefa9 ]
__setup() handlers should return 1 if the parameter is handled. Returning 0 causes the entire string to be added to init's environment strings (limited to 32 strings), unnecessarily polluting it.
Using the documented strings "TOMOYO_loader=string1" and "TOMOYO_trigger=string2" causes an Unknown parameter message:
Unknown kernel command line parameters
"BOOT_IMAGE=/boot/bzImage-517rc5 TOMOYO_loader=string1 \
TOMOYO_trigger=string2", will be passed to user space.
and these strings are added to init's environment string space:
Run /sbin/init as init process
with arguments:
/sbin/init
with environment:
HOME=/
TERM=linux
BOOT_IMAGE=/boot/bzImage-517rc5
TOMOYO_loader=string1
TOMOYO_trigger=string2With this change, these __setup handlers act as expected, and init's environment is not polluted with these strings.
--- security/tomoyo/load_policy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
security/tomoyo/load_policy.c +2 -2
@@ -24,7 +24,7 @@ static const char *tomoyo_loader;static int __init tomoyo_loader_setup (char *str) { tomoyo_loader = str; -return 0 ; +return 1 ; }__setup ("TOMOYO_loader=" , tomoyo_loader_setup);
@@ -64,7 +64,7 @@ static const char *tomoyo_trigger;static int __init tomoyo_trigger_setup (char *str) { tomoyo_trigger = str; -return 0 ; +return 1 ; }__setup ("TOMOYO_trigger=" , tomoyo_trigger_setup);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 322/599 ext2: correct max file size computing
In reply to Greg Kroah-HartmanFrom: Zhang Yi <[email protected]>
[ Upstream commit 50b3a818991074177a56c87124c7a7bdf5fa4f67 ]
We need to calculate the max file size accurately if the total blocks that can address by block tree exceed the upper_limit. But this check is not correct now, it only compute the total data blocks but missing metadata blocks are needed. So in the case of "data blocks < upper_limit && total blocks > upper_limit", we will get wrong result. Fortunately, this case could not happen in reality, but it's confused and better to correct the computing.
bits data blocks metadatablocks upper_limit
10 16843020 66051 2147483647
11 134480396 263171 1073741823
12 1074791436 1050627 536870911 (*) 13 8594130956 4198403 268435455 (*) 14 68736258060 16785411 134217727 (*)
15 549822930956 67125251 67108863 (*)
16 4398314962956 268468227 33554431 (*)
[*] Need to calculate in depth.
--- fs/ext2/super.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/ext2/super.c +5 -1
@@ -756,8 +756,12 @@ static loff_t ext2_max_size(int bits) res +=1LL << (bits-2 ); res +=1LL << (2 *(bits-2 )); res +=1LL << (3 *(bits-2 )); +/* Compute how many metadata blocks are needed */ + meta_blocks =1 ; + meta_blocks +=1 + ppb; + meta_blocks +=1 + ppb + ppb * ppb;/* Does block tree limit file size? */ -if (res < upper_limit) +if (res + meta_blocks <= upper_limit) goto check_lfs; res = upper_limit;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 323/599 drm/tegra: Fix reference leak in tegra_dsi_ganged_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 221e3638feb8bc42143833c9a704fa89b6c366bb ]
The reference taken by 'of_find_device_by_node()' must be released when not needed anymore. Add put_device() call to fix this.
--- drivers/gpu/drm/tegra/dsi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tegra/dsi.c +3 -1
@@ -1538,8 +1538,10 @@ static int tegra_dsi_ganged_probe(struct tegra_dsi *dsi) dsi->slave =platform_get_drvdata (gangster);of_node_put (np); -if (!dsi->slave) +if (!dsi->slave) { +put_device (&gangster->dev);return -EPROBE_DEFER ; + } dsi->slave->master = dsi; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 324/599 power: supply: bq24190_charger: Fix bq24190_vbus_is_enabled() wrong false return
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit f7731754fdce33dad19be746f647d6ac47c5d695 ]
The datasheet says that the BQ24190_REG_POC_CHG_CONFIG bits can have a value of either 10(0x2) or 11(0x3) for OTG (5V boost regulator) mode.
Sofar bq24190_vbus_is_enabled() was only checking for 10 but some BIOS-es uses 11 when enabling the regulator at boot.
Make bq24190_vbus_is_enabled() also check for 11 so that it does not wrongly returns false when the bits are set to 11.
--- drivers/power/supply/bq24190_charger.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/power/supply/bq24190_charger.c +6 -1
@@ -41,6 +41,7 @@#define BQ24190_REG_POC_CHG_CONFIG_DISABLE 0x0#define BQ24190_REG_POC_CHG_CONFIG_CHARGE 0x1#define BQ24190_REG_POC_CHG_CONFIG_OTG 0x2 +#define BQ24190_REG_POC_CHG_CONFIG_OTG_ALT 0x3#define BQ24190_REG_POC_SYS_MIN_MASK (BIT(3) | BIT(2) | BIT(1))#define BQ24190_REG_POC_SYS_MIN_SHIFT 1#define BQ24190_REG_POC_SYS_MIN_MIN 3000
@@ -552,7 +553,11 @@ static int bq24190_vbus_is_enabled(struct regulator_dev *dev)pm_runtime_mark_last_busy (bdi->dev);pm_runtime_put_autosuspend (bdi->dev); -return ret ? ret : val ==BQ24190_REG_POC_CHG_CONFIG_OTG ; +if (ret) +return ret; + +return (val ==BQ24190_REG_POC_CHG_CONFIG_OTG || + val ==BQ24190_REG_POC_CHG_CONFIG_OTG_ALT ); }static const struct regulator_ops bq24190_vbus_ops = {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 325/599 scsi: hisi_sas: Change permission of parameter prot_mask
In reply to Greg Kroah-HartmanFrom: Xiang Chen <[email protected]>
[ Upstream commit c4e070457a93705e56ed06b3910d9e5fe56d3be3 ]
Currently the permission of parameter prot_mask is 0x0, which means that the member does not appear in sysfs. Change it as other module parameters to 0444 for world-readable.
[mkp: s/v3/v2/]
--- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +1 -1
@@ -514,7 +514,7 @@ MODULE_PARM_DESC(intr_conv, "interrupt converge enable (0-1)");/* permit overriding the host protection capabilities mask (EEDP/T10 PI) */ static int prot_mask; -module_param (prot_mask, int,0 ); +module_param (prot_mask, int,0444 );MODULE_PARM_DESC (prot_mask," host protection capabilities mask, def=0x0 " );static bool auto_affine_msi_experimental;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 326/599 drm/bridge: cdns-dsi: Make sure to to create proper aliases for dt
In reply to Greg Kroah-HartmanFrom: Nishanth Menon <[email protected]>
[ Upstream commit ffb5c099aaa13ab7f73c29ea6ae26bce8d7575ae ]
Add MODULE_DEVICE_TABLE to the device tree table to create required aliases needed for module to be loaded with device tree based platform.
--- drivers/gpu/drm/bridge/cdns-dsi.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/bridge/cdns-dsi.c +1 -0
@@ -1286,6 +1286,7 @@ static const struct of_device_id cdns_dsi_of_match[] = { { .compatible = "cdns,dsi" }, { }, }; +MODULE_DEVICE_TABLE (of, cdns_dsi_of_match);static struct platform_driver cdns_dsi_platform_driver = { .probe = cdns_dsi_drm_probe,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 327/599 bpf, arm64: Call build_prologue() first in first JIT pass
In reply to Greg Kroah-HartmanFrom: Hou Tao <[email protected]>
[ Upstream commit 68e4f238b0e9d3670a1612ad900a6e98b2b3f7dd ]
BPF line info needs ctx->offset to be the instruction offset in the whole JITed image instead of the body itself, so also call build_prologue() first in first JIT pass.
--- arch/arm64/net/bpf_jit_comp.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
arch/arm64/net/bpf_jit_comp.c +8 -5
@@ -1040,15 +1040,18 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog) goto out_off; } -/* 1. Initial fake pass to compute ctx->idx. */ - -/* Fake pass to fill in ctx->offset. */ -if (build_body (&ctx, extra_pass)) { +/* +* 1. Initial fake pass to compute ctx->idx and ctx->offset. +* +* BPF line info needs ctx->offset[i] to be the offset of +* instruction[i] in jited image, so build prologue first. +*/ +if (build_prologue (&ctx, was_classic)) { prog = orig_prog; goto out_off; } -if (build_prologue (&ctx, was_classic)) { +if (build_body (&ctx, extra_pass)) { prog = orig_prog; goto out_off; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 328/599 bpf, arm64: Feed byte-offset into bpf line info
In reply to Greg Kroah-HartmanFrom: Hou Tao <[email protected]>
[ Upstream commit dda7596c109fc382876118627e29db7607cde35d ]
insn_to_jit_off passed to bpf_prog_fill_jited_linfo() is calculated in instruction granularity instead of bytes granularity, but BPF line info requires byte offset.
bpf_prog_fill_jited_linfo() will be the last user of ctx.offset before it is freed, so convert the offset into byte-offset before calling into bpf_prog_fill_jited_linfo() in order to fix the line info dump on arm64.
--- arch/arm64/net/bpf_jit_comp.c | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm64/net/bpf_jit_comp.c +5 -0
@@ -1124,6 +1124,11 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog) prog->jited_len = prog_size;if (!prog->is_func || extra_pass) { +int i; + +/* offset[prog->len] is the size of program */ +for (i =0 ; i <= prog->len; i++) + ctx.offset[i] *=AARCH64_INSN_SIZE ;bpf_prog_fill_jited_linfo (prog, ctx.offset +1 ); out_off:kfree (ctx.offset);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 329/599 gpu: host1x: Fix a memory leak in host1x_remove()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 025c6643a81564f066d8381b9e2f4603e0f8438f ]
Add a missing 'host1x_channel_list_free()' call in the remove function, as already done in the error handling path of the probe function.
--- drivers/gpu/host1x/dev.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/host1x/dev.c +1 -0
@@ -520,6 +520,7 @@ static int host1x_remove(struct platform_device *pdev)host1x_syncpt_deinit (host);reset_control_assert (host->rst);clk_disable_unprepare (host->clk); +host1x_channel_list_free (&host->channel_list);host1x_iommu_exit (host);return 0 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 330/599 libbpf: Skip forward declaration when counting duplicated type names
In reply to Greg Kroah-HartmanFrom: Xu Kuohai <[email protected]>
[ Upstream commit 4226961b0019b2e1612029e8950a9e911affc995 ]
Currently if a declaration appears in the BTF before the definition, the definition is dumped as a conflicting name, e.g.:
$ bpftool btf dump file vmlinux format raw | grep "'unix_sock'"
[81287] FWD 'unix_sock' fwd_kind=struct
[89336] STRUCT 'unix_sock' size=1024 vlen=14 $ bpftool btf dump file vmlinux format c | grep "struct unix_sock"
struct unix_sock;
struct unix_sock___2 { <--- conflict, the "___2" is unexpected
struct unix_sock___2 *unix_sk;This causes a compilation error if the dump output is used as a header file.
Fix it by skipping declaration when counting duplicated type names.
--- tools/lib/bpf/btf_dump.c | 5 +++++ 1 file changed, 5 insertions(+)
tools/lib/bpf/btf_dump.c +5 -0
@@ -1416,6 +1416,11 @@ static const char *btf_dump_resolve_name(struct btf_dump *d, __u32 id,if (s->name_resolved)return *cached_name ? *cached_name : orig_name; +if (btf_is_fwd (t) || (btf_is_enum (t) &&btf_vlen (t) ==0 )) { + s->name_resolved =1 ; +return orig_name; + } + dup_cnt =btf_dump_name_dups (d, name_map, orig_name);if (dup_cnt >1 ) {const size_t max_len =256 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 331/599 powerpc/mm/numa: skip NUMA_NO_NODE onlining in parse_numa_properties()
In reply to Greg Kroah-HartmanFrom: Daniel Henrique Barboza <[email protected]>
[ Upstream commit 749ed4a20657bcea66a6e082ca3dc0d228cbec80 ]
Executing node_set_online() when nid = NUMA_NO_NODE results in an undefined behavior. node_set_online() will call node_set_state(), into __node_set(), into set_bit(), and since NUMA_NO_NODE is -1 we'll end up doing a negative shift operation inside arch/powerpc/include/asm/bitops.h. This potential UB was detected running a kernel with CONFIG_UBSAN.
The behavior was introduced by commit 10f78fd0dabb ("powerpc/numa: Fix a regression on memoryless node 0"), where the check for nid > 0 was removed to fix a problem that was happening with nid = 0, but the result is that now we're trying to online NUMA_NO_NODE nids as well.
Checking for nid >= 0 will allow node 0 to be onlined while avoiding this UB with NUMA_NO_NODE.
--- arch/powerpc/mm/numa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/powerpc/mm/numa.c +3 -1
@@ -742,7 +742,9 @@ static int __init parse_numa_properties(void)of_node_put (cpu); } -node_set_online (nid); +/* node_set_online() is an UB if 'nid' is negative */ +if (likely (nid >=0 )) +node_set_online (nid); }get_n_mem_cells (&n_mem_addr_cells, &n_mem_size_cells);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 332/599 powerpc/Makefile: Dont pass -mcpu=powerpc64 when building 32-bit
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
[ Upstream commit 2863dd2db23e0407f6c50b8ba5c0e55abef894f1 ]
When CONFIG_GENERIC_CPU=y (true for all our defconfigs) we pass -mcpu=powerpc64 to the compiler, even when we're building a 32-bit kernel.
This happens because we have an ifdef CONFIG_PPC_BOOK3S_64/else block in the Makefile that was written before 32-bit supported GENERIC_CPU. Prior to that the else block only applied to 64-bit Book3E.
The GCC man page says -mcpu=powerpc64 "[specifies] a pure ... 64-bit big endian PowerPC ... architecture machine [type], with an appropriate, generic processor model assumed for scheduling purposes."
It's unclear how that interacts with -m32, which we are also passing, although obviously -m32 is taking precedence in some sense, as the 32-bit kernel only contains 32-bit instructions.
This was noticed by inspection, not via any bug reports, but it does affect code generation. Comparing before/after code generation, there are some changes to instruction scheduling, and the after case (with -mcpu=powerpc64 removed) the compiler seems more keen to use r8.
Fix it by making the else case only apply to Book3E 64, which excludes 32-bit.
--- arch/powerpc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/Makefile +1 -1
@@ -172,7 +172,7 @@ else CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power7,$(call cc-option,-mtune=power5)) CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mcpu=power5,-mcpu=power4) endif -else +else ifdef CONFIG_PPC_BOOK3E_64 CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64 endif
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 333/599 KVM: x86: Fix emulation in writing cr8
In reply to Greg Kroah-HartmanFrom: Zhenzhong Duan <[email protected]>
[ Upstream commit f66af9f222f08d5b11ea41c1bd6c07a0f12daa07 ]
In emulation of writing to cr8, one of the lowest four bits in TPR[3:0] is kept.
According to Intel SDM 10.8.6.1(baremetal scenario):
"APIC.TPR[bits 7:4] = CR8[bits 3:0], APIC.TPR[bits 3:0] = 0";
and SDM 28.3(use TPR shadow):
"MOV to CR8. The instruction stores bits 3:0 of its source operand into bits 7:4 of VTPR; the remainder of VTPR (bits 3:0 and bits 31:8) are cleared.";
and AMD's APM 16.6.4:
"Task Priority Sub-class (TPS)-Bits 3 : 0. The TPS field indicates the current sub-priority to be used when arbitrating lowest-priority messages. This field is written with zero when TPR is written using the architectural CR8 register.";
so in KVM emulated scenario, clear TPR[3:0] to make a consistent behavior as in other scenarios.
This doesn't impact evaluation and delivery of pending virtual interrupts because processor does not use the processor-priority sub-class to determine which interrupts to delivery and which to inhibit.
Sub-class is used by hardware to arbitrate lowest priority interrupts, but KVM just does a round-robin style delivery.
Message-Id: <[email protected]>
--- arch/x86/kvm/lapic.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
arch/x86/kvm/lapic.c +1 -4
@@ -2227,10 +2227,7 @@ void kvm_set_lapic_tscdeadline_msr(struct kvm_vcpu *vcpu, u64 data)void kvm_lapic_set_tpr (struct kvm_vcpu *vcpu,unsigned long cr8) { -struct kvm_lapic *apic = vcpu->arch.apic; - -apic_set_tpr (apic, ((cr8 &0x0f ) <<4 ) - | (kvm_lapic_get_reg (apic,APIC_TASKPRI ) &4 )); +apic_set_tpr (vcpu->arch.apic, (cr8 &0x0f ) <<4 ); }u64 kvm_lapic_get_cr8 (struct kvm_vcpu *vcpu)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 334/599 KVM: x86/emulator: Defer not-present segment check in __load_segment_descriptor()
In reply to Greg Kroah-HartmanFrom: Hou Wenlong <[email protected]>
[ Upstream commit ca85f002258fdac3762c57d12d5e6e401b6a41af ]
Per Intel's SDM on the "Instruction Set Reference", when loading segment descriptor, not-present segment check should be after all type and privilege checks. But the emulator checks it first, then #NP is triggered instead of #GP if privilege fails and segment is not present. Put not-present segment check after type and privilege checks in __load_segment_descriptor().
Message-Id: <52573c01d369f506cadcf7233812427cf7db81a7.1644292363.git.houwenlong.hwl@antgroup.com>
--- arch/x86/kvm/emulate.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
arch/x86/kvm/emulate.c +9 -5
@@ -1718,11 +1718,6 @@ static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt, goto exception; } -if (!seg_desc.p) { - err_vec = (seg ==VCPU_SREG_SS ) ?SS_VECTOR :NP_VECTOR ; - goto exception; - } - dpl = seg_desc.dpl;switch (seg) {
@@ -1762,6 +1757,10 @@ static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt,case VCPU_SREG_TR :if (seg_desc.s || (seg_desc.type !=1 && seg_desc.type !=9 )) goto exception; +if (!seg_desc.p) { + err_vec =NP_VECTOR ; + goto exception; + } old_desc = seg_desc; seg_desc.type |=2 ;/* busy */ ret = ctxt->ops->cmpxchg_emulated(ctxt, desc_addr, &old_desc, &seg_desc,
@@ -1786,6 +1785,11 @@ static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt,break ; } +if (!seg_desc.p) { + err_vec = (seg ==VCPU_SREG_SS ) ?SS_VECTOR :NP_VECTOR ; + goto exception; + } +if (seg_desc.s) {/* mark segment as accessed */ if (!(seg_desc.type &1 )) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 335/599 hv_balloon: rate-limit "Unhandled message" warning
In reply to Greg Kroah-HartmanFrom: Anssi Hannula <[email protected]>
[ Upstream commit 1d7286729aa616772be334eb908e11f527e1e291 ]
For a couple of times I have encountered a situation where
hv_balloon: Unhandled message: type: 12447
is being flooded over 1 million times per second with various values, filling the log and consuming cycles, making debugging difficult.
Add rate limiting to the message.
Most other Hyper-V drivers already have similar rate limiting in their message callbacks.
The cause of the floods in my case was probably fixed by 96d9d1fa5cd5 ("Drivers: hv: balloon: account for vmbus packet header in max_pkt_size").
--- drivers/hv/hv_balloon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hv/hv_balloon.c +1 -1
@@ -1558,7 +1558,7 @@ static void balloon_onchannelcallback(void *context)break ;default : -pr_warn ("Unhandled message: type: %d\n" , dm_hdr->type); +pr_warn_ratelimited ("Unhandled message: type: %d\n" , dm_hdr->type); } }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 336/599 i2c: xiic: Make bus names unique
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
[ Upstream commit 1d366c2f9df8279df2adbb60471f86fc40a1c39e ]
This driver is for an FPGA logic core, so there can be arbitrarily many instances of the bus on a given system. Previously all of the I2C bus names were "xiic-i2c" which caused issues with lm_sensors when trying to map human-readable names to sensor inputs because it could not properly distinguish the busses, for example. Append the platform device name to the I2C bus name so it is unique between different instances.
--- drivers/i2c/busses/i2c-xiic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-xiic.c +2 -1
@@ -756,7 +756,6 @@ static const struct i2c_adapter_quirks xiic_quirks = {static const struct i2c_adapter xiic_adapter = { .owner =THIS_MODULE , - .name =DRIVER_NAME , .class =I2C_CLASS_DEPRECATED , .algo = &xiic_algorithm, .quirks = &xiic_quirks,
@@ -793,6 +792,8 @@ static int xiic_i2c_probe(struct platform_device *pdev)i2c_set_adapdata (&i2c->adap, i2c); i2c->adap.dev.parent = &pdev->dev; i2c->adap.dev.of_node = pdev->dev.of_node; +snprintf (i2c->adap.name,sizeof (i2c->adap.name), +DRIVER_NAME " %s" , pdev->name);mutex_init (&i2c->lock);init_waitqueue_head (&i2c->wait);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 337/599 power: supply: wm8350-power: Handle error for wm8350_register_irq
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit b0b14b5ba11bec56fad344a4a0b2e16449cc8b94 ]
As the potential failure of the wm8350_register_irq(), it should be better to check it and return error if fails. Also, use 'free_' in order to avoid same code.
--- drivers/power/supply/wm8350_power.c | 96 ++++++++++++++++++++++++----- 1 file changed, 82 insertions(+), 14 deletions(-)
drivers/power/supply/wm8350_power.c +82 -14
@@ -408,44 +408,112 @@ static const struct power_supply_desc wm8350_usb_desc = {* Initialisation *********************************************************************/ -static void wm8350_init_charger (struct wm8350 *wm8350) +static int wm8350_init_charger (struct wm8350 *wm8350) { +int ret; +/* register our interest in charger events */ -wm8350_register_irq (wm8350,WM8350_IRQ_CHG_BAT_HOT , + ret =wm8350_register_irq (wm8350,WM8350_IRQ_CHG_BAT_HOT , wm8350_charger_handler,0 ,"Battery hot" , wm8350); -wm8350_register_irq (wm8350,WM8350_IRQ_CHG_BAT_COLD , +if (ret) + goto err; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_CHG_BAT_COLD , wm8350_charger_handler,0 ,"Battery cold" , wm8350); -wm8350_register_irq (wm8350,WM8350_IRQ_CHG_BAT_FAIL , +if (ret) + goto free_chg_bat_hot; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_CHG_BAT_FAIL , wm8350_charger_handler,0 ,"Battery fail" , wm8350); -wm8350_register_irq (wm8350,WM8350_IRQ_CHG_TO , +if (ret) + goto free_chg_bat_cold; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_CHG_TO , wm8350_charger_handler,0 ,"Charger timeout" , wm8350); -wm8350_register_irq (wm8350,WM8350_IRQ_CHG_END , +if (ret) + goto free_chg_bat_fail; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_CHG_END , wm8350_charger_handler,0 ,"Charge end" , wm8350); -wm8350_register_irq (wm8350,WM8350_IRQ_CHG_START , +if (ret) + goto free_chg_to; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_CHG_START , wm8350_charger_handler,0 ,"Charge start" , wm8350); -wm8350_register_irq (wm8350,WM8350_IRQ_CHG_FAST_RDY , +if (ret) + goto free_chg_end; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_CHG_FAST_RDY , wm8350_charger_handler,0 ,"Fast charge ready" , wm8350); -wm8350_register_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_3P9 , +if (ret) + goto free_chg_start; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_3P9 , wm8350_charger_handler,0 ,"Battery <3.9V" , wm8350); -wm8350_register_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_3P1 , +if (ret) + goto free_chg_fast_rdy; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_3P1 , wm8350_charger_handler,0 ,"Battery <3.1V" , wm8350); -wm8350_register_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_2P85 , +if (ret) + goto free_chg_vbatt_lt_3p9; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_2P85 , wm8350_charger_handler,0 ,"Battery <2.85V" , wm8350); +if (ret) + goto free_chg_vbatt_lt_3p1;/* and supply change events */ -wm8350_register_irq (wm8350,WM8350_IRQ_EXT_USB_FB , + ret =wm8350_register_irq (wm8350,WM8350_IRQ_EXT_USB_FB , wm8350_charger_handler,0 ,"USB" , wm8350); -wm8350_register_irq (wm8350,WM8350_IRQ_EXT_WALL_FB , +if (ret) + goto free_chg_vbatt_lt_2p85; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_EXT_WALL_FB , wm8350_charger_handler,0 ,"Wall" , wm8350); -wm8350_register_irq (wm8350,WM8350_IRQ_EXT_BAT_FB , +if (ret) + goto free_ext_usb_fb; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_EXT_BAT_FB , wm8350_charger_handler,0 ,"Battery" , wm8350); +if (ret) + goto free_ext_wall_fb; + +return 0 ; + +free_ext_wall_fb: +wm8350_free_irq (wm8350,WM8350_IRQ_EXT_WALL_FB , wm8350); +free_ext_usb_fb: +wm8350_free_irq (wm8350,WM8350_IRQ_EXT_USB_FB , wm8350); +free_chg_vbatt_lt_2p85: +wm8350_free_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_2P85 , wm8350); +free_chg_vbatt_lt_3p1: +wm8350_free_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_3P1 , wm8350); +free_chg_vbatt_lt_3p9: +wm8350_free_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_3P9 , wm8350); +free_chg_fast_rdy: +wm8350_free_irq (wm8350,WM8350_IRQ_CHG_FAST_RDY , wm8350); +free_chg_start: +wm8350_free_irq (wm8350,WM8350_IRQ_CHG_START , wm8350); +free_chg_end: +wm8350_free_irq (wm8350,WM8350_IRQ_CHG_END , wm8350); +free_chg_to: +wm8350_free_irq (wm8350,WM8350_IRQ_CHG_TO , wm8350); +free_chg_bat_fail: +wm8350_free_irq (wm8350,WM8350_IRQ_CHG_BAT_FAIL , wm8350); +free_chg_bat_cold: +wm8350_free_irq (wm8350,WM8350_IRQ_CHG_BAT_COLD , wm8350); +free_chg_bat_hot: +wm8350_free_irq (wm8350,WM8350_IRQ_CHG_BAT_HOT , wm8350); +err: +return ret; }static void free_charger_irq (struct wm8350 *wm8350)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 338/599 power: supply: wm8350-power: Add missing free in free_charger_irq
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 6dee930f6f6776d1e5a7edf542c6863b47d9f078 ]
In free_charger_irq(), there is no free for 'WM8350_IRQ_CHG_FAST_RDY'. Therefore, it should be better to add it in order to avoid the memory leak.
--- drivers/power/supply/wm8350_power.c | 1 + 1 file changed, 1 insertion(+)
drivers/power/supply/wm8350_power.c +1 -0
@@ -524,6 +524,7 @@ static void free_charger_irq(struct wm8350 *wm8350)wm8350_free_irq (wm8350,WM8350_IRQ_CHG_TO , wm8350);wm8350_free_irq (wm8350,WM8350_IRQ_CHG_END , wm8350);wm8350_free_irq (wm8350,WM8350_IRQ_CHG_START , wm8350); +wm8350_free_irq (wm8350,WM8350_IRQ_CHG_FAST_RDY , wm8350);wm8350_free_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_3P9 , wm8350);wm8350_free_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_3P1 , wm8350);wm8350_free_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_2P85 , wm8350);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 339/599 IB/hfi1: Allow larger MTU without AIP
In reply to Greg Kroah-HartmanFrom: Mike Marciniszyn <[email protected]>
[ Upstream commit b135e324d7a2e7fa0a7ef925076136e799b79f44 ]
The AIP code signals the phys_mtu in the following query_port() fragment:
props->phys_mtu = HFI1_CAP_IS_KSET(AIP) ? hfi1_max_mtu : ib_mtu_enum_to_int(props->max_mtu);
Using the largest MTU possible should not depend on AIP.
Fix by unconditionally using the hfi1_max_mtu value.
--- drivers/infiniband/hw/hfi1/verbs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/infiniband/hw/hfi1/verbs.c +1 -2
@@ -1439,8 +1439,7 @@ static int query_port(struct rvt_dev_info *rdi, u8 port_num, 4096 : hfi1_max_mtu), IB_MTU_4096); props->active_mtu = !valid_ib_mtu (ppd->ibmtu) ? props->max_mtu :mtu_to_enum (ppd->ibmtu,IB_MTU_4096 ); - props->phys_mtu =HFI1_CAP_IS_KSET (AIP ) ? hfi1_max_mtu : -ib_mtu_enum_to_int (props->max_mtu); + props->phys_mtu = hfi1_max_mtu;return 0 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 340/599 PCI: Reduce warnings on possible RW1C corruption
In reply to Greg Kroah-HartmanFrom: Mark Tomlinson <[email protected]>
[ Upstream commit 92c45b63ce22c8898aa41806e8d6692bcd577510 ]
For hardware that only supports 32-bit writes to PCI there is the possibility of clearing RW1C (write-one-to-clear) bits. A rate-limited messages was introduced by fb2659230120, but rate-limiting is not the best choice here. Some devices may not show the warnings they should if another device has just produced a bunch of warnings. Also, the number of messages can be a nuisance on devices which are otherwise working fine.
Change the ratelimit to a single warning per bus. This ensures no bus is 'starved' of emitting a warning and also that there isn't a continuous stream of warnings. It would be preferable to have a warning per device, but the pci_dev structure is not available here, and a lookup from devfn would be far too slow.
--- drivers/pci/access.c | 9 ++++++--- include/linux/pci.h | 1 + 2 files changed, 7 insertions(+), 3 deletions(-)
drivers/pci/access.c +6 -3
@@ -160,9 +160,12 @@ int pci_generic_config_write32(struct pci_bus *bus, unsigned int devfn,* write happen to have any RW1C (write-one-to-clear) bits set, we * just inadvertently cleared something we shouldn't have. */ -dev_warn_ratelimited (&bus->dev,"%d-byte config write to %04x:%02x:%02x.%d offset %#x may corrupt adjacent RW1C bits\n" , - size,pci_domain_nr (bus), bus->number, -PCI_SLOT (devfn),PCI_FUNC (devfn), where); +if (!bus->unsafe_warn) { +dev_warn (&bus->dev,"%d-byte config write to %04x:%02x:%02x.%d offset %#x may corrupt adjacent RW1C bits\n" , + size,pci_domain_nr (bus), bus->number, +PCI_SLOT (devfn),PCI_FUNC (devfn), where); + bus->unsafe_warn =1 ; + } mask = ~(((1 << (size *8 )) -1 ) << ((where &0x3 ) *8 )); tmp =readl (addr) & mask;
include/linux/pci.h +1 -0
@@ -638,6 +638,7 @@ struct pci_bus {struct bin_attribute *legacy_io;/* Legacy I/O for this bus */ struct bin_attribute *legacy_mem;/* Legacy mem */ unsigned int is_added:1; + unsigned int unsafe_warn:1; /* warned about RW1C config write */ };#define to_pci_bus (n) container_of(n, struct pci_bus, dev)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 341/599 net: axienet: fix RX ring refill allocation failure handling
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
[ Upstream commit 7a7d340ba4d9351e4c8847b898a2b996727a922a ]
If a memory allocation error occurred during an attempt to refill a slot in the RX ring after the packet was received, the hardware tail pointer would still have been updated to point to or past the slot which remained marked as previously completed. This would likely result in the DMA engine raising an error when it eventually tried to use that slot again.
If a slot cannot be refilled, then just stop processing and do not move the tail pointer past it. On the next attempt, we should skip receiving the packet from the empty slot and just try to refill it again.
This failure mode has not actually been observed, but was found as part of other driver updates.
--- .../net/ethernet/xilinx/xilinx_axienet_main.c | 72 +++++++++++-------- 1 file changed, 42 insertions(+), 30 deletions(-)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +42 -30
@@ -857,46 +857,53 @@ static void axienet_recv(struct net_device *ndev)while ((cur_p->status &XAXIDMA_BD_STS_COMPLETE_MASK )) {dma_addr_t phys; - tail_p = lp->rx_bd_p +sizeof (*lp->rx_bd_v) * lp->rx_bd_ci; -/* Ensure we see complete descriptor update */ dma_rmb (); - phys =desc_get_phys_addr (lp, cur_p); -dma_unmap_single (ndev->dev.parent, phys, lp->max_frm_size, -DMA_FROM_DEVICE ); skb = cur_p->skb; cur_p->skb =NULL ; - length = cur_p->app4 &0x0000FFFF ; - -skb_put (skb, length); - skb->protocol =eth_type_trans (skb, ndev); -/*skb_checksum_none_assert(skb);*/ - skb->ip_summed =CHECKSUM_NONE ; - -/* if we're doing Rx csum offload, set it up */ -if (lp->features &XAE_FEATURE_FULL_RX_CSUM ) { - csumstatus = (cur_p->app2 & -XAE_FULL_CSUM_STATUS_MASK ) >>3 ; -if ((csumstatus ==XAE_IP_TCP_CSUM_VALIDATED ) || - (csumstatus ==XAE_IP_UDP_CSUM_VALIDATED )) { - skb->ip_summed =CHECKSUM_UNNECESSARY ; + +/* skb could be NULL if a previous pass already received the +* packet for this slot in the ring, but failed to refill it +* with a newly allocated buffer. In this case, don't try to +* receive it again. +*/ +if (likely (skb)) { + length = cur_p->app4 &0x0000FFFF ; + + phys =desc_get_phys_addr (lp, cur_p); +dma_unmap_single (ndev->dev.parent, phys, lp->max_frm_size, +DMA_FROM_DEVICE ); + +skb_put (skb, length); + skb->protocol =eth_type_trans (skb, ndev); +/*skb_checksum_none_assert(skb);*/ + skb->ip_summed =CHECKSUM_NONE ; + +/* if we're doing Rx csum offload, set it up */ +if (lp->features &XAE_FEATURE_FULL_RX_CSUM ) { + csumstatus = (cur_p->app2 & +XAE_FULL_CSUM_STATUS_MASK ) >>3 ; +if (csumstatus ==XAE_IP_TCP_CSUM_VALIDATED || + csumstatus ==XAE_IP_UDP_CSUM_VALIDATED ) { + skb->ip_summed =CHECKSUM_UNNECESSARY ; + } + }else if ((lp->features &XAE_FEATURE_PARTIAL_RX_CSUM ) !=0 && + skb->protocol ==htons (ETH_P_IP ) && + skb->len >64 ) { + skb->csum =be32_to_cpu (cur_p->app3 &0xFFFF ); + skb->ip_summed =CHECKSUM_COMPLETE ; } - }else if ((lp->features &XAE_FEATURE_PARTIAL_RX_CSUM ) !=0 && - skb->protocol ==htons (ETH_P_IP ) && - skb->len >64 ) { - skb->csum =be32_to_cpu (cur_p->app3 &0xFFFF ); - skb->ip_summed =CHECKSUM_COMPLETE ; - } -netif_rx (skb); +netif_rx (skb); - size += length; - packets++; + size += length; + packets++; + } new_skb =netdev_alloc_skb_ip_align (ndev, lp->max_frm_size);if (!new_skb) -return ; +break ; phys = dma_map_single(ndev->dev.parent, new_skb->data, lp->max_frm_size,
@@ -905,7 +912,7 @@ static void axienet_recv(struct net_device *ndev)if (net_ratelimit ())netdev_err (ndev,"RX DMA mapping error\n" );dev_kfree_skb (new_skb); -return ; +break ; }desc_set_phys_addr (lp, phys, cur_p);
@@ -913,6 +920,11 @@ static void axienet_recv(struct net_device *ndev) cur_p->status =0 ; cur_p->skb = new_skb; +/* Only update tail_p to mark this slot as usable after it has +* been successfully refilled. +*/ + tail_p = lp->rx_bd_p +sizeof (*lp->rx_bd_v) * lp->rx_bd_ci; +if (++lp->rx_bd_ci >= lp->rx_bd_num) lp->rx_bd_ci =0 ; cur_p = &lp->rx_bd_v[lp->rx_bd_ci];
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 342/599 mips: DEC: honor CONFIG_MIPS_FP_SUPPORT=n
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 97bf0395c226907e1a9b908511a35192bf1e09bb ]
Include the DECstation interrupt handler in opting out of FPU support.
Fixes a linker error:
mips-linux-ld: arch/mips/dec/int-handler.o: in function `fpu':
(.text+0x148): undefined reference to `handle_fpe_int'
--- arch/mips/dec/int-handler.S | 6 +++--- arch/mips/dec/setup.c | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-)
arch/mips/dec/int-handler.S +3 -3
@@ -131,7 +131,7 @@ */ mfc0 t0,CP0_CAUSE # get pending interrupts mfc0 t1,CP0_STATUS -#ifdef CONFIG_32BIT +#if defined(CONFIG_32BIT) && defined(CONFIG_MIPS_FP_SUPPORT) lw t2,cpu_fpu_mask #endif andi t0,ST0_IM # CAUSE.CE may be non-zero!
@@ -139,7 +139,7 @@ beqz t0,spurious -#ifdef CONFIG_32BIT +#if defined(CONFIG_32BIT) && defined(CONFIG_MIPS_FP_SUPPORT) and t2,t0 bnez t2,fpu # handle FPU immediately #endif
@@ -280,7 +280,7 @@ handle_it: j dec_irq_dispatch nop -#ifdef CONFIG_32BIT +#if defined(CONFIG_32BIT) && defined(CONFIG_MIPS_FP_SUPPORT) fpu: lw t0,fpu_kstat_irq nop
arch/mips/dec/setup.c +2 -1
@@ -746,7 +746,8 @@ void __init arch_init_irq(void) dec_interrupt[DEC_IRQ_HALT ] =-1 ;/* Register board interrupts: FPU and cascade. */ -if (dec_interrupt[DEC_IRQ_FPU ] >=0 && cpu_has_fpu) { +if (IS_ENABLED (CONFIG_MIPS_FP_SUPPORT ) && + dec_interrupt[DEC_IRQ_FPU ] >=0 && cpu_has_fpu) {struct irq_desc *desc_fpu;int irq_fpu;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 343/599 powerpc/sysdev: fix incorrect use to determine if list is empty
In reply to Greg Kroah-HartmanFrom: Jakob Koschel <[email protected]>
[ Upstream commit fa1321b11bd01752f5be2415e74a0e1a7c378262 ]
'gtm' will *always* be set by list_for_each_entry().
It is incorrect to assume that the iterator value will be NULL if the list is empty.
Instead of checking the pointer it should be checked if the list is empty.
--- arch/powerpc/sysdev/fsl_gtm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/sysdev/fsl_gtm.c +2 -2
@@ -86,7 +86,7 @@ static LIST_HEAD(gtms);*/ struct gtm_timer *gtm_get_timer16 (void ) { -struct gtm *gtm =NULL ; +struct gtm *gtm;int i;list_for_each_entry (gtm, >ms, list_node) {
@@ -103,7 +103,7 @@ struct gtm_timer *gtm_get_timer16(void)spin_unlock_irq (>m->lock); } -if (gtm) +if (!list_empty (>ms))return ERR_PTR (-EBUSY );return ERR_PTR (-ENODEV ); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 344/599 mfd: mc13xxx: Add check for mc13xxx_irq_request
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit e477e51a41cb5d6034f3c5ea85a71ad4613996b9 ]
As the potential failure of the devm_request_threaded_irq(), it should be better to check the return value of the mc13xxx_irq_request() and return error if fails.
--- drivers/mfd/mc13xxx-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mfd/mc13xxx-core.c +3 -1
@@ -323,8 +323,10 @@ int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx, unsigned int mode, adc1 |=MC13783_ADC1_ATOX ;dev_dbg (mc13xxx->dev,"%s: request irq\n" , __func__); -mc13xxx_irq_request (mc13xxx,MC13XXX_IRQ_ADCDONE , + ret =mc13xxx_irq_request (mc13xxx,MC13XXX_IRQ_ADCDONE , mc13xxx_handler_adcdone, __func__, &adcdone_data); +if (ret) + goto out;mc13xxx_reg_write (mc13xxx,MC13XXX_ADC0 , adc0);mc13xxx_reg_write (mc13xxx,MC13XXX_ADC1 , adc1);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 345/599 libbpf: Unmap rings when umem deleted
In reply to Greg Kroah-HartmanFrom: lic121 <[email protected]>
[ Upstream commit 9c6e6a80ee741adf6cb3cfd8eef7d1554f91fceb ]
xsk_umem__create() does mmap for fill/comp rings, but xsk_umem__delete() doesn't do the unmap. This works fine for regular cases, because xsk_socket__delete() does unmap for the rings. But for the case that xsk_socket__create_shared() fails, umem rings are not unmapped.
fill_save/comp_save are checked to determine if rings have already be unmapped by xsk. If fill_save and comp_save are NULL, it means that the rings have already been used by xsk. Then they are supposed to be unmapped by xsk_socket__delete(). Otherwise, xsk_umem__delete() does the unmap.
--- tools/lib/bpf/xsk.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
tools/lib/bpf/xsk.c +11 -0
@@ -895,12 +895,23 @@ int xsk_socket__create(struct xsk_socket **xsk_ptr, const char *ifname,int xsk_umem__delete (struct xsk_umem *umem) { +struct xdp_mmap_offsets off; +int err; +if (!umem)return 0 ;if (umem->refcount)return -EBUSY ; + err =xsk_get_mmap_offsets (umem->fd, &off); +if (!err && umem->fill_save && umem->comp_save) { +munmap (umem->fill_save->ring - off.fr.desc, + off.fr.desc + umem->config.fill_size *sizeof (__u64)); +munmap (umem->comp_save->ring - off.cr.desc, + off.cr.desc + umem->config.comp_size *sizeof (__u64)); + } +close (umem->fd);free (umem);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 346/599 selftests/bpf: Make test_lwt_ip_encap more stable and faster
In reply to Greg Kroah-HartmanFrom: Felix Maurer <[email protected]>
[ Upstream commit d23a8720327d33616f584d76c80824bfa4699be6 ]
In test_lwt_ip_encap, the ingress IPv6 encap test failed from time to time. The failure occured when an IPv4 ping through the IPv6 GRE encapsulation did not receive a reply within the timeout. The IPv4 ping and the IPv6 ping in the test used different timeouts (1 sec for IPv4 and 6 sec for IPv6), probably taking into account that IPv6 might need longer to successfully complete. However, when IPv4 pings (with the short timeout) are encapsulated into the IPv6 tunnel, the delays of IPv6 apply.
The actual reason for the long delays with IPv6 was that the IPv6 neighbor discovery sometimes did not complete in time. This was caused by the outgoing interface only having a tentative link local address, i.e., not having completed DAD for that lladdr. The ND was successfully retried after 1 sec but that was too late for the ping timeout.
The IPv6 addresses for the test were already added with nodad. However, for the lladdrs, DAD was still performed. We now disable DAD in the test netns completely and just assume that the two lladdrs on each veth pair do not collide. This removes all the delays for IPv6 traffic in the test.
Without the delays, we can now also reduce the delay of the IPv6 ping to 1 sec. This makes the whole test complete faster because we don't need to wait for the excessive timeout for each IPv6 ping that is supposed to fail.
--- tools/testing/selftests/bpf/test_lwt_ip_encap.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
tools/testing/selftests/bpf/test_lwt_ip_encap.sh +9 -1
@@ -120,6 +120,14 @@ setup() ip netns exec ${NS2} sysctl -wq net.ipv4.conf.default.rp_filter=0 ip netns exec ${NS3} sysctl -wq net.ipv4.conf.default.rp_filter=0 + # disable IPv6 DAD because it sometimes takes too long and fails tests + ip netns exec ${NS1} sysctl -wq net.ipv6.conf.all.accept_dad=0 + ip netns exec ${NS2} sysctl -wq net.ipv6.conf.all.accept_dad=0 + ip netns exec ${NS3} sysctl -wq net.ipv6.conf.all.accept_dad=0 + ip netns exec ${NS1} sysctl -wq net.ipv6.conf.default.accept_dad=0 + ip netns exec ${NS2} sysctl -wq net.ipv6.conf.default.accept_dad=0 + ip netns exec ${NS3} sysctl -wq net.ipv6.conf.default.accept_dad=0 + ip link add veth1 type veth peer name veth2 ip link add veth3 type veth peer name veth4 ip link add veth5 type veth peer name veth6
@@ -289,7 +297,7 @@ test_ping() ip netns exec ${NS1} ping -c 1 -W 1 -I veth1 ${IPv4_DST} 2>&1 > /dev/null RET=$? elif [ "${PROTO}" == "IPv6" ] ; then - ip netns exec ${NS1} ping6 -c 1 -W 6 -I veth1 ${IPv6_DST} 2>&1 > /dev/null + ip netns exec ${NS1} ping6 -c 1 -W 1 -I veth1 ${IPv6_DST} 2>&1 > /dev/null RET=$? else echo " test_ping: unknown PROTO: ${PROTO}"
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 347/599 platform/x86: huawei-wmi: check the return value of device_create_file()
In reply to Greg Kroah-HartmanFrom: Jia-Ju Bai <[email protected]>
[ Upstream commit c91a5b1c221a58d008485cf7d02ccce73108b119 ]
The function device_create_file() in huawei_wmi_battery_add() can fail, so its return value should be checked.
--- drivers/platform/x86/huawei-wmi.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/platform/x86/huawei-wmi.c +10 -3
@@ -470,10 +470,17 @@ static DEVICE_ATTR_RW(charge_control_thresholds);static int huawei_wmi_battery_add (struct power_supply *battery) { -device_create_file (&battery->dev, &dev_attr_charge_control_start_threshold); -device_create_file (&battery->dev, &dev_attr_charge_control_end_threshold); +int err =0 ; -return 0 ; + err =device_create_file (&battery->dev, &dev_attr_charge_control_start_threshold); +if (err) +return err; + + err =device_create_file (&battery->dev, &dev_attr_charge_control_end_threshold); +if (err) +device_remove_file (&battery->dev, &dev_attr_charge_control_start_threshold); + +return err; }static int huawei_wmi_battery_remove (struct power_supply *battery)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 348/599 powerpc: 8xx: fix a return value error in mpc8xx_pic_init
In reply to Greg Kroah-HartmanFrom: Hangyu Hua <[email protected]>
[ Upstream commit 3fd46e551f67f4303c3276a0d6cd20baf2d192c4 ]
mpc8xx_pic_init() should return -ENOMEM instead of 0 when irq_domain_add_linear() return NULL. This cause mpc8xx_pics_init to continue executing even if mpc8xx_pic_host is NULL.
--- arch/powerpc/platforms/8xx/pic.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/platforms/8xx/pic.c +1 -0
@@ -153,6 +153,7 @@ int __init mpc8xx_pic_init(void)if (mpc8xx_pic_host ==NULL ) {printk (KERN_ERR "MPC8xx PIC: failed to allocate irq host!\n" ); ret = -ENOMEM ; + goto out; } ret =0 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 349/599 vxcan: enable local echo for sent CAN frames
In reply to Greg Kroah-HartmanFrom: Oliver Hartkopp <[email protected]>
[ Upstream commit 259bdba27e32368b4404f69d613b1c1014c07cbf ]
The vxcan driver provides a pair of virtual CAN interfaces to exchange CAN traffic between different namespaces - analogue to veth.
In opposite to the vcan driver the local sent CAN traffic on this interface is not echo'ed back but only sent to the remote peer. This is unusual and can be easily fixed by removing IFF_ECHO from the netdevice flags that are set for vxcan interfaces by default at startup.
Without IFF_ECHO set on driver level, the local sent CAN frames are echo'ed in af_can.c in can_send(). This patch makes vxcan interfaces adopt the same local echo behavior and procedures as known from the vcan interfaces.
--- drivers/net/can/vxcan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/vxcan.c +1 -1
@@ -148,7 +148,7 @@ static void vxcan_setup(struct net_device *dev) dev->hard_header_len =0 ; dev->addr_len =0 ; dev->tx_queue_len =0 ; - dev->flags = (IFF_NOARP |IFF_ECHO ); + dev->flags =IFF_NOARP ; dev->netdev_ops = &vxcan_netdev_ops; dev->needs_free_netdev = true;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 350/599 ath10k: Fix error handling in ath10k_setup_msa_resources
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 9747a78d5f758a5284751a10aee13c30d02bd5f1 ]
The device_node pointer is returned by of_parse_phandle() with refcount incremented. We should use of_node_put() on it when done.
This function only calls of_node_put() in the regular path. And it will cause refcount leak in error path.
--- drivers/net/wireless/ath/ath10k/snoc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/snoc.c +1 -1
@@ -1477,11 +1477,11 @@ static int ath10k_setup_msa_resources(struct ath10k *ar, u32 msa_size) node =of_parse_phandle (dev->of_node,"memory-region" ,0 );if (node) { ret =of_address_to_resource (node,0 , &r); +of_node_put (node);if (ret) {dev_err (dev,"failed to resolve msa fixed region\n" );return ret; } -of_node_put (node); ar->msa.paddr = r.start; ar->msa.mem_size =resource_size (&r);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 351/599 mips: cdmm: Fix refcount leak in mips_cdmm_phys_base
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 4528668ca331f7ce5999b7746657b46db5b3b785 ]
The of_find_compatible_node() function returns a node pointer with refcount incremented, We should use of_node_put() on it when done Add the missing of_node_put() to release the refcount.
--- drivers/bus/mips_cdmm.c | 1 + 1 file changed, 1 insertion(+)
drivers/bus/mips_cdmm.c +1 -0
@@ -351,6 +351,7 @@ phys_addr_t __weak mips_cdmm_phys_base(void) np =of_find_compatible_node (NULL ,NULL ,"mti,mips-cdmm" );if (np) { err =of_address_to_resource (np,0 , &res); +of_node_put (np);if (!err)return res.start; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 352/599 MIPS: RB532: fix return value of __setup handler
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 8755d57ba1ff910666572fab9e32890e8cc6ed3b ]
__setup() handlers should return 1 to obsolete_checksetup() in init/main.c to indicate that the boot option has been handled. A return of 0 causes the boot option/value to be listed as an Unknown kernel parameter and added to init's (limited) argument or environment strings. Also, error return codes don't mean anything to obsolete_checksetup() -- only non-zero (usually 1) or zero. So return 1 from setup_kmac().
From: Igor Zhbanov <[email protected]>
--- arch/mips/rb532/devices.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
arch/mips/rb532/devices.c +2 -4
@@ -310,11 +310,9 @@ static int __init plat_setup_devices(void)static int __init setup_kmac (char *s) {printk (KERN_INFO "korina mac = %s\n" , s); -if (!mac_pton (s, korina_dev0_data.mac)) { +if (!mac_pton (s, korina_dev0_data.mac))printk (KERN_ERR "Invalid mac\n" ); -return -EINVAL ; - } -return 0 ; +return 1 ; }__setup ("kmac=" , setup_kmac);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 353/599 MIPS: pgalloc: fix memory leak caused by pgd_free()
In reply to Greg Kroah-HartmanFrom: Yaliang Wang <[email protected]>
[ Upstream commit 2bc5bab9a763d520937e4f3fe8df51c6a1eceb97 ]
pgd page is freed by generic implementation pgd_free() since commit f9cb654cb550 ("asm-generic: pgalloc: provide generic pgd_free()"), however, there are scenarios that the system uses more than one page as the pgd table, in such cases the generic implementation pgd_free() won't be applicable anymore. For example, when PAGE_SIZE_4KB is enabled and MIPS_VA_BITS_48 is not enabled in a 64bit system, the macro "PGD_ORDER" will be set as "1", which will cause allocating two pages as the pgd table. Well, at the same time, the generic implementation pgd_free() just free one pgd page, which will result in the memory leak.
The memory leak can be easily detected by executing shell command:
"while true; do ls > /dev/null; grep MemFree /proc/meminfo; done"
--- arch/mips/include/asm/pgalloc.h | 6 ++++++ 1 file changed, 6 insertions(+)
arch/mips/include/asm/pgalloc.h +6 -0
@@ -15,6 +15,7 @@#define __HAVE_ARCH_PMD_ALLOC_ONE#define __HAVE_ARCH_PUD_ALLOC_ONE +#define __HAVE_ARCH_PGD_FREE#include <asm-generic/pgalloc.h> static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
@@ -49,6 +50,11 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)extern void pgd_init (unsigned long page);extern pgd_t *pgd_alloc (struct mm_struct *mm); +static inline void pgd_free (struct mm_struct *mm,pgd_t *pgd) +{ +free_pages ((unsigned long )pgd,PGD_ORDER ); +} +#define __pte_free_tlb (tlb,pte,address) \ do { \ pgtable_pte_page_dtor(pte); \
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 354/599 mtd: rawnand: atmel: fix refcount issue in atmel_nand_controller_init
In reply to Greg Kroah-HartmanFrom: Xin Xiong <[email protected]>
[ Upstream commit fecbd4a317c95d73c849648c406bcf1b6a0ec1cf ]
The reference counting issue happens in several error handling paths on a refcounted object "nc->dmac". In these paths, the function simply returns the error code, forgetting to balance the reference count of "nc->dmac", increased earlier by dma_request_channel(), which may cause refcount leaks.
Fix it by decrementing the refcount of specific object in those error paths.
--- drivers/mtd/nand/raw/atmel/nand-controller.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/mtd/nand/raw/atmel/nand-controller.c +11 -3
@@ -2057,13 +2057,15 @@ static int atmel_nand_controller_init(struct atmel_nand_controller *nc, nc->mck =of_clk_get (dev->parent->of_node,0 );if (IS_ERR (nc->mck)) {dev_err (dev,"Failed to retrieve MCK clk\n" ); -return PTR_ERR (nc->mck); + ret =PTR_ERR (nc->mck); + goto out_release_dma; } np =of_parse_phandle (dev->parent->of_node,"atmel,smc" ,0 );if (!np) {dev_err (dev,"Missing or invalid atmel,smc property\n" ); -return -EINVAL ; + ret = -EINVAL ; + goto out_release_dma; } nc->smc =syscon_node_to_regmap (np);
@@ -2071,10 +2073,16 @@ static int atmel_nand_controller_init(struct atmel_nand_controller *nc,if (IS_ERR (nc->smc)) { ret =PTR_ERR (nc->smc);dev_err (dev,"Could not get SMC regmap (err = %d)\n" , ret); -return ret; + goto out_release_dma; }return 0 ; + +out_release_dma: +if (nc->dmac) +dma_release_channel (nc->dmac); + +return ret; } static int
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 355/599 RDMA/mlx5: Fix memory leak in error flow for subscribe event routine
In reply to Greg Kroah-HartmanFrom: Yongzhi Liu <[email protected]>
[ Upstream commit 087f9c3f2309ed183f7e4b85ae57121d8663224d ]
In case the second xa_insert() fails, the obj_event is not released. Fix the error unwind flow to free that memory to avoid a memory leak.
--- drivers/infiniband/hw/mlx5/devx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/devx.c +3 -1
@@ -1792,8 +1792,10 @@ subscribe_event_xa_alloc(struct mlx5_devx_event_table *devx_event_table, key_level2, obj_event, GFP_KERNEL); -if (err) +if (err) { +kfree (obj_event);return err; + }INIT_LIST_HEAD (&obj_event->obj_sub_list); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 356/599 bpf, sockmap: Fix memleak in tcp_bpf_sendmsg while sk msg is full
In reply to Greg Kroah-HartmanFrom: Wang Yufen <[email protected]>
[ Upstream commit 9c34e38c4a870eb30b13f42f5b44f42e9d19ccb8 ]
If tcp_bpf_sendmsg() is running while sk msg is full. When sk_msg_alloc() returns -ENOMEM error, tcp_bpf_sendmsg() goes to wait_for_memory. If partial memory has been alloced by sk_msg_alloc(), that is, msg_tx->sg.size is greater than osize after sk_msg_alloc(), memleak occurs. To fix we use sk_msg_trim() to release the allocated memory, then goto wait for memory.
Other call paths of sk_msg_alloc() have the similar issue, such as tls_sw_sendmsg(), so handle sk_msg_trim logic inside sk_msg_alloc(), as Cong Wang suggested.
This issue can cause the following info:
WARNING: CPU: 3 PID: 7950 at net/core/stream.c:208 sk_stream_kill_queues+0xd4/0x1a0 Call Trace: <TASK> inet_csk_destroy_sock+0x55/0x110 __tcp_close+0x279/0x470 tcp_close+0x1f/0x60 inet_release+0x3f/0x80 __sock_release+0x3d/0xb0 sock_close+0x11/0x20 __fput+0x92/0x250 task_work_run+0x6a/0xa0 do_exit+0x33b/0xb60 do_group_exit+0x2f/0xa0 get_signal+0xb6/0x950 arch_do_signal_or_restart+0xac/0x2a0 exit_to_user_mode_prepare+0xa9/0x200 syscall_exit_to_user_mode+0x12/0x30 do_syscall_64+0x46/0x80 entry_SYSCALL_64_after_hwframe+0x44/0xae </TASK> WARNING: CPU: 3 PID: 2094 at net/ipv4/af_inet.c:155 inet_sock_destruct+0x13c/0x260 Call Trace: <TASK> __sk_destruct+0x24/0x1f0 sk_psock_destroy+0x19b/0x1c0 process_one_work+0x1b3/0x3c0 kthread+0xe6/0x110 ret_from_fork+0x22/0x30 </TASK>
--- net/core/skmsg.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
net/core/skmsg.c +13 -4
@@ -27,6 +27,7 @@ int sk_msg_alloc(struct sock *sk, struct sk_msg *msg, int len, int elem_first_coalesce) {struct page_frag *pfrag =sk_page_frag (sk); +u32 osize = msg->sg.size;int ret =0 ; len -= msg->sg.size;
@@ -35,13 +36,17 @@ int sk_msg_alloc(struct sock *sk, struct sk_msg *msg, int len,u32 orig_offset;int use, i; -if (!sk_page_frag_refill (sk, pfrag)) -return -ENOMEM ; +if (!sk_page_frag_refill (sk, pfrag)) { + ret = -ENOMEM ; + goto msg_trim; + } orig_offset = pfrag->offset; use =min_t (int, len, pfrag->size - orig_offset); -if (!sk_wmem_schedule (sk, use)) -return -ENOMEM ; +if (!sk_wmem_schedule (sk, use)) { + ret = -ENOMEM ; + goto msg_trim; + } i = msg->sg.end;sk_msg_iter_var_prev (i);
@@ -71,6 +76,10 @@ int sk_msg_alloc(struct sock *sk, struct sk_msg *msg, int len, }return ret; + +msg_trim: +sk_msg_trim (sk, msg, osize); +return ret; }EXPORT_SYMBOL_GPL (sk_msg_alloc);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 357/599 bpf, sockmap: Fix more uncharged while msg has more_data
In reply to Greg Kroah-HartmanFrom: Wang Yufen <[email protected]>
[ Upstream commit 84472b436e760ba439e1969a9e3c5ae7c86de39d ]
In tcp_bpf_send_verdict(), if msg has more data after tcp_bpf_sendmsg_redir():
tcp_bpf_send_verdict()
tosend = msg->sg.size //msg->sg.size = 22220
case __SK_REDIRECT:
sk_msg_return() //uncharged msg->sg.size(22220) sk->sk_forward_alloc tcp_bpf_sendmsg_redir() //after tcp_bpf_sendmsg_redir, msg->sg.size=11000
goto more_data;
tosend = msg->sg.size //msg->sg.size = 11000
case __SK_REDIRECT:
sk_msg_return() //uncharged msg->sg.size(11000) to sk->sk_forward_alloc
The msg->sg.size(11000) has been uncharged twice, to fix we can charge the remaining msg->sg.size before goto more data.
This issue can cause the following info:
WARNING: CPU: 0 PID: 9860 at net/core/stream.c:208 sk_stream_kill_queues+0xd4/0x1a0 Call Trace: <TASK> inet_csk_destroy_sock+0x55/0x110 __tcp_close+0x279/0x470 tcp_close+0x1f/0x60 inet_release+0x3f/0x80 __sock_release+0x3d/0xb0 sock_close+0x11/0x20 __fput+0x92/0x250 task_work_run+0x6a/0xa0 do_exit+0x33b/0xb60 do_group_exit+0x2f/0xa0 get_signal+0xb6/0x950 arch_do_signal_or_restart+0xac/0x2a0 ? vfs_write+0x237/0x290 exit_to_user_mode_prepare+0xa9/0x200 syscall_exit_to_user_mode+0x12/0x30 do_syscall_64+0x46/0x80 entry_SYSCALL_64_after_hwframe+0x44/0xae </TASK> WARNING: CPU: 0 PID: 2136 at net/ipv4/af_inet.c:155 inet_sock_destruct+0x13c/0x260 Call Trace: <TASK> __sk_destruct+0x24/0x1f0 sk_psock_destroy+0x19b/0x1c0 process_one_work+0x1b3/0x3c0 worker_thread+0x30/0x350 ? process_one_work+0x3c0/0x3c0 kthread+0xe6/0x110 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x22/0x30 </TASK>
--- net/ipv4/tcp_bpf.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
net/ipv4/tcp_bpf.c +5 -2
@@ -371,7 +371,7 @@ static int tcp_bpf_send_verdict(struct sock *sk, struct sk_psock *psock, cork = true; psock->cork =NULL ; } -sk_msg_return (sk, msg, tosend); +sk_msg_return (sk, msg, msg->sg.size);release_sock (sk); ret =tcp_bpf_sendmsg_redir (sk_redir, msg, tosend, flags);
@@ -411,8 +411,11 @@ static int tcp_bpf_send_verdict(struct sock *sk, struct sk_psock *psock, }if (msg && msg->sg.data[msg->sg.start].page_link && - msg->sg.data[msg->sg.start].length) + msg->sg.data[msg->sg.start].length) { +if (eval == __SK_REDIRECT) +sk_mem_charge (sk, msg->sg.size); goto more_data; + } }return ret; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 358/599 bpf, sockmap: Fix double uncharge the mem of sk_msg
In reply to Greg Kroah-HartmanFrom: Wang Yufen <[email protected]>
[ Upstream commit 2486ab434b2c2a14e9237296db00b1e1b7ae3273 ]
If tcp_bpf_sendmsg is running during a tear down operation, psock may be freed.
tcp_bpf_sendmsg()
tcp_bpf_send_verdict()
sk_msg_return()
tcp_bpf_sendmsg_redir()
unlikely(!psock))
sk_msg_free()
The mem of msg has been uncharged in tcp_bpf_send_verdict() by sk_msg_return(), and would be uncharged by sk_msg_free() again. When psock is null, we can simply returning an error code, this would then trigger the sk_msg_free_nocharge in the error path of __SK_REDIRECT and would have the side effect of throwing an error up to user space. This would be a slight change in behavior from user side but would look the same as an error if the redirect on the socket threw an error.
This issue can cause the following info:
WARNING: CPU: 0 PID: 2136 at net/ipv4/af_inet.c:155 inet_sock_destruct+0x13c/0x260 Call Trace: <TASK> __sk_destruct+0x24/0x1f0 sk_psock_destroy+0x19b/0x1c0 process_one_work+0x1b3/0x3c0 worker_thread+0x30/0x350 ? process_one_work+0x3c0/0x3c0 kthread+0xe6/0x110 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x22/0x30 </TASK>
--- net/ipv4/tcp_bpf.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
net/ipv4/tcp_bpf.c +3 -4
@@ -218,10 +218,9 @@ int tcp_bpf_sendmsg_redir(struct sock *sk, struct sk_msg *msg,struct sk_psock *psock =sk_psock_get (sk);int ret; -if (unlikely (!psock)) { -sk_msg_free (sk, msg); -return 0 ; - } +if (unlikely (!psock)) +return -EPIPE ; + ret = ingress ?bpf_tcp_ingress (sk, psock, msg, bytes, flags) :tcp_bpf_push_locked (sk, msg, bytes, flags, false);sk_psock_put (sk, psock);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 359/599 samples/bpf, xdpsock: Fix race when running for fix duration of time
In reply to Greg Kroah-HartmanFrom: Niklas Söderlund <[email protected]>
[ Upstream commit 8fa42d78f6354bb96ad3a079dcbef528ca9fa9e0 ]
When running xdpsock for a fix duration of time before terminating using --duration=<n>, there is a race condition that may cause xdpsock to terminate immediately.
When running for a fixed duration of time the check to determine when to terminate execution is in is_benchmark_done() and is being executed in the context of the poller thread,
if (opt_duration > 0) {
unsigned long dt = (get_nsecs() - start_time);
if (dt >= opt_duration)
benchmark_done = true;
}However start_time is only set after the poller thread have been created. This leaves a small window when the poller thread is starting and calls is_benchmark_done() for the first time that start_time is not yet set. In that case start_time have its initial value of 0 and the duration check fails as it do not correlate correctly for the applications start time and immediately sets benchmark_done which in turn terminates the xdpsock application.
Fix this by setting start_time before creating the poller thread.
--- samples/bpf/xdpsock_user.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
samples/bpf/xdpsock_user.c +3 -2
@@ -1520,14 +1520,15 @@ int main(int argc, char **argv)setlocale (LC_ALL ,"" ); + prev_time =get_nsecs (); + start_time = prev_time; +if (!opt_quiet) { ret =pthread_create (&pt,NULL , poller,NULL );if (ret)exit_with_error (ret); } - prev_time =get_nsecs (); - start_time = prev_time;if (opt_bench ==BENCH_RXDROP )rx_drop_all ();
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 360/599 USB: storage: ums-realtek: fix error code in rts51x_read_mem()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit b07cabb8361dc692522538205552b1b9dab134be ]
The rts51x_read_mem() function should return negative error codes. Currently if the kmalloc() fails it returns USB_STOR_TRANSPORT_ERROR (3) which is treated as success by the callers.
--- drivers/usb/storage/realtek_cr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/storage/realtek_cr.c +1 -1
@@ -365,7 +365,7 @@ static int rts51x_read_mem(struct us_data *us, u16 addr, u8 *data, u16 len) buf =kmalloc (len,GFP_NOIO );if (buf ==NULL ) -return USB_STOR_TRANSPORT_ERROR ; +return -ENOMEM ;usb_stor_dbg (us,"addr = 0x%x, len = %d\n" , addr, len);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 361/599 can: isotp: return -EADDRNOTAVAIL when reading from unbound socket
In reply to Greg Kroah-HartmanFrom: Oliver Hartkopp <[email protected]>
[ Upstream commit 30ffd5332e06316bd69a654c06aa033872979b7c ]
When reading from an unbound can-isotp socket the syscall blocked indefinitely. As unbound sockets (without given CAN address information) do not make sense anyway we directly return -EADDRNOTAVAIL on read() analogue to the known behavior from sendmsg().
--- net/can/isotp.c | 4 ++++ 1 file changed, 4 insertions(+)
net/can/isotp.c +4 -0
@@ -1003,12 +1003,16 @@ static int isotp_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, {struct sock *sk = sock->sk;struct sk_buff *skb; +struct isotp_sock *so =isotp_sk (sk);int err =0 ;int noblock; noblock = flags &MSG_DONTWAIT ; flags &= ~MSG_DONTWAIT ; +if (!so->bound) +return -EADDRNOTAVAIL ; + skb =skb_recv_datagram (sk, flags, noblock, &err);if (!skb)return err;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 362/599 can: isotp: support MSG_TRUNC flag when reading from socket
In reply to Greg Kroah-HartmanFrom: Oliver Hartkopp <[email protected]>
[ Upstream commit 42bf50a1795a1854d48717b7361dbdbce496b16b ]
When providing the MSG_TRUNC flag via recvmsg() syscall the return value provides the real length of the packet or datagram, even when it was longer than the passed buffer.
--- net/can/isotp.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-)
net/can/isotp.c +15 -12
@@ -1004,29 +1004,28 @@ static int isotp_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,struct sock *sk = sock->sk;struct sk_buff *skb;struct isotp_sock *so =isotp_sk (sk); -int err =0 ; -int noblock; +int noblock = flags &MSG_DONTWAIT ; +int ret =0 ; - noblock = flags &MSG_DONTWAIT ; - flags &= ~MSG_DONTWAIT ; +if (flags & ~(MSG_DONTWAIT |MSG_TRUNC )) +return -EINVAL ;if (!so->bound)return -EADDRNOTAVAIL ; - skb =skb_recv_datagram (sk, flags, noblock, &err); + flags &= ~MSG_DONTWAIT ; + skb =skb_recv_datagram (sk, flags, noblock, &ret);if (!skb) -return err; +return ret;if (size < skb->len) msg->msg_flags |=MSG_TRUNC ;else size = skb->len; - err =memcpy_to_msg (msg, skb->data, size); -if (err <0 ) { -skb_free_datagram (sk, skb); -return err; - } + ret =memcpy_to_msg (msg, skb->data, size); +if (ret <0 ) + goto out_err;sock_recv_timestamp (msg, sk, skb);
@@ -1036,9 +1035,13 @@ static int isotp_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,memcpy (msg->msg_name, skb->cb, msg->msg_namelen); } +/* set length of return value */ + ret = (flags &MSG_TRUNC ) ? skb->len : size; + +out_err:skb_free_datagram (sk, skb); -return size; +return ret; }static int isotp_release (struct socket *sock)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 363/599 bareudp: use ipv6_mod_enabled to check if IPv6 enabled
In reply to Greg Kroah-HartmanFrom: Hangbin Liu <[email protected]>
[ Upstream commit e077ed58c243afc197bc2a2ba0e1ff61135e4ec2 ]
bareudp_create_sock() use AF_INET6 by default if IPv6 CONFIG enabled. But if user start kernel with ipv6.disable=1, the bareudp sock will created failed, which cause the interface open failed even with ethertype ip. e.g.
# ip link add bareudp1 type bareudp dstport 2 ethertype ip # ip link set bareudp1 up RTNETLINK answers: Address family not supported by protocol
Fix it by using ipv6_mod_enabled() to check if IPv6 enabled. There is no need to check IS_ENABLED(CONFIG_IPV6) as ipv6_mod_enabled() will return false when CONFIG_IPV6 no enabled in include/linux/ipv6.h.
--- drivers/net/bareudp.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
drivers/net/bareudp.c +10 -9
@@ -140,14 +140,14 @@ static int bareudp_udp_encap_recv(struct oiph =skb_network_header (skb);skb_reset_network_header (skb); -if (!IS_ENABLED (CONFIG_IPV6 ) || family ==AF_INET ) +if (!ipv6_mod_enabled () || family ==AF_INET ) err =IP_ECN_decapsulate (oiph, skb);else err =IP6_ECN_decapsulate (oiph, skb);if (unlikely (err)) {if (log_ecn_error) { -if (!IS_ENABLED (CONFIG_IPV6 ) || family ==AF_INET ) +if (!ipv6_mod_enabled () || family ==AF_INET ) net_info_ratelimited("non-ECT from %pI4 " "with TOS=%#x\n", &((struct iphdr *)oiph)->saddr,
@@ -213,11 +213,12 @@ static struct socket *bareudp_create_socint err;memset (&udp_conf,0 ,sizeof (udp_conf)); -#if IS_ENABLED (CONFIG_IPV6 ) - udp_conf.family =AF_INET6 ; -#else - udp_conf.family =AF_INET ; -#endif + +if (ipv6_mod_enabled ()) + udp_conf.family =AF_INET6 ; +else + udp_conf.family =AF_INET ; + udp_conf.local_udp_port = port;/* Open UDP socket */ err =udp_sock_create (net, &udp_conf, &sock);
@@ -439,7 +440,7 @@ static netdev_tx_t bareudp_xmit(struct s }rcu_read_lock (); -if (IS_ENABLED (CONFIG_IPV6 ) && info->mode &IP_TUNNEL_INFO_IPV6 ) +if (ipv6_mod_enabled () && info->mode &IP_TUNNEL_INFO_IPV6 ) err =bareudp6_xmit_skb (skb, dev, bareudp, info);else err =bareudp_xmit_skb (skb, dev, bareudp, info);
@@ -469,7 +470,7 @@ static int bareudp_fill_metadata_dst(str use_cache =ip_tunnel_dst_cache_usable (skb, info); -if (!IS_ENABLED (CONFIG_IPV6 ) ||ip_tunnel_info_af (info) ==AF_INET ) { +if (!ipv6_mod_enabled () ||ip_tunnel_info_af (info) ==AF_INET ) {struct rtable *rt;__be32 saddr;
Greg Kroah-Hartman
maintainerPATCH 364/599 selftests/bpf: Fix error reporting from sock_fields programs
In reply to Greg Kroah-HartmanFrom: Jakub Sitnicki <[email protected]>
[ Upstream commit a4c9fe0ed4a13e25e43fcd44d9f89bc19ba8fbb7 ]
The helper macro that records an error in BPF programs that exercise sock fields access has been inadvertently broken by adaptation work that happened in commit b18c1f0aa477 ("bpf: selftest: Adapt sock_fields test to use skel and global variables").
BPF_NOEXIST flag cannot be used to update BPF_MAP_TYPE_ARRAY. The operation always fails with -EEXIST, which in turn means the error never gets recorded, and the checks for errors always pass.
Revert the change in update flags.
--- tools/testing/selftests/bpf/progs/test_sock_fields.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/progs/test_sock_fields.c +1 -1
@@ -113,7 +113,7 @@ static void tpcpy(struct bpf_tcp_sock *dst,#define RET_LOG () ({ \ linum = __LINE__; \ - bpf_map_update_elem(&linum_map, &linum_idx, &linum, BPF_NOEXIST); \ + bpf_map_update_elem(&linum_map, &linum_idx, &linum, BPF_ANY); \ return CG_OK; \ })
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 365/599 Bluetooth: call hci_le_conn_failed with hdev lock in hci_le_conn_failed
In reply to Greg Kroah-HartmanFrom: Niels Dossche <[email protected]>
[ Upstream commit 9fa6b4cda3b414e990f008f45f9bcecbcb54d4d1 ]
hci_le_conn_failed function's documentation says that the caller must hold hdev->lock. The only callsite that does not hold that lock is hci_le_conn_failed. The other 3 callsites hold the hdev->lock very locally. The solution is to hold the lock during the call to hci_le_conn_failed.
--- net/bluetooth/hci_conn.c | 2 ++ 1 file changed, 2 insertions(+)
net/bluetooth/hci_conn.c +2 -0
@@ -508,7 +508,9 @@ static void le_conn_timeout(struct work_struct *work)if (conn->role ==HCI_ROLE_SLAVE ) {/* Disable LE Advertising */ le_disable_advertising (hdev); +hci_dev_lock (hdev);hci_le_conn_failed (conn,HCI_ERROR_ADVERTISING_TIMEOUT ); +hci_dev_unlock (hdev);return ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 366/599 Bluetooth: btmtksdio: Fix kernel oops in btmtksdio_interrupt
In reply to Greg Kroah-HartmanFrom: Yake Yang <[email protected]>
[ Upstream commit b062a0b9c1dc1ff63094337dccfe1568d5b62023 ]
Fix the following kernel oops in btmtksdio_interrrupt
[ 14.339134] btmtksdio_interrupt+0x28/0x54 [ 14.339139] process_sdio_pending_irqs+0x68/0x1a0 [ 14.339144] sdio_irq_work+0x40/0x70 [ 14.339154] process_one_work+0x184/0x39c [ 14.339160] worker_thread+0x228/0x3e8 [ 14.339168] kthread+0x148/0x3ac [ 14.339176] ret_from_fork+0x10/0x30
That happened because hdev->power_on is already called before sdio_set_drvdata which btmtksdio_interrupt handler relies on is not properly set up.
The details are shown as the below: hci_register_dev would run queue_work(hdev->req_workqueue, &hdev->power_on) as WQ_HIGHPRI workqueue_struct to complete the power-on sequeunce and thus hci_power_on may run before sdio_set_drvdata is done in btmtksdio_probe.
The hci_dev_do_open in hci_power_on would initialize the device and enable the interrupt and thus it is possible that btmtksdio_interrupt is being called right before sdio_set_drvdata is filled out.
When btmtksdio_interrupt is being called and sdio_set_drvdata is not filled , the kernel oops is going to happen because btmtksdio_interrupt access an uninitialized pointer.
--- drivers/bluetooth/btmtksdio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/bluetooth/btmtksdio.c +2 -2
@@ -981,6 +981,8 @@ static int btmtksdio_probe(struct sdio_func *func, hdev->manufacturer =70 ;set_bit (HCI_QUIRK_NON_PERSISTENT_SETUP , &hdev->quirks); +sdio_set_drvdata (func, bdev); + err =hci_register_dev (hdev);if (err <0 ) {dev_err (&func->dev,"Can't register HCI device\n" );
@@ -988,8 +990,6 @@ static int btmtksdio_probe(struct sdio_func *func,return err; } -sdio_set_drvdata (func, bdev); -/* pm_runtime_enable would be done after the firmware is being * downloaded because the core layer probably already enables * runtime PM for this func such as the case host->caps &
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 367/599 ipv4: Fix route lookups when handling ICMP redirects and PMTU updates
In reply to Greg Kroah-HartmanFrom: Guillaume Nault <[email protected]>
[ Upstream commit 544b4dd568e3b09c1ab38a759d3187e7abda11a0 ]
The PMTU update and ICMP redirect helper functions initialise their fl4 variable with either __build_flow_key() or build_sk_flow_key(). These initialisation functions always set ->flowi4_scope with RT_SCOPE_UNIVERSE and might set the ECN bits of ->flowi4_tos. This is not a problem when the route lookup is later done via ip_route_output_key_hash(), which properly clears the ECN bits from ->flowi4_tos and initialises ->flowi4_scope based on the RTO_ONLINK flag. However, some helpers call fib_lookup() directly, without sanitising the tos and scope fields, so the route lookup can fail and, as a result, the ICMP redirect or PMTU update aren't taken into account.
Fix this by extracting the ->flowi4_tos and ->flowi4_scope sanitisation code into ip_rt_fix_tos(), then use this function in handlers that call fib_lookup() directly.
Note 1: We can't sanitise ->flowi4_tos and ->flowi4_scope in a central place (like __build_flow_key() or flowi4_init_output()), because ip_route_output_key_hash() expects non-sanitised values. When called with sanitised values, it can erroneously overwrite RT_SCOPE_LINK with RT_SCOPE_UNIVERSE in ->flowi4_scope. Therefore we have to be careful to sanitise the values only for those paths that don't call ip_route_output_key_hash().
Note 2: The problem is mostly about sanitising ->flowi4_tos. Having ->flowi4_scope initialised with RT_SCOPE_UNIVERSE instead of RT_SCOPE_LINK probably wasn't really a problem: sockets with the SOCK_LOCALROUTE flag set (those that'd result in RTO_ONLINK being set) normally shouldn't receive ICMP redirects or PMTU updates.
--- net/ipv4/route.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
net/ipv4/route.c +14 -4
@@ -529,6 +529,15 @@ void __ip_select_ident(struct net *net, struct iphdr *iph, int segs) }EXPORT_SYMBOL (__ip_select_ident); +static void ip_rt_fix_tos (struct flowi4 *fl4) +{ +__u8 tos =RT_FL_TOS (fl4); + + fl4->flowi4_tos = tos &IPTOS_RT_MASK ; + fl4->flowi4_scope = tos &RTO_ONLINK ? +RT_SCOPE_LINK :RT_SCOPE_UNIVERSE ; +} + static void __build_flow_key(const struct net *net, struct flowi4 *fl4, const struct sock *sk, const struct iphdr *iph,
@@ -853,6 +862,7 @@ static void ip_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_buf rt = (struct rtable *) dst;__build_flow_key (net, &fl4, sk, iph, oif, tos, prot, mark,0 ); +ip_rt_fix_tos (&fl4);__ip_do_redirect (rt, skb, &fl4, true); }
@@ -1077,6 +1087,7 @@ static void ip_rt_update_pmtu(struct dst_entry *dst, struct sock *sk,struct flowi4 fl4;ip_rt_build_flow_key (&fl4, sk, skb); +ip_rt_fix_tos (&fl4);/* Don't make lookup fail for bridged encapsulations */ if (skb &&netif_is_any_bridge_port (skb->dev))
@@ -1151,6 +1162,8 @@ void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu) goto out; new = true; + }else { +ip_rt_fix_tos (&fl4); }__ip_rt_update_pmtu ((struct rtable *)xfrm_dst_path (&rt->dst), &fl4, mtu);
@@ -2524,7 +2537,6 @@ static struct rtable *__mkroute_output(const struct fib_result *res,struct rtable *ip_route_output_key_hash (struct net *net,struct flowi4 *fl4,const struct sk_buff *skb) { -__u8 tos =RT_FL_TOS (fl4);struct fib_result res = { .type =RTN_UNSPEC , .fi =NULL ,
@@ -2534,9 +2546,7 @@ struct rtable *ip_route_output_key_hash(struct net *net, struct flowi4 *fl4,struct rtable *rth; fl4->flowi4_iif =LOOPBACK_IFINDEX ; - fl4->flowi4_tos = tos &IPTOS_RT_MASK ; - fl4->flowi4_scope = ((tos &RTO_ONLINK ) ? -RT_SCOPE_LINK :RT_SCOPE_UNIVERSE ); +ip_rt_fix_tos (fl4);rcu_read_lock (); rth =ip_route_output_key_hash_rcu (net, fl4, &res, skb);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 368/599 af_netlink: Fix shift out of bounds in group mask calculation
In reply to Greg Kroah-HartmanFrom: Petr Machata <[email protected]>
[ Upstream commit 0caf6d9922192dd1afa8dc2131abfb4df1443b9f ]
When a netlink message is received, netlink_recvmsg() fills in the address of the sender. One of the fields is the 32-bit bitfield nl_groups, which carries the multicast group on which the message was received. The least significant bit corresponds to group 1, and therefore the highest group that the field can represent is 32. Above that, the UB sanitizer flags the out-of-bounds shift attempts.
Which bits end up being set in such case is implementation defined, but it's either going to be a wrong non-zero value, or zero, which is at least not misleading. Make the latter choice deterministic by always setting to 0 for higher-numbered multicast groups.
To get information about membership in groups >= 32, userspace is expected to use nl_pktinfo control messages[0], which are enabled by NETLINK_PKTINFO socket option.
[0] https://lwn.net/Articles/147608/
The way to trigger this issue is e.g. through monitoring the BRVLAN group:
# bridge monitor vlan & # ip link add name br type bridge
Which produces the following citation:
UBSAN: shift-out-of-bounds in net/netlink/af_netlink.c:162:19 shift exponent 32 is too large for 32-bit type 'int'
--- net/netlink/af_netlink.c | 2 ++ 1 file changed, 2 insertions(+)
net/netlink/af_netlink.c +2 -0
@@ -149,6 +149,8 @@ static const struct rhashtable_params netlink_rhashtable_params;static inline u32 netlink_group_mask (u32 group) { +if (group >32 ) +return 0 ;return group ?1 << (group -1 ) :0 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 369/599 i2c: meson: Fix wrong speed use from probe
In reply to Greg Kroah-HartmanFrom: Lucas Tanure <[email protected]>
[ Upstream commit cb13aa16f34f794a9cee2626862af8a95f0f0ee9 ]
Having meson_i2c_set_clk_div after i2c_add_adapter causes issues for client drivers that try to use the bus before the requested speed is applied.
The bus can be used just after i2c_add_adapter, so move i2c_add_adapter to the final step as meson_i2c_set_clk_div needs to be called before the bus is used.
--- drivers/i2c/busses/i2c-meson.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/i2c/busses/i2c-meson.c +6 -6
@@ -465,18 +465,18 @@ static int meson_i2c_probe(struct platform_device *pdev)*/ meson_i2c_set_mask (i2c,REG_CTRL ,REG_CTRL_START ,0 ); - ret =i2c_add_adapter (&i2c->adap); -if (ret <0 ) { -clk_disable_unprepare (i2c->clk); -return ret; - } -/* Disable filtering */ meson_i2c_set_mask (i2c,REG_SLAVE_ADDR ,REG_SLV_SDA_FILTER |REG_SLV_SCL_FILTER ,0 );meson_i2c_set_clk_div (i2c, timings.bus_freq_hz); + ret =i2c_add_adapter (&i2c->adap); +if (ret <0 ) { +clk_disable_unprepare (i2c->clk); +return ret; + } +return 0 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 370/599 i2c: mux: demux-pinctrl: do not deactivate a master that is not active
In reply to Greg Kroah-HartmanFrom: Peter Rosin <[email protected]>
[ Upstream commit 1a22aabf20adf89cb216f566913196128766f25b ]
Attempting to rollback the activation of the current master when the current master has not been activated is bad. priv->cur_chan and priv->cur_adap are both still zeroed out and the rollback may result in attempts to revert an of changeset that has not been applied and do result in calls to both del and put the zeroed out i2c_adapter. Maybe it crashes, or whatever, but it's bad in any case.
--- drivers/i2c/muxes/i2c-demux-pinctrl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/i2c/muxes/i2c-demux-pinctrl.c +3 -2
@@ -261,7 +261,7 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev) err =device_create_file (&pdev->dev, &dev_attr_available_masters);if (err) - goto err_rollback; + goto err_rollback_activation; err =device_create_file (&pdev->dev, &dev_attr_current_master);if (err)
@@ -271,8 +271,9 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev) err_rollback_available:device_remove_file (&pdev->dev, &dev_attr_available_masters); -err_rollback: +err_rollback_activation:i2c_demux_deactivate_master (priv); +err_rollback:for (j =0 ; j < i; j++) {of_node_put (priv->chan[j].parent_np);of_changeset_destroy (&priv->chan[j].chgset);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 371/599 selftests/bpf/test_lirc_mode2.sh: Exit with proper code
In reply to Greg Kroah-HartmanFrom: Hangbin Liu <[email protected]>
[ Upstream commit ec80906b0fbd7be11e3e960813b977b1ffe5f8fe ]
When test_lirc_mode2_user exec failed, the test report failed but still exit with 0. Fix it by exiting with an error code.
Another issue is for the LIRCDEV checking. With bash -n, we need to quote the variable, or it will always be true. So if test_lirc_mode2_user was not run, just exit with skip code.
--- tools/testing/selftests/bpf/test_lirc_mode2.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
tools/testing/selftests/bpf/test_lirc_mode2.sh +4 -1
@@ -3,6 +3,7 @@ # Kselftest framework requirement - SKIP code is 4. ksft_skip=4 +ret=$ksft_skip msg="skip all tests:" if [ $UID != 0 ]; then
@@ -25,7 +26,7 @@ do fi done -if [ -n $LIRCDEV ]; +if [ -n "$LIRCDEV" ]; then TYPE=lirc_mode2 ./test_lirc_mode2_user $LIRCDEV $INPUTDEV
@@ -36,3 +37,5 @@ then echo -e ${GREEN}"PASS: $TYPE"${NC} fi fi + +exit $ret
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 372/599 PCI: Avoid broken MSI on SB600 USB devices
In reply to Greg Kroah-HartmanFrom: Bjorn Helgaas <[email protected]>
[ Upstream commit 63cd736f449445edcd7f0bcc7d84453e9beec0aa ]
Some ATI SB600 USB adapters advertise MSI, but if INTx is disabled by setting PCI_COMMAND_INTX_DISABLE, MSI doesn't work either. The PCI/PCIe specs do not require software to set PCI_COMMAND_INTX_DISABLE when enabling MSI, but Linux has done that for many years.
Mick reported that 306c54d0edb6 ("usb: hcd: Try MSI interrupts on PCI devices") broke these devices. Prior to 306c54d0edb6, they used INTx. Starting with 306c54d0edb6, they use MSI, and and the fact that Linux sets PCI_COMMAND_INTX_DISABLE means both INTx and MSI are disabled on these devices.
Avoid this SB600 defect by disabling MSI so we use INTx as before.
--- drivers/pci/quirks.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/pci/quirks.c +12 -0
@@ -1816,6 +1816,18 @@ static void quirk_alder_ioapic(struct pci_dev *pdev)DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_EESSC , quirk_alder_ioapic);#endif +static void quirk_no_msi (struct pci_dev *dev) +{ +pci_info (dev,"avoiding MSI to work around a hardware defect\n" ); + dev->no_msi =1 ; +} +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x4386 , quirk_no_msi); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x4387 , quirk_no_msi); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x4388 , quirk_no_msi); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x4389 , quirk_no_msi); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x438a , quirk_no_msi); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x438b , quirk_no_msi); +static void quirk_pcie_mch (struct pci_dev *pdev) { pdev->no_msi =1 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 373/599 net: bcmgenet: Use stronger register read/writes to assure ordering
In reply to Greg Kroah-HartmanFrom: Jeremy Linton <[email protected]>
[ Upstream commit 8d3ea3d402db94b61075617e71b67459a714a502 ]
GCC12 appears to be much smarter about its dependency tracking and is aware that the relaxed variants are just normal loads and stores and this is causing problems like:
[ 210.074549] ------------[ cut here ]------------ [ 210.079223] NETDEV WATCHDOG: enabcm6e4ei0 (bcmgenet): transmit queue 1 timed out [ 210.086717] WARNING: CPU: 1 PID: 0 at net/sched/sch_generic.c:529 dev_watchdog+0x234/0x240 [ 210.095044] Modules linked in: genet(E) nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_fib nft_reject_inet nf_reject_ipv4 nf_reject_ipv6 nft_reject nft_ct nft_chain_nat] [ 210.146561] ACPI CPPC: PCC check channel failed for ss: 0. ret=-110 [ 210.146927] CPU: 1 PID: 0 Comm: swapper/1 Tainted: G E 5.17.0-rc7G12+ #58 [ 210.153226] CPPC Cpufreq:cppc_scale_freq_workfn: failed to read perf counters [ 210.161349] Hardware name: Raspberry Pi Foundation Raspberry Pi 4 Model B/Raspberry Pi 4 Model B, BIOS EDK2-DEV 02/08/2022 [ 210.161353] pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 210.161358] pc : dev_watchdog+0x234/0x240 [ 210.161364] lr : dev_watchdog+0x234/0x240 [ 210.161368] sp : ffff8000080a3a40 [ 210.161370] x29: ffff8000080a3a40 x28: ffffcd425af87000 x27: ffff8000080a3b20 [ 210.205150] x26: ffffcd425aa00000 x25: 0000000000000001 x24: ffffcd425af8ec08 [ 210.212321] x23: 0000000000000100 x22: ffffcd425af87000 x21: ffff55b142688000 [ 210.219491] x20: 0000000000000001 x19: ffff55b1426884c8 x18: ffffffffffffffff [ 210.226661] x17: 64656d6974203120 x16: 0000000000000001 x15: 6d736e617274203a [ 210.233831] x14: 2974656e65676d63 x13: ffffcd4259c300d8 x12: ffffcd425b07d5f0 [ 210.241001] x11: 00000000ffffffff x10: ffffcd425b07d5f0 x9 : ffffcd4258bdad9c [ 210.248171] x8 : 00000000ffffdfff x7 : 000000000000003f x6 : 0000000000000000 [ 210.255341] x5 : 0000000000000000 x4 : 0000000000000000 x3 : 0000000000001000 [ 210.262511] x2 : 0000000000001000 x1 : 0000000000000005 x0 : 0000000000000044 [ 210.269682] Call trace: [ 210.272133] dev_watchdog+0x234/0x240 [ 210.275811] call_timer_fn+0x3c/0x15c [ 210.279489] __run_timers.part.0+0x288/0x310 [ 210.283777] run_timer_softirq+0x48/0x80 [ 210.287716] __do_softirq+0x128/0x360 [ 210.291392] __irq_exit_rcu+0x138/0x140 [ 210.295243] irq_exit_rcu+0x1c/0x30 [ 210.298745] el1_interrupt+0x38/0x54 [ 210.302334] el1h_64_irq_handler+0x18/0x24 [ 210.306445] el1h_64_irq+0x7c/0x80 [ 210.309857] arch_cpu_idle+0x18/0x2c [ 210.313445] default_idle_call+0x4c/0x140 [ 210.317470] cpuidle_idle_call+0x14c/0x1a0 [ 210.321584] do_idle+0xb0/0x100 [ 210.324737] cpu_startup_entry+0x30/0x8c [ 210.328675] secondary_start_kernel+0xe4/0x110 [ 210.333138] __secondary_switched+0x94/0x98
The assumption when these were relaxed seems to be that device memory would be mapped non reordering, and that other constructs (spinlocks/etc) would provide the barriers to assure that packet data and in memory rings/queues were ordered with respect to device register reads/writes. This itself seems a bit sketchy, but the real problem with GCC12 is that it is moving the actual reads/writes around at will as though they were independent operations when in truth they are not, but the compiler can't know that. When looking at the assembly dumps for many of these routines its possible to see very clean, but not strictly in program order operations occurring as the compiler would be free to do if these weren't actually register reads/write operations.
Its possible to suppress the timeout with a liberal bit of dma_mb()'s sprinkled around but the device still seems unable to reliably send/receive data. A better plan is to use the safer readl/writel everywhere.
Since this partially reverts an older commit, which notes the use of the relaxed variants for performance reasons. I would suggest that any performance problems with this commit are targeted at relaxing only the performance critical code paths after assuring proper barriers.
--- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/genet/bcmgenet.c +2 -2
@@ -76,7 +76,7 @@ static inline void bcmgenet_writel(u32 value, void __iomem *offset)if (IS_ENABLED (CONFIG_MIPS ) &&IS_ENABLED (CONFIG_CPU_BIG_ENDIAN ))__raw_writel (value, offset);else -writel_relaxed (value, offset); +writel (value, offset); }static inline u32 bcmgenet_readl (void __iomem *offset)
@@ -84,7 +84,7 @@ static inline u32 bcmgenet_readl(void __iomem *offset)if (IS_ENABLED (CONFIG_MIPS ) &&IS_ENABLED (CONFIG_CPU_BIG_ENDIAN ))return __raw_readl (offset);else -return readl_relaxed (offset); +return readl (offset); } static inline void dmadesc_set_length_status(struct bcmgenet_priv *priv,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 374/599 tcp: ensure PMTU updates are processed during fastopen
In reply to Greg Kroah-HartmanFrom: Jakub Kicinski <[email protected]>
[ Upstream commit ed0c99dc0f499ff8b6e75b5ae6092ab42be1ad39 ]
tp->rx_opt.mss_clamp is not populated, yet, during TFO send so we rise it to the local MSS. tp->mss_cache is not updated, however:
tcp_v6_connect():
tp->rx_opt.mss_clamp = IPV6_MIN_MTU - headers;
tcp_connect():
tcp_connect_init():
tp->mss_cache = min(mtu, tp->rx_opt.mss_clamp)
tcp_send_syn_data():
tp->rx_opt.mss_clamp = tp->advmssAfter recent fixes to ICMPv6 PTB handling we started dropping PMTU updates higher than tp->mss_cache. Because of the stale tp->mss_cache value PMTU updates during TFO are always dropped.
Thanks to Wei for helping zero in on the problem and the fix!
--- net/ipv4/tcp_output.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/ipv4/tcp_output.c +4 -1
@@ -3733,6 +3733,7 @@ static void tcp_connect_queue_skb(struct sock *sk, struct sk_buff *skb)*/ static int tcp_send_syn_data (struct sock *sk,struct sk_buff *syn) { +struct inet_connection_sock *icsk =inet_csk (sk);struct tcp_sock *tp =tcp_sk (sk);struct tcp_fastopen_request *fo = tp->fastopen_req;int space, err =0 ;
@@ -3747,8 +3748,10 @@ static int tcp_send_syn_data(struct sock *sk, struct sk_buff *syn)* private TCP options. The cost is reduced data space in SYN :( */ tp->rx_opt.mss_clamp =tcp_mss_clamp (tp, tp->rx_opt.mss_clamp); +/* Sync mss_cache after updating the mss_clamp */ +tcp_sync_mss (sk, icsk->icsk_pmtu_cookie); - space =__tcp_mtu_to_mss (sk,inet_csk (sk)->icsk_pmtu_cookie) - + space =__tcp_mtu_to_mss (sk, icsk->icsk_pmtu_cookie) -MAX_TCP_OPTION_SPACE ; space =min_t (size_t, space, fo->size);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 375/599 openvswitch: always update flow key after nat
In reply to Greg Kroah-HartmanFrom: Aaron Conole <[email protected]>
[ Upstream commit 60b44ca6bd7518dd38fa2719bc9240378b6172c3 ]
During NAT, a tuple collision may occur. When this happens, openvswitch will make a second pass through NAT which will perform additional packet modification. This will update the skb data, but not the flow key that OVS uses. This means that future flow lookups, and packet matches will have incorrect data. This has been supported since 5d50aa83e2c8 ("openvswitch: support asymmetric conntrack").
That commit failed to properly update the sw_flow_key attributes, since it only called the ovs_ct_nat_update_key once, rather than each time ovs_ct_nat_execute was called. As these two operations are linked, the ovs_ct_nat_execute() function should always make sure that the sw_flow_key is updated after a successful call through NAT infrastructure.
--- net/openvswitch/conntrack.c | 118 ++++++++++++++++++------------------ 1 file changed, 59 insertions(+), 59 deletions(-)
net/openvswitch/conntrack.c +59 -59
@@ -730,6 +730,57 @@ static bool skb_nfct_cached(struct net *net, }#if IS_ENABLED (CONFIG_NF_NAT ) +static void ovs_nat_update_key (struct sw_flow_key *key, +const struct sk_buff *skb, +enum nf_nat_manip_type maniptype) +{ +if (maniptype ==NF_NAT_MANIP_SRC ) { +__be16 src; + + key->ct_state |=OVS_CS_F_SRC_NAT ; +if (key->eth.type ==htons (ETH_P_IP )) + key->ipv4.addr.src =ip_hdr (skb)->saddr; +else if (key->eth.type ==htons (ETH_P_IPV6 )) +memcpy (&key->ipv6.addr.src, &ipv6_hdr (skb)->saddr, +sizeof (key->ipv6.addr.src)); +else +return ; + +if (key->ip.proto ==IPPROTO_UDP ) + src =udp_hdr (skb)->source; +else if (key->ip.proto ==IPPROTO_TCP ) + src =tcp_hdr (skb)->source; +else if (key->ip.proto ==IPPROTO_SCTP ) + src =sctp_hdr (skb)->source; +else +return ; + + key->tp.src = src; + }else { +__be16 dst; + + key->ct_state |=OVS_CS_F_DST_NAT ; +if (key->eth.type ==htons (ETH_P_IP )) + key->ipv4.addr.dst =ip_hdr (skb)->daddr; +else if (key->eth.type ==htons (ETH_P_IPV6 )) +memcpy (&key->ipv6.addr.dst, &ipv6_hdr (skb)->daddr, +sizeof (key->ipv6.addr.dst)); +else +return ; + +if (key->ip.proto ==IPPROTO_UDP ) + dst =udp_hdr (skb)->dest; +else if (key->ip.proto ==IPPROTO_TCP ) + dst =tcp_hdr (skb)->dest; +else if (key->ip.proto ==IPPROTO_SCTP ) + dst =sctp_hdr (skb)->dest; +else +return ; + + key->tp.dst = dst; + } +} +/* Modelled after nf_nat_ipv[46]_fn(). * range is only used for new, uninitialized NAT state. * Returns either NF_ACCEPT or NF_DROP.
@@ -737,7 +788,7 @@ static bool skb_nfct_cached(struct net *net,static int ovs_ct_nat_execute (struct sk_buff *skb,struct nf_conn *ct,enum ip_conntrack_info ctinfo,const struct nf_nat_range2 *range, -enum nf_nat_manip_type maniptype) +enum nf_nat_manip_type maniptype,struct sw_flow_key *key) {int hooknum, nh_off, err =NF_ACCEPT ;
@@ -810,58 +861,11 @@ static int ovs_ct_nat_execute(struct sk_buff *skb, struct nf_conn *ct,skb_push (skb, nh_off);skb_postpush_rcsum (skb, skb->data, nh_off); -return err; -} - -static void ovs_nat_update_key (struct sw_flow_key *key, -const struct sk_buff *skb, -enum nf_nat_manip_type maniptype) -{ -if (maniptype ==NF_NAT_MANIP_SRC ) { -__be16 src; - - key->ct_state |=OVS_CS_F_SRC_NAT ; -if (key->eth.type ==htons (ETH_P_IP )) - key->ipv4.addr.src =ip_hdr (skb)->saddr; -else if (key->eth.type ==htons (ETH_P_IPV6 )) -memcpy (&key->ipv6.addr.src, &ipv6_hdr (skb)->saddr, -sizeof (key->ipv6.addr.src)); -else -return ; - -if (key->ip.proto ==IPPROTO_UDP ) - src =udp_hdr (skb)->source; -else if (key->ip.proto ==IPPROTO_TCP ) - src =tcp_hdr (skb)->source; -else if (key->ip.proto ==IPPROTO_SCTP ) - src =sctp_hdr (skb)->source; -else -return ; - - key->tp.src = src; - }else { -__be16 dst; - - key->ct_state |=OVS_CS_F_DST_NAT ; -if (key->eth.type ==htons (ETH_P_IP )) - key->ipv4.addr.dst =ip_hdr (skb)->daddr; -else if (key->eth.type ==htons (ETH_P_IPV6 )) -memcpy (&key->ipv6.addr.dst, &ipv6_hdr (skb)->daddr, -sizeof (key->ipv6.addr.dst)); -else -return ; - -if (key->ip.proto ==IPPROTO_UDP ) - dst =udp_hdr (skb)->dest; -else if (key->ip.proto ==IPPROTO_TCP ) - dst =tcp_hdr (skb)->dest; -else if (key->ip.proto ==IPPROTO_SCTP ) - dst =sctp_hdr (skb)->dest; -else -return ; +/* Update the flow key if NAT successful. */ +if (err ==NF_ACCEPT ) +ovs_nat_update_key (key, skb, maniptype); - key->tp.dst = dst; - } +return err; }/* Returns NF_DROP if the packet should be dropped, NF_ACCEPT otherwise. */
@@ -903,7 +907,7 @@ static int ovs_ct_nat(struct net *net, struct sw_flow_key *key, }else {return NF_ACCEPT ;/* Connection is not NATed. */ } - err =ovs_ct_nat_execute (skb, ct, ctinfo, &info->range, maniptype); + err =ovs_ct_nat_execute (skb, ct, ctinfo, &info->range, maniptype, key);if (err ==NF_ACCEPT && ct->status &IPS_DST_NAT ) {if (ct->status &IPS_SRC_NAT ) {
@@ -913,17 +917,13 @@ static int ovs_ct_nat(struct net *net, struct sw_flow_key *key, maniptype =NF_NAT_MANIP_SRC ; err =ovs_ct_nat_execute (skb, ct, ctinfo, &info->range, - maniptype); + maniptype, key); }else if (CTINFO2DIR (ctinfo) ==IP_CT_DIR_ORIGINAL ) { err =ovs_ct_nat_execute (skb, ct, ctinfo,NULL , -NF_NAT_MANIP_SRC ); +NF_NAT_MANIP_SRC , key); } } -/* Mark NAT done if successful and update the flow key. */ -if (err ==NF_ACCEPT ) -ovs_nat_update_key (key, skb, maniptype); -return err; }#else /* !CONFIG_NF_NAT */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 376/599 tipc: fix the timer expires after interval 100ms
In reply to Greg Kroah-HartmanFrom: Hoang Le <[email protected]>
[ Upstream commit 6a7d8cff4a3301087dd139293e9bddcf63827282 ]
In the timer callback function tipc_sk_timeout(), we're trying to reschedule another timeout to retransmit a setup request if destination link is congested. But we use the incorrect timeout value (msecs_to_jiffies(100)) instead of (jiffies + msecs_to_jiffies(100)), so that the timer expires immediately, it's irrelevant for original description.
In this commit we correct the timeout value in sk_reset_timer()
--- net/tipc/socket.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/tipc/socket.c +2 -1
@@ -2846,7 +2846,8 @@ static void tipc_sk_retry_connect(struct sock *sk, struct sk_buff_head *list)/* Try again later if dest link is congested */ if (tsk->cong_link_cnt) { -sk_reset_timer (sk, &sk->sk_timer,msecs_to_jiffies (100 )); +sk_reset_timer (sk, &sk->sk_timer, + jiffies +msecs_to_jiffies (100 ));return ; }/* Prepare SYN for retransmit */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 377/599 mfd: asic3: Add missing iounmap() on error asic3_mfd_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit e84ee1a75f944a0fe3c277aaa10c426603d2b0bc ]
Add the missing iounmap() before return from asic3_mfd_probe in the error handling case.
--- drivers/mfd/asic3.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/mfd/asic3.c +7 -3
@@ -914,14 +914,14 @@ static int __init asic3_mfd_probe(struct platform_device *pdev, ret =mfd_add_devices (&pdev->dev, pdev->id, &asic3_cell_ds1wm,1 , mem, asic->irq_base,NULL );if (ret <0 ) - goto out; + goto out_unmap; }if (mem_sdio && (irq >=0 )) { ret =mfd_add_devices (&pdev->dev, pdev->id, &asic3_cell_mmc,1 , mem_sdio, irq,NULL );if (ret <0 ) - goto out; + goto out_unmap; } ret =0 ;
@@ -935,8 +935,12 @@ static int __init asic3_mfd_probe(struct platform_device *pdev, ret =mfd_add_devices (&pdev->dev,0 , asic3_cell_leds,ASIC3_NUM_LEDS ,NULL ,0 ,NULL ); } +return ret; - out: +out_unmap: +if (asic->tmio_cnf) +iounmap (asic->tmio_cnf); +out:return ret; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 378/599 mxser: fix xmit_buf leak in activate when LSR == 0xff
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
[ Upstream commit cd3a4907ee334b40d7aa880c7ab310b154fd5cd4 ]
When LSR is 0xff in ->activate() (rather unlike), we return an error. Provided ->shutdown() is not called when ->activate() fails, nothing actually frees the buffer in this case.
Fix this by properly freeing the buffer in a designated label. We jump there also from the "!info->type" if now too.
--- drivers/tty/mxser.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/tty/mxser.c +11 -4
@@ -858,6 +858,7 @@ static int mxser_activate(struct tty_port *port, struct tty_struct *tty) struct mxser_port *info = container_of(port, struct mxser_port, port);unsigned long page;unsigned long flags; +int ret; page =__get_free_page (GFP_KERNEL );if (!page)
@@ -867,9 +868,9 @@ static int mxser_activate(struct tty_port *port, struct tty_struct *tty)if (!info->ioaddr || !info->type) {set_bit (TTY_IO_ERROR , &tty->flags); -free_page (page);spin_unlock_irqrestore (&info->slock, flags); -return 0 ; + ret =0 ; + goto err_free_xmit; } info->port.xmit_buf = (unsigned char *) page;
@@ -895,8 +896,10 @@ static int mxser_activate(struct tty_port *port, struct tty_struct *tty)if (capable (CAP_SYS_ADMIN )) {set_bit (TTY_IO_ERROR , &tty->flags);return 0 ; - }else -return -ENODEV ; + } + + ret = -ENODEV ; + goto err_free_xmit; }/*
@@ -941,6 +944,10 @@ static int mxser_activate(struct tty_port *port, struct tty_struct *tty)spin_unlock_irqrestore (&info->slock, flags);return 0 ; +err_free_xmit: +free_page (page); + info->port.xmit_buf =NULL ; +return ret; }/*
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 379/599 pwm: lpc18xx-sct: Initialize driver data and hardware before pwmchip_add()
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit 0401f24cd238ae200a23a13925f98de3d2c883b8 ]
When a driver calls pwmchip_add() it has to be prepared to immediately get its callbacks called. So move allocation of driver data and hardware initialization before the call to pwmchip_add().
This fixes a potential NULL pointer exception and a race condition on register writes.
--- drivers/pwm/pwm-lpc18xx-sct.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)
drivers/pwm/pwm-lpc18xx-sct.c +9 -11
@@ -400,12 +400,6 @@ static int lpc18xx_pwm_probe(struct platform_device *pdev)lpc18xx_pwm_writel (lpc18xx_pwm,LPC18XX_PWM_LIMIT ,BIT (lpc18xx_pwm->period_event)); - ret =pwmchip_add (&lpc18xx_pwm->chip); -if (ret <0 ) { -dev_err (&pdev->dev,"pwmchip_add failed: %d\n" , ret); - goto disable_pwmclk; - } -for (i =0 ; i < lpc18xx_pwm->chip.npwm; i++) {struct lpc18xx_pwm_data *data;
@@ -415,14 +409,12 @@ static int lpc18xx_pwm_probe(struct platform_device *pdev) GFP_KERNEL);if (!data) { ret = -ENOMEM ; - goto remove_pwmchip; + goto disable_pwmclk; }pwm_set_chip_data (pwm, data); } -platform_set_drvdata (pdev, lpc18xx_pwm); - val =lpc18xx_pwm_readl (lpc18xx_pwm,LPC18XX_PWM_CTRL ); val &= ~LPC18XX_PWM_BIDIR ; val &= ~LPC18XX_PWM_CTRL_HALT ;
@@ -430,10 +422,16 @@ static int lpc18xx_pwm_probe(struct platform_device *pdev) val |=LPC18XX_PWM_PRE (0 );lpc18xx_pwm_writel (lpc18xx_pwm,LPC18XX_PWM_CTRL , val); + ret =pwmchip_add (&lpc18xx_pwm->chip); +if (ret <0 ) { +dev_err (&pdev->dev,"pwmchip_add failed: %d\n" , ret); + goto disable_pwmclk; + } + +platform_set_drvdata (pdev, lpc18xx_pwm); +return 0 ; -remove_pwmchip: -pwmchip_remove (&lpc18xx_pwm->chip); disable_pwmclk:clk_disable_unprepare (lpc18xx_pwm->pwm_clk);return ret;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 380/599 fsi: aspeed: convert to devm_platform_ioremap_resource
In reply to Greg Kroah-HartmanFrom: Yangtao Li <[email protected]>
[ Upstream commit a3469912f4caeea32ecbe0bf472b14634fecb38e ]
Use devm_platform_ioremap_resource() to simplify code.
--- drivers/fsi/fsi-master-aspeed.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/fsi/fsi-master-aspeed.c +1 -3
@@ -525,7 +525,6 @@ static int tacoma_cabled_fsi_fixup(struct device *dev)static int fsi_master_aspeed_probe (struct platform_device *pdev) {struct fsi_master_aspeed *aspeed; -struct resource *res;int rc, links, reg;__be32 raw;
@@ -541,8 +540,7 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev) aspeed->dev = &pdev->dev; - res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); - aspeed->base =devm_ioremap_resource (&pdev->dev, res); + aspeed->base =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (aspeed->base))return PTR_ERR (aspeed->base);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 381/599 fsi: Aspeed: Fix a potential double free
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 83ba7e895debc529803a7a258653f2fe9bf3bf40 ]
A struct device can never be devm_alloc()'ed.
Here, it is embedded in "struct fsi_master", and "struct fsi_master" is embedded in "struct fsi_master_aspeed".
Since "struct device" is embedded, the data structure embedding it must be released with the release function, as is already done here.
So use kzalloc() instead of devm_kzalloc() when allocating "aspeed" and update all error handling branches accordingly.
This prevent a potential double free().
This also fix another issue if opb_readl() fails. Instead of a direct return, it now jumps in the error handling path.
--- drivers/fsi/fsi-master-aspeed.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/fsi/fsi-master-aspeed.c +11 -6
@@ -534,25 +534,28 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev)return rc; } - aspeed =devm_kzalloc (&pdev->dev,sizeof (*aspeed),GFP_KERNEL ); + aspeed =kzalloc (sizeof (*aspeed),GFP_KERNEL );if (!aspeed)return -ENOMEM ; aspeed->dev = &pdev->dev; aspeed->base =devm_platform_ioremap_resource (pdev,0 ); -if (IS_ERR (aspeed->base)) -return PTR_ERR (aspeed->base); +if (IS_ERR (aspeed->base)) { + rc =PTR_ERR (aspeed->base); + goto err_free_aspeed; + } aspeed->clk =devm_clk_get (aspeed->dev,NULL );if (IS_ERR (aspeed->clk)) {dev_err (aspeed->dev,"couldn't get clock\n" ); -return PTR_ERR (aspeed->clk); + rc =PTR_ERR (aspeed->clk); + goto err_free_aspeed; } rc =clk_prepare_enable (aspeed->clk);if (rc) {dev_err (aspeed->dev,"couldn't enable clock\n" ); -return rc; + goto err_free_aspeed; } rc =setup_cfam_reset (aspeed);
@@ -587,7 +590,7 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev) rc =opb_readl (aspeed, ctrl_base +FSI_MVER , &raw);if (rc) {dev_err (&pdev->dev,"failed to read hub version\n" ); -return rc; + goto err_release; } reg =be32_to_cpu (raw);
@@ -626,6 +629,8 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev) err_release:clk_disable_unprepare (aspeed->clk); +err_free_aspeed: +kfree (aspeed);return rc; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 382/599 misc: alcor_pci: Fix an error handling path
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 5b3dc949f554379edcb8ef6111aa5ecb78feb798 ]
A successful ida_simple_get() should be balanced by a corresponding ida_simple_remove().
Add the missing call in the error handling path of the probe.
While at it, switch to ida_alloc()/ida_free() instead to ida_simple_get()/ida_simple_remove().
The latter is deprecated and more verbose.
--- drivers/misc/cardreader/alcor_pci.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/misc/cardreader/alcor_pci.c +6 -3
@@ -266,7 +266,7 @@ static int alcor_pci_probe(struct pci_dev *pdev,if (!priv)return -ENOMEM ; - ret =ida_simple_get (&alcor_pci_idr,0 ,0 ,GFP_KERNEL ); + ret =ida_alloc (&alcor_pci_idr,GFP_KERNEL );if (ret <0 )return ret; priv->id = ret;
@@ -280,7 +280,8 @@ static int alcor_pci_probe(struct pci_dev *pdev, ret =pci_request_regions (pdev,DRV_NAME_ALCOR_PCI );if (ret) {dev_err (&pdev->dev,"Cannot request region\n" ); -return -ENOMEM ; + ret = -ENOMEM ; + goto error_free_ida; }if (!(pci_resource_flags (pdev, bar) &IORESOURCE_MEM )) {
@@ -324,6 +325,8 @@ static int alcor_pci_probe(struct pci_dev *pdev, error_release_regions:pci_release_regions (pdev); +error_free_ida: +ida_free (&alcor_pci_idr, priv->id);return ret; }
@@ -337,7 +340,7 @@ static void alcor_pci_remove(struct pci_dev *pdev)mfd_remove_devices (&pdev->dev); -ida_simple_remove (&alcor_pci_idr, priv->id); +ida_free (&alcor_pci_idr, priv->id);pci_release_regions (pdev);pci_set_drvdata (pdev,NULL );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 383/599 cpufreq: qcom-cpufreq-nvmem: fix reading of PVS Valid fuse
In reply to Greg Kroah-HartmanFrom: Luca Weiss <[email protected]>
[ Upstream commit 4a8a77abf0e2b6468ba0281e33384cbec5fb476a ]
The fuse consists of 64 bits, with this statement we're supposed to get the upper 32 bits but it actually read out of bounds and got 0 instead of the desired value which lead to the "PVS bin not set." codepath being run resetting our pvs value.
--- drivers/cpufreq/qcom-cpufreq-nvmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/qcom-cpufreq-nvmem.c +1 -1
@@ -130,7 +130,7 @@ static void get_krait_bin_format_b(struct device *cpu_dev, }/* Check PVS_BLOW_STATUS */ - pte_efuse = *(((u32 *)buf) +4 ); + pte_efuse = *(((u32 *)buf) +1 ); pte_efuse &=BIT (21 );if (pte_efuse) {dev_dbg (cpu_dev,"PVS bin: %d\n" , *pvs);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 384/599 soundwire: intel: fix wrong register name in intel_shim_wake
In reply to Greg Kroah-HartmanFrom: Libin Yang <[email protected]>
[ Upstream commit 3957db3ae3dae6f8b8168791f154567fe49e1fd7 ]
When clearing the sdw wakests status, we should use SDW_SHIM_WAKESTS.
--- drivers/soundwire/intel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/soundwire/intel.c +2 -2
@@ -521,8 +521,8 @@ static void intel_shim_wake(struct sdw_intel *sdw, bool wake_enable)/* Clear wake status */ wake_sts =intel_readw (shim,SDW_SHIM_WAKESTS ); - wake_sts |= (SDW_SHIM_WAKEEN_ENABLE << link_id); -intel_writew (shim,SDW_SHIM_WAKESTS_STATUS , wake_sts); + wake_sts |= (SDW_SHIM_WAKESTS_STATUS << link_id); +intel_writew (shim,SDW_SHIM_WAKESTS , wake_sts); }mutex_unlock (sdw->link_res->shim_lock); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 385/599 clk: qcom: ipq8074: fix PCI-E clock oops
In reply to Greg Kroah-HartmanFrom: Robert Marko <[email protected]>
[ Upstream commit bf8f5182b8f59309809b41c1d1730ed9ca6134b1 ]
Fix PCI-E clock related kernel oops that are caused by a missing clock parent.
pcie0_rchng_clk_src has num_parents set to 2 but only one parent is actually set via parent_hws, it should also have "XO" defined. This will cause the kernel to panic on a NULL pointer in clk_core_get_parent_by_index().
So, to fix this utilize clk_parent_data to provide gcc_xo_gpll0 parent data.
Since there is already an existing static const char * const gcc_xo_gpll0[] used to provide the same parents via parent_names convert those users to clk_parent_data as well.
Without this earlycon is needed to even catch the OOPS as it will reset the board before serial is initialized with the following:
[ 0.232279] Unable to handle kernel paging request at virtual address 0000a00000000000 [ 0.232322] Mem abort info: [ 0.239094] ESR = 0x96000004 [ 0.241778] EC = 0x25: DABT (current EL), IL = 32 bits [ 0.244908] SET = 0, FnV = 0 [ 0.250377] EA = 0, S1PTW = 0 [ 0.253236] FSC = 0x04: level 0 translation fault [ 0.256277] Data abort info: [ 0.261141] ISV = 0, ISS = 0x00000004 [ 0.264262] CM = 0, WnR = 0 [ 0.267820] [0000a00000000000] address between user and kernel address ranges [ 0.270954] Internal error: Oops: 96000004 [#1] SMP [ 0.278067] Modules linked in: [ 0.282751] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.15.10 #0 [ 0.285882] Hardware name: Xiaomi AX3600 (DT) [ 0.292043] pstate: 20400005 (nzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 0.296299] pc : clk_core_get_parent_by_index+0x68/0xec [ 0.303067] lr : __clk_register+0x1d8/0x820 [ 0.308273] sp : ffffffc01111b7d0 [ 0.312438] x29: ffffffc01111b7d0 x28: 0000000000000000 x27: 0000000000000040 [ 0.315919] x26: 0000000000000002 x25: 0000000000000000 x24: ffffff8000308800 [ 0.323037] x23: ffffff8000308850 x22: ffffff8000308880 x21: ffffff8000308828 [ 0.330155] x20: 0000000000000028 x19: ffffff8000309700 x18: 0000000000000020 [ 0.337272] x17: 000000005cc86990 x16: 0000000000000004 x15: ffffff80001d9d0a [ 0.344391] x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000006 [ 0.351508] x11: 0000000000000003 x10: 0101010101010101 x9 : 0000000000000000 [ 0.358626] x8 : 7f7f7f7f7f7f7f7f x7 : 6468626f5e626266 x6 : 17000a3a403c1b06 [ 0.365744] x5 : 061b3c403a0a0017 x4 : 0000000000000000 x3 : 0000000000000001 [ 0.372863] x2 : 0000a00000000000 x1 : 0000000000000001 x0 : ffffff8000309700 [ 0.379982] Call trace: [ 0.387091] clk_core_get_parent_by_index+0x68/0xec [ 0.389351] __clk_register+0x1d8/0x820 [ 0.394210] devm_clk_hw_register+0x5c/0xe0 [ 0.398030] devm_clk_register_regmap+0x44/0x8c [ 0.402198] qcom_cc_really_probe+0x17c/0x1d0 [ 0.406711] qcom_cc_probe+0x34/0x44 [ 0.411224] gcc_ipq8074_probe+0x18/0x30 [ 0.414869] platform_probe+0x68/0xe0 [ 0.418776] really_probe.part.0+0x9c/0x30c [ 0.422336] __driver_probe_device+0x98/0x144 [ 0.426329] driver_probe_device+0x44/0x11c [ 0.430842] __device_attach_driver+0xb4/0x120 [ 0.434836] bus_for_each_drv+0x68/0xb0 [ 0.439349] __device_attach+0xb0/0x170 [ 0.443081] device_initial_probe+0x14/0x20 [ 0.446901] bus_probe_device+0x9c/0xa4 [ 0.451067] device_add+0x35c/0x834 [ 0.454886] of_device_add+0x54/0x64 [ 0.458360] of_platform_device_create_pdata+0xc0/0x100 [ 0.462181] of_platform_bus_create+0x114/0x370 [ 0.467128] of_platform_bus_create+0x15c/0x370 [ 0.471641] of_platform_populate+0x50/0xcc [ 0.476155] of_platform_default_populate_init+0xa8/0xc8 [ 0.480324] do_one_initcall+0x50/0x1b0 [ 0.485877] kernel_init_freeable+0x234/0x29c [ 0.489436] kernel_init+0x24/0x120 [ 0.493948] ret_from_fork+0x10/0x20 [ 0.497253] Code: d50323bf d65f03c0 f94002a2 b4000302 (f9400042) [ 0.501079] ---[ end trace 4ca7e1129da2abce ]---
--- drivers/clk/qcom/gcc-ipq8074.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
drivers/clk/qcom/gcc-ipq8074.c +9 -10
@@ -60,11 +60,6 @@ static const struct parent_map gcc_xo_gpll0_gpll0_out_main_div2_map[] = { { P_GPLL0_DIV2, 4 }, }; -static const char *const gcc_xo_gpll0[] = { -"xo" , -"gpll0" , -}; -static const struct parent_map gcc_xo_gpll0_map[] = { {P_XO ,0 }, { P_GPLL0, 1 },
@@ -956,6 +951,11 @@ static struct clk_rcg2 blsp1_uart6_apps_clk_src = { }, }; +static const struct clk_parent_data gcc_xo_gpll0[] = { + { .fw_name ="xo" }, + { .hw = &gpll0.clkr.hw }, +}; +static const struct freq_tbl ftbl_pcie_axi_clk_src[] = {F (19200000 ,P_XO ,1 ,0 ,0 ),F (200000000 ,P_GPLL0 ,4 ,0 ,0 ),
@@ -969,7 +969,7 @@ static struct clk_rcg2 pcie0_axi_clk_src = { .parent_map = gcc_xo_gpll0_map, .clkr.hw.init = &(struct clk_init_data ){ .name ="pcie0_axi_clk_src" , - .parent_names = gcc_xo_gpll0, + .parent_data = gcc_xo_gpll0, .num_parents =2 , .ops = &clk_rcg2_ops, },
@@ -1016,7 +1016,7 @@ static struct clk_rcg2 pcie1_axi_clk_src = { .parent_map = gcc_xo_gpll0_map, .clkr.hw.init = &(struct clk_init_data ){ .name ="pcie1_axi_clk_src" , - .parent_names = gcc_xo_gpll0, + .parent_data = gcc_xo_gpll0, .num_parents =2 , .ops = &clk_rcg2_ops, },
@@ -1330,7 +1330,7 @@ static struct clk_rcg2 nss_ce_clk_src = { .parent_map = gcc_xo_gpll0_map, .clkr.hw.init = &(struct clk_init_data ){ .name ="nss_ce_clk_src" , - .parent_names = gcc_xo_gpll0, + .parent_data = gcc_xo_gpll0, .num_parents =2 , .ops = &clk_rcg2_ops, },
@@ -4329,8 +4329,7 @@ static struct clk_rcg2 pcie0_rchng_clk_src = { .parent_map = gcc_xo_gpll0_map, .clkr.hw.init = &(struct clk_init_data ){ .name ="pcie0_rchng_clk_src" , - .parent_hws = (const struct clk_hw *[]) { - &gpll0.clkr.hw }, + .parent_data = gcc_xo_gpll0, .num_parents =2 , .ops = &clk_rcg2_ops, },
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 386/599 iio: mma8452: Fix probe failing when an i2c_device_id is used
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit a47ac019e7e8129b93a0b991e04b2a59872e053d ]
The mma8452_driver declares both of_match_table and i2c_driver.id_table match-tables, but its probe() function only checked for of matches.
Add support for i2c_device_id matches. This fixes the driver not loading on some x86 tablets (e.g. the Nextbook Ares 8) where the i2c_client is instantiated by platform code using an i2c_device_id.
Drop of_match_ptr() protection to avoid unused warning.
--- drivers/iio/accel/mma8452.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-)
drivers/iio/accel/mma8452.c +18 -11
@@ -176,6 +176,7 @@ static const struct mma8452_event_regs trans_ev_regs = {* @enabled_events: event flags enabled and handled by this driver */ struct mma_chip_info { +const char *name;u8 chip_id;const struct iio_chan_spec *channels;int num_channels;
@@ -1303,6 +1304,7 @@ enum {static const struct mma_chip_info mma_chip_info_table[] = { [mma8451] = { + .name ="mma8451" , .chip_id =MMA8451_DEVICE_ID , .channels = mma8451_channels, .num_channels =ARRAY_SIZE (mma8451_channels),
@@ -1327,6 +1329,7 @@ static const struct mma_chip_info mma_chip_info_table[] = { MMA8452_INT_FF_MT, }, [mma8452] = { + .name = "mma8452", .chip_id = MMA8452_DEVICE_ID, .channels = mma8452_channels, .num_channels = ARRAY_SIZE(mma8452_channels),
@@ -1343,6 +1346,7 @@ static const struct mma_chip_info mma_chip_info_table[] = { MMA8452_INT_FF_MT, }, [mma8453] = { + .name = "mma8453", .chip_id = MMA8453_DEVICE_ID, .channels = mma8453_channels, .num_channels = ARRAY_SIZE(mma8453_channels),
@@ -1359,6 +1363,7 @@ static const struct mma_chip_info mma_chip_info_table[] = { MMA8452_INT_FF_MT, }, [mma8652] = { + .name = "mma8652", .chip_id = MMA8652_DEVICE_ID, .channels = mma8652_channels, .num_channels = ARRAY_SIZE(mma8652_channels),
@@ -1368,6 +1373,7 @@ static const struct mma_chip_info mma_chip_info_table[] = { .enabled_events = MMA8452_INT_FF_MT, }, [mma8653] = { + .name = "mma8653", .chip_id = MMA8653_DEVICE_ID, .channels = mma8653_channels, .num_channels = ARRAY_SIZE(mma8653_channels),
@@ -1382,6 +1388,7 @@ static const struct mma_chip_info mma_chip_info_table[] = { .enabled_events = MMA8452_INT_FF_MT, }, [fxls8471] = { + .name = "fxls8471", .chip_id = FXLS8471_DEVICE_ID, .channels = mma8451_channels, .num_channels = ARRAY_SIZE(mma8451_channels),
@@ -1525,13 +1532,6 @@ static int mma8452_probe(struct i2c_client *client,struct mma8452_data *data;struct iio_dev *indio_dev;int ret; -const struct of_device_id *match; - - match =of_match_device (mma8452_dt_ids, &client->dev); -if (!match) { -dev_err (&client->dev,"unknown device model\n" ); -return -ENODEV ; - } indio_dev =devm_iio_device_alloc (&client->dev,sizeof (*data));if (!indio_dev)
@@ -1540,7 +1540,14 @@ static int mma8452_probe(struct i2c_client *client, data =iio_priv (indio_dev); data->client = client;mutex_init (&data->lock); - data->chip_info = match->data; + + data->chip_info =device_get_match_data (&client->dev); +if (!data->chip_info && id) { + data->chip_info = &mma_chip_info_table[id->driver_data]; + }else { +dev_err (&client->dev,"unknown device model\n" ); +return -ENODEV ; + } data->vdd_reg =devm_regulator_get (&client->dev,"vdd" );if (IS_ERR (data->vdd_reg))
@@ -1584,11 +1591,11 @@ static int mma8452_probe(struct i2c_client *client, }dev_info (&client->dev,"registering %s accelerometer; ID 0x%x\n" , - match->compatible, data->chip_info->chip_id); + data->chip_info->name, data->chip_info->chip_id);i2c_set_clientdata (client, indio_dev); indio_dev->info = &mma8452_info; - indio_dev->name = id->name; + indio_dev->name = data->chip_info->name; indio_dev->modes =INDIO_DIRECT_MODE ; indio_dev->channels = data->chip_info->channels; indio_dev->num_channels = data->chip_info->num_channels;
@@ -1814,7 +1821,7 @@ MODULE_DEVICE_TABLE(i2c, mma8452_id);static struct i2c_driver mma8452_driver = { .driver = { .name ="mma8452" , - .of_match_table =of_match_ptr (mma8452_dt_ids), + .of_match_table = mma8452_dt_ids, .pm = &mma8452_pm_ops, }, .probe = mma8452_probe,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 387/599 staging:iio:adc:ad7280a: Fix handing of device address bit reversing.
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit f281e4ddbbc0b60f061bc18a2834e9363ba85f9f ]
The bit reversal was wrong for bits 1 and 3 of the 5 bits. Result is driver failure to probe if you have more than 2 daisy-chained devices. Discovered via QEMU based device emulation.
Fixes tag is for when this moved from a macro to a function, but it was broken before that.
--- drivers/staging/iio/adc/ad7280a.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/iio/adc/ad7280a.c +2 -2
@@ -107,9 +107,9 @@static unsigned int ad7280a_devaddr (unsigned int addr) {return ((addr &0x1 ) <<4 ) | - ((addr &0x2 ) <<3 ) | + ((addr &0x2 ) <<2 ) | (addr &0x4 ) | - ((addr &0x8 ) >>3 ) | + ((addr &0x8 ) >>2 ) | ((addr &0x10 ) >>4 ); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 388/599 pinctrl: renesas: r8a77470: Reduce size for narrow VIN1 channel
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 9e04a0eda84fccab0ac22a33825ad53f47c968c7 ]
The second video-in channel on RZ/G1C has only 12 data lanes, but the pin control driver uses the vin_data union, which is meant for 24 data lanes, thus wasting space.
Fix this by using the vin_data12 union instead.
This reduces kernel size by 96 bytes.
--- drivers/pinctrl/renesas/pfc-r8a77470.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pinctrl/renesas/pfc-r8a77470.c +2 -2
@@ -2121,7 +2121,7 @@ static const unsigned int vin0_clk_mux[] = { VI0_CLK_MARK, };/* - VIN1 ------------------------------------------------------------------- */ -static const union vin_data vin1_data_pins = { +static const union vin_data12 vin1_data_pins = { .data12 = {RCAR_GP_PIN (3 ,1 ),RCAR_GP_PIN (3 ,2 ),RCAR_GP_PIN (3 ,3 ),RCAR_GP_PIN (3 ,4 ),
@@ -2131,7 +2131,7 @@ static const union vin_data vin1_data_pins = { RCAR_GP_PIN(3, 15), RCAR_GP_PIN(3, 16), }, }; -static const union vin_data vin1_data_mux = { +static const union vin_data12 vin1_data_mux = { .data12 = {VI1_DATA0_MARK ,VI1_DATA1_MARK ,VI1_DATA2_MARK ,VI1_DATA3_MARK ,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 389/599 pinctrl: renesas: checker: Fix miscalculation of number of states
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit de9b861018d46af27a5edff8b6baef35c0c0ad4f ]
The checker failed to validate all enum IDs in the description of a register with fixed-width register fields, due to a miscalculation of the number of described states: each register field of n bits can have "1 << n" possible states, not "1".
Increase SH_PFC_MAX_ENUMS accordingly, now more enum IDs are checked (SH-Mobile AG5 has more than 4000 enum IDs defined).
--- drivers/pinctrl/renesas/core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/pinctrl/renesas/core.c +3 -2
@@ -739,7 +739,7 @@ static int sh_pfc_suspend_init(struct sh_pfc *pfc) { return 0; }#ifdef DEBUG #define SH_PFC_MAX_REGS 300 -#define SH_PFC_MAX_ENUMS 3000 +#define SH_PFC_MAX_ENUMS 5000static unsigned int sh_pfc_errors__initdata =0 ;static unsigned int sh_pfc_warnings__initdata =0 ;
@@ -851,7 +851,8 @@ static void __init sh_pfc_check_cfg_reg(const char *drvname,sh_pfc_check_reg (drvname, cfg_reg->reg);if (cfg_reg->field_width) { - n = cfg_reg->reg_width / cfg_reg->field_width; + fw = cfg_reg->field_width; + n = (cfg_reg->reg_width / fw) << fw;/* Skip field checks (done at build time) */ goto check_enum_ids; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 390/599 clk: qcom: ipq8074: Use floor ops for SDCC1 clock
In reply to Greg Kroah-HartmanFrom: Dirk Buchwalder <[email protected]>
[ Upstream commit b77d8306d84f83d1da68028a68c91da9c867b6f6 ]
Use floor ops on SDCC1 APPS clock in order to round down selected clock frequency and avoid overclocking SD/eMMC cards.
For example, currently HS200 cards were failling tuning as they were actually being clocked at 384MHz instead of 192MHz.
This caused some boards to disable 1.8V I/O and force the eMMC into the standard HS mode (50MHz) and that appeared to work despite the eMMC being overclocked to 96Mhz in that case.
There was a previous commit to use floor ops on SDCC clocks, but it looks to have only covered SDCC2 clock.
--- drivers/clk/qcom/gcc-ipq8074.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/gcc-ipq8074.c +1 -1
@@ -1074,7 +1074,7 @@ static struct clk_rcg2 sdcc1_apps_clk_src = { .name = "sdcc1_apps_clk_src", .parent_names = gcc_xo_gpll0_gpll2_gpll0_out_main_div2, .num_parents = 4, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_floor_ops, }, };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 391/599 phy: dphy: Correct lpx parameter and its derivatives(ta_{get,go,sure})
In reply to Greg Kroah-HartmanFrom: Liu Ying <[email protected]>
[ Upstream commit 3153fa38e38af566cf6454a03b1dbadaf6f323c0 ]
According to the comment of the function phy_mipi_dphy_get_default_config(), it uses minimum D-PHY timings based on MIPI D-PHY specification. They are derived from the valid ranges specified in Section 6.9, Table 14, Page 41 of the D-PHY specification (v1.2). The table 14 explicitly mentions that the minimum T-LPX parameter is 50 nanoseconds and the minimum TA-SURE parameter is T-LPX nanoseconds. Likewise, the kernel doc of the 'lpx' and 'ta_sure' members of struct phy_configure_opts_mipi_dphy mentions that the minimum values are 50000 picoseconds and @lpx picoseconds respectively. Also, the function phy_mipi_dphy_config_validate() checks if cfg->lpx is less than 50000 picoseconds and if cfg->ta_sure is less than cfg->lpx, which hints the same minimum values.
Without this patch, the function phy_mipi_dphy_get_default_config() wrongly sets cfg->lpx to 60000 picoseconds and cfg->ta_sure to 2 * cfg->lpx. So, let's correct them to 50000 picoseconds and cfg->lpx respectively.
Note that I've only tested the patch with RM67191 DSI panel on i.MX8mq EVK. Help is needed to test with other i.MX8mq, Meson and Rockchip platforms, as I don't have the hardwares.
--- drivers/phy/phy-core-mipi-dphy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/phy/phy-core-mipi-dphy.c +2 -2
@@ -66,10 +66,10 @@ int phy_mipi_dphy_get_default_config(unsigned long pixel_clock, cfg->hs_trail =max (4 *8 * ui,60000 +4 *4 * ui); cfg->init =100 ; - cfg->lpx =60000 ; + cfg->lpx =50000 ; cfg->ta_get =5 * cfg->lpx; cfg->ta_go =4 * cfg->lpx; - cfg->ta_sure =2 * cfg->lpx; + cfg->ta_sure = cfg->lpx; cfg->wakeup =1000 ; cfg->hs_clk_rate = hs_clk_rate;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 392/599 serial: 8250_mid: Balance reference count for PCI DMA device
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 67ec6dd0b257bd81b4e9fcac89b29da72f6265e5 ]
The pci_get_slot() increases its reference count, the caller must decrement the reference count by calling pci_dev_put().
Depends-on: d9eda9bab237 ("serial: 8250_pci: Intel MID UART support to its own driver")
--- drivers/tty/serial/8250/8250_mid.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
drivers/tty/serial/8250/8250_mid.c +15 -4
@@ -73,6 +73,11 @@ static int pnw_setup(struct mid8250 *mid, struct uart_port *p)return 0 ; } +static void pnw_exit (struct mid8250 *mid) +{ +pci_dev_put (mid->dma_dev); +} +static int tng_handle_irq (struct uart_port *p) {struct mid8250 *mid = p->private_data;
@@ -124,6 +129,11 @@ static int tng_setup(struct mid8250 *mid, struct uart_port *p)return 0 ; } +static void tng_exit (struct mid8250 *mid) +{ +pci_dev_put (mid->dma_dev); +} +static int dnv_handle_irq (struct uart_port *p) {struct mid8250 *mid = p->private_data;
@@ -330,9 +340,9 @@ static int mid8250_probe(struct pci_dev *pdev, const struct pci_device_id *id)pci_set_drvdata (pdev, mid);return 0 ; + err: -if (mid->board->exit) - mid->board->exit (mid); + mid->board->exit (mid);return ret; }
@@ -342,8 +352,7 @@ static void mid8250_remove(struct pci_dev *pdev)serial8250_unregister_port (mid->line); -if (mid->board->exit) - mid->board->exit (mid); + mid->board->exit (mid); }static const struct mid8250_board pnw_board = {
@@ -351,6 +360,7 @@ static const struct mid8250_board pnw_board = { .freq = 50000000, .base_baud = 115200, .setup = pnw_setup, + .exit = pnw_exit, };static const struct mid8250_board tng_board = {
@@ -358,6 +368,7 @@ static const struct mid8250_board tng_board = { .freq = 38400000, .base_baud = 1843200, .setup = tng_setup, + .exit = tng_exit, };static const struct mid8250_board dnv_board = {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 393/599 serial: 8250_lpss: Balance reference count for PCI DMA device
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 5318f70da7e82649d794fc27d8a127c22aa3566e ]
The pci_get_slot() increases its reference count, the caller must decrement the reference count by calling pci_dev_put().
Depends-on: a13e19cf3dc1 ("serial: 8250_lpss: split LPSS driver to separate module")
--- drivers/tty/serial/8250/8250_lpss.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-)
drivers/tty/serial/8250/8250_lpss.c +22 -6
@@ -121,8 +121,7 @@ static int byt_serial_setup(struct lpss8250 *lpss, struct uart_port *port) {struct dw_dma_slave *param = &lpss->dma_param;struct pci_dev *pdev =to_pci_dev (port->dev); -unsigned int dma_devfn =PCI_DEVFN (PCI_SLOT (pdev->devfn),0 ); -struct pci_dev *dma_dev =pci_get_slot (pdev->bus, dma_devfn); +struct pci_dev *dma_dev;switch (pdev->device) {case PCI_DEVICE_ID_INTEL_BYT_UART1 :
@@ -141,6 +140,8 @@ static int byt_serial_setup(struct lpss8250 *lpss, struct uart_port *port)return -EINVAL ; } + dma_dev =pci_get_slot (pdev->bus,PCI_DEVFN (PCI_SLOT (pdev->devfn),0 )); + param->dma_dev = &dma_dev->dev; param->m_master =0 ; param->p_master =1 ;
@@ -156,11 +157,26 @@ static int byt_serial_setup(struct lpss8250 *lpss, struct uart_port *port)return 0 ; } +static void byt_serial_exit (struct lpss8250 *lpss) +{ +struct dw_dma_slave *param = &lpss->dma_param; + +/* Paired with pci_get_slot() in the byt_serial_setup() above */ +put_device (param->dma_dev); +} +static int ehl_serial_setup (struct lpss8250 *lpss,struct uart_port *port) {return 0 ; } +static void ehl_serial_exit (struct lpss8250 *lpss) +{ +struct uart_8250_port *up =serial8250_get_port (lpss->data.line); + + up->dma =NULL ; +} +#ifdef CONFIG_SERIAL_8250_DMA static const struct dw_dma_platform_data qrk_serial_dma_pdata = { .nr_channels = 2,
@@ -335,8 +351,7 @@ static int lpss8250_probe(struct pci_dev *pdev, const struct pci_device_id *id)return 0 ; err_exit: -if (lpss->board->exit) - lpss->board->exit (lpss); + lpss->board->exit (lpss);pci_free_irq_vectors (pdev);return ret; }
@@ -347,8 +362,7 @@ static void lpss8250_remove(struct pci_dev *pdev)serial8250_unregister_port (lpss->data.line); -if (lpss->board->exit) - lpss->board->exit (lpss); + lpss->board->exit (lpss);pci_free_irq_vectors (pdev); }
@@ -356,12 +370,14 @@ static const struct lpss8250_board byt_board = { .freq = 100000000, .base_baud = 2764800, .setup = byt_serial_setup, + .exit = byt_serial_exit, };static const struct lpss8250_board ehl_board = { .freq =200000000 , .base_baud =12500000 , .setup = ehl_serial_setup, + .exit = ehl_serial_exit, };static const struct lpss8250_board qrk_board = {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 394/599 NFS: Use of mapping_set_error() results in spurious errors
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
[ Upstream commit 6c984083ec2453dfd3fcf98f392f34500c73e3f2 ]
The use of mapping_set_error() in conjunction with calls to filemap_check_errors() is problematic because every error gets reported as either an EIO or an ENOSPC by filemap_check_errors() in functions such as filemap_write_and_wait() or filemap_write_and_wait_range(). In almost all cases, we prefer to use the more nuanced wb errors.
--- fs/nfs/write.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/nfs/write.c +4 -1
@@ -314,7 +314,10 @@ static void nfs_mapping_set_error(struct page *page, int error)struct address_space *mapping =page_file_mapping (page);SetPageError (page); -mapping_set_error (mapping, error); +filemap_set_wb_err (mapping, error); +if (mapping->host) +errseq_set (&mapping->host->i_sb->s_wb_err, + error == -ENOSPC ? -ENOSPC : -EIO );nfs_set_pageerror (mapping); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 395/599 serial: 8250: Fix race condition in RTS-after-send handling
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit dedab69fd650ea74710b2e626e63fd35584ef773 ]
Set em485->active_timer = NULL isn't always enough to take out the stop timer. While there is a check that it acts in the right state (i.e. waiting for RTS-after-send to pass after sending some chars) but the following might happen:
- CPU1: some chars send, shifter becomes empty, stop tx timer armed
- CPU0: more chars send before RTS-after-send expired
- CPU0: shifter empty irq, port lock taken
- CPU1: tx timer triggers, waits for port lock
- CPU0: em485->active_timer = &em485->stop_tx_timer, hrtimer_start(), releases lock()
- CPU1: get lock, see em485->active_timer == &em485->stop_tx_timer, tear down RTS too early
This fix bases on research done by Steffen Trumtrar.
--- drivers/tty/serial/8250/8250_port.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/tty/serial/8250/8250_port.c +12 -0
@@ -1620,6 +1620,18 @@ static inline void start_tx_rs485(struct uart_port *port)struct uart_8250_port *up =up_to_u8250p (port);struct uart_8250_em485 *em485 = up->em485; +/* +* While serial8250_em485_handle_stop_tx() is a noop if +* em485->active_timer != &em485->stop_tx_timer, it might happen that +* the timer is still armed and triggers only after the current bunch of +* chars is send and em485->active_timer == &em485->stop_tx_timer again. +* So cancel the timer. There is still a theoretical race condition if +* the timer is already running and only comes around to check for +* em485->active_timer when &em485->stop_tx_timer is armed again. +*/ +if (em485->active_timer == &em485->stop_tx_timer) +hrtimer_try_to_cancel (&em485->stop_tx_timer); + em485->active_timer =NULL ;if (em485->tx_stopped) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 396/599 iio: adc: Add check for devm_request_threaded_irq
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit b30537a4cedcacf0ade2f33ebb7610178ed1e7d7 ]
As the potential failure of the devm_request_threaded_irq(), it should be better to check the return value and return error if fails.
--- drivers/iio/adc/twl6030-gpadc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/iio/adc/twl6030-gpadc.c +2 -0
@@ -911,6 +911,8 @@ static int twl6030_gpadc_probe(struct platform_device *pdev) ret =devm_request_threaded_irq (dev, irq,NULL , twl6030_gpadc_irq_handler,IRQF_ONESHOT ,"twl6030_gpadc" , indio_dev); +if (ret) +return ret; ret =twl6030_gpadc_enable_irq (TWL6030_GPADC_RT_SW1_EOC_MASK );if (ret <0 ) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 397/599 habanalabs: Add check for pci_enable_device
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 9c27896ac1bb83ea5c461ce6f7089d02102a2b21 ]
As the potential failure of the pci_enable_device(), it should be better to check the return value and return error if fails.
--- drivers/misc/habanalabs/common/debugfs.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/misc/habanalabs/common/debugfs.c +2 -0
@@ -859,6 +859,8 @@ static ssize_t hl_set_power_state(struct file *f, const char __user *buf,pci_set_power_state (hdev->pdev,PCI_D0 );pci_restore_state (hdev->pdev); rc =pci_enable_device (hdev->pdev); +if (rc <0 ) +return rc; }else if (value ==2 ) {pci_save_state (hdev->pdev);pci_disable_device (hdev->pdev);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 398/599 NFS: Return valid errors from nfs2/3_decode_dirent()
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
[ Upstream commit 64cfca85bacde54caa64e0ab855c48734894fa37 ]
Valid return values for decode_dirent() callback functions are:
0: Success
-EBADCOOKIE: End of directory
-EAGAIN: End of xdr_stream
All errors need to map into one of those three values.
--- fs/nfs/nfs2xdr.c | 2 +- fs/nfs/nfs3xdr.c | 21 ++++++--------------- 2 files changed, 7 insertions(+), 16 deletions(-)
fs/nfs/nfs2xdr.c +1 -1
@@ -948,7 +948,7 @@ int nfs2_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, error =decode_filename_inline (xdr, &entry->name, &entry->len);if (unlikely (error)) -return error; +return -EAGAIN ;/* * The type (size and byte order) of nfscookie isn't defined in
fs/nfs/nfs3xdr.c +6 -15
@@ -1964,7 +1964,6 @@ int nfs3_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, bool plus) {struct user_namespace *userns =rpc_userns (entry->server->client); -struct nfs_entry old = *entry;__be32 *p;int error;u64 new_cookie;
@@ -1984,15 +1983,15 @@ int nfs3_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, error =decode_fileid3 (xdr, &entry->ino);if (unlikely (error)) -return error; +return -EAGAIN ; error =decode_inline_filename3 (xdr, &entry->name, &entry->len);if (unlikely (error)) -return error; +return -EAGAIN ; error =decode_cookie3 (xdr, &new_cookie);if (unlikely (error)) -return error; +return -EAGAIN ; entry->d_type =DT_UNKNOWN ;
@@ -2000,7 +1999,7 @@ int nfs3_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, entry->fattr->valid =0 ; error =decode_post_op_attr (xdr, entry->fattr, userns);if (unlikely (error)) -return error; +return -EAGAIN ;if (entry->fattr->valid &NFS_ATTR_FATTR_V3 ) entry->d_type =nfs_umode_to_dtype (entry->fattr->mode);
@@ -2015,11 +2014,8 @@ int nfs3_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry,return -EAGAIN ;if (*p != xdr_zero) { error =decode_nfs_fh3 (xdr, entry->fh); -if (unlikely (error)) { -if (error == -E2BIG ) - goto out_truncated; -return error; - } +if (unlikely (error)) +return -EAGAIN ; }else zero_nfs_fh3 (entry->fh); }
@@ -2028,11 +2024,6 @@ int nfs3_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, entry->cookie = new_cookie;return 0 ; - -out_truncated: -dprintk ("NFS: directory entry contains invalid file handle\n" ); - *entry = old; -return -EAGAIN ; }/*
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 399/599 dma-debug: fix return value of __setup handlers
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 80e4390981618e290616dbd06ea190d4576f219d ]
When valid kernel command line parameters
dma_debug=off dma_debug_entries=100
are used, they are reported as Unknown parameters and added to init's environment strings, polluting it.
Unknown kernel command line parameters "BOOT_IMAGE=/boot/bzImage-517rc5
dma_debug=off dma_debug_entries=100", will be passed to user space.
and
Run /sbin/init as init process
with arguments:
/sbin/init
with environment:
HOME=/
TERM=linux
BOOT_IMAGE=/boot/bzImage-517rc5
dma_debug=off
dma_debug_entries=100Return 1 from these __setup handlers to indicate that the command line option has been handled.
--- kernel/dma/debug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/dma/debug.c +2 -2
@@ -928,7 +928,7 @@ static __init int dma_debug_cmdline(char *str) global_disable = true; } -return 0 ; +return 1 ; }static __init int dma_debug_entries_cmdline (char *str)
@@ -937,7 +937,7 @@ static __init int dma_debug_entries_cmdline(char *str)return -EINVAL ;if (!get_option (&str, &nr_prealloc_entries)) nr_prealloc_entries =PREALLOC_DMA_DEBUG_ENTRIES ; -return 0 ; +return 1 ; }__setup ("dma_debug=" , dma_debug_cmdline);
Signature · 8 lines
2.34.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Greg Kroah-Hartman
maintainerPATCH 400/599 clk: imx7d: Remove audio_mclk_root_clk
In reply to Greg Kroah-HartmanFrom: Abel Vesa <[email protected]>
[ Upstream commit eccac77ede3946c90143447cdc785dc16aec4b24 ]
The audio_mclk_root_clk was added as a gate with the CCGR121 (0x4790), but according to the reference manual, there is no such gate. The CCGR121 belongs to ECSPI2 and it is not shared.
--- drivers/clk/imx/clk-imx7d.c | 1 - 1 file changed, 1 deletion(-)
drivers/clk/imx/clk-imx7d.c +0 -1
@@ -849,7 +849,6 @@ static void __init imx7d_clocks_init(struct device_node *ccm_node) hws[IMX7D_WDOG4_ROOT_CLK ] =imx_clk_hw_gate4 ("wdog4_root_clk" ,"wdog_post_div" , base +0x49f0 ,0 ); hws[IMX7D_KPP_ROOT_CLK ] =imx_clk_hw_gate4 ("kpp_root_clk" ,"ipg_root_clk" , base +0x4aa0 ,0 ); hws[IMX7D_CSI_MCLK_ROOT_CLK ] =imx_clk_hw_gate4 ("csi_mclk_root_clk" ,"csi_mclk_post_div" , base +0x4490 ,0 ); - hws[IMX7D_AUDIO_MCLK_ROOT_CLK ] =imx_clk_hw_gate4 ("audio_mclk_root_clk" ,"audio_mclk_post_div" , base +0x4790 ,0 ); hws[IMX7D_WRCLK_ROOT_CLK ] =imx_clk_hw_gate4 ("wrclk_root_clk" ,"wrclk_post_div" , base +0x47a0 ,0 ); hws[IMX7D_USB_CTRL_CLK ] =imx_clk_hw_gate4 ("usb_ctrl_clk" ,"ahb_root_clk" , base +0x4680 ,0 ); hws[IMX7D_USB_PHY1_CLK ] =imx_clk_hw_gate4 ("usb_phy1_clk" ,"pll_usb1_main_clk" , base +0x46a0 ,0 );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 401/599 clk: at91: sama7g5: fix parents of PDMCs GCLK
In reply to Greg Kroah-HartmanFrom: Codrin Ciubotariu <[email protected]>
[ Upstream commit 1a944729d8635fa59638f24e8727d5ccaa0c8c19 ]
Audio PLL can be used as parent by the GCLKs of PDMCs.
--- drivers/clk/at91/sama7g5.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/clk/at91/sama7g5.c +4 -4
@@ -606,16 +606,16 @@ static const struct { { .n = "pdmc0_gclk", .id = 68, .r = { .max = 50000000 }, - .pp = { "syspll_divpmcck", "baudpll_divpmcck", }, - .pp_mux_table = { 5, 8, }, + .pp = { "syspll_divpmcck", "audiopll_divpmcck", }, + .pp_mux_table = { 5, 9, }, .pp_count = 2, .pp_chg_id = INT_MIN, }, { .n = "pdmc1_gclk", .id = 69, .r = { .max = 50000000, }, - .pp = { "syspll_divpmcck", "baudpll_divpmcck", }, - .pp_mux_table = { 5, 8, }, + .pp = { "syspll_divpmcck", "audiopll_divpmcck", }, + .pp_mux_table = { 5, 9, }, .pp_count = 2, .pp_chg_id = INT_MIN, },
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 402/599 clk: qcom: clk-rcg2: Update logic to calculate D value for RCG
In reply to Greg Kroah-HartmanFrom: Taniya Das <[email protected]>
[ Upstream commit 58922910add18583d5273c2edcdb9fd7bf4eca02 ]
The display pixel clock has a requirement on certain newer platforms to support M/N as (2/3) and the final D value calculated results in underflow errors.
As the current implementation does not check for D value is within the accepted range for a given M & N value. Update the logic to calculate the final D value based on the range.
--- drivers/clk/qcom/clk-rcg2.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/clk/qcom/clk-rcg2.c +11 -2
@@ -264,7 +264,7 @@ static int clk_rcg2_determine_floor_rate(struct clk_hw *hw,static int __clk_rcg2_configure (struct clk_rcg2 *rcg,const struct freq_tbl *f) { -u32 cfg, mask; +u32 cfg, mask, d_val, not2d_val, n_minus_m;struct clk_hw *hw = &rcg->clkr.hw;int ret, index =qcom_find_src_index (hw, rcg->parent_map, f->src);
@@ -283,8 +283,17 @@ static int __clk_rcg2_configure(struct clk_rcg2 *rcg, const struct freq_tbl *f)if (ret)return ret; +/* Calculate 2d value */ + d_val = f->n; + + n_minus_m = f->n - f->m; + n_minus_m *=2 ; + + d_val =clamp_t (u32, d_val, f->m, n_minus_m); + not2d_val = ~d_val & mask; + ret =regmap_update_bits (rcg->clkr.regmap, -RCG_D_OFFSET (rcg), mask, ~f->n); +RCG_D_OFFSET (rcg), mask, not2d_val);if (ret)return ret; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 403/599 clk: qcom: clk-rcg2: Update the frac table for pixel clock
In reply to Greg Kroah-HartmanFrom: Taniya Das <[email protected]>
[ Upstream commit b527358cb4cd58a8279c9062b0786f1fab628fdc ]
Support the new numerator and denominator for pixel clock on SM8350 and support rgb101010, RGB888 use cases on SM8450.
--- drivers/clk/qcom/clk-rcg2.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/qcom/clk-rcg2.c +1 -0
@@ -648,6 +648,7 @@ static const struct frac_entry frac_table_pixel[] = { { 2, 9 }, { 4, 9 }, { 1, 1 }, + { 2, 3 }, { } };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 404/599 dmaengine: hisi_dma: fix MSI allocate fail when reload hisi_dma
In reply to Greg Kroah-HartmanFrom: Jie Hai <[email protected]>
[ Upstream commit b95044b38425f563404234d96bbb20cc6360c7e1 ]
Remove the loaded hisi_dma driver and reload it, the driver fails to work properly. The following error is reported in the kernel log:
[ 1475.597609] hisi_dma 0000:7b:00.0: Failed to allocate MSI vectors! [ 1475.604915] hisi_dma: probe of 0000:7b:00.0 failed with error -28
As noted in "The MSI Driver Guide HOWTO"[1], the number of MSI interrupt must be a power of two. The Kunpeng DMA driver allocates 30 MSI interrupts. As a result, no space left on device is reported when the driver is reloaded and allocates interrupt vectors from the interrupt domain.
This patch changes the number of interrupt vectors allocated by hisi_dma driver to 32 to avoid this problem.
[1] https://www.kernel.org/doc/html/latest/PCI/msi-howto.html
--- drivers/dma/hisi_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/hisi_dma.c +1 -1
@@ -30,7 +30,7 @@#define HISI_DMA_MODE 0x217c#define HISI_DMA_OFFSET 0x100 -#define HISI_DMA_MSI_NUM 30 +#define HISI_DMA_MSI_NUM 32#define HISI_DMA_CHAN_NUM 30#define HISI_DMA_Q_DEPTH_VAL 1024
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 405/599 remoteproc: qcom: Fix missing of_node_put in adsp_alloc_memory_region
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 505b5b1616e200042999de715dbe7c1e2735cd65 ]
The device_node pointer is returned by of_parse_phandle() with refcount incremented. We should use of_node_put() on it when done.
--- drivers/remoteproc/qcom_q6v5_adsp.c | 1 + 1 file changed, 1 insertion(+)
drivers/remoteproc/qcom_q6v5_adsp.c +1 -0
@@ -406,6 +406,7 @@ static int adsp_alloc_memory_region(struct qcom_adsp *adsp) } ret =of_address_to_resource (node,0 , &r); +of_node_put (node);if (ret)return ret;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 406/599 remoteproc: qcom_wcnss: Add missing of_node_put() in wcnss_alloc_memory_region
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 8f90161a66bc3d6b9fe8dde4d9028d20eae1b62a ]
The device_node pointer is returned by of_parse_phandle() with refcount incremented. We should use of_node_put() on it when done.
--- drivers/remoteproc/qcom_wcnss.c | 1 + 1 file changed, 1 insertion(+)
drivers/remoteproc/qcom_wcnss.c +1 -0
@@ -448,6 +448,7 @@ static int wcnss_alloc_memory_region(struct qcom_wcnss *wcnss) } ret =of_address_to_resource (node,0 , &r); +of_node_put (node);if (ret)return ret;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 407/599 remoteproc: qcom_q6v5_mss: Fix some leaks in q6v5_alloc_memory_region
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 07a5dcc4bed9d7cae54adf5aa10ff9f037a3204b ]
The device_node pointer is returned by of_parse_phandle() or of_get_child_by_name() with refcount incremented. We should use of_node_put() on it when done.
This function only call of_node_put(node) when of_address_to_resource succeeds, missing error cases.
--- drivers/remoteproc/qcom_q6v5_mss.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/remoteproc/qcom_q6v5_mss.c +7 -4
@@ -1594,18 +1594,20 @@ static int q6v5_alloc_memory_region(struct q6v5 *qproc)* reserved memory regions from device's memory-region property. */ child =of_get_child_by_name (qproc->dev->of_node,"mba" ); -if (!child) +if (!child) { node =of_parse_phandle (qproc->dev->of_node,"memory-region" ,0 ); -else + }else { node =of_parse_phandle (child,"memory-region" ,0 ); +of_node_put (child); + } ret =of_address_to_resource (node,0 , &r); +of_node_put (node);if (ret) {dev_err (qproc->dev,"unable to resolve mba region\n" );return ret; } -of_node_put (node); qproc->mba_phys = r.start; qproc->mba_size =resource_size (&r);
@@ -1622,14 +1624,15 @@ static int q6v5_alloc_memory_region(struct q6v5 *qproc) }else { child =of_get_child_by_name (qproc->dev->of_node,"mpss" ); node =of_parse_phandle (child,"memory-region" ,0 ); +of_node_put (child); } ret =of_address_to_resource (node,0 , &r); +of_node_put (node);if (ret) {dev_err (qproc->dev,"unable to resolve mpss region\n" );return ret; } -of_node_put (node); qproc->mpss_phys = qproc->mpss_reloc = r.start; qproc->mpss_size =resource_size (&r);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 408/599 nvdimm/region: Fix default alignment for small regions
In reply to Greg Kroah-HartmanFrom: Dan Williams <[email protected]>
[ Upstream commit d9d290d7e659e9db3e4518040cc18b97f5535f4a ]
In preparation for removing BLK aperture support the NVDIMM unit tests discovered that the default alignment can be set higher than the capacity of the region. Fall back to PAGE_SIZE in that case.
Given this has not been seen in the wild, elide notifying -stable.
--- drivers/nvdimm/region_devs.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/nvdimm/region_devs.c +3 -0
@@ -1018,6 +1018,9 @@ static unsigned long default_align(struct nd_region *nd_region) } } +if (nd_region->ndr_size <MEMREMAP_COMPAT_ALIGN_MAX ) + align =PAGE_SIZE ; + mappings =max_t (u16,1 , nd_region->ndr_mappings);div_u64_rem (align, mappings, &remainder);if (remainder)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 409/599 clk: actions: Terminate clk_div_table with sentinel element
In reply to Greg Kroah-HartmanFrom: Jonathan Neuschäfer <[email protected]>
[ Upstream commit d8a441e53e2434b1401e52dfd66b05263e442edc ]
In order that the end of a clk_div_table can be detected, it must be terminated with a sentinel element (.div = 0).
In owl-s900.s, the { 0, 8 } element was probably meant to be just that, so this patch changes { 0, 8 } to { 0, 0 }.
--- drivers/clk/actions/owl-s700.c | 1 + drivers/clk/actions/owl-s900.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/clk/actions/owl-s700.c +1 -0
@@ -162,6 +162,7 @@ static struct clk_div_table hdmia_div_table[] = {static struct clk_div_table rmii_div_table[] = { {0 ,4 }, {1 ,10 }, + {0 ,0 } };/* divider clocks */
drivers/clk/actions/owl-s900.c +1 -1
@@ -140,7 +140,7 @@ static struct clk_div_table rmii_ref_div_table[] = {static struct clk_div_table usb3_mac_div_table[] = { {1 ,2 }, {2 ,3 }, {3 ,4 }, - {0 ,8 }, + {0 ,0 } };static struct clk_div_table i2s_div_table[] = {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 410/599 clk: loongson1: Terminate clk_div_table with sentinel element
In reply to Greg Kroah-HartmanFrom: Jonathan Neuschäfer <[email protected]>
[ Upstream commit 3eb00f89162e80083dfcaa842468b510462cfeaa ]
In order that the end of a clk_div_table can be detected, it must be terminated with a sentinel element (.div = 0).
--- drivers/clk/loongson1/clk-loongson1c.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/loongson1/clk-loongson1c.c +1 -0
@@ -37,6 +37,7 @@ static const struct clk_div_table ahb_div_table[] = { [1] = { .val = 1, .div = 4 }, [2] = { .val = 2, .div = 3 }, [3] = { .val = 3, .div = 3 }, + [4] = { /* sentinel */ } };void __init ls1x_clk_init (void )
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 411/599 clk: clps711x: Terminate clk_div_table with sentinel element
In reply to Greg Kroah-HartmanFrom: Jonathan Neuschäfer <[email protected]>
[ Upstream commit 8bed4ed5aa3431085d9d27afc35d684856460eda ]
In order that the end of a clk_div_table can be detected, it must be terminated with a sentinel element (.div = 0).
--- drivers/clk/clk-clps711x.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/clk-clps711x.c +2 -0
@@ -28,11 +28,13 @@ static const struct clk_div_table spi_div_table[] = { { .val = 1, .div = 8, }, { .val = 2, .div = 2, }, { .val = 3, .div = 1, }, + {/* sentinel */ } };static const struct clk_div_table timer_div_table[] = { { .val =0 , .div =256 , }, { .val =1 , .div =1 , }, + {/* sentinel */ } }; struct clps711x_clk {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 412/599 clk: tegra: tegra124-emc: Fix missing put_device() call in emc_ensure_emc_driver
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 6d6ef58c2470da85a99119f74d34216c8074b9f0 ]
The reference taken by 'of_find_device_by_node()' must be released when not needed anymore.
Add the corresponding 'put_device()' in the error handling path.
--- drivers/clk/tegra/clk-tegra124-emc.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/tegra/clk-tegra124-emc.c +1 -0
@@ -191,6 +191,7 @@ static struct tegra_emc *emc_ensure_emc_driver(struct tegra_clk_emc *tegra) tegra->emc =platform_get_drvdata (pdev);if (!tegra->emc) { +put_device (&pdev->dev);pr_err ("%s: cannot find EMC driver\n" , __func__);return NULL ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 413/599 NFS: remove unneeded check in decode_devicenotify_args()
In reply to Greg Kroah-HartmanFrom: Alexey Khoroshilov <[email protected]>
[ Upstream commit cb8fac6d2727f79f211e745b16c9abbf4d8be652 ]
[You don't often get email from [email protected]. Learn why this is important at http://aka.ms/LearnAboutSenderIdentification.]
Overflow check in not needed anymore after we switch to kmalloc_array().
--- fs/nfs/callback_xdr.c | 4 ---- 1 file changed, 4 deletions(-)
fs/nfs/callback_xdr.c +0 -4
@@ -272,10 +272,6 @@ __be32 decode_devicenotify_args(struct svc_rqst *rqstp, n =ntohl (*p++);if (n ==0 ) goto out; -if (n >ULONG_MAX /sizeof (*args->devs)) { - status =htonl (NFS4ERR_BADXDR ); - goto out; - } args->devs =kmalloc_array (n,sizeof (*args->devs),GFP_KERNEL );if (!args->devs) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 414/599 staging: mt7621-dts: fix LEDs and pinctrl on GB-PC1 devicetree
In reply to Greg Kroah-HartmanFrom: Arınç ÜNAL <[email protected]>
[ Upstream commit 6256e18686158fa49e019297f990f1c1817aabf1 ]
Fix LED and pinctrl definitions on the GB-PC1 devicetree. Refer to the schematics of the device for more information.
LED fixes:
- Change GPIO6 LED label from system to power as GPIO6 is connected to PLED.
- Add default-on default-trigger to power LED.
- Change GPIO8 LED label from status to system as GPIO8 is connected to SYS_LED.
- Add disk-activity default-trigger to system LED.
- Switch to the color:function naming scheme.
- Remove lan1 and lan2 LEDs as they don't exist.
Pinctrl fixes:
- Claim state_default node under pinctrl node.
- Change pinctrl0 node name to state-default.
- Change gpio node name to gpio-pinmux to respect Documentation/devicetree/bindings/pinctrl/ralink,rt2880-pinmux.yaml.
- Sort pin groups alphabetically.
Misc fixes:
- Fix formatting.
- Use the status value "okay".
- Define hexadecimal addresses in lower case.
- Make hexadecimal addresses for memory easier to read.
--- drivers/staging/mt7621-dts/gbpc1.dts | 40 +++++++++++++--------------- 1 file changed, 18 insertions(+), 22 deletions(-)
drivers/staging/mt7621-dts/gbpc1.dts +18 -22
@@ -11,7 +11,8 @@ memory@0 { device_type = "memory"; - reg = <0x0 0x1c000000>, <0x20000000 0x4000000>; + reg = <0x00000000 0x1c000000>, + <0x20000000 0x04000000>; }; chosen {
@@ -37,24 +38,16 @@ gpio-leds { compatible = "gpio-leds"; - system { - label = "gb-pc1:green:system"; + power { + label = "green:power"; gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + linux,default-trigger = "default-on"; }; - status { - label = "gb-pc1:green:status"; + system { + label = "green:system"; gpios = <&gpio 8 GPIO_ACTIVE_LOW>; - }; - - lan1 { - label = "gb-pc1:green:lan1"; - gpios = <&gpio 24 GPIO_ACTIVE_LOW>; - }; - - lan2 { - label = "gb-pc1:green:lan2"; - gpios = <&gpio 25 GPIO_ACTIVE_LOW>; + linux,default-trigger = "disk-activity"; }; }; };
@@ -94,9 +87,8 @@ partition@50000 { label = "firmware"; - reg = <0x50000 0x1FB0000>; + reg = <0x50000 0x1fb0000>; }; - }; };
@@ -122,9 +114,12 @@ }; &pinctrl { - state_default: pinctrl0 { - default_gpio: gpio { - groups = "wdt", "rgmii2", "uart3"; + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: state-default { + gpio-pinmux { + groups = "rgmii2", "uart3", "wdt"; function = "gpio"; }; };
@@ -133,12 +128,13 @@ &switch0 { ports { port@0 { + status = "okay"; label = "ethblack"; - status = "ok"; }; + port@4 { + status = "okay"; label = "ethblue"; - status = "ok"; }; }; };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 415/599 staging: mt7621-dts: fix formatting
In reply to Greg Kroah-HartmanFrom: Arınç ÜNAL <[email protected]>
[ Upstream commit 7eeec44d33f6be7caca4fe9ca4e653cf315a36c1 ]
Fix formatting on mt7621.dtsi.
--- drivers/staging/mt7621-dts/mt7621.dtsi | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/staging/mt7621-dts/mt7621.dtsi +12 -3
@@ -56,9 +56,9 @@ regulator-max-microvolt = <3300000>; enable-active-high; regulator-always-on; - }; + }; - mmc_fixed_1v8_io: fixedregulator@1 { + mmc_fixed_1v8_io: fixedregulator@1 { compatible = "regulator-fixed"; regulator-name = "mmc_io"; regulator-min-microvolt = <1800000>;
@@ -412,17 +412,18 @@ mediatek,ethsys = <ðsys>; - gmac0: mac@0 { compatible = "mediatek,eth-mac"; reg = <0>; phy-mode = "rgmii"; + fixed-link { speed = <1000>; full-duplex; pause; }; }; + gmac1: mac@1 { compatible = "mediatek,eth-mac"; reg = <1>;
@@ -430,6 +431,7 @@ phy-mode = "rgmii-rxid"; phy-handle = <&phy_external>; }; + mdio-bus { #address-cells = <1>; #size-cells = <0>;
@@ -456,36 +458,43 @@ #address-cells = <1>; #size-cells = <0>; reg = <0>; + port@0 { status = "off"; reg = <0>; label = "lan0"; }; + port@1 { status = "off"; reg = <1>; label = "lan1"; }; + port@2 { status = "off"; reg = <2>; label = "lan2"; }; + port@3 { status = "off"; reg = <3>; label = "lan3"; }; + port@4 { status = "off"; reg = <4>; label = "lan4"; }; + port@6 { reg = <6>; label = "cpu"; ethernet = <&gmac0>; phy-mode = "trgmii"; + fixed-link { speed = <1000>; full-duplex;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 416/599 staging: mt7621-dts: fix pinctrl properties for ethernet
In reply to Greg Kroah-HartmanFrom: Arınç ÜNAL <[email protected]>
[ Upstream commit 0a93c0d75809582893e82039143591b9265b520e ]
Add pinctrl properties with rgmii1 & mdio pins under ethernet node which was wrongfully put under an external phy node.
GMAC1 will start working with this fix.
Move GB-PC2 specific phy_external node to its own device tree.
--- drivers/staging/mt7621-dts/gbpc2.dts | 16 +++++++++++----- drivers/staging/mt7621-dts/mt7621.dtsi | 13 +++---------- 2 files changed, 14 insertions(+), 15 deletions(-)
drivers/staging/mt7621-dts/gbpc2.dts +11 -5
@@ -12,10 +12,16 @@ function = "gpio"; }; -&gmac1 { - status = "ok"; -}; +ðernet { + gmac1: mac@1 { + status = "ok"; + phy-handle = <&phy_external>; + }; -&phy_external { - status = "ok"; + mdio-bus { + phy_external: ethernet-phy@5 { + reg = <5>; + phy-mode = "rgmii-rxid"; + }; + }; };
drivers/staging/mt7621-dts/mt7621.dtsi +3 -10
@@ -412,6 +412,9 @@ mediatek,ethsys = <ðsys>; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>; + gmac0: mac@0 { compatible = "mediatek,eth-mac"; reg = <0>;
@@ -429,22 +432,12 @@ reg = <1>; status = "off"; phy-mode = "rgmii-rxid"; - phy-handle = <&phy_external>; }; mdio-bus { #address-cells = <1>; #size-cells = <0>; - phy_external: ethernet-phy@5 { - status = "off"; - reg = <5>; - phy-mode = "rgmii-rxid"; - - pinctrl-names = "default"; - pinctrl-0 = <&rgmii2_pins>; - }; - switch0: switch0@0 { compatible = "mediatek,mt7621"; #address-cells = <1>;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 417/599 staging: mt7621-dts: fix GB-PC2 devicetree
In reply to Greg Kroah-HartmanFrom: Arınç ÜNAL <[email protected]>
[ Upstream commit 5bc148649cf358d0cccf525452a4efbd4bc89a0f ]
Fix the GB-PC2 devicetree. Refer to the schematics of the device for more information.
GB-PC2 devicetree fixes:
- Include mt7621.dtsi instead of gbpc1.dts. Add the missing definitions.
- Remove gpio-leds node as the system LED is not wired to anywhere on the board and the power LED is directly wired to GND.
- Remove uart3 pin group from gpio-pinmux node as it's not used as GPIO.
- Use reg 7 for the external phy to be on par with Documentation/devicetree/bindings/net/dsa/mt7530.txt.
- Use the status value "okay".
--- drivers/staging/mt7621-dts/gbpc2.dts | 110 +++++++++++++++++++++++++-- 1 file changed, 102 insertions(+), 8 deletions(-)
drivers/staging/mt7621-dts/gbpc2.dts +102 -8
@@ -1,27 +1,121 @@ /dts-v1/; -#include "gbpc1.dts" +#include "mt7621.dtsi" + +#include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/input/input.h> / { compatible = "gnubee,gb-pc2", "mediatek,mt7621-soc"; model = "GB-PC2"; + + memory@0 { + device_type = "memory"; + reg = <0x00000000 0x1c000000>, + <0x20000000 0x04000000>; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + palmbus: palmbus@1e000000 { + i2c@900 { + status = "okay"; + }; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 18 GPIO_ACTIVE_HIGH>; + linux,code = <KEY_RESTART>; + }; + }; }; -&default_gpio { - groups = "wdt", "uart3"; - function = "gpio"; +&sdhci { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + broken-flash-reset; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x1fb0000>; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pinctrl { + pinctrl-names = "default"; + pinctrl-0 = <&state_default>; + + state_default: state-default { + gpio-pinmux { + groups = "wdt"; + function = "gpio"; + }; + }; }; ðernet { gmac1: mac@1 { - status = "ok"; - phy-handle = <&phy_external>; + status = "okay"; + phy-handle = <ðphy7>; }; mdio-bus { - phy_external: ethernet-phy@5 { - reg = <5>; + ethphy7: ethernet-phy@7 { + reg = <7>; phy-mode = "rgmii-rxid"; }; }; }; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "ethblack"; + }; + + port@4 { + status = "okay"; + label = "ethblue"; + }; + }; +};
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 418/599 pinctrl: mediatek: Fix missing of_node_put() in mtk_pctrl_init
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit dab4df9ca919f59e5b9dd84385eaf34d4f20dbb0 ]
The device_node pointer is returned by of_parse_phandle() with refcount incremented. We should use of_node_put() on it when done.
--- drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pinctrl/mediatek/pinctrl-mtk-common.c +2 -0
@@ -1039,6 +1039,7 @@ int mtk_pctrl_init(struct platform_device *pdev, node =of_parse_phandle (np,"mediatek,pctl-regmap" ,0 );if (node) { pctl->regmap1 =syscon_node_to_regmap (node); +of_node_put (node);if (IS_ERR (pctl->regmap1))return PTR_ERR (pctl->regmap1); }else if (regmap) {
@@ -1052,6 +1053,7 @@ int mtk_pctrl_init(struct platform_device *pdev, node =of_parse_phandle (np,"mediatek,pctl-regmap" ,1 );if (node) { pctl->regmap2 =syscon_node_to_regmap (node); +of_node_put (node);if (IS_ERR (pctl->regmap2))return PTR_ERR (pctl->regmap2); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 419/599 pinctrl: mediatek: paris: Fix PIN_CONFIG_BIAS_* readback
In reply to Greg Kroah-HartmanFrom: Chen-Yu Tsai <[email protected]>
[ Upstream commit 3e8c6bc608480010f360c4a59578d7841726137d ]
When reading back pin bias settings, if the pin is not in the corresponding bias state, the function should return -EINVAL.
Fix this in the mediatek-paris pinctrl library so that the read back state is not littered with bogus a "input bias disabled" combined with "pull up" or "pull down" states.
--- drivers/pinctrl/mediatek/pinctrl-paris.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)
drivers/pinctrl/mediatek/pinctrl-paris.c +6 -10
@@ -96,20 +96,16 @@ static int mtk_pinconf_get(struct pinctrl_dev *pctldev, err = hw->soc->bias_get_combo (hw, desc, &pullup, &ret);if (err) goto out; +if (ret ==MTK_PUPD_SET_R1R0_00 ) + ret =MTK_DISABLE ;if (param ==PIN_CONFIG_BIAS_DISABLE ) { -if (ret ==MTK_PUPD_SET_R1R0_00 ) - ret =MTK_DISABLE ; +if (ret !=MTK_DISABLE ) + err = -EINVAL ; }else if (param ==PIN_CONFIG_BIAS_PULL_UP ) { -/* When desire to get pull-up value, return -* error if current setting is pull-down -*/ -if (!pullup) +if (!pullup || ret ==MTK_DISABLE ) err = -EINVAL ; }else if (param ==PIN_CONFIG_BIAS_PULL_DOWN ) { -/* When desire to get pull-down value, return -* error if current setting is pull-up -*/ -if (pullup) +if (pullup || ret ==MTK_DISABLE ) err = -EINVAL ; } }else {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 420/599 pinctrl: mediatek: paris: Fix "argument" argument type for mtk_pinconf_get()
In reply to Greg Kroah-HartmanFrom: Chen-Yu Tsai <[email protected]>
[ Upstream commit 19bce7ce0a593c7024030a0cda9e23facea3c93d ]
For mtk_pinconf_get(), the "argument" argument is typically returned by pinconf_to_config_argument(), which holds the value for a given pinconf parameter. It certainly should not have the type of "enum pin_config_param", which describes the type of the pinconf parameter itself.
Change the type to u32, which matches the return type of pinconf_to_config_argument().
--- drivers/pinctrl/mediatek/pinctrl-paris.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/pinctrl/mediatek/pinctrl-paris.c +1 -2
@@ -184,8 +184,7 @@ static int mtk_pinconf_get(struct pinctrl_dev *pctldev, }static int mtk_pinconf_set (struct pinctrl_dev *pctldev,unsigned int pin, -enum pin_config_param param, -enum pin_config_param arg) +enum pin_config_param param,u32 arg) {struct mtk_pinctrl *hw =pinctrl_dev_get_drvdata (pctldev);const struct mtk_pin_desc *desc;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 421/599 pinctrl: mediatek: paris: Fix pingroup pin config state readback
In reply to Greg Kroah-HartmanFrom: Chen-Yu Tsai <[email protected]>
[ Upstream commit 54fe55fb384ade630ef20b9a8b8f3b2a89ad97f2 ]
mtk_pconf_group_get(), used to read back pingroup pin config state, simply returns a set of configs saved from a previous invocation of mtk_pconf_group_set(). This is an unfiltered, unvalidated set passed in from the pinconf core, which does not match the current hardware state.
Since the driver library is designed to have one pin per group, pass through mtk_pconf_group_get() to mtk_pinconf_get(), to read back the current pin config state of the only pin in the group.
Also drop the assignment of pin config state to the group.
--- drivers/pinctrl/mediatek/pinctrl-paris.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/pinctrl/mediatek/pinctrl-paris.c +3 -5
@@ -714,10 +714,10 @@ static int mtk_pconf_group_get(struct pinctrl_dev *pctldev, unsigned group, unsigned long *config) {struct mtk_pinctrl *hw =pinctrl_dev_get_drvdata (pctldev); +struct mtk_pinctrl_group *grp = &hw->groups[group]; - *config = hw->groups[group].config; - -return 0 ; +/* One pin per group only */ +return mtk_pinconf_get (pctldev, grp->pin, config); } static int mtk_pconf_group_set(struct pinctrl_dev *pctldev, unsigned group,
@@ -733,8 +733,6 @@ static int mtk_pconf_group_set(struct pinctrl_dev *pctldev, unsigned group, pinconf_to_config_argument(configs[i]));if (ret <0 )return ret; - - grp->config = configs[i]; }return 0 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 422/599 pinctrl: mediatek: paris: Skip custom extra pin config dump for virtual GPIOs
In reply to Greg Kroah-HartmanFrom: Chen-Yu Tsai <[email protected]>
[ Upstream commit 1763933d377ecb05454f8d20e3c8922480db2ac0 ]
Virtual GPIOs do not have any hardware state associated with them. Any attempt to read back hardware state for these pins result in error codes.
Skip dumping extra pin config information for these virtual GPIOs.
--- drivers/pinctrl/mediatek/pinctrl-paris.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/pinctrl/mediatek/pinctrl-paris.c +3 -0
@@ -580,6 +580,9 @@ ssize_t mtk_pctrl_show_one_pin(struct mtk_pinctrl *hw,if (gpio >= hw->soc->npins)return -EINVAL ; +if (mtk_is_virt_gpio (hw, gpio)) +return -EINVAL ; + desc = (const struct mtk_pin_desc *)&hw->soc->pins[gpio]; pinmux =mtk_pctrl_get_pinmux (hw, gpio);if (pinmux >= hw->soc->nfuncs)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 423/599 pinctrl: nomadik: Add missing of_node_put() in nmk_pinctrl_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit c09ac191b1f97cfa06f394dbfd7a5db07986cefc ]
This node pointer is returned by of_parse_phandle() with refcount incremented in this function. Calling of_node_put() to avoid the refcount leak.
--- drivers/pinctrl/nomadik/pinctrl-nomadik.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pinctrl/nomadik/pinctrl-nomadik.c +3 -1
@@ -1883,8 +1883,10 @@ static int nmk_pinctrl_probe(struct platform_device *pdev) } prcm_np =of_parse_phandle (np,"prcm" ,0 ); -if (prcm_np) +if (prcm_np) { npct->prcm_base =of_iomap (prcm_np,0 ); +of_node_put (prcm_np); + }if (!npct->prcm_base) {if (version ==PINCTRL_NMK_STN8815 ) { dev_info(&pdev->dev,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 424/599 pinctrl/rockchip: Add missing of_node_put() in rockchip_pinctrl_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 89388f8730699c259f8090ec435fb43569efe4ac ]
The device_node pointer is returned by of_parse_phandle() with refcount incremented. We should use of_node_put() on it when done.
--- drivers/pinctrl/pinctrl-rockchip.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pinctrl/pinctrl-rockchip.c +2 -0
@@ -3774,6 +3774,7 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev) node =of_parse_phandle (np,"rockchip,grf" ,0 );if (node) { info->regmap_base =syscon_node_to_regmap (node); +of_node_put (node);if (IS_ERR (info->regmap_base))return PTR_ERR (info->regmap_base); }else {
@@ -3810,6 +3811,7 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev) node =of_parse_phandle (np,"rockchip,pmu" ,0 );if (node) { info->regmap_pmu =syscon_node_to_regmap (node); +of_node_put (node);if (IS_ERR (info->regmap_pmu))return PTR_ERR (info->regmap_pmu); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 425/599 tty: hvc: fix return value of __setup handler
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 53819a0d97aace1425bb042829e3446952a9e8a9 ]
__setup() handlers should return 1 to indicate that the boot option has been handled or 0 to indicate that it was not handled. Add a pr_warn() message if the option value is invalid and then always return 1.
--- drivers/tty/hvc/hvc_iucv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/tty/hvc/hvc_iucv.c +3 -1
@@ -1470,7 +1470,9 @@ static int __init hvc_iucv_init(void)*/ static int __init hvc_iucv_config (char *val) { -return kstrtoul (val,10 , &hvc_iucv_devices); +if (kstrtoul (val,10 , &hvc_iucv_devices)) +pr_warn ("hvc_iucv= invalid parameter value '%s'\n" , val); +return 1 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 426/599 kgdboc: fix return value of __setup handler
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit ab818c7aa7544bf8d2dd4bdf68878b17a02eb332 ]
__setup() handlers should return 1 to obsolete_checksetup() in init/main.c to indicate that the boot option has been handled. A return of 0 causes the boot option/value to be listed as an Unknown kernel parameter and added to init's (limited) environment strings. So return 1 from kgdboc_option_setup().
Unknown kernel command line parameters "BOOT_IMAGE=/boot/bzImage-517rc7
kgdboc=kbd kgdbts=", will be passed to user space.
Run /sbin/init as init process
with arguments:
/sbin/init
with environment:
HOME=/
TERM=linux
BOOT_IMAGE=/boot/bzImage-517rc7
kgdboc=kbd
kgdbts=--- drivers/tty/serial/kgdboc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/tty/serial/kgdboc.c +3 -3
@@ -403,16 +403,16 @@ static int kgdboc_option_setup(char *opt) {if (!opt) {pr_err ("config string not provided\n" ); -return -EINVAL ; +return 1 ; }if (strlen (opt) >=MAX_CONFIG_LEN ) {pr_err ("config string too long\n" ); -return -ENOSPC ; +return 1 ; }strcpy (config, opt); -return 0 ; +return 1 ; }__setup ("kgdboc=" , kgdboc_option_setup);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 427/599 serial: 8250: fix XOFF/XON sending when DMA is used
In reply to Greg Kroah-HartmanFrom: Ilpo Järvinen <[email protected]>
[ Upstream commit f58c252e30cf74f68b0054293adc03b5923b9f0e ]
When 8250 UART is using DMA, x_char (XON/XOFF) is never sent to the wire. After this change, x_char is injected correctly.
Create uart_xchar_out() helper for sending the x_char out and accounting related to it. It seems that almost every driver does these same steps with x_char. Except for 8250, however, almost all currently lack .serial_out so they cannot immediately take advantage of this new helper.
The downside of this patch is that it might reintroduce the problems some devices faced with mixed DMA/non-DMA transfer which caused revert f967fc8f165f (Revert "serial: 8250_dma:
don't bother DMA with small transfers"). However, the impact should be limited to cases with XON/XOFF (that didn't work with DMA capable devices to begin with so this problem is not very likely to cause a major issue, if any at all).
--- drivers/tty/serial/8250/8250_dma.c | 11 ++++++++++- drivers/tty/serial/8250/8250_port.c | 4 +--- drivers/tty/serial/serial_core.c | 14 ++++++++++++++ include/linux/serial_core.h | 2 ++ 4 files changed, 27 insertions(+), 4 deletions(-)
drivers/tty/serial/8250/8250_dma.c +10 -1
@@ -64,10 +64,19 @@ int serial8250_tx_dma(struct uart_8250_port *p)struct uart_8250_dma *dma = p->dma;struct circ_buf *xmit = &p->port.state->xmit;struct dma_async_tx_descriptor *desc; +struct uart_port *up = &p->port;int ret; -if (dma->tx_running) +if (dma->tx_running) { +if (up->x_char) { +dmaengine_pause (dma->txchan); +uart_xchar_out (up,UART_TX ); +dmaengine_resume (dma->txchan); + }return 0 ; + }else if (up->x_char) { +uart_xchar_out (up,UART_TX ); + }if (uart_tx_stopped (&p->port) ||uart_circ_empty (xmit)) {/* We have been called from __dma_tx_complete() */
drivers/tty/serial/8250/8250_port.c +1 -3
@@ -1817,9 +1817,7 @@ void serial8250_tx_chars(struct uart_8250_port *up)int count;if (port->x_char) { -serial_out (up,UART_TX , port->x_char); - port->icount.tx++; - port->x_char =0 ; +uart_xchar_out (port,UART_TX );return ; }if (uart_tx_stopped (port)) {
drivers/tty/serial/serial_core.c +14 -0
@@ -676,6 +676,20 @@ static void uart_flush_buffer(struct tty_struct *tty)tty_port_tty_wakeup (&state->port); } +/* +* This function performs low-level write of high-priority XON/XOFF +* character and accounting for it. +* +* Requires uart_port to implement .serial_out(). +*/ +void uart_xchar_out (struct uart_port *uport,int offset) +{ +serial_port_out (uport, offset, uport->x_char); + uport->icount.tx++; + uport->x_char =0 ; +} +EXPORT_SYMBOL_GPL (uart_xchar_out); +/* * This function is used to send a high-priority XON/XOFF character to * the device
include/linux/serial_core.h +2 -0
@@ -463,6 +463,8 @@ extern void uart_handle_cts_change(struct uart_port *uport,extern void uart_insert_char (struct uart_port *port,unsigned int status,unsigned int overrun,unsigned int ch,unsigned int flag); +void uart_xchar_out (struct uart_port *uport,int offset); +#ifdef CONFIG_MAGIC_SYSRQ_SERIAL #define SYSRQ_TIMEOUT (HZ * 5)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 428/599 kgdbts: fix return value of __setup handler
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 96c9e802c64014a7716865332d732cc9c7f24593 ]
__setup() handlers should return 1 to indicate that the boot option has been handled. A return of 0 causes the boot option/value to be listed as an Unknown kernel parameter and added to init's (limited) environment strings. So return 1 from kgdbts_option_setup().
Unknown kernel command line parameters "BOOT_IMAGE=/boot/bzImage-517rc7
kgdboc=kbd kgdbts=", will be passed to user space.
Run /sbin/init as init process
with arguments:
/sbin/init
with environment:
HOME=/
TERM=linux
BOOT_IMAGE=/boot/bzImage-517rc7
kgdboc=kbd
kgdbts=--- drivers/misc/kgdbts.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/misc/kgdbts.c +2 -2
@@ -1060,10 +1060,10 @@ static int kgdbts_option_setup(char *opt) {if (strlen (opt) >=MAX_CONFIG_LEN ) {printk (KERN_ERR "kgdbts: config string too long\n" ); -return -ENOSPC ; +return 1 ; }strcpy (config, opt); -return 0 ; +return 1 ; }__setup ("kgdbts=" , kgdbts_option_setup);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 429/599 firmware: google: Properly state IOMEM dependency
In reply to Greg Kroah-HartmanFrom: David Gow <[email protected]>
[ Upstream commit 37fd83916da2e4cae03d350015c82a67b1b334c4 ]
The Google Coreboot implementation requires IOMEM functions (memmremap, memunmap, devm_memremap), but does not specify this is its Kconfig. This results in build errors when HAS_IOMEM is not set, such as on some UML configurations:
/usr/bin/ld: drivers/firmware/google/coreboot_table.o: in function `coreboot_table_probe':
coreboot_table.c:(.text+0x311): undefined reference to memremap' /usr/bin/ld: coreboot_table.c:(.text+0x34e): undefined reference to memunmap' /usr/bin/ld: drivers/firmware/google/memconsole-coreboot.o: in function `memconsole_probe':
memconsole-coreboot.c:(.text+0x12d): undefined reference to memremap' /usr/bin/ld: memconsole-coreboot.c:(.text+0x17e): undefined reference to devm_memremap' /usr/bin/ld: memconsole-coreboot.c:(.text+0x191): undefined reference to memunmap' /usr/bin/ld: drivers/firmware/google/vpd.o: in function vpd_section_destroy.isra.0':
vpd.c:(.text+0x300): undefined reference to `memunmap'/usr/bin/ld: drivers/firmware/google/vpd.o: in function `vpd_section_init':
vpd.c:(.text+0x382): undefined reference to `memremap'/usr/bin/ld: vpd.c:(.text+0x459): undefined reference to memunmap' /usr/bin/ld: drivers/firmware/google/vpd.o: in function vpd_probe':
vpd.c:(.text+0x59d): undefined reference to `memremap'/usr/bin/ld: vpd.c:(.text+0x5d3): undefined reference to `memunmap'
collect2: error: ld returned 1 exit status
--- drivers/firmware/google/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/google/Kconfig +1 -1
@@ -21,7 +21,7 @@ config GOOGLE_SMI config GOOGLE_COREBOOT_TABLE tristate "Coreboot Table Access" - depends on ACPI || OF + depends on HAS_IOMEM && (ACPI || OF) help This option enables the coreboot_table module, which provides other firmware modules access to the coreboot table. The coreboot table
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 430/599 driver core: dd: fix return value of __setup handler
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit f2aad54703dbe630f9d8b235eb58e8c8cc78f37d ]
When "driver_async_probe=nulltty" is used on the kernel boot command line, it causes an Unknown parameter message and the string is added to init's environment strings, polluting them.
Unknown kernel command line parameters "BOOT_IMAGE=/boot/bzImage-517rc6 driver_async_probe=nulltty", will be passed to user space.
Run /sbin/init as init process
with arguments:
/sbin/init
with environment:
HOME=/
TERM=linux
BOOT_IMAGE=/boot/bzImage-517rc6
driver_async_probe=nullttyChange the return value of the __setup function to 1 to indicate that the __setup option has been handled.
--- drivers/base/dd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/dd.c +1 -1
@@ -771,7 +771,7 @@ static int __init save_async_options(char *buf)pr_warn ("Too long list of driver names for 'driver_async_probe'!\n" );strlcpy (async_probe_drv_names, buf,ASYNC_DRV_NAMES_MAX_LEN ); -return 0 ; +return 1 ; }__setup ("driver_async_probe=" , save_async_options);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 431/599 jfs: fix divide error in dbNextAG
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit 2cc7cc01c15f57d056318c33705647f87dcd4aab ]
Syzbot reported divide error in dbNextAG(). The problem was in missing validation check for malicious image.
Syzbot crafted an image with bmp->db_numag equal to 0. There wasn't any validation checks, but dbNextAG() blindly use bmp->db_numag in divide expression
Fix it by validating bmp->db_numag in dbMount() and return an error if image is malicious
--- fs/jfs/jfs_dmap.c | 7 +++++++ 1 file changed, 7 insertions(+)
fs/jfs/jfs_dmap.c +7 -0
@@ -148,6 +148,7 @@ static const s8 budtab[256] = {* 0 - success * -ENOMEM - insufficient memory * -EIO - i/o error +* -EINVAL - wrong bmap data */ int dbMount (struct inode *ipbmap) {
@@ -179,6 +180,12 @@ int dbMount(struct inode *ipbmap) bmp->db_nfree =le64_to_cpu (dbmp_le->dn_nfree); bmp->db_l2nbperpage =le32_to_cpu (dbmp_le->dn_l2nbperpage); bmp->db_numag =le32_to_cpu (dbmp_le->dn_numag); +if (!bmp->db_numag) { +release_metapage (mp); +kfree (bmp); +return -EINVAL ; + } + bmp->db_maxlevel =le32_to_cpu (dbmp_le->dn_maxlevel); bmp->db_maxag =le32_to_cpu (dbmp_le->dn_maxag); bmp->db_agpref =le32_to_cpu (dbmp_le->dn_agpref);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 432/599 netfilter: nf_conntrack_tcp: preserve liberal flag in tcp options
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit f2dd495a8d589371289981d5ed33e6873df94ecc ]
Do not reset IP_CT_TCP_FLAG_BE_LIBERAL flag in out-of-sync scenarios coming before the TCP window tracking, otherwise such connections will fail in the window check.
Update tcp_options() to leave this flag in place and add a new helper function to reset the tcp window state.
Based on patch from Sven Auhagen.
--- net/netfilter/nf_conntrack_proto_tcp.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
net/netfilter/nf_conntrack_proto_tcp.c +13 -4
@@ -354,8 +354,8 @@ static void tcp_options(const struct sk_buff *skb, length, buff);BUG_ON (ptr ==NULL ); - state->td_scale = - state->flags =0 ; + state->td_scale =0 ; + state->flags &=IP_CT_TCP_FLAG_BE_LIBERAL ;while (length >0 ) {int opcode=*ptr++;
@@ -840,6 +840,16 @@ static bool nf_conntrack_tcp_established(const struct nf_conn *ct)test_bit (IPS_ASSURED_BIT , &ct->status); } +static void nf_ct_tcp_state_reset (struct ip_ct_tcp_state *state) +{ + state->td_end =0 ; + state->td_maxend =0 ; + state->td_maxwin =0 ; + state->td_maxack =0 ; + state->td_scale =0 ; + state->flags &=IP_CT_TCP_FLAG_BE_LIBERAL ; +} +/* Returns verdict for packet, or -1 for invalid. */ int nf_conntrack_tcp_packet(struct nf_conn *ct, struct sk_buff *skb,
@@ -946,8 +956,7 @@ int nf_conntrack_tcp_packet(struct nf_conn *ct, ct->proto.tcp.last_flags &= ~IP_CT_EXP_CHALLENGE_ACK ; ct->proto.tcp.seen[ct->proto.tcp.last_dir].flags = ct->proto.tcp.last_flags; -memset (&ct->proto.tcp.seen[dir],0 , -sizeof (struct ip_ct_tcp_state )); +nf_ct_tcp_state_reset (&ct->proto.tcp.seen[dir]);break ; } ct->proto.tcp.last_index = index;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 433/599 NFSv4.1: dont retry BIND_CONN_TO_SESSION on session error
In reply to Greg Kroah-HartmanFrom: Olga Kornievskaia <[email protected]>
[ Upstream commit 1d15d121cc2ad4d016a7dc1493132a9696f91fc5 ]
There is no reason to retry the operation if a session error had occurred in such case result structure isn't filled out.
--- fs/nfs/nfs4proc.c | 1 + 1 file changed, 1 insertion(+)
fs/nfs/nfs4proc.c +1 -0
@@ -8205,6 +8205,7 @@ nfs4_bind_one_conn_to_session_done(struct rpc_task *task, void *calldata)case -NFS4ERR_DEADSESSION :nfs4_schedule_session_recovery (clp->cl_session, task->tk_status); +return ; }if (args->dir ==NFS4_CDFC4_FORE_OR_BOTH && res->dir !=NFS4_CDFS4_BOTH ) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 434/599 kdb: Fix the putarea helper function
In reply to Greg Kroah-HartmanFrom: Daniel Thompson <[email protected]>
[ Upstream commit c1cb81429df462eca1b6ba615cddd21dd3103c46 ]
Currently kdb_putarea_size() uses copy_from_kernel_nofault() to write *to* arbitrary kernel memory. This is obviously wrong and means the memory modify ('mm') command is a serious risk to debugger stability: if we poke to a bad address we'll double-fault and lose our debug session.
Fix this the (very) obvious way.
Note that there are two Fixes: tags because the API was renamed and this patch will only trivially backport as far as the rename (and this is probably enough). Nevertheless Christoph's rename did not introduce this problem so I wanted to record that!
--- kernel/debug/kdb/kdb_support.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/debug/kdb/kdb_support.c +1 -1
@@ -350,7 +350,7 @@ int kdb_getarea_size(void *res, unsigned long addr, size_t size)*/ int kdb_putarea_size (unsigned long addr,void *res,size_t size) { -int ret =copy_from_kernel_nofault ((char *)addr, (char *)res, size); +int ret =copy_to_kernel_nofault ((char *)addr, (char *)res, size);if (ret) {if (!KDB_STATE (SUPPRESS )) {kdb_printf ("kdb_putarea: Bad address 0x%lx\n" , addr);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 435/599 clk: qcom: gcc-msm8994: Fix gpll4 width
In reply to Greg Kroah-HartmanFrom: Konrad Dybcio <[email protected]>
[ Upstream commit 71021db1c532c2545ae53b9ee85b37b7154f51d4 ]
The gpll4 postdiv is actually a div4, so make sure that Linux is aware of this.
This fixes the following error messages:
mmc1: Card appears overclocked; req 200000000 Hz, actual 343999999 Hz
mmc1: Card appears overclocked; req 400000000 Hz, actual 687999999 Hz
--- drivers/clk/qcom/gcc-msm8994.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/qcom/gcc-msm8994.c +1 -0
@@ -108,6 +108,7 @@ static struct clk_alpha_pll gpll4_early = {static struct clk_alpha_pll_postdiv gpll4 = { .offset =0x1dc0 , + .width =4 , .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT ], .clkr.hw.init = &(struct clk_init_data ) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 436/599 clk: Initialize orphan req_rate
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
[ Upstream commit 5f7e2af00807f2117650e711a58b7f0e986ce1df ]
When registering a clock that doesn't have a recalc_rate implementation, and doesn't have its parent registered yet, we initialize the clk_core rate and 'req_rate' fields to 0.
The rate field is later updated when the parent is registered in clk_core_reparent_orphans_nolock() using __clk_recalc_rates(), but the 'req_rate' field is never updated.
This leads to an issue in clk_set_rate_range() and clk_put(), since those functions will call clk_set_rate() with the content of 'req_rate' to provide drivers with the opportunity to change the rate based on the new boundaries. In this case, we would call clk_set_rate() with a rate of 0, effectively enforcing the minimum allowed for this clock whenever we would call one of those two functions, even though the actual rate might be within range.
Let's fix this by setting 'req_rate' in clk_core_reparent_orphans_nolock() with the rate field content just updated by the call to __clk_recalc_rates().
--- drivers/clk/clk.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/clk/clk.c +13 -0
@@ -3384,6 +3384,19 @@ static void clk_core_reparent_orphans_nolock(void)__clk_set_parent_after (orphan, parent,NULL );__clk_recalc_accuracies (orphan);__clk_recalc_rates (orphan,0 ); + +/* +* __clk_init_parent() will set the initial req_rate to +* 0 if the clock doesn't have clk_ops::recalc_rate and +* is an orphan when it's registered. +* +* 'req_rate' is used by clk_set_rate_range() and +* clk_put() to trigger a clk_set_rate() call whenever +* the boundaries are modified. Let's make sure +* 'req_rate' is set to something non-zero so that +* clk_set_rate_range() doesn't drop the frequency. +*/ + orphan->req_rate = orphan->rate; } } }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 437/599 xen: fix is_xen_pmu()
In reply to Greg Kroah-HartmanFrom: Juergen Gross <[email protected]>
[ Upstream commit de2ae403b4c0e79a3410e63bc448542fbb9f9bfc ]
is_xen_pmu() is taking the cpu number as parameter, but it is not using it. Instead it just tests whether the Xen PMU initialization on the current cpu did succeed. As this test is done by checking a percpu pointer, preemption needs to be disabled in order to avoid switching the cpu while doing the test. While resuming from suspend() this seems not to be the case:
[ 88.082751] ACPI: PM: Low-level resume complete [ 88.087933] ACPI: EC: EC started [ 88.091464] ACPI: PM: Restoring platform NVS memory [ 88.097166] xen_acpi_processor: Uploading Xen processor PM info [ 88.103850] Enabling non-boot CPUs ... [ 88.108128] installing Xen timer for CPU 1 [ 88.112763] BUG: using smp_processor_id() in preemptible [00000000] code: systemd-sleep/7138 [ 88.122256] caller is is_xen_pmu+0x12/0x30 [ 88.126937] CPU: 0 PID: 7138 Comm: systemd-sleep Tainted: G W 5.16.13-2.fc32.qubes.x86_64 #1 [ 88.137939] Hardware name: Star Labs StarBook/StarBook, BIOS 7.97 03/21/2022 [ 88.145930] Call Trace: [ 88.148757] <TASK> [ 88.151193] dump_stack_lvl+0x48/0x5e [ 88.155381] check_preemption_disabled+0xde/0xe0 [ 88.160641] is_xen_pmu+0x12/0x30 [ 88.164441] xen_smp_intr_init_pv+0x75/0x100
Fix that by replacing is_xen_pmu() by a simple boolean variable which reflects the Xen PMU initialization state on cpu 0.
Modify xen_pmu_init() to return early in case it is being called for a cpu other than cpu 0 and the boolean variable not being set.
--- arch/x86/xen/pmu.c | 10 ++++------ arch/x86/xen/pmu.h | 3 ++- arch/x86/xen/smp_pv.c | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-)
arch/x86/xen/pmu.c +4 -6
@@ -512,10 +512,7 @@ irqreturn_t xen_pmu_irq_handler(int irq, void *dev_id)return ret; } -bool is_xen_pmu (int cpu) -{ -return (get_xenpmu_data () !=NULL ); -} +bool is_xen_pmu;void xen_pmu_init (int cpu) {
@@ -526,7 +523,7 @@ void xen_pmu_init(int cpu)BUILD_BUG_ON (sizeof (struct xen_pmu_data ) >PAGE_SIZE ); -if (xen_hvm_domain ()) +if (xen_hvm_domain () || (cpu !=0 && !is_xen_pmu))return ; xenpmu_data = (struct xen_pmu_data *)get_zeroed_page (GFP_KERNEL );
@@ -547,7 +544,8 @@ void xen_pmu_init(int cpu)per_cpu (xenpmu_shared, cpu).xenpmu_data = xenpmu_data;per_cpu (xenpmu_shared, cpu).flags =0 ; -if (cpu ==0 ) { +if (!is_xen_pmu) { + is_xen_pmu = true;perf_register_guest_info_callbacks (&xen_guest_cbs);xen_pmu_arch_init (); }
arch/x86/xen/pmu.h +2 -1
@@ -4,6 +4,8 @@#include <xen/interface/xenpmu.h> +extern bool is_xen_pmu; +irqreturn_t xen_pmu_irq_handler (int irq,void *dev_id);#ifdef CONFIG_XEN_HAVE_VPMU void xen_pmu_init (int cpu);
@@ -12,7 +14,6 @@ void xen_pmu_finish(int cpu);static inline void xen_pmu_init (int cpu) {}static inline void xen_pmu_finish (int cpu) {}#endif -bool is_xen_pmu (int cpu);bool pmu_msr_read (unsigned int msr,uint64_t *val,int *err);bool pmu_msr_write (unsigned int msr,uint32_t low,uint32_t high,int *err);int pmu_apic_update (uint32_t reg);
arch/x86/xen/smp_pv.c +1 -1
@@ -130,7 +130,7 @@ int xen_smp_intr_init_pv(unsigned int cpu)per_cpu (xen_irq_work, cpu).irq = rc;per_cpu (xen_irq_work, cpu).name = callfunc_name; -if (is_xen_pmu (cpu)) { +if (is_xen_pmu) { pmu_name =kasprintf (GFP_KERNEL ,"pmu%d" , cpu); rc = bind_virq_to_irqhandler(VIRQ_XENPMU, cpu, xen_pmu_irq_handler,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 438/599 net: enetc: report software timestamping via SO_TIMESTAMPING
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit feb13dcb1818b775fbd9191f797be67cd605f03e ]
Let user space properly determine that the enetc driver provides software timestamps.
--- drivers/net/ethernet/freescale/enetc/enetc_ethtool.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/freescale/enetc/enetc_ethtool.c +4 -1
@@ -651,7 +651,10 @@ static int enetc_get_ts_info(struct net_device *ndev,#ifdef CONFIG_FSL_ENETC_PTP_CLOCK info->so_timestamping =SOF_TIMESTAMPING_TX_HARDWARE |SOF_TIMESTAMPING_RX_HARDWARE | -SOF_TIMESTAMPING_RAW_HARDWARE ; +SOF_TIMESTAMPING_RAW_HARDWARE | +SOF_TIMESTAMPING_TX_SOFTWARE | +SOF_TIMESTAMPING_RX_SOFTWARE | +SOF_TIMESTAMPING_SOFTWARE ; info->tx_types = (1 <<HWTSTAMP_TX_OFF ) | (1 <<HWTSTAMP_TX_ON );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 439/599 net: hns3: fix bug when PF set the duplicate MAC address for VFs
In reply to Greg Kroah-HartmanFrom: Jian Shen <[email protected]>
[ Upstream commit ccb18f05535c96d26e2d559d402acb87700fc5a7 ]
If the MAC address A is configured to vport A and then vport B. The MAC address of vport A in the hardware becomes invalid. If the address of vport A is changed to MAC address B, the driver needs to delete the MAC address A of vport A. Due to the MAC address A of vport A has become invalid in the hardware entry, so "-ENOENT" is returned. In this case, the "used_umv_size" value recorded in driver is not updated. As a result, the MAC entry status of the software is inconsistent with that of the hardware.
Therefore, the driver updates the umv size even if the MAC entry cannot be found. Ensure that the software and hardware status is consistent.
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +2 -3
@@ -7616,12 +7616,11 @@ int hclge_rm_uc_addr_common(struct hclge_vport *vport,hnae3_set_bit (req.entry_type,HCLGE_MAC_VLAN_BIT0_EN_B ,0 );hclge_prepare_mac_addr (&req, addr, false); ret =hclge_remove_mac_vlan_tbl (vport, &req); -if (!ret) { +if (!ret || ret == -ENOENT ) {mutex_lock (&hdev->vport_lock);hclge_update_umv_space (vport, true);mutex_unlock (&hdev->vport_lock); - }else if (ret == -ENOENT ) { - ret =0 ; +return 0 ; }return ret;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 440/599 net: phy: broadcom: Fix brcm_fet_config_init()
In reply to Greg Kroah-HartmanFrom: Florian Fainelli <[email protected]>
[ Upstream commit bf8bfc4336f7a34e48b3bbd19b1542bf085bdc3d ]
A Broadcom AC201 PHY (same entry as 5241) would be flagged by the Broadcom UniMAC MDIO controller as not completing the turn around properly since the PHY expects 65 MDC clock cycles to complete a write cycle, and the MDIO controller was only sending 64 MDC clock cycles as determined by looking at a scope shot.
This would make the subsequent read fail with the UniMAC MDIO controller command field having MDIO_READ_FAIL set and we would abort the brcm_fet_config_init() function and thus not probe the PHY at all.
After issuing a software reset, wait for at least 1ms which is well above the 1us reset delay advertised by the datasheet and issue a dummy read to let the PHY turn around the line properly. This read specifically ignores -EIO which would be returned by MDIO controllers checking for the line being turned around.
If we have a genuine reaad failure, the next read of the interrupt status register would pick it up anyway.
--- drivers/net/phy/broadcom.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
drivers/net/phy/broadcom.c +21 -0
@@ -11,6 +11,7 @@*/ #include "bcm-phy-lib.h" +#include <linux/delay.h> #include <linux/module.h> #include <linux/phy.h> #include <linux/brcmphy.h>
@@ -622,6 +623,26 @@ static int brcm_fet_config_init(struct phy_device *phydev)if (err <0 )return err; +/* The datasheet indicates the PHY needs up to 1us to complete a reset, +* build some slack here. +*/ +usleep_range (1000 ,2000 ); + +/* The PHY requires 65 MDC clock cycles to complete a write operation +* and turnaround the line properly. +* +* We ignore -EIO here as the MDIO controller (e.g.: mdio-bcm-unimac) +* may flag the lack of turn-around as a read failure. This is +* particularly true with this combination since the MDIO controller +* only used 64 MDC cycles. This is not a critical failure in this +* specific case and it has no functional impact otherwise, so we let +* that one go through. If there is a genuine bus error, the next read +* of MII_BRCM_FET_INTREG will error out. +*/ + err =phy_read (phydev,MII_BMCR ); +if (err <0 && err != -EIO ) +return err; + reg =phy_read (phydev,MII_BRCM_FET_INTREG );if (reg <0 )return reg;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 441/599 selftests: test_vxlan_under_vrf: Fix broken test case
In reply to Greg Kroah-HartmanFrom: Ido Schimmel <[email protected]>
[ Upstream commit b50d3b46f84282d795ae3076111acb75ae1031f3 ]
The purpose of the last test case is to test VXLAN encapsulation and decapsulation when the underlay lookup takes place in a non-default VRF. This is achieved by enslaving the physical device of the tunnel to a VRF.
The binding of the VXLAN UDP socket to the VRF happens when the VXLAN device itself is opened, not when its physical device is opened. This was also mentioned in the cited commit ("tests that moving the underlay from a VRF to another works when down/up the VXLAN interface"), but the test did something else.
Fix it by reopening the VXLAN device instead of its physical device.
Before:
# ./test_vxlan_under_vrf.sh Checking HV connectivity [ OK ] Check VM connectivity through VXLAN (underlay in the default VRF) [ OK ] Check VM connectivity through VXLAN (underlay in a VRF) [FAIL]
After:
# ./test_vxlan_under_vrf.sh Checking HV connectivity [ OK ] Check VM connectivity through VXLAN (underlay in the default VRF) [ OK ] Check VM connectivity through VXLAN (underlay in a VRF) [ OK ]
--- tools/testing/selftests/net/test_vxlan_under_vrf.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tools/testing/selftests/net/test_vxlan_under_vrf.sh +4 -4
@@ -118,11 +118,11 @@ echo "[ OK ]" # Move the underlay to a non-default VRF ip -netns hv-1 link set veth0 vrf vrf-underlay -ip -netns hv-1 link set veth0 down -ip -netns hv-1 link set veth0 up +ip -netns hv-1 link set vxlan0 down +ip -netns hv-1 link set vxlan0 up ip -netns hv-2 link set veth0 vrf vrf-underlay -ip -netns hv-2 link set veth0 down -ip -netns hv-2 link set veth0 up +ip -netns hv-2 link set vxlan0 down +ip -netns hv-2 link set vxlan0 up echo -n "Check VM connectivity through VXLAN (underlay in a VRF) " ip netns exec vm-1 ping -c 1 -W 1 10.0.0.2 &> /dev/null || (echo "[FAIL]"; false)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 442/599 qlcnic: dcb: default to returning -EOPNOTSUPP
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
[ Upstream commit 1521db37f0d42334a88e8ff28198a27d1ed5cd7b ]
Clang static analysis reports this issue
qlcnic_dcb.c:382:10: warning: Assigned value is
garbage or undefined
mbx_out = *val;
^ ~~~~val is set in the qlcnic_dcb_query_hw_capability() wrapper. If there is no query_hw_capability op in dcp, success is returned without setting the val.
For this and similar wrappers, return -EOPNOTSUPP.
--- drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.h +5 -5
@@ -51,7 +51,7 @@ static inline int qlcnic_dcb_get_hw_capability(struct qlcnic_dcb *dcb)if (dcb && dcb->ops->get_hw_capability)return dcb->ops->get_hw_capability (dcb); -return 0 ; +return -EOPNOTSUPP ; }static inline void qlcnic_dcb_free (struct qlcnic_dcb *dcb)
@@ -65,7 +65,7 @@ static inline int qlcnic_dcb_attach(struct qlcnic_dcb *dcb)if (dcb && dcb->ops->attach)return dcb->ops->attach (dcb); -return 0 ; +return -EOPNOTSUPP ; } static inline int
@@ -74,7 +74,7 @@ qlcnic_dcb_query_hw_capability(struct qlcnic_dcb *dcb, char *buf)if (dcb && dcb->ops->query_hw_capability)return dcb->ops->query_hw_capability (dcb, buf); -return 0 ; +return -EOPNOTSUPP ; }static inline void qlcnic_dcb_get_info (struct qlcnic_dcb *dcb)
@@ -89,7 +89,7 @@ qlcnic_dcb_query_cee_param(struct qlcnic_dcb *dcb, char *buf, u8 type)if (dcb && dcb->ops->query_cee_param)return dcb->ops->query_cee_param (dcb, buf, type); -return 0 ; +return -EOPNOTSUPP ; }static inline int qlcnic_dcb_get_cee_cfg (struct qlcnic_dcb *dcb)
@@ -97,7 +97,7 @@ static inline int qlcnic_dcb_get_cee_cfg(struct qlcnic_dcb *dcb)if (dcb && dcb->ops->get_cee_cfg)return dcb->ops->get_cee_cfg (dcb); -return 0 ; +return -EOPNOTSUPP ; }static inline void qlcnic_dcb_aen_handler (struct qlcnic_dcb *dcb,void *msg)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 443/599 net/x25: Fix null-ptr-deref caused by x25_disconnect
In reply to Greg Kroah-HartmanFrom: Duoming Zhou <[email protected]>
[ Upstream commit 7781607938c8371d4c2b243527430241c62e39c2 ]
When the link layer is terminating, x25->neighbour will be set to NULL in x25_disconnect(). As a result, it could cause null-ptr-deref bugs in x25_sendmsg(),x25_recvmsg() and x25_connect(). One of the bugs is shown below.
(Thread 1) | (Thread 2) x25_link_terminated() | x25_recvmsg() x25_kill_by_neigh() | ... x25_disconnect() | lock_sock(sk) ... | ... x25->neighbour = NULL //(1) | ... | x25->neighbour->extended //(2)
The code sets NULL to x25->neighbour in position (1) and dereferences x25->neighbour in position (2), which could cause null-ptr-deref bug.
This patch adds lock_sock() in x25_kill_by_neigh() in order to synchronize with x25_sendmsg(), x25_recvmsg() and x25_connect(). What`s more, the sock held by lock_sock() is not NULL, because it is extracted from x25_list and uses x25_list_lock to synchronize.
--- net/x25/af_x25.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
net/x25/af_x25.c +8 -3
@@ -1775,10 +1775,15 @@ void x25_kill_by_neigh(struct x25_neigh *nb)write_lock_bh (&x25_list_lock); -sk_for_each (s, &x25_list) -if (x25_sk (s)->neighbour == nb) +sk_for_each (s, &x25_list) { +if (x25_sk (s)->neighbour == nb) { +write_unlock_bh (&x25_list_lock); +lock_sock (s);x25_disconnect (s,ENETUNREACH ,0 ,0 ); - +release_sock (s); +write_lock_bh (&x25_list_lock); + } + }write_unlock_bh (&x25_list_lock);/* Remove any related forwards */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 444/599 NFSv4/pNFS: Fix another issue with a list iterator pointing to the head
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
[ Upstream commit 7c9d845f0612e5bcd23456a2ec43be8ac43458f1 ]
In nfs4_callback_devicenotify(), if we don't find a matching entry for the deviceid, we're left with a pointer to 'struct nfs_server' that actually points to the list of super blocks associated with our struct nfs_client.
Furthermore, even if we have a valid pointer, nothing pins the super block, and so the struct nfs_server could end up getting freed while we're using it.
Since all we want is a pointer to the struct pnfs_layoutdriver_type, let's skip all the iteration over super blocks, and just use APIs to find the layout driver directly.
--- fs/nfs/callback_proc.c | 27 +++++++++------------------ fs/nfs/pnfs.c | 11 +++++++++++ fs/nfs/pnfs.h | 2 ++ 3 files changed, 22 insertions(+), 18 deletions(-)
fs/nfs/callback_proc.c +9 -18
@@ -353,12 +353,11 @@ __be32 nfs4_callback_devicenotify(void *argp, void *resp, struct cb_process_state *cps) {struct cb_devicenotifyargs *args = argp; +const struct pnfs_layoutdriver_type *ld =NULL ;uint32_t i;__be32 res =0 ; -struct nfs_client *clp = cps->clp; -struct nfs_server *server =NULL ; -if (!clp) { +if (!cps->clp) { res =cpu_to_be32 (NFS4ERR_OP_NOT_IN_SESSION ); goto out; }
@@ -366,23 +365,15 @@ __be32 nfs4_callback_devicenotify(void *argp, void *resp,for (i =0 ; i < args->ndevs; i++) {struct cb_devicenotifyitem *dev = &args->devs[i]; -if (!server || - server->pnfs_curr_ld->id != dev->cbd_layout_type) { -rcu_read_lock (); -list_for_each_entry_rcu (server, &clp->cl_superblocks, client_link) -if (server->pnfs_curr_ld && - server->pnfs_curr_ld->id == dev->cbd_layout_type) { -rcu_read_unlock (); - goto found; - } -rcu_read_unlock (); -continue ; +if (!ld || ld->id != dev->cbd_layout_type) { +pnfs_put_layoutdriver (ld); + ld =pnfs_find_layoutdriver (dev->cbd_layout_type); +if (!ld) +continue ; } - - found: -nfs4_delete_deviceid (server->pnfs_curr_ld, clp, &dev->cbd_dev_id); +nfs4_delete_deviceid (ld, cps->clp, &dev->cbd_dev_id); } - +pnfs_put_layoutdriver (ld); out:kfree (args->devs);return res;
fs/nfs/pnfs.c +11 -0
@@ -92,6 +92,17 @@ find_pnfs_driver(u32 id)return local; } +const struct pnfs_layoutdriver_type *pnfs_find_layoutdriver (u32 id) +{ +return find_pnfs_driver (id); +} + +void pnfs_put_layoutdriver (const struct pnfs_layoutdriver_type *ld) +{ +if (ld) +module_put (ld->owner); +} +void unset_pnfs_layoutdriver (struct nfs_server *nfss) {
fs/nfs/pnfs.h +2 -0
@@ -236,6 +236,8 @@ struct pnfs_devicelist {extern int pnfs_register_layoutdriver (struct pnfs_layoutdriver_type *);extern void pnfs_unregister_layoutdriver (struct pnfs_layoutdriver_type *); +extern const struct pnfs_layoutdriver_type *pnfs_find_layoutdriver (u32 id); +extern void pnfs_put_layoutdriver (const struct pnfs_layoutdriver_type *ld);/* nfs4proc.c */ extern size_t max_response_pages (struct nfs_server *server);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 445/599 net: dsa: bcm_sf2_cfp: fix an incorrect NULL check on list iterator
In reply to Greg Kroah-HartmanFrom: Xiaomeng Tong <[email protected]>
[ Upstream commit 6da69b1da130e7d96766042750cd9f902e890eba ]
The bug is here:
return rule;
The list iterator value 'rule' will *always* be set and non-NULL by list_for_each_entry(), so it is incorrect to assume that the iterator value will be NULL if the list is empty or no element is found.
To fix the bug, return 'rule' when found, otherwise return NULL.
--- drivers/net/dsa/bcm_sf2_cfp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/dsa/bcm_sf2_cfp.c +3 -3
@@ -567,14 +567,14 @@ static void bcm_sf2_cfp_slice_ipv6(struct bcm_sf2_priv *priv,static struct cfp_rule *bcm_sf2_cfp_rule_find (struct bcm_sf2_priv *priv,int port,u32 location) { -struct cfp_rule *rule =NULL ; +struct cfp_rule *rule;list_for_each_entry (rule, &priv->cfp.rules_list, next) {if (rule->port == port && rule->fs.location == location) -break ; +return rule; } -return rule; +return NULL ; } static int bcm_sf2_cfp_rule_cmp(struct bcm_sf2_priv *priv, int port,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 446/599 fs: fd tables have to be multiples of BITS_PER_LONG
In reply to Greg Kroah-HartmanFrom: Linus Torvalds <[email protected]>
[ Upstream commit 1c24a186398f59c80adb9a967486b65c1423a59d ]
This has always been the rule: fdtables have several bitmaps in them, and as a result they have to be sized properly for bitmaps. We walk those bitmaps in chunks of 'unsigned long' in serveral cases, but even when we don't, we use the regular kernel bitops that are defined to work on arrays of 'unsigned long', not on some byte array.
Now, the distinction between arrays of bytes and 'unsigned long' normally only really ends up being noticeable on big-endian systems, but Fedor Pchelkin and Alexey Khoroshilov reported that copy_fd_bitmaps() could be called with an argument that wasn't even a multiple of BITS_PER_BYTE. And then it fails to do the proper copy even on little-endian machines.
The bug wasn't in copy_fd_bitmap(), but in sane_fdtable_size(), which didn't actually sanitize the fdtable size sufficiently, and never made sure it had the proper BITS_PER_LONG alignment.
That's partly because the alignment historically came not from having to explicitly align things, but simply from previous fdtable sizes, and from count_open_files(), which counts the file descriptors by walking them one 'unsigned long' word at a time and thus naturally ends up doing sizing in the proper 'chunks of unsigned long'.
But with the introduction of close_range(), we now have an external source of "this is how many files we want to have", and so sane_fdtable_size() needs to do a better job.
This also adds that explicit alignment to alloc_fdtable(), although there it is mainly just for documentation at a source code level. The arithmetic we do there to pick a reasonable fdtable size already aligns the result sufficiently.
In fact,clang notices that the added ALIGN() in that function doesn't actually do anything, and does not generate any extra code for it.
It turns out that gcc ends up confusing itself by combining a previous constant-sized shift operation with the variable-sized shift operations in roundup_pow_of_two(). And probably due to that doesn't notice that the ALIGN() is a no-op. But that's a (tiny) gcc misfeature that doesn't matter. Having the explicit alignment makes sense, and would actually matter on a 128-bit architecture if we ever go there.
This also adds big comments above both functions about how fdtable sizes have to have that BITS_PER_LONG alignment.
--- fs/file.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
fs/file.c +30 -0
@@ -85,6 +85,21 @@ static void copy_fdtable(struct fdtable *nfdt, struct fdtable *ofdt)copy_fd_bitmaps (nfdt, ofdt, ofdt->max_fds); } +/* +* Note how the fdtable bitmap allocations very much have to be a multiple of +* BITS_PER_LONG. This is not only because we walk those things in chunks of +* 'unsigned long' in some places, but simply because that is how the Linux +* kernel bitmaps are defined to work: they are not "bits in an array of bytes", +* they are very much "bits in an array of unsigned long". +* +* The ALIGN(nr, BITS_PER_LONG) here is for clarity: since we just multiplied +* by that "1024/sizeof(ptr)" before, we already know there are sufficient +* clear low bits. Clang seems to realize that, gcc ends up being confused. +* +* On a 128-bit machine, the ALIGN() would actually matter. In the meantime, +* let's consider it documentation (and maybe a test-case for gcc to improve +* its code generation ;) +*/ static struct fdtable *alloc_fdtable (unsigned int nr) {struct fdtable *fdt;
@@ -100,6 +115,7 @@ static struct fdtable * alloc_fdtable(unsigned int nr) nr /= (1024 /sizeof (struct file *)); nr =roundup_pow_of_two (nr +1 ); nr *= (1024 /sizeof (struct file *)); + nr =ALIGN (nr,BITS_PER_LONG );/* * Note that this can drive nr *below* what we had passed if sysctl_nr_open * had been set lower between the check in expand_files() and here. Deal
@@ -267,11 +283,25 @@ static unsigned int count_open_files(struct fdtable *fdt)return i; } +/* +* Note that a sane fdtable size always has to be a multiple of +* BITS_PER_LONG, since we have bitmaps that are sized by this. +* +* 'max_fds' will normally already be properly aligned, but it +* turns out that in the close_range() -> __close_range() -> +* unshare_fd() -> dup_fd() -> sane_fdtable_size() we can end +* up having a 'max_fds' value that isn't already aligned. +* +* Rather than make close_range() have to worry about this, +* just make that BITS_PER_LONG alignment be part of a sane +* fdtable size. Becuase that's really what it is. +*/ static unsigned int sane_fdtable_size (struct fdtable *fdt,unsigned int max_fds) {unsigned int count; count =count_open_files (fdt); + max_fds =ALIGN (max_fds,BITS_PER_LONG );if (max_fds <NR_OPEN_DEFAULT ) max_fds =NR_OPEN_DEFAULT ;return min (count, max_fds);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 447/599 lib/test: use after free in register_test_dev_kmod()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit dc0ce6cc4b133f5f2beb8b47dacae13a7d283c2c ]
The "test_dev" pointer is freed but then returned to the caller.
--- lib/test_kmod.c | 1 + 1 file changed, 1 insertion(+)
lib/test_kmod.c +1 -0
@@ -1155,6 +1155,7 @@ static struct kmod_test_device *register_test_dev_kmod(void)if (ret) {pr_err ("could not register misc device: %d\n" , ret);free_test_dev_kmod (test_dev); + test_dev =NULL ; goto out; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 448/599 fs: fix fd table size alignment properly
In reply to Greg Kroah-HartmanFrom: Linus Torvalds <[email protected]>
[ Upstream commit d888c83fcec75194a8a48ccd283953bdba7b2550 ]
Jason Donenfeld reports that my commit 1c24a186398f ("fs: fd tables have to be multiples of BITS_PER_LONG") doesn't work, and the reason is an embarrassing brown-paper-bag bug.
Yes, we want to align the number of fds to BITS_PER_LONG, and yes, the reason they might not be aligned is because the incoming 'max_fd' argument might not be aligned.
But aligining the argument - while simple - will cause a "infinitely big" maxfd (eg NR_OPEN_MAX) to just overflow to zero. Which most definitely isn't what we want either.
The obvious fix was always just to do the alignment last, but I had moved it earlier just to make the patch smaller and the code look simpler. Duh. It certainly made _me_ look simple.
--- fs/file.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/file.c +1 -2
@@ -301,10 +301,9 @@ static unsigned int sane_fdtable_size(struct fdtable *fdt, unsigned int max_fds)unsigned int count; count =count_open_files (fdt); - max_fds =ALIGN (max_fds,BITS_PER_LONG );if (max_fds <NR_OPEN_DEFAULT ) max_fds =NR_OPEN_DEFAULT ; -return min (count, max_fds); +return ALIGN (min (count, max_fds),BITS_PER_LONG ); }/*
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 449/599 LSM: general protection fault in legacy_parse_param
In reply to Greg Kroah-HartmanFrom: Casey Schaufler <[email protected]>
[ Upstream commit ecff30575b5ad0eda149aadad247b7f75411fd47 ]
The usual LSM hook "bail on fail" scheme doesn't work for cases where a security module may return an error code indicating that it does not recognize an input. In this particular case Smack sees a mount option that it recognizes, and returns 0. A call to a BPF hook follows, which returns -ENOPARAM, which confuses the caller because Smack has processed its data.
The SELinux hook incorrectly returns 1 on success. There was a time when this was correct, however the current expectation is that it return 0 on success. This is repaired.
--- security/security.c | 17 +++++++++++++++-- security/selinux/hooks.c | 5 ++--- 2 files changed, 17 insertions(+), 5 deletions(-)
security/security.c +15 -2
@@ -860,9 +860,22 @@ int security_fs_context_dup(struct fs_context *fc, struct fs_context *src_fc)return call_int_hook (fs_context_dup,0 , fc, src_fc); } -int security_fs_context_parse_param (struct fs_context *fc,struct fs_parameter *param) +int security_fs_context_parse_param (struct fs_context *fc, +struct fs_parameter *param) { -return call_int_hook (fs_context_parse_param, -ENOPARAM , fc, param); +struct security_hook_list *hp; +int trc; +int rc = -ENOPARAM ; + +hlist_for_each_entry (hp, &security_hook_heads.fs_context_parse_param, + list) { + trc = hp->hook.fs_context_parse_param (fc, param); +if (trc ==0 ) + rc =0 ; +else if (trc != -ENOPARAM ) +return trc; + } +return rc; }int security_sb_alloc (struct super_block *sb)
security/selinux/hooks.c +2 -3
@@ -2820,10 +2820,9 @@ static int selinux_fs_context_parse_param(struct fs_context *fc,return opt; rc =selinux_add_opt (opt, param->string, &fc->security); -if (!rc) { +if (!rc) param->string =NULL ; - rc =1 ; - } +return rc; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 450/599 regulator: rpi-panel: Handle I2C errors/timing to the Atmel
In reply to Greg Kroah-HartmanFrom: Dave Stevenson <[email protected]>
[ Upstream commit 5665eee7a3800430e7dc3ef6f25722476b603186 ]
The Atmel is doing some things in the I2C ISR, during which period it will not respond to further commands. This is particularly true of the POWERON command.
Increase delays appropriately, and retry should I2C errors be reported.
--- .../regulator/rpi-panel-attiny-regulator.c | 56 +++++++++++++++---- 1 file changed, 46 insertions(+), 10 deletions(-)
drivers/regulator/rpi-panel-attiny-regulator.c +46 -10
@@ -37,11 +37,24 @@ static const struct regmap_config attiny_regmap_config = {static int attiny_lcd_power_enable (struct regulator_dev *rdev) {unsigned int data; +int ret, i;regmap_write (rdev->regmap,REG_POWERON ,1 ); +msleep (80 ); +/* Wait for nPWRDWN to go low to indicate poweron is done. */ -regmap_read_poll_timeout (rdev->regmap,REG_PORTB , data, - data &BIT (0 ),10 ,1000000 ); +for (i =0 ; i <20 ; i++) { + ret =regmap_read (rdev->regmap,REG_PORTB , &data); +if (!ret) { +if (data &BIT (0 )) +break ; + } +usleep_range (10000 ,12000 ); + } +usleep_range (10000 ,12000 ); + +if (ret) +pr_err ("%s: regmap_read_poll_timeout failed %d\n" , __func__, ret);/* Default to the same orientation as the closed source * firmware used for the panel. Runtime rotation
@@ -57,23 +70,34 @@ static int attiny_lcd_power_disable(struct regulator_dev *rdev) {regmap_write (rdev->regmap,REG_PWM ,0 );regmap_write (rdev->regmap,REG_POWERON ,0 ); -udelay (1 ); +msleep (30 );return 0 ; }static int attiny_lcd_power_is_enabled (struct regulator_dev *rdev) {unsigned int data; -int ret; +int ret, i; - ret =regmap_read (rdev->regmap,REG_POWERON , &data); +for (i =0 ; i <10 ; i++) { + ret =regmap_read (rdev->regmap,REG_POWERON , &data); +if (!ret) +break ; +usleep_range (10000 ,12000 ); + }if (ret <0 )return ret;if (!(data &BIT (0 )))return 0 ; - ret =regmap_read (rdev->regmap,REG_PORTB , &data); +for (i =0 ; i <10 ; i++) { + ret =regmap_read (rdev->regmap,REG_PORTB , &data); +if (!ret) +break ; +usleep_range (10000 ,12000 ); + } +if (ret <0 )return ret;
@@ -103,20 +127,32 @@ static int attiny_update_status(struct backlight_device *bl) {struct regmap *regmap =bl_get_data (bl);int brightness = bl->props.brightness; +int ret, i;if (bl->props.power !=FB_BLANK_UNBLANK || bl->props.fb_blank !=FB_BLANK_UNBLANK ) brightness =0 ; -return regmap_write (regmap,REG_PWM , brightness); +for (i =0 ; i <10 ; i++) { + ret =regmap_write (regmap,REG_PWM , brightness); +if (!ret) +break ; + } + +return ret; }static int attiny_get_brightness (struct backlight_device *bl) {struct regmap *regmap =bl_get_data (bl); -int ret, brightness; +int ret, brightness, i; + +for (i =0 ; i <10 ; i++) { + ret =regmap_read (regmap,REG_PWM , &brightness); +if (!ret) +break ; + } - ret =regmap_read (regmap,REG_PWM , &brightness);if (ret)return ret;
@@ -166,7 +202,7 @@ static int attiny_i2c_probe(struct i2c_client *i2c, }regmap_write (regmap,REG_POWERON ,0 ); -mdelay (1 ); +msleep (30 ); config.dev = &i2c->dev; config.regmap = regmap;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 451/599 gcc-plugins/stackleak: Exactly match strings instead of prefixes
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit 27e9faf415dbf94af19b9c827842435edbc1fbbc ]
Since STRING_CST may not be NUL terminated, strncmp() was used for check for equality. However, this may lead to mismatches for longer section names where the start matches the tested-for string. Test for exact equality by checking for the presences of NUL termination.
--- scripts/gcc-plugins/stackleak_plugin.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-)
scripts/gcc-plugins/stackleak_plugin.c +21 -4
@@ -431,6 +431,23 @@ static unsigned int stackleak_cleanup_execute(void)return 0 ; } +/* +* STRING_CST may or may not be NUL terminated: +* https://gcc.gnu.org/onlinedocs/gccint/Constant-expressions.html +*/ +static inline bool string_equal (tree node,const char *string,int length) +{ +if (TREE_STRING_LENGTH (node) < length) +return false; +if (TREE_STRING_LENGTH (node) > length +1 ) +return false; +if (TREE_STRING_LENGTH (node) == length +1 && +TREE_STRING_POINTER (node)[length] !='\0' ) +return false; +return !memcmp (TREE_STRING_POINTER (node), string, length); +} +#define STRING_EQUAL (node, str) string_equal(node, str, strlen(str)) +static bool stackleak_gate (void ) {tree section;
@@ -440,13 +457,13 @@ static bool stackleak_gate(void)if (section &&TREE_VALUE (section)) { section =TREE_VALUE (TREE_VALUE (section)); -if (!strncmp (TREE_STRING_POINTER (section),".init.text" ,10 )) +if (STRING_EQUAL (section,".init.text" ))return false; -if (!strncmp (TREE_STRING_POINTER (section),".devinit.text" ,13 )) +if (STRING_EQUAL (section,".devinit.text" ))return false; -if (!strncmp (TREE_STRING_POINTER (section),".cpuinit.text" ,13 )) +if (STRING_EQUAL (section,".cpuinit.text" ))return false; -if (!strncmp (TREE_STRING_POINTER (section),".meminit.text" ,13 )) +if (STRING_EQUAL (section,".meminit.text" ))return false; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 452/599 pinctrl: npcm: Fix broken references to chip->parent_device
In reply to Greg Kroah-HartmanFrom: Marc Zyngier <[email protected]>
[ Upstream commit f7e53e2255808ca3abcc8f38d18ad0823425e771 ]
The npcm driver has a bunch of references to the irq_chip parent_device field, but never sets it.
Fix it by fishing that reference from somewhere else, but it is obvious that these debug statements were never used. Also remove an unused field in a local data structure.
--- drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c | 25 +++++++++++------------ 1 file changed, 12 insertions(+), 13 deletions(-)
drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c +12 -13
@@ -78,7 +78,6 @@ struct npcm7xx_gpio {struct gpio_chip gc;int irqbase;int irq; -void *priv;struct irq_chip irq_chip;u32 pinctrl_id;int (*direction_input)(struct gpio_chip *chip,unsigned offset);
@@ -226,7 +225,7 @@ static void npcmgpio_irq_handler(struct irq_desc *desc)chained_irq_enter (chip, desc); sts =ioread32 (bank->base +NPCM7XX_GP_N_EVST ); en =ioread32 (bank->base +NPCM7XX_GP_N_EVEN ); -dev_dbg (chip->parent_device,"==> got irq sts %.8x %.8x\n" , sts, +dev_dbg (bank->gc.parent,"==> got irq sts %.8x %.8x\n" , sts, en); sts &= en;
@@ -241,33 +240,33 @@ static int npcmgpio_set_irq_type(struct irq_data *d, unsigned int type)gpiochip_get_data (irq_data_get_irq_chip_data (d));unsigned int gpio =BIT (d->hwirq); -dev_dbg (d->chip->parent_device,"setirqtype: %u.%u = %u\n" , gpio, +dev_dbg (bank->gc.parent,"setirqtype: %u.%u = %u\n" , gpio, d->irq, type);switch (type) {case IRQ_TYPE_EDGE_RISING : -dev_dbg (d->chip->parent_device,"edge.rising\n" ); +dev_dbg (bank->gc.parent,"edge.rising\n" );npcm_gpio_clr (&bank->gc, bank->base +NPCM7XX_GP_N_EVBE , gpio);npcm_gpio_clr (&bank->gc, bank->base +NPCM7XX_GP_N_POL , gpio);break ;case IRQ_TYPE_EDGE_FALLING : -dev_dbg (d->chip->parent_device,"edge.falling\n" ); +dev_dbg (bank->gc.parent,"edge.falling\n" );npcm_gpio_clr (&bank->gc, bank->base +NPCM7XX_GP_N_EVBE , gpio);npcm_gpio_set (&bank->gc, bank->base +NPCM7XX_GP_N_POL , gpio);break ;case IRQ_TYPE_EDGE_BOTH : -dev_dbg (d->chip->parent_device,"edge.both\n" ); +dev_dbg (bank->gc.parent,"edge.both\n" );npcm_gpio_set (&bank->gc, bank->base +NPCM7XX_GP_N_EVBE , gpio);break ;case IRQ_TYPE_LEVEL_LOW : -dev_dbg (d->chip->parent_device,"level.low\n" ); +dev_dbg (bank->gc.parent,"level.low\n" );npcm_gpio_set (&bank->gc, bank->base +NPCM7XX_GP_N_POL , gpio);break ;case IRQ_TYPE_LEVEL_HIGH : -dev_dbg (d->chip->parent_device,"level.high\n" ); +dev_dbg (bank->gc.parent,"level.high\n" );npcm_gpio_clr (&bank->gc, bank->base +NPCM7XX_GP_N_POL , gpio);break ;default : -dev_dbg (d->chip->parent_device,"invalid irq type\n" ); +dev_dbg (bank->gc.parent,"invalid irq type\n" );return -EINVAL ; }
@@ -289,7 +288,7 @@ static void npcmgpio_irq_ack(struct irq_data *d)gpiochip_get_data (irq_data_get_irq_chip_data (d));unsigned int gpio = d->hwirq; -dev_dbg (d->chip->parent_device,"irq_ack: %u.%u\n" , gpio, d->irq); +dev_dbg (bank->gc.parent,"irq_ack: %u.%u\n" , gpio, d->irq);iowrite32 (BIT (gpio), bank->base +NPCM7XX_GP_N_EVST ); }
@@ -301,7 +300,7 @@ static void npcmgpio_irq_mask(struct irq_data *d)unsigned int gpio = d->hwirq;/* Clear events */ -dev_dbg (d->chip->parent_device,"irq_mask: %u.%u\n" , gpio, d->irq); +dev_dbg (bank->gc.parent,"irq_mask: %u.%u\n" , gpio, d->irq);iowrite32 (BIT (gpio), bank->base +NPCM7XX_GP_N_EVENC ); }
@@ -313,7 +312,7 @@ static void npcmgpio_irq_unmask(struct irq_data *d)unsigned int gpio = d->hwirq;/* Enable events */ -dev_dbg (d->chip->parent_device,"irq_unmask: %u.%u\n" , gpio, d->irq); +dev_dbg (bank->gc.parent,"irq_unmask: %u.%u\n" , gpio, d->irq);iowrite32 (BIT (gpio), bank->base +NPCM7XX_GP_N_EVENS ); }
@@ -323,7 +322,7 @@ static unsigned int npcmgpio_irq_startup(struct irq_data *d)unsigned int gpio = d->hwirq;/* active-high, input, clear interrupt, enable interrupt */ -dev_dbg (d->chip->parent_device,"startup: %u.%u\n" , gpio, d->irq); +dev_dbg (gc->parent,"startup: %u.%u\n" , gpio, d->irq);npcmgpio_direction_input (gc, gpio);npcmgpio_irq_ack (d);npcmgpio_irq_unmask (d);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 453/599 block, bfq: dont move oom_bfqq
In reply to Greg Kroah-HartmanFrom: Yu Kuai <[email protected]>
[ Upstream commit 8410f70977734f21b8ed45c37e925d311dfda2e7 ]
Our test report a UAF:
[ 2073.019181] ================================================================== [ 2073.019188] BUG: KASAN: use-after-free in __bfq_put_async_bfqq+0xa0/0x168 [ 2073.019191] Write of size 8 at addr ffff8000ccf64128 by task rmmod/72584 [ 2073.019192] [ 2073.019196] CPU: 0 PID: 72584 Comm: rmmod Kdump: loaded Not tainted 4.19.90-yk #5 [ 2073.019198] Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015 [ 2073.019200] Call trace: [ 2073.019203] dump_backtrace+0x0/0x310 [ 2073.019206] show_stack+0x28/0x38 [ 2073.019210] dump_stack+0xec/0x15c [ 2073.019216] print_address_description+0x68/0x2d0 [ 2073.019220] kasan_report+0x238/0x2f0 [ 2073.019224] __asan_store8+0x88/0xb0 [ 2073.019229] __bfq_put_async_bfqq+0xa0/0x168 [ 2073.019233] bfq_put_async_queues+0xbc/0x208 [ 2073.019236] bfq_pd_offline+0x178/0x238 [ 2073.019240] blkcg_deactivate_policy+0x1f0/0x420 [ 2073.019244] bfq_exit_queue+0x128/0x178 [ 2073.019249] blk_mq_exit_sched+0x12c/0x160 [ 2073.019252] elevator_exit+0xc8/0xd0 [ 2073.019256] blk_exit_queue+0x50/0x88 [ 2073.019259] blk_cleanup_queue+0x228/0x3d8 [ 2073.019267] null_del_dev+0xfc/0x1e0 [null_blk] [ 2073.019274] null_exit+0x90/0x114 [null_blk] [ 2073.019278] __arm64_sys_delete_module+0x358/0x5a0 [ 2073.019282] el0_svc_common+0xc8/0x320 [ 2073.019287] el0_svc_handler+0xf8/0x160 [ 2073.019290] el0_svc+0x10/0x218 [ 2073.019291] [ 2073.019294] Allocated by task 14163: [ 2073.019301] kasan_kmalloc+0xe0/0x190 [ 2073.019305] kmem_cache_alloc_node_trace+0x1cc/0x418 [ 2073.019308] bfq_pd_alloc+0x54/0x118 [ 2073.019313] blkcg_activate_policy+0x250/0x460 [ 2073.019317] bfq_create_group_hierarchy+0x38/0x110 [ 2073.019321] bfq_init_queue+0x6d0/0x948 [ 2073.019325] blk_mq_init_sched+0x1d8/0x390 [ 2073.019330] elevator_switch_mq+0x88/0x170 [ 2073.019334] elevator_switch+0x140/0x270 [ 2073.019338] elv_iosched_store+0x1a4/0x2a0 [ 2073.019342] queue_attr_store+0x90/0xe0 [ 2073.019348] sysfs_kf_write+0xa8/0xe8 [ 2073.019351] kernfs_fop_write+0x1f8/0x378 [ 2073.019359] __vfs_write+0xe0/0x360 [ 2073.019363] vfs_write+0xf0/0x270 [ 2073.019367] ksys_write+0xdc/0x1b8 [ 2073.019371] __arm64_sys_write+0x50/0x60 [ 2073.019375] el0_svc_common+0xc8/0x320 [ 2073.019380] el0_svc_handler+0xf8/0x160 [ 2073.019383] el0_svc+0x10/0x218 [ 2073.019385] [ 2073.019387] Freed by task 72584: [ 2073.019391] __kasan_slab_free+0x120/0x228 [ 2073.019394] kasan_slab_free+0x10/0x18 [ 2073.019397] kfree+0x94/0x368 [ 2073.019400] bfqg_put+0x64/0xb0 [ 2073.019404] bfqg_and_blkg_put+0x90/0xb0 [ 2073.019408] bfq_put_queue+0x220/0x228 [ 2073.019413] __bfq_put_async_bfqq+0x98/0x168 [ 2073.019416] bfq_put_async_queues+0xbc/0x208 [ 2073.019420] bfq_pd_offline+0x178/0x238 [ 2073.019424] blkcg_deactivate_policy+0x1f0/0x420 [ 2073.019429] bfq_exit_queue+0x128/0x178 [ 2073.019433] blk_mq_exit_sched+0x12c/0x160 [ 2073.019437] elevator_exit+0xc8/0xd0 [ 2073.019440] blk_exit_queue+0x50/0x88 [ 2073.019443] blk_cleanup_queue+0x228/0x3d8 [ 2073.019451] null_del_dev+0xfc/0x1e0 [null_blk] [ 2073.019459] null_exit+0x90/0x114 [null_blk] [ 2073.019462] __arm64_sys_delete_module+0x358/0x5a0 [ 2073.019467] el0_svc_common+0xc8/0x320 [ 2073.019471] el0_svc_handler+0xf8/0x160 [ 2073.019474] el0_svc+0x10/0x218 [ 2073.019475] [ 2073.019479] The buggy address belongs to the object at ffff8000ccf63f00 which belongs to the cache kmalloc-1024 of size 1024 [ 2073.019484] The buggy address is located 552 bytes inside of 1024-byte region [ffff8000ccf63f00, ffff8000ccf64300) [ 2073.019486] The buggy address belongs to the page: [ 2073.019492] page:ffff7e000333d800 count:1 mapcount:0 mapping:ffff8000c0003a00 index:0x0 compound_mapcount: 0 [ 2073.020123] flags: 0x7ffff0000008100(slab|head) [ 2073.020403] raw: 07ffff0000008100 ffff7e0003334c08 ffff7e00001f5a08 ffff8000c0003a00 [ 2073.020409] raw: 0000000000000000 00000000001c001c 00000001ffffffff 0000000000000000 [ 2073.020411] page dumped because: kasan: bad access detected [ 2073.020412] [ 2073.020414] Memory state around the buggy address: [ 2073.020420] ffff8000ccf64000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 2073.020424] ffff8000ccf64080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 2073.020428] >ffff8000ccf64100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 2073.020430] ^ [ 2073.020434] ffff8000ccf64180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 2073.020438] ffff8000ccf64200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 2073.020439] ==================================================================
The same problem exist in mainline as well.
This is because oom_bfqq is moved to a non-root group, thus root_group is freed earlier.
Thus fix the problem by don't move oom_bfqq.
--- block/bfq-cgroup.c | 6 ++++++ 1 file changed, 6 insertions(+)
block/bfq-cgroup.c +6 -0
@@ -642,6 +642,12 @@ void bfq_bfqq_move(struct bfq_data *bfqd, struct bfq_queue *bfqq, {struct bfq_entity *entity = &bfqq->entity; +/* +* oom_bfqq is not allowed to move, oom_bfqq will hold ref to root_group +* until elevator exit. +*/ +if (bfqq == &bfqd->oom_bfqq) +return ;/* * Get extra reference to prevent bfqq from being freed in * next possible expire or deactivate.
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 454/599 selinux: use correct type for context length
In reply to Greg Kroah-HartmanFrom: Christian Göttsche <[email protected]>
[ Upstream commit b97df7c098c531010e445da88d02b7bf7bf59ef6 ]
security_sid_to_context() expects a pointer to an u32 as the address where to store the length of the computed context.
Reported by sparse:
security/selinux/xfrm.c:359:39: warning: incorrect type in arg 4
(different signedness)
security/selinux/xfrm.c:359:39: expected unsigned int
[usertype] *scontext_len
security/selinux/xfrm.c:359:39: got int *
--- security/selinux/xfrm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/selinux/xfrm.c +1 -1
@@ -346,7 +346,7 @@ int selinux_xfrm_state_alloc_acquire(struct xfrm_state *x,int rc;struct xfrm_sec_ctx *ctx;char *ctx_str =NULL ; -int str_len; +u32 str_len;if (!polsec)return 0 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 455/599 selinux: allow FIOCLEX and FIONCLEX with policy capability
In reply to Greg Kroah-HartmanFrom: Richard Haines <[email protected]>
[ Upstream commit 65881e1db4e948614d9eb195b8e1197339822949 ]
These ioctls are equivalent to fcntl(fd, F_SETFD, flags), which SELinux always allows too. Furthermore, a failed FIOCLEX could result in a file descriptor being leaked to a process that should not have access to it.
As this patch removes access controls, a policy capability needs to be enabled in policy to always allow these ioctls.
--- security/selinux/hooks.c | 6 ++++++ security/selinux/include/policycap.h | 1 + security/selinux/include/policycap_names.h | 3 ++- security/selinux/include/security.h | 7 +++++++ 4 files changed, 16 insertions(+), 1 deletion(-)
security/selinux/hooks.c +6 -0
@@ -3647,6 +3647,12 @@ static int selinux_file_ioctl(struct file *file, unsigned int cmd, CAP_OPT_NONE, true);break ; +case FIOCLEX : +case FIONCLEX : +if (!selinux_policycap_ioctl_skip_cloexec ()) + error =ioctl_has_perm (cred, file,FILE__IOCTL , (u16 ) cmd); +break ; +/* default case assumes that the command will go * to the file's ioctl() function. */
security/selinux/include/policycap.h +1 -0
@@ -11,6 +11,7 @@ enum {POLICYDB_CAPABILITY_CGROUPSECLABEL ,POLICYDB_CAPABILITY_NNP_NOSUID_TRANSITION ,POLICYDB_CAPABILITY_GENFS_SECLABEL_SYMLINKS , +POLICYDB_CAPABILITY_IOCTL_SKIP_CLOEXEC , __POLICYDB_CAPABILITY_MAX };#define POLICYDB_CAPABILITY_MAX (__POLICYDB_CAPABILITY_MAX - 1)
security/selinux/include/policycap_names.h +2 -1
@@ -12,7 +12,8 @@ const char *selinux_policycap_names[__POLICYDB_CAPABILITY_MAX] = {"always_check_network" ,"cgroup_seclabel" ,"nnp_nosuid_transition" , -"genfs_seclabel_symlinks" +"genfs_seclabel_symlinks" , +"ioctl_skip_cloexec" };#endif /* _SELINUX_POLICYCAP_NAMES_H_ */
security/selinux/include/security.h +7 -0
@@ -219,6 +219,13 @@ static inline bool selinux_policycap_genfs_seclabel_symlinks(void)return READ_ONCE (state->policycap[POLICYDB_CAPABILITY_GENFS_SECLABEL_SYMLINKS ]); } +static inline bool selinux_policycap_ioctl_skip_cloexec (void ) +{ +struct selinux_state *state = &selinux_state; + +return READ_ONCE (state->policycap[POLICYDB_CAPABILITY_IOCTL_SKIP_CLOEXEC ]); +} +struct selinux_policy_convert_data ;struct selinux_load_state {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 456/599 loop: use sysfs_emit() in the sysfs xxx show()
In reply to Greg Kroah-HartmanFrom: Chaitanya Kulkarni <[email protected]>
[ Upstream commit b27824d31f09ea7b4a6ba2c1b18bd328df3e8bed ]
sprintf does not know the PAGE_SIZE maximum of the temporary buffer used for outputting sysfs content and it's possible to overrun the PAGE_SIZE buffer length.
Use a generic sysfs_emit function that knows the size of the temporary buffer and ensures that no overrun is done for offset attribute in loop_attr_[offset|sizelimit|autoclear|partscan|dio]_show() callbacks.
--- drivers/block/loop.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/block/loop.c +5 -5
@@ -797,33 +797,33 @@ static ssize_t loop_attr_backing_file_show(struct loop_device *lo, char *buf)static ssize_t loop_attr_offset_show (struct loop_device *lo,char *buf) { -return sprintf (buf,"%llu\n" , (unsigned long long )lo->lo_offset); +return sysfs_emit (buf,"%llu\n" , (unsigned long long )lo->lo_offset); }static ssize_t loop_attr_sizelimit_show (struct loop_device *lo,char *buf) { -return sprintf (buf,"%llu\n" , (unsigned long long )lo->lo_sizelimit); +return sysfs_emit (buf,"%llu\n" , (unsigned long long )lo->lo_sizelimit); }static ssize_t loop_attr_autoclear_show (struct loop_device *lo,char *buf) {int autoclear = (lo->lo_flags &LO_FLAGS_AUTOCLEAR ); -return sprintf (buf,"%s\n" , autoclear ?"1" :"0" ); +return sysfs_emit (buf,"%s\n" , autoclear ?"1" :"0" ); }static ssize_t loop_attr_partscan_show (struct loop_device *lo,char *buf) {int partscan = (lo->lo_flags &LO_FLAGS_PARTSCAN ); -return sprintf (buf,"%s\n" , partscan ?"1" :"0" ); +return sysfs_emit (buf,"%s\n" , partscan ?"1" :"0" ); }static ssize_t loop_attr_dio_show (struct loop_device *lo,char *buf) {int dio = (lo->lo_flags &LO_FLAGS_DIRECT_IO ); -return sprintf (buf,"%s\n" , dio ?"1" :"0" ); +return sysfs_emit (buf,"%s\n" , dio ?"1" :"0" ); }LOOP_ATTR_RO (backing_file);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 457/599 Fix incorrect type in assignment of ipv6 port for audit
In reply to Greg Kroah-HartmanFrom: Casey Schaufler <[email protected]>
[ Upstream commit a5cd1ab7ab679d252a6d2f483eee7d45ebf2040c ]
Remove inappropriate use of ntohs() and assign the port value directly.
--- security/smack/smack_lsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/smack/smack_lsm.c +1 -1
@@ -2506,7 +2506,7 @@ static int smk_ipv6_check(struct smack_known *subject,#ifdef CONFIG_AUDIT smk_ad_init_net (&ad, __func__,LSM_AUDIT_DATA_NET , &net); ad.a.u.net->family =PF_INET6 ; - ad.a.u.net->dport =ntohs (address->sin6_port); + ad.a.u.net->dport = address->sin6_port;if (act ==SMK_RECEIVING ) ad.a.u.net->v6info.saddr = address->sin6_addr;else
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 458/599 irqchip/qcom-pdc: Fix broken locking
In reply to Greg Kroah-HartmanFrom: Marc Zyngier <[email protected]>
[ Upstream commit a6aca2f460e203781dc41391913cc5b54f4bc0ce ]
pdc_enable_intr() serves as a primitive to qcom_pdc_gic_{en,dis}able, and has a raw spinlock for mutual exclusion, which is uses with interruptible primitives.
This means that this critical section can itself be interrupted. Should the interrupt also be a PDC interrupt, and the endpoint driver perform an irq_disable() on that interrupt, we end-up in a deadlock.
Fix this by using the irqsave/irqrestore variants of the locking primitives.
--- drivers/irqchip/qcom-pdc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/irqchip/qcom-pdc.c +3 -2
@@ -74,17 +74,18 @@ static int qcom_pdc_gic_set_irqchip_state(struct irq_data *d,static void pdc_enable_intr (struct irq_data *d,bool on) {int pin_out = d->hwirq; +unsigned long flags;u32 index, mask;u32 enable; index = pin_out /32 ; mask = pin_out %32 ; -raw_spin_lock (&pdc_lock); +raw_spin_lock_irqsave (&pdc_lock, flags); enable =pdc_reg_read (IRQ_ENABLE_BANK , index); enable = on ?ENABLE_INTR (enable, mask) :CLEAR_INTR (enable, mask);pdc_reg_write (IRQ_ENABLE_BANK , index, enable); -raw_spin_unlock (&pdc_lock); +raw_spin_unlock_irqrestore (&pdc_lock, flags); }static void qcom_pdc_gic_disable (struct irq_data *d)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 459/599 irqchip/nvic: Release nvic_base upon failure
In reply to Greg Kroah-HartmanFrom: Souptick Joarder (HPE) <[email protected]>
[ Upstream commit e414c25e3399b2b3d7337dc47abccab5c71b7c8f ]
smatch warning was reported as below ->
smatch warnings:drivers/irqchip/irq-nvic.c:131 nvic_of_init()
warn: 'nvic_base' not released on lines: 97.
Release nvic_base upon failure.
--- drivers/irqchip/irq-nvic.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/irqchip/irq-nvic.c +2 -0
@@ -94,6 +94,7 @@ static int __init nvic_of_init(struct device_node *node,if (!nvic_irq_domain) {pr_warn ("Failed to allocate irq domain\n" ); +iounmap (nvic_base);return -ENOMEM ; }
@@ -103,6 +104,7 @@ static int __init nvic_of_init(struct device_node *node,if (ret) {pr_warn ("Failed to allocate irq chips\n" );irq_domain_remove (nvic_irq_domain); +iounmap (nvic_base);return ret; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 460/599 fs/binfmt_elf: Fix AT_PHDR for unusual ELF files
In reply to Greg Kroah-HartmanFrom: Akira Kawata <[email protected]>
[ Upstream commit 0da1d5002745cdc721bc018b582a8a9704d56c42 ]
As pointed out in the discussion of buglink, we cannot calculate AT_PHDR as the sum of load_addr and exec->e_phoff.
: The AT_PHDR of ELF auxiliary vectors should point to the memory address : of program header. But binfmt_elf.c calculates this address as follows:
:
: NEW_AUX_ENT(AT_PHDR, load_addr + exec->e_phoff);
:
: which is wrong since e_phoff is the file offset of program header and : load_addr is the memory base address from PT_LOAD entry.
:
: The ld.so uses AT_PHDR as the memory address of program header. In normal : case, since the e_phoff is usually 64 and in the first PT_LOAD region, it : is the correct program header address.
:
: But if the address of program header isn't equal to the first PT_LOAD : address + e_phoff (e.g. Put the program header in other non-consecutive : PT_LOAD region), ld.so will try to read program header from wrong address : then crash or use incorrect program header.
This is because exec->e_phoff
is the offset of PHDRs in the file and the address of PHDRs in the memory may differ from it. This patch fixes the bug by calculating the address of program headers from PT_LOADs directly.
--- fs/binfmt_elf.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-)
fs/binfmt_elf.c +18 -6
@@ -170,8 +170,8 @@ static int padzero(unsigned long elf_bss)static int create_elf_tables (struct linux_binprm *bprm,const struct elfhdr *exec, -unsigned long load_addr,unsigned long interp_load_addr, -unsigned long e_entry) +unsigned long interp_load_addr, +unsigned long e_entry,unsigned long phdr_addr) {struct mm_struct *mm = current->mm;unsigned long p = bprm->p;
@@ -256,7 +256,7 @@ create_elf_tables(struct linux_binprm *bprm, const struct elfhdr *exec,NEW_AUX_ENT (AT_HWCAP ,ELF_HWCAP );NEW_AUX_ENT (AT_PAGESZ ,ELF_EXEC_PAGESIZE );NEW_AUX_ENT (AT_CLKTCK ,CLOCKS_PER_SEC ); -NEW_AUX_ENT (AT_PHDR , load_addr + exec->e_phoff); +NEW_AUX_ENT (AT_PHDR , phdr_addr);NEW_AUX_ENT (AT_PHENT ,sizeof (struct elf_phdr ));NEW_AUX_ENT (AT_PHNUM , exec->e_phnum);NEW_AUX_ENT (AT_BASE , interp_load_addr);
@@ -820,7 +820,7 @@ static int parse_elf_properties(struct file *f, const struct elf_phdr *phdr,static int load_elf_binary (struct linux_binprm *bprm) {struct file *interpreter =NULL ;/* to shut gcc up */ -unsigned long load_addr =0 , load_bias =0 ; +unsigned long load_addr, load_bias =0 , phdr_addr =0 ;int load_addr_set =0 ;unsigned long error;struct elf_phdr *elf_ppnt, *elf_phdata, *interp_elf_phdata =NULL ;
@@ -1153,6 +1153,17 @@ static int load_elf_binary(struct linux_binprm *bprm) reloc_func_desc = load_bias; } } + +/* +* Figure out which segment in the file contains the Program +* Header table, and map to the associated memory address. +*/ +if (elf_ppnt->p_offset <= elf_ex->e_phoff && + elf_ex->e_phoff < elf_ppnt->p_offset + elf_ppnt->p_filesz) { + phdr_addr = elf_ex->e_phoff - elf_ppnt->p_offset + + elf_ppnt->p_vaddr; + } + k = elf_ppnt->p_vaddr;if ((elf_ppnt->p_flags &PF_X ) && k < start_code) start_code = k;
@@ -1188,6 +1199,7 @@ static int load_elf_binary(struct linux_binprm *bprm) } e_entry = elf_ex->e_entry + load_bias; + phdr_addr += load_bias; elf_bss += load_bias; elf_brk += load_bias; start_code += load_bias;
@@ -1251,8 +1263,8 @@ static int load_elf_binary(struct linux_binprm *bprm) goto out;#endif /* ARCH_HAS_SETUP_ADDITIONAL_PAGES */ - retval =create_elf_tables (bprm, elf_ex, - load_addr, interp_load_addr, e_entry); + retval =create_elf_tables (bprm, elf_ex, interp_load_addr, + e_entry, phdr_addr);if (retval <0 ) goto out;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 461/599 bfq: fix use-after-free in bfq_dispatch_request
In reply to Greg Kroah-HartmanFrom: Zhang Wensheng <[email protected]>
[ Upstream commit ab552fcb17cc9e4afe0e4ac4df95fc7b30e8490a ]
KASAN reports a use-after-free report when doing normal scsi-mq test
[69832.239032] ================================================================== [69832.241810] BUG: KASAN: use-after-free in bfq_dispatch_request+0x1045/0x44b0 [69832.243267] Read of size 8 at addr ffff88802622ba88 by task kworker/3:1H/155 [69832.244656] [69832.245007] CPU: 3 PID: 155 Comm: kworker/3:1H Not tainted 5.10.0-10295-g576c6382529e #8 [69832.246626] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 [69832.249069] Workqueue: kblockd blk_mq_run_work_fn [69832.250022] Call Trace: [69832.250541] dump_stack+0x9b/0xce [69832.251232] ? bfq_dispatch_request+0x1045/0x44b0 [69832.252243] print_address_description.constprop.6+0x3e/0x60 [69832.253381] ? __cpuidle_text_end+0x5/0x5 [69832.254211] ? vprintk_func+0x6b/0x120 [69832.254994] ? bfq_dispatch_request+0x1045/0x44b0 [69832.255952] ? bfq_dispatch_request+0x1045/0x44b0 [69832.256914] kasan_report.cold.9+0x22/0x3a [69832.257753] ? bfq_dispatch_request+0x1045/0x44b0 [69832.258755] check_memory_region+0x1c1/0x1e0 [69832.260248] bfq_dispatch_request+0x1045/0x44b0 [69832.261181] ? bfq_bfqq_expire+0x2440/0x2440 [69832.262032] ? blk_mq_delay_run_hw_queues+0xf9/0x170 [69832.263022] __blk_mq_do_dispatch_sched+0x52f/0x830 [69832.264011] ? blk_mq_sched_request_inserted+0x100/0x100 [69832.265101] __blk_mq_sched_dispatch_requests+0x398/0x4f0 [69832.266206] ? blk_mq_do_dispatch_ctx+0x570/0x570 [69832.267147] ? __switch_to+0x5f4/0xee0 [69832.267898] blk_mq_sched_dispatch_requests+0xdf/0x140 [69832.268946] __blk_mq_run_hw_queue+0xc0/0x270 [69832.269840] blk_mq_run_work_fn+0x51/0x60 [69832.278170] process_one_work+0x6d4/0xfe0 [69832.278984] worker_thread+0x91/0xc80 [69832.279726] ? __kthread_parkme+0xb0/0x110 [69832.280554] ? process_one_work+0xfe0/0xfe0 [69832.281414] kthread+0x32d/0x3f0 [69832.282082] ? kthread_park+0x170/0x170 [69832.282849] ret_from_fork+0x1f/0x30 [69832.283573] [69832.283886] Allocated by task 7725: [69832.284599] kasan_save_stack+0x19/0x40 [69832.285385] __kasan_kmalloc.constprop.2+0xc1/0xd0 [69832.286350] kmem_cache_alloc_node+0x13f/0x460 [69832.287237] bfq_get_queue+0x3d4/0x1140 [69832.287993] bfq_get_bfqq_handle_split+0x103/0x510 [69832.289015] bfq_init_rq+0x337/0x2d50 [69832.289749] bfq_insert_requests+0x304/0x4e10 [69832.290634] blk_mq_sched_insert_requests+0x13e/0x390 [69832.291629] blk_mq_flush_plug_list+0x4b4/0x760 [69832.292538] blk_flush_plug_list+0x2c5/0x480 [69832.293392] io_schedule_prepare+0xb2/0xd0 [69832.294209] io_schedule_timeout+0x13/0x80 [69832.295014] wait_for_common_io.constprop.1+0x13c/0x270 [69832.296137] submit_bio_wait+0x103/0x1a0 [69832.296932] blkdev_issue_discard+0xe6/0x160 [69832.297794] blk_ioctl_discard+0x219/0x290 [69832.298614] blkdev_common_ioctl+0x50a/0x1750 [69832.304715] blkdev_ioctl+0x470/0x600 [69832.305474] block_ioctl+0xde/0x120 [69832.306232] vfs_ioctl+0x6c/0xc0 [69832.306877] __se_sys_ioctl+0x90/0xa0 [69832.307629] do_syscall_64+0x2d/0x40 [69832.308362] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [69832.309382] [69832.309701] Freed by task 155: [69832.310328] kasan_save_stack+0x19/0x40 [69832.311121] kasan_set_track+0x1c/0x30 [69832.311868] kasan_set_free_info+0x1b/0x30 [69832.312699] __kasan_slab_free+0x111/0x160 [69832.313524] kmem_cache_free+0x94/0x460 [69832.314367] bfq_put_queue+0x582/0x940 [69832.315112] __bfq_bfqd_reset_in_service+0x166/0x1d0 [69832.317275] bfq_bfqq_expire+0xb27/0x2440 [69832.318084] bfq_dispatch_request+0x697/0x44b0 [69832.318991] __blk_mq_do_dispatch_sched+0x52f/0x830 [69832.319984] __blk_mq_sched_dispatch_requests+0x398/0x4f0 [69832.321087] blk_mq_sched_dispatch_requests+0xdf/0x140 [69832.322225] __blk_mq_run_hw_queue+0xc0/0x270 [69832.323114] blk_mq_run_work_fn+0x51/0x60 [69832.323942] process_one_work+0x6d4/0xfe0 [69832.324772] worker_thread+0x91/0xc80 [69832.325518] kthread+0x32d/0x3f0 [69832.326205] ret_from_fork+0x1f/0x30 [69832.326932] [69832.338297] The buggy address belongs to the object at ffff88802622b968 [69832.338297] which belongs to the cache bfq_queue of size 512 [69832.340766] The buggy address is located 288 bytes inside of [69832.340766] 512-byte region [ffff88802622b968, ffff88802622bb68) [69832.343091] The buggy address belongs to the page: [69832.344097] page:ffffea0000988a00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88802622a528 pfn:0x26228 [69832.346214] head:ffffea0000988a00 order:2 compound_mapcount:0 compound_pincount:0 [69832.347719] flags: 0x1fffff80010200(slab|head) [69832.348625] raw: 001fffff80010200 ffffea0000dbac08 ffff888017a57650 ffff8880179fe840 [69832.354972] raw: ffff88802622a528 0000000000120008 00000001ffffffff 0000000000000000 [69832.356547] page dumped because: kasan: bad access detected [69832.357652] [69832.357970] Memory state around the buggy address: [69832.358926] ffff88802622b980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [69832.360358] ffff88802622ba00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [69832.361810] >ffff88802622ba80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [69832.363273] ^ [69832.363975] ffff88802622bb00: fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc [69832.375960] ffff88802622bb80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [69832.377405] ==================================================================
In bfq_dispatch_requestfunction, it may have function call:
bfq_dispatch_request
__bfq_dispatch_request
bfq_select_queue
bfq_bfqq_expire
__bfq_bfqd_reset_in_service
bfq_put_queue
kmem_cache_free
In this function call, in_serv_queue has beed expired and meet the conditions to free. In the function bfq_dispatch_request, the address of in_serv_queue pointing to has been released. For getting the value of idle_timer_disabled, it will get flags value from the address which in_serv_queue pointing to, then the problem of use-after-free happens;
Fix the problem by check in_serv_queue == bfqd->in_service_queue, to get the value of idle_timer_disabled if in_serve_queue is equel to bfqd->in_service_queue. If the space of in_serv_queue pointing has been released, this judge will aviod use-after-free problem. And if in_serv_queue may be expired or finished, the idle_timer_disabled will be false which would not give effects to bfq_update_dispatch_stats.
--- block/bfq-iosched.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
block/bfq-iosched.c +8 -7
@@ -4799,7 +4799,7 @@ static struct request *bfq_dispatch_request(struct blk_mq_hw_ctx *hctx)struct bfq_data *bfqd = hctx->queue->elevator->elevator_data;struct request *rq;struct bfq_queue *in_serv_queue; -bool waiting_rq, idle_timer_disabled; +bool waiting_rq, idle_timer_disabled = false;spin_lock_irq (&bfqd->lock);
@@ -4807,14 +4807,15 @@ static struct request *bfq_dispatch_request(struct blk_mq_hw_ctx *hctx) waiting_rq = in_serv_queue &&bfq_bfqq_wait_request (in_serv_queue); rq =__bfq_dispatch_request (hctx); - - idle_timer_disabled = - waiting_rq && !bfq_bfqq_wait_request (in_serv_queue); +if (in_serv_queue == bfqd->in_service_queue) { + idle_timer_disabled = + waiting_rq && !bfq_bfqq_wait_request (in_serv_queue); + }spin_unlock_irq (&bfqd->lock); - -bfq_update_dispatch_stats (hctx->queue, rq, in_serv_queue, - idle_timer_disabled); +bfq_update_dispatch_stats (hctx->queue, rq, + idle_timer_disabled ? in_serv_queue :NULL , + idle_timer_disabled);return rq; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 462/599 ACPICA: Avoid walking the ACPI Namespace if it is not there
In reply to Greg Kroah-HartmanFrom: Rafael J. Wysocki <[email protected]>
[ Upstream commit 0c9992315e738e7d6e927ef36839a466b080dba6 ]
ACPICA commit b1c3656ef4950098e530be68d4b589584f06cddc
Prevent acpi_ns_walk_namespace() from crashing when called with start_node equal to ACPI_ROOT_OBJECT if the Namespace has not been instantiated yet and acpi_gbl_root_node is NULL.
For instance, this can happen if the kernel is run with "acpi=off" in the command line.
--- drivers/acpi/acpica/nswalk.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/acpi/acpica/nswalk.c +3 -0
@@ -169,6 +169,9 @@ acpi_ns_walk_namespace(acpi_object_type type,if (start_node ==ACPI_ROOT_OBJECT ) { start_node = acpi_gbl_root_node; +if (!start_node) { +return_ACPI_STATUS (AE_NO_NAMESPACE ); + } }/* Null child means "get first node" */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 463/599 lib/raid6/test/Makefile: Use $(pound) instead of \# for Make 4.3
In reply to Greg Kroah-HartmanFrom: Paul Menzel <[email protected]>
[ Upstream commit 633174a7046ec3b4572bec24ef98e6ee89bce14b ]
Buidling raid6test on Ubuntu 21.10 (ppc64le) with GNU Make 4.3 shows the errors below:
$ cd lib/raid6/test/
$ make
<stdin>:1:1: error: stray ‘\’ in program
<stdin>:1:2: error: stray ‘#’ in program
<stdin>:1:11: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ \
before ‘<’ token[...]
The errors come from the HAS_ALTIVEC test, which fails, and the POWER optimized versions are not built. That’s also reason nobody noticed on the other architectures.
GNU Make 4.3 does not remove the backslash anymore. From the 4.3 release announcment:
Quoted 11 lines
* WARNING: Backward-incompatibility!
Number signs (#) appearing inside a macro reference or function invocation no longer introduce comments and should not be escaped with backslashes:
thus a call such as:foo := $(shell echo '#') is legal. Previously the number sign needed to be escaped, for example: foo := $(shell echo '\#') Now this latter will resolve to "\#". If you want to write makefiles portable to both versions, assign the number sign to a variable: H := \# foo := $(shell echo '$H')
Quoted 2 lines
This was claimed to be fixed in 3.81, but wasn't, for some reason. To detect this change search for 'nocomment' in the .FEATURES variable.
So, do the same as commit 9564a8cf422d ("Kbuild: fix # escaping in .cmd files for future Make") and commit 929bef467771 ("bpf: Use $(pound) instead of \# in Makefiles") and define and use a $(pound) variable.
Reference for the change in make:
https://git.savannah.gnu.org/cgit/make.git/commit/?id=c6966b323811c37acedff05b57
--- lib/raid6/test/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
lib/raid6/test/Makefile +3 -1
@@ -4,6 +4,8 @@ # from userspace. # +pound := \# + CC = gcc OPTFLAGS = -O2 # Adjust as desired CFLAGS = -I.. -I ../../../include -g $(OPTFLAGS)
@@ -42,7 +44,7 @@ else ifeq ($(HAS_NEON),yes) OBJS += neon.o neon1.o neon2.o neon4.o neon8.o recov_neon.o recov_neon_inner.o CFLAGS += -DCONFIG_KERNEL_MODE_NEON=1 else - HAS_ALTIVEC := $(shell printf '\#include <altivec.h>\nvector int a;\n' |\ + HAS_ALTIVEC := $(shell printf '$(pound)include <altivec.h>\nvector int a;\n' |\ gcc -c -x c - >/dev/null && rm ./-.o && echo yes) ifeq ($(HAS_ALTIVEC),yes) CFLAGS += -I../../../arch/powerpc/include
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 464/599 Revert "Revert "block, bfq: honor already-setup queue merges""
In reply to Greg Kroah-HartmanFrom: Paolo Valente <[email protected]>
[ Upstream commit 15729ff8143f8135b03988a100a19e66d7cb7ecd ]
A crash [1] happened to be triggered in conjunction with commit 2d52c58b9c9b ("block, bfq: honor already-setup queue merges"). The latter was then reverted by commit ebc69e897e17 ("Revert "block, bfq:
honor already-setup queue merges""). Yet, the reverted commit was not the one introducing the bug. In fact, it actually triggered a UAF introduced by a different commit, and now fixed by commit d29bd41428cf ("block, bfq: reset last_bfqq_created on group change").
So, there is no point in keeping commit 2d52c58b9c9b ("block, bfq:
honor already-setup queue merges") out. This commit restores it.
[1] https://bugzilla.kernel.org/show_bug.cgi?id=214503
--- block/bfq-iosched.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
block/bfq-iosched.c +13 -3
@@ -2526,6 +2526,15 @@ bfq_setup_merge(struct bfq_queue *bfqq, struct bfq_queue *new_bfqq)* are likely to increase the throughput. */ bfqq->new_bfqq = new_bfqq; +/* +* The above assignment schedules the following redirections: +* each time some I/O for bfqq arrives, the process that +* generated that I/O is disassociated from bfqq and +* associated with new_bfqq. Here we increases new_bfqq->ref +* in advance, adding the number of processes that are +* expected to be associated with new_bfqq as they happen to +* issue I/O. +*/ new_bfqq->ref += process_refs;return new_bfqq; }
@@ -2585,6 +2594,10 @@ bfq_setup_cooperator(struct bfq_data *bfqd, struct bfq_queue *bfqq, {struct bfq_queue *in_service_bfqq, *new_bfqq; +/* if a merge has already been setup, then proceed with that first */ +if (bfqq->new_bfqq) +return bfqq->new_bfqq; +/* * Do not perform queue merging if the device is non * rotational and performs internal queueing. In fact, such a
@@ -2639,9 +2652,6 @@ bfq_setup_cooperator(struct bfq_data *bfqd, struct bfq_queue *bfqq,if (bfq_too_late_for_merging (bfqq))return NULL ; -if (bfqq->new_bfqq) -return bfqq->new_bfqq; -if (!io_struct ||unlikely (bfqq == &bfqd->oom_bfqq))return NULL ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 465/599 ACPI/APEI: Limit printable size of BERT table data
In reply to Greg Kroah-HartmanFrom: Darren Hart <[email protected]>
[ Upstream commit 3f8dec116210ca649163574ed5f8df1e3b837d07 ]
Platforms with large BERT table data can trigger soft lockup errors while attempting to print the entire BERT table data to the console at boot:
watchdog: BUG: soft lockup - CPU#160 stuck for 23s! [swapper/0:1]
Observed on Ampere Altra systems with a single BERT record of ~250KB.
The original bert driver appears to have assumed relatively small table data. Since it is impractical to reassemble large table data from interwoven console messages, and the table data is available in
/sys/firmware/acpi/tables/data/BERT
limit the size for tables printed to the console to 1024 (for no reason other than it seemed like a good place to kick off the discussion, would appreciate feedback from existing users in terms of what size would maintain their current usage model).
Alternatively, we could make printing a CONFIG option, use the bert_disable boot arg (or something similar), or use a debug log level. However, all those solutions require extra steps or change the existing behavior for small table data. Limiting the size preserves existing behavior on existing platforms with small table data, and eliminates the soft lockups for platforms with large table data, while still making it available.
--- drivers/acpi/apei/bert.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/acpi/apei/bert.c +6 -2
@@ -29,6 +29,7 @@#undef pr_fmt#define pr_fmt (fmt) "BERT: " fmt +#define ACPI_BERT_PRINT_MAX_LEN 1024static int bert_disable;
@@ -58,8 +59,11 @@ static void __init bert_print_all(struct acpi_bert_region *region, }pr_info_once ("Error records from previous boot:\n" ); - - cper_estatus_print(KERN_INFO HW_ERR, estatus); +if (region_len <ACPI_BERT_PRINT_MAX_LEN ) + cper_estatus_print(KERN_INFO HW_ERR, estatus); +else +pr_info_once ("Max print length exceeded, table data is available at:\n" +"/sys/firmware/acpi/tables/data/BERT" );/* * Because the boot error source is "one-time polled" type,
Signature · 1 line
2.34.1