5.17.2-rc1 review
Subsystems (11)
Greg Kroah-Hartman
maintainerPATCH 60/1126 f2fs: quota: fix loop condition at f2fs_quota_sync()
In reply to Greg Kroah-HartmanFrom: Juhyung Park <[email protected]>
commit 680af5b824a52faa819167628665804a14f0e0df upstream.
cnt should be passed to sb_has_quota_active() instead of type to check active quota properly.
Moreover, when the type is -1, the compiler with enough inline knowledge can discard sb_has_quota_active() check altogether, causing a NULL pointer dereference at the following inode_lock(dqopt->files[cnt]):
[ 2.796010] Unable to handle kernel NULL pointer dereference at virtual address 00000000000000a0 [ 2.796024] Mem abort info: [ 2.796025] ESR = 0x96000005 [ 2.796028] EC = 0x25: DABT (current EL), IL = 32 bits [ 2.796029] SET = 0, FnV = 0 [ 2.796031] EA = 0, S1PTW = 0 [ 2.796032] Data abort info: [ 2.796034] ISV = 0, ISS = 0x00000005 [ 2.796035] CM = 0, WnR = 0 [ 2.796046] user pgtable: 4k pages, 39-bit VAs, pgdp=00000003370d1000 [ 2.796048] [00000000000000a0] pgd=0000000000000000, pud=0000000000000000 [ 2.796051] Internal error: Oops: 96000005 [#1] PREEMPT SMP [ 2.796056] CPU: 7 PID: 640 Comm: f2fs_ckpt-259:7 Tainted: G S 5.4.179-arter97-r8-64666-g2f16e087f9d8 #1 [ 2.796057] Hardware name: Qualcomm Technologies, Inc. Lahaina MTP lemonadep (DT) [ 2.796059] pstate: 80c00005 (Nzcv daif +PAN +UAO) [ 2.796065] pc : down_write+0x28/0x70 [ 2.796070] lr : f2fs_quota_sync+0x100/0x294 [ 2.796071] sp : ffffffa3f48ffc30 [ 2.796073] x29: ffffffa3f48ffc30 x28: 0000000000000000 [ 2.796075] x27: ffffffa3f6d718b8 x26: ffffffa415fe9d80 [ 2.796077] x25: ffffffa3f7290048 x24: 0000000000000001 [ 2.796078] x23: 0000000000000000 x22: ffffffa3f7290000 [ 2.796080] x21: ffffffa3f72904a0 x20: ffffffa3f7290110 [ 2.796081] x19: ffffffa3f77a9800 x18: ffffffc020aae038 [ 2.796083] x17: ffffffa40e38e040 x16: ffffffa40e38e6d0 [ 2.796085] x15: ffffffa40e38e6cc x14: ffffffa40e38e6d0 [ 2.796086] x13: 00000000000004f6 x12: 00162c44ff493000 [ 2.796088] x11: 0000000000000400 x10: ffffffa40e38c948 [ 2.796090] x9 : 0000000000000000 x8 : 00000000000000a0 [ 2.796091] x7 : 0000000000000000 x6 : 0000d1060f00002a [ 2.796093] x5 : ffffffa3f48ff718 x4 : 000000000000000d [ 2.796094] x3 : 00000000060c0000 x2 : 0000000000000001 [ 2.796096] x1 : 0000000000000000 x0 : 00000000000000a0 [ 2.796098] Call trace: [ 2.796100] down_write+0x28/0x70 [ 2.796102] f2fs_quota_sync+0x100/0x294 [ 2.796104] block_operations+0x120/0x204 [ 2.796106] f2fs_write_checkpoint+0x11c/0x520 [ 2.796107] __checkpoint_and_complete_reqs+0x7c/0xd34 [ 2.796109] issue_checkpoint_thread+0x6c/0xb8 [ 2.796112] kthread+0x138/0x414 [ 2.796114] ret_from_fork+0x10/0x18 [ 2.796117] Code: aa0803e0 aa1f03e1 52800022 aa0103e9 (c8e97d02) [ 2.796120] ---[ end trace 96e942e8eb6a0b53 ]--- [ 2.800116] Kernel panic - not syncing: Fatal exception [ 2.800120] SMP: stopping secondary CPUs
--- fs/f2fs/super.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/f2fs/super.c +3 -3
@@ -2688,7 +2688,7 @@ int f2fs_quota_sync(struct super_block *struct f2fs_sb_info *sbi =F2FS_SB (sb);struct quota_info *dqopt =sb_dqopt (sb);int cnt; -int ret; +int ret =0 ;/* * Now when everything is written we can discard the pagecache so
@@ -2699,8 +2699,8 @@ int f2fs_quota_sync(struct super_block *if (type !=-1 && cnt != type)continue ; -if (!sb_has_quota_active (sb, type)) -return 0 ; +if (!sb_has_quota_active (sb, cnt)) +continue ;inode_lock (dqopt->files[cnt]);
Greg Kroah-Hartman
maintainerPATCH 150/1126 ARM: dts: at91: sama5d2: Fix PMERRLOC resource size
In reply to Greg Kroah-HartmanFrom: Tudor Ambarus <[email protected]>
commit 0fb578a529ac7aca326a9fa475b4a6f58a756fda upstream.
PMERRLOC resource size was set to 0x100, which resulted in HSMC_ERRLOCx register being truncated to offset x = 21, causing error correction to fail if more than 22 bit errors and if 24 or 32 bit error correction was supported.
--- arch/arm/boot/dts/sama5d2.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/sama5d2.dtsi +1 -1
@@ -415,7 +415,7 @@ pmecc: ecc-engine@f8014070 { compatible = "atmel,sama5d2-pmecc"; reg = <0xf8014070 0x490>, - <0xf8014500 0x100>; + <0xf8014500 0x200>; }; };
Greg Kroah-Hartman
maintainerPATCH 82/1126 scsi: ufs: Fix runtime PM messages never-ending cycle
In reply to Greg Kroah-HartmanFrom: Adrian Hunter <[email protected]>
commit 71bb9ab6e3511b7bb98678a19eb8cf1ccbf3ca2f upstream.
Kernel messages produced during runtime PM can cause a never-ending cycle because user space utilities (e.g. journald or rsyslog) write the messages back to storage, causing runtime resume, more messages, and so on.
Messages that tell of things that are expected to happen, are arguably unnecessary, so suppress them.
UFS driver messages are changes to from dev_err() to dev_dbg() which means they will not display unless activated by dynamic debug of building with -DDEBUG.
sdev->silence_suspend is set to skip messages from sd_suspend_common() "Synchronizing SCSI cache", "Stopping disk" and scsi_report_sense() "Power-on or device reset occurred" message (Note, that message appears when the LUN is accessed after runtime PM, not during runtime PM)
Example messages from Ubuntu 21.10:
$ dmesg | tail [ 1620.380071] ufshcd 0000:00:12.5: ufshcd_print_pwr_info:[RX, TX]: gear=[1, 1], lane[1, 1], pwr[SLOWAUTO_MODE, SLOWAUTO_MODE], rate = 0 [ 1620.408825] ufshcd 0000:00:12.5: ufshcd_print_pwr_info:[RX, TX]: gear=[4, 4], lane[2, 2], pwr[FAST MODE, FAST MODE], rate = 2 [ 1620.409020] ufshcd 0000:00:12.5: ufshcd_find_max_sup_active_icc_level: Regulator capability was not set, actvIccLevel=0 [ 1620.409524] sd 0:0:0:0: Power-on or device reset occurred [ 1622.938794] sd 0:0:0:0: [sda] Synchronizing SCSI cache [ 1622.939184] ufs_device_wlun 0:0:0:49488: Power-on or device reset occurred [ 1625.183175] ufshcd 0000:00:12.5: ufshcd_print_pwr_info:[RX, TX]: gear=[1, 1], lane[1, 1], pwr[SLOWAUTO_MODE, SLOWAUTO_MODE], rate = 0 [ 1625.208041] ufshcd 0000:00:12.5: ufshcd_print_pwr_info:[RX, TX]: gear=[4, 4], lane[2, 2], pwr[FAST MODE, FAST MODE], rate = 2 [ 1625.208311] ufshcd 0000:00:12.5: ufshcd_find_max_sup_active_icc_level: Regulator capability was not set, actvIccLevel=0 [ 1625.209035] sd 0:0:0:0: Power-on or device reset occurred
Note for stable: depends on patch "scsi: core: sd: Add silence_suspend flag to suppress some PM messages".
--- drivers/scsi/ufs/ufshcd.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/scsi/ufs/ufshcd.c +19 -2
@@ -585,7 +585,12 @@ static void ufshcd_print_pwr_info(struct "INVALID MODE", }; - dev_err(hba->dev, "%s:[RX, TX]: gear=[%d, %d], lane[%d, %d], pwr[%s, %s], rate = %d\n", +/* +* Using dev_dbg to avoid messages during runtime PM to avoid +* never-ending cycles of messages written back to storage by user space +* causing runtime resume, causing more messages and so on. +*/ + dev_dbg(hba->dev, "%s:[RX, TX]: gear=[%d, %d], lane[%d, %d], pwr[%s, %s], rate = %d\n", __func__, hba->pwr_info.gear_rx, hba->pwr_info.gear_tx, hba->pwr_info.lane_rx, hba->pwr_info.lane_tx,
@@ -5024,6 +5029,12 @@ static int ufshcd_slave_configure(structpm_runtime_get_noresume (&sdev->sdev_gendev); else if (ufshcd_is_rpm_autosuspend_allowed(hba)) sdev->rpm_autosuspend = 1; +/* +* Do not print messages during runtime PM to avoid never-ending cycles +* of messages written back to storage by user space causing runtime +* resume, causing more messages and so on. +*/ + sdev->silence_suspend =1 ;ufshcd_crypto_register (hba, q);
@@ -7339,7 +7350,13 @@ static u32 ufshcd_find_max_sup_active_icif (!hba->vreg_info.vcc || !hba->vreg_info.vccq || !hba->vreg_info.vccq2) { -dev_err (hba->dev, +/* +* Using dev_dbg to avoid messages during runtime PM to avoid +* never-ending cycles of messages written back to storage by +* user space causing runtime resume, causing more messages and +* so on. +*/ +dev_dbg (hba->dev,"%s: Regulator capability was not set, actvIccLevel=%d" , __func__, icc_level); goto out;
Greg Kroah-Hartman
maintainerPATCH 157/1126 thermal: int340x: Increase bitmap size
In reply to Greg Kroah-HartmanFrom: Srinivas Pandruvada <[email protected]>
commit 668f69a5f863b877bc3ae129efe9a80b6f055141 upstream.
The number of policies are 10, so can't be supported by the bitmap size of u8.
Even though there are no platfoms with these many policies, but for correctness increase to u32.
--- drivers/thermal/intel/int340x_thermal/int3400_thermal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/intel/int340x_thermal/int3400_thermal.c +1 -1
@@ -53,7 +53,7 @@ struct int3400_thermal_priv {struct art *arts;int trt_count;struct trt *trts; -u8 uuid_bitmap; +u32 uuid_bitmap;int rel_misc_dev_res;int current_uuid_index;char *data_vault;
Greg Kroah-Hartman
maintainerPATCH 71/1126 can: m_can: m_can_tx_handler(): fix use after free of skb
In reply to Greg Kroah-HartmanFrom: Marc Kleine-Budde <[email protected]>
commit 2e8e79c416aae1de224c0f1860f2e3350fa171f8 upstream.
can_put_echo_skb() will clone skb then free the skb. Move the can_put_echo_skb() for the m_can version 3.0.x directly before the start of the xmit in hardware, similar to the 3.1.x branch.
--- drivers/net/can/m_can/m_can.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/can/m_can/m_can.c +3 -2
@@ -1637,8 +1637,6 @@ static netdev_tx_t m_can_tx_handler(struif (err) goto out_fail; -can_put_echo_skb (skb, dev,0 ,0 ); -if (cdev->can.ctrlmode &CAN_CTRLMODE_FD ) { cccr =m_can_read (cdev,M_CAN_CCCR ); cccr &= ~CCCR_CMR_MASK ;
@@ -1655,6 +1653,9 @@ static netdev_tx_t m_can_tx_handler(strum_can_write (cdev,M_CAN_CCCR , cccr); }m_can_write (cdev,M_CAN_TXBTIE ,0x1 ); + +can_put_echo_skb (skb, dev,0 ,0 ); +m_can_write (cdev,M_CAN_TXBAR ,0x1 );/* End of xmit function for version 3.0.x */ }else {
Greg Kroah-Hartman
maintainerPATCH 66/1126 net: bnxt_ptp: fix compilation error
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
commit dcf500065fabe27676dfe7b4ba521a4f1e0fc8ac upstream.
The Broadcom bnxt_ptp driver does not compile with GCC 11.2.2 when CONFIG_WERROR is enabled. The following error is generated:
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c: In function ‘bnxt_ptp_enable’:drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c:400:43: error: array subscript 255 is above array bounds of ‘struct pps_pin[4]’ [-Werror=array-bounds]
400 | ptp->pps_info.pins[pin_id].event = BNXT_PPS_EVENT_EXTERNAL;
| ~~~~~~~~~~~~~~~~~~^~~~~~~~In file included from drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c:20:drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h:75:24: note: while referencing ‘pins’
75 | struct pps_pin pins[BNXT_MAX_TSIO_PINS];
| ^~~~
cc1: all warnings being treated as errors
This is due to the function ptp_find_pin() returning a pin ID of -1 when a valid pin is not found and this error never being checked. Change the TSIO_PIN_VALID() function to also check that a pin ID is not negative and use this macro in bnxt_ptp_enable() to check the result of the calls to ptp_find_pin() to return an error early for invalid pins. This fixes the compilation error.
--- drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c | 6 +++++- drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c +5 -1
@@ -329,7 +329,7 @@ static int bnxt_ptp_enable(struct ptp_cl struct bnxt_ptp_cfg *ptp = container_of(ptp_info, struct bnxt_ptp_cfg, ptp_info);struct bnxt *bp = ptp->bp; -u8 pin_id; +int pin_id;int rc;switch (rq->type) {
@@ -337,6 +337,8 @@ static int bnxt_ptp_enable(struct ptp_cl/* Configure an External PPS IN */ pin_id =ptp_find_pin (ptp->ptp_clock,PTP_PF_EXTTS , rq->extts.index); +if (!TSIO_PIN_VALID (pin_id)) +return -EOPNOTSUPP ;if (!on)break ; rc =bnxt_ptp_cfg_pin (bp, pin_id,BNXT_PPS_PIN_PPS_IN );
@@ -350,6 +352,8 @@ static int bnxt_ptp_enable(struct ptp_cl/* Configure a Periodic PPS OUT */ pin_id =ptp_find_pin (ptp->ptp_clock,PTP_PF_PEROUT , rq->perout.index); +if (!TSIO_PIN_VALID (pin_id)) +return -EOPNOTSUPP ;if (!on)break ;
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h +1 -1
@@ -31,7 +31,7 @@ struct pps_pin {u8 state; }; -#define TSIO_PIN_VALID (pin) ((pin) < (BNXT_MAX_TSIO_PINS)) +#define TSIO_PIN_VALID (pin) ((pin) >= 0 && (pin) < (BNXT_MAX_TSIO_PINS))#define EVENT_DATA2_PPS_EVENT_TYPE (data2) \ ((data2) & ASYNC_EVENT_CMPL_PPS_TIMESTAMP_EVENT_DATA2_EVENT_TYPE)
Greg Kroah-Hartman
maintainerPATCH 61/1126 f2fs: fix to do sanity check on .cp_pack_total_block_count
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
commit 5b5b4f85b01604389f7a0f11ef180a725bf0e2d4 upstream.
As bughunter reported in bugzilla:
https://bugzilla.kernel.org/show_bug.cgi?id=215709
f2fs may hang when mounting a fuzzed image, the dmesg shows as below:
__filemap_get_folio+0x3a9/0x590 pagecache_get_page+0x18/0x60 __get_meta_page+0x95/0x460 [f2fs] get_checkpoint_version+0x2a/0x1e0 [f2fs] validate_checkpoint+0x8e/0x2a0 [f2fs] f2fs_get_valid_checkpoint+0xd0/0x620 [f2fs] f2fs_fill_super+0xc01/0x1d40 [f2fs] mount_bdev+0x18a/0x1c0 f2fs_mount+0x15/0x20 [f2fs] legacy_get_tree+0x28/0x50 vfs_get_tree+0x27/0xc0 path_mount+0x480/0xaa0 do_mount+0x7c/0xa0 __x64_sys_mount+0x8b/0xe0 do_syscall_64+0x38/0xc0 entry_SYSCALL_64_after_hwframe+0x44/0xae
The root cause is cp_pack_total_block_count field in checkpoint was fuzzed to one, as calcuated, two cp pack block locates in the same block address, so then read latter cp pack block, it will block on the page lock due to the lock has already held when reading previous cp pack block, fix it by adding sanity check for cp_pack_total_block_count.
--- fs/f2fs/checkpoint.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
fs/f2fs/checkpoint.c +5 -3
@@ -864,6 +864,7 @@ static struct page *validate_checkpoint(struct page *cp_page_1 =NULL , *cp_page_2 =NULL ;struct f2fs_checkpoint *cp_block =NULL ;unsigned long long cur_version =0 , pre_version =0 ; +unsigned int cp_blocks;int err; err = get_checkpoint_version(sbi, cp_addr, &cp_block,
@@ -871,15 +872,16 @@ static struct page *validate_checkpoint(if (err)return NULL ; -if (le32_to_cpu (cp_block->cp_pack_total_block_count) > - sbi->blocks_per_seg) { + cp_blocks =le32_to_cpu (cp_block->cp_pack_total_block_count); + +if (cp_blocks > sbi->blocks_per_seg || cp_blocks <=F2FS_CP_PACKS ) {f2fs_warn (sbi,"invalid cp_pack_total_block_count:%u" ,le32_to_cpu (cp_block->cp_pack_total_block_count)); goto invalid_cp; } pre_version = *version; - cp_addr +=le32_to_cpu (cp_block->cp_pack_total_block_count) -1 ; + cp_addr += cp_blocks -1 ; err =get_checkpoint_version (sbi, cp_addr, &cp_block, &cp_page_2, version);if (err)
Greg Kroah-Hartman
maintainerPATCH 76/1126 mm: fs: fix lru_cache_disabled race in bh_lru
In reply to Greg Kroah-HartmanFrom: Minchan Kim <[email protected]>
commit c0226eb8bde854e016a594a16f5c0d98aca426fa upstream.
Check lru_cache_disabled under bh_lru_lock. Otherwise, it could introduce race below and it fails to migrate pages containing buffer_head.
CPU 0 CPU 1
bh_lru_install
lru_cache_disable
lru_cache_disabled = false
atomic_inc(&lru_disable_count); invalidate_bh_lrus_cpu of CPU 0 bh_lru_lock __invalidate_bh_lrus bh_lru_unlock
bh_lru_lock
install the bh
bh_lru_unlock
WHen this race happens a CMA allocation fails, which is critical for the workload which depends on CMA.
--- fs/buffer.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
fs/buffer.c +5 -3
@@ -1235,16 +1235,18 @@ static void bh_lru_install(struct bufferint i;check_irqs_on (); +bh_lru_lock (); +/* * the refcount of buffer_head in bh_lru prevents dropping the * attached page(i.e., try_to_free_buffers) so it could cause * failing page migration. * Skip putting upcoming bh into bh_lru until migration is done. */ -if (lru_cache_disabled ()) +if (lru_cache_disabled ()) { +bh_lru_unlock ();return ; - -bh_lru_lock (); + } b =this_cpu_ptr (&bh_lrus);for (i =0 ; i <BH_LRU_SIZE ; i++) {
Greg Kroah-Hartman
maintainerPATCH 83/1126 scsi: scsi_transport_fc: Fix FPIN Link Integrity statistics counters
In reply to Greg Kroah-HartmanFrom: James Smart <[email protected]>
commit 07e0984b96ec1ba8c6de1c092b986b00ea0c114c upstream.
In the original FPIN commit, stats were incremented by the event_count. Event_count is the minimum # of events that must occur before an FPIN is sent. Thus, its not the actual number of events, and could be significantly off (too low) as it doesn't reflect anything not reported. Rather than attempt to count events, have the statistic count how many FPINS cross the threshold and were reported.
--- drivers/scsi/scsi_transport_fc.c | 39 ++++++++++++++++----------------------- 1 file changed, 16 insertions(+), 23 deletions(-)
drivers/scsi/scsi_transport_fc.c +16 -23
@@ -34,7 +34,7 @@ static int fc_bsg_hostadd(struct Scsi_Hostatic int fc_bsg_rportadd (struct Scsi_Host *,struct fc_rport *);static void fc_bsg_remove (struct request_queue *);static void fc_bsg_goose_queue (struct fc_rport *); -static void fc_li_stats_update (struct fc_fn_li_desc *li_desc, +static void fc_li_stats_update (u16 event_type,struct fc_fpin_stats *stats);static void fc_delivery_stats_update (u32 reason_code,struct fc_fpin_stats *stats);
@@ -670,42 +670,34 @@ fc_find_rport_by_wwpn(struct Scsi_Host *EXPORT_SYMBOL (fc_find_rport_by_wwpn);static void -fc_li_stats_update (struct fc_fn_li_desc *li_desc, +fc_li_stats_update (u16 event_type,struct fc_fpin_stats *stats) { - stats->li +=be32_to_cpu (li_desc->event_count); -switch (be16_to_cpu (li_desc->event_type)) { + stats->li++; +switch (event_type) {case FPIN_LI_UNKNOWN : - stats->li_failure_unknown += -be32_to_cpu (li_desc->event_count); + stats->li_failure_unknown++;break ;case FPIN_LI_LINK_FAILURE : - stats->li_link_failure_count += -be32_to_cpu (li_desc->event_count); + stats->li_link_failure_count++;break ;case FPIN_LI_LOSS_OF_SYNC : - stats->li_loss_of_sync_count += -be32_to_cpu (li_desc->event_count); + stats->li_loss_of_sync_count++;break ;case FPIN_LI_LOSS_OF_SIG : - stats->li_loss_of_signals_count += -be32_to_cpu (li_desc->event_count); + stats->li_loss_of_signals_count++;break ;case FPIN_LI_PRIM_SEQ_ERR : - stats->li_prim_seq_err_count += -be32_to_cpu (li_desc->event_count); + stats->li_prim_seq_err_count++;break ;case FPIN_LI_INVALID_TX_WD : - stats->li_invalid_tx_word_count += -be32_to_cpu (li_desc->event_count); + stats->li_invalid_tx_word_count++;break ;case FPIN_LI_INVALID_CRC : - stats->li_invalid_crc_count += -be32_to_cpu (li_desc->event_count); + stats->li_invalid_crc_count++;break ;case FPIN_LI_DEVICE_SPEC : - stats->li_device_specific += -be32_to_cpu (li_desc->event_count); + stats->li_device_specific++;break ; } }
@@ -767,6 +759,7 @@ fc_fpin_li_stats_update(struct Scsi_Hoststruct fc_rport *attach_rport =NULL ;struct fc_host_attrs *fc_host =shost_to_fc_host (shost);struct fc_fn_li_desc *li_desc = (struct fc_fn_li_desc *)tlv; +u16 event_type =be16_to_cpu (li_desc->event_type);u64 wwpn; rport = fc_find_rport_by_wwpn(shost,
@@ -775,7 +768,7 @@ fc_fpin_li_stats_update(struct Scsi_Host (rport->roles & FC_PORT_ROLE_FCP_TARGET || rport->roles & FC_PORT_ROLE_NVME_TARGET)) { attach_rport = rport; -fc_li_stats_update (li_desc, &attach_rport->fpin_stats); +fc_li_stats_update (event_type, &attach_rport->fpin_stats); }if (be32_to_cpu (li_desc->pname_count) >0 ) {
@@ -789,14 +782,14 @@ fc_fpin_li_stats_update(struct Scsi_Host rport->roles & FC_PORT_ROLE_NVME_TARGET)) {if (rport == attach_rport)continue ; -fc_li_stats_update (li_desc, +fc_li_stats_update (event_type, &rport->fpin_stats); } } }if (fc_host->port_name ==be64_to_cpu (li_desc->attached_wwpn)) -fc_li_stats_update (li_desc, &fc_host->fpin_stats); +fc_li_stats_update (event_type, &fc_host->fpin_stats); }/*
Greg Kroah-Hartman
maintainerPATCH 152/1126 ARM: dts: exynos: add missing HDMI supplies on SMDK5250
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
commit 60a9914cb2061ba612a3f14f6ad329912b486360 upstream.
Add required VDD supplies to HDMI block on SMDK5250. Without them, the HDMI driver won't probe. Because of lack of schematics, use same supplies as on Arndale 5250 board (voltage matches).
--- arch/arm/boot/dts/exynos5250-smdk5250.dts | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/boot/dts/exynos5250-smdk5250.dts +3 -0
@@ -118,6 +118,9 @@ status = "okay"; ddc = <&i2c_2>; hpd-gpios = <&gpx3 7 GPIO_ACTIVE_HIGH>; + vdd-supply = <&ldo8_reg>; + vdd_osc-supply = <&ldo10_reg>; + vdd_pll-supply = <&ldo8_reg>; }; &i2c_0 {
Greg Kroah-Hartman
maintainerPATCH 97/1126 ALSA: hda: Avoid unsol event during RPM suspending
In reply to Greg Kroah-HartmanFrom: Mohan Kumar <[email protected]>
commit 6ddc2f749621d5d45ca03edc9f0616bcda136d29 upstream.
There is a corner case with unsol event handling during codec runtime suspending state. When the codec runtime suspend call initiated, the codec->in_pm atomic variable would be 0, currently the codec runtime suspend function calls snd_hdac_enter_pm() which will just increments the codec->in_pm atomic variable. Consider unsol event happened just after this step and before snd_hdac_leave_pm() in the codec runtime suspend function. The snd_hdac_power_up_pm() in the unsol event flow in hdmi_present_sense_via_verbs() function would just increment the codec->in_pm atomic variable without calling pm_runtime_get_sync function.
As codec runtime suspend flow is already in progress and in parallel unsol event is also accessing the codec verbs, as soon as codec suspend flow completes and clocks are switched off before completing the unsol event handling as both functions doesn't wait for each other. This will result in below errors
[ 589.428020] tegra-hda 3510000.hda: azx_get_response timeout, switching to polling mode: last cmd=0x505f2f57 [ 589.428344] tegra-hda 3510000.hda: spurious response 0x80000074:0x5, last cmd=0x505f2f57 [ 589.428547] tegra-hda 3510000.hda: spurious response 0x80000065:0x5,
last cmd=0x505f2f57
To avoid this, the unsol event flow should not perform any codec verb related operations during RPM_SUSPENDING state.
--- sound/pci/hda/patch_hdmi.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
sound/pci/hda/patch_hdmi.c +7 -1
@@ -1617,6 +1617,7 @@ static void hdmi_present_sense_via_verbsstruct hda_codec *codec = per_pin->codec;struct hdmi_spec *spec = codec->spec;struct hdmi_eld *eld = &spec->temp_eld; +struct device *dev =hda_codec_dev (codec);hda_nid_t pin_nid = per_pin->pin_nid;int dev_id = per_pin->dev_id;/*
@@ -1630,8 +1631,13 @@ static void hdmi_present_sense_via_verbsint present;int ret; +#ifdef CONFIG_PM +if (dev->power.runtime_status ==RPM_SUSPENDING ) +return ; +#endif + ret =snd_hda_power_up_pm (codec); -if (ret <0 &&pm_runtime_suspended (hda_codec_dev (codec))) +if (ret <0 &&pm_runtime_suspended (dev)) goto out; present =snd_hda_jack_pin_sense (codec, pin_nid, dev_id);
Greg Kroah-Hartman
maintainerPATCH 123/1126 arm64: dts: ti: k3-am65: Fix gic-v3 compatible regs
In reply to Greg Kroah-HartmanFrom: Nishanth Menon <[email protected]>
commit 8cae268b70f387ff9e697ccd62fb2384079124e7 upstream.
Though GIC ARE option is disabled for no GIC-v2 compatibility, Cortex-A53 is free to implement the CPU interface as long as it communicates with the GIC using the stream protocol. This requires that the SoC integration mark out the PERIPHBASE[1] as reserved area within the SoC. See longer discussion in [2] for further information.
Update the GIC register map to indicate offsets from PERIPHBASE based on [3]. Without doing this, systems like kvm will not function with gic-v2 emulation.
[1] https://developer.arm.com/documentation/ddi0500/e/system-control/aarch64-register-descriptions/configuration-base-address-register--el1
[2] https://lore.kernel.org/all/[email protected]/
[3] https://developer.arm.com/documentation/ddi0500/e/generic-interrupt-controller-cpu-interface/gic-programmers-model/memory-map
--- arch/arm64/boot/dts/ti/k3-am65-main.dtsi | 5 ++++- arch/arm64/boot/dts/ti/k3-am65.dtsi | 1 + 2 files changed, 5 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/ti/k3-am65-main.dtsi +4 -1
@@ -35,7 +35,10 @@ #interrupt-cells = <3>; interrupt-controller; reg = <0x00 0x01800000 0x00 0x10000>, /* GICD */ - <0x00 0x01880000 0x00 0x90000>; /* GICR */ + <0x00 0x01880000 0x00 0x90000>, /* GICR */ + <0x00 0x6f000000 0x00 0x2000>, /* GICC */ + <0x00 0x6f010000 0x00 0x1000>, /* GICH */ + <0x00 0x6f020000 0x00 0x2000>; /* GICV */ /* * vcpumntirq: * virtual CPU interface maintenance interrupt
arch/arm64/boot/dts/ti/k3-am65.dtsi +1 -0
@@ -86,6 +86,7 @@ <0x00 0x46000000 0x00 0x46000000 0x00 0x00200000>, <0x00 0x47000000 0x00 0x47000000 0x00 0x00068400>, <0x00 0x50000000 0x00 0x50000000 0x00 0x8000000>, + <0x00 0x6f000000 0x00 0x6f000000 0x00 0x00310000>, /* A53 PERIPHBASE */ <0x00 0x70000000 0x00 0x70000000 0x00 0x200000>, <0x05 0x00000000 0x05 0x00000000 0x01 0x0000000>, <0x07 0x00000000 0x07 0x00000000 0x01 0x0000000>;
Greg Kroah-Hartman
maintainerPATCH 117/1126 drbd: fix potential silent data corruption
In reply to Greg Kroah-HartmanFrom: Lars Ellenberg <[email protected]>
commit f4329d1f848ac35757d9cc5487669d19dfc5979c upstream.
Scenario:
---------
bio chain generated by blk_queue_split().
Some split bio fails and propagates its error status to the "parent" bio. But then the (last part of the) parent bio itself completes without error.
We would clobber the already recorded error status with BLK_STS_OK, causing silent data corruption.
Reproducer:
-----------
How to trigger this in the real world within seconds:
DRBD on top of degraded parity raid,
small stripe_cache_size, large read_ahead setting. Drop page cache (sysctl vm.drop_caches=1, fadvise "DONTNEED", umount and mount again, "reboot").
Cause significant read ahead.
Large read ahead request is split by blk_queue_split(). Parts of the read ahead that are already in the stripe cache, or find an available stripe cache to use, can be serviced. Parts of the read ahead that would need "too much work", would need to wait for a "stripe_head" to become available, are rejected immediately.
For larger read ahead requests that are split in many pieces, it is very likely that some "splits" will be serviced, but then the stripe cache is exhausted/busy, and the remaining ones will be rejected.
--- drivers/block/drbd/drbd_req.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/block/drbd/drbd_req.c +2 -1
@@ -180,7 +180,8 @@ void start_new_tl_epoch(struct drbd_connvoid complete_master_bio (struct drbd_device *device,struct bio_and_error *m) { - m->bio->bi_status =errno_to_blk_status (m->error); +if (unlikely (m->error)) + m->bio->bi_status =errno_to_blk_status (m->error);bio_endio (m->bio);dec_ap_bio (device); }
Greg Kroah-Hartman
maintainerPATCH 161/1126 crypto: rsa-pkcs1pad - correctly get hash from source scatterlist
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
commit e316f7179be22912281ce6331d96d7c121fb2b17 upstream.
Commit c7381b012872 ("crypto: akcipher - new verify API for public key algorithms") changed akcipher_alg::verify to take in both the signature and the actual hash and do the signature verification, rather than just return the hash expected by the signature as was the case before. To do this, it implemented a hack where the signature and hash are concatenated with each other in one scatterlist.
Obviously, for this to work correctly, akcipher_alg::verify needs to correctly extract the two items from the scatterlist it is given. Unfortunately, it doesn't correctly extract the hash in the case where the signature is longer than the RSA key size, as it assumes that the signature's length is equal to the RSA key size. This causes a prefix of the hash, or even the entire hash, to be taken from the *signature*.
(Note, the case of a signature longer than the RSA key size should not be allowed in the first place; a separate patch will fix that.)
It is unclear whether the resulting scheme has any useful security properties.
Fix this by correctly extracting the hash from the scatterlist.
--- crypto/rsa-pkcs1pad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
crypto/rsa-pkcs1pad.c +1 -1
@@ -495,7 +495,7 @@ static int pkcs1pad_verify_complete(strusg_nents_for_len (req->src, req->src_len + req->dst_len), req_ctx->out_buf + ctx->key_size, - req->dst_len, ctx->key_size); + req->dst_len, req->src_len);/* Do the actual verification step. */ if (memcmp (req_ctx->out_buf + ctx->key_size, out_buf + pos, req->dst_len) !=0 )
Greg Kroah-Hartman
maintainerPATCH 106/1126 mm: madvise: return correct bytes advised with process_madvise
In reply to Greg Kroah-HartmanFrom: Charan Teja Kalla <[email protected]>
commit 5bd009c7c9a9e888077c07535dc0c70aeab242c3 upstream.
Patch series "mm: madvise: return correct bytes processed with process_madvise", v2. With the process_madvise(), always choose to return non zero processed bytes over an error. This can help the user to know on which VMA, passed in the 'struct iovec' vector list, is failed to advise thus can take the decission of retrying/skipping on that VMA.
This patch (of 2):
The process_madvise() system call returns error even after processing some VMA's passed in the 'struct iovec' vector list which leaves the user confused to know where to restart the advise next. It is also against this syscall man page[1] documentation where it mentions that "return value may be less than the total number of requested bytes, if an error occurred after some iovec elements were already processed.".
Consider a user passed 10 VMA's in the 'struct iovec' vector list of which 9 are processed but one. Then it just returns the error caused on that failed VMA despite the first 9 VMA's processed, leaving the user confused about on which VMA it is failed. Returning the number of bytes processed here can help the user to know which VMA it is failed on and thus can retry/skip the advise on that VMA.
[1]https://man7.org/linux/man-pages/man2/process_madvise.2.html.
--- mm/madvise.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
mm/madvise.c +1 -2
@@ -1440,8 +1440,7 @@ SYSCALL_DEFINE5(process_madvise, int, piiov_iter_advance (&iter, iovec.iov_len); } -if (ret ==0 ) - ret = total_len -iov_iter_count (&iter); + ret = (total_len -iov_iter_count (&iter)) ? : ret; release_mm:mmput (mm);
Greg Kroah-Hartman
maintainerPATCH 168/1126 media: omap3isp: Use struct_group() for memcpy() region
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
commit d4568fc8525897e683983806f813be1ae9eedaed upstream.
In preparation for FORTIFY_SOURCE performing compile-time and run-time field bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Wrap the target region in struct_group(). This additionally fixes a theoretical misalignment of the copy (since the size of "buf" changes between 64-bit and 32-bit, but this is likely never built for 64-bit).
FWIW, I think this code is totally broken on 64-bit (which appears to not be a "real" build configuration): it would either always fail (with an uninitialized data->buf_size) or would cause corruption in userspace due to the copy_to_user() in the call path against an uninitialized data->buf value:
omap3isp_stat_request_statistics_time32(...)
struct omap3isp_stat_data data64;
...
omap3isp_stat_request_statistics(stat, &data64);int omap3isp_stat_request_statistics(struct ispstat *stat,
struct omap3isp_stat_data *data)
...
buf = isp_stat_buf_get(stat, data);static struct ispstat_buffer *isp_stat_buf_get(struct ispstat *stat,
struct omap3isp_stat_data *data)
...
if (buf->buf_size > data->buf_size) {
...
return ERR_PTR(-EINVAL);
}
...
rval = copy_to_user(data->buf,
buf->virt_addr,
buf->buf_size);Regardless, additionally initialize data64 to be zero-filled to avoid undefined behavior.
--- drivers/media/platform/omap3isp/ispstat.c | 5 +++-- include/uapi/linux/omap3isp.h | 21 +++++++++++++-------- 2 files changed, 16 insertions(+), 10 deletions(-)
drivers/media/platform/omap3isp/ispstat.c +3 -2
@@ -512,7 +512,7 @@ int omap3isp_stat_request_statistics(strint omap3isp_stat_request_statistics_time32 (struct ispstat *stat,struct omap3isp_stat_data_time32 *data) { -struct omap3isp_stat_data data64; +struct omap3isp_stat_data data64 = { };int ret; ret =omap3isp_stat_request_statistics (stat, &data64);
@@ -521,7 +521,8 @@ int omap3isp_stat_request_statistics_tim data->ts.tv_sec = data64.ts.tv_sec; data->ts.tv_usec = data64.ts.tv_usec; -memcpy (&data->buf, &data64.buf,sizeof (*data) -sizeof (data->ts)); + data->buf = (uintptr_t )data64.buf; +memcpy (&data->frame, &data64.frame,sizeof (data->frame));return 0 ; }
include/uapi/linux/omap3isp.h +13 -8
@@ -162,6 +162,7 @@ struct omap3isp_h3a_aewb_config {* struct omap3isp_stat_data - Statistic data sent to or received from user * @ts: Timestamp of returned framestats. * @buf: Pointer to pass to user. +* @buf_size: Size of buffer. * @frame_number: Frame number of requested stats. * @cur_frame: Current frame number being processed. * @config_counter: Number of the configuration associated with the data.
@@ -176,10 +177,12 @@ struct omap3isp_stat_data {struct timeval ts;#endif void __user *buf; -__u32 buf_size; -__u16 frame_number; -__u16 cur_frame; -__u16 config_counter; + __struct_group(/* no tag */, frame, /* no attrs */, + __u32 buf_size; +__u16 frame_number; +__u16 cur_frame; +__u16 config_counter; + ); };#ifdef __KERNEL__
@@ -189,10 +192,12 @@ struct omap3isp_stat_data_time32 {__s32 tv_usec; } ts;__u32 buf; -__u32 buf_size; -__u16 frame_number; -__u16 cur_frame; -__u16 config_counter; + __struct_group(/* no tag */, frame, /* no attrs */, + __u32 buf_size; +__u16 frame_number; +__u16 cur_frame; +__u16 config_counter; + ); };#endif
Greg Kroah-Hartman
maintainerPATCH 102/1126 io_uring: ensure that fsnotify is always called
In reply to Greg Kroah-HartmanFrom: Jens Axboe <[email protected]>
commit f63cf5192fe3418ad5ae1a4412eba5694b145f79 upstream.
Ensure that we call fsnotify_modify() if we write a file, and that we do fsnotify_access() if we read it. This enables anyone using inotify on the file to get notified.
Ditto for fallocate, ensure that fsnotify_modify() is called.
--- fs/io_uring.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
fs/io_uring.c +7 -1
@@ -2813,8 +2813,12 @@ static bool io_rw_should_reissue(structstatic bool __io_complete_rw_common (struct io_kiocb *req,long res) { -if (req->rw.kiocb.ki_flags &IOCB_WRITE ) +if (req->rw.kiocb.ki_flags &IOCB_WRITE ) {kiocb_end_write (req); +fsnotify_modify (req->file); + }else { +fsnotify_access (req->file); + }if (unlikely (res != req->result)) {if ((res == -EAGAIN || res == -EOPNOTSUPP ) &&io_rw_should_reissue (req)) {
@@ -4301,6 +4305,8 @@ static int io_fallocate(struct io_kiocb req->sync.len);if (ret <0 )req_set_fail (req); +else +fsnotify_modify (req->file);io_req_complete (req, ret);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 129/1126 mmc: core: use sysfs_emit() instead of sprintf()
In reply to Greg Kroah-HartmanFrom: Sergey Shtylyov <[email protected]>
commit f5d8a5fe77ce933f53eb8f2e22bb7a1a2019ea11 upstream.
sprintf() (still used in the MMC core for the sysfs output) is vulnerable to the buffer overflow. Use the new-fangled sysfs_emit() instead.
Found by Linux Verification Center (linuxtesting.org) with the SVACE static analysis tool.
--- drivers/mmc/core/bus.c | 9 +++++---- drivers/mmc/core/bus.h | 3 ++- drivers/mmc/core/mmc.c | 16 ++++++++-------- drivers/mmc/core/sd.c | 27 +++++++++++++-------------- drivers/mmc/core/sdio.c | 5 +++-- drivers/mmc/core/sdio_bus.c | 7 ++++--- 6 files changed, 35 insertions(+), 32 deletions(-)
drivers/mmc/core/bus.c +5 -4
@@ -15,6 +15,7 @@#include <linux/stat.h> #include <linux/of.h> #include <linux/pm_runtime.h> +#include <linux/sysfs.h> #include <linux/mmc/card.h> #include <linux/mmc/host.h>
@@ -34,13 +35,13 @@ static ssize_t type_show(struct device *switch (card->type) {case MMC_TYPE_MMC : -return sprintf (buf,"MMC\n" ); +return sysfs_emit (buf,"MMC\n" );case MMC_TYPE_SD : -return sprintf (buf,"SD\n" ); +return sysfs_emit (buf,"SD\n" );case MMC_TYPE_SDIO : -return sprintf (buf,"SDIO\n" ); +return sysfs_emit (buf,"SDIO\n" );case MMC_TYPE_SD_COMBO : -return sprintf (buf,"SDcombo\n" ); +return sysfs_emit (buf,"SDcombo\n" );default :return -EFAULT ; }
drivers/mmc/core/bus.h +2 -1
@@ -9,6 +9,7 @@#define _MMC_CORE_BUS_H#include <linux/device.h> +#include <linux/sysfs.h> struct mmc_host ;struct mmc_card ;
@@ -17,7 +18,7 @@ struct mmc_card; static ssize_t mmc_##name##_show (struct device *dev, struct device_attribute *attr, char *buf) \ { \ struct mmc_card *card = mmc_dev_to_card(dev); \ - return sprintf(buf, fmt, args); \ + return sysfs_emit(buf, fmt, args); \ } \ static DEVICE_ATTR(name, S_IRUGO, mmc_##name##_show, NULL)
drivers/mmc/core/mmc.c +8 -8
@@ -12,6 +12,7 @@#include <linux/slab.h> #include <linux/stat.h> #include <linux/pm_runtime.h> +#include <linux/sysfs.h> #include <linux/mmc/host.h> #include <linux/mmc/card.h>
@@ -812,12 +813,11 @@ static ssize_t mmc_fwrev_show(struct dev {struct mmc_card *card =mmc_dev_to_card (dev); -if (card->ext_csd.rev <7 ) { -return sprintf (buf,"0x%x\n" , card->cid.fwrev); - }else { -return sprintf (buf,"0x%*phN\n" ,MMC_FIRMWARE_LEN , - card->ext_csd.fwrev); - } +if (card->ext_csd.rev <7 ) +return sysfs_emit (buf,"0x%x\n" , card->cid.fwrev); +else +return sysfs_emit (buf,"0x%*phN\n" ,MMC_FIRMWARE_LEN , + card->ext_csd.fwrev); } static DEVICE_ATTR(fwrev, S_IRUGO, mmc_fwrev_show, NULL);
@@ -830,10 +830,10 @@ static ssize_t mmc_dsr_show(struct devicstruct mmc_host *host = card->host;if (card->csd.dsr_imp && host->dsr_req) -return sprintf (buf,"0x%x\n" , host->dsr); +return sysfs_emit (buf,"0x%x\n" , host->dsr);else /* return default DSR value */ -return sprintf (buf,"0x%x\n" ,0x404 ); +return sysfs_emit (buf,"0x%x\n" ,0x404 ); } static DEVICE_ATTR(dsr, S_IRUGO, mmc_dsr_show, NULL);
drivers/mmc/core/sd.c +13 -14
@@ -13,6 +13,7 @@#include <linux/stat.h> #include <linux/pm_runtime.h> #include <linux/scatterlist.h> +#include <linux/sysfs.h> #include <linux/mmc/host.h> #include <linux/mmc/card.h>
@@ -708,18 +709,16 @@ MMC_DEV_ATTR(ocr, "0x%08x\n", card->ocr)MMC_DEV_ATTR (rca,"0x%04x\n" , card->rca); -static ssize_t mmc_dsr_show (struct device *dev, -struct device_attribute *attr, -char *buf) -{ -struct mmc_card *card =mmc_dev_to_card (dev); -struct mmc_host *host = card->host; - -if (card->csd.dsr_imp && host->dsr_req) -return sprintf (buf,"0x%x\n" , host->dsr); -else -/* return default DSR value */ -return sprintf (buf,"0x%x\n" ,0x404 ); +static ssize_t mmc_dsr_show (struct device *dev,struct device_attribute *attr, +char *buf) +{ +struct mmc_card *card =mmc_dev_to_card (dev); +struct mmc_host *host = card->host; + +if (card->csd.dsr_imp && host->dsr_req) +return sysfs_emit (buf,"0x%x\n" , host->dsr); +/* return default DSR value */ +return sysfs_emit (buf,"0x%x\n" ,0x404 ); } static DEVICE_ATTR(dsr, S_IRUGO, mmc_dsr_show, NULL);
@@ -735,9 +734,9 @@ static ssize_t info##num##_show(struct d \if (num > card->num_info) \return -ENODATA ; \ -if (!card->info[num-1 ][0 ]) \ +if (!card->info[num -1 ][0 ]) \return 0 ; \ -return sprintf (buf,"%s\n" , card->info[num-1 ]); \ +return sysfs_emit (buf,"%s\n" , card->info[num -1 ]); \ } \ static DEVICE_ATTR_RO(info##num)
drivers/mmc/core/sdio.c +3 -2
@@ -7,6 +7,7 @@#include <linux/err.h> #include <linux/pm_runtime.h> +#include <linux/sysfs.h> #include <linux/mmc/host.h> #include <linux/mmc/card.h>
@@ -40,9 +41,9 @@ static ssize_t info##num##_show(struct d \if (num > card->num_info) \return -ENODATA ; \ -if (!card->info[num-1 ][0 ]) \ +if (!card->info[num -1 ][0 ]) \return 0 ; \ -return sprintf (buf,"%s\n" , card->info[num-1 ]); \ +return sysfs_emit (buf,"%s\n" , card->info[num -1 ]); \ } \ static DEVICE_ATTR_RO(info##num)
drivers/mmc/core/sdio_bus.c +4 -3
@@ -14,6 +14,7 @@#include <linux/pm_runtime.h> #include <linux/pm_domain.h> #include <linux/acpi.h> +#include <linux/sysfs.h> #include <linux/mmc/card.h> #include <linux/mmc/host.h>
@@ -35,7 +36,7 @@ field##_show(struct device *dev, structstruct sdio_func *func; \ \ func =dev_to_sdio_func (dev); \ -return sprintf (buf, format_string, args); \ +return sysfs_emit (buf, format_string, args); \ } \static DEVICE_ATTR_RO (field)
@@ -52,9 +53,9 @@ static ssize_t info##num##_show(struct d \if (num > func->num_info) \return -ENODATA ; \ -if (!func->info[num-1 ][0 ]) \ +if (!func->info[num -1 ][0 ]) \return 0 ; \ -return sprintf (buf,"%s\n" , func->info[num-1 ]); \ +return sysfs_emit (buf,"%s\n" , func->info[num -1 ]); \ } \ static DEVICE_ATTR_RO(info##num)
Greg Kroah-Hartman
maintainerPATCH 158/1126 lib/raid6/test: fix multiple definition linking error
In reply to Greg Kroah-HartmanFrom: Dirk Müller <[email protected]>
commit a5359ddd052860bacf957e65fe819c63e974b3a6 upstream.
GCC 10+ defaults to -fno-common, which enforces proper declaration of external references using "extern". without this change a link would fail with:
lib/raid6/test/algos.c:28: multiple definition of `raid6_call'; lib/raid6/test/test.c:22: first defined here
the pq.h header that is included already includes an extern declaration so we can just remove the redundant one here.
--- lib/raid6/test/test.c | 1 - 1 file changed, 1 deletion(-)
lib/raid6/test/test.c +0 -1
@@ -19,7 +19,6 @@#define NDISKS 16/* Including P and Q */ const char raid6_empty_zero_page[PAGE_SIZE] __attribute__((aligned(PAGE_SIZE))); -struct raid6_calls raid6_call;char *dataptrs[NDISKS ]; char data[NDISKS][PAGE_SIZE] __attribute__((aligned(PAGE_SIZE)));
Greg Kroah-Hartman
maintainerPATCH 155/1126 carl9170: fix missing bit-wise or operator for tx_params
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
commit 02a95374b5eebdbd3b6413fd7ddec151d2ea75a1 upstream.
Currently tx_params is being re-assigned with a new value and the previous setting IEEE80211_HT_MCS_TX_RX_DIFF is being overwritten. The assignment operator is incorrect, the original intent was to bit-wise or the value in. Fix this by replacing the = operator with |= instead.
Kudos to Christian Lamparter for suggesting the correct fix.
--- drivers/net/wireless/ath/carl9170/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/carl9170/main.c +1 -1
@@ -1914,7 +1914,7 @@ static int carl9170_parse_eeprom(structWARN_ON (!(tx_streams >=1 && tx_streams <=IEEE80211_HT_MCS_TX_MAX_STREAMS )); - tx_params = (tx_streams -1 ) << + tx_params |= (tx_streams -1 ) <<IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT ; carl9170_band_2GHz.ht_cap.mcs.tx_params |= tx_params;
Greg Kroah-Hartman
maintainerPATCH 80/1126 mempolicy: mbind_range() set_policy() after vma_merge()
In reply to Greg Kroah-HartmanFrom: Hugh Dickins <[email protected]>
commit 4e0906008cdb56381638aa17d9c32734eae6d37a upstream.
v2.6.34 commit 9d8cebd4bcd7 ("mm: fix mbind vma merge problem") introduced vma_merge() to mbind_range(); but unlike madvise, mlock and mprotect, it put a "continue" to next vma where its precedents go to update flags on current vma before advancing: that left vma with the wrong setting in the infamous vma_merge() case 8.
v3.10 commit 1444f92c8498 ("mm: merging memory blocks resets mempolicy") tried to fix that in vma_adjust(), without fully understanding the issue.
v3.11 commit 3964acd0dbec ("mm: mempolicy: fix mbind_range() && vma_adjust() interaction") reverted that, and went about the fix in the right way, but chose to optimize out an unnecessary mpol_dup() with a prior mpol_equal() test. But on tmpfs, that also pessimized out the vital call to its ->set_policy(), leaving the new mbind unenforced.
The user visible effect was that the pages got allocated on the local node (happened to be 0), after the mbind() caller had specifically asked for them to be allocated on node 1. There was not any page migration involved in the case reported: the pages simply got allocated on the wrong node.
Just delete that optimization now (though it could be made conditional on vma not having a set_policy). Also remove the "next" variable: it turned out to be blameless, but also pointless.
--- mm/mempolicy.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
mm/mempolicy.c +1 -7
@@ -786,7 +786,6 @@ static int vma_replace_policy(struct vm_static int mbind_range (struct mm_struct *mm,unsigned long start,unsigned long end,struct mempolicy *new_pol) { -struct vm_area_struct *next;struct vm_area_struct *prev;struct vm_area_struct *vma;int err =0 ;
@@ -801,8 +800,7 @@ static int mbind_range(struct mm_structif (start > vma->vm_start) prev = vma; -for (; vma && vma->vm_start < end; prev = vma, vma = next) { - next = vma->vm_next; +for (; vma && vma->vm_start < end; prev = vma, vma = vma->vm_next) { vmstart =max (start, vma->vm_start); vmend =min (end, vma->vm_end);
@@ -817,10 +815,6 @@ static int mbind_range(struct mm_struct anon_vma_name(vma));if (prev) { vma = prev; - next = vma->vm_next; -if (mpol_equal (vma_policy (vma), new_pol)) -continue ; -/* vma_merge() joined vma && vma->next, case 8 */ goto replace; }if (vma->vm_start != vmstart) {
Greg Kroah-Hartman
maintainerPATCH 84/1126 scsi: libsas: Fix sas_ata_qc_issue() handling of NCQ NON DATA commands
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
commit 8454563e4c2aafbfb81a383ab423ea8b9b430a25 upstream.
To detect for the DMA_NONE (no data transfer) DMA direction, sas_ata_qc_issue() tests if the command protocol is ATA_PROT_NODATA. This test does not include the ATA_CMD_NCQ_NON_DATA command as this command protocol is defined as ATA_PROT_NCQ_NODATA (equal to ATA_PROT_FLAG_NCQ) and not as ATA_PROT_NODATA.
To include both NCQ and non-NCQ commands when testing for the DMA_NONE DMA direction, use "!ata_is_data()".
--- drivers/scsi/libsas/sas_ata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/libsas/sas_ata.c +1 -1
@@ -197,7 +197,7 @@ static unsigned int sas_ata_qc_issue(str task->total_xfer_len = qc->nbytes; task->num_scatter = qc->n_elem; task->data_dir = qc->dma_dir; - }else if (qc->tf.protocol ==ATA_PROT_NODATA ) { + }else if (!ata_is_data (qc->tf.protocol)) { task->data_dir =DMA_NONE ; }else {for_each_sg (qc->sg, sg, qc->n_elem, si)
Greg Kroah-Hartman
maintainerPATCH 104/1126 drm/simpledrm: Add "panel orientation" property on non-upright mounted LCD panels
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
commit 94fa115f7b28a3f02611499175e134f0a823b686 upstream.
Some devices use e.g. a portrait panel in a standard laptop casing made for landscape panels. efifb calls drm_get_panel_orientation_quirk() and sets fb_info.fbcon_rotate_hint to make fbcon rotate the console so that it shows up-right instead of on its side.
When switching to simpledrm the fbcon renders on its side. Call the drm_connector_set_panel_orientation_with_quirk() helper to add a "panel orientation" property on devices listed in the quirk table, to make the fbcon (and aware userspace apps) rotate the image to display properly.
--- drivers/gpu/drm/tiny/simpledrm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/tiny/simpledrm.c +3 -0
@@ -798,6 +798,9 @@ static int simpledrm_device_init_modesetif (ret)return ret;drm_connector_helper_add (connector, &simpledrm_connector_helper_funcs); +drm_connector_set_panel_orientation_with_quirk (connector, +DRM_MODE_PANEL_ORIENTATION_UNKNOWN , + mode->hdisplay, mode->vdisplay); formats =simpledrm_device_formats (sdev, &nformats);
Greg Kroah-Hartman
maintainerPATCH 131/1126 ACPI: properties: Consistently return -ENOENT if there are no more references
In reply to Greg Kroah-HartmanFrom: Sakari Ailus <[email protected]>
commit babc92da5928f81af951663fc436997352e02d3a upstream.
__acpi_node_get_property_reference() is documented to return -ENOENT if the caller requests a property reference at an index that does not exist, not -EINVAL which it actually does.
Fix this by returning -ENOENT consistenly, independently of whether the property value is a plain reference or a package.
--- drivers/acpi/property.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/property.c +1 -1
@@ -685,7 +685,7 @@ int __acpi_node_get_property_reference(c*/ if (obj->type ==ACPI_TYPE_LOCAL_REFERENCE ) {if (index) -return -EINVAL ; +return -ENOENT ; device =acpi_fetch_acpi_dev (obj->reference.handle);if (!device)
Greg Kroah-Hartman
maintainerPATCH 98/1126 ALSA: pcm: Fix potential AB/BA lock with buffer_mutex and mmap_lock
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit bc55cfd5718c7c23e5524582e9fa70b4d10f2433 upstream.
syzbot caught a potential deadlock between the PCM runtime->buffer_mutex and the mm->mmap_lock. It was brought by the recent fix to cover the racy read/write and other ioctls, and in that commit, I overlooked a (hopefully only) corner case that may take the revert lock, namely, the OSS mmap. The OSS mmap operation exceptionally allows to re-configure the parameters inside the OSS mmap syscall, where mm->mmap_mutex is already held. Meanwhile, the copy_from/to_user calls at read/write operations also take the mm->mmap_lock internally, hence it may lead to a AB/BA deadlock.
A similar problem was already seen in the past and we fixed it with a refcount (in commit b248371628aa). The former fix covered only the call paths with OSS read/write and OSS ioctls, while we need to cover the concurrent access via both ALSA and OSS APIs now.
This patch addresses the problem above by replacing the buffer_mutex lock in the read/write operations with a refcount similar as we've used for OSS. The new field, runtime->buffer_accessing, keeps the number of concurrent read/write operations. Unlike the former buffer_mutex protection, this protects only around the copy_from/to_user() calls; the other codes are basically protected by the PCM stream lock. The refcount can be a negative, meaning blocked by the ioctls. If a negative value is seen, the read/write aborts with -EBUSY. In the ioctl side, OTOH, they check this refcount, too, and set to a negative value for blocking unless it's already being accessed.
--- include/sound/pcm.h | 1 + sound/core/pcm.c | 1 + sound/core/pcm_lib.c | 9 +++++---- sound/core/pcm_native.c | 39 ++++++++++++++++++++++++++++++++------- 4 files changed, 39 insertions(+), 11 deletions(-)
include/sound/pcm.h +1 -0
@@ -402,6 +402,7 @@ struct snd_pcm_runtime {struct fasync_struct *fasync;bool stop_operating;/* sync_stop will be called */ struct mutex buffer_mutex;/* protect for buffer changes */ +atomic_t buffer_accessing;/* >0: in r/w operation, <0: blocked */ /* -- private section -- */ void *private_data;
sound/core/pcm.c +1 -0
@@ -970,6 +970,7 @@ int snd_pcm_attach_substream(struct snd_ runtime->status->state =SNDRV_PCM_STATE_OPEN ;mutex_init (&runtime->buffer_mutex); +atomic_set (&runtime->buffer_accessing,0 ); substream->runtime = runtime; substream->private_data = pcm->private_data;
sound/core/pcm_lib.c +5 -4
@@ -1906,11 +1906,9 @@ static int wait_for_avail(struct snd_pcmif (avail >= runtime->twake)break ;snd_pcm_stream_unlock_irq (substream); -mutex_unlock (&runtime->buffer_mutex); tout =schedule_timeout (wait_time); -mutex_lock (&runtime->buffer_mutex);snd_pcm_stream_lock_irq (substream);set_current_state (TASK_INTERRUPTIBLE );switch (runtime->status->state) {
@@ -2221,7 +2219,6 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(str nonblock = !!(substream->f_flags &O_NONBLOCK ); -mutex_lock (&runtime->buffer_mutex);snd_pcm_stream_lock_irq (substream); err =pcm_accessible_state (runtime);if (err <0 )
@@ -2276,6 +2273,10 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(str err = -EINVAL ; goto _end_unlock; } +if (!atomic_inc_unless_negative (&runtime->buffer_accessing)) { + err = -EBUSY ; + goto _end_unlock; + }snd_pcm_stream_unlock_irq (substream);if (!is_playback)snd_pcm_dma_buffer_sync (substream,SNDRV_DMA_SYNC_CPU );
@@ -2284,6 +2285,7 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(strif (is_playback)snd_pcm_dma_buffer_sync (substream,SNDRV_DMA_SYNC_DEVICE );snd_pcm_stream_lock_irq (substream); +atomic_dec (&runtime->buffer_accessing);if (err <0 ) goto _end_unlock; err =pcm_accessible_state (runtime);
@@ -2313,7 +2315,6 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(strif (xfer >0 && err >=0 )snd_pcm_update_state (substream, runtime);snd_pcm_stream_unlock_irq (substream); -mutex_unlock (&runtime->buffer_mutex);return xfer >0 ? (snd_pcm_sframes_t )xfer : err; }EXPORT_SYMBOL (__snd_pcm_lib_xfer);
sound/core/pcm_native.c +32 -7
@@ -685,6 +685,24 @@ static int snd_pcm_hw_params_choose(strureturn 0 ; } +/* acquire buffer_mutex; if it's in r/w operation, return -EBUSY, otherwise +* block the further r/w operations +*/ +static int snd_pcm_buffer_access_lock (struct snd_pcm_runtime *runtime) +{ +if (!atomic_dec_unless_positive (&runtime->buffer_accessing)) +return -EBUSY ; +mutex_lock (&runtime->buffer_mutex); +return 0 ;/* keep buffer_mutex, unlocked by below */ +} + +/* release buffer_mutex and clear r/w access flag */ +static void snd_pcm_buffer_access_unlock (struct snd_pcm_runtime *runtime) +{ +mutex_unlock (&runtime->buffer_mutex); +atomic_inc (&runtime->buffer_accessing); +} +#if IS_ENABLED (CONFIG_SND_PCM_OSS )#define is_oss_stream (substream) ((substream)->oss.oss)#else
@@ -695,14 +713,16 @@ static int snd_pcm_hw_params(struct snd_ struct snd_pcm_hw_params *params) {struct snd_pcm_runtime *runtime; -int err =0 , usecs; +int err, usecs;unsigned int bits;snd_pcm_uframes_t frames;if (PCM_RUNTIME_CHECK (substream))return -ENXIO ; runtime = substream->runtime; -mutex_lock (&runtime->buffer_mutex); + err =snd_pcm_buffer_access_lock (runtime); +if (err <0 ) +return err;snd_pcm_stream_lock_irq (substream);switch (runtime->status->state) {case SNDRV_PCM_STATE_OPEN :
@@ -820,7 +840,7 @@ static int snd_pcm_hw_params(struct snd_snd_pcm_lib_free_pages (substream); } unlock: -mutex_unlock (&runtime->buffer_mutex); +snd_pcm_buffer_access_unlock (runtime);return err; }
@@ -865,7 +885,9 @@ static int snd_pcm_hw_free(struct snd_pcif (PCM_RUNTIME_CHECK (substream))return -ENXIO ; runtime = substream->runtime; -mutex_lock (&runtime->buffer_mutex); + result =snd_pcm_buffer_access_lock (runtime); +if (result <0 ) +return result;snd_pcm_stream_lock_irq (substream);switch (runtime->status->state) {case SNDRV_PCM_STATE_SETUP :
@@ -884,7 +906,7 @@ static int snd_pcm_hw_free(struct snd_pcsnd_pcm_set_state (substream,SNDRV_PCM_STATE_OPEN );cpu_latency_qos_remove_request (&substream->latency_pm_qos_req); unlock: -mutex_unlock (&runtime->buffer_mutex); +snd_pcm_buffer_access_unlock (runtime);return result; }
@@ -1369,12 +1391,15 @@ static int snd_pcm_action_nonatomic(cons/* Guarantee the group members won't change during non-atomic action */ down_read (&snd_pcm_link_rwsem); -mutex_lock (&substream->runtime->buffer_mutex); + res =snd_pcm_buffer_access_lock (substream->runtime); +if (res <0 ) + goto unlock;if (snd_pcm_stream_linked (substream)) res =snd_pcm_action_group (ops, substream, state, false);else res =snd_pcm_action_single (ops, substream, state); -mutex_unlock (&substream->runtime->buffer_mutex); +snd_pcm_buffer_access_unlock (substream->runtime); + unlock:up_read (&snd_pcm_link_rwsem);return res; }
Greg Kroah-Hartman
maintainerPATCH 112/1126 dm: fix use-after-free in dm_cleanup_zoned_dev()
In reply to Greg Kroah-HartmanFrom: Kirill Tkhai <[email protected]>
commit 588b7f5df0cb64f281290c7672470c006abe7160 upstream.
dm_cleanup_zoned_dev() uses queue, so it must be called before blk_cleanup_disk() starts its killing:
blk_cleanup_disk->blk_cleanup_queue()->kobject_put()->blk_release_queue()-> ->...RCU...->blk_free_queue_rcu()->kmem_cache_free()
Otherwise, RCU callback may be executed first anddm_cleanup_zoned_dev() will touch free'd memory:
BUG: KASAN: use-after-free in dm_cleanup_zoned_dev+0x33/0xd0 Read of size 8 at addr ffff88805ac6e430 by task dmsetup/681 CPU: 4 PID: 681 Comm: dmsetup Not tainted 5.17.0-rc2+ #6 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014 Call Trace: <TASK> dump_stack_lvl+0x57/0x7d print_address_description.constprop.0+0x1f/0x150 ? dm_cleanup_zoned_dev+0x33/0xd0 kasan_report.cold+0x7f/0x11b ? dm_cleanup_zoned_dev+0x33/0xd0 dm_cleanup_zoned_dev+0x33/0xd0 __dm_destroy+0x26a/0x400 ? dm_blk_ioctl+0x230/0x230 ? up_write+0xd8/0x270 dev_remove+0x156/0x1d0 ctl_ioctl+0x269/0x530 ? table_clear+0x140/0x140 ? lock_release+0xb2/0x750 ? remove_all+0x40/0x40 ? rcu_read_lock_sched_held+0x12/0x70 ? lock_downgrade+0x3c0/0x3c0 ? rcu_read_lock_sched_held+0x12/0x70 dm_ctl_ioctl+0xa/0x10 __x64_sys_ioctl+0xb9/0xf0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7fb6dfa95c27
--- drivers/md/dm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm.c +1 -1
@@ -1609,6 +1609,7 @@ static void cleanup_mapped_device(struct md->dax_dev =NULL ; } +dm_cleanup_zoned_dev (md);if (md->disk) {spin_lock (&_minor_lock); md->disk->private_data =NULL ;
@@ -1629,7 +1630,6 @@ static void cleanup_mapped_device(structmutex_destroy (&md->swap_bios_lock);dm_mq_cleanup_mapped_device (md); -dm_cleanup_zoned_dev (md); }/*
Greg Kroah-Hartman
maintainerPATCH 125/1126 arm64: dts: ti: k3-j7200: Fix gic-v3 compatible regs
In reply to Greg Kroah-HartmanFrom: Nishanth Menon <[email protected]>
commit 1a307cc299430dd7139d351a3b8941f493dfa885 upstream.
Though GIC ARE option is disabled for no GIC-v2 compatibility, Cortex-A72 is free to implement the CPU interface as long as it communicates with the GIC using the stream protocol. This requires that the SoC integration mark out the PERIPHBASE[1] as reserved area within the SoC. See longer discussion in [2] for further information.
Update the GIC register map to indicate offsets from PERIPHBASE based on [3]. Without doing this, systems like kvm will not function with gic-v2 emulation.
[1] https://developer.arm.com/documentation/100095/0002/system-control/aarch64-register-descriptions/configuration-base-address-register--el1
[2] https://lore.kernel.org/all/[email protected]/
[3] https://developer.arm.com/documentation/100095/0002/way1382452674438
--- arch/arm64/boot/dts/ti/k3-j7200-main.dtsi | 5 ++++- arch/arm64/boot/dts/ti/k3-j7200.dtsi | 1 + 2 files changed, 5 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/ti/k3-j7200-main.dtsi +4 -1
@@ -54,7 +54,10 @@ #interrupt-cells = <3>; interrupt-controller; reg = <0x00 0x01800000 0x00 0x10000>, /* GICD */ - <0x00 0x01900000 0x00 0x100000>; /* GICR */ + <0x00 0x01900000 0x00 0x100000>, /* GICR */ + <0x00 0x6f000000 0x00 0x2000>, /* GICC */ + <0x00 0x6f010000 0x00 0x1000>, /* GICH */ + <0x00 0x6f020000 0x00 0x2000>; /* GICV */ /* vcpumntirq: virtual CPU interface maintenance interrupt */ interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH>;
arch/arm64/boot/dts/ti/k3-j7200.dtsi +1 -0
@@ -129,6 +129,7 @@ <0x00 0x00a40000 0x00 0x00a40000 0x00 0x00000800>, /* timesync router */ <0x00 0x01000000 0x00 0x01000000 0x00 0x0d000000>, /* Most peripherals */ <0x00 0x30000000 0x00 0x30000000 0x00 0x0c400000>, /* MAIN NAVSS */ + <0x00 0x6f000000 0x00 0x6f000000 0x00 0x00310000>, /* A72 PERIPHBASE */ <0x00 0x70000000 0x00 0x70000000 0x00 0x00800000>, /* MSMC RAM */ <0x00 0x18000000 0x00 0x18000000 0x00 0x08000000>, /* PCIe1 DAT0 */ <0x41 0x00000000 0x41 0x00000000 0x01 0x00000000>, /* PCIe1 DAT1 */
Greg Kroah-Hartman
maintainerPATCH 170/1126 media: venus: hfi_cmds: List HDR10 property as unsupported for v1 and v3
In reply to Greg Kroah-HartmanFrom: Stanimir Varbanov <[email protected]>
commit 22beb839f48d841ec75974872863dc253d37c21c upstream.
The HFI_PROPERTY_PARAM_VENC_HDR10_PQ_SEI HFI property is not supported on Venus v1 and v3.
--- drivers/media/platform/qcom/venus/hfi_cmds.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/platform/qcom/venus/hfi_cmds.c +2 -0
@@ -1054,6 +1054,8 @@ static int pkt_session_set_property_1x(s pkt->shdr.hdr.size +=sizeof (u32) +sizeof (*info);break ; } +case HFI_PROPERTY_PARAM_VENC_HDR10_PQ_SEI : +return -ENOTSUPP ;/* FOLLOWING PROPERTIES ARE NOT IMPLEMENTED IN CORE YET */ case HFI_PROPERTY_CONFIG_BUFFER_REQUIREMENTS :
Greg Kroah-Hartman
maintainerPATCH 58/1126 NFSD: prevent integer overflow on 32 bit systems
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
commit 23a9dbbe0faf124fc4c139615633b9d12a3a89ef upstream.
On a 32 bit system, the "len * sizeof(*p)" operation can have an integer overflow.
--- include/linux/sunrpc/xdr.h | 2 ++ 1 file changed, 2 insertions(+)
include/linux/sunrpc/xdr.h +2 -0
@@ -731,6 +731,8 @@ xdr_stream_decode_uint32_array(struct xdif (unlikely (xdr_stream_decode_u32 (xdr, &len) <0 ))return -EBADMSG ; +if (len >SIZE_MAX /sizeof (*p)) +return -EBADMSG ; p =xdr_inline_decode (xdr, len *sizeof (*p));if (unlikely (!p))return -EBADMSG ;
Greg Kroah-Hartman
maintainerPATCH 186/1126 drm/fb-helper: Mark screen buffers in system memory with FBINFO_VIRTFB
In reply to Greg Kroah-HartmanFrom: Thomas Zimmermann <[email protected]>
commit cd9f7f7ac5932129fe81b4c7559cfcb226ec7c5c upstream.
Mark screen buffers in system memory with FBINFO_VIRTFB. Otherwise, fbdev deferred I/O marks mmap'ed areas of system memory with VM_IO. (There's an inverse relationship between the two flags.)
For shadow buffers, also set the FBINFO_READS_FAST hint.
v3:
* change FB_ to FBINFO_ in commit description
v2:
* updated commit description (Daniel)
* added Fixes tag
--- drivers/gpu/drm/drm_fb_helper.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_fb_helper.c +6 -3
@@ -2346,6 +2346,7 @@ static int drm_fb_helper_generic_probe(s fbi->fbops = &drm_fbdev_fb_ops; fbi->screen_size = sizes->surface_height * fb->pitches[0 ]; fbi->fix.smem_len = fbi->screen_size; + fbi->flags =FBINFO_DEFAULT ;drm_fb_helper_fill_info (fbi, fb_helper, sizes);
@@ -2353,19 +2354,21 @@ static int drm_fb_helper_generic_probe(s fbi->screen_buffer =vzalloc (fbi->screen_size);if (!fbi->screen_buffer)return -ENOMEM ; + fbi->flags |=FBINFO_VIRTFB |FBINFO_READS_FAST ; fbi->fbdefio = &drm_fbdev_defio; -fb_deferred_io_init (fbi); }else {/* buffer is mapped for HW framebuffer */ ret =drm_client_buffer_vmap (fb_helper->buffer, &map);if (ret)return ret; -if (map.is_iomem) +if (map.is_iomem) { fbi->screen_base = map.vaddr_iomem; -else + }else { fbi->screen_buffer = map.vaddr; + fbi->flags |=FBINFO_VIRTFB ; + }/* * Shamelessly leak the physical address to user-space. As
Greg Kroah-Hartman
maintainerPATCH 57/1126 NFSD: prevent underflow in nfssvc_decode_writeargs()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
commit 184416d4b98509fb4c3d8fc3d6dc1437896cc159 upstream.
Smatch complains:
fs/nfsd/nfsxdr.c:341 nfssvc_decode_writeargs() warn: no lower bound on 'args->len'
Change the type to unsigned to prevent this issue.
--- fs/nfsd/nfsproc.c | 2 +- fs/nfsd/xdr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/nfsd/nfsproc.c +1 -1
@@ -230,7 +230,7 @@ nfsd_proc_write(struct svc_rqst *rqstp)unsigned long cnt = argp->len;unsigned int nvecs; -dprintk ("nfsd: WRITE %s %d bytes at %d\n" , +dprintk ("nfsd: WRITE %s %u bytes at %d\n" ,SVCFH_fmt (&argp->fh), argp->len, argp->offset);
fs/nfsd/xdr.h +1 -1
@@ -32,7 +32,7 @@ struct nfsd_readargs {struct nfsd_writeargs {svc_fh fh;__u32 offset; -int len; +__u32 len;struct xdr_buf payload; };
Greg Kroah-Hartman
maintainerPATCH 59/1126 f2fs: fix to unlock page correctly in error path of is_alive()
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
commit 6d18762ed5cd549fde74fd0e05d4d87bac5a3beb upstream.
As Pavel Machek reported in below link [1]:
After commit 77900c45ee5c ("f2fs: fix to do sanity check in is_alive()"), node page should be unlock via calling f2fs_put_page() in the error path of is_alive(), otherwise, f2fs may hang when it tries to lock the node page, fix it.
[1] https://lore.kernel.org/stable/[email protected]/
--- fs/f2fs/gc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/f2fs/gc.c +3 -1
@@ -1038,8 +1038,10 @@ static bool is_alive(struct f2fs_sb_infoset_sbi_flag (sbi,SBI_NEED_FSCK ); } -if (f2fs_check_nid_range (sbi, dni->ino)) +if (f2fs_check_nid_range (sbi, dni->ino)) { +f2fs_put_page (node_page,1 );return false; + } *nofs =ofs_of_node (node_page); source_blkaddr =data_blkaddr (NULL , node_page, ofs_in_node);
Greg Kroah-Hartman
maintainerPATCH 90/1126 RISC-V: Declare per cpu boot data as static
In reply to Greg Kroah-HartmanFrom: Atish Patra <[email protected]>
commit f1de125766d6f377a4b5d5821bc12928f929a4eb upstream.
The per cpu boot data is only used within the cpu_ops_sbi.c. It can be delcared as static.
--- arch/riscv/kernel/cpu_ops_sbi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/kernel/cpu_ops_sbi.c +1 -1
@@ -21,7 +21,7 @@ const struct cpu_operations cpu_ops_sbi;* be invoked from multiple threads in parallel. Define a per cpu data * to handle that. */ -DEFINE_PER_CPU(struct sbi_hart_boot_data, boot_data); +static DEFINE_PER_CPU(struct sbi_hart_boot_data, boot_data);static int sbi_hsm_hart_start (unsigned long hartid,unsigned long saddr,unsigned long priv)
Greg Kroah-Hartman
maintainerPATCH 105/1126 mm: madvise: skip unmapped vma holes passed to process_madvise
In reply to Greg Kroah-HartmanFrom: Charan Teja Kalla <[email protected]>
commit 08095d6310a7ce43256b4251577bc66a25c6e1a6 upstream.
The process_madvise() system call is expected to skip holes in vma passed through 'struct iovec' vector list. But do_madvise, which process_madvise() calls for each vma, returns ENOMEM in case of unmapped holes, despite the VMA is processed.
Thus process_madvise() should treat ENOMEM as expected and consider the VMA passed to as processed and continue processing other vma's in the vector list. Returning -ENOMEM to user, despite the VMA is processed, will be unable to figure out where to start the next madvise.
--- mm/madvise.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
mm/madvise.c +8 -1
@@ -1426,9 +1426,16 @@ SYSCALL_DEFINE5(process_madvise, int, piwhile (iov_iter_count (&iter)) { iovec =iov_iter_iovec (&iter); +/* +* do_madvise returns ENOMEM if unmapped holes are present +* in the passed VMA. process_madvise() is expected to skip +* unmapped holes passed to it in the 'struct iovec' list +* and not fail because of them. Thus treat -ENOMEM return +* from do_madvise as valid and continue processing. +*/ ret =do_madvise (mm, (unsigned long )iovec.iov_base, iovec.iov_len, behavior); -if (ret <0 ) +if (ret <0 && ret != -ENOMEM )break ;iov_iter_advance (&iter, iovec.iov_len); }
Greg Kroah-Hartman
maintainerPATCH 54/1126 SUNRPC: avoid race between mod_timer() and del_timer_sync()
In reply to Greg Kroah-HartmanFrom: NeilBrown <[email protected]>
commit 3848e96edf4788f772d83990022fa7023a233d83 upstream.
xprt_destory() claims XPRT_LOCKED and then calls del_timer_sync(). Both xprt_unlock_connect() and xprt_release() call
->release_xprt()
which drops XPRT_LOCKED and *then* xprt_schedule_autodisconnect() which calls mod_timer().
This may result in mod_timer() being called *after* del_timer_sync(). When this happens, the timer may fire long after the xprt has been freed, and run_timer_softirq() will probably crash.
The pairing of ->release_xprt() and xprt_schedule_autodisconnect() is always called under ->transport_lock. So if we take ->transport_lock to call del_timer_sync(), we can be sure that mod_timer() will run first (if it runs at all).
--- net/sunrpc/xprt.c | 7 +++++++ 1 file changed, 7 insertions(+)
net/sunrpc/xprt.c +7 -0
@@ -2112,7 +2112,14 @@ static void xprt_destroy(struct rpc_xprt*/ wait_on_bit_lock (&xprt->state,XPRT_LOCKED ,TASK_UNINTERRUPTIBLE ); +/* +* xprt_schedule_autodisconnect() can run after XPRT_LOCKED +* is cleared. We use ->transport_lock to ensure the mod_timer() +* can only run *before* del_time_sync(), never after. +*/ +spin_lock (&xprt->transport_lock);del_timer_sync (&xprt->timer); +spin_unlock (&xprt->transport_lock);/* * Destroy sockets etc from the system workqueue so they can
Greg Kroah-Hartman
maintainerPATCH 88/1126 riscv: Fix fill_callchain return value
In reply to Greg Kroah-HartmanFrom: Nikita Shubin <[email protected]>
commit 2b2b574ac587ec5bd7716a356492a85ab8b0ce9f upstream.
perf_callchain_store return 0 on success, -1 otherwise, fix fill_callchain to return correct bool value.
--- arch/riscv/kernel/perf_callchain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/kernel/perf_callchain.c +1 -1
@@ -68,7 +68,7 @@ void perf_callchain_user(struct perf_calstatic bool fill_callchain (void *entry,unsigned long pc) { -return perf_callchain_store (entry, pc); +return perf_callchain_store (entry, pc) ==0 ; } void perf_callchain_kernel(struct perf_callchain_entry_ctx *entry,
Greg Kroah-Hartman
maintainerPATCH 148/1126 rfkill: make new event layout opt-in
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
commit 54f586a9153201c6cff55e1f561990c78bd99aa7 upstream.
Again new complaints surfaced that we had broken the ABI here, although previously all the userspace tools had agreed that it was their mistake and fixed it. Yet now there are cases (e.g. RHEL) that want to run old userspace with newer kernels, and thus are broken.
Since this is a bit of a whack-a-mole thing, change the whole extensibility scheme of rfkill to no longer just rely on the message lengths, but instead require userspace to opt in via a new ioctl to a given maximum event size that it is willing to understand.
By default, set that to RFKILL_EVENT_SIZE_V1 (8), so that the behaviour for userspace not calling the ioctl will look as if it's just running on an older kernel.
--- include/uapi/linux/rfkill.h | 14 +++++++++++- net/rfkill/core.c | 48 +++++++++++++++++++++++++++++++------------- 2 files changed, 46 insertions(+), 16 deletions(-)
include/uapi/linux/rfkill.h +12 -2
@@ -159,8 +159,16 @@ struct rfkill_event_ext {* old behaviour for all userspace, unless it explicitly opts in to the * rules outlined here by using the new &struct rfkill_event_ext. * -* Userspace using &struct rfkill_event_ext must adhere to the following -* rules +* Additionally, some other userspace (bluez, g-s-d) was reading with a +* large size but as streaming reads rather than message-based, or with +* too strict checks for the returned size. So eventually, we completely +* reverted this, and extended messages need to be opted in to by using +* an ioctl: +* +* ioctl(fd, RFKILL_IOCTL_MAX_SIZE, sizeof(struct rfkill_event_ext)); +* +* Userspace using &struct rfkill_event_ext and the ioctl must adhere to +* the following rules: * * 1. accept short writes, optionally using them to detect that it's * running on an older kernel;
@@ -175,6 +183,8 @@ struct rfkill_event_ext {#define RFKILL_IOC_MAGIC 'R'#define RFKILL_IOC_NOINPUT 1#define RFKILL_IOCTL_NOINPUT _IO(RFKILL_IOC_MAGIC, RFKILL_IOC_NOINPUT) +#define RFKILL_IOC_MAX_SIZE 2 +#define RFKILL_IOCTL_MAX_SIZE _IOW(RFKILL_IOC_MAGIC, RFKILL_IOC_EXT_SIZE, __u32)/* and that's all userspace gets */
net/rfkill/core.c +34 -14
105 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 113/1126 dm: interlock pending dm_io and dm_wait_for_bios_completion
In reply to Greg Kroah-HartmanFrom: Mike Snitzer <[email protected]>
commit 9f6dc633761006f974701d4c88da71ab68670749 upstream.
Commit d208b89401e0 ("dm: fix mempool NULL pointer race when completing IO") didn't go far enough.
When bio_end_io_acct ends the count of in-flight I/Os may reach zero and the DM device may be suspended. There is a possibility that the suspend races with dm_stats_account_io.
Fix this by adding percpu "pending_io" counters to track outstanding dm_io. Move kicking of suspend queue to dm_io_dec_pending(). Also, rename md_in_flight_bios() to dm_in_flight_bios() and update it to iterate all pending_io counters.
--- drivers/md/dm-core.h | 2 ++ drivers/md/dm.c | 35 +++++++++++++++++++++++------------ 2 files changed, 25 insertions(+), 12 deletions(-)
drivers/md/dm-core.h +2 -0
@@ -65,6 +65,8 @@ struct mapped_device {struct gendisk *disk;struct dax_device *dax_dev; +unsigned long __percpu *pending_io; +/* * A list of ios that arrived while we were suspended. */
drivers/md/dm.c +23 -12
@@ -507,10 +507,6 @@ static void end_io_acct(struct mapped_dedm_stats_account_io (&md->stats,bio_data_dir (bio), bio->bi_iter.bi_sector,bio_sectors (bio), true, duration, stats_aux); - -/* nudge anyone waiting on suspend queue */ -if (unlikely (wq_has_sleeper (&md->wait))) -wake_up (&md->wait); }static struct dm_io *alloc_io (struct mapped_device *md,struct bio *bio)
@@ -531,6 +527,7 @@ static struct dm_io *alloc_io(struct map io->magic =DM_IO_MAGIC ; io->status =0 ;atomic_set (&io->io_count,1 ); +this_cpu_inc (*md->pending_io); io->orig_bio = bio; io->md = md;spin_lock_init (&io->endio_lock);
@@ -828,6 +825,12 @@ void dm_io_dec_pending(struct dm_io *io, stats_aux = io->stats_aux;free_io (md, io);end_io_acct (md, bio, start_time, &stats_aux); +smp_wmb (); +this_cpu_dec (*md->pending_io); + +/* nudge anyone waiting on suspend queue */ +if (unlikely (wq_has_sleeper (&md->wait))) +wake_up (&md->wait);if (io_error ==BLK_STS_DM_REQUEUE )return ;
@@ -1622,6 +1625,11 @@ static void cleanup_mapped_device(structblk_cleanup_disk (md->disk); } +if (md->pending_io) { +free_percpu (md->pending_io); + md->pending_io =NULL ; + } +cleanup_srcu_struct (&md->io_barrier);mutex_destroy (&md->suspend_lock);
@@ -1723,6 +1731,10 @@ static struct mapped_device *alloc_dev(iif (!md->wq) goto bad; + md->pending_io = alloc_percpu(unsigned long); +if (!md->pending_io) + goto bad; +dm_stats_init (&md->stats);/* Populate the mapping, nobody knows we exist yet */
@@ -2130,16 +2142,13 @@ void dm_put(struct mapped_device *md) }EXPORT_SYMBOL_GPL (dm_put); -static bool md_in_flight_bios (struct mapped_device *md) +static bool dm_in_flight_bios (struct mapped_device *md) {int cpu; -struct block_device *part =dm_disk (md)->part0; -long sum =0 ; +unsigned long sum =0 ; -for_each_possible_cpu (cpu) { - sum +=part_stat_local_read_cpu (part, in_flight[0 ], cpu); - sum +=part_stat_local_read_cpu (part, in_flight[1 ], cpu); - } +for_each_possible_cpu (cpu) + sum += *per_cpu_ptr (md->pending_io, cpu);return sum !=0 ; }
@@ -2152,7 +2161,7 @@ static int dm_wait_for_bios_completion(swhile (true) {prepare_to_wait (&md->wait, &wait, task_state); -if (!md_in_flight_bios (md)) +if (!dm_in_flight_bios (md))break ;if (signal_pending_state (task_state, current)) {
@@ -2164,6 +2173,8 @@ static int dm_wait_for_bios_completion(s }finish_wait (&md->wait, &wait); +smp_rmb (); +return r; }
Greg Kroah-Hartman
maintainerPATCH 120/1126 arm64: signal: nofpsimd: Do not allocate fp/simd context when not available
In reply to Greg Kroah-HartmanFrom: David Engraf <[email protected]>
commit 0a32c88ddb9af30e8a16d41d7b9b824c27d29459 upstream.
Commit 6d502b6ba1b2 ("arm64: signal: nofpsimd: Handle fp/simd context for signal frames") introduced saving the fp/simd context for signal handling only when support is available. But setup_sigframe_layout() always reserves memory for fp/simd context. The additional memory is not touched because preserve_fpsimd_context() is not called and thus the magic is invalid.
This may lead to an error when parse_user_sigframe() checks the fp/simd area and does not find a valid magic number.
--- arch/arm64/kernel/signal.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
arch/arm64/kernel/signal.c +6 -4
@@ -577,10 +577,12 @@ static int setup_sigframe_layout(struct {int err; - err =sigframe_alloc (user, &user->fpsimd_offset, -sizeof (struct fpsimd_context )); -if (err) -return err; +if (system_supports_fpsimd ()) { + err =sigframe_alloc (user, &user->fpsimd_offset, +sizeof (struct fpsimd_context )); +if (err) +return err; + }/* fault information, if valid */ if (add_all || current->thread.fault_code) {
Greg Kroah-Hartman
maintainerPATCH 116/1126 tracing: Have trace event string test handle zero length strings
In reply to Greg Kroah-HartmanFrom: Steven Rostedt (Google) <[email protected]>
commit eca344a7362e0f34f179298fd8366bcd556eede1 upstream.
If a trace event has in its TP_printk():
"%*.s", len, len ? __get_str(string) : NULL
It is perfectly valid if len is zero and passing in the NULL. Unfortunately, the runtime string check at time of reading the trace sees the NULL and flags it as a bad string and produces a WARN_ON().
Handle this case by passing into the test function if the format has an asterisk (star) and if so, if the length is zero, then mark it as safe.
--- kernel/trace/trace.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
kernel/trace/trace.c +7 -2
@@ -3663,12 +3663,17 @@ static char *trace_iter_expand_format(st }/* Returns true if the string is safe to dereference from an event */ -static bool trace_safe_str (struct trace_iterator *iter,const char *str) +static bool trace_safe_str (struct trace_iterator *iter,const char *str, +bool star,int len) {unsigned long addr = (unsigned long )str;struct trace_event *trace_event;struct trace_event_call *event; +/* Ignore strings with no length */ +if (star && !len) +return true; +/* OK if part of the event data */ if ((addr >= (unsigned long )iter->ent) && (addr < (unsigned long )iter->ent + iter->ent_size))
@@ -3854,7 +3859,7 @@ void trace_check_vprintf(struct trace_it* instead. See samples/trace_events/trace-events-sample.h * for reference. */ -if (WARN_ONCE (!trace_safe_str (iter, str), +if (WARN_ONCE (!trace_safe_str (iter, str, star, len),"fmt: '%s' current_buffer: '%s'" , fmt,show_buffer (&iter->seq))) {int ret;
Greg Kroah-Hartman
maintainerPATCH 172/1126 media: davinci: vpif: fix unbalanced runtime PM get
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 4a321de239213300a714fa0353a5f1272d381a44 upstream.
Make sure to balance the runtime PM usage counter on driver unbind.
--- drivers/media/platform/davinci/vpif.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/platform/davinci/vpif.c +1 -0
@@ -495,6 +495,7 @@ static int vpif_probe(struct platform_destatic int vpif_remove (struct platform_device *pdev) { +pm_runtime_put (&pdev->dev);pm_runtime_disable (&pdev->dev);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 147/1126 video: fbdev: atari: Atari 2 bpp (STe) palette bugfix
In reply to Greg Kroah-HartmanFrom: Michael Schmitz <[email protected]>
commit c8be5edbd36ceed2ff3d6b8f8e40643c3f396ea3 upstream.
The code to set the shifter STe palette registers has a long standing operator precedence bug, manifesting as colors set on a 2 bits per pixel frame buffer coming up with a distinctive blue tint.
Add parentheses around the calculation of the per-color palette data before shifting those into their respective bit field position.
This bug goes back a long way (2.4 days at the very least) so there won't be a Fixes: tag.
Tested on ARAnyM as well on Falcon030 hardware.
--- drivers/video/fbdev/atafb.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/video/fbdev/atafb.c +6 -6
@@ -1683,9 +1683,9 @@ static int falcon_setcolreg(unsigned int ((blue & 0xfc00) >> 8));if (regno <16 ) { shifter_tt.color_reg[regno] = - (((red &0xe000 ) >>13 ) | ((red &0x1000 ) >>12 ) <<8 ) | - (((green &0xe000 ) >>13 ) | ((green &0x1000 ) >>12 ) <<4 ) | - ((blue &0xe000 ) >>13 ) | ((blue &0x1000 ) >>12 ); + ((((red &0xe000 ) >>13 ) | ((red &0x1000 ) >>12 )) <<8 ) | + ((((green &0xe000 ) >>13 ) | ((green &0x1000 ) >>12 )) <<4 ) | + ((blue &0xe000 ) >>13 ) | ((blue &0x1000 ) >>12 ); ((u32 *)info->pseudo_palette)[regno] = ((red &0xf800 ) | ((green &0xfc00 ) >>5 ) | ((blue &0xf800 ) >>11 ));
@@ -1971,9 +1971,9 @@ static int stste_setcolreg(unsigned int green >>=12 ;if (ATARIHW_PRESENT (EXTD_SHIFTER )) shifter_tt.color_reg[regno] = - (((red &0xe ) >>1 ) | ((red &1 ) <<3 ) <<8 ) | - (((green &0xe ) >>1 ) | ((green &1 ) <<3 ) <<4 ) | - ((blue &0xe ) >>1 ) | ((blue &1 ) <<3 ); + ((((red &0xe ) >>1 ) | ((red &1 ) <<3 )) <<8 ) | + ((((green &0xe ) >>1 ) | ((green &1 ) <<3 )) <<4 ) | + ((blue &0xe ) >>1 ) | ((blue &1 ) <<3 );else shifter_tt.color_reg[regno] = ((red & 0xe) << 7) |
Greg Kroah-Hartman
maintainerPATCH 95/1126 cifs: fix NULL ptr dereference in smb2_ioctl_query_info()
In reply to Greg Kroah-HartmanFrom: Paulo Alcantara <[email protected]>
commit d6f5e358452479fa8a773b5c6ccc9e4ec5a20880 upstream.
When calling smb2_ioctl_query_info() with invalid smb_query_info::flags, a NULL ptr dereference is triggered when trying to kfree() uninitialised rqst[n].rq_iov array.
This also fixes leaked paths that are created in SMB2_open_init() which required SMB2_open_free() to properly free them.
Here is a small C reproducer that triggers it
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#define die(s) perror(s), exit(1)
#define QUERY_INFO 0xc018cf07
int main(int argc, char *argv[])
{
int fd;
if (argc < 2)
exit(1);
fd = open(argv[1], O_RDONLY);
if (fd == -1)
die("open");
if (ioctl(fd, QUERY_INFO, (uint32_t[]) { 0, 0, 0, 4, 0, 0}) == -1)
die("ioctl");
close(fd);
return 0;
}
mount.cifs //srv/share /mnt -o ...
gcc repro.c && ./a.out /mnt/f0
[ 1832.124468] CIFS: VFS: \\w22-dc.zelda.test\test Invalid passthru query flags: 0x4
[ 1832.125043] general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN NOPTI
[ 1832.125764] KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
[ 1832.126241] CPU: 3 PID: 1133 Comm: a.out Not tainted 5.17.0-rc8 #2
[ 1832.126630] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.15.0-0-g2dd4b9b-rebuilt.opensuse.org 04/01/2014
[ 1832.127322] RIP: 0010:smb2_ioctl_query_info+0x7a3/0xe30 [cifs]
[ 1832.127749] Code: 00 00 00 fc ff df 48 c1 ea 03 80 3c 02 00 0f 85 6c 05 00 00 48 b8 00 00 00 00 00 fc ff df 4d 8b 74 24 28 4c 89 f2 48 c1 ea 03 <80> 3c 02 00 0f 85 cb 04 00 00 49 8b 3e e8 bb fc fa ff 48 89 da 48
[ 1832.128911] RSP: 0018:ffffc90000957b08 EFLAGS: 00010256
[ 1832.129243] RAX: dffffc0000000000 RBX: ffff888117e9b850 RCX: ffffffffa020580d
[ 1832.129691] RDX: 0000000000000000 RSI: 0000000000000004 RDI: ffffffffa043a2c0
[ 1832.130137] RBP: ffff888117e9b878 R08: 0000000000000001 R09: 0000000000000003
[ 1832.130585] R10: fffffbfff4087458 R11: 0000000000000001 R12: ffff888117e9b800
[ 1832.131037] R13: 00000000ffffffea R14: 0000000000000000 R15: ffff888117e9b8a8
[ 1832.131485] FS: 00007fcee9900740(0000) GS:ffff888151a00000(0000) knlGS:0000000000000000
[ 1832.131993] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1832.132354] CR2: 00007fcee9a1ef5e CR3: 0000000114cd2000 CR4: 0000000000350ee0
[ 1832.132801] Call Trace:
[ 1832.132962] <TASK>
[ 1832.133104] ? smb2_query_reparse_tag+0x890/0x890 [cifs]
[ 1832.133489] ? cifs_mapchar+0x460/0x460 [cifs]
[ 1832.133822] ? rcu_read_lock_sched_held+0x3f/0x70
[ 1832.134125] ? cifs_strndup_to_utf16+0x15b/0x250 [cifs]
[ 1832.134502] ? lock_downgrade+0x6f0/0x6f0
[ 1832.134760] ? cifs_convert_path_to_utf16+0x198/0x220 [cifs]
[ 1832.135170] ? smb2_check_message+0x1080/0x1080 [cifs]
[ 1832.135545] cifs_ioctl+0x1577/0x3320 [cifs]
[ 1832.135864] ? lock_downgrade+0x6f0/0x6f0
[ 1832.136125] ? cifs_readdir+0x2e60/0x2e60 [cifs]
[ 1832.136468] ? rcu_read_lock_sched_held+0x3f/0x70
[ 1832.136769] ? __rseq_handle_notify_resume+0x80b/0xbe0
[ 1832.137096] ? __up_read+0x192/0x710
[ 1832.137327] ? __ia32_sys_rseq+0xf0/0xf0
[ 1832.137578] ? __x64_sys_openat+0x11f/0x1d0
[ 1832.137850] __x64_sys_ioctl+0x127/0x190
[ 1832.138103] do_syscall_64+0x3b/0x90
[ 1832.138378] entry_SYSCALL_64_after_hwframe+0x44/0xae
[ 1832.138702] RIP: 0033:0x7fcee9a253df
[ 1832.138937] Code: 00 48 89 44 24 18 31 c0 48 8d 44 24 60 c7 04 24 10 00 00 00 48 89 44 24 08 48 8d 44 24 20 48 89 44 24 10 b8 10 00 00 00 0f 05 <41> 89 c0 3d 00 f0 ff ff 77 1f 48 8b 44 24 18 64 48 2b 04 25 28 00
[ 1832.140107] RSP: 002b:00007ffeba94a8a0 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
[ 1832.140606] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fcee9a253df
[ 1832.141058] RDX: 00007ffeba94a910 RSI: 00000000c018cf07 RDI: 0000000000000003
[ 1832.141503] RBP: 00007ffeba94a930 R08: 00007fcee9b24db0 R09: 00007fcee9b45c4e
[ 1832.141948] R10: 00007fcee9918d40 R11: 0000000000000246 R12: 00007ffeba94aa48
[ 1832.142396] R13: 0000000000401176 R14: 0000000000403df8 R15: 00007fcee9b78000
[ 1832.142851] </TASK>
[ 1832.142994] Modules linked in: cifs cifs_arc4 cifs_md4 bpf_preload [last unloaded: cifs]--- fs/cifs/smb2ops.c | 124 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 65 insertions(+), 59 deletions(-)
fs/cifs/smb2ops.c +65 -59
@@ -1643,6 +1643,7 @@ smb2_ioctl_query_info(const unsigned intunsigned int size[2 ];void *data[2 ];int create_options = is_dir ?CREATE_NOT_FILE :CREATE_NOT_DIR ; +void (*free_req1_func)(struct smb_rqst *r); vars =kzalloc (sizeof (*vars),GFP_ATOMIC );if (vars ==NULL )
@@ -1652,17 +1653,18 @@ smb2_ioctl_query_info(const unsigned int resp_buftype[0 ] = resp_buftype[1 ] = resp_buftype[2 ] =CIFS_NO_BUFFER ; -if (copy_from_user (&qi, arg,sizeof (struct smb_query_info ))) - goto e_fault; - +if (copy_from_user (&qi, arg,sizeof (struct smb_query_info ))) { + rc = -EFAULT ; + goto free_vars; + }if (qi.output_buffer_length >1024 ) { -kfree (vars); -return -EINVAL ; + rc = -EINVAL ; + goto free_vars; }if (!ses || !server) { -kfree (vars); -return -EIO ; + rc = -EIO ; + goto free_vars; }if (smb3_encryption_required (tcon))
@@ -1671,8 +1673,8 @@ smb2_ioctl_query_info(const unsigned intif (qi.output_buffer_length) { buffer =memdup_user (arg +sizeof (struct smb_query_info ), qi.output_buffer_length);if (IS_ERR (buffer)) { -kfree (vars); -return PTR_ERR (buffer); + rc =PTR_ERR (buffer); + goto free_vars; } }
@@ -1711,48 +1713,45 @@ smb2_ioctl_query_info(const unsigned int rc =SMB2_open_init (tcon, server, &rqst[0 ], &oplock, &oparms, path);if (rc) - goto iqinf_exit; + goto free_output_buffer;smb2_set_next_command (tcon, &rqst[0 ]);/* Query */ if (qi.flags &PASSTHRU_FSCTL ) {/* Can eventually relax perm check since server enforces too */ -if (!capable (CAP_SYS_ADMIN )) +if (!capable (CAP_SYS_ADMIN )) { rc = -EPERM ; -else { - rqst[1 ].rq_iov = &vars->io_iov[0 ]; - rqst[1 ].rq_nvec =SMB2_IOCTL_IOV_SIZE ; - - rc =SMB2_ioctl_init (tcon, server, - &rqst[1 ], -COMPOUND_FID ,COMPOUND_FID , - qi.info_type, true, buffer, - qi.output_buffer_length, - CIFSMaxBufSize - -MAX_SMB2_CREATE_RESPONSE_SIZE - -MAX_SMB2_CLOSE_RESPONSE_SIZE ); + goto free_open_req; } + rqst[1 ].rq_iov = &vars->io_iov[0 ]; + rqst[1 ].rq_nvec =SMB2_IOCTL_IOV_SIZE ; + + rc =SMB2_ioctl_init (tcon, server, &rqst[1 ],COMPOUND_FID ,COMPOUND_FID , + qi.info_type, true, buffer, qi.output_buffer_length, + CIFSMaxBufSize -MAX_SMB2_CREATE_RESPONSE_SIZE - +MAX_SMB2_CLOSE_RESPONSE_SIZE ); + free_req1_func = SMB2_ioctl_free; }else if (qi.flags ==PASSTHRU_SET_INFO ) {/* Can eventually relax perm check since server enforces too */ -if (!capable (CAP_SYS_ADMIN )) +if (!capable (CAP_SYS_ADMIN )) { rc = -EPERM ; -else if (qi.output_buffer_length <8 ) + goto free_open_req; + } +if (qi.output_buffer_length <8 ) { rc = -EINVAL ; -else { - rqst[1 ].rq_iov = &vars->si_iov[0 ]; - rqst[1 ].rq_nvec =1 ; - -/* MS-FSCC 2.4.13 FileEndOfFileInformation */ - size[0 ] =8 ; - data[0 ] = buffer; - - rc =SMB2_set_info_init (tcon, server, - &rqst[1 ], -COMPOUND_FID ,COMPOUND_FID , - current->tgid, -FILE_END_OF_FILE_INFORMATION , -SMB2_O_INFO_FILE ,0 , data, size); + goto free_open_req; } + rqst[1 ].rq_iov = &vars->si_iov[0 ]; + rqst[1 ].rq_nvec =1 ; + +/* MS-FSCC 2.4.13 FileEndOfFileInformation */ + size[0 ] =8 ; + data[0 ] = buffer; + + rc =SMB2_set_info_init (tcon, server, &rqst[1 ],COMPOUND_FID ,COMPOUND_FID , + current->tgid,FILE_END_OF_FILE_INFORMATION , +SMB2_O_INFO_FILE ,0 , data, size); + free_req1_func = SMB2_set_info_free; }else if (qi.flags ==PASSTHRU_QUERY_INFO ) { rqst[1 ].rq_iov = &vars->qi_iov[0 ]; rqst[1 ].rq_nvec =1 ;
@@ -1763,6 +1762,7 @@ smb2_ioctl_query_info(const unsigned int qi.info_type, qi.additional_information, qi.input_buffer_length, qi.output_buffer_length, buffer); + free_req1_func = SMB2_query_info_free; }else {/* unknown flags */ cifs_tcon_dbg (VFS ,"Invalid passthru query flags: 0x%x\n" , qi.flags);
@@ -1770,7 +1770,7 @@ smb2_ioctl_query_info(const unsigned int }if (rc) - goto iqinf_exit; + goto free_open_req;smb2_set_next_command (tcon, &rqst[1 ]);smb2_set_related (&rqst[1 ]);
@@ -1781,14 +1781,14 @@ smb2_ioctl_query_info(const unsigned int rc =SMB2_close_init (tcon, server, &rqst[2 ],COMPOUND_FID ,COMPOUND_FID , false);if (rc) - goto iqinf_exit; + goto free_req_1;smb2_set_related (&rqst[2 ]); rc =compound_send_recv (xid, ses, server, flags,3 , rqst, resp_buftype, rsp_iov);if (rc) - goto iqinf_exit; + goto out;/* No need to bump num_remote_opens since handle immediately closed */ if (qi.flags &PASSTHRU_FSCTL ) {
@@ -1798,18 +1798,22 @@ smb2_ioctl_query_info(const unsigned int qi.input_buffer_length =le32_to_cpu (io_rsp->OutputCount);if (qi.input_buffer_length >0 &&le32_to_cpu (io_rsp->OutputOffset) + qi.input_buffer_length - > rsp_iov[1 ].iov_len) - goto e_fault; + > rsp_iov[1 ].iov_len) { + rc = -EFAULT ; + goto out; + }if (copy_to_user (&pqi->input_buffer_length, &qi.input_buffer_length, -sizeof (qi.input_buffer_length))) - goto e_fault; +sizeof (qi.input_buffer_length))) { + rc = -EFAULT ; + goto out; + }if (copy_to_user ((void __user *)pqi +sizeof (struct smb_query_info ), (const void *)io_rsp +le32_to_cpu (io_rsp->OutputOffset), qi.input_buffer_length)) - goto e_fault; + rc = -EFAULT ; }else { pqi = (struct smb_query_info __user *)arg; qi_rsp = (struct smb2_query_info_rsp *)rsp_iov[1 ].iov_base;
@@ -1817,28 +1821,30 @@ smb2_ioctl_query_info(const unsigned int qi.input_buffer_length =le32_to_cpu (qi_rsp->OutputBufferLength);if (copy_to_user (&pqi->input_buffer_length, &qi.input_buffer_length, -sizeof (qi.input_buffer_length))) - goto e_fault; +sizeof (qi.input_buffer_length))) { + rc = -EFAULT ; + goto out; + }if (copy_to_user (pqi +1 , qi_rsp->Buffer, qi.input_buffer_length)) - goto e_fault; + rc = -EFAULT ; } - iqinf_exit: -cifs_small_buf_release (rqst[0 ].rq_iov[0 ].iov_base); -cifs_small_buf_release (rqst[1 ].rq_iov[0 ].iov_base); -cifs_small_buf_release (rqst[2 ].rq_iov[0 ].iov_base); +out:free_rsp_buf (resp_buftype[0 ], rsp_iov[0 ].iov_base);free_rsp_buf (resp_buftype[1 ], rsp_iov[1 ].iov_base);free_rsp_buf (resp_buftype[2 ], rsp_iov[2 ].iov_base); -kfree (vars); +SMB2_close_free (&rqst[2 ]); +free_req_1: +free_req1_func (&rqst[1 ]); +free_open_req: +SMB2_open_free (&rqst[0 ]); +free_output_buffer:kfree (buffer); +free_vars: +kfree (vars);return rc; - -e_fault: - rc = -EFAULT ; - goto iqinf_exit; } static ssize_t
Greg Kroah-Hartman
maintainerPATCH 108/1126 mm,hwpoison: unmap poisoned page before invalidation
In reply to Greg Kroah-HartmanFrom: Rik van Riel <[email protected]>
commit 3149c79f3cb0e2e3bafb7cfadacec090cbd250d3 upstream.
In some cases it appears the invalidation of a hwpoisoned page fails because the page is still mapped in another process. This can cause a program to be continuously restarted and die when it page faults on the page that was not invalidated. Avoid that problem by unmapping the hwpoisoned page when we find it.
Another issue is that sometimes we end up oopsing in finish_fault, if the code tries to do something with the now-NULL vmf->page. I did not hit this error when submitting the previous patch because there are several opportunities for alloc_set_pte to bail out before accessing vmf->page, and that apparently happened on those systems, and most of the time on other systems, too.
However, across several million systems that error does occur a handful of times a day. It can be avoided by returning VM_FAULT_NOPAGE which will cause do_read_fault to return before calling finish_fault.
--- mm/memory.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
mm/memory.c +8 -4
@@ -3893,14 +3893,18 @@ static vm_fault_t __do_fault(struct vm_freturn ret;if (unlikely (PageHWPoison (vmf->page))) { +struct page *page = vmf->page;vm_fault_t poisonret =VM_FAULT_HWPOISON ;if (ret &VM_FAULT_LOCKED ) { +if (page_mapped (page)) +unmap_mapping_pages (page_mapping (page), + page->index,1 , false);/* Retry if a clean page was removed from the cache. */ -if (invalidate_inode_page (vmf->page)) - poisonret =0 ; -unlock_page (vmf->page); +if (invalidate_inode_page (page)) + poisonret =VM_FAULT_NOPAGE ; +unlock_page (page); } -put_page (vmf->page); +put_page (page); vmf->page =NULL ;return poisonret; }
Greg Kroah-Hartman
maintainerPATCH 85/1126 qed: display VF trust config
In reply to Greg Kroah-HartmanFrom: Manish Chopra <[email protected]>
commit 4e6e6bec7440b9b76f312f28b1f4e944eebb3abc upstream.
Driver does support SR-IOV VFs trust configuration but it does not display it when queried via ip link utility.
--- drivers/net/ethernet/qlogic/qed/qed_sriov.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/qlogic/qed/qed_sriov.c +1 -0
@@ -4719,6 +4719,7 @@ static int qed_get_vf_config(struct qed_ tx_rate = vf_info->tx_rate; ivi->max_tx_rate = tx_rate ? tx_rate : link.speed; ivi->min_tx_rate =qed_iov_get_vf_min_rate (hwfn, vf_id); + ivi->trusted = vf_info->is_trusted_request;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 103/1126 ocfs2: fix crash when mount with quota enabled
In reply to Greg Kroah-HartmanFrom: Joseph Qi <[email protected]>
commit de19433423c7bedabbd4f9a25f7dbc62c5e78921 upstream.
There is a reported crash when mounting ocfs2 with quota enabled.
RIP: 0010:ocfs2_qinfo_lock_res_init+0x44/0x50 [ocfs2]
Call Trace:
ocfs2_local_read_info+0xb9/0x6f0 [ocfs2]
dquot_load_quota_sb+0x216/0x470
dquot_load_quota_inode+0x85/0x100
ocfs2_enable_quotas+0xa0/0x1c0 [ocfs2]
ocfs2_fill_super.cold+0xc8/0x1bf [ocfs2]
mount_bdev+0x185/0x1b0
legacy_get_tree+0x27/0x40
vfs_get_tree+0x25/0xb0
path_mount+0x465/0xac0
__x64_sys_mount+0x103/0x140It is caused by when initializing dqi_gqlock, the corresponding dqi_type and dqi_sb are not properly initialized.
This issue is introduced by commit 6c85c2c72819, which wants to avoid accessing uninitialized variables in error cases. So make global quota info properly initialized.
--- fs/ocfs2/quota_global.c | 23 ++++++++++++----------- fs/ocfs2/quota_local.c | 2 -- 2 files changed, 12 insertions(+), 13 deletions(-)
fs/ocfs2/quota_global.c +12 -11
@@ -337,7 +337,6 @@ void ocfs2_unlock_global_qf(struct ocfs2/* Read information header from global quota file */ int ocfs2_global_read_info (struct super_block *sb,int type) { -struct inode *gqinode =NULL ;unsigned int ino[OCFS2_MAXQUOTAS ] = {USER_QUOTA_SYSTEM_INODE ,GROUP_QUOTA_SYSTEM_INODE };struct ocfs2_global_disk_dqinfo dinfo;
@@ -346,29 +345,31 @@ int ocfs2_global_read_info(struct super_u64 pcount;int status; + oinfo->dqi_gi.dqi_sb = sb; + oinfo->dqi_gi.dqi_type = type; +ocfs2_qinfo_lock_res_init (&oinfo->dqi_gqlock, oinfo); + oinfo->dqi_gi.dqi_entry_size =sizeof (struct ocfs2_global_disk_dqblk ); + oinfo->dqi_gi.dqi_ops = &ocfs2_global_ops; + oinfo->dqi_gqi_bh =NULL ; + oinfo->dqi_gqi_count =0 ; +/* Read global header */ - gqinode =ocfs2_get_system_file_inode (OCFS2_SB (sb), ino[type], + oinfo->dqi_gqinode =ocfs2_get_system_file_inode (OCFS2_SB (sb), ino[type],OCFS2_INVALID_SLOT ); -if (!gqinode) { +if (!oinfo->dqi_gqinode) {mlog (ML_ERROR ,"failed to get global quota inode (type=%d)\n" , type); status = -EINVAL ; goto out_err; } - oinfo->dqi_gi.dqi_sb = sb; - oinfo->dqi_gi.dqi_type = type; - oinfo->dqi_gi.dqi_entry_size =sizeof (struct ocfs2_global_disk_dqblk ); - oinfo->dqi_gi.dqi_ops = &ocfs2_global_ops; - oinfo->dqi_gqi_bh =NULL ; - oinfo->dqi_gqi_count =0 ; - oinfo->dqi_gqinode = gqinode; + status =ocfs2_lock_global_qf (oinfo,0 );if (status <0 ) {mlog_errno (status); goto out_err; } - status =ocfs2_extent_map_get_blocks (gqinode,0 , &oinfo->dqi_giblk, + status =ocfs2_extent_map_get_blocks (oinfo->dqi_gqinode,0 , &oinfo->dqi_giblk, &pcount,NULL );if (status <0 ) goto out_unlock;
fs/ocfs2/quota_local.c +0 -2
@@ -702,8 +702,6 @@ static int ocfs2_local_read_info(struct info->dqi_priv = oinfo; oinfo->dqi_type = type;INIT_LIST_HEAD (&oinfo->dqi_chunk); - oinfo->dqi_gqinode =NULL ; -ocfs2_qinfo_lock_res_init (&oinfo->dqi_gqlock, oinfo); oinfo->dqi_rec =NULL ; oinfo->dqi_lqi_bh =NULL ; oinfo->dqi_libh =NULL ;
Greg Kroah-Hartman
maintainerPATCH 114/1126 dm: fix double accounting of flush with data
In reply to Greg Kroah-HartmanFrom: Mike Snitzer <[email protected]>
commit 8d394bc4adf588ca4a0650745167cb83f86c18c9 upstream.
DM handles a flush with data by first issuing an empty flush and then once it completes the REQ_PREFLUSH flag is removed and the payload is issued. The problem fixed by this commit is that both the empty flush bio and the data payload will account the full extent of the data payload.
Fix this by factoring out dm_io_acct() and having it wrap all IO accounting to set the size of bio with REQ_PREFLUSH to 0, account the IO, and then restore the original size.
--- drivers/md/dm-stats.c | 6 ++++-- drivers/md/dm-stats.h | 2 +- drivers/md/dm.c | 47 +++++++++++++++++++++++++++++++++-------------- 3 files changed, 38 insertions(+), 17 deletions(-)
drivers/md/dm-stats.c +4 -2
@@ -644,13 +644,14 @@ static void __dm_stat_bio(struct dm_statvoid dm_stats_account_io (struct dm_stats *stats,unsigned long bi_rw,sector_t bi_sector,unsigned bi_sectors,bool end, -unsigned long duration_jiffies, +unsigned long start_time,struct dm_stats_aux *stats_aux) {struct dm_stat *s;sector_t end_sector;struct dm_stats_last_position *last;bool got_precise_time; +unsigned long duration_jiffies =0 ;if (unlikely (!bi_sectors))return ;
@@ -670,7 +671,8 @@ void dm_stats_account_io(struct dm_stats ));WRITE_ONCE (last->last_sector, end_sector);WRITE_ONCE (last->last_rw, bi_rw); - } + }else + duration_jiffies = jiffies - start_time;rcu_read_lock ();
drivers/md/dm-stats.h +1 -1
@@ -31,7 +31,7 @@ int dm_stats_message(struct mapped_devicvoid dm_stats_account_io (struct dm_stats *stats,unsigned long bi_rw,sector_t bi_sector,unsigned bi_sectors,bool end, -unsigned long duration_jiffies, +unsigned long start_time,struct dm_stats_aux *aux);static inline bool dm_stats_used (struct dm_stats *st)
drivers/md/dm.c +33 -14
69 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 126/1126 arm64: dts: ti: k3-am64: Fix gic-v3 compatible regs
In reply to Greg Kroah-HartmanFrom: Nishanth Menon <[email protected]>
commit de60edf1be3d42d4a1b303b41c7c53b2f865726e upstream.
Though GIC ARE option is disabled for no GIC-v2 compatibility, Cortex-A53 is free to implement the CPU interface as long as it communicates with the GIC using the stream protocol. This requires that the SoC integration mark out the PERIPHBASE[1] as reserved area within the SoC. See longer discussion in [2] for further information.
Update the GIC register map to indicate offsets from PERIPHBASE based on [3]. Without doing this, systems like kvm will not function with gic-v2 emulation.
[1] https://developer.arm.com/documentation/ddi0500/e/system-control/aarch64-register-descriptions/configuration-base-address-register--el1
[2] https://lore.kernel.org/all/[email protected]/
[3] https://developer.arm.com/documentation/ddi0500/e/generic-interrupt-controller-cpu-interface/gic-programmers-model/memory-map
--- arch/arm64/boot/dts/ti/k3-am64-main.dtsi | 5 ++++- arch/arm64/boot/dts/ti/k3-am64.dtsi | 1 + 2 files changed, 5 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/ti/k3-am64-main.dtsi +4 -1
@@ -59,7 +59,10 @@ #interrupt-cells = <3>; interrupt-controller; reg = <0x00 0x01800000 0x00 0x10000>, /* GICD */ - <0x00 0x01840000 0x00 0xC0000>; /* GICR */ + <0x00 0x01840000 0x00 0xC0000>, /* GICR */ + <0x01 0x00000000 0x00 0x2000>, /* GICC */ + <0x01 0x00010000 0x00 0x1000>, /* GICH */ + <0x01 0x00020000 0x00 0x2000>; /* GICV */ /* * vcpumntirq: * virtual CPU interface maintenance interrupt
arch/arm64/boot/dts/ti/k3-am64.dtsi +1 -0
@@ -87,6 +87,7 @@ <0x00 0x68000000 0x00 0x68000000 0x00 0x08000000>, /* PCIe DAT0 */ <0x00 0x70000000 0x00 0x70000000 0x00 0x00200000>, /* OC SRAM */ <0x00 0x78000000 0x00 0x78000000 0x00 0x00800000>, /* Main R5FSS */ + <0x01 0x00000000 0x01 0x00000000 0x00 0x00310000>, /* A53 PERIPHBASE */ <0x06 0x00000000 0x06 0x00000000 0x01 0x00000000>, /* PCIe DAT1 */ <0x05 0x00000000 0x05 0x00000000 0x01 0x00000000>, /* FSS0 DAT3 */
Greg Kroah-Hartman
maintainerPATCH 133/1126 ext4: fix ext4_fc_stats trace point
In reply to Greg Kroah-HartmanFrom: Ritesh Harjani <[email protected]>
commit 7af1974af0a9ba8a8ed2e3e947d87dd4d9a78d27 upstream.
ftrace's __print_symbolic() requires that any enum values used in the symbol to string translation table be wrapped in a TRACE_DEFINE_ENUM so that the enum value can be decoded from the ftrace ring buffer by user space tooling.
This patch also fixes few other problems found in this trace point. e.g. dereferencing structures in TP_printk which should not be done at any cost.
Also to avoid checkpatch warnings, this patch removes those whitespaces/tab stops issues.
--- include/trace/events/ext4.h | 80 +++++++++++++++++++++++++++----------------- 1 file changed, 50 insertions(+), 30 deletions(-)
include/trace/events/ext4.h +50 -30
@@ -95,6 +95,17 @@ TRACE_DEFINE_ENUM(ES_REFERENCED_B); { FALLOC_FL_COLLAPSE_RANGE, "COLLAPSE_RANGE"}, \ { FALLOC_FL_ZERO_RANGE, "ZERO_RANGE"}) +TRACE_DEFINE_ENUM (EXT4_FC_REASON_XATTR ); +TRACE_DEFINE_ENUM (EXT4_FC_REASON_CROSS_RENAME ); +TRACE_DEFINE_ENUM (EXT4_FC_REASON_JOURNAL_FLAG_CHANGE ); +TRACE_DEFINE_ENUM (EXT4_FC_REASON_NOMEM ); +TRACE_DEFINE_ENUM (EXT4_FC_REASON_SWAP_BOOT ); +TRACE_DEFINE_ENUM (EXT4_FC_REASON_RESIZE ); +TRACE_DEFINE_ENUM (EXT4_FC_REASON_RENAME_DIR ); +TRACE_DEFINE_ENUM (EXT4_FC_REASON_FALLOC_RANGE ); +TRACE_DEFINE_ENUM (EXT4_FC_REASON_INODE_JOURNAL_DATA ); +TRACE_DEFINE_ENUM (EXT4_FC_REASON_MAX ); +#define show_fc_reason (reason) \ __print_symbolic(reason, \ { EXT4_FC_REASON_XATTR, "XATTR"}, \
@@ -2723,41 +2734,50 @@ TRACE_EVENT(ext4_fc_commit_stop,#define FC_REASON_NAME_STAT (reason) \ show_fc_reason(reason), \ - __entry->sbi->s_fc_stats.fc_ineligible_reason_count[reason] + __entry->fc_ineligible_rc[reason]TRACE_EVENT (ext4_fc_stats, - TP_PROTO(struct super_block *sb), + TP_PROTO(struct super_block *sb), + +TP_ARGS (sb), + +TP_STRUCT__entry ( + __field(dev_t, dev) + __array(unsigned int, fc_ineligible_rc, EXT4_FC_REASON_MAX) + __field(unsigned long, fc_commits) + __field(unsigned long, fc_ineligible_commits) + __field(unsigned long, fc_numblks) + ), -TP_ARGS (sb), +TP_fast_assign ( + int i; -TP_STRUCT__entry ( - __field(dev_t, dev) - __field(struct ext4_sb_info *, sbi) -__field (int, count) - ), - -TP_fast_assign ( - __entry->dev = sb->s_dev; - __entry->sbi = EXT4_SB(sb); - ), - -TP_printk ("dev %d:%d fc ineligible reasons:\n" -"%s:%d, %s:%d, %s:%d, %s:%d, %s:%d, %s:%d, %s:%d, %s:%d, %s:%d; " -"num_commits:%ld, ineligible: %ld, numblks: %ld" , -MAJOR (__entry->dev),MINOR (__entry->dev), -FC_REASON_NAME_STAT (EXT4_FC_REASON_XATTR ), -FC_REASON_NAME_STAT (EXT4_FC_REASON_CROSS_RENAME ), -FC_REASON_NAME_STAT (EXT4_FC_REASON_JOURNAL_FLAG_CHANGE ), -FC_REASON_NAME_STAT (EXT4_FC_REASON_NOMEM ), -FC_REASON_NAME_STAT (EXT4_FC_REASON_SWAP_BOOT ), -FC_REASON_NAME_STAT (EXT4_FC_REASON_RESIZE ), -FC_REASON_NAME_STAT (EXT4_FC_REASON_RENAME_DIR ), -FC_REASON_NAME_STAT (EXT4_FC_REASON_FALLOC_RANGE ), -FC_REASON_NAME_STAT (EXT4_FC_REASON_INODE_JOURNAL_DATA ), - __entry->sbi->s_fc_stats.fc_num_commits, - __entry->sbi->s_fc_stats.fc_ineligible_commits, - __entry->sbi->s_fc_stats.fc_numblks) + __entry->dev = sb->s_dev; + for (i = 0; i < EXT4_FC_REASON_MAX; i++) { + __entry->fc_ineligible_rc[i] = + EXT4_SB(sb)->s_fc_stats.fc_ineligible_reason_count[i]; + } + __entry->fc_commits = EXT4_SB(sb)->s_fc_stats.fc_num_commits; + __entry->fc_ineligible_commits = + EXT4_SB(sb)->s_fc_stats.fc_ineligible_commits; + __entry->fc_numblks = EXT4_SB(sb)->s_fc_stats.fc_numblks; + ), +TP_printk ("dev %d,%d fc ineligible reasons:\n" +"%s:%u, %s:%u, %s:%u, %s:%u, %s:%u, %s:%u, %s:%u, %s:%u, %s:%u " +"num_commits:%lu, ineligible: %lu, numblks: %lu" , +MAJOR (__entry->dev),MINOR (__entry->dev), +FC_REASON_NAME_STAT (EXT4_FC_REASON_XATTR ), +FC_REASON_NAME_STAT (EXT4_FC_REASON_CROSS_RENAME ), +FC_REASON_NAME_STAT (EXT4_FC_REASON_JOURNAL_FLAG_CHANGE ), +FC_REASON_NAME_STAT (EXT4_FC_REASON_NOMEM ), +FC_REASON_NAME_STAT (EXT4_FC_REASON_SWAP_BOOT ), +FC_REASON_NAME_STAT (EXT4_FC_REASON_RESIZE ), +FC_REASON_NAME_STAT (EXT4_FC_REASON_RENAME_DIR ), +FC_REASON_NAME_STAT (EXT4_FC_REASON_FALLOC_RANGE ), +FC_REASON_NAME_STAT (EXT4_FC_REASON_INODE_JOURNAL_DATA ), + __entry->fc_commits, __entry->fc_ineligible_commits, + __entry->fc_numblks) );#define DEFINE_TRACE_DENTRY_EVENT (__type) \
Greg Kroah-Hartman
maintainerPATCH 99/1126 ALSA: hda/realtek: Fix audio regression on Mi Notebook Pro 2020
In reply to Greg Kroah-HartmanFrom: Kai-Heng Feng <[email protected]>
commit f30741cded62f87bb4b1cc58bc627f076abcaba8 upstream.
Commit 5aec98913095 ("ALSA: hda/realtek - ALC236 headset MIC recording issue") is to solve recording issue met on AL236, by matching codec variant ALC269_TYPE_ALC257 and ALC269_TYPE_ALC256.
This match can be too broad and Mi Notebook Pro 2020 is broken by the patch.
Instead, use codec ID to be narrow down the scope, in order to make ALC256 unaffected.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=215484
--- sound/pci/hda/patch_realtek.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/pci/hda/patch_realtek.c +2 -2
@@ -3617,8 +3617,8 @@ static void alc256_shutup(struct hda_cod/* If disable 3k pulldown control for alc257, the Mic detection will not work correctly * when booting with headset plugged. So skip setting it for the codec alc257 */ -if (spec->codec_variant !=ALC269_TYPE_ALC257 && - spec->codec_variant !=ALC269_TYPE_ALC256 ) +if (codec->core.vendor_id !=0x10ec0236 && + codec->core.vendor_id !=0x10ec0257 )alc_update_coef_idx (codec,0x46 ,0 ,3 <<12 );if (!spec->no_shutup_pins)
Greg Kroah-Hartman
maintainerPATCH 139/1126 mailbox: tegra-hsp: Flush whole channel
In reply to Greg Kroah-HartmanFrom: Pekka Pessi <[email protected]>
commit 60de2d2dc284e0dd1c2c897d08625bde24ef3454 upstream.
The txdone can re-fill the mailbox. Keep polling the mailbox during the flush until all the messages have been delivered.
This fixes an issue with the Tegra Combined UART (TCU) where output can get truncated under high traffic load.
--- drivers/mailbox/tegra-hsp.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/mailbox/tegra-hsp.c +5 -0
@@ -412,6 +412,11 @@ static int tegra_hsp_mailbox_flush(struc value =tegra_hsp_channel_readl (ch,HSP_SM_SHRD_MBOX );if ((value &HSP_SM_SHRD_MBOX_FULL ) ==0 ) {mbox_chan_txdone (chan,0 ); + +/* Wait until channel is empty */ +if (chan->active_req !=NULL ) +continue ; +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 164/1126 bcache: fixup multiple threads crash
In reply to Greg Kroah-HartmanFrom: Mingzhe Zou <[email protected]>
commit 887554ab96588de2917b6c8c73e552da082e5368 upstream.
When multiple threads to check btree nodes in parallel, the main thread wait for all threads to stop or CACHE_SET_IO_DISABLE flag:
wait_event_interruptible(check_state->wait,
atomic_read(&check_state->started) == 0 ||
test_bit(CACHE_SET_IO_DISABLE, &c->flags));However, the bch_btree_node_read and bch_btree_node_read_done maybe call bch_cache_set_error, then the CACHE_SET_IO_DISABLE will be set. If the flag already set, the main thread return error. At the same time, maybe some threads still running and read NULL pointer, the kernel will crash.
This patch change the event wait condition, the main thread must wait for all threads to stop.
--- drivers/md/bcache/btree.c | 6 ++++-- drivers/md/bcache/writeback.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/md/bcache/btree.c +4 -2
@@ -2060,9 +2060,11 @@ int bch_btree_check(struct cache_set *c) } } +/* +* Must wait for all threads to stop. +*/ wait_event_interruptible (check_state->wait, -atomic_read (&check_state->started) ==0 || -test_bit (CACHE_SET_IO_DISABLE , &c->flags)); +atomic_read (&check_state->started) ==0 );for (i =0 ; i < check_state->total_threads; i++) {if (check_state->infos[i].result) {
drivers/md/bcache/writeback.c +4 -2
@@ -998,9 +998,11 @@ void bch_sectors_dirty_init(struct bcach } } +/* +* Must wait for all threads to stop. +*/ wait_event_interruptible (state->wait, -atomic_read (&state->started) ==0 || -test_bit (CACHE_SET_IO_DISABLE , &c->flags)); +atomic_read (&state->started) ==0 ); out:kfree (state);
Greg Kroah-Hartman
maintainerPATCH 173/1126 media: davinci: vpif: fix unbalanced runtime PM enable
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit d42b3ad105b5d3481f6a56bc789aa2b27aa09325 upstream.
Make sure to disable runtime PM before returning on probe errors.
--- drivers/media/platform/davinci/vpif.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/media/platform/davinci/vpif.c +9 -2
@@ -428,6 +428,7 @@ static int vpif_probe(struct platform_destatic struct resource *res_irq;struct platform_device *pdev_capture, *pdev_display;struct device_node *endpoint =NULL ; +int ret; vpif_base =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (vpif_base))
@@ -456,8 +457,8 @@ static int vpif_probe(struct platform_de res_irq =platform_get_resource (pdev,IORESOURCE_IRQ ,0 );if (!res_irq) {dev_warn (&pdev->dev,"Missing IRQ resource.\n" ); -pm_runtime_put (&pdev->dev); -return -EINVAL ; + ret = -EINVAL ; + goto err_put_rpm; } pdev_capture = devm_kzalloc(&pdev->dev, sizeof(*pdev_capture),
@@ -491,6 +492,12 @@ static int vpif_probe(struct platform_de }return 0 ; + +err_put_rpm: +pm_runtime_put (&pdev->dev); +pm_runtime_disable (&pdev->dev); + +return ret; }static int vpif_remove (struct platform_device *pdev)
Greg Kroah-Hartman
maintainerPATCH 174/1126 media: davinci: vpif: fix use-after-free on driver unbind
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 43acb728bbc40169d2e2425e84a80068270974be upstream.
The driver allocates and registers two platform device structures during probe, but the devices were never deregistered on driver unbind.
This results in a use-after-free on driver unbind as the device structures were allocated using devres and would be freed by driver core when remove() returns.
Fix this by adding the missing deregistration calls to the remove() callback and failing probe on registration errors.
Note that the platform device structures must be freed using a proper release callback to avoid leaking associated resources like device names.
--- drivers/media/platform/davinci/vpif.c | 97 ++++++++++++++++++++++++---------- 1 file changed, 71 insertions(+), 26 deletions(-)
drivers/media/platform/davinci/vpif.c +71 -26
@@ -41,6 +41,11 @@ MODULE_ALIAS("platform:" VPIF_DRIVER_NAM#define VPIF_CH2_MAX_MODES 15#define VPIF_CH3_MAX_MODES 2 +struct vpif_data { +struct platform_device *capture; +struct platform_device *display; +}; +DEFINE_SPINLOCK (vpif_lock);EXPORT_SYMBOL_GPL (vpif_lock);
@@ -423,17 +428,31 @@ int vpif_channel_getfid(u8 channel_id) }EXPORT_SYMBOL (vpif_channel_getfid); +static void vpif_pdev_release (struct device *dev) +{ +struct platform_device *pdev =to_platform_device (dev); + +kfree (pdev); +} +static int vpif_probe (struct platform_device *pdev) {static struct resource *res_irq;struct platform_device *pdev_capture, *pdev_display;struct device_node *endpoint =NULL ; +struct vpif_data *data;int ret; vpif_base =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (vpif_base))return PTR_ERR (vpif_base); + data =kzalloc (sizeof (*data),GFP_KERNEL ); +if (!data) +return -ENOMEM ; + +platform_set_drvdata (pdev, data); +pm_runtime_enable (&pdev->dev);pm_runtime_get (&pdev->dev);
@@ -461,49 +480,75 @@ static int vpif_probe(struct platform_de goto err_put_rpm; } - pdev_capture =devm_kzalloc (&pdev->dev,sizeof (*pdev_capture), -GFP_KERNEL ); -if (pdev_capture) { - pdev_capture->name ="vpif_capture" ; - pdev_capture->id =-1 ; - pdev_capture->resource = res_irq; - pdev_capture->num_resources =1 ; - pdev_capture->dev.dma_mask = pdev->dev.dma_mask; - pdev_capture->dev.coherent_dma_mask = pdev->dev.coherent_dma_mask; - pdev_capture->dev.parent = &pdev->dev; -platform_device_register (pdev_capture); - }else { -dev_warn (&pdev->dev,"Unable to allocate memory for pdev_capture.\n" ); + pdev_capture =kzalloc (sizeof (*pdev_capture),GFP_KERNEL ); +if (!pdev_capture) { + ret = -ENOMEM ; + goto err_put_rpm; } - pdev_display =devm_kzalloc (&pdev->dev,sizeof (*pdev_display), -GFP_KERNEL ); -if (pdev_display) { - pdev_display->name ="vpif_display" ; - pdev_display->id =-1 ; - pdev_display->resource = res_irq; - pdev_display->num_resources =1 ; - pdev_display->dev.dma_mask = pdev->dev.dma_mask; - pdev_display->dev.coherent_dma_mask = pdev->dev.coherent_dma_mask; - pdev_display->dev.parent = &pdev->dev; -platform_device_register (pdev_display); - }else { -dev_warn (&pdev->dev,"Unable to allocate memory for pdev_display.\n" ); + pdev_capture->name ="vpif_capture" ; + pdev_capture->id =-1 ; + pdev_capture->resource = res_irq; + pdev_capture->num_resources =1 ; + pdev_capture->dev.dma_mask = pdev->dev.dma_mask; + pdev_capture->dev.coherent_dma_mask = pdev->dev.coherent_dma_mask; + pdev_capture->dev.parent = &pdev->dev; + pdev_capture->dev.release = vpif_pdev_release; + + ret =platform_device_register (pdev_capture); +if (ret) + goto err_put_pdev_capture; + + pdev_display =kzalloc (sizeof (*pdev_display),GFP_KERNEL ); +if (!pdev_display) { + ret = -ENOMEM ; + goto err_put_pdev_capture; } + pdev_display->name ="vpif_display" ; + pdev_display->id =-1 ; + pdev_display->resource = res_irq; + pdev_display->num_resources =1 ; + pdev_display->dev.dma_mask = pdev->dev.dma_mask; + pdev_display->dev.coherent_dma_mask = pdev->dev.coherent_dma_mask; + pdev_display->dev.parent = &pdev->dev; + pdev_display->dev.release = vpif_pdev_release; + + ret =platform_device_register (pdev_display); +if (ret) + goto err_put_pdev_display; + + data->capture = pdev_capture; + data->display = pdev_display; +return 0 ; +err_put_pdev_display: +platform_device_put (pdev_display); +err_put_pdev_capture: +platform_device_put (pdev_capture); err_put_rpm:pm_runtime_put (&pdev->dev);pm_runtime_disable (&pdev->dev); +kfree (data);return ret; }static int vpif_remove (struct platform_device *pdev) { +struct vpif_data *data =platform_get_drvdata (pdev); + +if (data->capture) +platform_device_unregister (data->capture); +if (data->display) +platform_device_unregister (data->display); +pm_runtime_put (&pdev->dev);pm_runtime_disable (&pdev->dev); + +kfree (data); +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 175/1126 mips: Always permit to build u-boot images
In reply to Greg Kroah-HartmanFrom: Paul Cercueil <[email protected]>
commit 34275ac292ae141ebc1296b72f005f71b25998a7 upstream.
The platforms where the kernel should be loaded above 0x8000.0000 do not support loading u-boot images, that doesn't mean that we shouldn't be able to generate them.
Additionally, since commit 79876cc1d7b8 ("MIPS: new Kconfig option ZBOOT_LOAD_ADDRESS"), the $(zload-y) variable was no longer hardcoded, which made it impossible to use the uzImage.bin target.
--- arch/mips/Makefile | 4 ---- 1 file changed, 4 deletions(-)
arch/mips/Makefile +0 -4
@@ -340,14 +340,12 @@ drivers-$(CONFIG_PM) += arch/mips/power/ boot-y := vmlinux.bin boot-y += vmlinux.ecoff boot-y += vmlinux.srec -ifeq ($(shell expr $(load-y) \< 0xffffffff80000000 2> /dev/null), 0) boot-y += uImage boot-y += uImage.bin boot-y += uImage.bz2 boot-y += uImage.gz boot-y += uImage.lzma boot-y += uImage.lzo -endif boot-y += vmlinux.itb boot-y += vmlinux.gz.itb boot-y += vmlinux.bz2.itb
@@ -359,9 +357,7 @@ bootz-y := vmlinuz bootz-y += vmlinuz.bin bootz-y += vmlinuz.ecoff bootz-y += vmlinuz.srec -ifeq ($(shell expr $(zload-y) \< 0xffffffff80000000 2> /dev/null), 0) bootz-y += uzImage.bin -endif bootz-y += vmlinuz.itb #
Greg Kroah-Hartman
maintainerPATCH 100/1126 rtc: mc146818-lib: fix locking in mc146818_set_time
In reply to Greg Kroah-HartmanFrom: Mateusz Jończyk <[email protected]>
commit 811f5559270f25c34c338d6eaa2ece2544c3d3bd upstream.
In mc146818_set_time(), CMOS_READ(RTC_CONTROL) was performed without the rtc_lock taken, which is required for CMOS accesses. Fix this.
Nothing in kernel modifies RTC_DM_BINARY, so a separate critical section is allowed here.
--- drivers/rtc/rtc-mc146818-lib.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/rtc/rtc-mc146818-lib.c +4 -2
@@ -232,8 +232,10 @@ int mc146818_set_time(struct rtc_time *tif (yrs >=100 ) yrs -=100 ; -if (!(CMOS_READ (RTC_CONTROL ) &RTC_DM_BINARY ) - ||RTC_ALWAYS_BCD ) { +spin_lock_irqsave (&rtc_lock, flags); + save_control =CMOS_READ (RTC_CONTROL ); +spin_unlock_irqrestore (&rtc_lock, flags); +if (!(save_control &RTC_DM_BINARY ) ||RTC_ALWAYS_BCD ) { sec =bin2bcd (sec); min =bin2bcd (min); hrs =bin2bcd (hrs);
Greg Kroah-Hartman
maintainerPATCH 141/1126 block: fix rq-qos breakage from skipping rq_qos_done_bio()
In reply to Greg Kroah-HartmanFrom: Tejun Heo <[email protected]>
commit aa1b46dcdc7baaf5fec0be25782ef24b26aa209e upstream.
a647a524a467 ("block: don't call rq_qos_ops->done_bio if the bio isn't tracked") made bio_endio() skip rq_qos_done_bio() if BIO_TRACKED is not set. While this fixed a potential oops, it also broke blk-iocost by skipping the done_bio callback for merged bios.
Before, whether a bio goes through rq_qos_throttle() or rq_qos_merge(), rq_qos_done_bio() would be called on the bio on completion with BIO_TRACKED distinguishing the former from the latter. rq_qos_done_bio() is not called for bios which wenth through rq_qos_merge(). This royally confuses blk-iocost as the merged bios never finish and are considered perpetually in-flight.
One reliably reproducible failure mode is an intermediate cgroup geting stuck active preventing its children from being activated due to the leaf-only rule, leading to loss of control. The following is from resctl-bench protection scenario which emulates isolating a web server like workload from a memory bomb run on an iocost configuration which should yield a reasonable level of protection.
# cat /sys/block/nvme2n1/device/model Samsung SSD 970 PRO 512GB # cat /sys/fs/cgroup/io.cost.model 259:0 ctrl=user model=linear rbps=834913556 rseqiops=93622 rrandiops=102913 wbps=618985353 wseqiops=72325 wrandiops=71025 # cat /sys/fs/cgroup/io.cost.qos 259:0 enable=1 ctrl=user rpct=95.00 rlat=18776 wpct=95.00 wlat=8897 min=60.00 max=100.00 # resctl-bench -m 29.6G -r out.json run protection::scenario=mem-hog,loops=1 ... Memory Hog Summary ==================
IO Latency: R p50=242u:336u/2.5m p90=794u:1.4m/7.5m p99=2.7m:8.0m/62.5m max=8.0m:36.4m/350m
W p50=221u:323u/1.5m p90=709u:1.2m/5.5m p99=1.5m:2.5m/9.5m max=6.9m:35.9m/350m
Isolation and Request Latency Impact Distributions:
min p01 p05 p10 p25 p50 p75 p90 p95 p99 max mean stdev
isol% 15.90 15.90 15.90 40.05 57.24 59.07 60.01 74.63 74.63 90.35 90.35 58.12 15.82
lat-imp% 0 0 0 0 0 4.55 14.68 15.54 233.5 548.1 548.1 53.88 143.6
Result: isol=58.12:15.82% lat_imp=53.88%:143.6 work_csv=100.0% missing=3.96%
The isolation result of 58.12% is close to what this device would show without any IO control.
Fix it by introducing a new flag BIO_QOS_MERGED to mark merged bios and calling rq_qos_done_bio() on them too. For consistency and clarity, rename BIO_TRACKED to BIO_QOS_THROTTLED. The flag checks are moved into rq_qos_done_bio() so that it's next to the code paths that set the flags.
With the patch applied, the above same benchmark shows:
# resctl-bench -m 29.6G -r out.json run protection::scenario=mem-hog,loops=1 ... Memory Hog Summary ==================
IO Latency: R p50=123u:84.4u/985u p90=322u:256u/2.5m p99=1.6m:1.4m/9.5m max=11.1m:36.0m/350m
W p50=429u:274u/995u p90=1.7m:1.3m/4.5m p99=3.4m:2.7m/11.5m max=7.9m:5.9m/26.5m
Isolation and Request Latency Impact Distributions:
min p01 p05 p10 p25 p50 p75 p90 p95 p99 max mean stdev
isol% 84.91 84.91 89.51 90.73 92.31 94.49 96.36 98.04 98.71 100.0 100.0 94.42 2.81
lat-imp% 0 0 0 0 0 2.81 5.73 11.11 13.92 17.53 22.61 4.10 4.68
Result: isol=94.42:2.81% lat_imp=4.10%:4.68 work_csv=58.34% missing=0%
--- block/bio.c | 3 +-- block/blk-iolatency.c | 2 +- block/blk-rq-qos.h | 20 +++++++++++--------- include/linux/blk_types.h | 3 ++- 4 files changed, 15 insertions(+), 13 deletions(-)
block/bio.c +1 -2
@@ -1486,8 +1486,7 @@ again:if (!bio_integrity_endio (bio))return ; -if (bio->bi_bdev &&bio_flagged (bio,BIO_TRACKED )) -rq_qos_done_bio (bdev_get_queue (bio->bi_bdev), bio); +rq_qos_done_bio (bio);if (bio->bi_bdev &&bio_flagged (bio,BIO_TRACE_COMPLETION )) {trace_block_bio_complete (bdev_get_queue (bio->bi_bdev), bio);
block/blk-iolatency.c +1 -1
@@ -598,7 +598,7 @@ static void blkcg_iolatency_done_bio(strint inflight =0 ; blkg = bio->bi_blkg; -if (!blkg || !bio_flagged (bio,BIO_TRACKED )) +if (!blkg || !bio_flagged (bio,BIO_QOS_THROTTLED ))return ; iolat =blkg_to_lat (bio->bi_blkg);
block/blk-rq-qos.h +11 -9
@@ -177,20 +177,20 @@ static inline void rq_qos_requeue(struct__rq_qos_requeue (q->rq_qos, rq); } -static inline void rq_qos_done_bio (struct request_queue *q,struct bio *bio) +static inline void rq_qos_done_bio (struct bio *bio) { -if (q->rq_qos) -__rq_qos_done_bio (q->rq_qos, bio); +if (bio->bi_bdev && (bio_flagged (bio,BIO_QOS_THROTTLED ) || +bio_flagged (bio,BIO_QOS_MERGED ))) { +struct request_queue *q =bdev_get_queue (bio->bi_bdev); +if (q->rq_qos) +__rq_qos_done_bio (q->rq_qos, bio); + } }static inline void rq_qos_throttle (struct request_queue *q,struct bio *bio) { -/* -* BIO_TRACKED lets controllers know that a bio went through the -* normal rq_qos path. -*/ if (q->rq_qos) { -bio_set_flag (bio,BIO_TRACKED ); +bio_set_flag (bio,BIO_QOS_THROTTLED );__rq_qos_throttle (q->rq_qos, bio); } }
@@ -205,8 +205,10 @@ static inline void rq_qos_track(struct rstatic inline void rq_qos_merge (struct request_queue *q,struct request *rq,struct bio *bio) { -if (q->rq_qos) +if (q->rq_qos) { +bio_set_flag (bio,BIO_QOS_MERGED );__rq_qos_merge (q->rq_qos, rq, bio); + } }static inline void rq_qos_queue_depth_changed (struct request_queue *q)
include/linux/blk_types.h +2 -1
@@ -317,7 +317,8 @@ enum {BIO_TRACE_COMPLETION ,/* bio_endio() should trace the final completion * of this bio. */ BIO_CGROUP_ACCT ,/* has been accounted to a cgroup */ -BIO_TRACKED ,/* set if bio goes through the rq_qos path */ +BIO_QOS_THROTTLED ,/* bio went through rq_qos throttle path */ +BIO_QOS_MERGED ,/* but went through rq_qos merge path */ BIO_REMAPPED ,BIO_ZONE_WRITE_LOCKED ,/* Owns a zoned device zone write lock */ BIO_PERCPU_CACHE, /* can participate in per-cpu alloc cache */
Greg Kroah-Hartman
maintainerPATCH 143/1126 block: dont merge across cgroup boundaries if blkcg is enabled
In reply to Greg Kroah-HartmanFrom: Tejun Heo <[email protected]>
commit 6b2b04590b51aa4cf395fcd185ce439cab5961dc upstream.
blk-iocost and iolatency are cgroup aware rq-qos policies but they didn't disable merges across different cgroups. This obviously can lead to accounting and control errors but more importantly to priority inversions - e.g. an IO which belongs to a higher priority cgroup or IO class may end up getting throttled incorrectly because it gets merged to an IO issued from a low priority cgroup.
Fix it by adding blk_cgroup_mergeable() which is called from merge paths and rejects cross-cgroup and cross-issue_as_root merges.
--- block/blk-merge.c | 11 +++++++++++ include/linux/blk-cgroup.h | 17 +++++++++++++++++ 2 files changed, 28 insertions(+)
block/blk-merge.c +11 -0
@@ -9,6 +9,7 @@#include <linux/blk-integrity.h> #include <linux/scatterlist.h> #include <linux/part_stat.h> +#include <linux/blk-cgroup.h> #include <trace/events/block.h>
@@ -600,6 +601,9 @@ static inline unsigned int blk_rq_get_mastatic inline int ll_new_hw_segment (struct request *req,struct bio *bio,unsigned int nr_phys_segs) { +if (!blk_cgroup_mergeable (req, bio)) + goto no_merge; +if (blk_integrity_merge_bio (req->q, req, bio) == false) goto no_merge;
@@ -696,6 +700,9 @@ static int ll_merge_requests_fn(struct rif (total_phys_segments >blk_rq_get_max_segments (req))return 0 ; +if (!blk_cgroup_mergeable (req, next->bio)) +return 0 ; +if (blk_integrity_merge_rq (q, req, next) == false)return 0 ;
@@ -904,6 +911,10 @@ bool blk_rq_merge_ok(struct request *rq,if (bio_data_dir (bio) !=rq_data_dir (rq))return false; +/* don't merge across cgroup boundaries */ +if (!blk_cgroup_mergeable (rq, bio)) +return false; +/* only merge integrity protected bio into ditto rq */ if (blk_integrity_merge_bio (rq->q, rq, bio) == false)return false;
include/linux/blk-cgroup.h +17 -0
@@ -24,6 +24,7 @@#include <linux/atomic.h> #include <linux/kthread.h> #include <linux/fs.h> +#include <linux/blk-mq.h> /* percpu_counter batch for blkg_[rw]stats, per-cpu drift doesn't matter */ #define BLKG_STAT_CPU_BATCH (INT_MAX / 2)
@@ -604,6 +605,21 @@ static inline void blkcg_clear_delay(stratomic_dec (&blkg->blkcg->css.cgroup->congestion_count); } +/** +* blk_cgroup_mergeable - Determine whether to allow or disallow merges +* @rq: request to merge into +* @bio: bio to merge +* +* @bio and @rq should belong to the same cgroup and their issue_as_root should +* match. The latter is necessary as we don't want to throttle e.g. a metadata +* update because it happens to be next to a regular IO. +*/ +static inline bool blk_cgroup_mergeable (struct request *rq,struct bio *bio) +{ +return rq->bio->bi_blkg == bio->bi_blkg && +bio_issue_as_root_blkg (rq->bio) ==bio_issue_as_root_blkg (bio); +} +void blk_cgroup_bio_start (struct bio *bio);void blkcg_add_delay (struct blkcg_gq *blkg,u64 now,u64 delta);void blkcg_schedule_throttle (struct request_queue *q,bool use_memdelay);
@@ -659,6 +675,7 @@ static inline void blkg_put(struct blkcgstatic inline bool blkcg_punt_bio_submit (struct bio *bio) {return false; }static inline void blkcg_bio_issue_init (struct bio *bio) { }static inline void blk_cgroup_bio_start (struct bio *bio) { } +static inline bool blk_cgroup_mergeable (struct request *rq,struct bio *bio) {return true; }#define blk_queue_for_each_rl (rl, q) \ for ((rl) = &(q)->root_rl; (rl); (rl) = NULL)
Greg Kroah-Hartman
maintainerPATCH 176/1126 btrfs: zoned: mark relocation as writing
In reply to Greg Kroah-HartmanFrom: Naohiro Aota <[email protected]>
commit ca5e4ea0beaec8bc674121838bf8614c089effb9 upstream.
There is a hung_task issue with running generic/068 on an SMR device. The hang occurs while a process is trying to thaw the filesystem. The process is trying to take sb->s_umount to thaw the FS. The lock is held by fsstress, which calls btrfs_sync_fs() and is waiting for an ordered extent to finish. However, as the FS is frozen, the ordered extents never finish.
Having an ordered extent while the FS is frozen is the root cause of the hang. The ordered extent is initiated from btrfs_relocate_chunk() which is called from btrfs_reclaim_bgs_work().
This commit adds sb_*_write() around btrfs_relocate_chunk() call site. For the usual "btrfs balance" command, we already call it with mnt_want_file() in btrfs_ioctl_balance().
--- fs/btrfs/block-group.c | 8 +++++++- fs/btrfs/volumes.c | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-)
fs/btrfs/block-group.c +7 -1
@@ -1522,8 +1522,12 @@ void btrfs_reclaim_bgs_work(struct work_if (!test_bit (BTRFS_FS_OPEN , &fs_info->flags))return ; -if (!btrfs_exclop_start (fs_info,BTRFS_EXCLOP_BALANCE )) +sb_start_write (fs_info->sb); + +if (!btrfs_exclop_start (fs_info,BTRFS_EXCLOP_BALANCE )) { +sb_end_write (fs_info->sb);return ; + }/* * Long running balances can keep us blocked here for eternity, so
@@ -1531,6 +1535,7 @@ void btrfs_reclaim_bgs_work(struct work_*/ if (!mutex_trylock (&fs_info->reclaim_bgs_lock)) {btrfs_exclop_finish (fs_info); +sb_end_write (fs_info->sb);return ; }
@@ -1605,6 +1610,7 @@ next:spin_unlock (&fs_info->unused_bgs_lock);mutex_unlock (&fs_info->reclaim_bgs_lock);btrfs_exclop_finish (fs_info); +sb_end_write (fs_info->sb); }void btrfs_reclaim_bgs (struct btrfs_fs_info *fs_info)
fs/btrfs/volumes.c +3 -0
@@ -8299,10 +8299,12 @@ static int relocating_repair_kthread(voi target = cache->start;btrfs_put_block_group (cache); +sb_start_write (fs_info->sb);if (!btrfs_exclop_start (fs_info,BTRFS_EXCLOP_BALANCE )) {btrfs_info (fs_info,"zoned: skip relocating block group %llu to repair: EBUSY" , target); +sb_end_write (fs_info->sb);return -EBUSY ; }
@@ -8330,6 +8332,7 @@ out:btrfs_put_block_group (cache);mutex_unlock (&fs_info->reclaim_bgs_lock);btrfs_exclop_finish (fs_info); +sb_end_write (fs_info->sb);return ret; }
Greg Kroah-Hartman
maintainerPATCH 177/1126 btrfs: extend locking to all space_info members accesses
In reply to Greg Kroah-HartmanFrom: Niels Dossche <[email protected]>
commit 06bae876634ebf837ba70ea3de532b288326103d upstream.
bytes_pinned is always accessed under space_info->lock, except in btrfs_preempt_reclaim_metadata_space, however the other members are accessed under that lock. The reserved member of the rsv's are also partially accessed under a lock and partially not. Move all these accesses into the same lock to ensure consistency.
This could potentially race and lead to a flush instead of a commit but it's not a big problem as it's only for preemptive flush.
--- fs/btrfs/space-info.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/space-info.c +2 -1
@@ -1061,7 +1061,6 @@ static void btrfs_preempt_reclaim_metada trans_rsv->reserved;if (block_rsv_size < space_info->bytes_may_use) delalloc_size = space_info->bytes_may_use - block_rsv_size; -spin_unlock (&space_info->lock);/* * We don't want to include the global_rsv in our calculation,
@@ -1092,6 +1091,8 @@ static void btrfs_preempt_reclaim_metada flush =FLUSH_DELAYED_REFS_NR ; } +spin_unlock (&space_info->lock); +/* * We don't want to reclaim everything, just a portion, so scale * down the to_reclaim by 1/4. If it takes us down to 0,
Greg Kroah-Hartman
maintainerPATCH 142/1126 block: limit request dispatch loop duration
In reply to Greg Kroah-HartmanFrom: Shin'ichiro Kawasaki <[email protected]>
commit 572299f03afd676dd4e20669cdaf5ed0fe1379d4 upstream.
When IO requests are made continuously and the target block device handles requests faster than request arrival, the request dispatch loop keeps on repeating to dispatch the arriving requests very long time, more than a minute. Since the loop runs as a workqueue worker task, the very long loop duration triggers workqueue watchdog timeout and BUG [1].
To avoid the very long loop duration, break the loop periodically. When opportunity to dispatch requests still exists, check need_resched(). If need_resched() returns true, the dispatch loop already consumed its time slice, then reschedule the dispatch work and break the loop. With heavy IO load, need_resched() does not return true for 20~30 seconds. To cover such case, check time spent in the dispatch loop with jiffies. If more than 1 second is spent, reschedule the dispatch work and break the loop.
[1]
[ 609.691437] BUG: workqueue lockup - pool cpus=10 node=1 flags=0x0 nice=-20 stuck for 35s! [ 609.701820] Showing busy workqueues and worker pools: [ 609.707915] workqueue events: flags=0x0 [ 609.712615] pwq 0: cpus=0 node=0 flags=0x0 nice=0 active=1/256 refcnt=2 [ 609.712626] pending: drm_fb_helper_damage_work [drm_kms_helper] [ 609.712687] workqueue events_freezable: flags=0x4 [ 609.732943] pwq 0: cpus=0 node=0 flags=0x0 nice=0 active=1/256 refcnt=2 [ 609.732952] pending: pci_pme_list_scan [ 609.732968] workqueue events_power_efficient: flags=0x80 [ 609.751947] pwq 0: cpus=0 node=0 flags=0x0 nice=0 active=1/256 refcnt=2 [ 609.751955] pending: neigh_managed_work [ 609.752018] workqueue kblockd: flags=0x18 [ 609.769480] pwq 21: cpus=10 node=1 flags=0x0 nice=-20 active=3/256 refcnt=4 [ 609.769488] in-flight: 1020:blk_mq_run_work_fn [ 609.769498] pending: blk_mq_timeout_work, blk_mq_run_work_fn [ 609.769744] pool 21: cpus=10 node=1 flags=0x0 nice=-20 hung=35s workers=2 idle: 67 [ 639.899730] BUG: workqueue lockup - pool cpus=10 node=1 flags=0x0 nice=-20 stuck for 66s! [ 639.909513] Showing busy workqueues and worker pools: [ 639.915404] workqueue events: flags=0x0 [ 639.920197] pwq 0: cpus=0 node=0 flags=0x0 nice=0 active=1/256 refcnt=2 [ 639.920215] pending: drm_fb_helper_damage_work [drm_kms_helper] [ 639.920365] workqueue kblockd: flags=0x18 [ 639.939932] pwq 21: cpus=10 node=1 flags=0x0 nice=-20 active=3/256 refcnt=4 [ 639.939942] in-flight: 1020:blk_mq_run_work_fn [ 639.939955] pending: blk_mq_timeout_work, blk_mq_run_work_fn [ 639.940212] pool 21: cpus=10 node=1 flags=0x0 nice=-20 hung=66s workers=2 idle: 67
--- block/blk-mq-sched.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
block/blk-mq-sched.c +8 -1
@@ -180,11 +180,18 @@ static int __blk_mq_do_dispatch_sched(ststatic int blk_mq_do_dispatch_sched (struct blk_mq_hw_ctx *hctx) { +unsigned long end = jiffies +HZ ;int ret;do { ret =__blk_mq_do_dispatch_sched (hctx); - }while (ret ==1 ); +if (ret !=1 ) +break ; +if (need_resched () ||time_is_before_jiffies (end)) { +blk_mq_delay_run_hw_queue (hctx,0 ); +break ; + } + }while (1 );return ret; }
Greg Kroah-Hartman
maintainerPATCH 137/1126 samples/landlock: Fix path_list memory leak
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
commit 66b513b7c64a7290c1fbb88e657f7cece992e131 upstream.
Clang static analysis reports this error
sandboxer.c:134:8: warning: Potential leak of memory
pointed to by 'path_list'
ret = 0;
^path_list is allocated in parse_path() but never freed.
--- samples/landlock/sandboxer.c | 1 + 1 file changed, 1 insertion(+)
samples/landlock/sandboxer.c +1 -0
@@ -134,6 +134,7 @@ static int populate_ruleset( ret =0 ; out_free_name: +free (path_list);free (env_path_name);return ret; }
Greg Kroah-Hartman
maintainerPATCH 201/1126 crypto: ccp - Ensure psp_ret is always initd in __sev_platform_init_locked()
In reply to Greg Kroah-HartmanFrom: Peter Gonda <[email protected]>
[ Upstream commit 1e1ec11d3ec3134e05d4710f4dee5f9bd05e828d ]
Initialize psp_ret inside of __sev_platform_init_locked() because there are many failure paths with PSP initialization that do not set __sev_do_cmd_locked().
--- drivers/crypto/ccp/sev-dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/ccp/sev-dev.c +1 -1
@@ -413,7 +413,7 @@ static int __sev_platform_init_locked(int *error) {struct psp_device *psp = psp_master;struct sev_device *sev; -int rc, psp_ret; +int rc, psp_ret =-1 ;int (*init_function)(int *error);if (!psp || !psp->sev_data)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 146/1126 video: fbdev: sm712fb: Fix crash in smtcfb_read()
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
commit bd771cf5c4254511cc4abb88f3dab3bd58bdf8e8 upstream.
Zheyu Ma reported this crash in the sm712fb driver when reading three bytes from the framebuffer:
BUG: unable to handle page fault for address: ffffc90001ffffff RIP: 0010:smtcfb_read+0x230/0x3e0 Call Trace: vfs_read+0x198/0xa00 ? do_sys_openat2+0x27d/0x350 ? __fget_light+0x54/0x340 ksys_read+0xce/0x190 do_syscall_64+0x43/0x90
Fix it by removing the open-coded endianess fixup-code and by moving the pointer post decrement out the fb_readl() function.
--- drivers/video/fbdev/sm712fb.c | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-)
drivers/video/fbdev/sm712fb.c +7 -18
@@ -1047,7 +1047,7 @@ static ssize_t smtcfb_read(struct fb_infif (count + p > total_size) count = total_size - p; - buffer =kmalloc ((count >PAGE_SIZE ) ?PAGE_SIZE : count,GFP_KERNEL ); + buffer =kmalloc (PAGE_SIZE ,GFP_KERNEL );if (!buffer)return -ENOMEM ;
@@ -1059,25 +1059,14 @@ static ssize_t smtcfb_read(struct fb_infwhile (count) { c = (count >PAGE_SIZE ) ?PAGE_SIZE : count; dst = buffer; -for (i = c >>2 ; i--;) { - *dst =fb_readl (src++); - *dst =big_swap (*dst); +for (i = (c +3 ) >>2 ; i--;) { +u32 val; + + val =fb_readl (src); + *dst =big_swap (val); + src++; dst++; } -if (c &3 ) { -u8 *dst8 = (u8 *)dst; -u8 __iomem *src8 = (u8 __iomem *)src; - -for (i = c &3 ; i--;) { -if (i &1 ) { - *dst8++ =fb_readb (++src8); - }else { - *dst8++ =fb_readb (--src8); - src8 +=2 ; - } - } - src = (u32 __iomem *)src8; - }if (copy_to_user (buf, buffer, c)) { err = -EFAULT ;
Greg Kroah-Hartman
maintainerPATCH 145/1126 fbdev: Hot-unplug firmware fb devices on forced removal
In reply to Greg Kroah-HartmanFrom: Thomas Zimmermann <[email protected]>
commit 27599aacbaefcbf2af7b06b0029459bbf682000d upstream.
Hot-unplug all firmware-framebuffer devices as part of removing them via remove_conflicting_framebuffers() et al. Releases all memory regions to be acquired by native drivers.
Firmware, such as EFI, install a framebuffer while posting the computer. After removing the firmware-framebuffer device from fbdev, a native driver takes over the hardware and the firmware framebuffer becomes invalid.
Firmware-framebuffer drivers, specifically simplefb, don't release their device from Linux' device hierarchy. It still owns the firmware framebuffer and blocks the native drivers from loading. This has been observed in the vmwgfx driver. [1]
Initiating a device removal (i.e., hot unplug) as part of remove_conflicting_framebuffers() removes the underlying device and returns the memory range to the system.
[1] https://lore.kernel.org/dri-devel/[email protected]/
v2:
* rename variable 'dev' to 'device' (Javier)
--- drivers/video/fbdev/core/fbmem.c | 29 ++++++++++++++++++++++++++--- include/linux/fb.h | 1 + 2 files changed, 27 insertions(+), 3 deletions(-)
drivers/video/fbdev/core/fbmem.c +26 -3
@@ -25,6 +25,7 @@#include <linux/init.h> #include <linux/linux_logo.h> #include <linux/proc_fs.h> +#include <linux/platform_device.h> #include <linux/seq_file.h> #include <linux/console.h> #include <linux/kmod.h>
@@ -1559,18 +1560,36 @@ static void do_remove_conflicting_frameb/* check all firmware fbs and kick off if the base addr overlaps */ for_each_registered_fb (i) {struct apertures_struct *gen_aper; +struct device *device;if (!(registered_fb[i]->flags &FBINFO_MISC_FIRMWARE ))continue ; gen_aper = registered_fb[i]->apertures; + device = registered_fb[i]->device;if (fb_do_apertures_overlap (gen_aper, a) || (primary && gen_aper && gen_aper->count && gen_aper->ranges[0 ].base ==VGA_FB_PHYS )) {printk (KERN_INFO "fb%d: switching to %s from %s\n" , i, name, registered_fb[i]->fix.id); -do_unregister_framebuffer (registered_fb[i]); + +/* +* If we kick-out a firmware driver, we also want to remove +* the underlying platform device, such as simple-framebuffer, +* VESA, EFI, etc. A native driver will then be able to +* allocate the memory range. +* +* If it's not a platform device, at least print a warning. A +* fix would add code to remove the device from the system. +*/ +if (dev_is_platform (device)) { + registered_fb[i]->forced_out = true; +platform_device_unregister (to_platform_device (device)); + }else { +pr_warn ("fb%d: cannot remove device\n" , i); +do_unregister_framebuffer (registered_fb[i]); + } } } }
@@ -1900,9 +1919,13 @@ EXPORT_SYMBOL(register_framebuffer);void unregister_framebuffer (struct fb_info *fb_info) { -mutex_lock (®istration_lock); +bool forced_out = fb_info->forced_out; + +if (!forced_out) +mutex_lock (®istration_lock);do_unregister_framebuffer (fb_info); -mutex_unlock (®istration_lock); +if (!forced_out) +mutex_unlock (®istration_lock); }EXPORT_SYMBOL (unregister_framebuffer);
include/linux/fb.h +1 -0
@@ -502,6 +502,7 @@ struct fb_info { } *apertures;bool skip_vt_switch;/* no VT switch on suspend/resume required */ +bool forced_out;/* set when being removed by another driver */ };static inline struct apertures_struct *alloc_apertures (unsigned int max_num) {
Greg Kroah-Hartman
maintainerPATCH 190/1126 brcmfmac: pcie: Replace brcmf_pcie_copy_mem_todev with memcpy_toio
In reply to Greg Kroah-HartmanFrom: Hector Martin <[email protected]>
commit 9466987f246758eb7e9071ae58005253f631271e upstream.
The alignment check was wrong (e.g. & 4 instead of & 3), and the logic was also inefficient if the length was not a multiple of 4, since it would needlessly fall back to copying the entire buffer bytewise.
We already have a perfectly good memcpy_toio function, so just call that instead of rolling our own copy logic here. brcmf_pcie_init_ringbuffers was already using it anyway.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 48 +--------------- 1 file changed, 4 insertions(+), 44 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +4 -44
@@ -12,6 +12,7 @@#include <linux/interrupt.h> #include <linux/bcma/bcma.h> #include <linux/sched.h> +#include <linux/io.h> #include <asm/unaligned.h> #include <soc.h>
@@ -455,47 +456,6 @@ brcmf_pcie_write_ram32(struct brcmf_pciestatic void -brcmf_pcie_copy_mem_todev (struct brcmf_pciedev_info *devinfo,u32 mem_offset, -void *srcaddr,u32 len) -{ -void __iomem *address = devinfo->tcm + mem_offset; -__le32 *src32; -__le16 *src16; -u8 *src8; - -if (((ulong )address &4 ) || ((ulong )srcaddr &4 ) || (len &4 )) { -if (((ulong )address &2 ) || ((ulong )srcaddr &2 ) || (len &2 )) { - src8 = (u8 *)srcaddr; -while (len) { -iowrite8 (*src8, address); - address++; - src8++; - len--; - } - }else { - len = len /2 ; - src16 = (__le16 *)srcaddr; -while (len) { -iowrite16 (le16_to_cpu (*src16), address); - address +=2 ; - src16++; - len--; - } - } - }else { - len = len /4 ; - src32 = (__le32 *)srcaddr; -while (len) { -iowrite32 (le32_to_cpu (*src32), address); - address +=4 ; - src32++; - len--; - } - } -} - - -static void brcmf_pcie_copy_dev_tomem (struct brcmf_pciedev_info *devinfo,u32 mem_offset,void *dstaddr,u32 len) {
@@ -1570,8 +1530,8 @@ static int brcmf_pcie_download_fw_nvram(return err;brcmf_dbg (PCIE ,"Download FW %s\n" , devinfo->fw_name); -brcmf_pcie_copy_mem_todev (devinfo, devinfo->ci->rambase, - (void *)fw->data, fw->size); +memcpy_toio (devinfo->tcm + devinfo->ci->rambase, + (void *)fw->data, fw->size); resetintr =get_unaligned_le32 (fw->data);release_firmware (fw);
@@ -1585,7 +1545,7 @@ static int brcmf_pcie_download_fw_nvram(brcmf_dbg (PCIE ,"Download NVRAM %s\n" , devinfo->nvram_name); address = devinfo->ci->rambase + devinfo->ci->ramsize - nvram_len; -brcmf_pcie_copy_mem_todev (devinfo, address, nvram, nvram_len); +memcpy_toio (devinfo->tcm + address, nvram, nvram_len);brcmf_fw_nvram_free (nvram); }else { brcmf_dbg(PCIE, "No matching NVRAM file found %s\n",
Greg Kroah-Hartman
maintainerPATCH 191/1126 brcmfmac: pcie: Fix crashes due to early IRQs
In reply to Greg Kroah-HartmanFrom: Hector Martin <[email protected]>
commit b50255c83b914defd61a57fbc81d452334b63f4c upstream.
The driver was enabling IRQs before the message processing was initialized. This could cause IRQs to come in too early and crash the driver. Instead, move the IRQ enable and hostready to a bus preinit function, at which point everything is properly initialized.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +13 -3
@@ -1315,6 +1315,18 @@ static void brcmf_pcie_down(struct devic { } +static int brcmf_pcie_preinit (struct device *dev) +{ +struct brcmf_bus *bus_if =dev_get_drvdata (dev); +struct brcmf_pciedev *buspub = bus_if->bus_priv.pcie; + +brcmf_dbg (PCIE ,"Enter\n" ); + +brcmf_pcie_intr_enable (buspub->devinfo); +brcmf_pcie_hostready (buspub->devinfo); + +return 0 ; +}static int brcmf_pcie_tx (struct device *dev,struct sk_buff *skb) {
@@ -1423,6 +1435,7 @@ static int brcmf_pcie_reset(struct devic }static const struct brcmf_bus_ops brcmf_pcie_bus_ops = { + .preinit = brcmf_pcie_preinit, .txdata = brcmf_pcie_tx, .stop = brcmf_pcie_down, .txctl = brcmf_pcie_tx_ctlpkt,
@@ -1795,9 +1808,6 @@ static void brcmf_pcie_setup(struct deviinit_waitqueue_head (&devinfo->mbdata_resp_wait); -brcmf_pcie_intr_enable (devinfo); -brcmf_pcie_hostready (devinfo); - ret =brcmf_attach (&devinfo->pdev->dev);if (ret) goto fail;
Greg Kroah-Hartman
maintainerPATCH 194/1126 PCI: imx6: Allow to probe when dw_pcie_wait_for_link() fails
In reply to Greg Kroah-HartmanFrom: Fabio Estevam <[email protected]>
commit f81f095e87715e198471f4653952fe5e3f824874 upstream.
The intention of commit 886a9c134755 ("PCI: dwc: Move link handling into common code") was to standardize the behavior of link down as explained in its commit log:
"The behavior for a link down was inconsistent as some drivers would fail probe in that case while others succeed. Let's standardize this to succeed as there are usecases where devices (and the link) appear later even without hotplug. For example, a reconfigured FPGA device."
The pci-imx6 still fails to probe when the link is not present, which causes the following warning:
imx6q-pcie 8ffc000.pcie: Phy link never came up
imx6q-pcie: probe of 8ffc000.pcie failed with error -110
------------[ cut here ]------------ WARNING: CPU: 0 PID: 30 at drivers/regulator/core.c:2257 _regulator_put.part.0+0x1b8/0x1dc Modules linked in: CPU: 0 PID: 30 Comm: kworker/u2:2 Not tainted 5.15.0-next-20211103 #1 Hardware name: Freescale i.MX6 SoloX (Device Tree) Workqueue: events_unbound async_run_entry_fn [<c0111730>] (unwind_backtrace) from [<c010bb74>] (show_stack+0x10/0x14) [<c010bb74>] (show_stack) from [<c0f90290>] (dump_stack_lvl+0x58/0x70) [<c0f90290>] (dump_stack_lvl) from [<c012631c>] (__warn+0xd4/0x154) [<c012631c>] (__warn) from [<c0f87b00>] (warn_slowpath_fmt+0x74/0xa8) [<c0f87b00>] (warn_slowpath_fmt) from [<c076b4bc>] (_regulator_put.part.0+0x1b8/0x1dc) [<c076b4bc>] (_regulator_put.part.0) from [<c076b574>] (regulator_put+0x2c/0x3c) [<c076b574>] (regulator_put) from [<c08c3740>] (release_nodes+0x50/0x178)
Fix this problem by ignoring the dw_pcie_wait_for_link() error like it is done on the other dwc drivers.
Tested on imx6sx-sdb and imx6q-sabresd boards.
--- drivers/pci/controller/dwc/pci-imx6.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/pci/controller/dwc/pci-imx6.c +2 -8
@@ -809,9 +809,7 @@ static int imx6_pcie_start_link(struct d/* Start LTSSM. */ imx6_pcie_ltssm_enable (dev); - ret =dw_pcie_wait_for_link (pci); -if (ret) - goto err_reset_phy; +dw_pcie_wait_for_link (pci);if (pci->link_gen ==2 ) {/* Allow Gen2 mode after the link is up. */
@@ -847,11 +845,7 @@ static int imx6_pcie_start_link(struct d }/* Make sure link training is finished as well! */ - ret =dw_pcie_wait_for_link (pci); -if (ret) { -dev_err (dev,"Failed to bring link up!\n" ); - goto err_reset_phy; - } +dw_pcie_wait_for_link (pci); }else {dev_info (dev,"Link: Gen2 disabled\n" ); }
Greg Kroah-Hartman
maintainerPATCH 199/1126 selinux: access superblock_security_struct in LSM blob way
In reply to Greg Kroah-HartmanFrom: GONG, Ruiqi <[email protected]>
[ Upstream commit 0266c25e7c2821181b610595df42cbca6bc93cb8 ]
LSM blob has been involved for superblock's security struct. So fix the remaining direct access to sb->s_security by using the LSM blob mechanism.
--- security/selinux/hooks.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
security/selinux/hooks.c +2 -2
@@ -479,7 +479,7 @@ static int selinux_is_sblabel_mnt(struct super_block *sb)static int sb_check_xattr_support (struct super_block *sb) { -struct superblock_security_struct *sbsec = sb->s_security; +struct superblock_security_struct *sbsec =selinux_superblock (sb);struct dentry *root = sb->s_root;struct inode *root_inode =d_backing_inode (root);u32 sid;
@@ -2647,7 +2647,7 @@ static int selinux_sb_eat_lsm_opts(char *options, void **mnt_opts)static int selinux_sb_mnt_opts_compat (struct super_block *sb,void *mnt_opts) {struct selinux_mnt_opts *opts = mnt_opts; -struct superblock_security_struct *sbsec = sb->s_security; +struct superblock_security_struct *sbsec =selinux_superblock (sb);u32 sid;int rc;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 202/1126 crypto: qat - fix a signedness bug in get_service_enabled()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 844318dfd31f7c99f6cebbdba5d6f8392c4c115c ]
The "ret" variable needs to be signed or there is an error message which will not be printed correctly.
--- drivers/crypto/qat/qat_4xxx/adf_4xxx_hw_data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/qat/qat_4xxx/adf_4xxx_hw_data.c +1 -1
@@ -52,7 +52,7 @@ static const char *const dev_cfg_services[] = {static int get_service_enabled (struct adf_accel_dev *accel_dev) {char services[ADF_CFG_MAX_VAL_LEN_IN_BYTES ] = {0 }; -u32 ret; +int ret; ret =adf_cfg_get_param_value (accel_dev,ADF_GENERAL_SEC ,ADF_SERVICES_ENABLED , services);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 203/1126 hwrng: cavium - HW_RANDOM_CAVIUM should depend on ARCH_THUNDER
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit ab7d88549e2f7ae116afd303f32e1950cb790a1d ]
The Cavium ThunderX Random Number Generator is only present on Cavium ThunderX SoCs, and not available as an independent PCIe endpoint. Hence add a dependency on ARCH_THUNDER, to prevent asking the user about this driver when configuring a kernel without Cavium Thunder SoC support.
--- drivers/char/hw_random/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/hw_random/Kconfig +1 -1
@@ -401,7 +401,7 @@ config HW_RANDOM_MESON config HW_RANDOM_CAVIUM tristate "Cavium ThunderX Random Number Generator support" - depends on HW_RANDOM && PCI && ARM64 + depends on HW_RANDOM && PCI && ARCH_THUNDER default HW_RANDOM help This driver provides kernel-side support for the Random Number
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 206/1126 crypto: qat - fix access to PFVF interrupt registers for GEN4
In reply to Greg Kroah-HartmanFrom: Giovanni Cabiddu <[email protected]>
[ Upstream commit 642a7d49c249f04007e68c124a148847471dd476 ]
The logic that detects, enables and disables pfvf interrupts was expecting a single CSR per VF. Instead, the source and mask register are two registers with a bit per VF.
Due to this, the driver is reading and setting reserved CSRs and not masking the correct source of interrupts.
Fix the access to the source and mask register for QAT GEN4 devices by removing the outer loop in adf_gen4_get_vf2pf_sources(), adf_gen4_enable_vf2pf_interrupts() and adf_gen4_disable_vf2pf_interrupts() and changing the helper macros ADF_4XXX_VM2PF_SOU and ADF_4XXX_VM2PF_MSK.
--- drivers/crypto/qat/qat_common/adf_gen4_pfvf.c | 42 ++++--------------- 1 file changed, 9 insertions(+), 33 deletions(-)
drivers/crypto/qat/qat_common/adf_gen4_pfvf.c +9 -33
@@ -9,15 +9,12 @@#include "adf_pfvf_pf_proto.h" #include "adf_pfvf_utils.h" -#define ADF_4XXX_MAX_NUM_VFS 16 -#define ADF_4XXX_PF2VM_OFFSET (i) (0x40B010 + ((i) * 0x20))#define ADF_4XXX_VM2PF_OFFSET (i) (0x40B014 + ((i) * 0x20))/* VF2PF interrupt source registers */ -#define ADF_4XXX_VM2PF_SOU (i) (0x41A180 + ((i) * 4)) -#define ADF_4XXX_VM2PF_MSK (i) (0x41A1C0 + ((i) * 4)) -#define ADF_4XXX_VM2PF_INT_EN_MSK BIT(0) +#define ADF_4XXX_VM2PF_SOU 0x41A180 +#define ADF_4XXX_VM2PF_MSK 0x41A1C0#define ADF_PFVF_GEN4_MSGTYPE_SHIFT 2#define ADF_PFVF_GEN4_MSGTYPE_MASK 0x3F
@@ -41,51 +38,30 @@ static u32 adf_gen4_pf_get_vf2pf_offset(u32 i)static u32 adf_gen4_get_vf2pf_sources (void __iomem *pmisc_addr) { -int i;u32 sou, mask; -int num_csrs =ADF_4XXX_MAX_NUM_VFS ; -u32 vf_mask =0 ; -for (i =0 ; i < num_csrs; i++) { - sou =ADF_CSR_RD (pmisc_addr,ADF_4XXX_VM2PF_SOU (i)); - mask =ADF_CSR_RD (pmisc_addr,ADF_4XXX_VM2PF_MSK (i)); - sou &= ~mask; - vf_mask |= sou << i; - } + sou =ADF_CSR_RD (pmisc_addr,ADF_4XXX_VM2PF_SOU ); + mask =ADF_CSR_RD (pmisc_addr,ADF_4XXX_VM2PF_MSK ); -return vf_mask; +return sou &= ~mask; }static void adf_gen4_enable_vf2pf_interrupts (void __iomem *pmisc_addr,u32 vf_mask) { -int num_csrs =ADF_4XXX_MAX_NUM_VFS ; -unsigned long mask = vf_mask;unsigned int val; -int i; - -for_each_set_bit (i, &mask, num_csrs) { -unsigned int offset =ADF_4XXX_VM2PF_MSK (i); - val =ADF_CSR_RD (pmisc_addr, offset) & ~ADF_4XXX_VM2PF_INT_EN_MSK ; -ADF_CSR_WR (pmisc_addr, offset, val); - } + val =ADF_CSR_RD (pmisc_addr,ADF_4XXX_VM2PF_MSK ) & ~vf_mask; +ADF_CSR_WR (pmisc_addr,ADF_4XXX_VM2PF_MSK , val); }static void adf_gen4_disable_vf2pf_interrupts (void __iomem *pmisc_addr,u32 vf_mask) { -int num_csrs =ADF_4XXX_MAX_NUM_VFS ; -unsigned long mask = vf_mask;unsigned int val; -int i; - -for_each_set_bit (i, &mask, num_csrs) { -unsigned int offset =ADF_4XXX_VM2PF_MSK (i); - val =ADF_CSR_RD (pmisc_addr, offset) |ADF_4XXX_VM2PF_INT_EN_MSK ; -ADF_CSR_WR (pmisc_addr, offset, val); - } + val =ADF_CSR_RD (pmisc_addr,ADF_4XXX_VM2PF_MSK ) | vf_mask; +ADF_CSR_WR (pmisc_addr,ADF_4XXX_VM2PF_MSK , val); } static int adf_gen4_pfvf_send(struct adf_accel_dev *accel_dev,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 183/1126 drm/syncobj: flatten dma_fence_chains on transfer
In reply to Greg Kroah-HartmanFrom: Christian König <[email protected]>
commit 721255b52700b320c4ae2e23d57f7d9ad1db50b9 upstream.
It is illegal to add a dma_fence_chain as timeline point. Flatten out the fences into a dma_fence_array instead.
--- drivers/gpu/drm/drm_syncobj.c | 61 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 56 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_syncobj.c +56 -5
@@ -853,12 +853,57 @@ drm_syncobj_fd_to_handle_ioctl(struct dr &args->handle); } + +/* +* Try to flatten a dma_fence_chain into a dma_fence_array so that it can be +* added as timeline fence to a chain again. +*/ +static int drm_syncobj_flatten_chain (struct dma_fence **f) +{ +struct dma_fence_chain *chain =to_dma_fence_chain (*f); +struct dma_fence *tmp, **fences; +struct dma_fence_array *array; +unsigned int count; + +if (!chain) +return 0 ; + + count =0 ; +dma_fence_chain_for_each (tmp, &chain->base) + ++count; + + fences =kmalloc_array (count,sizeof (*fences),GFP_KERNEL ); +if (!fences) +return -ENOMEM ; + + count =0 ; +dma_fence_chain_for_each (tmp, &chain->base) + fences[count++] =dma_fence_get (tmp); + + array =dma_fence_array_create (count, fences, +dma_fence_context_alloc (1 ), +1 , false); +if (!array) + goto free_fences; + +dma_fence_put (*f); + *f = &array->base; +return 0 ; + +free_fences: +while (count--) +dma_fence_put (fences[count]); + +kfree (fences); +return -ENOMEM ; +} +static int drm_syncobj_transfer_to_timeline (struct drm_file *file_private,struct drm_syncobj_transfer *args) {struct drm_syncobj *timeline_syncobj =NULL ; -struct dma_fence *fence;struct dma_fence_chain *chain; +struct dma_fence *fence;int ret; timeline_syncobj =drm_syncobj_find (file_private, args->dst_handle);
@@ -869,16 +914,22 @@ static int drm_syncobj_transfer_to_timel args->src_point, args->flags, &fence);if (ret) - goto err; + goto err_put_timeline; + + ret =drm_syncobj_flatten_chain (&fence); +if (ret) + goto err_free_fence; + chain =dma_fence_chain_alloc ();if (!chain) { ret = -ENOMEM ; - goto err1; + goto err_free_fence; } +drm_syncobj_add_point (timeline_syncobj, chain, fence, args->dst_point); -err1: +err_free_fence:dma_fence_put (fence); -err: +err_put_timeline:drm_syncobj_put (timeline_syncobj);return ret;
Greg Kroah-Hartman
maintainerPATCH 213/1126 spi: tegra114: Add missing IRQ check in tegra_spi_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 4f92724d4b92c024e721063f520d66e11ca4b54b ]
This func misses checking for platform_get_irq()'s call and may passes the negative error codes to request_threaded_irq(), which takes unsigned IRQ #, causing it to fail with -EINVAL, overriding an original error code. Stop calling request_threaded_irq() with invalid IRQ #s.
--- drivers/spi/spi-tegra114.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/spi/spi-tegra114.c +4 -0
@@ -1352,6 +1352,10 @@ static int tegra_spi_probe(struct platform_device *pdev) tspi->phys = r->start; spi_irq =platform_get_irq (pdev,0 ); +if (spi_irq <0 ) { + ret = spi_irq; + goto exit_free_master; + } tspi->irq = spi_irq; tspi->clk =devm_clk_get (&pdev->dev,"spi" );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 185/1126 drm/nouveau/backlight: Just set all backlight types as RAW
In reply to Greg Kroah-HartmanFrom: Lyude Paul <[email protected]>
commit b21a142fd2055d8276169efcc95b624ff908a341 upstream.
Currently we can get a warning on systems with eDP backlights like so:
nv_backlight: invalid backlight type
WARNING: CPU: 4 PID: 454 at drivers/video/backlight/backlight.c:420
backlight_device_register+0x226/0x250This happens as a result of us not filling out props.type for the eDP backlight, even though we do it for all other backlight types.
Since nothing in our driver uses anything but BACKLIGHT_RAW, let's take the props\.type assignments out of the codepaths for individual backlight types and just set it unconditionally to prevent this from happening again.
--- drivers/gpu/drm/nouveau/nouveau_backlight.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/nouveau/nouveau_backlight.c +1 -2
@@ -101,7 +101,6 @@ nv40_backlight_init(struct nouveau_encodif (!(nvif_rd32 (device,NV40_PMC_BACKLIGHT ) &NV40_PMC_BACKLIGHT_MASK ))return -ENODEV ; - props->type =BACKLIGHT_RAW ; props->max_brightness =31 ; *ops = &nv40_bl_ops;return 0 ;
@@ -343,7 +342,6 @@ nv50_backlight_init(struct nouveau_backlelse *ops = &nva3_bl_ops; - props->type =BACKLIGHT_RAW ; props->max_brightness =100 ;return 0 ;
@@ -411,6 +409,7 @@ nouveau_backlight_init(struct drm_connec goto fail_alloc; } + props.type =BACKLIGHT_RAW ; bl->dev =backlight_device_register (backlight_name, connector->kdev, nv_encoder, ops, &props);if (IS_ERR (bl->dev)) {
Greg Kroah-Hartman
maintainerPATCH 184/1126 drm/nouveau/backlight: Fix LVDS backlight detection on some laptops
In reply to Greg Kroah-HartmanFrom: Lyude Paul <[email protected]>
commit 6b0076540faffd47f5a899bf12f3528c4f0e726b upstream.
It seems that some laptops will report having both an eDP and LVDS connector, even though only the LVDS connector is actually hooked up. This can lead to issues with backlight registration if the eDP connector ends up getting registered before the LVDS connector, as the backlight device will then be registered to the eDP connector instead of the LVDS connector.
So, fix this by only registering the backlight on connectors that are reported as being connected.
Bugzilla: https://gitlab.freedesktop.org/drm/nouveau/-/issues/137
--- drivers/gpu/drm/nouveau/nouveau_backlight.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_backlight.c +2 -1
@@ -294,7 +294,8 @@ nv50_backlight_init(struct nouveau_backlstruct nouveau_drm *drm =nouveau_drm (nv_encoder->base.base.dev);struct nvif_object *device = &drm->client.device.object; -if (!nvif_rd32 (device,NV50_PDISP_SOR_PWM_CTL (ffs (nv_encoder->dcb->or) -1 ))) +if (!nvif_rd32 (device,NV50_PDISP_SOR_PWM_CTL (ffs (nv_encoder->dcb->or) -1 )) || + nv_conn->base.status != connector_status_connected)return -ENODEV ;if (nv_conn->type == DCB_CONNECTOR_eDP) {
Greg Kroah-Hartman
maintainerPATCH 188/1126 brcmfmac: pcie: Release firmwares in the brcmf_pcie_setup error path
In reply to Greg Kroah-HartmanFrom: Hector Martin <[email protected]>
commit 5e90f0f3ead014867dade7a22f93958119f5efab upstream.
This avoids leaking memory if brcmf_chip_get_raminfo fails. Note that the CLM blob is released in the device remove path.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +2 -0
@@ -1777,6 +1777,8 @@ static void brcmf_pcie_setup(struct devi ret =brcmf_chip_get_raminfo (devinfo->ci);if (ret) {brcmf_err (bus,"Failed to get RAM info\n" ); +release_firmware (fw); +brcmf_fw_nvram_free (nvram); goto fail; }
Greg Kroah-Hartman
maintainerPATCH 196/1126 PCI: xgene: Revert "PCI: xgene: Use inbound resources for setup"
In reply to Greg Kroah-HartmanFrom: Marc Zyngier <[email protected]>
commit 1874b6d7ab1bdc900e8398026350313ac29caddb upstream.
Commit 6dce5aa59e0b ("PCI: xgene: Use inbound resources for setup") killed PCIe on my XGene-1 box (a Mustang board). The machine itself is still alive, but half of its storage (over NVMe) is gone, and the NVMe driver just times out.
Note that this machine boots with a device tree provided by the UEFI firmware (2016 vintage), which could well be non conformant with the spec, hence the breakage.
With the patch reverted, the box boots 5.17-rc8 with flying colors.
--- drivers/pci/controller/pci-xgene.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-)
drivers/pci/controller/pci-xgene.c +22 -11
@@ -479,28 +479,27 @@ static int xgene_pcie_select_ib_reg(u8 * }static void xgene_pcie_setup_ib_reg (struct xgene_pcie *port, -struct resource_entry *entry, -u8 *ib_reg_mask) +struct of_pci_range *range,u8 *ib_reg_mask) {void __iomem *cfg_base = port->cfg_base;struct device *dev = port->dev;void __iomem *bar_addr;u32 pim_reg; -u64 cpu_addr = entry->res->start; -u64 pci_addr = cpu_addr - entry->offset; -u64 size =resource_size (entry->res); +u64 cpu_addr = range->cpu_addr; +u64 pci_addr = range->pci_addr; +u64 size = range->size;u64 mask = ~(size -1 ) |EN_REG ;u32 flags =PCI_BASE_ADDRESS_MEM_TYPE_64 ;u32 bar_low;int region; - region =xgene_pcie_select_ib_reg (ib_reg_mask, size); + region =xgene_pcie_select_ib_reg (ib_reg_mask, range->size);if (region <0 ) {dev_warn (dev,"invalid pcie dma-range config\n" );return ; } -if (entry->res->flags &IORESOURCE_PREFETCH ) +if (range->flags &IORESOURCE_PREFETCH ) flags |=PCI_BASE_ADDRESS_MEM_PREFETCH ; bar_low =pcie_bar_low_val ((u32 )cpu_addr, flags);
@@ -531,13 +530,25 @@ static void xgene_pcie_setup_ib_reg(strustatic int xgene_pcie_parse_map_dma_ranges (struct xgene_pcie *port) { -struct pci_host_bridge *bridge =pci_host_bridge_from_priv (port); -struct resource_entry *entry; +struct device_node *np = port->node; +struct of_pci_range range; +struct of_pci_range_parser parser; +struct device *dev = port->dev;u8 ib_reg_mask =0 ; -resource_list_for_each_entry (entry, &bridge->dma_ranges) -xgene_pcie_setup_ib_reg (port, entry, &ib_reg_mask); +if (of_pci_dma_range_parser_init (&parser, np)) { +dev_err (dev,"missing dma-ranges property\n" ); +return -EINVAL ; + } +/* Get the dma-ranges from DT */ +for_each_of_pci_range (&parser, &range) { +u64 end = range.cpu_addr + range.size -1 ; + +dev_dbg (dev,"0x%08x 0x%016llx..0x%016llx -> 0x%016llx\n" , + range.flags, range.cpu_addr, end, range.pci_addr); +xgene_pcie_setup_ib_reg (port, &range, &ib_reg_mask); + }return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 205/1126 crypto: kdf - Select hmac in addition to sha256
In reply to Greg Kroah-HartmanFrom: Herbert Xu <[email protected]>
[ Upstream commit a88592cc27efd4ed0ceba79016eb4a3ddb90e05e ]
In addition to sha256 we must also enable hmac for the kdf self-test to work.
--- crypto/Kconfig | 1 + 1 file changed, 1 insertion(+)
crypto/Kconfig +1 -0
@@ -1847,6 +1847,7 @@ config CRYPTO_JITTERENTROPY config CRYPTO_KDF800108_CTR tristate + select CRYPTO_HMAC select CRYPTO_SHA256 config CRYPTO_USER_API
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 207/1126 crypto: authenc - Fix sleep in atomic context in decrypt_tail
In reply to Greg Kroah-HartmanFrom: Herbert Xu <[email protected]>
[ Upstream commit 66eae850333d639fc278d6f915c6fc01499ea893 ]
The function crypto_authenc_decrypt_tail discards its flags argument and always relies on the flags from the original request when starting its sub-request.
This is clearly wrong as it may cause the SLEEPABLE flag to be set when it shouldn't.
--- crypto/authenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
crypto/authenc.c +1 -1
@@ -253,7 +253,7 @@ static int crypto_authenc_decrypt_tail(struct aead_request *req, dst =scatterwalk_ffwd (areq_ctx->dst, req->dst, req->assoclen);skcipher_request_set_tfm (skreq, ctx->enc); -skcipher_request_set_callback (skreq,aead_request_flags (req), +skcipher_request_set_callback (skreq, flags, req->base.complete, req->base.data);skcipher_request_set_crypt (skreq, src, dst, req->cryptlen - authsize, req->iv);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 182/1126 KVM: s390x: fix SCK locking
In reply to Greg Kroah-HartmanFrom: Claudio Imbrenda <[email protected]>
commit c0573ba5c5a2244dc02060b1f374d4593c1d20b7 upstream.
When handling the SCK instruction, the kvm lock is taken, even though the vcpu lock is already being held. The normal locking order is kvm lock first and then vcpu lock. This is can (and in some circumstances does) lead to deadlocks.
The function kvm_s390_set_tod_clock is called both by the SCK handler and by some IOCTLs to set the clock. The IOCTLs will not hold the vcpu lock, so they can safely take the kvm lock. The SCK handler holds the vcpu lock, but will also somehow need to acquire the kvm lock without relinquishing the vcpu lock.
The solution is to factor out the code to set the clock, and provide two wrappers. One is called like the original function and does the locking, the other is called kvm_s390_try_set_tod_clock and uses trylock to try to acquire the kvm lock. This new wrapper is then used in the SCK handler. If locking fails, -EAGAIN is returned, which is eventually propagated to userspace, thus also freeing the vcpu lock and allowing for forward progress.
This is not the most efficient or elegant way to solve this issue, but the SCK instruction is deprecated and its performance is not critical.
The goal of this patch is just to provide a simple but correct way to fix the bug.
--- arch/s390/kvm/kvm-s390.c | 19 ++++++++++++++++--- arch/s390/kvm/kvm-s390.h | 4 ++-- arch/s390/kvm/priv.c | 15 ++++++++++++++- 3 files changed, 32 insertions(+), 6 deletions(-)
arch/s390/kvm/kvm-s390.c +16 -3
@@ -3869,14 +3869,12 @@ retry:return 0 ; } -void kvm_s390_set_tod_clock (struct kvm *kvm, -const struct kvm_s390_vm_tod_clock *gtod) +static void __kvm_s390_set_tod_clock (struct kvm *kvm,const struct kvm_s390_vm_tod_clock *gtod) {struct kvm_vcpu *vcpu;union tod_clock clk;unsigned long i; -mutex_lock (&kvm->lock);preempt_disable ();store_tod_clock_ext (&clk);
@@ -3897,7 +3895,22 @@ void kvm_s390_set_tod_clock(struct kvm *kvm_s390_vcpu_unblock_all (kvm);preempt_enable (); +} + +void kvm_s390_set_tod_clock (struct kvm *kvm,const struct kvm_s390_vm_tod_clock *gtod) +{ +mutex_lock (&kvm->lock); +__kvm_s390_set_tod_clock (kvm, gtod); +mutex_unlock (&kvm->lock); +} + +int kvm_s390_try_set_tod_clock (struct kvm *kvm,const struct kvm_s390_vm_tod_clock *gtod) +{ +if (!mutex_trylock (&kvm->lock)) +return 0 ; +__kvm_s390_set_tod_clock (kvm, gtod);mutex_unlock (&kvm->lock); +return 1 ; }/**
arch/s390/kvm/kvm-s390.h +2 -2
@@ -349,8 +349,8 @@ int kvm_s390_handle_sigp(struct kvm_vcpuint kvm_s390_handle_sigp_pei (struct kvm_vcpu *vcpu);/* implemented in kvm-s390.c */ -void kvm_s390_set_tod_clock (struct kvm *kvm, -const struct kvm_s390_vm_tod_clock *gtod); +void kvm_s390_set_tod_clock (struct kvm *kvm,const struct kvm_s390_vm_tod_clock *gtod); +int kvm_s390_try_set_tod_clock (struct kvm *kvm,const struct kvm_s390_vm_tod_clock *gtod);long kvm_arch_fault_in_page (struct kvm_vcpu *vcpu,gpa_t gpa,int writable);int kvm_s390_store_status_unloaded (struct kvm_vcpu *vcpu,unsigned long addr);int kvm_s390_vcpu_store_status (struct kvm_vcpu *vcpu,unsigned long addr);
arch/s390/kvm/priv.c +14 -1
@@ -102,7 +102,20 @@ static int handle_set_clock(struct kvm_vreturn kvm_s390_inject_prog_cond (vcpu, rc);VCPU_EVENT (vcpu,3 ,"SCK: setting guest TOD to 0x%llx" , gtod.tod); -kvm_s390_set_tod_clock (vcpu->kvm, >od); +/* +* To set the TOD clock the kvm lock must be taken, but the vcpu lock +* is already held in handle_set_clock. The usual lock order is the +* opposite. As SCK is deprecated and should not be used in several +* cases, for example when the multiple epoch facility or TOD clock +* steering facility is installed (see Principles of Operation), a +* slow path can be used. If the lock can not be taken via try_lock, +* the instruction will be retried via -EAGAIN at a later point in +* time. +*/ +if (!kvm_s390_try_set_tod_clock (vcpu->kvm, >od)) { +kvm_s390_retry_instr (vcpu); +return -EAGAIN ; + }kvm_s390_set_psw_cc (vcpu,0 );return 0 ;
Greg Kroah-Hartman
maintainerPATCH 204/1126 crypto: sun8i-ss - really disable hash on A80
In reply to Greg Kroah-HartmanFrom: Corentin Labbe <[email protected]>
[ Upstream commit 881fc7fba6c3e7d77d608b9a50b01a89d5e0c61b ]
When adding hashes support to sun8i-ss, I have added them only on A83T. But I forgot that 0 is a valid algorithm ID, so hashes are enabled on A80 but with an incorrect ID.
Anyway, even with correct IDs, hashes do not work on A80 and I cannot find why.
So let's disable all of them on A80.
--- drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c +2 -0
@@ -30,6 +30,8 @@static const struct ss_variant ss_a80_variant = { .alg_cipher = {SS_ALG_AES ,SS_ALG_DES ,SS_ALG_3DES , }, + .alg_hash = {SS_ID_NOTSUPP ,SS_ID_NOTSUPP ,SS_ID_NOTSUPP ,SS_ID_NOTSUPP , + }, .op_mode = {SS_OP_ECB ,SS_OP_CBC , }, .ss_clks = {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 208/1126 crypto: octeontx2 - select CONFIG_NET_DEVLINK
In reply to Greg Kroah-HartmanFrom: Shijith Thotton <[email protected]>
[ Upstream commit 85872d1a6f38d133133784c8027d25d1c5328f4f ]
OcteonTX2 CPT driver will fail to link without devlink support.
aarch64-linux-gnu-ld: otx2_cpt_devlink.o: in function `otx2_cpt_dl_egrp_delete':
otx2_cpt_devlink.c:18: undefined reference to `devlink_priv'
aarch64-linux-gnu-ld: otx2_cpt_devlink.o: in function `otx2_cpt_dl_egrp_create':
otx2_cpt_devlink.c:9: undefined reference to `devlink_priv'
aarch64-linux-gnu-ld: otx2_cpt_devlink.o: in function `otx2_cpt_dl_uc_info':
otx2_cpt_devlink.c:27: undefined reference to `devlink_priv'
--- drivers/crypto/marvell/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/crypto/marvell/Kconfig +1 -0
@@ -47,6 +47,7 @@ config CRYPTO_DEV_OCTEONTX2_CPT select CRYPTO_SKCIPHER select CRYPTO_HASH select CRYPTO_AEAD + select NET_DEVLINK help This driver allows you to utilize the Marvell Cryptographic Accelerator Unit(CPT) found in OcteonTX2 series of processors.
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 209/1126 crypto: mxs-dcp - Fix scatterlist processing
In reply to Greg Kroah-HartmanFrom: Tomas Paukrt <[email protected]>
[ Upstream commit 28e9b6d8199a3f124682b143800c2dacdc3d70dd ]
This patch fixes a bug in scatterlist processing that may cause incorrect AES block encryption/decryption.
--- drivers/crypto/mxs-dcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/mxs-dcp.c +1 -1
@@ -331,7 +331,7 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq)memset (key +AES_KEYSIZE_128 ,0 ,AES_KEYSIZE_128 ); } -for_each_sg (req->src, src,sg_nents (src), i) { +for_each_sg (req->src, src,sg_nents (req->src), i) { src_buf =sg_virt (src); len =sg_dma_len (src); tlen += len;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 210/1126 selinux: Fix selinux_sb_mnt_opts_compat()
In reply to Greg Kroah-HartmanFrom: Scott Mayhew <[email protected]>
[ Upstream commit b8b87fd954b4b1bdd2d739c8f50bf685351a1a94 ]
selinux_sb_mnt_opts_compat() is called under the sb_lock spinlock and shouldn't be performing any memory allocations. Fix this by parsing the sids at the same time we're chopping up the security mount options string and then using the pre-parsed sids when doing the comparison.
--- security/selinux/hooks.c | 75 ++++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 34 deletions(-)
security/selinux/hooks.c +41 -34
@@ -342,6 +342,10 @@ static void inode_free_security(struct inode *inode)struct selinux_mnt_opts {const char *fscontext, *context, *rootcontext, *defcontext; +u32 fscontext_sid; +u32 context_sid; +u32 rootcontext_sid; +u32 defcontext_sid; };static void selinux_free_mnt_opts (void *mnt_opts)
@@ -598,15 +602,14 @@ static int bad_option(struct superblock_security_struct *sbsec, char flag,return 0 ; } -static int parse_sid (struct super_block *sb,const char *s,u32 *sid, -gfp_t gfp) +static int parse_sid (struct super_block *sb,const char *s,u32 *sid) {int rc =security_context_str_to_sid (&selinux_state, s, - sid, gfp); + sid,GFP_KERNEL );if (rc)pr_warn ("SELinux: security_context_str_to_sid" "(%s) failed for (dev %s, type %s) errno=%d\n" , - s, sb->s_id, sb->s_type->name, rc); + s, sb ? sb->s_id :"?" , sb ? sb->s_type->name :"?" , rc);return rc; }
@@ -673,8 +676,7 @@ static int selinux_set_mnt_opts(struct super_block *sb,*/ if (opts) {if (opts->fscontext) { - rc =parse_sid (sb, opts->fscontext, &fscontext_sid, -GFP_KERNEL ); + rc =parse_sid (sb, opts->fscontext, &fscontext_sid);if (rc) goto out; if (bad_option(sbsec, FSCONTEXT_MNT, sbsec->sid,
@@ -683,8 +685,7 @@ static int selinux_set_mnt_opts(struct super_block *sb, sbsec->flags |=FSCONTEXT_MNT ; }if (opts->context) { - rc =parse_sid (sb, opts->context, &context_sid, -GFP_KERNEL ); + rc =parse_sid (sb, opts->context, &context_sid);if (rc) goto out; if (bad_option(sbsec, CONTEXT_MNT, sbsec->mntpoint_sid,
@@ -693,8 +694,7 @@ static int selinux_set_mnt_opts(struct super_block *sb, sbsec->flags |=CONTEXT_MNT ; }if (opts->rootcontext) { - rc =parse_sid (sb, opts->rootcontext, &rootcontext_sid, -GFP_KERNEL ); + rc =parse_sid (sb, opts->rootcontext, &rootcontext_sid);if (rc) goto out; if (bad_option(sbsec, ROOTCONTEXT_MNT, root_isec->sid,
@@ -703,8 +703,7 @@ static int selinux_set_mnt_opts(struct super_block *sb, sbsec->flags |=ROOTCONTEXT_MNT ; }if (opts->defcontext) { - rc =parse_sid (sb, opts->defcontext, &defcontext_sid, -GFP_KERNEL ); + rc =parse_sid (sb, opts->defcontext, &defcontext_sid);if (rc) goto out; if (bad_option(sbsec, DEFCONTEXT_MNT, sbsec->def_sid,
@@ -996,21 +995,29 @@ static int selinux_add_opt(int token, const char *s, void **mnt_opts)if (opts->context || opts->defcontext) goto err; opts->context = s; +if (selinux_initialized (&selinux_state)) +parse_sid (NULL , s, &opts->context_sid);break ;case Opt_fscontext:if (opts->fscontext) goto err; opts->fscontext = s; +if (selinux_initialized (&selinux_state)) +parse_sid (NULL , s, &opts->fscontext_sid);break ;case Opt_rootcontext:if (opts->rootcontext) goto err; opts->rootcontext = s; +if (selinux_initialized (&selinux_state)) +parse_sid (NULL , s, &opts->rootcontext_sid);break ;case Opt_defcontext:if (opts->context || opts->defcontext) goto err; opts->defcontext = s; +if (selinux_initialized (&selinux_state)) +parse_sid (NULL , s, &opts->defcontext_sid);break ; }
@@ -2648,8 +2655,6 @@ static int selinux_sb_mnt_opts_compat(struct super_block *sb, void *mnt_opts) {struct selinux_mnt_opts *opts = mnt_opts;struct superblock_security_struct *sbsec =selinux_superblock (sb); -u32 sid; -int rc;/* * Superblock not initialized (i.e. no options) - reject if any
@@ -2666,34 +2671,36 @@ static int selinux_sb_mnt_opts_compat(struct super_block *sb, void *mnt_opts)return (sbsec->flags &SE_MNTMASK ) ?1 :0 ;if (opts->fscontext) { - rc =parse_sid (sb, opts->fscontext, &sid,GFP_NOWAIT ); -if (rc) +if (opts->fscontext_sid ==SECSID_NULL )return 1 ; -if (bad_option (sbsec,FSCONTEXT_MNT , sbsec->sid, sid)) +else if (bad_option (sbsec,FSCONTEXT_MNT , sbsec->sid, + opts->fscontext_sid))return 1 ; }if (opts->context) { - rc =parse_sid (sb, opts->context, &sid,GFP_NOWAIT ); -if (rc) +if (opts->context_sid ==SECSID_NULL )return 1 ; -if (bad_option (sbsec,CONTEXT_MNT , sbsec->mntpoint_sid, sid)) +else if (bad_option (sbsec,CONTEXT_MNT , sbsec->mntpoint_sid, + opts->context_sid))return 1 ; }if (opts->rootcontext) { -struct inode_security_struct *root_isec; - - root_isec =backing_inode_security (sb->s_root); - rc =parse_sid (sb, opts->rootcontext, &sid,GFP_NOWAIT ); -if (rc) -return 1 ; -if (bad_option (sbsec,ROOTCONTEXT_MNT , root_isec->sid, sid)) +if (opts->rootcontext_sid ==SECSID_NULL )return 1 ; +else { +struct inode_security_struct *root_isec; + + root_isec =backing_inode_security (sb->s_root); +if (bad_option (sbsec,ROOTCONTEXT_MNT , root_isec->sid, + opts->rootcontext_sid)) +return 1 ; + } }if (opts->defcontext) { - rc =parse_sid (sb, opts->defcontext, &sid,GFP_NOWAIT ); -if (rc) +if (opts->defcontext_sid ==SECSID_NULL )return 1 ; -if (bad_option (sbsec,DEFCONTEXT_MNT , sbsec->def_sid, sid)) +else if (bad_option (sbsec,DEFCONTEXT_MNT , sbsec->def_sid, + opts->defcontext_sid))return 1 ; }return 0 ;
@@ -2713,14 +2720,14 @@ static int selinux_sb_remount(struct super_block *sb, void *mnt_opts)return 0 ;if (opts->fscontext) { - rc =parse_sid (sb, opts->fscontext, &sid,GFP_KERNEL ); + rc =parse_sid (sb, opts->fscontext, &sid);if (rc)return rc;if (bad_option (sbsec,FSCONTEXT_MNT , sbsec->sid, sid)) goto out_bad_option; }if (opts->context) { - rc =parse_sid (sb, opts->context, &sid,GFP_KERNEL ); + rc =parse_sid (sb, opts->context, &sid);if (rc)return rc;if (bad_option (sbsec,CONTEXT_MNT , sbsec->mntpoint_sid, sid))
@@ -2729,14 +2736,14 @@ static int selinux_sb_remount(struct super_block *sb, void *mnt_opts)if (opts->rootcontext) {struct inode_security_struct *root_isec; root_isec =backing_inode_security (sb->s_root); - rc =parse_sid (sb, opts->rootcontext, &sid,GFP_KERNEL ); + rc =parse_sid (sb, opts->rootcontext, &sid);if (rc)return rc;if (bad_option (sbsec,ROOTCONTEXT_MNT , root_isec->sid, sid)) goto out_bad_option; }if (opts->defcontext) { - rc =parse_sid (sb, opts->defcontext, &sid,GFP_KERNEL ); + rc =parse_sid (sb, opts->defcontext, &sid);if (rc)return rc;if (bad_option (sbsec,DEFCONTEXT_MNT , sbsec->def_sid, sid))
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 211/1126 thermal: int340x: Check for NULL after calling kmemdup()
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 38b16d6cfe54c820848bcfc999bc5e8a7da1cefb ]
As the potential failure of the allocation, kmemdup() may return NULL.
Then, 'bin_attr_data_vault.private' will be NULL, but 'bin_attr_data_vault.size' is not 0, which is not consistent.
Therefore, it is better to check the return value of kmemdup() to avoid the confusion.
--- drivers/thermal/intel/int340x_thermal/int3400_thermal.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/thermal/intel/int340x_thermal/int3400_thermal.c +5 -0
@@ -468,6 +468,11 @@ static void int3400_setup_gddv(struct int3400_thermal_priv *priv) priv->data_vault =kmemdup (obj->package.elements[0 ].buffer.pointer, obj->package.elements[0 ].buffer.length,GFP_KERNEL ); +if (!priv->data_vault) { +kfree (buffer.pointer); +return ; + } + bin_attr_data_vault.private = priv->data_vault; bin_attr_data_vault.size = obj->package.elements[0 ].buffer.length;kfree (buffer.pointer);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 212/1126 crypto: octeontx2 - remove CONFIG_DM_CRYPT check
In reply to Greg Kroah-HartmanFrom: Shijith Thotton <[email protected]>
[ Upstream commit 2d841af23ae8f398c85dd1ff2dc24b5ec8ba4569 ]
No issues were found while using the driver with dm-crypt enabled. So CONFIG_DM_CRYPT check in the driver can be removed.
This also fixes the NULL pointer dereference in driver release if CONFIG_DM_CRYPT is enabled.
...
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000008 ... Call trace: crypto_unregister_alg+0x68/0xfc crypto_unregister_skciphers+0x44/0x60 otx2_cpt_crypto_exit+0x100/0x1a0 otx2_cptvf_remove+0xf8/0x200 pci_device_remove+0x3c/0xd4 __device_release_driver+0x188/0x234 device_release_driver+0x2c/0x4c
...
--- .../crypto/marvell/octeontx2/otx2_cptvf_algs.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)
drivers/crypto/marvell/octeontx2/otx2_cptvf_algs.c +7 -10
@@ -1634,16 +1634,13 @@ static inline int cpt_register_algs(void) {int i, err =0 ; -if (!IS_ENABLED (CONFIG_DM_CRYPT )) { -for (i =0 ; i <ARRAY_SIZE (otx2_cpt_skciphers); i++) - otx2_cpt_skciphers[i].base.cra_flags &= - ~CRYPTO_ALG_DEAD ; - - err =crypto_register_skciphers (otx2_cpt_skciphers, -ARRAY_SIZE (otx2_cpt_skciphers)); -if (err) -return err; - } +for (i =0 ; i <ARRAY_SIZE (otx2_cpt_skciphers); i++) + otx2_cpt_skciphers[i].base.cra_flags &= ~CRYPTO_ALG_DEAD ; + + err =crypto_register_skciphers (otx2_cpt_skciphers, +ARRAY_SIZE (otx2_cpt_skciphers)); +if (err) +return err;for (i =0 ; i <ARRAY_SIZE (otx2_cpt_aeads); i++) otx2_cpt_aeads[i].base.cra_flags &= ~CRYPTO_ALG_DEAD ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 214/1126 spi: tegra210-quad: Fix missin IRQ check in tegra_qspi_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 47c3e06ed95aa9b74932dbc6b23b544f644faf84 ]
This func misses checking for platform_get_irq()'s call and may passes the negative error codes to request_threaded_irq(), which takes unsigned IRQ #, causing it to fail with -EINVAL, overriding an original error code. Stop calling request_threaded_irq() with invalid IRQ #s.
--- drivers/spi/spi-tegra210-quad.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/spi/spi-tegra210-quad.c +2 -0
@@ -1240,6 +1240,8 @@ static int tegra_qspi_probe(struct platform_device *pdev) tqspi->phys = r->start; qspi_irq =platform_get_irq (pdev,0 ); +if (qspi_irq <0 ) +return qspi_irq; tqspi->irq = qspi_irq; tqspi->clk =devm_clk_get (&pdev->dev,"qspi" );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 181/1126 xtensa: fix xtensa_wsr always writing 0
In reply to Greg Kroah-HartmanFrom: Max Filippov <[email protected]>
commit a3d0245c58f962ee99d4440ea0eaf45fb7f5a5cc upstream.
The commit cad6fade6e78 ("xtensa: clean up WSR*/RSR*/get_sr/set_sr") replaced 'WSR' macro in the function xtensa_wsr with 'xtensa_set_sr', but variable 'v' in the xtensa_set_sr body shadowed the argument 'v' passed to it, resulting in wrong value written to debug registers.
Fix that by removing intermediate variable from the xtensa_set_sr macro body.
--- arch/xtensa/include/asm/processor.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/xtensa/include/asm/processor.h +2 -2
@@ -246,8 +246,8 @@ extern unsigned long __get_wchan(struct#define xtensa_set_sr (x, sr) \ ({ \ - unsigned int v = (unsigned int)(x); \ - __asm__ __volatile__ ("wsr %0, "__stringify(sr) :: "a"(v)); \ + __asm__ __volatile__ ("wsr %0, "__stringify(sr) :: \ + "a"((unsigned int)(x))); \ })#define xtensa_get_sr (sr) \
Greg Kroah-Hartman
maintainerPATCH 198/1126 regulator: qcom_smd: fix for_each_child.cocci warnings
In reply to Greg Kroah-HartmanFrom: kernel test robot <[email protected]>
[ Upstream commit 6390d42c21efff0b4c10956a38e341f4e84ecd3d ]
drivers/regulator/qcom_smd-regulator.c:1318:1-33: WARNING: Function "for_each_available_child_of_node" should have of_node_put() before return around line 1321.
Semantic patch information:
False positives can be due to function calls within the for_each loop that may encapsulate an of_node_put.
Generated by: scripts/coccinelle/iterators/for_each_child.cocci
--- drivers/regulator/qcom_smd-regulator.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/regulator/qcom_smd-regulator.c +3 -1
@@ -1317,8 +1317,10 @@ static int rpm_reg_probe(struct platform_device *pdev)for_each_available_child_of_node (dev->of_node, node) { vreg =devm_kzalloc (&pdev->dev,sizeof (*vreg),GFP_KERNEL ); -if (!vreg) +if (!vreg) { +of_node_put (node);return -ENOMEM ; + } ret =rpm_regulator_init_vreg (vreg, dev, node, rpm, vreg_data);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 200/1126 selinux: check return value of sel_make_avc_files
In reply to Greg Kroah-HartmanFrom: Christian Göttsche <[email protected]>
[ Upstream commit bcb62828e3e8c813b6613db6eb7fd9657db248fc ]
sel_make_avc_files() might fail and return a negative errno value on memory allocation failures. Re-add the check of the return value, dropped in 66f8e2f03c02 ("selinux: sidtab reverse lookup hash table").
Reported by clang-analyzer:
security/selinux/selinuxfs.c:2129:2: warning: Value stored to
'ret' is never read [deadcode.DeadStores]
ret = sel_make_avc_files(dentry);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
--- security/selinux/selinuxfs.c | 2 ++ 1 file changed, 2 insertions(+)
security/selinux/selinuxfs.c +2 -0
@@ -2127,6 +2127,8 @@ static int sel_fill_super(struct super_block *sb, struct fs_context *fc) } ret =sel_make_avc_files (dentry); +if (ret) + goto err; dentry =sel_make_dir (sb->s_root,"ss" , &fsi->last_ino);if (IS_ERR (dentry)) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 180/1126 xtensa: fix stop_machine_cpuslocked call in patch_text
In reply to Greg Kroah-HartmanFrom: Max Filippov <[email protected]>
commit f406f2d03e07afc199dd8cf501f361dde6be8a69 upstream.
patch_text must invoke patch_text_stop_machine on all online CPUs, but it calls stop_machine_cpuslocked with NULL cpumask. As a result only one CPU runs patch_text_stop_machine potentially leaving stale icache entries on other CPUs. Fix that by calling stop_machine_cpuslocked with cpu_online_mask as the last argument.
--- arch/xtensa/kernel/jump_label.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/xtensa/kernel/jump_label.c +1 -1
@@ -61,7 +61,7 @@ static void patch_text(unsigned long add .data = data, };stop_machine_cpuslocked (patch_text_stop_machine, - &patch,NULL ); + &patch, cpu_online_mask); }else {unsigned long flags;
Greg Kroah-Hartman
maintainerPATCH 197/1126 PCI: xgene: Revert "PCI: xgene: Fix IB window setup"
In reply to Greg Kroah-HartmanFrom: Marc Zyngier <[email protected]>
commit 825da4e9cec68713fbb02dc6f71fe1bf65fe8050 upstream.
Commit c7a75d07827a ("PCI: xgene: Fix IB window setup") tried to fix the damages that 6dce5aa59e0b ("PCI: xgene: Use inbound resources for setup") caused, but actually didn't improve anything for some plarforms (at least Mustang and m400 are still broken).
Given that 6dce5aa59e0b has been reverted, revert this patch as well, restoring the PCIe support on XGene to its pre-5.5, working state.
--- drivers/pci/controller/pci-xgene.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/pci-xgene.c +1 -1
@@ -465,7 +465,7 @@ static int xgene_pcie_select_ib_reg(u8 *return 1 ; } -if ((size >SZ_1K ) && (size <SZ_4G ) && !(*ib_reg_mask & (1 <<0 ))) { +if ((size >SZ_1K ) && (size <SZ_1T ) && !(*ib_reg_mask & (1 <<0 ))) { *ib_reg_mask |= (1 <<0 );return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 195/1126 PCI: pciehp: Clear cmd_busy bit in polling mode
In reply to Greg Kroah-HartmanFrom: Liguang Zhang <[email protected]>
commit 92912b175178c7e895f5e5e9f1e30ac30319162b upstream.
Writes to a Downstream Port's Slot Control register are PCIe hotplug "commands." If the Port supports Command Completed events, software must wait for a command to complete before writing to Slot Control again.
pcie_do_write_cmd() sets ctrl->cmd_busy when it writes to Slot Control. If software notification is enabled, i.e., PCI_EXP_SLTCTL_HPIE and PCI_EXP_SLTCTL_CCIE are set, ctrl->cmd_busy is cleared by pciehp_isr().
But when software notification is disabled, as it is when pcie_init() powers off an empty slot, pcie_wait_cmd() uses pcie_poll_cmd() to poll for command completion, and it neglects to clear ctrl->cmd_busy, which leads to spurious timeouts:
pcieport 0000:00:03.0: pciehp: Timeout on hotplug command 0x01c0 (issued 2264 msec ago) pcieport 0000:00:03.0: pciehp: Timeout on hotplug command 0x05c0 (issued 2288 msec ago)
Clear ctrl->cmd_busy in pcie_poll_cmd() when it detects a Command Completed event (PCI_EXP_SLTSTA_CC).
--- drivers/pci/hotplug/pciehp_hpc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pci/hotplug/pciehp_hpc.c +2 -0
@@ -98,6 +98,8 @@ static int pcie_poll_cmd(struct controllif (slot_status &PCI_EXP_SLTSTA_CC ) {pcie_capability_write_word (pdev,PCI_EXP_SLTSTA ,PCI_EXP_SLTSTA_CC ); + ctrl->cmd_busy =0 ; +smp_mb ();return 1 ; }msleep (10 );
Greg Kroah-Hartman
maintainerPATCH 187/1126 brcmfmac: firmware: Allocate space for default boardrev in nvram
In reply to Greg Kroah-HartmanFrom: Hector Martin <[email protected]>
commit d19d8e3ba256f81ea4a27209dbbd1f0a00ef1903 upstream.
If boardrev is missing from the NVRAM we add a default one, but this might need more space in the output buffer than was allocated. Ensure we have enough padding for this in the buffer.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +2 -0
@@ -207,6 +207,8 @@ static int brcmf_init_nvram_parser(struc size =BRCMF_FW_MAX_NVRAM_SIZE ; else size = data_len; +/* Add space for properties we may add */ + size +=strlen (BRCMF_FW_DEFAULT_BOARDREV ) +1 ;/* Alloc for extra 0 byte + roundup by 4 + length field */ size +=1 +3 +sizeof (u32); nvp->nvram =kzalloc (size,GFP_KERNEL );
Greg Kroah-Hartman
maintainerPATCH 193/1126 drm/i915/gem: add missing boundary check in vm_access
In reply to Greg Kroah-HartmanFrom: Mastan Katragadda <[email protected]>
commit 3886a86e7e6cc6ce2ce93c440fecd8f42aed0ce7 upstream.
A missing bounds check in vm_access() can lead to an out-of-bounds read or write in the adjacent memory area, since the len attribute is not validated before the memcpy later in the function, potentially hitting:
[ 183.637831] BUG: unable to handle page fault for address: ffffc90000c86000 [ 183.637934] #PF: supervisor read access in kernel mode [ 183.637997] #PF: error_code(0x0000) - not-present page [ 183.638059] PGD 100000067 P4D 100000067 PUD 100258067 PMD 106341067 PTE 0 [ 183.638144] Oops: 0000 [#2] PREEMPT SMP NOPTI [ 183.638201] CPU: 3 PID: 1790 Comm: poc Tainted: G D 5.17.0-rc6-ci-drm-11296+ #1 [ 183.638298] Hardware name: Intel Corporation CoffeeLake Client Platform/CoffeeLake H DDR4 RVP, BIOS CNLSFWR1.R00.X208.B00.1905301319 05/30/2019 [ 183.638430] RIP: 0010:memcpy_erms+0x6/0x10 [ 183.640213] RSP: 0018:ffffc90001763d48 EFLAGS: 00010246 [ 183.641117] RAX: ffff888109c14000 RBX: ffff888111bece40 RCX: 0000000000000ffc [ 183.642029] RDX: 0000000000001000 RSI: ffffc90000c86000 RDI: ffff888109c14004 [ 183.642946] RBP: 0000000000000ffc R08: 800000000000016b R09: 0000000000000000 [ 183.643848] R10: ffffc90000c85000 R11: 0000000000000048 R12: 0000000000001000 [ 183.644742] R13: ffff888111bed190 R14: ffff888109c14000 R15: 0000000000001000 [ 183.645653] FS: 00007fe5ef807540(0000) GS:ffff88845b380000(0000) knlGS:0000000000000000 [ 183.646570] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 183.647481] CR2: ffffc90000c86000 CR3: 000000010ff02006 CR4: 00000000003706e0 [ 183.648384] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 183.649271] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 183.650142] Call Trace: [ 183.650988] <TASK> [ 183.651793] vm_access+0x1f0/0x2a0 [i915] [ 183.652726] __access_remote_vm+0x224/0x380 [ 183.653561] mem_rw.isra.0+0xf9/0x190 [ 183.654402] vfs_read+0x9d/0x1b0 [ 183.655238] ksys_read+0x63/0xe0 [ 183.656065] do_syscall_64+0x38/0xc0 [ 183.656882] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 183.657663] RIP: 0033:0x7fe5ef725142 [ 183.659351] RSP: 002b:00007ffe1e81c7e8 EFLAGS: 00000246 ORIG_RAX: 0000000000000000 [ 183.660227] RAX: ffffffffffffffda RBX: 0000557055dfb780 RCX: 00007fe5ef725142 [ 183.661104] RDX: 0000000000001000 RSI: 00007ffe1e81d880 RDI: 0000000000000005 [ 183.661972] RBP: 00007ffe1e81e890 R08: 0000000000000030 R09: 0000000000000046 [ 183.662832] R10: 0000557055dfc2e0 R11: 0000000000000246 R12: 0000557055dfb1c0 [ 183.663691] R13: 00007ffe1e81e980 R14: 0000000000000000 R15: 0000000000000000
Changes since v1:
- Updated if condition with range_overflows_t [Chris Wilson]
--- drivers/gpu/drm/i915/gem/i915_gem_mman.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/gem/i915_gem_mman.c +1 -1
@@ -439,7 +439,7 @@ vm_access(struct vm_area_struct *area, ureturn -EACCES ; addr -= area->vm_start; -if (addr >= obj->base.size) +if (range_overflows_t (u64, addr, len, obj->base.size))return -EINVAL ;i915_gem_ww_ctx_init (&ww, true);
Greg Kroah-Hartman
maintainerPATCH 192/1126 drm/i915/opregion: check port number bounds for SWSCI display power state
In reply to Greg Kroah-HartmanFrom: Jani Nikula <[email protected]>
commit 24a644ebbfd3b13cda702f98907f9dd123e34bf9 upstream.
The mapping from enum port to whatever port numbering scheme is used by the SWSCI Display Power State Notification is odd, and the memory of it has faded. In any case, the parameter only has space for ports numbered [0..4], and UBSAN reports bit shift beyond it when the platform has port F or more.
Since the SWSCI functionality is supposed to be obsolete for new platforms (i.e. ones that might have port F or more), just bail out early if the mapped and mangled port number is beyond what the Display Power State Notification can support.
--- drivers/gpu/drm/i915/display/intel_opregion.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/gpu/drm/i915/display/intel_opregion.c +15 -0
@@ -375,6 +375,21 @@ int intel_opregion_notify_encoder(structreturn -EINVAL ; } +/* +* The port numbering and mapping here is bizarre. The now-obsolete +* swsci spec supports ports numbered [0..4]. Port E is handled as a +* special case, but port F and beyond are not. The functionality is +* supposed to be obsolete for new platforms. Just bail out if the port +* number is out of bounds after mapping. +*/ +if (port >4 ) { +drm_dbg_kms (&dev_priv->drm, +"[ENCODER:%d:%s] port %c (index %u) out of bounds for display power state notification\n" , + intel_encoder->base.base.id, intel_encoder->base.name, +port_name (intel_encoder->port), port); +return -EINVAL ; + } +if (!enable) parm |=4 <<8 ;
Greg Kroah-Hartman
maintainerPATCH 189/1126 brcmfmac: pcie: Declare missing firmware files in pcie.c
In reply to Greg Kroah-HartmanFrom: Hector Martin <[email protected]>
commit 6d766d8cb505ec1fae63da8faef4fc5712c3d794 upstream.
Move one of the declarations from sdio.c to pcie.c, since it makes no sense in the former (SDIO support is optional), and add missing ones.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 7 +++++++ drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 1 - 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +7 -0
@@ -59,6 +59,13 @@ BRCMF_FW_DEF(4366B, "brcmfmac4366b-pcie" BRCMF_FW_DEF(4366C, "brcmfmac4366c-pcie");BRCMF_FW_DEF (4371 ,"brcmfmac4371-pcie" ); +/* firmware config files */ +MODULE_FIRMWARE (BRCMF_FW_DEFAULT_PATH "brcmfmac*-pcie.txt" ); +MODULE_FIRMWARE (BRCMF_FW_DEFAULT_PATH "brcmfmac*-pcie.*.txt" ); + +/* per-board firmware binaries */ +MODULE_FIRMWARE (BRCMF_FW_DEFAULT_PATH "brcmfmac*-pcie.*.bin" ); +static const struct brcmf_firmware_mapping brcmf_pcie_fwnames[] = {BRCMF_FW_ENTRY (BRCM_CC_43602_CHIP_ID ,0xFFFFFFFF ,43602 ), BRCMF_FW_ENTRY(BRCM_CC_43465_CHIP_ID, 0xFFFFFFF0, 4366C),
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +0 -1
@@ -629,7 +629,6 @@ BRCMF_FW_CLM_DEF(43752, "brcmfmac43752-s/* firmware config files */ MODULE_FIRMWARE (BRCMF_FW_DEFAULT_PATH "brcmfmac*-sdio.*.txt" ); -MODULE_FIRMWARE (BRCMF_FW_DEFAULT_PATH "brcmfmac*-pcie.*.txt" );/* per-board firmware binaries */ MODULE_FIRMWARE (BRCMF_FW_DEFAULT_PATH "brcmfmac*-sdio.*.bin" );
Greg Kroah-Hartman
maintainerPATCH 179/1126 xtensa: define update_mmu_tlb function
In reply to Greg Kroah-HartmanFrom: Max Filippov <[email protected]>
commit 1c4664faa38923330d478f046dc743a00c1e2dec upstream.
Before the commit f9ce0be71d1f ("mm: Cleanup faultaround and finish_fault() codepaths") there was a call to update_mmu_cache in alloc_set_pte that used to invalidate TLB entry caching invalid PTE that caused a page fault. That commit removed that call so now invalid TLB entry survives causing repetitive page faults on the CPU that took the initial fault until that TLB entry is occasionally evicted. This issue is spotted by the xtensa TLB sanity checker.
Fix this issue by defining update_mmu_tlb function that flushes TLB entry for the faulting address.
--- arch/xtensa/include/asm/pgtable.h | 4 ++++ arch/xtensa/mm/tlb.c | 6 ++++++ 2 files changed, 10 insertions(+)
arch/xtensa/include/asm/pgtable.h +4 -0
@@ -411,6 +411,10 @@ extern void update_mmu_cache(struct vm_typedef pte_t *pte_addr_t ; +void update_mmu_tlb (struct vm_area_struct *vma, +unsigned long address,pte_t *ptep); +#define __HAVE_ARCH_UPDATE_MMU_TLB +#endif /* !defined (__ASSEMBLY__) */ #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
arch/xtensa/mm/tlb.c +6 -0
@@ -162,6 +162,12 @@ void local_flush_tlb_kernel_range(unsign } } +void update_mmu_tlb (struct vm_area_struct *vma, +unsigned long address,pte_t *ptep) +{ +local_flush_tlb_page (vma, address); +} +#ifdef CONFIG_DEBUG_TLB_SANITY static unsigned get_pte_for_vaddr (unsigned vaddr)
Greg Kroah-Hartman
maintainerPATCH 216/1126 selftests/sgx: Fix NULL-pointer-dereference upon early test failure
In reply to Greg Kroah-HartmanFrom: Reinette Chatre <[email protected]>
[ Upstream commit 2d03861e0d1d1ee81efc59338101cdd86a7474f6 ]
== Background ==
The SGX selftests track parts of the enclave binaries in an array:
encl->segment_tbl[]. That array is dynamically allocated early (but not first) in the test's lifetime. The array is referenced at the end of the test in encl_delete().
== Problem ==
encl->segment_tbl[] can be NULL if the test fails before its allocation. That leads to a NULL-pointer-dereference in encl_delete(). This is triggered during early failures of the selftest like if the enclave binary ("test_encl.elf") is deleted.
== Solution ==
Ensure encl->segment_tbl[] is valid before attempting to access its members. The offset with which it is accessed, encl->nr_segments, is initialized before encl->segment_tbl[] and thus considered valid to use after the encl->segment_tbl[] check succeeds.
--- tools/testing/selftests/sgx/load.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
tools/testing/selftests/sgx/load.c +5 -4
@@ -21,7 +21,7 @@void encl_delete (struct encl *encl) { -struct encl_segment *heap_seg = &encl->segment_tbl[encl->nr_segments -1 ]; +struct encl_segment *heap_seg;if (encl->encl_base)munmap ((void *)encl->encl_base, encl->encl_size);
@@ -32,10 +32,11 @@ void encl_delete(struct encl *encl)if (encl->fd)close (encl->fd); -munmap (heap_seg->src, heap_seg->size); - -if (encl->segment_tbl) +if (encl->segment_tbl) { + heap_seg = &encl->segment_tbl[encl->nr_segments -1 ]; +munmap (heap_seg->src, heap_seg->size);free (encl->segment_tbl); + }memset (encl,0 ,sizeof (*encl)); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 228/1126 audit: log AUDIT_TIME_* records only from rules
In reply to Greg Kroah-HartmanFrom: Richard Guy Briggs <[email protected]>
[ Upstream commit 272ceeaea355214b301530e262a0df8600bfca95 ]
AUDIT_TIME_* events are generated when there are syscall rules present that are not related to time keeping. This will produce noisy log entries that could flood the logs and hide events we really care about.
Rather than immediately produce the AUDIT_TIME_* records, store the data in the context and log it at syscall exit time respecting the filter rules.
Note: This eats the audit_buffer, unlike any others in show_special().
Please see https://bugzilla.redhat.com/show_bug.cgi?id=1991919
--- kernel/audit.h | 4 +++ kernel/auditsc.c | 87 +++++++++++++++++++++++++++++++++++++----------- 2 files changed, 71 insertions(+), 20 deletions(-)
kernel/audit.h +4 -0
@@ -201,6 +201,10 @@ struct audit_context {struct {char *name; } module; +struct { +struct audit_ntp_data ntp_data; +struct timespec64 tk_injoffset; + } time; };int fds[2 ];struct audit_proctitle proctitle;
kernel/auditsc.c +67 -20
110 lines not on this page · raw message
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 178/1126 btrfs: verify the tranisd of the to-be-written dirty extent buffer
In reply to Greg Kroah-HartmanFrom: Qu Wenruo <[email protected]>
commit 3777369ff1518b579560611a0d0c33f930154f64 upstream.
[BUG]
There is a bug report that a bitflip in the transid part of an extent buffer makes btrfs to reject certain tree blocks:
BTRFS error (device dm-0): parent transid verify failed on 1382301696 wanted 262166 found 22
[CAUSE]
Note the failed transid check, hex(262166) = 0x40016, while hex(22) = 0x16.
It's an obvious bitflip.
Furthermore, the reporter also confirmed the bitflip is from the hardware, so it's a real hardware caused bitflip, and such problem can not be detected by the existing tree-checker framework.
As tree-checker can only verify the content inside one tree block, while generation of a tree block can only be verified against its parent.
So such problem remain undetected.
[FIX]
Although tree-checker can not verify it at write-time, we still have a quick (but not the most accurate) way to catch such obvious corruption.
Function csum_one_extent_buffer() is called before we submit metadata write.
Thus it means, all the extent buffer passed in should be dirty tree blocks, and should be newer than last committed transaction.
Using that we can catch the above bitflip.
Although it's not a perfect solution, as if the corrupted generation is higher than the correct value, we have no way to catch it at all.
--- fs/btrfs/disk-io.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-)
fs/btrfs/disk-io.c +20 -6
@@ -441,17 +441,31 @@ static int csum_one_extent_buffer(structelse ret =btrfs_check_leaf_full (eb); -if (ret <0 ) { -btrfs_print_tree (eb,0 ); +if (ret <0 ) + goto error; + +/* +* Also check the generation, the eb reached here must be newer than +* last committed. Or something seriously wrong happened. +*/ +if (unlikely (btrfs_header_generation (eb) <= fs_info->last_trans_committed)) { + ret = -EUCLEAN ;btrfs_err (fs_info, -"block=%llu write time tree block corruption detected" , - eb->start); -WARN_ON (IS_ENABLED (CONFIG_BTRFS_DEBUG )); -return ret; +"block=%llu bad generation, have %llu expect > %llu" , + eb->start,btrfs_header_generation (eb), + fs_info->last_trans_committed); + goto error; }write_extent_buffer (eb, result,0 , fs_info->csum_size);return 0 ; + +error: +btrfs_print_tree (eb,0 ); +btrfs_err (fs_info,"block=%llu write time tree block corruption detected" , + eb->start); +WARN_ON (IS_ENABLED (CONFIG_BTRFS_DEBUG )); +return ret; }/* Checksum all dirty extent buffers in one bio_vec */
Greg Kroah-Hartman
maintainerPATCH 225/1126 selftests/sgx: Treat CC as one argument
In reply to Greg Kroah-HartmanFrom: Muhammad Usama Anjum <[email protected]>
[ Upstream commit 6170abb21e2380477080b25145da9747ad467d3d ]
CC can have multiple sub-strings like "ccache gcc". For check_cc.sh, CC needs to be treated like one argument. Put double quotes around it to make CC one string and hence one argument.
--- tools/testing/selftests/sgx/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/sgx/Makefile +1 -1
@@ -4,7 +4,7 @@ include ../lib.mk .PHONY: all clean -CAN_BUILD_X86_64 := $(shell ../x86/check_cc.sh $(CC) \ +CAN_BUILD_X86_64 := $(shell ../x86/check_cc.sh "$(CC)" \ ../x86/trivial_64bit_program.c) ifndef OBJCOPY
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 227/1126 block: update io_ticks when io hang
In reply to Greg Kroah-HartmanFrom: Zhang Wensheng <[email protected]>
[ Upstream commit 86d7331299fda7634b11c1b7c911432679d525a5 ]
When the inflight IOs are slow and no new IOs are issued, we expect iostat could manifest the IO hang problem. However after commit 5b18b5a73760 ("block: delete part_round_stats and switch to less precise counting"), io_tick and time_in_queue will not be updated until the end of IO, and the avgqu-sz and %util columns of iostat will be zero.
Because it has using stat.nsecs accumulation to express time_in_queue which is not suitable to change, and may %util will express the status better when io hang occur. To fix io_ticks, we use update_io_ticks and inflight to update io_ticks when diskstats_show and part_stat_show been called.
--- block/genhd.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
block/genhd.c +12 -2
@@ -927,12 +927,17 @@ ssize_t part_stat_show(struct device *dev,struct disk_stats stat;unsigned int inflight; -part_stat_read_all (bdev, &stat);if (queue_is_mq (q)) inflight =blk_mq_in_flight (q, bdev);else inflight =part_in_flight (bdev); +if (inflight) { +part_stat_lock (); +update_io_ticks (bdev, jiffies, true); +part_stat_unlock (); + } +part_stat_read_all (bdev, &stat);return sprintf (buf,"%8lu %8lu %8llu %8u " "%8lu %8lu %8llu %8u "
@@ -1188,12 +1193,17 @@ static int diskstats_show(struct seq_file *seqf, void *v)xa_for_each (&gp->part_tbl, idx, hd) {if (bdev_is_partition (hd) && !bdev_nr_sectors (hd))continue ; -part_stat_read_all (hd, &stat);if (queue_is_mq (gp->queue)) inflight =blk_mq_in_flight (gp->queue, hd);else inflight =part_in_flight (hd); +if (inflight) { +part_stat_lock (); +update_io_ticks (hd, jiffies, true); +part_stat_unlock (); + } +part_stat_read_all (hd, &stat);seq_printf (seqf,"%4d %7d %pg " "%lu %lu %lu %u " "%lu %lu %lu %u "
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 231/1126 crypto: hisilicon/sec - fix the aead software fallback for engine
In reply to Greg Kroah-HartmanFrom: Kai Ye <[email protected]>
[ Upstream commit 0a2a464f863187f97e96ebc6384c052cafd4a54c ]
Due to the subreq pointer misuse the private context memory. The aead soft crypto occasionally casues the OS panic as setting the 64K page. Here is fix it.
--- drivers/crypto/hisilicon/sec2/sec_crypto.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/crypto/hisilicon/sec2/sec_crypto.c +13 -3
@@ -2284,9 +2284,10 @@ static int sec_aead_soft_crypto(struct sec_ctx *ctx, struct aead_request *aead_req, bool encrypt) { -struct aead_request *subreq =aead_request_ctx (aead_req);struct sec_auth_ctx *a_ctx = &ctx->a_ctx;struct device *dev = ctx->dev; +struct aead_request *subreq; +int ret;/* Kunpeng920 aead mode not support input 0 size */ if (!a_ctx->fallback_aead_tfm) {
@@ -2294,6 +2295,10 @@ static int sec_aead_soft_crypto(struct sec_ctx *ctx,return -EINVAL ; } + subreq =aead_request_alloc (a_ctx->fallback_aead_tfm,GFP_KERNEL ); +if (!subreq) +return -ENOMEM ; +aead_request_set_tfm (subreq, a_ctx->fallback_aead_tfm);aead_request_set_callback (subreq, aead_req->base.flags, aead_req->base.complete, aead_req->base.data);
@@ -2301,8 +2306,13 @@ static int sec_aead_soft_crypto(struct sec_ctx *ctx, aead_req->cryptlen, aead_req->iv);aead_request_set_ad (subreq, aead_req->assoclen); -return encrypt ?crypto_aead_encrypt (subreq) : -crypto_aead_decrypt (subreq); +if (encrypt) + ret =crypto_aead_encrypt (subreq); +else + ret =crypto_aead_decrypt (subreq); +aead_request_free (subreq); + +return ret; }static int sec_aead_crypto (struct aead_request *a_req,bool encrypt)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 233/1126 hwmon: (pmbus) Add mutex to regulator ops
In reply to Greg Kroah-HartmanFrom: Patrick Rudolph <[email protected]>
[ Upstream commit 686d303ee6301261b422ea51e64833d7909a2c36 ]
On PMBUS devices with multiple pages, the regulator ops need to be protected with the update mutex. This prevents accidentally changing the page in a separate thread while operating on the PMBUS_OPERATION register.
Tested on Infineon xdpe11280 while a separate thread polls for sensor data.
--- drivers/hwmon/pmbus/pmbus_core.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/hwmon/pmbus/pmbus_core.c +13 -3
@@ -2391,10 +2391,14 @@ static int pmbus_regulator_is_enabled(struct regulator_dev *rdev) {struct device *dev =rdev_get_dev (rdev);struct i2c_client *client =to_i2c_client (dev->parent); +struct pmbus_data *data =i2c_get_clientdata (client);u8 page =rdev_get_id (rdev);int ret; +mutex_lock (&data->update_lock); ret =pmbus_read_byte_data (client, page,PMBUS_OPERATION ); +mutex_unlock (&data->update_lock); +if (ret <0 )return ret;
@@ -2405,11 +2409,17 @@ static int _pmbus_regulator_on_off(struct regulator_dev *rdev, bool enable) {struct device *dev =rdev_get_dev (rdev);struct i2c_client *client =to_i2c_client (dev->parent); +struct pmbus_data *data =i2c_get_clientdata (client);u8 page =rdev_get_id (rdev); +int ret; -return pmbus_update_byte_data (client, page,PMBUS_OPERATION , -PB_OPERATION_CONTROL_ON , - enable ?PB_OPERATION_CONTROL_ON :0 ); +mutex_lock (&data->update_lock); + ret =pmbus_update_byte_data (client, page,PMBUS_OPERATION , +PB_OPERATION_CONTROL_ON , + enable ?PB_OPERATION_CONTROL_ON :0 ); +mutex_unlock (&data->update_lock); + +return ret; }static int pmbus_regulator_enable (struct regulator_dev *rdev)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 232/1126 spi: pxa2xx-pci: Balance reference count for PCI DMA device
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 609d7ffdc42199a0ec949db057e3b4be6745d6c5 ]
The pci_get_slot() increases its reference count, the caller must decrement the reference count by calling pci_dev_put().
--- drivers/spi/spi-pxa2xx-pci.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/spi/spi-pxa2xx-pci.c +16 -1
@@ -76,14 +76,23 @@ static bool lpss_dma_filter(struct dma_chan *chan, void *param)return true; } +static void lpss_dma_put_device (void *dma_dev) +{ +pci_dev_put (dma_dev); +} +static int lpss_spi_setup (struct pci_dev *dev,struct pxa_spi_info *c) {struct pci_dev *dma_dev; +int ret; c->num_chipselect =1 ; c->max_clk_rate =50000000 ; dma_dev =pci_get_slot (dev->bus,PCI_DEVFN (PCI_SLOT (dev->devfn),0 )); + ret =devm_add_action_or_reset (&dev->dev, lpss_dma_put_device, dma_dev); +if (ret) +return ret;if (c->tx_param) {struct dw_dma_slave *slave = c->tx_param;
@@ -107,8 +116,9 @@ static int lpss_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c)static int mrfld_spi_setup (struct pci_dev *dev,struct pxa_spi_info *c) { -struct pci_dev *dma_dev =pci_get_slot (dev->bus,PCI_DEVFN (21 ,0 ));struct dw_dma_slave *tx, *rx; +struct pci_dev *dma_dev; +int ret;switch (PCI_FUNC (dev->devfn)) {case 0 :
@@ -133,6 +143,11 @@ static int mrfld_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c)return -ENODEV ; } + dma_dev =pci_get_slot (dev->bus,PCI_DEVFN (21 ,0 )); + ret =devm_add_action_or_reset (&dev->dev, lpss_dma_put_device, dma_dev); +if (ret) +return ret; + tx = c->tx_param; tx->dma_dev = &dma_dev->dev;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 234/1126 hwmon: (sch56xx-common) Replace WDOG_ACTIVE with WDOG_HW_RUNNING
In reply to Greg Kroah-HartmanFrom: Armin Wolf <[email protected]>
[ Upstream commit 647d6f09bea7dacf4cdb6d4ea7e3051883955297 ]
If the watchdog was already enabled by the BIOS after booting, the watchdog infrastructure needs to regularly send keepalives to prevent a unexpected reset.WDOG_ACTIVE only serves as an status indicator for userspace, we want to use WDOG_HW_RUNNING instead.
Since my Fujitsu Esprimo P720 does not support the watchdog, this change is compile-tested only.
--- drivers/hwmon/sch56xx-common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/sch56xx-common.c +1 -1
@@ -422,7 +422,7 @@ void sch56xx_watchdog_register(struct device *parent, u16 addr, u32 revision, data->wddev.max_timeout =255 *60 ;watchdog_set_nowayout (&data->wddev, nowayout);if (output_enable &SCH56XX_WDOG_OUTPUT_ENABLE ) -set_bit (WDOG_ACTIVE , &data->wddev.status); +set_bit (WDOG_HW_RUNNING , &data->wddev.status);/* Since the watchdog uses a downcounter there is no register to read the BIOS set timeout from (if any was set at all) ->
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 217/1126 selftests/sgx: Do not attempt enclave build without valid enclave
In reply to Greg Kroah-HartmanFrom: Reinette Chatre <[email protected]>
[ Upstream commit fff36bcbfde1126f6b81cb8ee12a58aada17ca29 ]
It is not possible to build an enclave if it was not possible to load the binary from which it should be constructed. Do not attempt to make further progress but instead return with failure. A "return false" from setup_test_encl() is expected to trip an ASSERT_TRUE() and abort the rest of the test.
--- tools/testing/selftests/sgx/main.c | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/sgx/main.c +1 -0
@@ -147,6 +147,7 @@ static bool setup_test_encl(unsigned long heap_size, struct encl *encl,if (!encl_load ("test_encl.elf" , encl, heap_size)) {encl_delete (encl);TH_LOG ("Failed to load the test enclave.\n" ); +return false; }if (!encl_measure (encl))
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 235/1126 nvme: cleanup __nvme_check_ids
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
[ Upstream commit fd8099e7918cd2df39ef306dd1d1af7178a15b81 ]
Pass the actual nvme_ns_ids used for the comparison instead of the ns_head that isn't needed and use a more descriptive function name.
--- drivers/nvme/host/core.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/nvme/host/core.c +4 -5
@@ -3598,16 +3598,15 @@ static struct nvme_ns_head *nvme_find_ns_head(struct nvme_subsystem *subsys,return NULL ; } -static int __nvme_check_ids (struct nvme_subsystem *subsys, -struct nvme_ns_head *new) +static int nvme_subsys_check_duplicate_ids (struct nvme_subsystem *subsys, +struct nvme_ns_ids *ids) {struct nvme_ns_head *h;lockdep_assert_held (&subsys->lock);list_for_each_entry (h, &subsys->nsheads, entry) { -if (nvme_ns_ids_valid (&new->ids) && -nvme_ns_ids_equal (&new->ids, &h->ids)) +if (nvme_ns_ids_valid (ids) &&nvme_ns_ids_equal (ids, &h->ids))return -EINVAL ; }
@@ -3706,7 +3705,7 @@ static struct nvme_ns_head *nvme_alloc_ns_head(struct nvme_ctrl *ctrl, head->ids = *ids;kref_init (&head->ref); - ret =__nvme_check_ids (ctrl->subsys, head); + ret =nvme_subsys_check_duplicate_ids (ctrl->subsys, &head->ids);if (ret) {dev_err (ctrl->device,"duplicate IDs for nsid %d\n" , nsid);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 237/1126 block: dont delete queue kobject before its children
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
[ Upstream commit 0f69288253e9fc7c495047720e523b9f1aba5712 ]
kobjects aren't supposed to be deleted before their child kobjects are deleted. Apparently this is usually benign; however, a WARN will be triggered if one of the child kobjects has a named attribute group:
sysfs group 'modes' not found for kobject 'crypto'
WARNING: CPU: 0 PID: 1 at fs/sysfs/group.c:278 sysfs_remove_group+0x72/0x80
...
Call Trace:
sysfs_remove_groups+0x29/0x40 fs/sysfs/group.c:312
__kobject_del+0x20/0x80 lib/kobject.c:611
kobject_cleanup+0xa4/0x140 lib/kobject.c:696
kobject_release lib/kobject.c:736 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x53/0x70 lib/kobject.c:753
blk_crypto_sysfs_unregister+0x10/0x20 block/blk-crypto-sysfs.c:159
blk_unregister_queue+0xb0/0x110 block/blk-sysfs.c:962
del_gendisk+0x117/0x250 block/genhd.c:610Fix this by moving the kobject_del() and the corresponding kobject_uevent() to the correct place.
--- block/blk-sysfs.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
block/blk-sysfs.c +5 -3
@@ -954,9 +954,6 @@ void blk_unregister_queue(struct gendisk *disk)*/ if (queue_is_mq (q))blk_mq_unregister_dev (disk_to_dev (disk), q); - -kobject_uevent (&q->kobj,KOBJ_REMOVE ); -kobject_del (&q->kobj);blk_trace_remove_sysfs (disk_to_dev (disk));mutex_lock (&q->sysfs_lock);
@@ -964,6 +961,11 @@ void blk_unregister_queue(struct gendisk *disk)elv_unregister_queue (q);disk_unregister_independent_access_ranges (disk);mutex_unlock (&q->sysfs_lock); + +/* Now that we've deleted all child objects, we can delete the queue. */ +kobject_uevent (&q->kobj,KOBJ_REMOVE ); +kobject_del (&q->kobj); +mutex_unlock (&q->sysfs_dir_lock);kobject_put (&disk_to_dev (disk)->kobj);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 238/1126 PM: hibernate: fix __setup handler error handling
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit ba7ffcd4c4da374b0f64666354eeeda7d3827131 ]
If an invalid value is used in "resumedelay=<seconds>", it is silently ignored. Add a warning message and then let the __setup handler return 1 to indicate that the kernel command line option has been handled.
--- kernel/power/hibernate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/power/hibernate.c +1 -1
@@ -1328,7 +1328,7 @@ static int __init resumedelay_setup(char *str)int rc =kstrtouint (str,0 , &resume_delay);if (rc) -return rc; +pr_warn ("resumedelay: bad option string '%s'\n" , str);return 1 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 240/1126 spi: spi-zynqmp-gqspi: Handle error for dma_set_mask
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 13262fc26c1837c51a5131dbbdd67a2387f8bfc7 ]
As the potential failure of the dma_set_mask(),
it should be better to check it and return error
if fails.
--- drivers/spi/spi-zynqmp-gqspi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/spi/spi-zynqmp-gqspi.c +4 -1
@@ -1172,7 +1172,10 @@ static int zynqmp_qspi_probe(struct platform_device *pdev) goto clk_dis_all; } -dma_set_mask (&pdev->dev,DMA_BIT_MASK (44 )); + ret =dma_set_mask (&pdev->dev,DMA_BIT_MASK (44 )); +if (ret) + goto clk_dis_all; + ctlr->bits_per_word_mask =SPI_BPW_MASK (8 ); ctlr->num_chipselect =GQSPI_DEFAULT_NUM_CS ; ctlr->mem_ops = &zynqmp_qspi_mem_ops;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 243/1126 crypto: sun8i-ce - call finalize with bh disabled
In reply to Greg Kroah-HartmanFrom: Corentin Labbe <[email protected]>
[ Upstream commit f75a749b6d78aeae2ce90e14fcc4b7b3ba46126d ]
Doing ipsec produces a spinlock recursion warning.
This is due to not disabling BH during crypto completion function.
--- drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c | 3 +++ drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c | 3 +++ 2 files changed, 6 insertions(+)
drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c +3 -0
@@ -11,6 +11,7 @@* You could find a link for the datasheet in Documentation/arm/sunxi.rst */ +#include <linux/bottom_half.h> #include <linux/crypto.h> #include <linux/dma-mapping.h> #include <linux/io.h>
@@ -283,7 +284,9 @@ static int sun8i_ce_cipher_run(struct crypto_engine *engine, void *areq) flow = rctx->flow; err =sun8i_ce_run_task (ce, flow,crypto_tfm_alg_name (breq->base.tfm)); +local_bh_disable ();crypto_finalize_skcipher_request (engine, breq, err); +local_bh_enable ();return 0 ; }
drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c +3 -0
@@ -9,6 +9,7 @@* * You could find the datasheet in Documentation/arm/sunxi.rst */ +#include <linux/bottom_half.h> #include <linux/dma-mapping.h> #include <linux/pm_runtime.h> #include <linux/scatterlist.h>
@@ -414,6 +415,8 @@ int sun8i_ce_hash_run(struct crypto_engine *engine, void *breq) theend:kfree (buf);kfree (result); +local_bh_disable ();crypto_finalize_hash_request (engine, breq, err); +local_bh_enable ();return 0 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 242/1126 crypto: sun8i-ss - call finalize with bh disabled
In reply to Greg Kroah-HartmanFrom: Corentin Labbe <[email protected]>
[ Upstream commit b169b3766242b6f3336e24a6c8ee1522978b57a7 ]
Doing ipsec produces a spinlock recursion warning.
This is due to not disabling BH during crypto completion function.
--- drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c | 3 +++ drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c | 3 +++ 2 files changed, 6 insertions(+)
drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c +3 -0
@@ -11,6 +11,7 @@* You could find a link for the datasheet in Documentation/arm/sunxi.rst */ +#include <linux/bottom_half.h> #include <linux/crypto.h> #include <linux/dma-mapping.h> #include <linux/io.h>
@@ -274,7 +275,9 @@ static int sun8i_ss_handle_cipher_request(struct crypto_engine *engine, void *ar struct skcipher_request *breq = container_of(areq, struct skcipher_request, base); err =sun8i_ss_cipher (breq); +local_bh_disable ();crypto_finalize_skcipher_request (engine, breq, err); +local_bh_enable ();return 0 ; }
drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c +3 -0
@@ -9,6 +9,7 @@* * You could find the datasheet in Documentation/arm/sunxi.rst */ +#include <linux/bottom_half.h> #include <linux/dma-mapping.h> #include <linux/pm_runtime.h> #include <linux/scatterlist.h>
@@ -442,6 +443,8 @@ int sun8i_ss_hash_run(struct crypto_engine *engine, void *breq) theend:kfree (pad);kfree (result); +local_bh_disable ();crypto_finalize_hash_request (engine, breq, err); +local_bh_enable ();return 0 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 241/1126 hwrng: atmel - disable trng on failure path
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
[ Upstream commit a223ea9f89ab960eb254ba78429efd42eaf845eb ]
Call atmel_trng_disable() on failure path of probe.
--- drivers/char/hw_random/atmel-rng.c | 1 + 1 file changed, 1 insertion(+)
drivers/char/hw_random/atmel-rng.c +1 -0
@@ -114,6 +114,7 @@ static int atmel_trng_probe(struct platform_device *pdev) err_register:clk_disable_unprepare (trng->clk); +atmel_trng_disable (trng);return ret; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 239/1126 PM: suspend: fix return value of __setup handler
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 7a64ca17e4dd50d5f910769167f3553902777844 ]
If an invalid option is given for "test_suspend=<option>", the entire string is added to init's environment, so return 1 instead of 0 from the __setup handler.
Unknown kernel command line parameters "BOOT_IMAGE=/boot/bzImage-517rc5
test_suspend=invalid"
and
Run /sbin/init as init process
with arguments:
/sbin/init
with environment:
HOME=/
TERM=linux
BOOT_IMAGE=/boot/bzImage-517rc5
test_suspend=invalid--- kernel/power/suspend_test.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/power/suspend_test.c +4 -4
@@ -157,22 +157,22 @@ static int __init setup_test_suspend(char *value) value++; suspend_type =strsep (&value,"," );if (!suspend_type) -return 0 ; +return 1 ; repeat =strsep (&value,"," );if (repeat) {if (kstrtou32 (repeat,0 , &test_repeat_count_max)) -return 0 ; +return 1 ; }for (i =PM_SUSPEND_MIN ; i <PM_SUSPEND_MAX ; i++)if (!strcmp (pm_labels[i], suspend_type)) { test_state_label = pm_labels[i]; -return 0 ; +return 1 ; }printk (warn_bad_state, suspend_type); -return 0 ; +return 1 ; }__setup ("test_suspend" , setup_test_suspend);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 236/1126 nvme: fix the check for duplicate unique identifiers
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
[ Upstream commit e2724cb9f0c406b8fb66efd3aa9e8b3edfd8d5c8 ]
nvme_subsys_check_duplicate_ids should needs to return an error if any of the identifiers matches, not just if all of them match. But it does not need to and should not look at the CSI value for this sanity check.
Rewrite the logic to be separate from nvme_ns_ids_equal and optimize it by reducing duplicate checks for non-present identifiers.
--- drivers/nvme/host/core.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
drivers/nvme/host/core.c +10 -8
@@ -1683,13 +1683,6 @@ static void nvme_config_discard(struct gendisk *disk, struct nvme_ns *ns)blk_queue_max_write_zeroes_sectors (queue,UINT_MAX ); } -static bool nvme_ns_ids_valid (struct nvme_ns_ids *ids) -{ -return !uuid_is_null (&ids->uuid) || -memchr_inv (ids->nguid,0 ,sizeof (ids->nguid)) || -memchr_inv (ids->eui64,0 ,sizeof (ids->eui64)); -} -static bool nvme_ns_ids_equal (struct nvme_ns_ids *a,struct nvme_ns_ids *b) { return uuid_equal(&a->uuid, &b->uuid) &&
@@ -3601,12 +3594,21 @@ static struct nvme_ns_head *nvme_find_ns_head(struct nvme_subsystem *subsys,static int nvme_subsys_check_duplicate_ids (struct nvme_subsystem *subsys,struct nvme_ns_ids *ids) { +bool has_uuid = !uuid_is_null (&ids->uuid); +bool has_nguid =memchr_inv (ids->nguid,0 ,sizeof (ids->nguid)); +bool has_eui64 =memchr_inv (ids->eui64,0 ,sizeof (ids->eui64));struct nvme_ns_head *h;lockdep_assert_held (&subsys->lock);list_for_each_entry (h, &subsys->nsheads, entry) { -if (nvme_ns_ids_valid (ids) &&nvme_ns_ids_equal (ids, &h->ids)) +if (has_uuid &&uuid_equal (&ids->uuid, &h->ids.uuid)) +return -EINVAL ; +if (has_nguid && +memcmp (&ids->nguid, &h->ids.nguid,sizeof (ids->nguid)) ==0 ) +return -EINVAL ; +if (has_eui64 && +memcmp (&ids->eui64, &h->ids.eui64,sizeof (ids->eui64)) ==0 )return -EINVAL ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 244/1126 crypto: amlogic - call finalize with bh disabled
In reply to Greg Kroah-HartmanFrom: Corentin Labbe <[email protected]>
[ Upstream commit dba633342994ce47d347bcf5522ba28301247b79 ]
Doing ipsec produces a spinlock recursion warning.
This is due to not disabling BH during crypto completion function.
--- drivers/crypto/amlogic/amlogic-gxl-cipher.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/crypto/amlogic/amlogic-gxl-cipher.c +2 -0
@@ -265,7 +265,9 @@ static int meson_handle_cipher_request(struct crypto_engine *engine, struct skcipher_request *breq = container_of(areq, struct skcipher_request, base); err =meson_cipher (breq); +local_bh_disable ();crypto_finalize_skcipher_request (engine, breq, err); +local_bh_enable ();return 0 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 230/1126 crypto: ccree - dont attempt 0 len DMA mappings
In reply to Greg Kroah-HartmanFrom: Gilad Ben-Yossef <[email protected]>
[ Upstream commit 1fb37b5692c915edcc2448a6b37255738c7c77e0 ]
Refuse to try mapping zero bytes as this may cause a fault on some configurations / platforms and it seems the prev. attempt is not enough and we need to be more explicit.
scatterlists")
--- drivers/crypto/ccree/cc_buffer_mgr.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/crypto/ccree/cc_buffer_mgr.c +7 -0
@@ -258,6 +258,13 @@ static int cc_map_sg(struct device *dev, struct scatterlist *sg, {int ret =0 ; +if (!nbytes) { + *mapped_nents =0 ; + *lbytes =0 ; + *nents =0 ; +return 0 ; + } + *nents =cc_get_sgl_nents (dev, sg, nbytes, lbytes);if (*nents > max_sg_nents) { *nents =0 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 229/1126 EVM: fix the evm= __setup handler return value
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit f2544f5e6c691679d56bb38637d2f347075b36fa ]
__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 string "evm=fix" causes an Unknown parameter message:
Unknown kernel command line parameters "BOOT_IMAGE=/boot/bzImage-517rc5 evm=fix", will be passed to user space.
and that string is 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
evm=fixWith this change, using "evm=fix" acts as expected and an invalid option ("evm=evm") causes a warning to be printed:
evm: invalid "evm" mode
but init's environment is not polluted with this string, as expected.
--- security/integrity/evm/evm_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/integrity/evm/evm_main.c +1 -1
@@ -86,7 +86,7 @@ static int __init evm_set_fixmode(char *str)else pr_err ("invalid \"%s\" mode" , str); -return 0 ; +return 1 ; }__setup ("evm=" , evm_set_fixmode);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 226/1126 crypto: rockchip - ECB does not need IV
In reply to Greg Kroah-HartmanFrom: Corentin Labbe <[email protected]>
[ Upstream commit 973d74e93820d99d8ea203882631c76edab699c9 ]
When loading rockchip crypto module, testmgr complains that ivsize of ecb-des3-ede-rk is not the same than generic implementation.
In fact ECB does not use an IV.
--- drivers/crypto/rockchip/rk3288_crypto_skcipher.c | 1 - 1 file changed, 1 deletion(-)
drivers/crypto/rockchip/rk3288_crypto_skcipher.c +0 -1
@@ -506,7 +506,6 @@ struct rk_crypto_tmp rk_ecb_des3_ede_alg = { .exit = rk_ablk_exit_tfm, .min_keysize = DES3_EDE_KEY_SIZE, .max_keysize = DES3_EDE_KEY_SIZE, - .ivsize = DES_BLOCK_SIZE, .setkey = rk_tdes_setkey, .encrypt = rk_des3_ede_ecb_encrypt, .decrypt = rk_des3_ede_ecb_decrypt,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 218/1126 selftests/sgx: Ensure enclave data available during debug print
In reply to Greg Kroah-HartmanFrom: Reinette Chatre <[email protected]>
[ Upstream commit 2db703fc3b15e7ef68c82eca613a3c00d43d70af ]
In support of debugging the SGX tests print details from the enclave and its memory mappings if any failure is encountered during enclave loading.
When a failure is encountered no data is printed because the printing of the data is preceded by cleanup of the data.
Move the data cleanup after the data print.
--- tools/testing/selftests/sgx/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/sgx/main.c +2 -2
@@ -186,8 +186,6 @@ static bool setup_test_encl(unsigned long heap_size, struct encl *encl,return true; err: -encl_delete (encl); -for (i =0 ; i < encl->nr_segments; i++) { seg = &encl->segment_tbl[i];
@@ -208,6 +206,8 @@ static bool setup_test_encl(unsigned long heap_size, struct encl *encl,TH_LOG ("Failed to initialize the test enclave.\n" ); +encl_delete (encl); +return false; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 245/1126 crypto: gemini - call finalize with bh disabled
In reply to Greg Kroah-HartmanFrom: Corentin Labbe <[email protected]>
[ Upstream commit 7f22421103c5a7f9a1726f0ed125274c38174ddb ]
Doing ipsec produces a spinlock recursion warning.
This is due to not disabling BH during crypto completion function.
--- drivers/crypto/gemini/sl3516-ce-cipher.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/crypto/gemini/sl3516-ce-cipher.c +2 -0
@@ -264,7 +264,9 @@ static int sl3516_ce_handle_cipher_request(struct crypto_engine *engine, void *a struct skcipher_request *breq = container_of(areq, struct skcipher_request, base); err =sl3516_ce_cipher (breq); +local_bh_disable ();crypto_finalize_skcipher_request (engine, breq, err); +local_bh_enable ();return 0 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 246/1126 crypto: vmx - add missing dependencies
In reply to Greg Kroah-HartmanFrom: Petr Vorel <[email protected]>
[ Upstream commit 647d41d3952d726d4ae49e853a9eff68ebad3b3f ]
vmx-crypto module depends on CRYPTO_AES, CRYPTO_CBC, CRYPTO_CTR or CRYPTO_XTS, thus add them.
These dependencies are likely to be enabled, but if CRYPTO_DEV_VMX=y && !CRYPTO_MANAGER_DISABLE_TESTS
and either of CRYPTO_AES, CRYPTO_CBC, CRYPTO_CTR or CRYPTO_XTS is built as module or disabled, alg_test() from crypto/testmgr.c complains during boot about failing to allocate the generic fallback implementations (2 == ENOENT):
[ 0.540953] Failed to allocate xts(aes) fallback: -2 [ 0.541014] alg: skcipher: failed to allocate transform for p8_aes_xts: -2 [ 0.541120] alg: self-tests for p8_aes_xts (xts(aes)) failed (rc=-2) [ 0.544440] Failed to allocate ctr(aes) fallback: -2 [ 0.544497] alg: skcipher: failed to allocate transform for p8_aes_ctr: -2 [ 0.544603] alg: self-tests for p8_aes_ctr (ctr(aes)) failed (rc=-2) [ 0.547992] Failed to allocate cbc(aes) fallback: -2 [ 0.548052] alg: skcipher: failed to allocate transform for p8_aes_cbc: -2 [ 0.548156] alg: self-tests for p8_aes_cbc (cbc(aes)) failed (rc=-2) [ 0.550745] Failed to allocate transformation for 'aes': -2 [ 0.550801] alg: cipher: Failed to load transform for p8_aes: -2 [ 0.550892] alg: self-tests for p8_aes (aes) failed (rc=-2)
--- drivers/crypto/vmx/Kconfig | 4 ++++ 1 file changed, 4 insertions(+)
drivers/crypto/vmx/Kconfig +4 -0
@@ -2,7 +2,11 @@ config CRYPTO_DEV_VMX_ENCRYPT tristate "Encryption acceleration support on P8 CPU" depends on CRYPTO_DEV_VMX + select CRYPTO_AES + select CRYPTO_CBC + select CRYPTO_CTR select CRYPTO_GHASH + select CRYPTO_XTS default m help Support for VMX cryptographic acceleration instructions on Power8 CPU.
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 249/1126 clocksource/drivers/timer-microchip-pit64b: Use notrace
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
[ Upstream commit ff10ee97cb203262e88d9c8bc87369cbd4004a0c ]
Use notrace for mchp_pit64b_sched_read_clk() to avoid recursive call of prepare_ftrace_return() when issuing:
echo function_graph > /sys/kernel/debug/tracing/current_tracer
--- drivers/clocksource/timer-microchip-pit64b.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clocksource/timer-microchip-pit64b.c +1 -1
@@ -165,7 +165,7 @@ static u64 mchp_pit64b_clksrc_read(struct clocksource *cs)return mchp_pit64b_cnt_read (mchp_pit64b_cs_base); } -static u64 mchp_pit64b_sched_read_clk (void ) +static u64 notrace mchp_pit64b_sched_read_clk(void) {return mchp_pit64b_cnt_read (mchp_pit64b_cs_base); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 248/1126 clocksource/drivers/exynos_mct: Handle DTS with higher number of interrupts
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit ab8da93dc06d82f464c47ab30e6c75190702f369 ]
The driver statically defines maximum number of interrupts it can handle, however it does not respect that limit when configuring them. When provided with a DTS with more interrupts than assumed, the driver will overwrite static array mct_irqs leading to silent memory corruption.
Validate the interrupts coming from DTS to avoid this. This does not change the fact that such DTS might not boot at all, because it is simply incompatible, however at least some warning will be printed.
--- drivers/clocksource/exynos_mct.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/clocksource/exynos_mct.c +9 -1
@@ -541,6 +541,11 @@ static int __init exynos4_timer_interrupts(struct device_node *np,* irqs are specified. */ nr_irqs =of_irq_count (np); +if (nr_irqs >ARRAY_SIZE (mct_irqs)) { +pr_err ("exynos-mct: too many (%d) interrupts configured in DT\n" , + nr_irqs); + nr_irqs =ARRAY_SIZE (mct_irqs); + }for (i =MCT_L0_IRQ ; i < nr_irqs; i++) mct_irqs[i] =irq_of_parse_and_map (np, i);
@@ -553,11 +558,14 @@ static int __init exynos4_timer_interrupts(struct device_node *np, mct_irqs[MCT_L0_IRQ], err); }else {for_each_possible_cpu (cpu) { -int mct_irq = mct_irqs[MCT_L0_IRQ + cpu]; +int mct_irq;struct mct_clock_event_device *pcpu_mevt =per_cpu_ptr (&percpu_mct_tick, cpu); pcpu_mevt->evt.irq =-1 ; +if (MCT_L0_IRQ + cpu >=ARRAY_SIZE (mct_irqs)) +break ; + mct_irq = mct_irqs[MCT_L0_IRQ + cpu];irq_set_status_flags (mct_irq,IRQ_NOAUTOEN ); if (request_irq(mct_irq,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 247/1126 clocksource/drivers/timer-ti-dm: Fix regression from errata i940 fix
In reply to Greg Kroah-HartmanFrom: Drew Fustini <[email protected]>
[ Upstream commit bceaae3bac0ce27c549bb050336d8d08abc2ee54 ]
The existing fix for errata i940 causes a conflict for IPU2 which is using timer 3 and 4. From arch/arm/boot/dts/dra7-ipu-dsp-common.dtsi:
&ipu2 {
mboxes = <&mailbox6 &mbox_ipu2_ipc3x>;
ti,timers = <&timer3>;
ti,watchdog-timers = <&timer4>, <&timer9>;
};The conflict was noticed when booting mainline on the BeagleBoard X15 which has a TI AM5728 SoC:
remoteproc remoteproc1: 55020000.ipu is available remoteproc remoteproc1: powering up 55020000.ipu remoteproc remoteproc1: Booting fw image dra7-ipu2-fw.xem4 omap-rproc 55020000.ipu: could not get timer platform device omap-rproc 55020000.ipu: omap_rproc_enable_timers failed: -19 remoteproc remoteproc1: can't start rproc 55020000.ipu: -19
This change modifies the errata fix to instead use timer 15 and 16 which resolves the timer conflict.
It does not appear to introduce any latency regression. Results from cyclictest with original errata fix using dmtimer 3 and 4:
# cyclictest --mlockall --smp --priority=80 --interval=200 --distance=0 policy: fifo: loadavg: 0.02 0.03 0.05
T: 0 ( 1449) P:80 I:200 C: 800368 Min: 0 Act: 32 Avg: 22 Max: 128 T: 1 ( 1450) P:80 I:200 C: 800301 Min: 0 Act: 12 Avg: 23 Max: 70
The results after the change to dmtimer 15 and 16:
# cyclictest --mlockall --smp --priority=80 --interval=200 --distance=0 policy: fifo: loadavg: 0.36 0.19 0.07
T: 0 ( 1711) P:80 I:200 C: 759599 Min: 0 Act: 6 Avg: 22 Max: 108 T: 1 ( 1712) P:80 I:200 C: 759539 Min: 0 Act: 19 Avg: 23 Max: 79
--- arch/arm/boot/dts/dra7-l4.dtsi | 5 ++--- arch/arm/boot/dts/dra7.dtsi | 8 ++++---- drivers/clocksource/timer-ti-dm-systimer.c | 4 ++-- 3 files changed, 8 insertions(+), 9 deletions(-)
arch/arm/boot/dts/dra7-l4.dtsi +2 -3
@@ -3482,8 +3482,7 @@ ti,timer-pwm; }; }; - - target-module@2c000 { /* 0x4882c000, ap 17 02.0 */ + timer15_target: target-module@2c000 { /* 0x4882c000, ap 17 02.0 */ compatible = "ti,sysc-omap4-timer", "ti,sysc"; reg = <0x2c000 0x4>, <0x2c010 0x4>;
@@ -3511,7 +3510,7 @@ }; }; - target-module@2e000 { /* 0x4882e000, ap 19 14.0 */ + timer16_target: target-module@2e000 { /* 0x4882e000, ap 19 14.0 */ compatible = "ti,sysc-omap4-timer", "ti,sysc"; reg = <0x2e000 0x4>, <0x2e010 0x4>;
arch/arm/boot/dts/dra7.dtsi +4 -4
@@ -1339,20 +1339,20 @@ }; /* Local timers, see ARM architected timer wrap erratum i940 */ -&timer3_target { +&timer15_target { ti,no-reset-on-init; ti,no-idle; timer@0 { - assigned-clocks = <&l4per_clkctrl DRA7_L4PER_TIMER3_CLKCTRL 24>; + assigned-clocks = <&l4per3_clkctrl DRA7_L4PER3_TIMER15_CLKCTRL 24>; assigned-clock-parents = <&timer_sys_clk_div>; }; }; -&timer4_target { +&timer16_target { ti,no-reset-on-init; ti,no-idle; timer@0 { - assigned-clocks = <&l4per_clkctrl DRA7_L4PER_TIMER4_CLKCTRL 24>; + assigned-clocks = <&l4per3_clkctrl DRA7_L4PER3_TIMER16_CLKCTRL 24>; assigned-clock-parents = <&timer_sys_clk_div>; }; };
drivers/clocksource/timer-ti-dm-systimer.c +2 -2
@@ -694,9 +694,9 @@ static int __init dmtimer_percpu_quirk_init(struct device_node *np, u32 pa)return 0 ; } -if (pa ==0x48034000 )/* dra7 dmtimer3 */ +if (pa ==0x4882c000 )/* dra7 dmtimer15 */ return dmtimer_percpu_timer_init (np,0 ); -else if (pa ==0x48036000 )/* dra7 dmtimer4 */ +else if (pa ==0x4882e000 )/* dra7 dmtimer16 */ return dmtimer_percpu_timer_init (np,1 );return 0 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 250/1126 clocksource/drivers/timer-of: Check return value of of_iomap in timer_of_base_init()
In reply to Greg Kroah-HartmanFrom: Guillaume Ranquet <[email protected]>
[ Upstream commit 4467b8bad2401794fb89a0268c8c8257180bf60f ]
of_base->base can either be iomapped using of_io_request_and_map() or of_iomap() depending whether or not an of_base->name has been set.
Thus check of_base->base against NULL as of_iomap() does not return a PTR_ERR() in case of error.
--- drivers/clocksource/timer-of.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/clocksource/timer-of.c +3 -3
@@ -157,9 +157,9 @@ static __init int timer_of_base_init(struct device_node *np, of_base->base = of_base->name ?of_io_request_and_map (np, of_base->index, of_base->name) :of_iomap (np, of_base->index); -if (IS_ERR (of_base->base)) { -pr_err ("Failed to iomap (%s)\n" , of_base->name); -return PTR_ERR (of_base->base); +if (IS_ERR_OR_NULL (of_base->base)) { +pr_err ("Failed to iomap (%s:%s)\n" , np->name, of_base->name); +return of_base->base ?PTR_ERR (of_base->base) : -ENOMEM ; }return 0 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 251/1126 arm64: prevent instrumentation of bp hardening callbacks
In reply to Greg Kroah-HartmanFrom: Mark Rutland <[email protected]>
[ Upstream commit 614c0b9fee711dd89b1dd65c88ba83612a373fdc ]
We may call arm64_apply_bp_hardening() early during entry (e.g. in el0_ia()) before it is safe to run instrumented code. Unfortunately this may result in running instrumented code in two cases:
* The hardening callbacks called by arm64_apply_bp_hardening() are not marked as noinstr, and have been observed to be instrumented when compiled with either GCC or LLVM.
* Since arm64_apply_bp_hardening() itself is only marked as inline rather than __always_inline, it is possible that the compiler decides to place it out-of-line, whereupon it may be instrumented.
For example, with defconfig built with clang 13.0.0, call_hvc_arch_workaround_1() is compiled as:
| <call_hvc_arch_workaround_1>: | d503233f paciasp | f81f0ffe str x30, [sp, #-16]! | 320183e0 mov w0, #0x80008000 | d503201f nop | d4000002 hvc #0x0 | f84107fe ldr x30, [sp], #16 | d50323bf autiasp | d65f03c0 ret
... but when CONFIG_FTRACE=y and CONFIG_KCOV=y this is compiled as:
| <call_hvc_arch_workaround_1>: | d503245f bti c | d503201f nop | d503201f nop | d503233f paciasp | a9bf7bfd stp x29, x30, [sp, #-16]! | 910003fd mov x29, sp | 94000000 bl 0 <__sanitizer_cov_trace_pc> | 320183e0 mov w0, #0x80008000 | d503201f nop | d4000002 hvc #0x0 | a8c17bfd ldp x29, x30, [sp], #16 | d50323bf autiasp | d65f03c0 ret
... with a patchable function entry registered with ftrace, and a direct call to __sanitizer_cov_trace_pc(). Neither of these are safe early during entry sequences.
This patch avoids the unsafe instrumentation by marking arm64_apply_bp_hardening() as __always_inline and by marking the hardening functions as noinstr. This avoids the potential for instrumentation, and causes clang to consistently generate the function as with the defconfig sample.
Note: in the defconfig compilation, when CONFIG_SVE=y, x30 is spilled to the stack without being placed in a frame record, which will result in a missing entry if call_hvc_arch_workaround_1() is backtraced. Similar is true of qcom_link_stack_sanitisation(), where inline asm spills the LR to a GPR prior to corrupting it. This is not a significant issue presently as we will only backtrace here if an exception is taken, and in such cases we may omit entries for other reasons today.
The relevant hardening functions were introduced in commits:
ec82b567a74fbdff ("arm64: Implement branch predictor hardening for Falkor") b092201e00206141 ("arm64: Add ARM_SMCCC_ARCH_WORKAROUND_1 BP hardening support")
... and these were subsequently moved in commit:
d4647f0a2ad71110 ("arm64: Rewrite Spectre-v2 mitigation code")
The arm64_apply_bp_hardening() function was introduced in commit:
0f15adbb2861ce6f ("arm64: Add skeleton to harden the branch predictor against aliasing attacks")
... and was subsequently moved and reworked in commit:
6279017e807708a0 ("KVM: arm64: Move BP hardening helpers into spectre.h")
--- arch/arm64/include/asm/spectre.h | 3 ++- arch/arm64/kernel/proton-pack.c | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-)
arch/arm64/include/asm/spectre.h +2 -1
@@ -67,7 +67,8 @@ struct bp_hardening_data { DECLARE_PER_CPU_READ_MOSTLY(struct bp_hardening_data, bp_hardening_data); -static inline void arm64_apply_bp_hardening (void ) +/* Called during entry so must be __always_inline */ +static __always_inline void arm64_apply_bp_hardening(void) {struct bp_hardening_data *d;
arch/arm64/kernel/proton-pack.c +6 -3
@@ -233,17 +233,20 @@ static void install_bp_hardening_cb(bp_hardening_cb_t fn)__this_cpu_write (bp_hardening_data.slot,HYP_VECTOR_SPECTRE_DIRECT ); } -static void call_smc_arch_workaround_1 (void ) +/* Called during entry so must be noinstr */ +static noinstr void call_smc_arch_workaround_1(void) {arm_smccc_1_1_smc (ARM_SMCCC_ARCH_WORKAROUND_1 ,NULL ); } -static void call_hvc_arch_workaround_1 (void ) +/* Called during entry so must be noinstr */ +static noinstr void call_hvc_arch_workaround_1(void) {arm_smccc_1_1_hvc (ARM_SMCCC_ARCH_WORKAROUND_1 ,NULL ); } -static void qcom_link_stack_sanitisation (void ) +/* Called during entry so must be noinstr */ +static noinstr void qcom_link_stack_sanitisation(void) {u64 tmp;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 252/1126 perf/arm-cmn: Hide XP PUB events for CMN-600
In reply to Greg Kroah-HartmanFrom: Robin Murphy <[email protected]>
[ Upstream commit 205295c7e1abba9c1db1f9fe075f22f71351887f ]
CMN-600 doesn't have XP events for the PUB channel, but we missed the appropriate check to avoid exposing them.
--- drivers/perf/arm-cmn.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/perf/arm-cmn.c +3 -0
@@ -595,6 +595,9 @@ static umode_t arm_cmn_event_attr_is_visible(struct kobject *kobj,if ((intf &4 ) && !(cmn->ports_used &BIT (intf &3 )))return 0 ; +if (chan ==4 && cmn->model ==CMN600 ) +return 0 ; +if ((chan ==5 && cmn->rsp_vc_num <2 ) || (chan ==6 && cmn->dat_vc_num <2 ))return 0 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 219/1126 stack: Constrain and fix stack offset randomization with Clang builds
In reply to Greg Kroah-HartmanFrom: Marco Elver <[email protected]>
[ Upstream commit efa90c11f62e6b7252fb75efe2787056872a627c ]
All supported versions of Clang perform auto-init of __builtin_alloca() when stack auto-init is on (CONFIG_INIT_STACK_ALL_{ZERO,PATTERN}).
add_random_kstack_offset() uses __builtin_alloca() to add a stack offset. This means, when CONFIG_INIT_STACK_ALL_{ZERO,PATTERN} is enabled, add_random_kstack_offset() will auto-init that unused portion of the stack used to add an offset.
There are several problems with this:
1. These offsets can be as large as 1023 bytes. Performing memset() on them isn't exactly cheap, and this is done on every syscall entry.
2. Architectures adding add_random_kstack_offset() to syscall entry implemented in C require them to be 'noinstr' (e.g. see x86 and s390). The potential problem here is that a call to memset may occur, which is not noinstr.
A x86_64 defconfig kernel with Clang 11 and CONFIG_VMLINUX_VALIDATION shows:
| vmlinux.o: warning: objtool: do_syscall_64()+0x9d: call to memset() leaves .noinstr.text section | vmlinux.o: warning: objtool: do_int80_syscall_32()+0xab: call to memset() leaves .noinstr.text section | vmlinux.o: warning: objtool: __do_fast_syscall_32()+0xe2: call to memset() leaves .noinstr.text section | vmlinux.o: warning: objtool: fixup_bad_iret()+0x2f: call to memset() leaves .noinstr.text section
Clang 14 (unreleased) will introduce a way to skip alloca initialization via __builtin_alloca_uninitialized() (https://reviews.llvm.org/D115440).
Constrain RANDOMIZE_KSTACK_OFFSET to only be enabled if no stack auto-init is enabled, the compiler is GCC, or Clang is version 14+. Use __builtin_alloca_uninitialized() if the compiler provides it, as is done by Clang 14.
--- arch/Kconfig | 1 + include/linux/randomize_kstack.h | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-)
arch/Kconfig +1 -0
@@ -1162,6 +1162,7 @@ config HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET config RANDOMIZE_KSTACK_OFFSET_DEFAULT bool "Randomize kernel stack offset on syscall entry" depends on HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET + depends on INIT_STACK_NONE || !CC_IS_CLANG || CLANG_VERSION >= 140000 help The kernel stack offset can be randomized (after pt_regs) by roughly 5 bits of entropy, frustrating memory corruption
include/linux/randomize_kstack.h +14 -2
@@ -16,8 +16,20 @@ DECLARE_PER_CPU(u32, kstack_offset);* alignment. Also, since this use is being explicitly masked to a max of * 10 bits, stack-clash style attacks are unlikely. For more details see * "VLAs" in Documentation/process/deprecated.rst +* +* The normal __builtin_alloca() is initialized with INIT_STACK_ALL (currently +* only with Clang and not GCC). Initializing the unused area on each syscall +* entry is expensive, and generating an implicit call to memset() may also be +* problematic (such as in noinstr functions). Therefore, if the compiler +* supports it (which it should if it initializes allocas), always use the +* "uninitialized" variant of the builtin. */ -void *__builtin_alloca (size_t size); +#if __has_builtin (__builtin_alloca_uninitialized) +#define __kstack_alloca __builtin_alloca_uninitialized +#else +#define __kstack_alloca __builtin_alloca +#endif +/* * Use, at most, 10 bits of entropy. We explicitly cap this to keep the * "VLA" from being unbounded (see above). 10 bits leaves enough room for
@@ -36,7 +48,7 @@ void *__builtin_alloca(size_t size);if (static_branch_maybe (CONFIG_RANDOMIZE_KSTACK_OFFSET_DEFAULT , \ &randomize_kstack_offset)) { \u32 offset =raw_cpu_read (kstack_offset); \ -u8 *ptr =__builtin_alloca (KSTACK_OFFSET_MAX (offset)); \ +u8 *ptr =__kstack_alloca (KSTACK_OFFSET_MAX (offset)); \/* Keep allocation even after "ptr" loses scope. */ \ asmvolatile ("" ::"r" (ptr) :"memory" ); \ } \
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 254/1126 KEYS: trusted: Fix trusted key backends when building as module
In reply to Greg Kroah-HartmanFrom: Andreas Rammhold <[email protected]>
[ Upstream commit 969a26446bcd142faedfe8c6f41cd7668596c1fa ]
Before this commit the kernel could end up with no trusted key sources even though both of the currently supported backends (TPM and TEE) were compiled as modules. This manifested in the trusted key type not being registered at all.
When checking if a CONFIG_… preprocessor variable is defined we only test for the builtin (=y) case and not the module (=m) case. By using the IS_REACHABLE() macro we do test for both cases.
--- security/keys/trusted-keys/trusted_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
security/keys/trusted-keys/trusted_core.c +2 -2
@@ -27,10 +27,10 @@ module_param_named(source, trusted_key_source, charp, 0);MODULE_PARM_DESC (source,"Select trusted keys source (tpm or tee)" );static const struct trusted_key_source trusted_key_sources[] = { -#if defined(CONFIG_TCG_TPM) +#if IS_REACHABLE(CONFIG_TCG_TPM) {"tpm" , &trusted_key_tpm_ops }, #endif -#if defined(CONFIG_TEE) +#if IS_REACHABLE(CONFIG_TEE) {"tee" , &trusted_key_tee_ops }, #endif };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 253/1126 perf/arm-cmn: Update watchpoint format
In reply to Greg Kroah-HartmanFrom: Robin Murphy <[email protected]>
[ Upstream commit 31fac565773981df43f018b2dbfbc7a3164f4b6c ]
Quoted 1 line
From CMN-650 onwards, some of the fields in the watchpoint config
registers moved subtly enough to easily overlook. Watchpoint events are still only partially supported on newer IPs - which in itself deserves noting - but were not intended to become any *less* functional than on CMN-600.
--- drivers/perf/arm-cmn.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/perf/arm-cmn.c +12 -6
@@ -71,9 +71,11 @@#define CMN_DTM_WPn (n) (0x1A0 + (n) * 0x18)#define CMN_DTM_WPn_CONFIG (n) (CMN_DTM_WPn(n) + 0x00)#define CMN_DTM_WPn_CONFIG_WP_DEV_SEL2 GENMASK_ULL(18,17) -#define CMN_DTM_WPn_CONFIG_WP_COMBINE BIT(6) -#define CMN_DTM_WPn_CONFIG_WP_EXCLUSIVE BIT(5) -#define CMN_DTM_WPn_CONFIG_WP_GRP BIT(4) +#define CMN_DTM_WPn_CONFIG_WP_COMBINE BIT(9) +#define CMN_DTM_WPn_CONFIG_WP_EXCLUSIVE BIT(8) +#define CMN600_WPn_CONFIG_WP_COMBINE BIT(6) +#define CMN600_WPn_CONFIG_WP_EXCLUSIVE BIT(5) +#define CMN_DTM_WPn_CONFIG_WP_GRP GENMASK_ULL(5, 4)#define CMN_DTM_WPn_CONFIG_WP_CHN_SEL GENMASK_ULL(3, 1)#define CMN_DTM_WPn_CONFIG_WP_DEV_SEL BIT(0)#define CMN_DTM_WPn_VAL (n) (CMN_DTM_WPn(n) + 0x08)
@@ -155,6 +157,7 @@#define CMN_CONFIG_WP_COMBINE GENMASK_ULL(27, 24)#define CMN_CONFIG_WP_DEV_SEL GENMASK_ULL(50, 48)#define CMN_CONFIG_WP_CHN_SEL GENMASK_ULL(55, 51) +/* Note that we don't yet support the tertiary match group on newer IPs */ #define CMN_CONFIG_WP_GRP BIT_ULL(56)#define CMN_CONFIG_WP_EXCLUSIVE BIT_ULL(57)#define CMN_CONFIG1_WP_VAL GENMASK_ULL(63, 0)
@@ -908,15 +911,18 @@ static u32 arm_cmn_wp_config(struct perf_event *event)u32 grp =CMN_EVENT_WP_GRP (event);u32 exc =CMN_EVENT_WP_EXCLUSIVE (event);u32 combine =CMN_EVENT_WP_COMBINE (event); +bool is_cmn600 =to_cmn (event->pmu)->model ==CMN600 ; config =FIELD_PREP (CMN_DTM_WPn_CONFIG_WP_DEV_SEL, dev) |FIELD_PREP (CMN_DTM_WPn_CONFIG_WP_CHN_SEL, chn) |FIELD_PREP (CMN_DTM_WPn_CONFIG_WP_GRP, grp) | -FIELD_PREP (CMN_DTM_WPn_CONFIG_WP_EXCLUSIVE, exc) |FIELD_PREP (CMN_DTM_WPn_CONFIG_WP_DEV_SEL2, dev >>1 ); +if (exc) + config |= is_cmn600 ? CMN600_WPn_CONFIG_WP_EXCLUSIVE : + CMN_DTM_WPn_CONFIG_WP_EXCLUSIVE;if (combine && !grp) - config |= CMN_DTM_WPn_CONFIG_WP_COMBINE; - + config |= is_cmn600 ? CMN600_WPn_CONFIG_WP_COMBINE : + CMN_DTM_WPn_CONFIG_WP_COMBINE;return config; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 220/1126 arm64/mm: avoid fixmap race condition when create pud mapping
In reply to Greg Kroah-HartmanFrom: Jianyong Wu <[email protected]>
[ Upstream commit ee017ee353506fcec58e481673e4331ff198a80e ]
The 'fixmap' is a global resource and is used recursively by create pud mapping(), leading to a potential race condition in the presence of a concurrent call to alloc_init_pud():
kernel_init thread virtio-mem workqueue thread
================== ===========================
alloc_init_pud(...) alloc_init_pud(...)
pudp = pud_set_fixmap_offset(...) pudp = pud_set_fixmap_offset(...)
READ_ONCE(*pudp)
pud_clear_fixmap(...)
READ_ONCE(*pudp) // CRASH!
As kernel may sleep during creating pud mapping, introduce a mutex lock to serialise use of the fixmap entries by alloc_init_pud(). However, there is no need for locking in early boot stage and it doesn't work well with KASLR enabled when early boot. So, enable lock when system_state doesn't equal to "SYSTEM_BOOTING".
--- arch/arm64/mm/mmu.c | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/arm64/mm/mmu.c +9 -0
@@ -63,6 +63,7 @@ static pmd_t bm_pmd[PTRS_PER_PMD] __page_aligned_bss __maybe_unused; static pud_t bm_pud[PTRS_PER_PUD] __page_aligned_bss __maybe_unused;static DEFINE_SPINLOCK (swapper_pgdir_lock); +static DEFINE_MUTEX (fixmap_lock);void set_swapper_pgd (pgd_t *pgdp,pgd_t pgd) {
@@ -329,6 +330,12 @@ static void alloc_init_pud(pgd_t *pgdp, unsigned long addr, unsigned long end, }BUG_ON (p4d_bad (p4d)); +/* +* No need for locking during early boot. And it doesn't work as +* expected with KASLR enabled. +*/ +if (system_state !=SYSTEM_BOOTING ) +mutex_lock (&fixmap_lock); pudp =pud_set_fixmap_offset (p4dp, addr); do { pud_t old_pud = READ_ONCE(*pudp);
@@ -359,6 +366,8 @@ static void alloc_init_pud(pgd_t *pgdp, unsigned long addr, unsigned long end, }while (pudp++, addr = next, addr != end);pud_clear_fixmap (); +if (system_state !=SYSTEM_BOOTING ) +mutex_unlock (&fixmap_lock); } static void __create_pgd_mapping(pgd_t *pgdir, phys_addr_t phys,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 255/1126 KEYS: trusted: Avoid calling null function trusted_key_exit
In reply to Greg Kroah-HartmanFrom: Dave Kleikamp <[email protected]>
[ Upstream commit c5d1ed846e15090bc90dfdaafc07eac066e070bb ]
If one loads and unloads the trusted module, trusted_key_exit can be NULL. Call it through static_call_cond() to avoid a kernel trap.
--- security/keys/trusted-keys/trusted_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/keys/trusted-keys/trusted_core.c +1 -1
@@ -351,7 +351,7 @@ static int __init init_trusted(void) static void __exit cleanup_trusted(void) { -static_call (trusted_key_exit)(); +static_call_cond (trusted_key_exit)(); }late_initcall (init_trusted);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 256/1126 ACPI: APEI: fix return value of __setup handlers
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit f3303ff649dbf7dcdc6a6e1a922235b12b3028f4 ]
__setup() handlers should return 1 to indicate that the boot option has been handled. Returning 0 causes a boot option to be listed in the Unknown kernel command line parameters and also added to init's arg list (if no '=' sign) or environment list (if of the form 'a=b').
Unknown kernel command line parameters "erst_disable
bert_disable hest_disable BOOT_IMAGE=/boot/bzImage-517rc6", will be passed to user space.
Run /sbin/init as init process
with arguments:
/sbin/init
erst_disable
bert_disable
hest_disable
with environment:
HOME=/
TERM=linux
BOOT_IMAGE=/boot/bzImage-517rc6--- drivers/acpi/apei/bert.c | 2 +- drivers/acpi/apei/erst.c | 2 +- drivers/acpi/apei/hest.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/acpi/apei/bert.c +1 -1
@@ -77,7 +77,7 @@ static int __init setup_bert_disable(char *str) { bert_disable =1 ; -return 0 ; +return 1 ; }__setup ("bert_disable" , setup_bert_disable);
drivers/acpi/apei/erst.c +1 -1
@@ -891,7 +891,7 @@ EXPORT_SYMBOL_GPL(erst_clear);static int __init setup_erst_disable (char *str) { erst_disable =1 ; -return 0 ; +return 1 ; }__setup ("erst_disable" , setup_erst_disable);
drivers/acpi/apei/hest.c +1 -1
@@ -224,7 +224,7 @@ static int __init hest_ghes_dev_register(unsigned int ghes_count)static int __init setup_hest_disable (char *str) { hest_disable =HEST_DISABLED ; -return 0 ; +return 1 ; }__setup ("hest_disable" , setup_hest_disable);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 323/1126 ASoC: max98927: add missing header file
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit bb45f689fa62110c263c86070bfcb9ecbb6e1e23 ]
Add a header file that provides the missing function prototypes and macro to fix these build errors (seen on arch/alpha/):
../sound/soc/codecs/max98927.c: In function 'max98927_i2c_probe':../sound/soc/codecs/max98927.c:902:19: error: implicit declaration of function 'devm_gpiod_get_optional'; did you mean 'devm_regulator_get_optional'? [-Werror=implicit-function-declaration]
902 | = devm_gpiod_get_optional(&i2c->dev, "reset", GPIOD_OUT_HIGH);
| ^~~~~~~~~~~~~~~~~~~~~~~../sound/soc/codecs/max98927.c:902:63: error: 'GPIOD_OUT_HIGH' undeclared (first use in this function); did you mean 'GPIOF_INIT_HIGH'?
902 | = devm_gpiod_get_optional(&i2c->dev, "reset", GPIOD_OUT_HIGH);
| ^~~~~~~~~~~~~~../sound/soc/codecs/max98927.c:909:17: error: implicit declaration of function 'gpiod_set_value_cansleep'; did you mean 'gpio_set_value_cansleep'? [-Werror=implicit-function-declaration]
909 | gpiod_set_value_cansleep(max98927->reset_gpio, 0);
| ^~~~~~~~~~~~~~~~~~~~~~~~--- sound/soc/codecs/max98927.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/codecs/max98927.c +1 -0
@@ -16,6 +16,7 @@#include <sound/pcm_params.h> #include <sound/soc.h> #include <linux/gpio.h> +#include <linux/gpio/consumer.h> #include <linux/of_gpio.h> #include <sound/tlv.h> #include "max98927.h"
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 310/1126 media: meson: vdec: potential dereference of null pointer
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit c8c80c996182239ff9b05eda4db50184cf3b2e99 ]
As the possible failure of the kzalloc(), the 'new_ts' could be NULL pointer.
Therefore, it should be better to check it in order to avoid the dereference of the NULL pointer.
Also, the caller esparser_queue() needs to deal with the return value of the amvdec_add_ts().
--- drivers/staging/media/meson/vdec/esparser.c | 7 ++++++- drivers/staging/media/meson/vdec/vdec_helpers.c | 8 ++++++-- drivers/staging/media/meson/vdec/vdec_helpers.h | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-)
drivers/staging/media/meson/vdec/esparser.c +6 -1
@@ -328,7 +328,12 @@ esparser_queue(struct amvdec_session *sess, struct vb2_v4l2_buffer *vbuf) offset =esparser_get_offset (sess); -amvdec_add_ts (sess, vb->timestamp, vbuf->timecode, offset, vbuf->flags); + ret =amvdec_add_ts (sess, vb->timestamp, vbuf->timecode, offset, vbuf->flags); +if (ret) { +v4l2_m2m_buf_done (vbuf,VB2_BUF_STATE_ERROR ); +return ret; + } +dev_dbg (core->dev,"esparser: ts = %llu pld_size = %u offset = %08X flags = %08X\n" , vb->timestamp, payload_size, offset, vbuf->flags);
drivers/staging/media/meson/vdec/vdec_helpers.c +6 -2
@@ -227,13 +227,16 @@ int amvdec_set_canvases(struct amvdec_session *sess, }EXPORT_SYMBOL_GPL (amvdec_set_canvases); -void amvdec_add_ts (struct amvdec_session *sess,u64 ts, -struct v4l2_timecode tc,u32 offset,u32 vbuf_flags) +int amvdec_add_ts (struct amvdec_session *sess,u64 ts, +struct v4l2_timecode tc,u32 offset,u32 vbuf_flags) {struct amvdec_timestamp *new_ts;unsigned long flags; new_ts =kzalloc (sizeof (*new_ts),GFP_KERNEL ); +if (!new_ts) +return -ENOMEM ; + new_ts->ts = ts; new_ts->tc = tc; new_ts->offset = offset;
@@ -242,6 +245,7 @@ void amvdec_add_ts(struct amvdec_session *sess, u64 ts,spin_lock_irqsave (&sess->ts_spinlock, flags);list_add_tail (&new_ts->list, &sess->timestamps);spin_unlock_irqrestore (&sess->ts_spinlock, flags); +return 0 ; }EXPORT_SYMBOL_GPL (amvdec_add_ts);
drivers/staging/media/meson/vdec/vdec_helpers.h +2 -2
@@ -56,8 +56,8 @@ void amvdec_dst_buf_done_offset(struct amvdec_session *sess,* @offset: offset in the VIFIFO where the associated packet was written * @flags: the vb2_v4l2_buffer flags */ -void amvdec_add_ts (struct amvdec_session *sess,u64 ts, -struct v4l2_timecode tc,u32 offset,u32 flags); +int amvdec_add_ts (struct amvdec_session *sess,u64 ts, +struct v4l2_timecode tc,u32 offset,u32 flags);void amvdec_remove_ts (struct amvdec_session *sess,u64 ts);/**
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 425/1126 drm/bridge: Fix free wrong object in sii8620_init_rcp_input_dev
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 7c442e76c06cb1bef16a6c523487438175584eea ]
rc_dev is allocated by rc_allocate_device(), and doesn't assigned to ctx->rc_dev before calling rc_free_device(ctx->rc_dev). So it should call rc_free_device(rc_dev);
--- drivers/gpu/drm/bridge/sil-sii8620.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/sil-sii8620.c +1 -1
@@ -2120,7 +2120,7 @@ static void sii8620_init_rcp_input_dev(struct sii8620 *ctx)if (ret) {dev_err (ctx->dev,"Failed to register RC device\n" ); ctx->error = ret; -rc_free_device (ctx->rc_dev); +rc_free_device (rc_dev);return ; } ctx->rc_dev = rc_dev;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 335/1126 arm64: dts: qcom: sm8150: Correct TCS configuration for apps rsc
In reply to Greg Kroah-HartmanFrom: Maulik Shah <[email protected]>
[ Upstream commit 17ac8af678b6da6a8f1df7da8ebf2c5198741827 ]
Correct the TCS config by updating the number of TCSes for each type.
--- arch/arm64/boot/dts/qcom/sm8150.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/qcom/sm8150.dtsi +3 -3
@@ -3556,9 +3556,9 @@ qcom,tcs-offset = <0xd00>; qcom,drv-id = <2>; qcom,tcs-config = <ACTIVE_TCS 2>, - <SLEEP_TCS 1>, - <WAKE_TCS 1>, - <CONTROL_TCS 0>; + <SLEEP_TCS 3>, + <WAKE_TCS 3>, + <CONTROL_TCS 1>; rpmhcc: clock-controller { compatible = "qcom,sm8150-rpmh-clk";
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 292/1126 media: staging: media: zoran: fix usage of vb2_dma_contig_set_max_seg_size
In reply to Greg Kroah-HartmanFrom: Corentin Labbe <[email protected]>
[ Upstream commit 241f5b67fb48def58643f279dfb8468bdd54b443 ]
vb2_dma_contig_set_max_seg_size need to have a size in parameter and not a DMA_BIT_MASK().
While fixing this issue, also fix error handling of all DMA size setting.
--- drivers/staging/media/zoran/zoran_card.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/media/zoran/zoran_card.c +4 -2
@@ -1069,8 +1069,10 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) err =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 ));if (err) -return -ENODEV ; -vb2_dma_contig_set_max_seg_size (&pdev->dev,DMA_BIT_MASK (32 )); +return err; + err =vb2_dma_contig_set_max_seg_size (&pdev->dev,U32_MAX ); +if (err) +return err; nr = zoran_num++;if (nr >=BUZ_MAX ) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 339/1126 arm64: dts: qcom: ipq6018: fix usb reference period
In reply to Greg Kroah-HartmanFrom: Baruch Siach <[email protected]>
[ Upstream commit d1c10ab1494f09eb12fa6e58fc78bb28d44922ae ]
Reference clock period for rate of 24MHz is 41ns (0x29).
--- arch/arm64/boot/dts/qcom/ipq6018.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/ipq6018.dtsi +1 -1
@@ -748,7 +748,7 @@ snps,hird-threshold = /bits/ 8 <0x0>; snps,dis_u2_susphy_quirk; snps,dis_u3_susphy_quirk; - snps,ref-clock-period-ns = <0x32>; + snps,ref-clock-period-ns = <0x29>; dr_mode = "host"; }; };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 263/1126 clocksource: acpi_pm: fix return value of __setup handler
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 6a861abceecb68497dd82a324fee45a5332dcece ]
__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.
The __setup() handler interface isn't meant to handle negative return values -- they are non-zero, so they mean "handled" (like a return value of 1 does), but that's just a quirk. So return 1 from parse_pmtmr(). Also print a warning message if kstrtouint() returns an error.
--- drivers/clocksource/acpi_pm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/clocksource/acpi_pm.c +4 -2
@@ -229,8 +229,10 @@ static int __init parse_pmtmr(char *arg)int ret; ret =kstrtouint (arg,16 , &base); -if (ret) -return ret; +if (ret) { +pr_warn ("PMTMR: invalid 'pmtmr=' value: '%s'\n" , arg); +return 1 ; + }pr_info ("PMTMR IOPort override: 0x%04x -> 0x%04x\n" , pmtmr_ioport, base);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 318/1126 video: fbdev: controlfb: Fix COMPILE_TEST build
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit 567e44fb51b4f909ae58038a7301352eecea8426 ]
If PPC_BOOK3S, PPC_PMAC and PPC32 is n, COMPILE_TEST build fails:
drivers/video/fbdev/controlfb.c:70:0: error: "pgprot_cached_wthru" redefined [-Werror]
#define pgprot_cached_wthru(prot) (prot)
In file included from ./arch/powerpc/include/asm/pgtable.h:20:0,
from ./include/linux/pgtable.h:6,
from ./include/linux/mm.h:33,
from drivers/video/fbdev/controlfb.c:37:./arch/powerpc/include/asm/nohash/pgtable.h:243:0: note: this is the location of the previous definition
#define pgprot_cached_wthru(prot) (__pgprot((pgprot_val(prot) & ~_PAGE_CACHE_CTL) | \
--- drivers/video/fbdev/controlfb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/video/fbdev/controlfb.c +2 -0
@@ -67,7 +67,9 @@#define out_8 (addr, val) (void)(val)#define in_le32 (addr) 0#define out_le32 (addr, val) (void)(val) +#ifndef pgprot_cached_wthru#define pgprot_cached_wthru (prot) (prot) +#endif #else static void invalid_vram_cache (void __force *addr) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 432/1126 Bluetooth: hci_sync: unlock on error in hci_inquiry_result_with_rssi_evt()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit c07ba878ca199a6089cdb323bf526adbeeb4201f ]
Add unlocks to two error paths in hci_inquiry_result_with_rssi_evt().
--- net/bluetooth/hci_event.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/bluetooth/hci_event.c +3 -3
@@ -4534,7 +4534,7 @@ static void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, void *edata,if (!info) {bt_dev_err (hdev,"Malformed HCI Event: 0x%2.2x" ,HCI_EV_INQUIRY_RESULT_WITH_RSSI ); -return ; + goto unlock; }bacpy (&data.bdaddr, &info->bdaddr);
@@ -4565,7 +4565,7 @@ static void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, void *edata,if (!info) {bt_dev_err (hdev,"Malformed HCI Event: 0x%2.2x" ,HCI_EV_INQUIRY_RESULT_WITH_RSSI ); -return ; + goto unlock; }bacpy (&data.bdaddr, &info->bdaddr);
@@ -4587,7 +4587,7 @@ static void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, void *edata,bt_dev_err (hdev,"Malformed HCI Event: 0x%2.2x" ,HCI_EV_INQUIRY_RESULT_WITH_RSSI ); } - +unlock:hci_dev_unlock (hdev); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 373/1126 ASoC: acp: check the return value of devm_kzalloc() in acp_legacy_dai_links_create()
In reply to Greg Kroah-HartmanFrom: Jia-Ju Bai <[email protected]>
[ Upstream commit 431f9a77a4a62694ce90742d1f4c5abe1b8b6612 ]
The function devm_kzalloc() in acp_legacy_dai_links_create() can fail, so its return value should be checked.
--- sound/soc/amd/acp/acp-mach-common.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/amd/acp/acp-mach-common.c +2 -0
@@ -556,6 +556,8 @@ int acp_legacy_dai_links_create(struct snd_soc_card *card) num_links++; links =devm_kzalloc (dev,sizeof (struct snd_soc_dai_link ) * num_links,GFP_KERNEL ); +if (!links) +return -ENOMEM ;if (drv_data->hs_cpu_id ==I2S_SP ) { links[i].name ="acp-headset-codec" ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 409/1126 ASoC: imx-es8328: Fix error return code in imx_es8328_probe()
In reply to Greg Kroah-HartmanFrom: Wang Wensheng <[email protected]>
[ Upstream commit 3b891513f95cba3944e72c1139ea706d04f3781b ]
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.
--- sound/soc/fsl/imx-es8328.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/fsl/imx-es8328.c +1 -0
@@ -87,6 +87,7 @@ static int imx_es8328_probe(struct platform_device *pdev)if (int_port >MUX_PORT_MAX || int_port ==0 ) {dev_err (dev,"mux-int-port: hardware only has %d mux ports\n" ,MUX_PORT_MAX ); + ret = -EINVAL ; goto fail; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 337/1126 arm64: dts: qcom: sm8450: Update cpuidle states parameters
In reply to Greg Kroah-HartmanFrom: Maulik Shah <[email protected]>
[ Upstream commit 6574702b0d394d2acc9ff808c4a79df8b9999173 ]
This change updates/corrects below cpuidle parameters
1. entry-latency, exit-latency and residency for various idle states.
2. arm,psci-suspend-param which is same for CLUSTER_SLEEP_0/1 states.
3. Add CLUSTER_SLEEP_1 in CLUSTER_PD.
--- arch/arm64/boot/dts/qcom/sm8450.dtsi | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
arch/arm64/boot/dts/qcom/sm8450.dtsi +14 -14
@@ -203,9 +203,9 @@ compatible = "arm,idle-state"; idle-state-name = "silver-rail-power-collapse"; arm,psci-suspend-param = <0x40000004>; - entry-latency-us = <274>; - exit-latency-us = <480>; - min-residency-us = <3934>; + entry-latency-us = <800>; + exit-latency-us = <750>; + min-residency-us = <4090>; local-timer-stop; };
@@ -213,9 +213,9 @@ compatible = "arm,idle-state"; idle-state-name = "gold-rail-power-collapse"; arm,psci-suspend-param = <0x40000004>; - entry-latency-us = <327>; - exit-latency-us = <1502>; - min-residency-us = <4488>; + entry-latency-us = <600>; + exit-latency-us = <1550>; + min-residency-us = <4791>; local-timer-stop; }; };
@@ -224,10 +224,10 @@ CLUSTER_SLEEP_0: cluster-sleep-0 { compatible = "domain-idle-state"; idle-state-name = "cluster-l3-off"; - arm,psci-suspend-param = <0x4100c344>; - entry-latency-us = <584>; - exit-latency-us = <2332>; - min-residency-us = <6118>; + arm,psci-suspend-param = <0x41000044>; + entry-latency-us = <1050>; + exit-latency-us = <2500>; + min-residency-us = <5309>; local-timer-stop; };
@@ -235,9 +235,9 @@ compatible = "domain-idle-state"; idle-state-name = "cluster-power-collapse"; arm,psci-suspend-param = <0x4100c344>; - entry-latency-us = <2893>; - exit-latency-us = <4023>; - min-residency-us = <9987>; + entry-latency-us = <2700>; + exit-latency-us = <3500>; + min-residency-us = <13959>; local-timer-stop; }; };
@@ -315,7 +315,7 @@ CLUSTER_PD: cpu-cluster0 { #power-domain-cells = <0>; - domain-idle-states = <&CLUSTER_SLEEP_0>; + domain-idle-states = <&CLUSTER_SLEEP_0>, <&CLUSTER_SLEEP_1>; }; };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 297/1126 media: staging: media: imx: imx7-mipi-csis: Make subdev name unique
In reply to Greg Kroah-HartmanFrom: Laurent Pinchart <[email protected]>
[ Upstream commit 5be7f8c91d25089be847a71b336c13b5bb0db772 ]
When multiple CSIS instances are present in a single graph, they are currently all named "imx7-mipi-csis.0", which breaks the entity name uniqueness requirement. Fix it by using the device name to create the subdev name.
--- drivers/staging/media/imx/imx7-mipi-csis.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/media/imx/imx7-mipi-csis.c +2 -4
@@ -32,7 +32,6 @@#include <media/v4l2-subdev.h> #define CSIS_DRIVER_NAME "imx7-mipi-csis" -#define CSIS_SUBDEV_NAME CSIS_DRIVER_NAME#define CSIS_PAD_SINK 0#define CSIS_PAD_SOURCE 1
@@ -311,7 +310,6 @@ struct csi_state {struct reset_control *mrst;struct regulator *mipi_phy_regulator;const struct mipi_csis_info *info; -u8 index;struct v4l2_subdev sd;struct media_pad pads[CSIS_PADS_NUM ];
@@ -1303,8 +1301,8 @@ static int mipi_csis_subdev_init(struct csi_state *state)v4l2_subdev_init (sd, &mipi_csis_subdev_ops); sd->owner =THIS_MODULE ; -snprintf (sd->name,sizeof (sd->name),"%s.%d" , -CSIS_SUBDEV_NAME , state->index); +snprintf (sd->name,sizeof (sd->name),"csis-%s" , +dev_name (state->dev)); sd->flags |=V4L2_SUBDEV_FL_HAS_DEVNODE ; sd->ctrl_handler =NULL ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 336/1126 arm64: dts: qcom: sm8350: Correct TCS configuration for apps rsc
In reply to Greg Kroah-HartmanFrom: Maulik Shah <[email protected]>
[ Upstream commit a131255e4ad1ef8d4873ecba21561ba272b2547a ]
Correct the TCS config by updating the number of TCSes for each type.
--- arch/arm64/boot/dts/qcom/sm8350.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sm8350.dtsi +1 -1
@@ -1820,7 +1820,7 @@ qcom,tcs-offset = <0xd00>; qcom,drv-id = <2>; qcom,tcs-config = <ACTIVE_TCS 2>, <SLEEP_TCS 3>, - <WAKE_TCS 3>, <CONTROL_TCS 1>; + <WAKE_TCS 3>, <CONTROL_TCS 0>; rpmhcc: clock-controller { compatible = "qcom,sm8350-rpmh-clk";
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 359/1126 ASoC: codecs: rx-macro: fix accessing array out of bounds for enum type
In reply to Greg Kroah-HartmanFrom: Srinivas Kandagatla <[email protected]>
[ Upstream commit bcfe5f76cc4051ea3f9eb5d2c8ea621641f290a5 ]
Accessing enums using integer would result in array out of bounds access on platforms like aarch64 where sizeof(long) is 8 compared to enum size which is 4 bytes.
--- sound/soc/codecs/lpass-rx-macro.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/soc/codecs/lpass-rx-macro.c +4 -4
@@ -2272,7 +2272,7 @@ static int rx_macro_mux_get(struct snd_kcontrol *kcontrol,struct snd_soc_component *component =snd_soc_dapm_to_component (widget->dapm);struct rx_macro *rx =snd_soc_component_get_drvdata (component); - ucontrol->value.integer.value[0 ] = + ucontrol->value.enumerated.item[0 ] = rx->rx_port_value[widget->shift];return 0 ; }
@@ -2284,7 +2284,7 @@ static int rx_macro_mux_put(struct snd_kcontrol *kcontrol,struct snd_soc_component *component =snd_soc_dapm_to_component (widget->dapm);struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;struct snd_soc_dapm_update *update =NULL ; -u32 rx_port_value = ucontrol->value.integer.value[0 ]; +u32 rx_port_value = ucontrol->value.enumerated.item[0 ];u32 aif_rst;struct rx_macro *rx =snd_soc_component_get_drvdata (component);
@@ -2396,7 +2396,7 @@ static int rx_macro_get_hph_pwr_mode(struct snd_kcontrol *kcontrol,struct snd_soc_component *component =snd_soc_kcontrol_component (kcontrol);struct rx_macro *rx =snd_soc_component_get_drvdata (component); - ucontrol->value.integer.value[0 ] = rx->hph_pwr_mode; + ucontrol->value.enumerated.item[0 ] = rx->hph_pwr_mode;return 0 ; }
@@ -2406,7 +2406,7 @@ static int rx_macro_put_hph_pwr_mode(struct snd_kcontrol *kcontrol,struct snd_soc_component *component =snd_soc_kcontrol_component (kcontrol);struct rx_macro *rx =snd_soc_component_get_drvdata (component); - rx->hph_pwr_mode = ucontrol->value.integer.value[0 ]; + rx->hph_pwr_mode = ucontrol->value.enumerated.item[0 ];return 0 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 348/1126 ARM: dts: imx: Add missing LVDS decoder on M53Menlo
In reply to Greg Kroah-HartmanFrom: Marek Vasut <[email protected]>
[ Upstream commit 0c6f71176ea43d6f4003a4d57f7bb518c5ad6145 ]
The M53Menlo display unit uses an LVDS-to-DPI bridge, TI DS90CF364A. Describe this bridge in DT, otherwise the DT incorrectly describes DPI panel attached directly to LVDS source.
--- arch/arm/boot/dts/imx53-m53menlo.dts | 29 ++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-)
arch/arm/boot/dts/imx53-m53menlo.dts +27 -2
@@ -53,6 +53,31 @@ }; }; + lvds-decoder { + compatible = "ti,ds90cf364a", "lvds-decoder"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + lvds_decoder_in: endpoint { + remote-endpoint = <&lvds0_out>; + }; + }; + + port@1 { + reg = <1>; + + lvds_decoder_out: endpoint { + remote-endpoint = <&panel_in>; + }; + }; + }; + }; + panel { compatible = "edt,etm0700g0dh6"; pinctrl-0 = <&pinctrl_display_gpio>;
@@ -61,7 +86,7 @@ port { panel_in: endpoint { - remote-endpoint = <&lvds0_out>; + remote-endpoint = <&lvds_decoder_out>; }; }; };
@@ -450,7 +475,7 @@ reg = <2>; lvds0_out: endpoint { - remote-endpoint = <&panel_in>; + remote-endpoint = <&lvds_decoder_in>; }; }; };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 361/1126 ASoC: codecs: wc938x: fix accessing array out of bounds for enum type
In reply to Greg Kroah-HartmanFrom: Srinivas Kandagatla <[email protected]>
[ Upstream commit cc587b7c8fbbe128f6bd0dad025a0caea5e6d164 ]
Accessing enums using integer would result in array out of bounds access on platforms like aarch64 where sizeof(long) is 8 compared to enum size which is 4 bytes.
Fix this by using enumerated items instead of integers.
--- sound/soc/codecs/wcd938x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/wcd938x.c +2 -2
@@ -2504,7 +2504,7 @@ static int wcd938x_tx_mode_get(struct snd_kcontrol *kcontrol,struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;int path = e->shift_l; - ucontrol->value.integer.value[0 ] = wcd938x->tx_mode[path]; + ucontrol->value.enumerated.item[0 ] = wcd938x->tx_mode[path];return 0 ; }
@@ -2528,7 +2528,7 @@ static int wcd938x_rx_hph_mode_get(struct snd_kcontrol *kcontrol,struct snd_soc_component *component =snd_soc_kcontrol_component (kcontrol);struct wcd938x_priv *wcd938x =snd_soc_component_get_drvdata (component); - ucontrol->value.integer.value[0 ] = wcd938x->hph_mode; + ucontrol->value.enumerated.item[0 ] = wcd938x->hph_mode;return 0 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 386/1126 memory: emif: Add check for setup_interrupts
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit fd7bd80b46373887b390852f490f21b07e209498 ]
As the potential failure of the devm_request_threaded_irq(), it should be better to check the return value of the setup_interrupts() and return error if fails.
--- drivers/memory/emif.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/memory/emif.c +4 -2
@@ -1117,7 +1117,7 @@ static int __init_or_module emif_probe(struct platform_device *pdev) {struct emif_data *emif;struct resource *res; -int irq; +int irq, ret;if (pdev->dev.of_node) emif =of_get_memory_device_details (pdev->dev.of_node, &pdev->dev);
@@ -1147,7 +1147,9 @@ static int __init_or_module emif_probe(struct platform_device *pdev)emif_onetime_settings (emif);emif_debugfs_init (emif);disable_and_clear_all_interrupts (emif); -setup_interrupts (emif, irq); + ret =setup_interrupts (emif, irq); +if (ret) + goto error;/* One-time actions taken on probing the first device */ if (!emif1) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 475/1126 rtw88: check for validity before using a pointer
In reply to Greg Kroah-HartmanFrom: Muhammad Usama Anjum <[email protected]>
[ Upstream commit a12f809968dbf46ce2a6bc94463db8d431bb75fc ]
ieee80211_probereq_get() can return NULL. Pointer skb should be checked for validty before use. If it is not valid, list of skbs needs to be freed.
--- drivers/net/wireless/realtek/rtw88/fw.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/wireless/realtek/rtw88/fw.c +8 -0
@@ -1866,11 +1866,19 @@ static int rtw_hw_scan_update_probe_req(struct rtw_dev *rtwdev, req->ssids[i].ssid, req->ssids[i].ssid_len, req->ie_len); +if (!skb) + goto out;rtw_append_probe_req_ie (rtwdev, skb, &list, rtwvif);kfree_skb (skb); }return _rtw_hw_scan_update_probe_req (rtwdev, num, &list); + +out: + skb_queue_walk(&list, skb) +kfree_skb (skb); + +return -ENOMEM ; } static int rtw_add_chan_info(struct rtw_dev *rtwdev, struct rtw_chan_info *info,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 329/1126 soc: qcom: aoss: Fix missing put_device call in qmp_get
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 4b41a9d0fe3db5f91078a380f62f0572c3ecf2dd ]
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 paths.
--- drivers/soc/qcom/qcom_aoss.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/soc/qcom/qcom_aoss.c +5 -1
@@ -451,7 +451,11 @@ struct qmp *qmp_get(struct device *dev) qmp =platform_get_drvdata (pdev); -return qmp ? qmp :ERR_PTR (-EPROBE_DEFER ); +if (!qmp) { +put_device (&pdev->dev); +return ERR_PTR (-EPROBE_DEFER ); + } +return qmp; }EXPORT_SYMBOL (qmp_get);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 330/1126 soc: qcom: aoss: remove spurious IRQF_ONESHOT flags
In reply to Greg Kroah-HartmanFrom: Daniel Thompson <[email protected]>
[ Upstream commit 8030cb9a55688c1339edd284d9d6ce5f9fc75160 ]
Quoting the header comments, IRQF_ONESHOT is "Used by threaded interrupts which need to keep the irq line disabled until the threaded handler has been run.". When applied to an interrupt that doesn't request a threaded irq then IRQF_ONESHOT has a lesser known (undocumented?) side effect, which it to disable the forced threading of the irq. For "normal" kernels (without forced threading) then, if there is no thread_fn, then IRQF_ONESHOT is a nop.
In this case disabling forced threading is not appropriate for this driver because it calls wake_up_all() and this API cannot be called from no-thread interrupt handlers on PREEMPT_RT systems (deadlock risk, triggers sleeping-while-atomic warnings).
Fix this by removing IRQF_ONESHOT.
--- drivers/soc/qcom/qcom_aoss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/qcom/qcom_aoss.c +1 -1
@@ -501,7 +501,7 @@ static int qmp_probe(struct platform_device *pdev) } irq =platform_get_irq (pdev,0 ); - ret =devm_request_irq (&pdev->dev, irq, qmp_intr,IRQF_ONESHOT , + ret =devm_request_irq (&pdev->dev, irq, qmp_intr,0 ,"aoss-qmp" , qmp);if (ret <0 ) {dev_err (&pdev->dev,"failed to request interrupt\n" );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 439/1126 udmabuf: validate ubuf->pagecount
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit 2b6dd600dd72573c23ea180b5b0b2f1813405882 ]
Syzbot has reported GPF in sg_alloc_append_table_from_pages(). The problem was in ubuf->pages == ZERO_PTR.
ubuf->pagecount is calculated from arguments passed from user-space. If user creates udmabuf with list.size == 0 then ubuf->pagecount will be also equal to zero; it causes kmalloc_array() to return ZERO_PTR.
Fix it by validating ubuf->pagecount before passing it to kmalloc_array().
--- drivers/dma-buf/udmabuf.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/dma-buf/udmabuf.c +4 -0
@@ -190,6 +190,10 @@ static long udmabuf_create(struct miscdevice *device,if (ubuf->pagecount > pglimit) goto err; } + +if (!ubuf->pagecount) + goto err; + ubuf->pages =kmalloc_array (ubuf->pagecount,sizeof (*ubuf->pages),GFP_KERNEL );if (!ubuf->pages) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 326/1126 ARM: dts: qcom: ipq4019: fix sleep clock
In reply to Greg Kroah-HartmanFrom: Pavel Kubelun <[email protected]>
[ Upstream commit 3d7e7980993d2c1ae42d3d314040fc2de6a9c45f ]
It seems like sleep_clk was copied from ipq806x.
Fix ipq40xx sleep_clk to the value QSDK defines.
--- arch/arm/boot/dts/qcom-ipq4019.dtsi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/boot/dts/qcom-ipq4019.dtsi +2 -1
@@ -142,7 +142,8 @@ clocks { sleep_clk: sleep_clk { compatible = "fixed-clock"; - clock-frequency = <32768>; + clock-frequency = <32000>; + clock-output-names = "gcc_sleep_clk_src"; #clock-cells = <0>; };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 322/1126 ARM: dts: Fix OpenBMC flash layout label addresses
In reply to Greg Kroah-HartmanFrom: Zev Weiss <[email protected]>
[ Upstream commit e011df3579ac980d840db8e8c3b9431f88ebddab ]
We've ended up with some inconsistencies between the addresses in the DT node labels and the actual offsets of the partitions; this brings them back in sync.
--- arch/arm/boot/dts/openbmc-flash-layout-64.dtsi | 2 +- arch/arm/boot/dts/openbmc-flash-layout.dtsi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/openbmc-flash-layout-64.dtsi +1 -1
@@ -28,7 +28,7 @@ partitions { label = "rofs"; }; - rwfs@6000000 { + rwfs@2a00000 { reg = <0x2a00000 0x1600000>; // 22MB label = "rwfs"; };
arch/arm/boot/dts/openbmc-flash-layout.dtsi +1 -1
@@ -20,7 +20,7 @@ partitions { label = "kernel"; }; - rofs@c0000 { + rofs@4c0000 { reg = <0x4c0000 0x1740000>; label = "rofs"; };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 272/1126 sched/uclamp: Fix iowait boost escaping uclamp restriction
In reply to Greg Kroah-HartmanFrom: Qais Yousef <[email protected]>
[ Upstream commit d37aee9018e68b0d356195caefbb651910e0bbfa ]
iowait_boost signal is applied independently of util and doesn't take into account uclamp settings of the rq. An io heavy task that is capped by uclamp_max could still request higher frequency because sugov_iowait_apply() doesn't clamp the boost via uclamp_rq_util_with() like effective_cpu_util() does.
Make sure that iowait_boost honours uclamp requests by calling uclamp_rq_util_with() when applying the boost.
--- kernel/sched/cpufreq_schedutil.c | 1 + 1 file changed, 1 insertion(+)
kernel/sched/cpufreq_schedutil.c +1 -0
@@ -289,6 +289,7 @@ static void sugov_iowait_apply(struct sugov_cpu *sg_cpu, u64 time)* into the same scale so we can compare. */ boost = (sg_cpu->iowait_boost * sg_cpu->max) >>SCHED_CAPACITY_SHIFT ; + boost =uclamp_rq_util_with (cpu_rq (sg_cpu->cpu), boost,NULL );if (sg_cpu->util < boost) sg_cpu->util = boost; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 457/1126 ionic: start watchdog after all is setup
In reply to Greg Kroah-HartmanFrom: Shannon Nelson <[email protected]>
[ Upstream commit 9ad2939a1525962a79a2fd974ec7e3a71455b964 ]
The watchdog expects the lif to fully exist when it goes off, so lets not start the watchdog until all is ready in case there is some quirky time dialation that makes probe take multiple seconds.
--- drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c | 4 +++- drivers/net/ethernet/pensando/ionic/ionic_dev.c | 3 --- 2 files changed, 3 insertions(+), 4 deletions(-)
drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c +3 -1
@@ -331,6 +331,9 @@ static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto err_out_deregister_lifs; } +mod_timer (&ionic->watchdog_timer, +round_jiffies (jiffies + ionic->watchdog_period)); +return 0 ; err_out_deregister_lifs:
@@ -348,7 +351,6 @@ static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) err_out_reset:ionic_reset (ionic); err_out_teardown: -del_timer_sync (&ionic->watchdog_timer);pci_clear_master (pdev);/* Don't fail the probe for these errors, keep * the hw interface around for inspection
drivers/net/ethernet/pensando/ionic/ionic_dev.c +0 -3
@@ -122,9 +122,6 @@ int ionic_dev_setup(struct ionic *ionic) idev->fw_generation =IONIC_FW_STS_F_GENERATION &ioread8 (&idev->dev_info_regs->fw_status); -mod_timer (&ionic->watchdog_timer, -round_jiffies (jiffies + ionic->watchdog_period)); - idev->db_pages = bar->vaddr; idev->phy_db_pages = bar->bus_addr;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 351/1126 media: ti-vpe: cal: Fix a NULL pointer dereference in cal_ctx_v4l2_init_formats()
In reply to Greg Kroah-HartmanFrom: Zhou Qingyang <[email protected]>
[ Upstream commit abd77889851d2ead0d0c9c4d29f1808801477b00 ]
In cal_ctx_v4l2_init_formats(), devm_kzalloc() is assigned to ctx->active_fmt and there is a dereference of it after that, which could lead to NULL pointer dereference on failure of devm_kzalloc().
Fix this bug by adding a NULL check of ctx->active_fmt.
This bug was found by a static analyzer.
Builds with 'make allyesconfig' show no new warnings, and our static analyzer no longer warns about this code.
--- drivers/media/platform/ti-vpe/cal-video.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/media/platform/ti-vpe/cal-video.c +3 -0
@@ -823,6 +823,9 @@ static int cal_ctx_v4l2_init_formats(struct cal_ctx *ctx)/* Enumerate sub device formats and enable all matching local formats */ ctx->active_fmt =devm_kcalloc (ctx->cal->dev, cal_num_formats,sizeof (*ctx->active_fmt),GFP_KERNEL ); +if (!ctx->active_fmt) +return -ENOMEM ; + ctx->num_active_fmt =0 ;for (j =0 , i =0 ; ; ++j) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 325/1126 firmware: qcom: scm: Remove reassignment to desc following initializer
In reply to Greg Kroah-HartmanFrom: Marijn Suijten <[email protected]>
[ Upstream commit 7823e5aa5d1dd9ed5849923c165eb8f29ad23c54 ]
Member assignments to qcom_scm_desc were moved into struct initializers in 57d3b816718c ("firmware: qcom_scm: Remove thin wrappers") including the case in qcom_scm_iommu_secure_ptbl_init, except that the - now duplicate - assignment to desc was left in place. While not harmful, remove this unnecessary extra reassignment.
--- drivers/firmware/qcom_scm.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/firmware/qcom_scm.c +0 -6
@@ -749,12 +749,6 @@ int qcom_scm_iommu_secure_ptbl_init(u64 addr, u32 size, u32 spare) };int ret; - desc.args[0 ] = addr; - desc.args[1 ] = size; - desc.args[2 ] = spare; - desc.arginfo =QCOM_SCM_ARGS (3 ,QCOM_SCM_RW ,QCOM_SCM_VAL , -QCOM_SCM_VAL ); - ret =qcom_scm_call (__scm->dev, &desc,NULL );/* the pg table has been initialized already, ignore the error */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 393/1126 ASoC: cs35l41: Fix GPIO2 configuration
In reply to Greg Kroah-HartmanFrom: David Rhodes <[email protected]>
[ Upstream commit 03a7895ee701e873c88c06bdb830ff40adb2be73 ]
Fix GPIO2 polarity and direction configuration
--- sound/soc/codecs/cs35l41.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/cs35l41.c +2 -2
@@ -1035,8 +1035,8 @@ static int cs35l41_irq_gpio_config(struct cs35l41_private *cs35l41)regmap_update_bits (cs35l41->regmap,CS35L41_GPIO2_CTRL1 ,CS35L41_GPIO_POL_MASK |CS35L41_GPIO_DIR_MASK , - irq_gpio_cfg1->irq_pol_inv <<CS35L41_GPIO_POL_SHIFT | - !irq_gpio_cfg1->irq_out_en <<CS35L41_GPIO_DIR_SHIFT ); + irq_gpio_cfg2->irq_pol_inv <<CS35L41_GPIO_POL_SHIFT | + !irq_gpio_cfg2->irq_out_en <<CS35L41_GPIO_DIR_SHIFT ); regmap_update_bits(cs35l41->regmap, CS35L41_GPIO_PAD_CONTROL, CS35L41_GPIO1_CTRL_MASK | CS35L41_GPIO2_CTRL_MASK,
Signature · 1 line
2.34.1