5.15.3-rc1 review
Subsystems (15)
Greg Kroah-Hartman
maintainerPATCH 246/917 net-sysfs: try not to restart the syscall if it will fail eventually
In reply to Greg Kroah-HartmanFrom: Antoine Tenart <[email protected]>
[ Upstream commit 146e5e733310379f51924111068f08a3af0db830 ]
Due to deadlocks in the networking subsystem spotted 12 years ago[1], a workaround was put in place[2] to avoid taking the rtnl lock when it was not available and restarting the syscall (back to VFS, letting userspace spin). The following construction is found a lot in the net sysfs and sysctl code:
if (!rtnl_trylock())
return restart_syscall();This can be problematic when multiple userspace threads use such interfaces in a short period, making them to spin a lot. This happens for example when adding and moving virtual interfaces: userspace programs listening on events, such as systemd-udevd and NetworkManager, do trigger actions reading files in sysfs. It gets worse when a lot of virtual interfaces are created concurrently, say when creating containers at boot time.
Returning early without hitting the above pattern when the syscall will fail eventually does make things better. While it is not a fix for the issue, it does ease things.
[1] https://lore.kernel.org/netdev/[email protected]/
https://lore.kernel.org/netdev/[email protected]/ and https://lore.kernel.org/netdev/20090226084924.16cb3e08@nehalam/
[2] Rightfully, those deadlocks are *hard* to solve.
--- net/core/net-sysfs.c | 55 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+)
net/core/net-sysfs.c +55 -0
@@ -175,6 +175,14 @@ static int change_carrier(struct net_device *dev, unsigned long new_carrier)static ssize_t carrier_store (struct device *dev,struct device_attribute *attr,const char *buf,size_t len) { +struct net_device *netdev =to_net_dev (dev); + +/* The check is also done in change_carrier; this helps returning early +* without hitting the trylock/restart in netdev_store. +*/ +if (!netdev->netdev_ops->ndo_change_carrier) +return -EOPNOTSUPP ; +return netdev_store (dev, attr, buf, len, change_carrier); }
@@ -196,6 +204,12 @@ static ssize_t speed_show(struct device *dev,struct net_device *netdev =to_net_dev (dev);int ret = -EINVAL ; +/* The check is also done in __ethtool_get_link_ksettings; this helps +* returning early without hitting the trylock/restart below. +*/ +if (!netdev->ethtool_ops->get_link_ksettings) +return ret; +if (!rtnl_trylock ())return restart_syscall ();
@@ -216,6 +230,12 @@ static ssize_t duplex_show(struct device *dev,struct net_device *netdev =to_net_dev (dev);int ret = -EINVAL ; +/* The check is also done in __ethtool_get_link_ksettings; this helps +* returning early without hitting the trylock/restart below. +*/ +if (!netdev->ethtool_ops->get_link_ksettings) +return ret; +if (!rtnl_trylock ())return restart_syscall ();
@@ -468,6 +488,14 @@ static ssize_t proto_down_store(struct device *dev,struct device_attribute *attr, const char *buf, size_t len) { + struct net_device *netdev = to_net_dev(dev); + +/* The check is also done in change_proto_down; this helps returning +* early without hitting the trylock/restart in netdev_store. +*/ +if (!netdev->netdev_ops->ndo_change_proto_down) +return -EOPNOTSUPP ; +return netdev_store (dev, attr, buf, len, change_proto_down); }NETDEVICE_SHOW_RW (proto_down, fmt_dec);
@@ -478,6 +506,12 @@ static ssize_t phys_port_id_show(struct device *dev,struct net_device *netdev =to_net_dev (dev);ssize_t ret = -EINVAL ; +/* The check is also done in dev_get_phys_port_id; this helps returning +* early without hitting the trylock/restart below. +*/ +if (!netdev->netdev_ops->ndo_get_phys_port_id) +return -EOPNOTSUPP ; +if (!rtnl_trylock ())return restart_syscall ();
@@ -500,6 +534,13 @@ static ssize_t phys_port_name_show(struct device *dev,struct net_device *netdev =to_net_dev (dev);ssize_t ret = -EINVAL ; +/* The checks are also done in dev_get_phys_port_name; this helps +* returning early without hitting the trylock/restart below. +*/ +if (!netdev->netdev_ops->ndo_get_phys_port_name && + !netdev->netdev_ops->ndo_get_devlink_port) +return -EOPNOTSUPP ; +if (!rtnl_trylock ())return restart_syscall ();
@@ -522,6 +563,14 @@ static ssize_t phys_switch_id_show(struct device *dev,struct net_device *netdev =to_net_dev (dev);ssize_t ret = -EINVAL ; +/* The checks are also done in dev_get_phys_port_name; this helps +* returning early without hitting the trylock/restart below. This works +* because recurse is false when calling dev_get_port_parent_id. +*/ +if (!netdev->netdev_ops->ndo_get_port_parent_id && + !netdev->netdev_ops->ndo_get_devlink_port) +return -EOPNOTSUPP ; +if (!rtnl_trylock ())return restart_syscall ();
@@ -1226,6 +1275,12 @@ static ssize_t tx_maxrate_store(struct netdev_queue *queue,if (!capable (CAP_NET_ADMIN ))return -EPERM ; +/* The check is also done later; this helps returning early without +* hitting the trylock/restart below. +*/ +if (!dev->netdev_ops->ndo_set_tx_maxrate) +return -EOPNOTSUPP ; + err =kstrtou32 (buf,10 , &rate);if (err <0 )return err;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 247/917 drm/amdkfd: rm BO resv on validation to avoid deadlock
In reply to Greg Kroah-HartmanFrom: Alex Sierra <[email protected]>
[ Upstream commit ec6abe831a843208e99a59adf108adba22166b3f ]
This fix the deadlock with the BO reservations during SVM_BO evictions while allocations in VRAM are concurrently performed. More specific, while the ttm waits for the fence to be signaled (ttm_bo_wait), it already has the BO reserved. In parallel, the restore worker might be running, prefetching memory to VRAM. This also requires to reserve the BO, but blocks the mmap semaphore first. The deadlock happens when the SVM_BO eviction worker kicks in and waits for the mmap semaphore held in restore worker. Preventing signal the fence back, causing the deadlock until the ttm times out.
We don't need to hold the BO reservation anymore during validation and mapping. Now the physical addresses are taken from hmm_range_fault. We also take migrate_mutex to prevent range migration while validate_and_map update GPU page table.
--- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_svm.c +1 -6
@@ -1307,7 +1307,7 @@ struct svm_validate_context {struct svm_range *prange;bool intr;unsigned long bitmap[MAX_GPU_INSTANCE ]; -struct ttm_validate_buffer tv[MAX_GPU_INSTANCE +1 ]; +struct ttm_validate_buffer tv[MAX_GPU_INSTANCE ];struct list_head validate_list;struct ww_acquire_ctx ticket; };
@@ -1334,11 +1334,6 @@ static int svm_range_reserve_bos(struct svm_validate_context *ctx) ctx->tv[gpuidx].num_shared =4 ;list_add (&ctx->tv[gpuidx].head, &ctx->validate_list); } -if (ctx->prange->svm_bo && ctx->prange->ttm_res) { - ctx->tv[MAX_GPU_INSTANCE ].bo = &ctx->prange->svm_bo->bo->tbo; - ctx->tv[MAX_GPU_INSTANCE ].num_shared =1 ; -list_add (&ctx->tv[MAX_GPU_INSTANCE ].head, &ctx->validate_list); - } r =ttm_eu_reserve_buffers (&ctx->ticket, &ctx->validate_list, ctx->intr,NULL );
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 248/917 tracefs: Have tracefs directories not set OTH permission bits by default
In reply to Greg Kroah-HartmanFrom: Steven Rostedt (VMware) <[email protected]>
[ Upstream commit 49d67e445742bbcb03106b735b2ab39f6e5c56bc ]
The tracefs file system is by default mounted such that only root user can access it. But there are legitimate reasons to create a group and allow those added to the group to have access to tracing. By changing the permissions of the tracefs mount point to allow access, it will allow group access to the tracefs directory.
There should not be any real reason to allow all access to the tracefs directory as it contains sensitive information. Have the default permission of directories being created not have any OTH (other) bits set, such that an admin that wants to give permission to a group has to first disable all OTH bits in the file system.
--- fs/tracefs/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/tracefs/inode.c +2 -1
@@ -432,7 +432,8 @@ static struct dentry *__create_dir(const char *name, struct dentry *parent,if (unlikely (!inode))return failed_creating (dentry); - inode->i_mode =S_IFDIR |S_IRWXU |S_IRUGO |S_IXUGO ; +/* Do not set bits for OTH */ + inode->i_mode =S_IFDIR |S_IRWXU |S_IRUSR |S_IRGRP |S_IXUSR |S_IXGRP ; inode->i_op = ops; inode->i_fop = &simple_dir_operations;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 249/917 tracing: Disable "other" permission bits in the tracefs files
In reply to Greg Kroah-HartmanFrom: Steven Rostedt (VMware) <[email protected]>
[ Upstream commit 21ccc9cd72116289469e5519b6159c675a2fa58f ]
When building the files in the tracefs file system, do not by default set any permissions for OTH (other). This will make it easier for admins who want to define a group for accessing tracefs and not having to first disable all the permission bits for "other" in the file system.
As tracing can leak sensitive information, it should never by default allowing all users access. An admin can still set the permission bits for others to have access, which may be useful for creating a honeypot and seeing who takes advantage of it and roots the machine.
--- kernel/trace/ftrace.c | 23 +++++---- kernel/trace/trace.c | 73 ++++++++++++++------------- kernel/trace/trace.h | 3 ++ kernel/trace/trace_dynevent.c | 2 +- kernel/trace/trace_events.c | 42 +++++++-------- kernel/trace/trace_events_synth.c | 4 +- kernel/trace/trace_functions_graph.c | 2 +- kernel/trace/trace_hwlat.c | 6 +-- kernel/trace/trace_kprobe.c | 8 +-- kernel/trace/trace_osnoise.c | 14 ++--- kernel/trace/trace_printk.c | 2 +- kernel/trace/trace_recursion_record.c | 4 +- kernel/trace/trace_stack.c | 6 +-- kernel/trace/trace_stat.c | 6 +-- kernel/trace/trace_uprobe.c | 4 +- 15 files changed, 103 insertions(+), 96 deletions(-)
kernel/trace/ftrace.c +12 -11
@@ -988,8 +988,9 @@ static __init void ftrace_profile_tracefs(struct dentry *d_tracer) } } - entry =tracefs_create_file ("function_profile_enabled" ,0644 , - d_tracer,NULL , &ftrace_profile_fops); + entry =tracefs_create_file ("function_profile_enabled" , +TRACE_MODE_WRITE , d_tracer,NULL , + &ftrace_profile_fops);if (!entry)pr_warn ("Could not create tracefs 'function_profile_enabled' entry\n" ); }
@@ -6109,10 +6110,10 @@ void ftrace_create_filter_files(struct ftrace_ops *ops, struct dentry *parent) { -trace_create_file ("set_ftrace_filter" ,0644 , parent, +trace_create_file ("set_ftrace_filter" ,TRACE_MODE_WRITE , parent, ops, &ftrace_filter_fops); -trace_create_file ("set_ftrace_notrace" ,0644 , parent, +trace_create_file ("set_ftrace_notrace" ,TRACE_MODE_WRITE , parent, ops, &ftrace_notrace_fops); }
@@ -6139,19 +6140,19 @@ void ftrace_destroy_filter_files(struct ftrace_ops *ops)static __init int ftrace_init_dyn_tracefs (struct dentry *d_tracer) { -trace_create_file ("available_filter_functions" ,0444 , +trace_create_file ("available_filter_functions" ,TRACE_MODE_READ , d_tracer,NULL , &ftrace_avail_fops); -trace_create_file ("enabled_functions" ,0444 , +trace_create_file ("enabled_functions" ,TRACE_MODE_READ , d_tracer,NULL , &ftrace_enabled_fops);ftrace_create_filter_files (&global_ops, d_tracer);#ifdef CONFIG_FUNCTION_GRAPH_TRACER -trace_create_file ("set_graph_function" ,0644 , d_tracer, +trace_create_file ("set_graph_function" ,TRACE_MODE_WRITE , d_tracer,NULL , &ftrace_graph_fops); -trace_create_file ("set_graph_notrace" ,0644 , d_tracer, +trace_create_file ("set_graph_notrace" ,TRACE_MODE_WRITE , d_tracer,NULL , &ftrace_graph_notrace_fops);#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
@@ -7494,10 +7495,10 @@ static const struct file_operations ftrace_no_pid_fops = {void ftrace_init_tracefs (struct trace_array *tr,struct dentry *d_tracer) { -trace_create_file ("set_ftrace_pid" ,0644 , d_tracer, +trace_create_file ("set_ftrace_pid" ,TRACE_MODE_WRITE , d_tracer, tr, &ftrace_pid_fops); -trace_create_file ("set_ftrace_notrace_pid" ,0644 , d_tracer, - tr, &ftrace_no_pid_fops); +trace_create_file ("set_ftrace_notrace_pid" ,TRACE_MODE_WRITE , + d_tracer, tr, &ftrace_no_pid_fops); } void __init ftrace_init_tracefs_toplevel(struct trace_array *tr,
kernel/trace/trace.c +37 -36
191 lines not on this page · raw message
kernel/trace/trace.h +3 -0
@@ -27,6 +27,9 @@#include <asm/syscall.h> /* some archs define it here */ #endif +#define TRACE_MODE_WRITE 0640 +#define TRACE_MODE_READ 0440 +enum trace_type { __TRACE_FIRST_TYPE =0 ,
kernel/trace/trace_dynevent.c +1 -1
@@ -262,7 +262,7 @@ static __init int init_dynamic_event(void)if (ret)return 0 ; - entry =tracefs_create_file ("dynamic_events" ,0644 ,NULL , + entry =tracefs_create_file ("dynamic_events" ,TRACE_MODE_WRITE ,NULL ,NULL , &dynamic_events_ops);/* Event list interface */
kernel/trace/trace_events.c +22 -20
116 lines not on this page · raw message
kernel/trace/trace_events_synth.c +2 -2
@@ -2227,8 +2227,8 @@ static __init int trace_events_synth_init(void)if (err) goto err; - entry =tracefs_create_file ("synthetic_events" ,0644 ,NULL , -NULL , &synth_events_fops); + entry =tracefs_create_file ("synthetic_events" ,TRACE_MODE_WRITE , +NULL ,NULL , &synth_events_fops);if (!entry) { err = -ENODEV ; goto err;
kernel/trace/trace_functions_graph.c +1 -1
@@ -1340,7 +1340,7 @@ static __init int init_graph_tracefs(void)if (ret)return 0 ; -trace_create_file ("max_graph_depth" ,0644 ,NULL , +trace_create_file ("max_graph_depth" ,TRACE_MODE_WRITE ,NULL ,NULL , &graph_depth_fops);return 0 ;
kernel/trace/trace_hwlat.c +3 -3
@@ -782,21 +782,21 @@ static int init_tracefs(void)if (!top_dir)return -ENOMEM ; - hwlat_sample_window =tracefs_create_file ("window" ,0640 , + hwlat_sample_window =tracefs_create_file ("window" ,TRACE_MODE_WRITE , top_dir, &hwlat_window, &trace_min_max_fops);if (!hwlat_sample_window) goto err; - hwlat_sample_width =tracefs_create_file ("width" ,0644 , + hwlat_sample_width =tracefs_create_file ("width" ,TRACE_MODE_WRITE , top_dir, &hwlat_width, &trace_min_max_fops);if (!hwlat_sample_width) goto err; - hwlat_thread_mode =trace_create_file ("mode" ,0644 , + hwlat_thread_mode =trace_create_file ("mode" ,TRACE_MODE_WRITE , top_dir,NULL , &thread_mode_fops);
kernel/trace/trace_kprobe.c +4 -4
@@ -1925,16 +1925,16 @@ static __init int init_kprobe_trace(void)if (ret)return 0 ; - entry =tracefs_create_file ("kprobe_events" ,0644 ,NULL , -NULL , &kprobe_events_ops); + entry =tracefs_create_file ("kprobe_events" ,TRACE_MODE_WRITE , +NULL ,NULL , &kprobe_events_ops);/* Event list interface */ if (!entry)pr_warn ("Could not create tracefs 'kprobe_events' entry\n" );/* Profile interface */ - entry =tracefs_create_file ("kprobe_profile" ,0444 ,NULL , -NULL , &kprobe_profile_ops); + entry =tracefs_create_file ("kprobe_profile" ,TRACE_MODE_READ , +NULL ,NULL , &kprobe_profile_ops);if (!entry)pr_warn ("Could not create tracefs 'kprobe_profile' entry\n" );
kernel/trace/trace_osnoise.c +7 -7
@@ -1856,38 +1856,38 @@ static int init_tracefs(void)if (!top_dir)return 0 ; - tmp =tracefs_create_file ("period_us" ,0640 , top_dir, + tmp =tracefs_create_file ("period_us" ,TRACE_MODE_WRITE , top_dir, &osnoise_period, &trace_min_max_fops);if (!tmp) goto err; - tmp =tracefs_create_file ("runtime_us" ,0644 , top_dir, + tmp =tracefs_create_file ("runtime_us" ,TRACE_MODE_WRITE , top_dir, &osnoise_runtime, &trace_min_max_fops);if (!tmp) goto err; - tmp =tracefs_create_file ("stop_tracing_us" ,0640 , top_dir, + tmp =tracefs_create_file ("stop_tracing_us" ,TRACE_MODE_WRITE , top_dir, &osnoise_stop_tracing_in, &trace_min_max_fops);if (!tmp) goto err; - tmp =tracefs_create_file ("stop_tracing_total_us" ,0640 , top_dir, + tmp =tracefs_create_file ("stop_tracing_total_us" ,TRACE_MODE_WRITE , top_dir, &osnoise_stop_tracing_total, &trace_min_max_fops);if (!tmp) goto err; - tmp =trace_create_file ("cpus" ,0644 , top_dir,NULL , &cpus_fops); + tmp =trace_create_file ("cpus" ,TRACE_MODE_WRITE , top_dir,NULL , &cpus_fops);if (!tmp) goto err;#ifdef CONFIG_TIMERLAT_TRACER #ifdef CONFIG_STACKTRACE - tmp =tracefs_create_file ("print_stack" ,0640 , top_dir, + tmp =tracefs_create_file ("print_stack" ,TRACE_MODE_WRITE , top_dir, &osnoise_print_stack, &trace_min_max_fops);if (!tmp) goto err;#endif - tmp =tracefs_create_file ("timerlat_period_us" ,0640 , top_dir, + tmp =tracefs_create_file ("timerlat_period_us" ,TRACE_MODE_WRITE , top_dir, &timerlat_period, &trace_min_max_fops);if (!tmp) goto err;
kernel/trace/trace_printk.c +1 -1
@@ -384,7 +384,7 @@ static __init int init_trace_printk_function_export(void)if (ret)return 0 ; -trace_create_file ("printk_formats" ,0444 ,NULL , +trace_create_file ("printk_formats" ,TRACE_MODE_READ ,NULL ,NULL , &ftrace_formats_fops);return 0 ;
kernel/trace/trace_recursion_record.c +2 -2
@@ -226,8 +226,8 @@ __init static int create_recursed_functions(void) {struct dentry *dentry; - dentry =trace_create_file ("recursed_functions" ,0644 ,NULL ,NULL , - &recursed_functions_fops); + dentry =trace_create_file ("recursed_functions" ,TRACE_MODE_WRITE , +NULL ,NULL , &recursed_functions_fops);if (!dentry)pr_warn ("WARNING: Failed to create recursed_functions\n" );return 0 ;
kernel/trace/trace_stack.c +3 -3
@@ -559,14 +559,14 @@ static __init int stack_trace_init(void)if (ret)return 0 ; -trace_create_file ("stack_max_size" ,0644 ,NULL , +trace_create_file ("stack_max_size" ,TRACE_MODE_WRITE ,NULL , &stack_trace_max_size, &stack_max_size_fops); -trace_create_file ("stack_trace" ,0444 ,NULL , +trace_create_file ("stack_trace" ,TRACE_MODE_READ ,NULL ,NULL , &stack_trace_fops);#ifdef CONFIG_DYNAMIC_FTRACE -trace_create_file ("stack_trace_filter" ,0644 ,NULL , +trace_create_file ("stack_trace_filter" ,TRACE_MODE_WRITE ,NULL , &trace_ops, &stack_trace_filter_fops);#endif
kernel/trace/trace_stat.c +3 -3
@@ -297,9 +297,9 @@ static int init_stat_file(struct stat_session *session)if (!stat_dir && (ret =tracing_stat_init ()))return ret; - session->file =tracefs_create_file (session->ts->name,0644 , - stat_dir, - session, &tracing_stat_fops); + session->file =tracefs_create_file (session->ts->name,TRACE_MODE_WRITE , + stat_dir, session, + &tracing_stat_fops);if (!session->file)return -ENOMEM ;return 0 ;
kernel/trace/trace_uprobe.c +2 -2
@@ -1655,10 +1655,10 @@ static __init int init_uprobe_trace(void)if (ret)return 0 ; -trace_create_file ("uprobe_events" ,0644 ,NULL , +trace_create_file ("uprobe_events" ,TRACE_MODE_WRITE ,NULL ,NULL , &uprobe_events_ops);/* Profile interface */ -trace_create_file ("uprobe_profile" ,0444 ,NULL , +trace_create_file ("uprobe_profile" ,TRACE_MODE_READ ,NULL ,NULL , &uprobe_profile_ops);return 0 ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 250/917 ath: dfs_pattern_detector: Fix possible null-pointer dereference in channel_detector_create()
In reply to Greg Kroah-HartmanFrom: Tuo Li <[email protected]>
[ Upstream commit 4b6012a7830b813799a7faf40daa02a837e0fd5b ]
kzalloc() is used to allocate memory for cd->detectors, and if it fails, channel_detector_exit() behind the label fail will be called:
channel_detector_exit(dpd, cd);
In channel_detector_exit(), cd->detectors is dereferenced through:
struct pri_detector *de = cd->detectors[i];
To fix this possible null-pointer dereference, check cd->detectors before the for loop to dereference cd->detectors.
--- drivers/net/wireless/ath/dfs_pattern_detector.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/dfs_pattern_detector.c +6 -4
@@ -183,10 +183,12 @@ static void channel_detector_exit(struct dfs_pattern_detector *dpd,if (cd ==NULL )return ;list_del (&cd->head); -for (i =0 ; i < dpd->num_radar_types; i++) { -struct pri_detector *de = cd->detectors[i]; -if (de !=NULL ) - de->exit (de); +if (cd->detectors) { +for (i =0 ; i < dpd->num_radar_types; i++) { +struct pri_detector *de = cd->detectors[i]; +if (de !=NULL ) + de->exit (de); + } }kfree (cd->detectors);kfree (cd);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 251/917 KVM: arm64: Propagate errors from __pkvm_prot_finalize hypercall
In reply to Greg Kroah-HartmanFrom: Will Deacon <[email protected]>
[ Upstream commit 2f2e1a5069679491d18cf9021da19b40c56a17f3 ]
If the __pkvm_prot_finalize hypercall returns an error, we WARN but fail to propagate the failure code back to kvm_arch_init().
Pass a pointer to a zero-initialised return variable so that failure to finalise the pKVM protections on a host CPU can be reported back to KVM.
--- arch/arm64/kvm/arm.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-)
arch/arm64/kvm/arm.c +19 -11
@@ -1971,9 +1971,25 @@ out_err:return err; } -static void _kvm_host_prot_finalize (void *discard) +static void _kvm_host_prot_finalize (void *arg) { -WARN_ON (kvm_call_hyp_nvhe (__pkvm_prot_finalize)); +int *err = arg; + +if (WARN_ON (kvm_call_hyp_nvhe (__pkvm_prot_finalize))) +WRITE_ONCE (*err, -EINVAL ); +} + +static int pkvm_drop_host_privileges (void ) +{ +int ret =0 ; + +/* +* Flip the static key upfront as that may no longer be possible +* once the host stage 2 is installed. +*/ +static_branch_enable (&kvm_protected_mode_initialized); +on_each_cpu (_kvm_host_prot_finalize, &ret,1 ); +return ret; }static int finalize_hyp_mode (void )
@@ -1987,15 +2003,7 @@ static int finalize_hyp_mode(void)* None of other sections should ever be introspected. */ kmemleak_free_part (__hyp_bss_start, __hyp_bss_end - __hyp_bss_start); - -/* -* Flip the static key upfront as that may no longer be possible -* once the host stage 2 is installed. -*/ -static_branch_enable (&kvm_protected_mode_initialized); -on_each_cpu (_kvm_host_prot_finalize,NULL ,1 ); - -return 0 ; +return pkvm_drop_host_privileges (); }struct kvm_vcpu *kvm_mpidr_to_vcpu (struct kvm *kvm,unsigned long mpidr)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 252/917 mmc: moxart: Fix reference count leaks in moxart_probe
In reply to Greg Kroah-HartmanFrom: Xin Xiong <[email protected]>
[ Upstream commit 8105c2abbf36296bf38ca44f55ee45d160db476a ]
The issue happens in several error handling paths on two refcounted object related to the object "host" (dma_chan_rx, dma_chan_tx). In these paths, the function forgets to decrement one or both objects' reference count increased earlier by dma_request_chan(), causing reference count leaks.
Fix it by balancing the refcounts of both objects in some error handling paths. In correspondence with the changes in moxart_probe(), IS_ERR() is replaced with IS_ERR_OR_NULL() in moxart_remove() as well.
--- drivers/mmc/host/moxart-mmc.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/mmc/host/moxart-mmc.c +14 -2
@@ -621,6 +621,14 @@ static int moxart_probe(struct platform_device *pdev) ret = -EPROBE_DEFER ; goto out; } +if (!IS_ERR (host->dma_chan_tx)) { +dma_release_channel (host->dma_chan_tx); + host->dma_chan_tx =NULL ; + } +if (!IS_ERR (host->dma_chan_rx)) { +dma_release_channel (host->dma_chan_rx); + host->dma_chan_rx =NULL ; + }dev_dbg (dev,"PIO mode transfer enabled\n" ); host->have_dma = false; }else {
@@ -675,6 +683,10 @@ static int moxart_probe(struct platform_device *pdev)return 0 ; out: +if (!IS_ERR_OR_NULL (host->dma_chan_tx)) +dma_release_channel (host->dma_chan_tx); +if (!IS_ERR_OR_NULL (host->dma_chan_rx)) +dma_release_channel (host->dma_chan_rx);if (mmc)mmc_free_host (mmc);return ret;
@@ -687,9 +699,9 @@ static int moxart_remove(struct platform_device *pdev)dev_set_drvdata (&pdev->dev,NULL ); -if (!IS_ERR (host->dma_chan_tx)) +if (!IS_ERR_OR_NULL (host->dma_chan_tx))dma_release_channel (host->dma_chan_tx); -if (!IS_ERR (host->dma_chan_rx)) +if (!IS_ERR_OR_NULL (host->dma_chan_rx))dma_release_channel (host->dma_chan_rx);mmc_remove_host (mmc);mmc_free_host (mmc);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 253/917 iov_iter: Fix iov_iter_get_pages{,_alloc} page fault return value
In reply to Greg Kroah-HartmanFrom: Andreas Gruenbacher <[email protected]>
[ Upstream commit 814a66741b9ffb5e1ba119e368b178edb0b7322d ]
Both iov_iter_get_pages and iov_iter_get_pages_alloc return the number of bytes of the iovec they could get the pages for. When they cannot get any pages, they're supposed to return 0, but when the start of the iovec isn't page aligned, the calculation goes wrong and they return a negative value. Fix both functions.
In addition, change iov_iter_get_pages_alloc to return NULL in that case to prevent resource leaks.
--- lib/iov_iter.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
lib/iov_iter.c +3 -2
@@ -1488,7 +1488,7 @@ ssize_t iov_iter_get_pages(struct iov_iter *i, res =get_user_pages_fast (addr, n,iov_iter_rw (i) !=WRITE ?FOLL_WRITE :0 , pages); -if (unlikely (res <0 )) +if (unlikely (res <=0 ))return res;return (res == n ? len : res *PAGE_SIZE ) - *start; }
@@ -1612,8 +1612,9 @@ ssize_t iov_iter_get_pages_alloc(struct iov_iter *i,return -ENOMEM ; res =get_user_pages_fast (addr, n,iov_iter_rw (i) !=WRITE ?FOLL_WRITE :0 , p); -if (unlikely (res <0 )) { +if (unlikely (res <=0 )) {kvfree (p); + *pages =NULL ;return res; } *pages = p;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 254/917 ACPI: battery: Accept charges over the design capacity as full
In reply to Greg Kroah-HartmanFrom: André Almeida <[email protected]>
[ Upstream commit 2835f327bd1240508db2c89fe94a056faa53c49a ]
Some buggy firmware and/or brand new batteries can support a charge that's slightly over the reported design capacity. In such cases, the kernel will report to userspace that the charging state of the battery is "Unknown", when in reality the battery charge is "Full", at least from the design capacity point of view. Make the fallback condition accepts capacities over the designed capacity so userspace knows that is full.
--- drivers/acpi/battery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/battery.c +1 -1
@@ -169,7 +169,7 @@ static int acpi_battery_is_charged(struct acpi_battery *battery)return 1 ;/* fallback to using design values for broken batteries */ -if (battery->design_capacity == battery->capacity_now) +if (battery->design_capacity <= battery->capacity_now)return 1 ;/* we don't do any sort of metric based on percentages */
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 255/917 ACPI: scan: Release PM resources blocked by unused objects
In reply to Greg Kroah-HartmanFrom: Rafael J. Wysocki <[email protected]>
[ Upstream commit c10383e8ddf4810b9a5c1595404c2724d925a0a6 ]
On some systems the ACPI namespace contains device objects that are not used in certain configurations of the system. If they start off in the D0 power state configuration, they will stay in it until the system reboots, because of the lack of any mechanism possibly causing their configuration to change. If that happens, they may prevent some power resources from being turned off or generally they may prevent the platform from getting into the deepest low-power states thus causing some energy to be wasted.
Address this issue by changing the configuration of unused ACPI device objects to the D3cold power state one after carrying out the ACPI-based enumeration of devices.
--- drivers/acpi/glue.c | 25 +++++++++++++++++++++++++ drivers/acpi/internal.h | 1 + drivers/acpi/scan.c | 6 ++++++ 3 files changed, 32 insertions(+)
drivers/acpi/glue.c +25 -0
@@ -340,3 +340,28 @@ void acpi_device_notify_remove(struct device *dev)acpi_unbind_one (dev); } + +int acpi_dev_turn_off_if_unused (struct device *dev,void *not_used) +{ +struct acpi_device *adev =to_acpi_device (dev); + +/* +* Skip device objects with device IDs, because they may be in use even +* if they are not companions of any physical device objects. +*/ +if (adev->pnp.type.hardware_id) +return 0 ; + +mutex_lock (&adev->physical_node_lock); + +/* +* Device objects without device IDs are not in use if they have no +* corresponding physical device objects. +*/ +if (list_empty (&adev->physical_node_list)) +acpi_device_set_power (adev,ACPI_STATE_D3_COLD ); + +mutex_unlock (&adev->physical_node_lock); + +return 0 ; +}
drivers/acpi/internal.h +1 -0
@@ -117,6 +117,7 @@ bool acpi_device_is_battery(struct acpi_device *adev);bool acpi_device_is_first_physical_node (struct acpi_device *adev,const struct device *dev);int acpi_bus_register_early_device (int type); +int acpi_dev_turn_off_if_unused (struct device *dev,void *not_used);/* -------------------------------------------------------------------------- Device Matching and Notification
drivers/acpi/scan.c +6 -0
@@ -2559,6 +2559,12 @@ int __init acpi_scan_init(void) } } +/* +* Make sure that power management resources are not blocked by ACPI +* device objects with no users. +*/ +bus_for_each_dev (&acpi_bus_type,NULL ,NULL , acpi_dev_turn_off_if_unused); +acpi_turn_off_unused_power_resources (); acpi_scan_initialized = true;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 256/917 drm/amd/display: fix null pointer deref when plugging in display
In reply to Greg Kroah-HartmanFrom: Aurabindo Pillai <[email protected]>
[ Upstream commit 1f3b22e4eb162e0b1d423106a47484943a22a309 ]
[Why&How]
When system boots in headless mode, connecting a 4k display creates a null pointer dereference due to hubp for a certain plane being null. Add a condition to check for null hubp before dereferencing it.
--- drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c +2 -1
@@ -1002,7 +1002,8 @@ void dcn30_set_disp_pattern_generator(const struct dc *dc,/* turning off DPG */ pipe_ctx->plane_res.hubp->funcs->set_blank (pipe_ctx->plane_res.hubp, false);for (mpcc_pipe = pipe_ctx->bottom_pipe; mpcc_pipe; mpcc_pipe = mpcc_pipe->bottom_pipe) - mpcc_pipe->plane_res.hubp->funcs->set_blank (mpcc_pipe->plane_res.hubp, false); +if (mpcc_pipe->plane_res.hubp) + mpcc_pipe->plane_res.hubp->funcs->set_blank (mpcc_pipe->plane_res.hubp, false); stream_res->opp->funcs->opp_set_disp_pattern_generator (stream_res->opp, test_pattern, color_space, color_depth, solid_color, width, height, offset);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 257/917 drm/amdkfd: fix resume error when iommu disabled in Picasso
In reply to Greg Kroah-HartmanFrom: Yifan Zhang <[email protected]>
[ Upstream commit 6f4b590aae217da16cfa44039a2abcfb209137ab ]
When IOMMU disabled in sbios and kfd in iommuv2 path, IOMMU resume failure blocks system resume. Don't allow kfd to use iommu v2 when iommu is disabled.
--- drivers/gpu/drm/amd/amdkfd/kfd_device.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +1 -0
@@ -916,6 +916,7 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,kfd_double_confirm_iommu_support (kfd);if (kfd_iommu_device_init (kfd)) { + kfd->use_iommu_v2 = false;dev_err (kfd_device,"Error initializing iommuv2\n" ); goto device_iommu_error; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 258/917 net: phy: micrel: make *-skew-ps check more lenient
In reply to Greg Kroah-HartmanFrom: Matthias Schiffer <[email protected]>
[ Upstream commit 67ca5159dbe2edb5dae7544447b8677d2596933a ]
It seems reasonable to fine-tune only some of the skew values when using one of the rgmii-*id PHY modes, and even when all skew values are specified, using the correct ID PHY mode makes sense for documentation purposes. Such a configuration also appears in the binding docs in Documentation/devicetree/bindings/net/micrel-ksz90x1.txt, so the driver should not warn about it.
--- drivers/net/phy/micrel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/phy/micrel.c +2 -2
@@ -863,9 +863,9 @@ static int ksz9031_config_init(struct phy_device *phydev)MII_KSZ9031RN_TX_DATA_PAD_SKEW ,4 , tx_data_skews, 4, &update); -if (update && phydev->interface !=PHY_INTERFACE_MODE_RGMII ) +if (update && !phy_interface_is_rgmii (phydev))phydev_warn (phydev, -"*-skew-ps values should be used only with phy-mode = \"rgmii\"\n" ); +"*-skew-ps values should be used only with RGMII PHY modes\n" );/* Silicon Errata Sheet (DS80000691D or DS80000692D): * When the device links in the 1000BASE-T slave mode only,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 259/917 leaking_addresses: Always print a trailing newline
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit cf2a85efdade117e2169d6e26641016cbbf03ef0 ]
For files that lack trailing newlines and match a leaking address (e.g. wchan[1]), the leaking_addresses.pl report would run together with the next line, making things look corrupted.
Unconditionally remove the newline on input, and write it back out on output.
[1] https://lore.kernel.org/all/20210103142726.GC30643@xsang-OptiPlex-9020/
--- scripts/leaking_addresses.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/leaking_addresses.pl +2 -1
@@ -455,8 +455,9 @@ sub parse_file open my $fh, "<", $file or return; while ( <$fh> ) { + chomp; if (may_leak_address($_)) { - print $file . ': ' . $_; + printf("$file: $_\n"); } } close $fh;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 260/917 thermal/core: Fix null pointer dereference in thermal_release()
In reply to Greg Kroah-HartmanFrom: Yuanzheng Song <[email protected]>
[ Upstream commit 1dd7128b839f631b31a9e9dce3aaf639bef74e9d ]
If both dev_set_name() and device_register() failed, then null pointer dereference occurs in thermal_release() which will use strncmp() to compare the name.
So fix it by adding dev_set_name() return value check.
--- drivers/thermal/thermal_core.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/thermal/thermal_core.c +8 -2
@@ -902,6 +902,10 @@ __thermal_cooling_device_register(struct device_node *np, goto out_kfree_cdev; cdev->id = ret; + ret =dev_set_name (&cdev->device,"cooling_device%d" , cdev->id); +if (ret) + goto out_ida_remove; + cdev->type =kstrdup (type ? type :"" ,GFP_KERNEL );if (!cdev->type) { ret = -ENOMEM ;
@@ -916,7 +920,6 @@ __thermal_cooling_device_register(struct device_node *np, cdev->device.class = &thermal_class; cdev->devdata = devdata;thermal_cooling_device_setup_sysfs (cdev); -dev_set_name (&cdev->device,"cooling_device%d" , cdev->id); ret =device_register (&cdev->device);if (ret) goto out_kfree_type;
@@ -1227,6 +1230,10 @@ thermal_zone_device_register(const char *type, int trips, int mask, tz->id = id;strlcpy (tz->type, type,sizeof (tz->type)); + result =dev_set_name (&tz->device,"thermal_zone%d" , tz->id); +if (result) + goto remove_id; +if (!ops->critical) ops->critical = thermal_zone_device_critical;
@@ -1248,7 +1255,6 @@ thermal_zone_device_register(const char *type, int trips, int mask,/* A new thermal zone needs to be updated anyway. */ atomic_set (&tz->need_update,1 ); -dev_set_name (&tz->device,"thermal_zone%d" , tz->id); result =device_register (&tz->device);if (result) goto release_device;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 261/917 drm/msm: prevent NULL dereference in msm_gpu_crashstate_capture()
In reply to Greg Kroah-HartmanFrom: Tim Gardner <[email protected]>
[ Upstream commit b220c154832c5cd0df34cbcbcc19d7135c16e823 ]
Coverity complains of a possible NULL dereference:
CID 120718 (#1 of 1): Dereference null return value (NULL_RETURNS)
23. dereference: Dereferencing a pointer that might be NULL state->bos when calling msm_gpu_crashstate_get_bo. [show details]
301 msm_gpu_crashstate_get_bo(state, submit->bos[i].obj,
302 submit->bos[i].iova, submit->bos[i].flags);
Fix this by employing the same state->bos NULL check as is used in the next for loop.
--- drivers/gpu/drm/msm/msm_gpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/msm_gpu.c +1 -1
@@ -296,7 +296,7 @@ static void msm_gpu_crashstate_capture(struct msm_gpu *gpu, state->bos =kcalloc (nr,sizeof (struct msm_gpu_state_bo ),GFP_KERNEL ); -for (i =0 ; i < submit->nr_bos; i++) { +for (i =0 ; state->bos && i < submit->nr_bos; i++) {if (should_dump (submit, i)) {msm_gpu_crashstate_get_bo (state, submit->bos[i].obj, submit->bos[i].iova, submit->bos[i].flags);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 262/917 thermal/drivers/tsens: Add timeout to get_temp_tsens_valid
In reply to Greg Kroah-HartmanFrom: Ansuel Smith <[email protected]>
[ Upstream commit d012f9189fda0f3a1b303780ba0bbc7298d0d349 ]
The function can loop and lock the system if for whatever reason the bit for the target sensor is NEVER valid. This is the case if a sensor is disabled by the factory and the valid bit is never reported as actually valid. Add a timeout check and exit if a timeout occurs. As this is a very rare condition, handle the timeout only if the first read fails. While at it also rework the function to improve readability and convert to poll_timeout generic macro.
--- drivers/thermal/qcom/tsens.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-)
drivers/thermal/qcom/tsens.c +14 -15
@@ -603,22 +603,21 @@ int get_temp_tsens_valid(const struct tsens_sensor *s, int *temp)int ret;/* VER_0 doesn't have VALID bit */ -if (tsens_version (priv) >=VER_0_1 ) { - ret =regmap_field_read (priv->rf[valid_idx], &valid); -if (ret) -return ret; -while (!valid) { -/* Valid bit is 0 for 6 AHB clock cycles. -* At 19.2MHz, 1 AHB clock is ~60ns. -* We should enter this loop very, very rarely. -*/ -ndelay (400 ); - ret =regmap_field_read (priv->rf[valid_idx], &valid); -if (ret) -return ret; - } - } +if (tsens_version (priv) ==VER_0 ) + goto get_temp; + +/* Valid bit is 0 for 6 AHB clock cycles. +* At 19.2MHz, 1 AHB clock is ~60ns. +* We should enter this loop very, very rarely. +* Wait 1 us since it's the min of poll_timeout macro. +* Old value was 400 ns. +*/ + ret =regmap_field_read_poll_timeout (priv->rf[valid_idx], valid, + valid,1 ,20 *USEC_PER_MSEC ); +if (ret) +return ret; +get_temp:/* Valid bit is set, OK to read the temperature */ *temp =tsens_hw_to_mC (s, temp_idx);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 263/917 block: bump max plugged deferred size from 16 to 32
In reply to Greg Kroah-HartmanFrom: Jens Axboe <[email protected]>
[ Upstream commit ba0ffdd8ce48ad7f7e85191cd29f9674caca3745 ]
Particularly for NVMe with efficient deferred submission for many requests, there are nice benefits to be seen by bumping the default max plug count from 16 to 32. This is especially true for virtualized setups, where the submit part is more expensive. But can be noticed even on native hardware.
Reduce the multiple queue factor from 4 to 2, since we're changing the default size.
While changing it, move the defines into the block layer private header. These aren't values that anyone outside of the block layer uses, or should use.
--- block/blk-mq.c | 4 ++-- block/blk.h | 6 ++++++ include/linux/blkdev.h | 2 -- 3 files changed, 8 insertions(+), 4 deletions(-)
block/blk-mq.c +2 -2
@@ -2148,14 +2148,14 @@ static void blk_add_rq_to_plug(struct blk_plug *plug, struct request *rq) }/* -* Allow 4x BLK_MAX_REQUEST_COUNT requests on plug queue for multiple +* Allow 2x BLK_MAX_REQUEST_COUNT requests on plug queue for multiple * queues. This is important for md arrays to benefit from merging * requests. */ static inline unsigned short blk_plug_max_rq_count (struct blk_plug *plug) {if (plug->multiple_queues) -return BLK_MAX_REQUEST_COUNT *4 ; +return BLK_MAX_REQUEST_COUNT *2 ;return BLK_MAX_REQUEST_COUNT ; }
block/blk.h +6 -0
@@ -184,6 +184,12 @@ bool blk_bio_list_merge(struct request_queue *q, struct list_head *list,void blk_account_io_start (struct request *req);void blk_account_io_done (struct request *req,u64 now); +/* +* Plug flush limits +*/ +#define BLK_MAX_REQUEST_COUNT 32 +#define BLK_PLUG_FLUSH_SIZE (128 * 1024) +/* * Internal elevator interface */
include/linux/blkdev.h +0 -2
@@ -1198,8 +1198,6 @@ struct blk_plug {bool multiple_queues;bool nowait; }; -#define BLK_MAX_REQUEST_COUNT 16 -#define BLK_PLUG_FLUSH_SIZE (128 * 1024)struct blk_plug_cb ;typedef void (*blk_plug_cb_fn )(struct blk_plug_cb *,bool );
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 264/917 floppy: fix calling platform_device_unregister() on invalid drives
In reply to Greg Kroah-HartmanFrom: Luis Chamberlain <[email protected]>
[ Upstream commit 662167e59d2f3c15a44a88088fc6c1a67c8a3650 ]
platform_device_unregister() should only be called when a respective platform_device_register() is called. However the floppy driver currently allows failures when registring a drive and a bail out could easily cause an invalid call to platform_device_unregister() where it was not intended.
Fix this by adding a bool to keep track of when the platform device was registered for a drive.
This does not fix any known panic / bug. This issue was found through code inspection while preparing the driver to use the up and coming support for device_add_disk() error handling.
Quoted 1 line
From what I can tell from code inspection, chances of this
ever happening should be insanely small, perhaps OOM.
--- drivers/block/floppy.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/block/floppy.c +7 -2
@@ -4478,6 +4478,7 @@ static const struct blk_mq_ops floppy_mq_ops = { };static struct platform_device floppy_device[N_DRIVE ]; +static bool registered[N_DRIVE ];static bool floppy_available (int drive) {
@@ -4693,6 +4694,8 @@ static int __init do_floppy_init(void)if (err) goto out_remove_drives; + registered[drive] = true; +device_add_disk (&floppy_device[drive].dev, disks[drive][0 ],NULL ); }
@@ -4703,7 +4706,8 @@ out_remove_drives:while (drive--) {if (floppy_available (drive)) {del_gendisk (disks[drive][0 ]); -platform_device_unregister (&floppy_device[drive]); +if (registered[drive]) +platform_device_unregister (&floppy_device[drive]); } } out_release_dma:
@@ -4946,7 +4950,8 @@ static void __exit floppy_module_exit(void)if (disks[drive][i])del_gendisk (disks[drive][i]); } -platform_device_unregister (&floppy_device[drive]); +if (registered[drive]) +platform_device_unregister (&floppy_device[drive]); }for (i =0 ; i <ARRAY_SIZE (floppy_type); i++) {if (disks[drive][i])
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 265/917 md: update superblock after changing rdev flags in state_store
In reply to Greg Kroah-HartmanFrom: Xiao Ni <[email protected]>
[ Upstream commit 8b9e2291e355a0eafdd5b1e21a94a6659f24b351 ]
When the in memory flag is changed, we need to persist the change in the rdev superblock flags. This is needed for "writemostly" and "failfast".
--- drivers/md/md.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/md/md.c +10 -1
@@ -2976,7 +2976,11 @@ state_store(struct md_rdev *rdev, const char *buf, size_t len)* -write_error - clears WriteErrorSeen * {,-}failfast - set/clear FailFast */ + +struct mddev *mddev = rdev->mddev;int err = -EINVAL ; +bool need_update_sb = false; +if (cmd_match (buf,"faulty" ) && rdev->mddev->pers) {md_error (rdev->mddev, rdev);if (test_bit (Faulty, &rdev->flags))
@@ -2991,7 +2995,6 @@ state_store(struct md_rdev *rdev, const char *buf, size_t len)if (rdev->raid_disk >=0 ) err = -EBUSY ;else { -struct mddev *mddev = rdev->mddev; err =0 ;if (mddev_is_clustered (mddev)) err = md_cluster_ops->remove_disk (mddev, rdev);
@@ -3008,10 +3011,12 @@ state_store(struct md_rdev *rdev, const char *buf, size_t len) }else if (cmd_match (buf,"writemostly" )) {set_bit (WriteMostly, &rdev->flags);mddev_create_serial_pool (rdev->mddev, rdev, false); + need_update_sb = true; err =0 ; }else if (cmd_match (buf,"-writemostly" )) {mddev_destroy_serial_pool (rdev->mddev, rdev, false);clear_bit (WriteMostly, &rdev->flags); + need_update_sb = true; err =0 ; }else if (cmd_match (buf,"blocked" )) {set_bit (Blocked, &rdev->flags);
@@ -3037,9 +3042,11 @@ state_store(struct md_rdev *rdev, const char *buf, size_t len) err =0 ; }else if (cmd_match (buf,"failfast" )) {set_bit (FailFast, &rdev->flags); + need_update_sb = true; err =0 ; }else if (cmd_match (buf,"-failfast" )) {clear_bit (FailFast, &rdev->flags); + need_update_sb = true; err =0 ; }else if (cmd_match (buf,"-insync" ) && rdev->raid_disk >=0 && !test_bit (Journal, &rdev->flags)) {
@@ -3118,6 +3125,8 @@ state_store(struct md_rdev *rdev, const char *buf, size_t len)clear_bit (ExternalBbl, &rdev->flags); err =0 ; } +if (need_update_sb) +md_update_sb (mddev,1 );if (!err)sysfs_notify_dirent_safe (rdev->sysfs_state);return err ? err : len;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 266/917 memstick: r592: Fix a UAF bug when removing the driver
In reply to Greg Kroah-HartmanFrom: Zheyu Ma <[email protected]>
[ Upstream commit 738216c1953e802aa9f930c5d15b8f9092c847ff ]
In r592_remove(), the driver will free dma after freeing the host, which may cause a UAF bug.
The following log reveals it:
[ 45.361796 ] BUG: KASAN: use-after-free in r592_remove+0x269/0x350 [r592] [ 45.364286 ] Call Trace: [ 45.364472 ] dump_stack_lvl+0xa8/0xd1 [ 45.364751 ] print_address_description+0x87/0x3b0 [ 45.365137 ] kasan_report+0x172/0x1c0 [ 45.365415 ] ? r592_remove+0x269/0x350 [r592] [ 45.365834 ] ? r592_remove+0x269/0x350 [r592] [ 45.366168 ] __asan_report_load8_noabort+0x14/0x20 [ 45.366531 ] r592_remove+0x269/0x350 [r592] [ 45.378785 ] [ 45.378903 ] Allocated by task 4674: [ 45.379162 ] ____kasan_kmalloc+0xb5/0xe0 [ 45.379455 ] __kasan_kmalloc+0x9/0x10 [ 45.379730 ] __kmalloc+0x150/0x280 [ 45.379984 ] memstick_alloc_host+0x2a/0x190 [ 45.380664 ] [ 45.380781 ] Freed by task 5509: [ 45.381014 ] kasan_set_track+0x3d/0x70 [ 45.381293 ] kasan_set_free_info+0x23/0x40 [ 45.381635 ] ____kasan_slab_free+0x10b/0x140 [ 45.381950 ] __kasan_slab_free+0x11/0x20 [ 45.382241 ] slab_free_freelist_hook+0x81/0x150 [ 45.382575 ] kfree+0x13e/0x290 [ 45.382805 ] memstick_free+0x1c/0x20 [ 45.383070 ] device_release+0x9c/0x1d0 [ 45.383349 ] kobject_put+0x2ef/0x4c0 [ 45.383616 ] put_device+0x1f/0x30 [ 45.383865 ] memstick_free_host+0x24/0x30 [ 45.384162 ] r592_remove+0x242/0x350 [r592] [ 45.384473 ] pci_device_remove+0xa9/0x250
--- drivers/memstick/host/r592.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/memstick/host/r592.c +4 -4
@@ -838,15 +838,15 @@ static void r592_remove(struct pci_dev *pdev) }memstick_remove_host (dev->host); +if (dev->dummy_dma_page) +dma_free_coherent (&pdev->dev,PAGE_SIZE , dev->dummy_dma_page, + dev->dummy_dma_page_physical_address); +free_irq (dev->irq, dev);iounmap (dev->mmio);pci_release_regions (pdev);pci_disable_device (pdev);memstick_free_host (dev->host); - -if (dev->dummy_dma_page) -dma_free_coherent (&pdev->dev,PAGE_SIZE , dev->dummy_dma_page, - dev->dummy_dma_page_physical_address); }#ifdef CONFIG_PM_SLEEP
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 267/917 locking/rwsem: Disable preemption for spinning region
In reply to Greg Kroah-HartmanFrom: Yanfei Xu <[email protected]>
[ Upstream commit 7cdacc5f52d68a9370f182c844b5b3e6cc975cc1 ]
The spinning region rwsem_spin_on_owner() should not be preempted, however the rwsem_down_write_slowpath() invokes it and don't disable preemption. Fix it by adding a pair of preempt_disable/enable().
--- kernel/locking/rwsem.c | 53 ++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 23 deletions(-)
kernel/locking/rwsem.c +30 -23
@@ -577,6 +577,24 @@ static inline bool rwsem_try_write_lock(struct rw_semaphore *sem,return true; } +/* +* The rwsem_spin_on_owner() function returns the following 4 values +* depending on the lock owner state. +* OWNER_NULL : owner is currently NULL +* OWNER_WRITER: when owner changes and is a writer +* OWNER_READER: when owner changes and the new owner may be a reader. +* OWNER_NONSPINNABLE: +* when optimistic spinning has to stop because either the +* owner stops running, is unknown, or its timeslice has +* been used up. +*/ +enum owner_state { +OWNER_NULL =1 <<0 , +OWNER_WRITER =1 <<1 , +OWNER_READER =1 <<2 , +OWNER_NONSPINNABLE =1 <<3 , +}; +#ifdef CONFIG_RWSEM_SPIN_ON_OWNER /* * Try to acquire write lock before the writer has been put on wait queue.
@@ -632,23 +650,6 @@ static inline bool rwsem_can_spin_on_owner(struct rw_semaphore *sem)return ret; } -/* -* The rwsem_spin_on_owner() function returns the following 4 values -* depending on the lock owner state. -* OWNER_NULL : owner is currently NULL -* OWNER_WRITER: when owner changes and is a writer -* OWNER_READER: when owner changes and the new owner may be a reader. -* OWNER_NONSPINNABLE: -* when optimistic spinning has to stop because either the -* owner stops running, is unknown, or its timeslice has -* been used up. -*/ -enum owner_state { -OWNER_NULL =1 <<0 , -OWNER_WRITER =1 <<1 , -OWNER_READER =1 <<2 , -OWNER_NONSPINNABLE =1 <<3 , -};#define OWNER_SPINNABLE (OWNER_NULL | OWNER_WRITER | OWNER_READER) static inline enum owner_state
@@ -878,12 +879,11 @@ static inline bool rwsem_optimistic_spin(struct rw_semaphore *sem)static inline void clear_nonspinnable (struct rw_semaphore *sem) { } -static inline int +static inline enum owner_state rwsem_spin_on_owner (struct rw_semaphore *sem) { -return 0 ; +return OWNER_NONSPINNABLE ; } -#define OWNER_NULL 1#endif /*
@@ -1095,9 +1095,16 @@ wait:* In this case, we attempt to acquire the lock again * without sleeping. */ -if (wstate ==WRITER_HANDOFF && -rwsem_spin_on_owner (sem) ==OWNER_NULL ) - goto trylock_again; +if (wstate ==WRITER_HANDOFF ) { +enum owner_state owner_state; + +preempt_disable (); + owner_state =rwsem_spin_on_owner (sem); +preempt_enable (); + +if (owner_state ==OWNER_NULL ) + goto trylock_again; + }/* Block until there are no active lockers. */ for (;;) {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 268/917 lib/xz: Avoid overlapping memcpy() with invalid input with in-place decompression
In reply to Greg Kroah-HartmanFrom: Lasse Collin <[email protected]>
[ Upstream commit 83d3c4f22a36d005b55f44628f46cc0d319a75e8 ]
With valid files, the safety margin described in lib/decompress_unxz.c ensures that these buffers cannot overlap. But if the uncompressed size of the input is larger than the caller thought, which is possible when the input file is invalid/corrupt, the buffers can overlap. Obviously the result will then be garbage (and usually the decoder will return an error too) but no other harm will happen when such an over-run occurs.
This change only affects uncompressed LZMA2 chunks and so this should have no effect on performance.
--- lib/decompress_unxz.c | 2 +- lib/xz/xz_dec_lzma2.c | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-)
lib/decompress_unxz.c +1 -1
@@ -167,7 +167,7 @@* memeq and memzero are not used much and any remotely sane implementation * is fast enough. memcpy/memmove speed matters in multi-call mode, but * the kernel image is decompressed in single-call mode, in which only -* memcpy speed can matter and only if there is a lot of uncompressible data +* memmove speed can matter and only if there is a lot of uncompressible data * (LZMA2 stores uncompressible chunks in uncompressed form). Thus, the * functions below should just be kept small; it's probably not worth * optimizing for speed.
lib/xz/xz_dec_lzma2.c +19 -2
@@ -387,7 +387,14 @@ static void dict_uncompressed(struct dictionary *dict, struct xz_buf *b, *left -= copy_size; -memcpy (dict->buf + dict->pos, b->in + b->in_pos, copy_size); +/* +* If doing in-place decompression in single-call mode and the +* uncompressed size of the file is larger than the caller +* thought (i.e. it is invalid input!), the buffers below may +* overlap and cause undefined behavior with memcpy(). +* With valid inputs memcpy() would be fine here. +*/ +memmove (dict->buf + dict->pos, b->in + b->in_pos, copy_size); dict->pos += copy_size;if (dict->full < dict->pos)
@@ -397,7 +404,11 @@ static void dict_uncompressed(struct dictionary *dict, struct xz_buf *b,if (dict->pos == dict->end) dict->pos =0 ; -memcpy (b->out + b->out_pos, b->in + b->in_pos, +/* +* Like above but for multi-call mode: use memmove() +* to avoid undefined behavior with invalid input. +*/ +memmove (b->out + b->out_pos, b->in + b->in_pos, copy_size); }
@@ -421,6 +432,12 @@ static uint32_t dict_flush(struct dictionary *dict, struct xz_buf *b)if (dict->pos == dict->end) dict->pos =0 ; +/* +* These buffers cannot overlap even if doing in-place +* decompression because in multi-call mode dict->buf +* has been allocated by us in this file; it's not +* provided by the caller like in single-call mode. +*/ memcpy (b->out + b->out_pos, dict->buf + dict->start, copy_size); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 269/917 lib/xz: Validate the value before assigning it to an enum variable
In reply to Greg Kroah-HartmanFrom: Lasse Collin <[email protected]>
[ Upstream commit 4f8d7abaa413c34da9d751289849dbfb7c977d05 ]
This might matter, for example, if the underlying type of enum xz_check was a signed char. In such a case the validation wouldn't have caught an unsupported header. I don't know if this problem can occur in the kernel on any arch but it's still good to fix it because some people might copy the XZ code to their own projects from Linux instead of the upstream XZ Embedded repository.
This change may increase the code size by a few bytes. An alternative would have been to use an unsigned int instead of enum xz_check but using an enumeration looks cleaner.
--- lib/xz/xz_dec_stream.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
lib/xz/xz_dec_stream.c +3 -3
@@ -402,12 +402,12 @@ static enum xz_ret dec_stream_header(struct xz_dec *s)* we will accept other check types too, but then the check won't * be verified and a warning (XZ_UNSUPPORTED_CHECK) will be given. */ +if (s->temp.buf[HEADER_MAGIC_SIZE +1 ] >XZ_CHECK_MAX ) +return XZ_OPTIONS_ERROR ; + s->check_type = s->temp.buf[HEADER_MAGIC_SIZE +1 ];#ifdef XZ_DEC_ANY_CHECK -if (s->check_type >XZ_CHECK_MAX ) -return XZ_OPTIONS_ERROR ; -if (s->check_type >XZ_CHECK_CRC32 )return XZ_UNSUPPORTED_CHECK ;#else
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 270/917 workqueue: make sysfs of unbound kworker cpumask more clever
In reply to Greg Kroah-HartmanFrom: Menglong Dong <[email protected]>
[ Upstream commit d25302e46592c97d29f70ccb1be558df31a9a360 ]
Some unfriendly component, such as dpdk, write the same mask to unbound kworker cpumask again and again. Every time it write to this interface some work is queue to cpu, even though the mask is same with the original mask.
So, fix it by return success and do nothing if the cpumask is equal with the old one.
--- kernel/workqueue.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
kernel/workqueue.c +11 -4
@@ -5384,9 +5384,6 @@ int workqueue_set_unbound_cpumask(cpumask_var_t cpumask)int ret = -EINVAL ;cpumask_var_t saved_cpumask; -if (!zalloc_cpumask_var (&saved_cpumask,GFP_KERNEL )) -return -ENOMEM ; -/* * Not excluding isolated cpus on purpose. * If the user wishes to include them, we allow that.
@@ -5394,6 +5391,15 @@ int workqueue_set_unbound_cpumask(cpumask_var_t cpumask)cpumask_and (cpumask, cpumask, cpu_possible_mask);if (!cpumask_empty (cpumask)) {apply_wqattrs_lock (); +if (cpumask_equal (cpumask, wq_unbound_cpumask)) { + ret =0 ; + goto out_unlock; + } + +if (!zalloc_cpumask_var (&saved_cpumask,GFP_KERNEL )) { + ret = -ENOMEM ; + goto out_unlock; + }/* save the old wq_unbound_cpumask. */ cpumask_copy (saved_cpumask, wq_unbound_cpumask);
@@ -5406,10 +5412,11 @@ int workqueue_set_unbound_cpumask(cpumask_var_t cpumask)if (ret <0 )cpumask_copy (wq_unbound_cpumask, saved_cpumask); +free_cpumask_var (saved_cpumask); +out_unlock:apply_wqattrs_unlock (); } -free_cpumask_var (saved_cpumask);return ret; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 271/917 tracing/cfi: Fix cmp_entries_* functions signature mismatch
In reply to Greg Kroah-HartmanFrom: Kalesh Singh <[email protected]>
[ Upstream commit 7ce1bb83a14019f8c396d57ec704d19478747716 ]
If CONFIG_CFI_CLANG=y, attempting to read an event histogram will cause the kernel to panic due to failed CFI check.
1. echo 'hist:keys=common_pid' >> events/sched/sched_switch/trigger
2. cat events/sched/sched_switch/hist
3. kernel panics on attempting to read hist
This happens because the sort() function expects a generic int (*)(const void *, const void *) pointer for the compare function. To prevent this CFI failure, change tracing map cmp_entries_* function signatures to match this.
Also, fix the build error reported by the kernel test robot [1].
[1] https://lore.kernel.org/r/[email protected]/
--- kernel/trace/tracing_map.c | 40 ++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 17 deletions(-)
kernel/trace/tracing_map.c +23 -17
@@ -834,29 +834,35 @@ int tracing_map_init(struct tracing_map *map)return err; } -static int cmp_entries_dup (const struct tracing_map_sort_entry **a, -const struct tracing_map_sort_entry **b) +static int cmp_entries_dup (const void *A ,const void *B ) { +const struct tracing_map_sort_entry *a, *b;int ret =0 ; -if (memcmp ((*a)->key, (*b)->key, (*a)->elt->map->key_size)) + a = *(const struct tracing_map_sort_entry **)A ; + b = *(const struct tracing_map_sort_entry **)B ; + +if (memcmp (a->key, b->key, a->elt->map->key_size)) ret =1 ;return ret; } -static int cmp_entries_sum (const struct tracing_map_sort_entry **a, -const struct tracing_map_sort_entry **b) +static int cmp_entries_sum (const void *A ,const void *B ) {const struct tracing_map_elt *elt_a, *elt_b; +const struct tracing_map_sort_entry *a, *b;struct tracing_map_sort_key *sort_key;struct tracing_map_field *field;tracing_map_cmp_fn_t cmp_fn;void *val_a, *val_b;int ret =0 ; - elt_a = (*a)->elt; - elt_b = (*b)->elt; + a = *(const struct tracing_map_sort_entry **)A ; + b = *(const struct tracing_map_sort_entry **)B ; + + elt_a = a->elt; + elt_b = b->elt; sort_key = &elt_a->map->sort_key;
@@ -873,18 +879,21 @@ static int cmp_entries_sum(const struct tracing_map_sort_entry **a,return ret; } -static int cmp_entries_key (const struct tracing_map_sort_entry **a, -const struct tracing_map_sort_entry **b) +static int cmp_entries_key (const void *A ,const void *B ) {const struct tracing_map_elt *elt_a, *elt_b; +const struct tracing_map_sort_entry *a, *b;struct tracing_map_sort_key *sort_key;struct tracing_map_field *field;tracing_map_cmp_fn_t cmp_fn;void *val_a, *val_b;int ret =0 ; - elt_a = (*a)->elt; - elt_b = (*b)->elt; + a = *(const struct tracing_map_sort_entry **)A ; + b = *(const struct tracing_map_sort_entry **)B ; + + elt_a = a->elt; + elt_b = b->elt; sort_key = &elt_a->map->sort_key;
@@ -989,10 +998,8 @@ static void sort_secondary(struct tracing_map *map, struct tracing_map_sort_key *primary_key, struct tracing_map_sort_key *secondary_key) { -int (*primary_fn)(const struct tracing_map_sort_entry **, -const struct tracing_map_sort_entry **); -int (*secondary_fn)(const struct tracing_map_sort_entry **, -const struct tracing_map_sort_entry **); +int (*primary_fn)(const void *,const void *); +int (*secondary_fn)(const void *,const void *);unsigned i, start =0 , n_sub =1 ;if (is_key (map, primary_key->field_idx))
@@ -1061,8 +1068,7 @@ int tracing_map_sort_entries(struct tracing_map *map, unsigned int n_sort_keys, struct tracing_map_sort_entry ***sort_entries) { -int (*cmp_entries_fn)(const struct tracing_map_sort_entry **, -const struct tracing_map_sort_entry **); +int (*cmp_entries_fn)(const void *,const void *);struct tracing_map_sort_entry *sort_entry, **entries;int i, n_entries, ret;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 272/917 mt76: mt7915: fix an off-by-one bound check
In reply to Greg Kroah-HartmanFrom: Ryder Lee <[email protected]>
[ Upstream commit d45dac0732a287fc371a23f257cce04e65627947 ]
The bounds check on datalen is off-by-one, so fix it.
--- drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +1 -1
@@ -925,7 +925,7 @@ static void mt7915_check_he_obss_narrow_bw_ru_iter(struct wiphy *wiphy, elem =ieee80211_bss_get_elem (bss,WLAN_EID_EXT_CAPABILITY ); -if (!elem || elem->datalen <10 || +if (!elem || elem->datalen <=10 || !(elem->data[10 ] &WLAN_EXT_CAPA10_OBSS_NARROW_BW_RU_TOLERANCE_SUPPORT )) data->tolerated = false;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 273/917 mwl8k: Fix use-after-free in mwl8k_fw_state_machine()
In reply to Greg Kroah-HartmanFrom: Zheyu Ma <[email protected]>
[ Upstream commit 257051a235c17e33782b6e24a4b17f2d7915aaec ]
When the driver fails to request the firmware, it calls its error handler. In the error handler, the driver detaches device from driver first before releasing the firmware, which can cause a use-after-free bug.
Fix this by releasing firmware first.
The following log reveals it:
[ 9.007301 ] BUG: KASAN: use-after-free in mwl8k_fw_state_machine+0x320/0xba0 [ 9.010143 ] Workqueue: events request_firmware_work_func [ 9.010830 ] Call Trace: [ 9.010830 ] dump_stack_lvl+0xa8/0xd1 [ 9.010830 ] print_address_description+0x87/0x3b0 [ 9.010830 ] kasan_report+0x172/0x1c0 [ 9.010830 ] ? mutex_unlock+0xd/0x10 [ 9.010830 ] ? mwl8k_fw_state_machine+0x320/0xba0 [ 9.010830 ] ? mwl8k_fw_state_machine+0x320/0xba0 [ 9.010830 ] __asan_report_load8_noabort+0x14/0x20 [ 9.010830 ] mwl8k_fw_state_machine+0x320/0xba0 [ 9.010830 ] ? mwl8k_load_firmware+0x5f0/0x5f0 [ 9.010830 ] request_firmware_work_func+0x172/0x250 [ 9.010830 ] ? read_lock_is_recursive+0x20/0x20 [ 9.010830 ] ? process_one_work+0x7a1/0x1100 [ 9.010830 ] ? request_firmware_nowait+0x460/0x460 [ 9.010830 ] ? __this_cpu_preempt_check+0x13/0x20 [ 9.010830 ] process_one_work+0x9bb/0x1100
--- drivers/net/wireless/marvell/mwl8k.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/marvell/mwl8k.c +1 -1
@@ -5800,8 +5800,8 @@ static void mwl8k_fw_state_machine(const struct firmware *fw, void *context) fail: priv->fw_state =FW_STATE_ERROR ;complete (&priv->firmware_loading_complete); -device_release_driver (&priv->pdev->dev);mwl8k_release_firmware (priv); +device_release_driver (&priv->pdev->dev); }#define MAX_RESTART_ATTEMPTS 1
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 274/917 iwlwifi: change all JnP to NO-160 configuration
In reply to Greg Kroah-HartmanFrom: Yaara Baruch <[email protected]>
[ Upstream commit 70382b0897eeecfcd35ba5f6161dbceeb556ea1e ]
JnP should not have the 160 MHz.
--- drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/pcie/drv.c +3 -3
@@ -931,9 +931,9 @@ static const struct iwl_dev_info iwl_dev_info_table[] = { IWL_CFG_ANY, IWL_CFG_ANY, IWL_CFG_NO_CDB, iwl_qu_b0_hr1_b0, iwl_ax101_name),_IWL_DEV_INFO (IWL_CFG_ANY ,IWL_CFG_ANY , -IWL_CFG_MAC_TYPE_QU ,SILICON_C_STEP , +IWL_CFG_MAC_TYPE_QU ,SILICON_B_STEP ,IWL_CFG_RF_TYPE_HR2 ,IWL_CFG_ANY , -IWL_CFG_ANY ,IWL_CFG_ANY ,IWL_CFG_NO_CDB , +IWL_CFG_NO_160 ,IWL_CFG_ANY ,IWL_CFG_NO_CDB , iwl_qu_b0_hr_b0, iwl_ax203_name),/* Qu C step */
@@ -945,7 +945,7 @@ static const struct iwl_dev_info iwl_dev_info_table[] = {_IWL_DEV_INFO (IWL_CFG_ANY ,IWL_CFG_ANY ,IWL_CFG_MAC_TYPE_QU ,SILICON_C_STEP ,IWL_CFG_RF_TYPE_HR2 ,IWL_CFG_ANY , -IWL_CFG_ANY ,IWL_CFG_ANY ,IWL_CFG_NO_CDB , +IWL_CFG_NO_160 ,IWL_CFG_ANY ,IWL_CFG_NO_CDB , iwl_qu_c0_hr_b0, iwl_ax203_name),/* QuZ */
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 275/917 block: remove inaccurate requeue check
In reply to Greg Kroah-HartmanFrom: Jens Axboe <[email protected]>
[ Upstream commit 037057a5a979c7eeb2ee5d12cf4c24b805192c75 ]
This check is meant to catch cases where a requeue is attempted on a request that is still inserted. It's never really been useful to catch any misuse, and now it's actively wrong. Outside of that, this should not be a BUG_ON() to begin with.
Remove the check as it's now causing active harm, as requeue off the plug path will trigger it even though the request state is just fine.
--- block/blk-mq.c | 1 - 1 file changed, 1 deletion(-)
block/blk-mq.c +0 -1
@@ -763,7 +763,6 @@ void blk_mq_requeue_request(struct request *rq, bool kick_requeue_list)/* this request will be re-inserted to io scheduler queue */ blk_mq_sched_requeue_request (rq); -BUG_ON (!list_empty (&rq->queuelist));blk_mq_add_to_requeue_list (rq, true, kick_requeue_list); }EXPORT_SYMBOL (blk_mq_requeue_request);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 276/917 media: allegro: ignore interrupt if mailbox is not initialized
In reply to Greg Kroah-HartmanFrom: Michael Tretter <[email protected]>
[ Upstream commit 1ecda6393db4be44aba27a243e648dc98c9b92e3 ]
The mailbox is initialized after the interrupt handler is installed. As the firmware is loaded and started even later, it should not happen that the interrupt occurs without the mailbox being initialized.
As the Linux Driver Verification project (linuxtesting.org) keeps reporting this as an error, add a check to ignore interrupts before the mailbox is initialized to fix this potential null pointer dereference.
--- drivers/media/platform/allegro-dvt/allegro-core.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/media/platform/allegro-dvt/allegro-core.c +9 -0
@@ -2185,6 +2185,15 @@ static irqreturn_t allegro_irq_thread(int irq, void *data) {struct allegro_dev *dev = data; +/* +* The firmware is initialized after the mailbox is setup. We further +* check the AL5_ITC_CPU_IRQ_STA register, if the firmware actually +* triggered the interrupt. Although this should not happen, make sure +* that we ignore interrupts, if the mailbox is not initialized. +*/ +if (!dev->mbox_status) +return IRQ_NONE ; +allegro_mbox_notify (dev->mbox_status);return IRQ_HANDLED ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 277/917 drm/amdgpu/pm: properly handle sclk for profiling modes on vangogh
In reply to Greg Kroah-HartmanFrom: Alex Deucher <[email protected]>
[ Upstream commit 68e3871dcd6e547f6c47454492bc452356cb9eac ]
When selecting between levels in the force performance levels interface sclk (gfxclk) was not set correctly for all levels. Select the proper sclk settings for all levels.
--- .../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c | 89 ++++++------------- 1 file changed, 29 insertions(+), 60 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +29 -60
@@ -1386,52 +1386,38 @@ static int vangogh_set_performance_level(struct smu_context *smu,uint32_t soc_mask, mclk_mask, fclk_mask;uint32_t vclk_mask =0 , dclk_mask =0 ; + smu->cpu_actual_soft_min_freq = smu->cpu_default_soft_min_freq; + smu->cpu_actual_soft_max_freq = smu->cpu_default_soft_max_freq; +switch (level) {case AMD_DPM_FORCED_LEVEL_HIGH : - smu->gfx_actual_hard_min_freq = smu->gfx_default_hard_min_freq; + smu->gfx_actual_hard_min_freq = smu->gfx_default_soft_max_freq; smu->gfx_actual_soft_max_freq = smu->gfx_default_soft_max_freq; - smu->cpu_actual_soft_min_freq = smu->cpu_default_soft_min_freq; - smu->cpu_actual_soft_max_freq = smu->cpu_default_soft_max_freq; ret =vangogh_force_dpm_limit_value (smu, true); +if (ret) +return ret;break ;case AMD_DPM_FORCED_LEVEL_LOW : smu->gfx_actual_hard_min_freq = smu->gfx_default_hard_min_freq; - smu->gfx_actual_soft_max_freq = smu->gfx_default_soft_max_freq; - - smu->cpu_actual_soft_min_freq = smu->cpu_default_soft_min_freq; - smu->cpu_actual_soft_max_freq = smu->cpu_default_soft_max_freq; + smu->gfx_actual_soft_max_freq = smu->gfx_default_hard_min_freq; ret =vangogh_force_dpm_limit_value (smu, false); +if (ret) +return ret;break ;case AMD_DPM_FORCED_LEVEL_AUTO : smu->gfx_actual_hard_min_freq = smu->gfx_default_hard_min_freq; smu->gfx_actual_soft_max_freq = smu->gfx_default_soft_max_freq; - smu->cpu_actual_soft_min_freq = smu->cpu_default_soft_min_freq; - smu->cpu_actual_soft_max_freq = smu->cpu_default_soft_max_freq; - ret =vangogh_unforce_dpm_levels (smu); -break ; -case AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD : - smu->gfx_actual_hard_min_freq = smu->gfx_default_hard_min_freq; - smu->gfx_actual_soft_max_freq = smu->gfx_default_soft_max_freq; - - smu->cpu_actual_soft_min_freq = smu->cpu_default_soft_min_freq; - smu->cpu_actual_soft_max_freq = smu->cpu_default_soft_max_freq; - - ret =smu_cmn_send_smc_msg_with_param (smu, - SMU_MSG_SetHardMinGfxClk, -VANGOGH_UMD_PSTATE_STANDARD_GFXCLK ,NULL ); -if (ret) -return ret; - - ret =smu_cmn_send_smc_msg_with_param (smu, - SMU_MSG_SetSoftMaxGfxClk, -VANGOGH_UMD_PSTATE_STANDARD_GFXCLK ,NULL );if (ret)return ret; +break ; +case AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD : + smu->gfx_actual_hard_min_freq =VANGOGH_UMD_PSTATE_STANDARD_GFXCLK ; + smu->gfx_actual_soft_max_freq =VANGOGH_UMD_PSTATE_STANDARD_GFXCLK ; ret = vangogh_get_profiling_clk_mask(smu, level, &vclk_mask,
@@ -1446,32 +1432,15 @@ static int vangogh_set_performance_level(struct smu_context *smu,vangogh_force_clk_levels (smu,SMU_SOCCLK ,1 << soc_mask);vangogh_force_clk_levels (smu,SMU_VCLK ,1 << vclk_mask);vangogh_force_clk_levels (smu,SMU_DCLK ,1 << dclk_mask); -break ;case AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK : smu->gfx_actual_hard_min_freq = smu->gfx_default_hard_min_freq; - smu->gfx_actual_soft_max_freq = smu->gfx_default_soft_max_freq; - - smu->cpu_actual_soft_min_freq = smu->cpu_default_soft_min_freq; - smu->cpu_actual_soft_max_freq = smu->cpu_default_soft_max_freq; - - ret =smu_cmn_send_smc_msg_with_param (smu, SMU_MSG_SetHardMinVcn, -VANGOGH_UMD_PSTATE_PEAK_DCLK ,NULL ); -if (ret) -return ret; - - ret =smu_cmn_send_smc_msg_with_param (smu, SMU_MSG_SetSoftMaxVcn, -VANGOGH_UMD_PSTATE_PEAK_DCLK ,NULL ); -if (ret) -return ret; + smu->gfx_actual_soft_max_freq = smu->gfx_default_hard_min_freq;break ;case AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK : smu->gfx_actual_hard_min_freq = smu->gfx_default_hard_min_freq; smu->gfx_actual_soft_max_freq = smu->gfx_default_soft_max_freq; - smu->cpu_actual_soft_min_freq = smu->cpu_default_soft_min_freq; - smu->cpu_actual_soft_max_freq = smu->cpu_default_soft_max_freq; - ret = vangogh_get_profiling_clk_mask(smu, level, NULL, NULL,
@@ -1484,29 +1453,29 @@ static int vangogh_set_performance_level(struct smu_context *smu,vangogh_force_clk_levels (smu,SMU_FCLK ,1 << fclk_mask);break ;case AMD_DPM_FORCED_LEVEL_PROFILE_PEAK : - smu->gfx_actual_hard_min_freq = smu->gfx_default_hard_min_freq; - smu->gfx_actual_soft_max_freq = smu->gfx_default_soft_max_freq; - - smu->cpu_actual_soft_min_freq = smu->cpu_default_soft_min_freq; - smu->cpu_actual_soft_max_freq = smu->cpu_default_soft_max_freq; - - ret =smu_cmn_send_smc_msg_with_param (smu, SMU_MSG_SetHardMinGfxClk, -VANGOGH_UMD_PSTATE_PEAK_GFXCLK ,NULL ); -if (ret) -return ret; + smu->gfx_actual_hard_min_freq =VANGOGH_UMD_PSTATE_PEAK_GFXCLK ; + smu->gfx_actual_soft_max_freq =VANGOGH_UMD_PSTATE_PEAK_GFXCLK ; - ret =smu_cmn_send_smc_msg_with_param (smu, SMU_MSG_SetSoftMaxGfxClk, -VANGOGH_UMD_PSTATE_PEAK_GFXCLK ,NULL ); + ret =vangogh_set_peak_clock_by_device (smu);if (ret)return ret; - - ret =vangogh_set_peak_clock_by_device (smu);break ;case AMD_DPM_FORCED_LEVEL_MANUAL :case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT :default : -break ; +return 0 ; } + + ret =smu_cmn_send_smc_msg_with_param (smu, SMU_MSG_SetHardMinGfxClk, + smu->gfx_actual_hard_min_freq,NULL ); +if (ret) +return ret; + + ret =smu_cmn_send_smc_msg_with_param (smu, SMU_MSG_SetSoftMaxGfxClk, + smu->gfx_actual_soft_max_freq,NULL ); +if (ret) +return ret; +return ret; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 278/917 nvmet: fix use-after-free when a port is removed
In reply to Greg Kroah-HartmanFrom: Israel Rukshin <[email protected]>
[ Upstream commit e3e19dcc4c416d65f99f13d55be2b787f8d0050e ]
When a port is removed through configfs, any connected controllers are starting teardown flow asynchronously and can still send commands. This causes a use-after-free bug for any command that dereferences req->port (like in nvmet_parse_io_cmd).
To fix this, wait for all the teardown scheduled works to complete (like release_work at rdma/tcp drivers). This ensures there are no active controllers when the port is eventually removed.
--- drivers/nvme/target/configfs.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/nvme/target/configfs.c +2 -0
@@ -1553,6 +1553,8 @@ static void nvmet_port_release(struct config_item *item) {struct nvmet_port *port =to_nvmet_port (item); +/* Let inflight controllers teardown complete */ +flush_scheduled_work ();list_del (&port->global_entry);kfree (port->ana_state);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 279/917 nvmet-rdma: fix use-after-free when a port is removed
In reply to Greg Kroah-HartmanFrom: Israel Rukshin <[email protected]>
[ Upstream commit fcf73a804c7d6bbf0ea63531c6122aa363852e04 ]
When removing a port, all its controllers are being removed, but there are queues on the port that doesn't belong to any controller (during connection time). This causes a use-after-free bug for any command that dereferences req->port (like in nvmet_alloc_ctrl). Those queues should be destroyed before freeing the port via configfs. Destroy the remaining queues after the RDMA-CM was destroyed guarantees that no new queue will be created.
--- drivers/nvme/target/rdma.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/nvme/target/rdma.c +24 -0
@@ -1818,12 +1818,36 @@ restart:mutex_unlock (&nvmet_rdma_queue_mutex); } +static void nvmet_rdma_destroy_port_queues (struct nvmet_rdma_port *port) +{ +struct nvmet_rdma_queue *queue, *tmp; +struct nvmet_port *nport = port->nport; + +mutex_lock (&nvmet_rdma_queue_mutex); +list_for_each_entry_safe (queue, tmp, &nvmet_rdma_queue_list, + queue_list) { +if (queue->port != nport) +continue ; + +list_del_init (&queue->queue_list); +__nvmet_rdma_queue_disconnect (queue); + } +mutex_unlock (&nvmet_rdma_queue_mutex); +} +static void nvmet_rdma_disable_port (struct nvmet_rdma_port *port) {struct rdma_cm_id *cm_id =xchg (&port->cm_id,NULL );if (cm_id)rdma_destroy_id (cm_id); + +/* +* Destroy the remaining queues, which are not belong to any +* controller yet. Do it here after the RDMA-CM was destroyed +* guarantees that no new queue will be created. +*/ +nvmet_rdma_destroy_port_queues (port); }static int nvmet_rdma_enable_port (struct nvmet_rdma_port *port)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 280/917 nvmet-tcp: fix use-after-free when a port is removed
In reply to Greg Kroah-HartmanFrom: Israel Rukshin <[email protected]>
[ Upstream commit 2351ead99ce9164fb42555aee3f96af84c4839e9 ]
When removing a port, all its controllers are being removed, but there are queues on the port that doesn't belong to any controller (during connection time). This causes a use-after-free bug for any command that dereferences req->port (like in nvmet_alloc_ctrl). Those queues should be destroyed before freeing the port via configfs. Destroy the remaining queues after the accept_work was cancelled guarantees that no new queue will be created.
--- drivers/nvme/target/tcp.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/nvme/target/tcp.c +16 -0
@@ -1740,6 +1740,17 @@ err_port:return ret; } +static void nvmet_tcp_destroy_port_queues (struct nvmet_tcp_port *port) +{ +struct nvmet_tcp_queue *queue; + +mutex_lock (&nvmet_tcp_queue_mutex); +list_for_each_entry (queue, &nvmet_tcp_queue_list, queue_list) +if (queue->port == port) +kernel_sock_shutdown (queue->sock,SHUT_RDWR ); +mutex_unlock (&nvmet_tcp_queue_mutex); +} +static void nvmet_tcp_remove_port (struct nvmet_port *nport) {struct nvmet_tcp_port *port = nport->priv;
@@ -1749,6 +1760,11 @@ static void nvmet_tcp_remove_port(struct nvmet_port *nport) port->sock->sk->sk_user_data =NULL ;write_unlock_bh (&port->sock->sk->sk_callback_lock);cancel_work_sync (&port->accept_work); +/* +* Destroy the remaining queues, which are not belong to any +* controller yet. +*/ +nvmet_tcp_destroy_port_queues (port);sock_release (port->sock);kfree (port);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 281/917 nvme: drop scan_lock and always kick requeue list when removing namespaces
In reply to Greg Kroah-HartmanFrom: Hannes Reinecke <[email protected]>
[ Upstream commit 2b81a5f015199f3d585ce710190a9e87714d3c1e ]
When reading the partition table on initial scan hits an I/O error the I/O will hang with the scan_mutex held:
[<0>] do_read_cache_page+0x49b/0x790 [<0>] read_part_sector+0x39/0xe0 [<0>] read_lba+0xf9/0x1d0 [<0>] efi_partition+0xf1/0x7f0 [<0>] bdev_disk_changed+0x1ee/0x550 [<0>] blkdev_get_whole+0x81/0x90 [<0>] blkdev_get_by_dev+0x128/0x2e0 [<0>] device_add_disk+0x377/0x3c0 [<0>] nvme_mpath_set_live+0x130/0x1b0 [nvme_core] [<0>] nvme_mpath_add_disk+0x150/0x160 [nvme_core] [<0>] nvme_alloc_ns+0x417/0x950 [nvme_core] [<0>] nvme_validate_or_alloc_ns+0xe9/0x1e0 [nvme_core] [<0>] nvme_scan_work+0x168/0x310 [nvme_core] [<0>] process_one_work+0x231/0x420
and trying to delete the controller will deadlock as it tries to grab the scan mutex:
[<0>] nvme_mpath_clear_ctrl_paths+0x25/0x80 [nvme_core] [<0>] nvme_remove_namespaces+0x31/0xf0 [nvme_core] [<0>] nvme_do_delete_ctrl+0x4b/0x80 [nvme_core]
As we're now properly ordering the namespace list there is no need to hold the scan_mutex in nvme_mpath_clear_ctrl_paths() anymore. And we always need to kick the requeue list as the path will be marked as unusable and I/O will be requeued _without_ a current path.
--- drivers/nvme/host/multipath.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/nvme/host/multipath.c +4 -5
@@ -138,13 +138,12 @@ void nvme_mpath_clear_ctrl_paths(struct nvme_ctrl *ctrl) {struct nvme_ns *ns; -mutex_lock (&ctrl->scan_lock);down_read (&ctrl->namespaces_rwsem); -list_for_each_entry (ns, &ctrl->namespaces, list) -if (nvme_mpath_clear_current_path (ns)) -kblockd_schedule_work (&ns->head->requeue_work); +list_for_each_entry (ns, &ctrl->namespaces, list) { +nvme_mpath_clear_current_path (ns); +kblockd_schedule_work (&ns->head->requeue_work); + }up_read (&ctrl->namespaces_rwsem); -mutex_unlock (&ctrl->scan_lock); }void nvme_mpath_revalidate_paths (struct nvme_ns *ns)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 282/917 samples/bpf: Fix application of sizeof to pointer
In reply to Greg Kroah-HartmanFrom: David Yang <[email protected]>
[ Upstream commit b599015f044df53e93ad0a2957b615bc1a26bf73 ]
The coccinelle check report:
"./samples/bpf/xdp_redirect_cpu_user.c:397:32-38:
ERROR: application of sizeof to pointer"
Using the "strlen" to fix it.
--- samples/bpf/xdp_redirect_cpu_user.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
samples/bpf/xdp_redirect_cpu_user.c +2 -4
@@ -325,7 +325,6 @@ int main(int argc, char **argv)int add_cpu =-1 ;int ifindex =-1 ;int *cpu, i, opt; -char *ifname;__u32 qsize;int n_cpus;
@@ -393,9 +392,8 @@ int main(int argc, char **argv)fprintf (stderr,"-d/--dev name too long\n" ); goto end_cpu; } - ifname = (char *)&ifname_buf; -safe_strncpy (ifname, optarg,sizeof (ifname)); - ifindex =if_nametoindex (ifname); +safe_strncpy (ifname_buf, optarg,strlen (ifname_buf)); + ifindex =if_nametoindex (ifname_buf);if (!ifindex) ifindex =strtoul (optarg,NULL ,0 );if (!ifindex) {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 283/917 arm64: vdso32: suppress error message for make mrproper
In reply to Greg Kroah-HartmanFrom: Nick Desaulniers <[email protected]>
[ Upstream commit 14831fad73f5ac30ac61760487d95a538e6ab3cb ]
When running the following command without arm-linux-gnueabi-gcc in one's $PATH, the following warning is observed:
$ ARCH=arm64 CROSS_COMPILE_COMPAT=arm-linux-gnueabi- make -j72 LLVM=1 mrproper make[1]: arm-linux-gnueabi-gcc: No such file or directory
This is because KCONFIG is not run for mrproper, so CONFIG_CC_IS_CLANG is not set, and we end up eagerly evaluating various variables that try to invoke CC_COMPAT.
This is a similar problem to what was observed in
commit dc960bfeedb0 ("h8300: suppress error messages for 'make clean'")
--- arch/arm64/kernel/vdso32/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/kernel/vdso32/Makefile +2 -1
@@ -40,7 +40,8 @@ cc32-as-instr = $(call try-run,\ # As a result we set our own flags here. # KBUILD_CPPFLAGS and NOSTDINC_FLAGS from top-level Makefile -VDSO_CPPFLAGS := -DBUILD_VDSO -D__KERNEL__ -nostdinc -isystem $(shell $(CC_COMPAT) -print-file-name=include) +VDSO_CPPFLAGS := -DBUILD_VDSO -D__KERNEL__ -nostdinc +VDSO_CPPFLAGS += -isystem $(shell $(CC_COMPAT) -print-file-name=include 2>/dev/null) VDSO_CPPFLAGS += $(LINUXINCLUDE) # Common C and assembly flags
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 284/917 PM: hibernate: Get block device exclusively in swsusp_check()
In reply to Greg Kroah-HartmanFrom: Ye Bin <[email protected]>
[ Upstream commit 39fbef4b0f77f9c89c8f014749ca533643a37c9f ]
The following kernel crash can be triggered:
[ 89.266592] ------------[ cut here ]------------ [ 89.267427] kernel BUG at fs/buffer.c:3020! [ 89.268264] invalid opcode: 0000 [#1] SMP KASAN PTI [ 89.269116] CPU: 7 PID: 1750 Comm: kmmpd-loop0 Not tainted 5.10.0-862.14.0.6.x86_64-08610-gc932cda3cef4-dirty #20 [ 89.273169] RIP: 0010:submit_bh_wbc.isra.0+0x538/0x6d0 [ 89.277157] RSP: 0018:ffff888105ddfd08 EFLAGS: 00010246 [ 89.278093] RAX: 0000000000000005 RBX: ffff888124231498 RCX: ffffffffb2772612 [ 89.279332] RDX: 1ffff11024846293 RSI: 0000000000000008 RDI: ffff888124231498 [ 89.280591] RBP: ffff8881248cc000 R08: 0000000000000001 R09: ffffed1024846294 [ 89.281851] R10: ffff88812423149f R11: ffffed1024846293 R12: 0000000000003800 [ 89.283095] R13: 0000000000000001 R14: 0000000000000000 R15: ffff8881161f7000 [ 89.284342] FS: 0000000000000000(0000) GS:ffff88839b5c0000(0000) knlGS:0000000000000000 [ 89.285711] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 89.286701] CR2: 00007f166ebc01a0 CR3: 0000000435c0e000 CR4: 00000000000006e0 [ 89.287919] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 89.289138] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 89.290368] Call Trace: [ 89.290842] write_mmp_block+0x2ca/0x510 [ 89.292218] kmmpd+0x433/0x9a0 [ 89.294902] kthread+0x2dd/0x3e0 [ 89.296268] ret_from_fork+0x22/0x30 [ 89.296906] Modules linked in:
by running the following commands:
1. mkfs.ext4 -O mmp /dev/sda -b 1024
2. mount /dev/sda /home/test
3. echo "/dev/sda" > /sys/power/resume
That happens because swsusp_check() calls set_blocksize() on the target partition which confuses the file system:
Thread1 Thread2
mount /dev/sda /home/test
get s_mmp_bh --> has mapped flag
start kmmpd thread
echo "/dev/sda" > /sys/power/resume
resume_store
software_resume
swsusp_check
set_blocksize
truncate_inode_pages_range
truncate_cleanup_page
block_invalidatepage
discard_buffer --> clean mapped flag
write_mmp_block
submit_bh
submit_bh_wbc
BUG_ON(!buffer_mapped(bh))To address this issue, modify swsusp_check() to open the target block device with exclusive access.
--- kernel/power/swap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
kernel/power/swap.c +3 -2
@@ -1521,9 +1521,10 @@ end:int swsusp_check (void ) {int error; +void *holder; hib_resume_bdev =blkdev_get_by_dev (swsusp_resume_device, -FMODE_READ ,NULL ); +FMODE_READ |FMODE_EXCL , &holder);if (!IS_ERR (hib_resume_bdev)) {set_blocksize (hib_resume_bdev,PAGE_SIZE );clear_page (swsusp_header);
@@ -1545,7 +1546,7 @@ int swsusp_check(void) put:if (error) -blkdev_put (hib_resume_bdev,FMODE_READ ); +blkdev_put (hib_resume_bdev,FMODE_READ |FMODE_EXCL );else pr_debug ("Image signature found, resuming\n" ); }else {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 285/917 selftests: kvm: fix mismatched fclose() after popen()
In reply to Greg Kroah-HartmanFrom: Shuah Khan <[email protected]>
[ Upstream commit c3867ab5924b7a9a0b4a117902a08669d8be7c21 ]
get_warnings_count() does fclose() using File * returned from popen(). Fix it to call pclose() as it should.
tools/testing/selftests/kvm/x86_64/mmio_warning_testx86_64/mmio_warning_test.c: In function ‘get_warnings_count’:x86_64/mmio_warning_test.c:87:9: warning: ‘fclose’ called on pointer returned from a mismatched allocation function [-Wmismatched-dealloc]
87 | fclose(f);
| ^~~~~~~~~
x86_64/mmio_warning_test.c:84:13: note: returned from ‘popen’
84 | f = popen("dmesg | grep \"WARNING:\" | wc -l", "r");
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--- tools/testing/selftests/kvm/x86_64/mmio_warning_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/kvm/x86_64/mmio_warning_test.c +1 -1
@@ -84,7 +84,7 @@ int get_warnings_count(void) f =popen ("dmesg | grep \"WARNING:\" | wc -l" ,"r" );if (fscanf (f,"%d" , &warnings) <1 ) warnings =0 ; -fclose (f); +pclose (f);return warnings; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 286/917 selftests/bpf: Fix perf_buffer test on system with offline cpus
In reply to Greg Kroah-HartmanFrom: Jiri Olsa <[email protected]>
[ Upstream commit d4121376ac7a9c81a696d7558789b2f29ef3574e ]
The perf_buffer fails on system with offline cpus:
# test_progs -t perf_buffer test_perf_buffer:PASS:nr_cpus 0 nsec test_perf_buffer:PASS:nr_on_cpus 0 nsec test_perf_buffer:PASS:skel_load 0 nsec test_perf_buffer:PASS:attach_kprobe 0 nsec test_perf_buffer:PASS:perf_buf__new 0 nsec test_perf_buffer:PASS:epoll_fd 0 nsec skipping offline CPU #24 skipping offline CPU #25 skipping offline CPU #26 skipping offline CPU #27 skipping offline CPU #28 skipping offline CPU #29 skipping offline CPU #30 skipping offline CPU #31 test_perf_buffer:PASS:perf_buffer__poll 0 nsec test_perf_buffer:PASS:seen_cpu_cnt 0 nsec test_perf_buffer:FAIL:buf_cnt got 24, expected 32 Summary: 0/0 PASSED, 0 SKIPPED, 1 FAILED
Changing the test to check online cpus instead of possible.
--- tools/testing/selftests/bpf/prog_tests/perf_buffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/prog_tests/perf_buffer.c +2 -2
@@ -107,8 +107,8 @@ void test_perf_buffer(void) "expect %d, seen %d\n", nr_on_cpus, CPU_COUNT(&cpu_seen))) goto out_free_pb; -if (CHECK (perf_buffer__buffer_cnt (pb) != nr_cpus,"buf_cnt" , -"got %zu, expected %d\n" ,perf_buffer__buffer_cnt (pb), nr_cpus)) +if (CHECK (perf_buffer__buffer_cnt (pb) != nr_on_cpus,"buf_cnt" , +"got %zu, expected %d\n" ,perf_buffer__buffer_cnt (pb), nr_on_cpus)) goto out_close;for (i =0 ; i < nr_cpus; i++) {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 287/917 iwlwifi: mvm: disable RX-diversity in powersave
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit e5322b9ab5f63536c41301150b7ce64605ce52cc ]
Just like we have default SMPS mode as dynamic in powersave, we should not enable RX-diversity in powersave, to reduce power consumption when connected to a non-MIMO AP.
--- drivers/net/wireless/intel/iwlwifi/mvm/utils.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/intel/iwlwifi/mvm/utils.c +3 -0
@@ -405,6 +405,9 @@ bool iwl_mvm_rx_diversity_allowed(struct iwl_mvm *mvm,lockdep_assert_held (&mvm->mutex); +if (iwlmvm_mod_params.power_scheme !=IWL_POWER_SCHEME_CAM ) +return false; +if (num_of_ant (iwl_mvm_get_valid_rx_ant (mvm)) ==1 )return false;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 288/917 smackfs: use __GFP_NOFAIL for smk_cipso_doi()
In reply to Greg Kroah-HartmanFrom: Tetsuo Handa <[email protected]>
[ Upstream commit f91488ee15bd3cac467e2d6a361fc2d34d1052ae ]
syzbot is reporting kernel panic at smk_cipso_doi() due to memory allocation fault injection [1]. The reason for need to use panic() was not explained. But since no fix was proposed for 18 months, for now let's use __GFP_NOFAIL for utilizing syzbot resource on other bugs.
--- security/smack/smackfs.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
security/smack/smackfs.c +1 -3
@@ -693,9 +693,7 @@ static void smk_cipso_doi(void)printk (KERN_WARNING "%s:%d remove rc = %d\n" , __func__, __LINE__, rc); - doip =kmalloc (sizeof (struct cipso_v4_doi ),GFP_KERNEL ); -if (doip ==NULL ) -panic ("smack: Failed to initialize cipso DOI.\n" ); + doip =kmalloc (sizeof (struct cipso_v4_doi ),GFP_KERNEL | __GFP_NOFAIL); doip->map.std =NULL ; doip->doi = smk_cipso_doi_value; doip->type =CIPSO_V4_MAP_PASS ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 289/917 ARM: clang: Do not rely on lr register for stacktrace
In reply to Greg Kroah-HartmanFrom: Masami Hiramatsu <[email protected]>
[ Upstream commit b3ea5d56f212ad81328c82454829a736197ebccc ]
Currently the stacktrace on clang compiled arm kernel uses the 'lr' register to find the first frame address from pt_regs. However, that is wrong after calling another function, because the 'lr' register is used by 'bl' instruction and never be recovered.
As same as gcc arm kernel, directly use the frame pointer (r11) of the pt_regs to find the first frame address.
Note that this fixes kretprobe stacktrace issue only with CONFIG_UNWINDER_FRAME_POINTER=y. For the CONFIG_UNWINDER_ARM, we need another fix.
--- arch/arm/kernel/stacktrace.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arm/kernel/stacktrace.c +1 -2
@@ -54,8 +54,7 @@ int notrace unwind_frame(struct stackframe *frame) frame->sp = frame->fp; frame->fp = *(unsigned long *)(fp); - frame->pc = frame->lr; - frame->lr = *(unsigned long *)(fp +4 ); + frame->pc = *(unsigned long *)(fp +4 );#else /* check current frame pointer is within bounds */ if (fp < low +12 || fp > high -4 )
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 290/917 gre/sit: Dont generate link-local addr if addr_gen_mode is IN6_ADDR_GEN_MODE_NONE
In reply to Greg Kroah-HartmanFrom: Stephen Suryaputra <[email protected]>
[ Upstream commit 61e18ce7348bfefb5688a8bcd4b4d6b37c0f9b2a ]
When addr_gen_mode is set to IN6_ADDR_GEN_MODE_NONE, the link-local addr should not be generated. But it isn't the case for GRE (as well as GRE6) and SIT tunnels. Make it so that tunnels consider the addr_gen_mode, especially for IN6_ADDR_GEN_MODE_NONE.
Do this in add_v4_addrs() to cover both GRE and SIT only if the addr scope is link.
--- net/ipv6/addrconf.c | 3 +++ 1 file changed, 3 insertions(+)
net/ipv6/addrconf.c +3 -0
@@ -3110,6 +3110,9 @@ static void add_v4_addrs(struct inet6_dev *idev)memcpy (&addr.s6_addr32[3 ], idev->dev->dev_addr + offset,4 );if (idev->dev->flags&IFF_POINTOPOINT ) { +if (idev->cnf.addr_gen_mode ==IN6_ADDR_GEN_MODE_NONE ) +return ; + addr.s6_addr32[0 ] =htonl (0xfe800000 ); scope =IFA_LINK ; plen =64 ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 291/917 net: dsa: lantiq_gswip: serialize access to the PCE table
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit 49753a75b9a32de4c0393bb8d1e51ea223fda8e4 ]
Looking at the code, the GSWIP switch appears to hold bridging service structures (VLANs, FDBs, forwarding rules) in PCE table entries. Hardware access to the PCE table is non-atomic, and is comprised of several register reads and writes.
These accesses are currently serialized by the rtnl_lock, but DSA is changing its driver API and that lock will no longer be held when calling ->port_fdb_add() and ->port_fdb_del().
So this driver needs to serialize the access to the PCE table using its own locking scheme. This patch adds that.
--- drivers/net/dsa/lantiq_gswip.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-)
drivers/net/dsa/lantiq_gswip.c +23 -5
@@ -276,6 +276,7 @@ struct gswip_priv {int num_gphy_fw;struct gswip_gphy_fw *gphy_fw;u32 port_vlan_filter; +struct mutex pce_table_lock; };struct gswip_pce_table_entry {
@@ -523,10 +524,14 @@ static int gswip_pce_table_entry_read(struct gswip_priv *priv,u16 addr_mode = tbl->key_mode ?GSWIP_PCE_TBL_CTRL_OPMOD_KSRD :GSWIP_PCE_TBL_CTRL_OPMOD_ADRD ; +mutex_lock (&priv->pce_table_lock); + err =gswip_switch_r_timeout (priv,GSWIP_PCE_TBL_CTRL ,GSWIP_PCE_TBL_CTRL_BAS ); -if (err) +if (err) { +mutex_unlock (&priv->pce_table_lock);return err; + }gswip_switch_w (priv, tbl->index,GSWIP_PCE_TBL_ADDR ); gswip_switch_mask(priv, GSWIP_PCE_TBL_CTRL_ADDR_MASK |
@@ -536,8 +541,10 @@ static int gswip_pce_table_entry_read(struct gswip_priv *priv, err =gswip_switch_r_timeout (priv,GSWIP_PCE_TBL_CTRL ,GSWIP_PCE_TBL_CTRL_BAS ); -if (err) +if (err) { +mutex_unlock (&priv->pce_table_lock);return err; + }for (i =0 ; i <ARRAY_SIZE (tbl->key); i++) tbl->key[i] =gswip_switch_r (priv,GSWIP_PCE_TBL_KEY (i));
@@ -553,6 +560,8 @@ static int gswip_pce_table_entry_read(struct gswip_priv *priv, tbl->valid = !!(crtl &GSWIP_PCE_TBL_CTRL_VLD ); tbl->gmap = (crtl &GSWIP_PCE_TBL_CTRL_GMAP_MASK ) >>7 ; +mutex_unlock (&priv->pce_table_lock); +return 0 ; }
@@ -565,10 +574,14 @@ static int gswip_pce_table_entry_write(struct gswip_priv *priv,u16 addr_mode = tbl->key_mode ?GSWIP_PCE_TBL_CTRL_OPMOD_KSWR :GSWIP_PCE_TBL_CTRL_OPMOD_ADWR ; +mutex_lock (&priv->pce_table_lock); + err =gswip_switch_r_timeout (priv,GSWIP_PCE_TBL_CTRL ,GSWIP_PCE_TBL_CTRL_BAS ); -if (err) +if (err) { +mutex_unlock (&priv->pce_table_lock);return err; + }gswip_switch_w (priv, tbl->index,GSWIP_PCE_TBL_ADDR ); gswip_switch_mask(priv, GSWIP_PCE_TBL_CTRL_ADDR_MASK |
@@ -600,8 +613,12 @@ static int gswip_pce_table_entry_write(struct gswip_priv *priv, crtl |=GSWIP_PCE_TBL_CTRL_BAS ;gswip_switch_w (priv, crtl,GSWIP_PCE_TBL_CTRL ); -return gswip_switch_r_timeout (priv,GSWIP_PCE_TBL_CTRL , -GSWIP_PCE_TBL_CTRL_BAS ); + err =gswip_switch_r_timeout (priv,GSWIP_PCE_TBL_CTRL , +GSWIP_PCE_TBL_CTRL_BAS ); + +mutex_unlock (&priv->pce_table_lock); + +return err; }/* Add the LAN port into a bridge with the CPU port by
@@ -2106,6 +2123,7 @@ static int gswip_probe(struct platform_device *pdev) priv->ds->priv = priv; priv->ds->ops = priv->hw_info->ops; priv->dev = dev; +mutex_init (&priv->pce_table_lock); version =gswip_switch_r (priv,GSWIP_VERSION ); np = dev->of_node;
Signature · 1 line
2.33.0
Re: [PATCH 5.15 291/917] net: dsa: lantiq_gswip: serialize access to the PCE table
Quoted 118 lines · Greg Kroah-Hartman
From: Vladimir Oltean <[email protected]>
[ Upstream commit
49753a75b9a32de4c0393bb8d1e51ea223fda8e4]Looking at the code, the GSWIP switch appears to hold bridging service structures (VLANs, FDBs, forwarding rules) in PCE table entries. Hardware access to the PCE table is non-atomic, and is comprised of several register reads and writes.
These accesses are currently serialized by the
rtnl_lock, but DSA is changing its driver API and that lock will no longer be held when calling ->port_fdb_add() and ->port_fdb_del().So this driver needs to serialize the access to the PCE table using its own locking scheme. This patch adds that.
Signed-off-by Vladimir Oltean <[email protected]>Reviewed-by Florian Fainelli <[email protected]>Acked-by Hauke Mehrtens <[email protected]>Signed-off-by David S. Miller <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- drivers/net/dsa/lantiq_gswip.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-)drivers/net/dsa/lantiq_gswip.c +23
-5@@ -276,6 +276,7 @@ struct gswip_priv {int num_gphy_fw;struct gswip_gphy_fw *gphy_fw;u32 port_vlan_filter; +struct mutex pce_table_lock; };struct gswip_pce_table_entry {@@ -523,10 +524,14 @@ static int gswip_pce_table_entry_read(struct gswip_priv *priv,u16 addr_mode = tbl->key_mode ?GSWIP_PCE_TBL_CTRL_OPMOD_KSRD :GSWIP_PCE_TBL_CTRL_OPMOD_ADRD ; +mutex_lock (&priv->pce_table_lock); + err =gswip_switch_r_timeout (priv,GSWIP_PCE_TBL_CTRL ,GSWIP_PCE_TBL_CTRL_BAS ); -if (err) +if (err) { +mutex_unlock (&priv->pce_table_lock);return err; + }gswip_switch_w (priv, tbl->index,GSWIP_PCE_TBL_ADDR ); gswip_switch_mask(priv, GSWIP_PCE_TBL_CTRL_ADDR_MASK |@@ -536,8 +541,10 @@ static int gswip_pce_table_entry_read(struct gswip_priv *priv, err =gswip_switch_r_timeout (priv,GSWIP_PCE_TBL_CTRL ,GSWIP_PCE_TBL_CTRL_BAS ); -if (err) +if (err) { +mutex_unlock (&priv->pce_table_lock);return err; + }for (i =0 ; i <ARRAY_SIZE (tbl->key); i++) tbl->key[i] =gswip_switch_r (priv,GSWIP_PCE_TBL_KEY (i));@@ -553,6 +560,8 @@ static int gswip_pce_table_entry_read(struct gswip_priv *priv, tbl->valid = !!(crtl &GSWIP_PCE_TBL_CTRL_VLD ); tbl->gmap = (crtl &GSWIP_PCE_TBL_CTRL_GMAP_MASK ) >>7 ; +mutex_unlock (&priv->pce_table_lock); +return 0 ; }@@ -565,10 +574,14 @@ static int gswip_pce_table_entry_write(struct gswip_priv *priv,u16 addr_mode = tbl->key_mode ?GSWIP_PCE_TBL_CTRL_OPMOD_KSWR :GSWIP_PCE_TBL_CTRL_OPMOD_ADWR ; +mutex_lock (&priv->pce_table_lock); + err =gswip_switch_r_timeout (priv,GSWIP_PCE_TBL_CTRL ,GSWIP_PCE_TBL_CTRL_BAS ); -if (err) +if (err) { +mutex_unlock (&priv->pce_table_lock);return err; + }gswip_switch_w (priv, tbl->index,GSWIP_PCE_TBL_ADDR ); gswip_switch_mask(priv, GSWIP_PCE_TBL_CTRL_ADDR_MASK |@@ -600,8 +613,12 @@ static int gswip_pce_table_entry_write(struct gswip_priv *priv, crtl |=GSWIP_PCE_TBL_CTRL_BAS ;gswip_switch_w (priv, crtl,GSWIP_PCE_TBL_CTRL ); -return gswip_switch_r_timeout (priv,GSWIP_PCE_TBL_CTRL , -GSWIP_PCE_TBL_CTRL_BAS ); + err =gswip_switch_r_timeout (priv,GSWIP_PCE_TBL_CTRL , +GSWIP_PCE_TBL_CTRL_BAS ); + +mutex_unlock (&priv->pce_table_lock); + +return err; }/* Add the LAN port into a bridge with the CPU port by @@ -2106,6 +2123,7 @@ static int gswip_probe(struct platform_device *pdev) priv->ds->priv = priv; priv->ds->ops = priv->hw_info->ops; priv->dev = dev; +mutex_init (&priv->pce_table_lock); version =gswip_switch_r (priv,GSWIP_VERSION ); np = dev->of_node;Signature · 1 line
2.33.0
As discussed on the v5.14 backport, this patch can be dropped.
Sasha Levin
maintainerRe: [PATCH 5.15 291/917] net: dsa: lantiq_gswip: serialize access to the PCE table
Quoted 113 lines · Vladimir Oltean
Quoted 112 lines · Greg Kroah-Hartman
From: Vladimir Oltean <[email protected]>
[ Upstream commit
49753a75b9a32de4c0393bb8d1e51ea223fda8e4]Looking at the code, the GSWIP switch appears to hold bridging service structures (VLANs, FDBs, forwarding rules) in PCE table entries. Hardware access to the PCE table is non-atomic, and is comprised of several register reads and writes.
These accesses are currently serialized by the
rtnl_lock, but DSA is changing its driver API and that lock will no longer be held when calling ->port_fdb_add() and ->port_fdb_del().So this driver needs to serialize the access to the PCE table using its own locking scheme. This patch adds that.
Signed-off-by Vladimir Oltean <[email protected]>Reviewed-by Florian Fainelli <[email protected]>Acked-by Hauke Mehrtens <[email protected]>Signed-off-by David S. Miller <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- drivers/net/dsa/lantiq_gswip.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-)drivers/net/dsa/lantiq_gswip.c +23
-5@@ -276,6 +276,7 @@ struct gswip_priv {int num_gphy_fw;struct gswip_gphy_fw *gphy_fw;u32 port_vlan_filter; +struct mutex pce_table_lock; };struct gswip_pce_table_entry {@@ -523,10 +524,14 @@ static int gswip_pce_table_entry_read(struct gswip_priv *priv,u16 addr_mode = tbl->key_mode ?GSWIP_PCE_TBL_CTRL_OPMOD_KSRD :GSWIP_PCE_TBL_CTRL_OPMOD_ADRD ; +mutex_lock (&priv->pce_table_lock); + err =gswip_switch_r_timeout (priv,GSWIP_PCE_TBL_CTRL ,GSWIP_PCE_TBL_CTRL_BAS ); -if (err) +if (err) { +mutex_unlock (&priv->pce_table_lock);return err; + }gswip_switch_w (priv, tbl->index,GSWIP_PCE_TBL_ADDR ); gswip_switch_mask(priv, GSWIP_PCE_TBL_CTRL_ADDR_MASK |@@ -536,8 +541,10 @@ static int gswip_pce_table_entry_read(struct gswip_priv *priv, err =gswip_switch_r_timeout (priv,GSWIP_PCE_TBL_CTRL ,GSWIP_PCE_TBL_CTRL_BAS ); -if (err) +if (err) { +mutex_unlock (&priv->pce_table_lock);return err; + }for (i =0 ; i <ARRAY_SIZE (tbl->key); i++) tbl->key[i] =gswip_switch_r (priv,GSWIP_PCE_TBL_KEY (i));@@ -553,6 +560,8 @@ static int gswip_pce_table_entry_read(struct gswip_priv *priv, tbl->valid = !!(crtl &GSWIP_PCE_TBL_CTRL_VLD ); tbl->gmap = (crtl &GSWIP_PCE_TBL_CTRL_GMAP_MASK ) >>7 ; +mutex_unlock (&priv->pce_table_lock); +return 0 ; }@@ -565,10 +574,14 @@ static int gswip_pce_table_entry_write(struct gswip_priv *priv,u16 addr_mode = tbl->key_mode ?GSWIP_PCE_TBL_CTRL_OPMOD_KSWR :GSWIP_PCE_TBL_CTRL_OPMOD_ADWR ; +mutex_lock (&priv->pce_table_lock); + err =gswip_switch_r_timeout (priv,GSWIP_PCE_TBL_CTRL ,GSWIP_PCE_TBL_CTRL_BAS ); -if (err) +if (err) { +mutex_unlock (&priv->pce_table_lock);return err; + }gswip_switch_w (priv, tbl->index,GSWIP_PCE_TBL_ADDR ); gswip_switch_mask(priv, GSWIP_PCE_TBL_CTRL_ADDR_MASK |@@ -600,8 +613,12 @@ static int gswip_pce_table_entry_write(struct gswip_priv *priv, crtl |=GSWIP_PCE_TBL_CTRL_BAS ;gswip_switch_w (priv, crtl,GSWIP_PCE_TBL_CTRL ); -return gswip_switch_r_timeout (priv,GSWIP_PCE_TBL_CTRL , -GSWIP_PCE_TBL_CTRL_BAS ); + err =gswip_switch_r_timeout (priv,GSWIP_PCE_TBL_CTRL , +GSWIP_PCE_TBL_CTRL_BAS ); + +mutex_unlock (&priv->pce_table_lock); + +return err; }/* Add the LAN port into a bridge with the CPU port by @@ -2106,6 +2123,7 @@ static int gswip_probe(struct platform_device *pdev) priv->ds->priv = priv; priv->ds->ops = priv->hw_info->ops; priv->dev = dev; +mutex_init (&priv->pce_table_lock); version =gswip_switch_r (priv,GSWIP_VERSION );
Quoted 8 lines
Quoted 6 lines
drivers/net/dsa/lantiq_gswip.c +0
-1np = dev->of_node; --2.33.0
As discussed on the v5.14 backport, this patch can be dropped.
Dropped, thanks!
Signature · 2 lines
Thanks, Sasha
Greg Kroah-Hartman
maintainerPATCH 292/917 can: bittiming: can_fixup_bittiming(): change type of tseg1 and alltseg to unsigned int
In reply to Greg Kroah-HartmanFrom: Marc Kleine-Budde <[email protected]>
[ Upstream commit e346290439609a8ac67122418ca2efbad8d0a7e7 ]
All timing calculation is done with unsigned integers, so change type of tseg1 and alltseg to unsigned int, too.
--- drivers/net/can/dev/bittiming.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/dev/bittiming.c +1 -1
@@ -209,7 +209,7 @@ static int can_fixup_bittiming(struct net_device *dev, struct can_bittiming *bt, const struct can_bittiming_const *btc) {struct can_priv *priv =netdev_priv (dev); -int tseg1, alltseg; +unsigned int tseg1, alltseg;u64 brp64; tseg1 = bt->prop_seg + bt->phase_seg1;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 293/917 gfs2: Cancel remote delete work asynchronously
In reply to Greg Kroah-HartmanFrom: Andreas Gruenbacher <[email protected]>
[ Upstream commit 486408d690e130c3adacf816754b97558d715f46 ]
In gfs2_inode_lookup and gfs2_create_inode, we're calling gfs2_cancel_delete_work which currently cancels any remote delete work (delete_work_func) synchronously. This means that if the work is currently running, it will wait for it to finish. We're doing this to pevent a previous instance of an inode from having any influence on the next instance.
However, delete_work_func uses gfs2_inode_lookup internally, and we can end up in a deadlock when delete_work_func gets interrupted at the wrong time. For example,
(1) An inode's iopen glock has delete work queued, but the inode itself has been evicted from the inode cache.
(2) The delete work is preempted before reaching gfs2_inode_lookup.
(3) Another process recreates the inode (gfs2_create_inode). It tries to cancel any outstanding delete work, which blocks waiting for the ongoing delete work to finish.
(4) The delete work calls gfs2_inode_lookup, which blocks waiting for gfs2_create_inode to instantiate and unlock the new inode => deadlock.
It turns out that when the delete work notices that its inode has been re-instantiated, it will do nothing. This means that it's safe to cancel the delete work asynchronously. This prevents the kind of deadlock described above.
--- fs/gfs2/glock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/gfs2/glock.c +1 -1
@@ -1919,7 +1919,7 @@ bool gfs2_queue_delete_work(struct gfs2_glock *gl, unsigned long delay)void gfs2_cancel_delete_work (struct gfs2_glock *gl) { -if (cancel_delayed_work_sync (&gl->gl_delete)) { +if (cancel_delayed_work (&gl->gl_delete)) {clear_bit (GLF_PENDING_DELETE , &gl->gl_flags);gfs2_glock_put (gl); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 294/917 gfs2: Fix glock_hash_walk bugs
In reply to Greg Kroah-HartmanFrom: Andreas Gruenbacher <[email protected]>
[ Upstream commit 7427f3bb49d81525b7dd1d0f7c5f6bbc752e6f0e ]
So far, glock_hash_walk took a reference on each glock it iterated over, and it was the examiner's responsibility to drop those references. Dropping the final reference to a glock can sleep and the examiners are called in a RCU critical section with spin locks held, so examiners that didn't need the extra reference had to drop it asynchronously via gfs2_glock_queue_put or similar. This wasn't done correctly in thaw_glock which did call gfs2_glock_put, and not at all in dump_glock_func.
Change glock_hash_walk to not take glock references at all. That way, the examiners that don't need them won't have to bother with slow asynchronous puts, and the examiners that do need references can take them themselves.
--- fs/gfs2/glock.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
fs/gfs2/glock.c +12 -10
@@ -1893,10 +1893,10 @@ static void glock_hash_walk(glock_examiner examiner, const struct gfs2_sbd *sdp)do {rhashtable_walk_start (&iter); -while ((gl =rhashtable_walk_next (&iter)) && !IS_ERR (gl)) -if (gl->gl_name.ln_sbd == sdp && -lockref_get_not_dead (&gl->gl_lockref)) +while ((gl =rhashtable_walk_next (&iter)) && !IS_ERR (gl)) { +if (gl->gl_name.ln_sbd == sdp)examiner (gl); + }rhashtable_walk_stop (&iter); }while (cond_resched (), gl ==ERR_PTR (-EAGAIN ));
@@ -1938,7 +1938,6 @@ static void flush_delete_work(struct gfs2_glock *gl) &gl->gl_delete, 0); } } -gfs2_glock_queue_work (gl,0 ); }void gfs2_flush_delete_work (struct gfs2_sbd *sdp)
@@ -1955,10 +1954,10 @@ void gfs2_flush_delete_work(struct gfs2_sbd *sdp)static void thaw_glock (struct gfs2_glock *gl) { -if (!test_and_clear_bit (GLF_FROZEN , &gl->gl_flags)) { -gfs2_glock_put (gl); +if (!test_and_clear_bit (GLF_FROZEN , &gl->gl_flags)) +return ; +if (!lockref_get_not_dead (&gl->gl_lockref))return ; - }set_bit (GLF_REPLY_PENDING , &gl->gl_flags);gfs2_glock_queue_work (gl,0 ); }
@@ -1974,9 +1973,12 @@ static void clear_glock(struct gfs2_glock *gl)gfs2_glock_remove_from_lru (gl);spin_lock (&gl->gl_lockref.lock); -if (gl->gl_state !=LM_ST_UNLOCKED ) -handle_callback (gl,LM_ST_UNLOCKED ,0 , false); -__gfs2_glock_queue_work (gl,0 ); +if (!__lockref_is_dead (&gl->gl_lockref)) { + gl->gl_lockref.count++; +if (gl->gl_state !=LM_ST_UNLOCKED ) +handle_callback (gl,LM_ST_UNLOCKED ,0 , false); +__gfs2_glock_queue_work (gl,0 ); + }spin_unlock (&gl->gl_lockref.lock); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 295/917 ARM: 9136/1: ARMv7-M uses BE-8, not BE-32
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 345dac33f58894a56d17b92a41be10e16585ceff ]
When configuring the kernel for big-endian, we set either BE-8 or BE-32 based on the CPU architecture level. Until linux-4.4, we did not have any ARMv7-M platform allowing big-endian builds, but now i.MX/Vybrid is in that category, adn we get a build error because of this:
arch/arm/kernel/module-plts.c: In function 'get_module_plt':arch/arm/kernel/module-plts.c:60:46: error: implicit declaration of function '__opcode_to_mem_thumb32' [-Werror=implicit-function-declaration]
This comes down to picking the wrong default, ARMv7-M uses BE8 like ARMv7-A does. Changing the default gets the kernel to compile and presumably works.
https://lore.kernel.org/all/[email protected]/
--- arch/arm/mm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mm/Kconfig +1 -1
@@ -750,7 +750,7 @@ config CPU_BIG_ENDIAN config CPU_ENDIAN_BE8 bool depends on CPU_BIG_ENDIAN - default CPU_V6 || CPU_V6K || CPU_V7 + default CPU_V6 || CPU_V6K || CPU_V7 || CPU_V7M help Support for the BE-8 (big-endian) mode on ARMv6 and ARMv7 processors.
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 296/917 tools/latency-collector: Use correct size when writing queue_full_warning
In reply to Greg Kroah-HartmanFrom: Viktor Rosendahl <[email protected]>
[ Upstream commit f604de20c0a47e0e9518940a1810193678c92fa8 ]
queue_full_warning is a pointer, so it is wrong to use sizeof to calculate the number of characters of the string it points to. The effect is that we only print out the first few characters of the warning string.
The correct way is to use strlen(). We don't need to add 1 to the strlen() because we don't want to write the terminating null character to stdout.
--- tools/tracing/latency/latency-collector.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/tracing/latency/latency-collector.c +1 -1
@@ -1538,7 +1538,7 @@ static void tracing_loop(void)mutex_lock (&print_mtx);check_signals ();write_or_die (fd_stdout, queue_full_warning, -sizeof (queue_full_warning)); +strlen (queue_full_warning));mutex_unlock (&print_mtx); } modified--;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 297/917 vrf: run conntrack only in context of lower/physdev for locally generated packets
In reply to Greg Kroah-HartmanFrom: Florian Westphal <[email protected]>
[ Upstream commit 8c9c296adfae9ea05f655d69e9f6e13daa86fb4a ]
The VRF driver invokes netfilter for output+postrouting hooks so that users can create rules that check for 'oif $vrf' rather than lower device name.
This is a problem when NAT rules are configured.
To avoid any conntrack involvement in round 1, tag skbs as 'untracked' to prevent conntrack from picking them up.
This gets cleared before the packet gets handed to the ip stack so conntrack will be active on the second iteration.
One remaining issue is that a rule like
output ... oif $vrfname notrack
won't propagate to the second round because we can't tell 'notrack set via ruleset' and 'notrack set by vrf driver' apart. However, this isn't a regression: the 'notrack' removal happens instead of unconditional nf_reset_ct().
I'd also like to avoid leaking more vrf specific conditionals into the netfilter infra.
For ingress, conntrack has already been done before the packet makes it to the vrf driver, with this patch egress does connection tracking with lower/physical device as well.
--- drivers/net/vrf.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-)
drivers/net/vrf.c +24 -4
@@ -35,6 +35,7 @@#include <net/l3mdev.h> #include <net/fib_rules.h> #include <net/netns/generic.h> +#include <net/netfilter/nf_conntrack.h> #define DRV_NAME "vrf"#define DRV_VERSION "1.1"
@@ -424,12 +425,26 @@ static int vrf_local_xmit(struct sk_buff *skb, struct net_device *dev,return NETDEV_TX_OK ; } +static void vrf_nf_set_untracked (struct sk_buff *skb) +{ +if (skb_get_nfct (skb) ==0 ) +nf_ct_set (skb,NULL ,IP_CT_UNTRACKED ); +} + +static void vrf_nf_reset_ct (struct sk_buff *skb) +{ +if (skb_get_nfct (skb) ==IP_CT_UNTRACKED ) +nf_reset_ct (skb); +} +#if IS_ENABLED (CONFIG_IPV6 )static int vrf_ip6_local_out (struct net *net,struct sock *sk,struct sk_buff *skb) {int err; +vrf_nf_reset_ct (skb); + err =nf_hook (NFPROTO_IPV6 ,NF_INET_LOCAL_OUT , net, sk, skb,NULL ,skb_dst (skb)->dev, dst_output);
@@ -508,6 +523,8 @@ static int vrf_ip_local_out(struct net *net, struct sock *sk, {int err; +vrf_nf_reset_ct (skb); + err =nf_hook (NFPROTO_IPV4 ,NF_INET_LOCAL_OUT , net, sk, skb,NULL ,skb_dst (skb)->dev, dst_output);if (likely (err ==1 ))
@@ -626,8 +643,7 @@ static void vrf_finish_direct(struct sk_buff *skb)skb_pull (skb,ETH_HLEN ); } -/* reset skb device */ -nf_reset_ct (skb); +vrf_nf_reset_ct (skb); }#if IS_ENABLED (CONFIG_IPV6 )
@@ -641,7 +657,7 @@ static int vrf_finish_output6(struct net *net, struct sock *sk,struct neighbour *neigh;int ret; -nf_reset_ct (skb); +vrf_nf_reset_ct (skb); skb->protocol =htons (ETH_P_IPV6 ); skb->dev = dev;
@@ -752,6 +768,8 @@ static struct sk_buff *vrf_ip6_out_direct(struct net_device *vrf_dev, skb->dev = vrf_dev; +vrf_nf_set_untracked (skb); + err =nf_hook (NFPROTO_IPV6 ,NF_INET_LOCAL_OUT , net, sk, skb,NULL , vrf_dev, vrf_ip6_out_direct_finish);
@@ -858,7 +876,7 @@ static int vrf_finish_output(struct net *net, struct sock *sk, struct sk_buff *sstruct neighbour *neigh;bool is_v6gw = false; -nf_reset_ct (skb); +vrf_nf_reset_ct (skb);/* Be paranoid, rather than too clever. */ if (unlikely (skb_headroom (skb) < hh_len && dev->header_ops)) {
@@ -980,6 +998,8 @@ static struct sk_buff *vrf_ip_out_direct(struct net_device *vrf_dev, skb->dev = vrf_dev; +vrf_nf_set_untracked (skb); + err =nf_hook (NFPROTO_IPV4 ,NF_INET_LOCAL_OUT , net, sk, skb,NULL , vrf_dev, vrf_ip_out_direct_finish);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 298/917 net: annotate data-race in neigh_output()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit d18785e213866935b4c3dc0c33c3e18801ce0ce8 ]
neigh_output() reads n->nud_state and hh->hh_len locklessly.
This is fine, but we need to add annotations and document this.
We evaluate skip_cache first to avoid reading these fields if the cache has to by bypassed.
syzbot report:
BUG: KCSAN: data-race in __neigh_event_send / ip_finish_output2
write to 0xffff88810798a885 of 1 bytes by interrupt on cpu 1:
__neigh_event_send+0x40d/0xac0 net/core/neighbour.c:1128 neigh_event_send include/net/neighbour.h:444 [inline] neigh_resolve_output+0x104/0x410 net/core/neighbour.c:1476 neigh_output include/net/neighbour.h:510 [inline] ip_finish_output2+0x80a/0xaa0 net/ipv4/ip_output.c:221 ip_finish_output+0x3b5/0x510 net/ipv4/ip_output.c:309 NF_HOOK_COND include/linux/netfilter.h:296 [inline] ip_output+0xf3/0x1a0 net/ipv4/ip_output.c:423 dst_output include/net/dst.h:450 [inline] ip_local_out+0x164/0x220 net/ipv4/ip_output.c:126 __ip_queue_xmit+0x9d3/0xa20 net/ipv4/ip_output.c:525 ip_queue_xmit+0x34/0x40 net/ipv4/ip_output.c:539 __tcp_transmit_skb+0x142a/0x1a00 net/ipv4/tcp_output.c:1405 tcp_transmit_skb net/ipv4/tcp_output.c:1423 [inline] tcp_xmit_probe_skb net/ipv4/tcp_output.c:4011 [inline] tcp_write_wakeup+0x4a9/0x810 net/ipv4/tcp_output.c:4064 tcp_send_probe0+0x2c/0x2b0 net/ipv4/tcp_output.c:4079 tcp_probe_timer net/ipv4/tcp_timer.c:398 [inline] tcp_write_timer_handler+0x394/0x520 net/ipv4/tcp_timer.c:626 tcp_write_timer+0xb9/0x180 net/ipv4/tcp_timer.c:642 call_timer_fn+0x2e/0x1d0 kernel/time/timer.c:1421 expire_timers+0x135/0x240 kernel/time/timer.c:1466 __run_timers+0x368/0x430 kernel/time/timer.c:1734 run_timer_softirq+0x19/0x30 kernel/time/timer.c:1747 __do_softirq+0x12c/0x26e kernel/softirq.c:558 invoke_softirq kernel/softirq.c:432 [inline] __irq_exit_rcu kernel/softirq.c:636 [inline] irq_exit_rcu+0x4e/0xa0 kernel/softirq.c:648 sysvec_apic_timer_interrupt+0x69/0x80 arch/x86/kernel/apic/apic.c:1097 asm_sysvec_apic_timer_interrupt+0x12/0x20 native_safe_halt arch/x86/include/asm/irqflags.h:51 [inline] arch_safe_halt arch/x86/include/asm/irqflags.h:89 [inline] acpi_safe_halt drivers/acpi/processor_idle.c:109 [inline] acpi_idle_do_entry drivers/acpi/processor_idle.c:553 [inline] acpi_idle_enter+0x258/0x2e0 drivers/acpi/processor_idle.c:688 cpuidle_enter_state+0x2b4/0x760 drivers/cpuidle/cpuidle.c:237 cpuidle_enter+0x3c/0x60 drivers/cpuidle/cpuidle.c:351 call_cpuidle kernel/sched/idle.c:158 [inline] cpuidle_idle_call kernel/sched/idle.c:239 [inline] do_idle+0x1a3/0x250 kernel/sched/idle.c:306 cpu_startup_entry+0x15/0x20 kernel/sched/idle.c:403 secondary_startup_64_no_verify+0xb1/0xbb
read to 0xffff88810798a885 of 1 bytes by interrupt on cpu 0:
neigh_output include/net/neighbour.h:507 [inline] ip_finish_output2+0x79a/0xaa0 net/ipv4/ip_output.c:221 ip_finish_output+0x3b5/0x510 net/ipv4/ip_output.c:309 NF_HOOK_COND include/linux/netfilter.h:296 [inline] ip_output+0xf3/0x1a0 net/ipv4/ip_output.c:423 dst_output include/net/dst.h:450 [inline] ip_local_out+0x164/0x220 net/ipv4/ip_output.c:126 __ip_queue_xmit+0x9d3/0xa20 net/ipv4/ip_output.c:525 ip_queue_xmit+0x34/0x40 net/ipv4/ip_output.c:539 __tcp_transmit_skb+0x142a/0x1a00 net/ipv4/tcp_output.c:1405 tcp_transmit_skb net/ipv4/tcp_output.c:1423 [inline] tcp_xmit_probe_skb net/ipv4/tcp_output.c:4011 [inline] tcp_write_wakeup+0x4a9/0x810 net/ipv4/tcp_output.c:4064 tcp_send_probe0+0x2c/0x2b0 net/ipv4/tcp_output.c:4079 tcp_probe_timer net/ipv4/tcp_timer.c:398 [inline] tcp_write_timer_handler+0x394/0x520 net/ipv4/tcp_timer.c:626 tcp_write_timer+0xb9/0x180 net/ipv4/tcp_timer.c:642 call_timer_fn+0x2e/0x1d0 kernel/time/timer.c:1421 expire_timers+0x135/0x240 kernel/time/timer.c:1466 __run_timers+0x368/0x430 kernel/time/timer.c:1734 run_timer_softirq+0x19/0x30 kernel/time/timer.c:1747 __do_softirq+0x12c/0x26e kernel/softirq.c:558 invoke_softirq kernel/softirq.c:432 [inline] __irq_exit_rcu kernel/softirq.c:636 [inline] irq_exit_rcu+0x4e/0xa0 kernel/softirq.c:648 sysvec_apic_timer_interrupt+0x69/0x80 arch/x86/kernel/apic/apic.c:1097 asm_sysvec_apic_timer_interrupt+0x12/0x20 native_safe_halt arch/x86/include/asm/irqflags.h:51 [inline] arch_safe_halt arch/x86/include/asm/irqflags.h:89 [inline] acpi_safe_halt drivers/acpi/processor_idle.c:109 [inline] acpi_idle_do_entry drivers/acpi/processor_idle.c:553 [inline] acpi_idle_enter+0x258/0x2e0 drivers/acpi/processor_idle.c:688 cpuidle_enter_state+0x2b4/0x760 drivers/cpuidle/cpuidle.c:237 cpuidle_enter+0x3c/0x60 drivers/cpuidle/cpuidle.c:351 call_cpuidle kernel/sched/idle.c:158 [inline] cpuidle_idle_call kernel/sched/idle.c:239 [inline] do_idle+0x1a3/0x250 kernel/sched/idle.c:306 cpu_startup_entry+0x15/0x20 kernel/sched/idle.c:403 rest_init+0xee/0x100 init/main.c:734 arch_call_rest_init+0xa/0xb start_kernel+0x5e4/0x669 init/main.c:1142 secondary_startup_64_no_verify+0xb1/0xbb
value changed: 0x20 -> 0x01
Reported by Kernel Concurrency Sanitizer on:
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.15.0-rc6-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
--- include/net/neighbour.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
include/net/neighbour.h +8 -3
@@ -504,10 +504,15 @@ static inline int neigh_output(struct neighbour *n, struct sk_buff *skb, {const struct hh_cache *hh = &n->hh; -if ((n->nud_state &NUD_CONNECTED ) && hh->hh_len && !skip_cache) +/* n->nud_state and hh->hh_len could be changed under us. +* neigh_hh_output() is taking care of the race later. +*/ +if (!skip_cache && + (READ_ONCE (n->nud_state) &NUD_CONNECTED ) && +READ_ONCE (hh->hh_len))return neigh_hh_output (hh, skb); -else -return n->output (n, skb); + +return n->output (n, skb); } static inline struct neighbour *
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 299/917 ACPI: AC: Quirk GK45 to skip reading _PSR
In reply to Greg Kroah-HartmanFrom: Stefan Schaeckeler <[email protected]>
[ Upstream commit 3d730ee686800d71ecc5c3cb8460dcdcdeaf38a3 ]
Let GK45 not go into BIOS for determining the AC power state.
The BIOS wrongly returns 0, so hardcode the power state to 1.
The mini PC GK45 by Besstar Tech Lld. (aka Kodlix) just runs off AC. It does not include any batteries. Nevertheless BIOS reports AC off:
root@kodlix:/usr/src/linux# cat /sys/class/power_supply/ADP1/online 0
root@kodlix:/usr/src/linux# modprobe acpi_dbg root@kodlix:/usr/src/linux# tools/power/acpi/acpidbg
- find _PSR
\_SB.PCI0.SBRG.H_EC.ADP1._PSR Method 000000009283cee8 001 Args 0 Len 001C Aml 00000000f54e5f67
- execute \_SB.PCI0.SBRG.H_EC.ADP1._PSR
Evaluating \_SB.PCI0.SBRG.H_EC.ADP1._PSR
Evaluation of \_SB.PCI0.SBRG.H_EC.ADP1._PSR returned object 00000000dc08c187, external buffer length 18
[Integer] = 0000000000000000
that should be
[Integer] = 0000000000000001
--- drivers/acpi/ac.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/acpi/ac.c +19 -0
@@ -61,6 +61,7 @@ static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume);static int ac_sleep_before_get_state_ms;static int ac_check_pmic =1 ; +static int ac_only;static struct acpi_driver acpi_ac_driver = { .name ="ac" ,
@@ -93,6 +94,11 @@ static int acpi_ac_get_state(struct acpi_ac *ac)if (!ac)return -EINVAL ; +if (ac_only) { + ac->state =1 ; +return 0 ; + } + status =acpi_evaluate_integer (ac->device->handle,"_PSR" ,NULL , &ac->state);if (ACPI_FAILURE (status)) {
@@ -200,6 +206,12 @@ static int __init ac_do_not_check_pmic_quirk(const struct dmi_system_id *d)return 0 ; } +static int __init ac_only_quirk (const struct dmi_system_id *d) +{ + ac_only =1 ; +return 0 ; +} +/* Please keep this list alphabetically sorted */ static const struct dmi_system_id ac_dmi_table[]__initconst = { {
@@ -209,6 +221,13 @@ static const struct dmi_system_id ac_dmi_table[] __initconst = { DMI_MATCH(DMI_PRODUCT_NAME, "EF20EA"), }, }, + { +/* Kodlix GK45 returning incorrect state */ + .callback = ac_only_quirk, + .matches = { + DMI_MATCH(DMI_PRODUCT_NAME, "GK45"), + }, + }, {/* Lenovo Ideapad Miix 320, AXP288 PMIC, separate fuel-gauge */ .callback = ac_do_not_check_pmic_quirk,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 300/917 ACPI: resources: Add one more Medion model in IRQ override quirk
In reply to Greg Kroah-HartmanFrom: Hui Wang <[email protected]>
[ Upstream commit 1b26ae40092b43bb6e9c5df376227382b390b953 ]
The Medion s17 series laptops have the same issue on the keyboard as the s15 series, if skipping to call acpi_get_override_irq(), the keyboard could work well. So put the DMI info of s17 series in the IRQ override quirk table as well.
--- drivers/acpi/resource.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/acpi/resource.c +7 -0
@@ -389,6 +389,13 @@ static const struct dmi_system_id medion_laptop[] = { DMI_MATCH(DMI_BOARD_NAME, "M15T"), }, }, + { + .ident = "MEDION S17405", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "MEDION"), + DMI_MATCH(DMI_BOARD_NAME, "M17T"), + }, + }, { } };
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 301/917 net: dsa: flush switchdev workqueue when leaving the bridge
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit d7d0d423dbaa73fd0506e25971dfdab6bf185d00 ]
DSA is preparing to offer switch drivers an API through which they can associate each FDB entry with a struct net_device *bridge_dev. This can be used to perform FDB isolation (the FDB lookup performed on the ingress of a standalone, or bridged port, should not find an FDB entry that is present in the FDB of another bridge).
In preparation of that work, DSA needs to ensure that by the time we call the switch .port_fdb_add and .port_fdb_del methods, the dp->bridge_dev pointer is still valid, i.e. the port is still a bridge port.
This is not guaranteed because the SWITCHDEV_FDB_{ADD,DEL}_TO_DEVICE API requires drivers that must have sleepable context to handle those events to schedule the deferred work themselves. DSA does this through the dsa_owq.
It can happen that a port leaves a bridge, del_nbp() flushes the FDB on that port, SWITCHDEV_FDB_DEL_TO_DEVICE is notified in atomic context, DSA schedules its deferred work, but del_nbp() finishes unlinking the bridge as a master from the port before DSA's deferred work is run.
Fundamentally, the port must not be unlinked from the bridge until all FDB deletion deferred work items have been flushed. The bridge must wait for the completion of these hardware accesses.
An attempt has been made to address this issue centrally in switchdev by making SWITCHDEV_FDB_DEL_TO_DEVICE deferred (=> blocking) at the switchdev level, which would offer implicit synchronization with del_nbp:
https://patchwork.kernel.org/project/netdevbpf/cover/[email protected]/
but it seems that any attempt to modify switchdev's behavior and make the events blocking there would introduce undesirable side effects in other switchdev consumers.
The most undesirable behavior seems to be that switchdev_deferred_process_work() takes the rtnl_mutex itself, which would be worse off than having the rtnl_mutex taken individually from drivers which is what we have now (except DSA which has removed that lock since commit 0faf890fc519 ("net: dsa: drop rtnl_lock from dsa_slave_switchdev_event_work")).
So to offer the needed guarantee to DSA switch drivers, I have come up with a compromise solution that does not require switchdev rework:
we already have a hook at the last moment in time when the bridge is still an upper of ours: the NETDEV_PRECHANGEUPPER handler. We can flush the dsa_owq manually from there, which makes all FDB deletions synchronous.
--- net/dsa/port.c | 2 ++ 1 file changed, 2 insertions(+)
net/dsa/port.c +2 -0
@@ -380,6 +380,8 @@ void dsa_port_pre_bridge_leave(struct dsa_port *dp, struct net_device *br)switchdev_bridge_port_unoffload (brport_dev, dp, &dsa_slave_switchdev_notifier, &dsa_slave_switchdev_blocking_notifier); + +dsa_flush_workqueue (); }void dsa_port_bridge_leave (struct dsa_port *dp,struct net_device *br)
Signature · 1 line
2.33.0
Re: [PATCH 5.15 301/917] net: dsa: flush switchdev workqueue when leaving the bridge
Quoted 78 lines · Greg Kroah-Hartman
From: Vladimir Oltean <[email protected]>
[ Upstream commit
d7d0d423dbaa73fd0506e25971dfdab6bf185d00]DSA is preparing to offer switch drivers an API through which they can associate each FDB entry with a struct
net_device*bridge_dev. This can be used to perform FDB isolation (the FDB lookup performed on the ingress of a standalone, or bridged port, should not find an FDB entry that is present in the FDB of another bridge).In preparation of that work, DSA needs to ensure that by the time we call the switch .port_fdb_add and .port_fdb_del methods, the
dp->bridge_devpointer is still valid, i.e. the port is still a bridge port.This is not guaranteed because the SWITCHDEV_FDB_{ADD,DEL}_TO_DEVICE API requires drivers that must have sleepable context to handle those events to schedule the deferred work themselves. DSA does this through the
dsa_owq.It can happen that a port leaves a bridge,
del_nbp()flushes the FDB on that port,SWITCHDEV_FDB_DEL_TO_DEVICEis notified in atomic context, DSA schedules its deferred work, butdel_nbp()finishes unlinking the bridge as a master from the port before DSA's deferred work is run.Fundamentally, the port must not be unlinked from the bridge until all FDB deletion deferred work items have been flushed. The bridge must wait for the completion of these hardware accesses.
An attempt has been made to address this issue centrally in switchdev by making
SWITCHDEV_FDB_DEL_TO_DEVICEdeferred (=> blocking) at the switchdev level, which would offer implicit synchronization withdel_nbp:https://patchwork.kernel.org/project/netdevbpf/cover/[email protected]/
but it seems that any attempt to modify switchdev's behavior and make the events blocking there would introduce undesirable side effects in other switchdev consumers.
The most undesirable behavior seems to be that
switchdev_deferred_process_work()takes thertnl_mutexitself, which would be worse off than having thertnl_mutextaken individually from drivers which is what we have now (except DSA which has removed that lock since commit0faf890fc519("net: dsa: droprtnl_lockfromdsa_slave_switchdev_event_work")).So to offer the needed guarantee to DSA switch drivers, I have come up with a compromise solution that does not require switchdev rework:
we already have a hook at the last moment in time when the bridge is still an upper of ours: theNETDEV_PRECHANGEUPPERhandler. We can flush thedsa_owqmanually from there, which makes all FDB deletions synchronous.Signed-off-by Vladimir Oltean <[email protected]>Signed-off-by David S. Miller <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- net/dsa/port.c | 2 ++ 1 file changed, 2 insertions(+)net/dsa/port.c +2
-0@@ -380,6 +380,8 @@ void dsa_port_pre_bridge_leave(struct dsa_port *dp, struct net_device *br)switchdev_bridge_port_unoffload (brport_dev, dp, &dsa_slave_switchdev_notifier, &dsa_slave_switchdev_blocking_notifier); + +dsa_flush_workqueue (); }void dsa_port_bridge_leave (struct dsa_port *dp,struct net_device *br)Signature · 1 line
2.33.0
This patch represents preparation work for a new feature. Unless it constitutes a dependency for some other bugfix patches (which I doubt), my suggestion is to not backport it. Thanks.
Sasha Levin
maintainerRe: [PATCH 5.15 301/917] net: dsa: flush switchdev workqueue when leaving the bridge
Quoted 73 lines · Vladimir Oltean
Quoted 72 lines · Greg Kroah-Hartman
From: Vladimir Oltean <[email protected]>
[ Upstream commit
d7d0d423dbaa73fd0506e25971dfdab6bf185d00]DSA is preparing to offer switch drivers an API through which they can associate each FDB entry with a struct
net_device*bridge_dev. This can be used to perform FDB isolation (the FDB lookup performed on the ingress of a standalone, or bridged port, should not find an FDB entry that is present in the FDB of another bridge).In preparation of that work, DSA needs to ensure that by the time we call the switch .port_fdb_add and .port_fdb_del methods, the
dp->bridge_devpointer is still valid, i.e. the port is still a bridge port.This is not guaranteed because the SWITCHDEV_FDB_{ADD,DEL}_TO_DEVICE API requires drivers that must have sleepable context to handle those events to schedule the deferred work themselves. DSA does this through the
dsa_owq.It can happen that a port leaves a bridge,
del_nbp()flushes the FDB on that port,SWITCHDEV_FDB_DEL_TO_DEVICEis notified in atomic context, DSA schedules its deferred work, butdel_nbp()finishes unlinking the bridge as a master from the port before DSA's deferred work is run.Fundamentally, the port must not be unlinked from the bridge until all FDB deletion deferred work items have been flushed. The bridge must wait for the completion of these hardware accesses.
An attempt has been made to address this issue centrally in switchdev by making
SWITCHDEV_FDB_DEL_TO_DEVICEdeferred (=> blocking) at the switchdev level, which would offer implicit synchronization withdel_nbp:https://patchwork.kernel.org/project/netdevbpf/cover/[email protected]/
but it seems that any attempt to modify switchdev's behavior and make the events blocking there would introduce undesirable side effects in other switchdev consumers.
The most undesirable behavior seems to be that
switchdev_deferred_process_work()takes thertnl_mutexitself, which would be worse off than having thertnl_mutextaken individually from drivers which is what we have now (except DSA which has removed that lock since commit0faf890fc519("net: dsa: droprtnl_lockfromdsa_slave_switchdev_event_work")).So to offer the needed guarantee to DSA switch drivers, I have come up with a compromise solution that does not require switchdev rework:
we already have a hook at the last moment in time when the bridge is still an upper of ours: theNETDEV_PRECHANGEUPPERhandler. We can flush thedsa_owqmanually from there, which makes all FDB deletions synchronous.Signed-off-by Vladimir Oltean <[email protected]>Signed-off-by David S. Miller <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- net/dsa/port.c | 2 ++ 1 file changed, 2 insertions(+)net/dsa/port.c +2
-0@@ -380,6 +380,8 @@ void dsa_port_pre_bridge_leave(struct dsa_port *dp, struct net_device *br)switchdev_bridge_port_unoffload (brport_dev, dp, &dsa_slave_switchdev_notifier, &dsa_slave_switchdev_blocking_notifier); + +dsa_flush_workqueue (); }
Quoted 10 lines
Quoted 6 lines
net/dsa/port.c +0
-1void dsa_port_bridge_leave (struct dsa_port *dp,struct net_device *br) --2.33.0
This patch represents preparation work for a new feature. Unless it constitutes a dependency for some other bugfix patches (which I doubt), my suggestion is to not backport it. Thanks.
Dropped, thanks!
Signature · 2 lines
Thanks, Sasha
Greg Kroah-Hartman
maintainerPATCH 302/917 btrfs: reflink: initialize return value to 0 in btrfs_extent_same()
In reply to Greg Kroah-HartmanFrom: Sidong Yang <[email protected]>
[ Upstream commit 44bee215f72f13874c0e734a0712c2e3264c0108 ]
Fix a warning reported by smatch that ret could be returned without initialized. The dedupe operations are supposed to to return 0 for a 0 length range but the caller does not pass olen == 0. To keep this behaviour and also fix the warning initialize ret to 0.
--- fs/btrfs/reflink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/reflink.c +1 -1
@@ -649,7 +649,7 @@ static int btrfs_extent_same_range(struct inode *src, u64 loff, u64 len,static int btrfs_extent_same (struct inode *src,u64 loff,u64 olen,struct inode *dst,u64 dst_loff) { -int ret; +int ret =0 ;u64 i, tail_len, chunk_count;struct btrfs_root *root_dst =BTRFS_I (dst)->root;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 303/917 btrfs: do not take the uuid_mutex in btrfs_rm_device
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
[ Upstream commit 8ef9dc0f14ba6124c62547a4fdc59b163d8b864e ]
We got the following lockdep splat while running fstests (specifically btrfs/003 and btrfs/020 in a row) with the new rc. This was uncovered by 87579e9b7d8d ("loop: use worker per cgroup instead of kworker") which converted loop to using workqueues, which comes with lockdep annotations that don't exist with kworkers. The lockdep splat is as follows:
WARNING: possible circular locking dependency detected 5.14.0-rc2-custom+ #34 Not tainted
------------------------------------------------------
losetup/156417 is trying to acquire lock:
ffff9c7645b02d38 ((wq_completion)loop0){+.+.}-{0:0}, at: flush_workqueue+0x84/0x600
but task is already holding lock:
ffff9c7647395468 (&lo->lo_mutex){+.+.}-{3:3}, at: __loop_clr_fd+0x41/0x650 [loop]
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #5 (&lo->lo_mutex){+.+.}-{3:3}:
__mutex_lock+0xba/0x7c0 lo_open+0x28/0x60 [loop] blkdev_get_whole+0x28/0xf0 blkdev_get_by_dev.part.0+0x168/0x3c0 blkdev_open+0xd2/0xe0 do_dentry_open+0x163/0x3a0 path_openat+0x74d/0xa40 do_filp_open+0x9c/0x140 do_sys_openat2+0xb1/0x170 __x64_sys_openat+0x54/0x90 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae
-> #4 (&disk->open_mutex){+.+.}-{3:3}:
__mutex_lock+0xba/0x7c0 blkdev_get_by_dev.part.0+0xd1/0x3c0 blkdev_get_by_path+0xc0/0xd0 btrfs_scan_one_device+0x52/0x1f0 [btrfs] btrfs_control_ioctl+0xac/0x170 [btrfs] __x64_sys_ioctl+0x83/0xb0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae
-> #3 (uuid_mutex){+.+.}-{3:3}:
__mutex_lock+0xba/0x7c0 btrfs_rm_device+0x48/0x6a0 [btrfs] btrfs_ioctl+0x2d1c/0x3110 [btrfs] __x64_sys_ioctl+0x83/0xb0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae
-> #2 (sb_writers#11){.+.+}-{0:0}:
lo_write_bvec+0x112/0x290 [loop] loop_process_work+0x25f/0xcb0 [loop] process_one_work+0x28f/0x5d0 worker_thread+0x55/0x3c0 kthread+0x140/0x170 ret_from_fork+0x22/0x30
-> #1 ((work_completion)(&lo->rootcg_work)){+.+.}-{0:0}:
process_one_work+0x266/0x5d0 worker_thread+0x55/0x3c0 kthread+0x140/0x170 ret_from_fork+0x22/0x30
-> #0 ((wq_completion)loop0){+.+.}-{0:0}:
__lock_acquire+0x1130/0x1dc0 lock_acquire+0xf5/0x320 flush_workqueue+0xae/0x600 drain_workqueue+0xa0/0x110 destroy_workqueue+0x36/0x250 __loop_clr_fd+0x9a/0x650 [loop] lo_ioctl+0x29d/0x780 [loop] block_ioctl+0x3f/0x50 __x64_sys_ioctl+0x83/0xb0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae
other info that might help us debug this:
Chain exists of:
(wq_completion)loop0 --> &disk->open_mutex --> &lo->lo_mutex
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&lo->lo_mutex);
lock(&disk->open_mutex);
lock(&lo->lo_mutex);
lock((wq_completion)loop0); *** DEADLOCK ***
1 lock held by losetup/156417:
#0: ffff9c7647395468 (&lo->lo_mutex){+.+.}-{3:3}, at: __loop_clr_fd+0x41/0x650 [loop]
stack backtrace: CPU: 8 PID: 156417 Comm: losetup Not tainted 5.14.0-rc2-custom+ #34 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015 Call Trace: dump_stack_lvl+0x57/0x72 check_noncircular+0x10a/0x120 __lock_acquire+0x1130/0x1dc0 lock_acquire+0xf5/0x320 ? flush_workqueue+0x84/0x600 flush_workqueue+0xae/0x600 ? flush_workqueue+0x84/0x600 drain_workqueue+0xa0/0x110 destroy_workqueue+0x36/0x250 __loop_clr_fd+0x9a/0x650 [loop] lo_ioctl+0x29d/0x780 [loop] ? __lock_acquire+0x3a0/0x1dc0 ? update_dl_rq_load_avg+0x152/0x360 ? lock_is_held_type+0xa5/0x120 ? find_held_lock.constprop.0+0x2b/0x80 block_ioctl+0x3f/0x50 __x64_sys_ioctl+0x83/0xb0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f645884de6b
Usually the uuid_mutex exists to protect the fs_devices that map together all of the devices that match a specific uuid. In rm_device we're messing with the uuid of a device, so it makes sense to protect that here.
However in doing that it pulls in a whole host of lockdep dependencies, as we call mnt_may_write() on the sb before we grab the uuid_mutex, thus we end up with the dependency chain under the uuid_mutex being added under the normal sb write dependency chain, which causes problems with loop devices.
We don't need the uuid mutex here however. If we call btrfs_scan_one_device() before we scratch the super block we will find the fs_devices and not find the device itself and return EBUSY because the fs_devices is open. If we call it after the scratch happens it will not appear to be a valid btrfs file system.
We do not need to worry about other fs_devices modifying operations here because we're protected by the exclusive operations locking.
So drop the uuid_mutex here in order to fix the lockdep splat.
A more detailed explanation from the discussion:
We are worried about rm and scan racing with each other, before this change we'll zero the device out under the UUID mutex so when scan does run it'll make sure that it can go through the whole device scan thing without rm messing with us.
We aren't worried if the scratch happens first, because the result is we don't think this is a btrfs device and we bail out.
The only case we are concerned with is we scratch _after_ scan is able to read the superblock and gets a seemingly valid super block, so lets consider this case.
Scan will call device_list_add() with the device we're removing. We'll call find_fsid_with_metadata_uuid() and get our fs_devices for this UUID. At this point we lock the fs_devices->device_list_mutex. This is what protects us in this case, but we have two cases here.
1. We aren't to the device removal part of the RM. We found our device, and device name matches our path, we go down and we set total_devices to our super number of devices, which doesn't affect anything because we haven't done the remove yet.
2. We are past the device removal part, which is protected by the device_list_mutex. Scan doesn't find the device, it goes down and does the
if (fs_devices->opened)
return -EBUSY;
check and we bail out.
Nothing about this situation is ideal, but the lockdep splat is real, and the fix is safe, tho admittedly a bit scary looking.
--- fs/btrfs/volumes.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
fs/btrfs/volumes.c +5 -5
@@ -2083,8 +2083,11 @@ int btrfs_rm_device(struct btrfs_fs_info *fs_info, const char *device_path,u64 num_devices;int ret =0 ; -mutex_lock (&uuid_mutex); - +/* +* The device list in fs_devices is accessed without locks (neither +* uuid_mutex nor device_list_mutex) as it won't change on a mounted +* filesystem and another device rm cannot run. +*/ num_devices =btrfs_num_devices (fs_info); ret =btrfs_check_raid_min_devices (fs_info, num_devices -1 );
@@ -2128,11 +2131,9 @@ int btrfs_rm_device(struct btrfs_fs_info *fs_info, const char *device_path,mutex_unlock (&fs_info->chunk_mutex); } -mutex_unlock (&uuid_mutex); ret =btrfs_shrink_device (device,0 );if (!ret)btrfs_reada_remove_dev (device); -mutex_lock (&uuid_mutex);if (ret) goto error_undo;
@@ -2219,7 +2220,6 @@ int btrfs_rm_device(struct btrfs_fs_info *fs_info, const char *device_path, } out: -mutex_unlock (&uuid_mutex);return ret; error_undo:
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 304/917 spi: bcm-qspi: Fix missing clk_disable_unprepare() on error in bcm_qspi_probe()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit ca9b8f56ec089d3a436050afefd17b7237301f47 ]
Fix the missing clk_disable_unprepare() before return from bcm_qspi_probe() in the error handling case.
--- drivers/spi/spi-bcm-qspi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/spi/spi-bcm-qspi.c +3 -2
@@ -1460,7 +1460,7 @@ int bcm_qspi_probe(struct platform_device *pdev, &qspi->dev_ids[val]);if (ret <0 ) {dev_err (&pdev->dev,"IRQ %s not found\n" , name); - goto qspi_probe_err; + goto qspi_unprepare_err; } qspi->dev_ids[val].dev = qspi;
@@ -1475,7 +1475,7 @@ int bcm_qspi_probe(struct platform_device *pdev,if (!num_ints) {dev_err (&pdev->dev,"no IRQs registered, cannot init driver\n" ); ret = -EINVAL ; - goto qspi_probe_err; + goto qspi_unprepare_err; }bcm_qspi_hw_init (qspi);
@@ -1499,6 +1499,7 @@ int bcm_qspi_probe(struct platform_device *pdev, qspi_reg_err:bcm_qspi_hw_uninit (qspi); +qspi_unprepare_err:clk_disable_unprepare (qspi->clk); qspi_probe_err:kfree (qspi->dev_ids);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 305/917 wcn36xx: Correct band/freq reporting on RX
In reply to Greg Kroah-HartmanFrom: Loic Poulain <[email protected]>
[ Upstream commit 8a27ca39478270e07baf9c09aa0c99709769ba03 ]
For packets originating from hardware scan, the channel and band is included in the buffer descriptor (bd->rf_band & bd->rx_ch).
For 2Ghz band the channel value is directly reported in the 4-bit rx_ch field. For 5Ghz band, the rx_ch field contains a mapping index (given the 4-bit limitation).
The reserved0 value field is also used to extend 4-bit mapping to 5-bit mapping to support more than 16 5Ghz channels.
This change adds correct reporting of the frequency/band, that is used in scan mechanism. And is required for 5Ghz hardware scan support.
--- drivers/net/wireless/ath/wcn36xx/txrx.c | 23 +++++++++++++++++++++++ drivers/net/wireless/ath/wcn36xx/txrx.h | 3 ++- 2 files changed, 25 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/wcn36xx/txrx.c +23 -0
@@ -31,6 +31,13 @@ struct wcn36xx_rate {enum rate_info_bw bw; }; +/* Buffer descriptor rx_ch field is limited to 5-bit (4+1), a mapping is used +* for 11A Channels. +*/ +static const u8 ab_rx_ch_map[] = {36 ,40 ,44 ,48 ,52 ,56 ,60 ,64 ,100 ,104 , +108 ,112 ,116 ,120 ,124 ,128 ,132 ,136 ,140 , +149 ,153 ,157 ,161 ,165 ,144 }; +static const struct wcn36xx_rate wcn36xx_rate_table[] = {/* 11b rates */ {10 ,0 ,RX_ENC_LEGACY ,0 ,RATE_INFO_BW_20 },
@@ -291,6 +298,22 @@ int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb) ieee80211_is_probe_resp(hdr->frame_control)) status.boottime_ns = ktime_get_boottime_ns(); +if (bd->scan_learn) { +/* If packet originates from hardware scanning, extract the +* band/channel from bd descriptor. +*/ +u8 hwch = (bd->reserved0 <<4 ) + bd->rx_ch; + +if (bd->rf_band !=1 && hwch <=sizeof (ab_rx_ch_map) && hwch >=1 ) { + status.band =NL80211_BAND_5GHZ ; + status.freq =ieee80211_channel_to_frequency (ab_rx_ch_map[hwch -1 ], + status.band); + }else { + status.band =NL80211_BAND_2GHZ ; + status.freq =ieee80211_channel_to_frequency (hwch, status.band); + } + } +memcpy (IEEE80211_SKB_RXCB (skb), &status,sizeof (status));if (ieee80211_is_beacon (hdr->frame_control)) {
drivers/net/wireless/ath/wcn36xx/txrx.h +2 -1
@@ -110,7 +110,8 @@ struct wcn36xx_rx_bd {/* 0x44 */ u32 exp_seq_num:12; u32 cur_seq_num:12; - u32 fr_type_subtype:8; + u32 rf_band:2; + u32 fr_type_subtype:6;/* 0x48 */ u32 msdu_size:16;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 306/917 wcn36xx: Fix packet drop on resume
In reply to Greg Kroah-HartmanFrom: Loic Poulain <[email protected]>
[ Upstream commit df0697801d8aa2eebfe7f0b7388879639f8fe7cc ]
If the system is resumed because of an incoming packet, the wcn36xx RX interrupts is fired before actual resuming of the wireless/mac80211 stack, causing any received packets to be simply dropped. E.g. a ping request causes a system resume, but is dropped and so never forwarded to the IP stack.
This change fixes that, disabling DMA interrupts on suspend to no pass packets until mac80211 is resumed and ready to handle them.
Note that it's not incompatible with RX irq wake.
--- drivers/net/wireless/ath/wcn36xx/main.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/net/wireless/ath/wcn36xx/main.c +11 -0
@@ -1115,6 +1115,13 @@ static int wcn36xx_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wow) goto out; ret =wcn36xx_smd_wlan_host_suspend_ind (wcn); } + +/* Disable IRQ, we don't want to handle any packet before mac80211 is +* resumed and ready to receive packets. +*/ +disable_irq (wcn->tx_irq); +disable_irq (wcn->rx_irq); + out:mutex_unlock (&wcn->conf_mutex);return ret;
@@ -1137,6 +1144,10 @@ static int wcn36xx_resume(struct ieee80211_hw *hw)wcn36xx_smd_ipv6_ns_offload (wcn, vif, false);wcn36xx_smd_arp_offload (wcn, vif, false); } + +enable_irq (wcn->tx_irq); +enable_irq (wcn->rx_irq); +mutex_unlock (&wcn->conf_mutex);return 0 ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 307/917 Revert "wcn36xx: Enable firmware link monitoring"
In reply to Greg Kroah-HartmanFrom: Bryan O'Donoghue <[email protected]>
[ Upstream commit 43ea9bd84f27d06482cc823d9749cc9dd2993bc8 ]
Firmware link offload monitoring can be made to work in 3/4 cases by switching on firmware feature bit WLANACTIVE_OFFLOAD
- Secure power-save on
- Secure power-save off
- Open power-save on
However, with an open AP if we switch off power-saving - thus never entering Beacon Mode Power Save - BMPS, firmware never forwards loss of beacon upwards.
We had hoped that WLANACTIVE_OFFLOAD and some fixes for sequence numbers would unblock this but, it hasn't and further investigation is required.
Its possible to have a complete set of Secure power-save on/off and Open power-save on/off provided we use Linux' link monitoring mechanism.
While we debug the Open AP failure we need to fix upstream.
This reverts commit c973fdad79f6eaf247d48b5fc77733e989eb01e1.
--- drivers/net/wireless/ath/wcn36xx/main.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/wireless/ath/wcn36xx/main.c +0 -1
@@ -1341,7 +1341,6 @@ static int wcn36xx_init_ieee80211(struct wcn36xx *wcn)ieee80211_hw_set (wcn->hw,HAS_RATE_CONTROL );ieee80211_hw_set (wcn->hw,SINGLE_SCAN_ON_ALL_BANDS );ieee80211_hw_set (wcn->hw,REPORTS_TX_ACK_STATUS ); -ieee80211_hw_set (wcn->hw,CONNECTION_MONITOR ); wcn->hw->wiphy->interface_modes =BIT (NL80211_IFTYPE_STATION ) | BIT(NL80211_IFTYPE_AP) |
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 308/917 ftrace: do CPU checking after preemption disabled
In reply to Greg Kroah-HartmanFrom: 王贇 <[email protected]>
[ Upstream commit d33cc657372366a8959f099c619a208b4c5dc664 ]
With CONFIG_DEBUG_PREEMPT we observed reports like:
BUG: using smp_processor_id() in preemptible caller is perf_ftrace_function_call+0x6f/0x2e0 CPU: 1 PID: 680 Comm: a.out Not tainted Call Trace: <TASK> dump_stack_lvl+0x8d/0xcf check_preemption_disabled+0x104/0x110 ? optimize_nops.isra.7+0x230/0x230 ? text_poke_bp_batch+0x9f/0x310 perf_ftrace_function_call+0x6f/0x2e0 ... __text_poke+0x5/0x620 text_poke_bp_batch+0x9f/0x310
This telling us the CPU could be changed after task is preempted, and the checking on CPU before preemption will be invalid.
Since now ftrace_test_recursion_trylock() will help to disable the preemption, this patch just do the checking after trylock() to address the issue.
--- kernel/trace/trace_event_perf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/trace/trace_event_perf.c +3 -3
@@ -441,13 +441,13 @@ perf_ftrace_function_call(unsigned long ip, unsigned long parent_ip,if (!rcu_is_watching ())return ; -if ((unsigned long )ops->private !=smp_processor_id ()) -return ; - bit =ftrace_test_recursion_trylock (ip, parent_ip);if (bit <0 )return ; +if ((unsigned long )ops->private !=smp_processor_id ()) + goto out; + event = container_of(ops, struct perf_event, ftrace_ops);/*
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 309/917 inet: remove races in inet{6}_getname()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 9dfc685e0262d4c5e44e13302f89841fa75173ca ]
syzbot reported data-races in inet_getname() multiple times, it is time we fix this instead of pretending applications should not trigger them.
getsockname() and getpeername() are not really considered fast path.
v2: added the missing BPF_CGROUP_RUN_SA_PROG() declaration
needed when CONFIG_CGROUP_BPF=n, as reported by kernel test robot <[email protected]>
syzbot typical report:
BUG: KCSAN: data-race in __inet_hash_connect / inet_getname
write to 0xffff888136d66cf8 of 2 bytes by task 14374 on cpu 1:
__inet_hash_connect+0x7ec/0x950 net/ipv4/inet_hashtables.c:831 inet_hash_connect+0x85/0x90 net/ipv4/inet_hashtables.c:853 tcp_v4_connect+0x782/0xbb0 net/ipv4/tcp_ipv4.c:275 __inet_stream_connect+0x156/0x6e0 net/ipv4/af_inet.c:664 inet_stream_connect+0x44/0x70 net/ipv4/af_inet.c:728 __sys_connect_file net/socket.c:1896 [inline] __sys_connect+0x254/0x290 net/socket.c:1913 __do_sys_connect net/socket.c:1923 [inline] __se_sys_connect net/socket.c:1920 [inline] __x64_sys_connect+0x3d/0x50 net/socket.c:1920 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae
read to 0xffff888136d66cf8 of 2 bytes by task 14408 on cpu 0:
inet_getname+0x11f/0x170 net/ipv4/af_inet.c:790 __sys_getsockname+0x11d/0x1b0 net/socket.c:1946 __do_sys_getsockname net/socket.c:1961 [inline] __se_sys_getsockname net/socket.c:1958 [inline] __x64_sys_getsockname+0x3e/0x50 net/socket.c:1958 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae
value changed: 0x0000 -> 0xdee0
Reported by Kernel Concurrency Sanitizer on:
CPU: 0 PID: 14408 Comm: syz-executor.3 Not tainted 5.15.0-rc3-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
--- include/linux/bpf-cgroup.h | 1 + net/ipv4/af_inet.c | 16 +++++++++------- net/ipv6/af_inet6.c | 21 +++++++++++---------- 3 files changed, 21 insertions(+), 17 deletions(-)
include/linux/bpf-cgroup.h +1 -0
@@ -517,6 +517,7 @@ static inline int bpf_percpu_cgroup_storage_update(struct bpf_map *map,#define cgroup_bpf_enabled (atype) (0)#define BPF_CGROUP_RUN_SA_PROG_LOCK (sk, uaddr, atype, t_ctx) ({ 0; }) +#define BPF_CGROUP_RUN_SA_PROG (sk, uaddr, atype) ({ 0; })#define BPF_CGROUP_PRE_CONNECT_ENABLED (sk) (0)#define BPF_CGROUP_RUN_PROG_INET_INGRESS (sk,skb) ({ 0; })#define BPF_CGROUP_RUN_PROG_INET_EGRESS (sk,skb) ({ 0; })
net/ipv4/af_inet.c +9 -7
@@ -773,26 +773,28 @@ int inet_getname(struct socket *sock, struct sockaddr *uaddr, DECLARE_SOCKADDR(struct sockaddr_in *, sin, uaddr); sin->sin_family =AF_INET ; +lock_sock (sk);if (peer) {if (!inet->inet_dport || (((1 << sk->sk_state) & (TCPF_CLOSE |TCPF_SYN_SENT )) && - peer ==1 )) + peer ==1 )) { +release_sock (sk);return -ENOTCONN ; + } sin->sin_port = inet->inet_dport; sin->sin_addr.s_addr = inet->inet_daddr; -BPF_CGROUP_RUN_SA_PROG_LOCK (sk, (struct sockaddr *)sin, -CGROUP_INET4_GETPEERNAME , -NULL ); +BPF_CGROUP_RUN_SA_PROG (sk, (struct sockaddr *)sin, +CGROUP_INET4_GETPEERNAME ); }else {__be32 addr = inet->inet_rcv_saddr;if (!addr) addr = inet->inet_saddr; sin->sin_port = inet->inet_sport; sin->sin_addr.s_addr = addr; -BPF_CGROUP_RUN_SA_PROG_LOCK (sk, (struct sockaddr *)sin, -CGROUP_INET4_GETSOCKNAME , -NULL ); +BPF_CGROUP_RUN_SA_PROG (sk, (struct sockaddr *)sin, +CGROUP_INET4_GETSOCKNAME ); } +release_sock (sk);memset (sin->sin_zero,0 ,sizeof (sin->sin_zero));return sizeof (*sin); }
net/ipv6/af_inet6.c +11 -10
@@ -521,31 +521,32 @@ int inet6_getname(struct socket *sock, struct sockaddr *uaddr, sin->sin6_family =AF_INET6 ; sin->sin6_flowinfo =0 ; sin->sin6_scope_id =0 ; +lock_sock (sk);if (peer) { -if (!inet->inet_dport) -return -ENOTCONN ; -if (((1 << sk->sk_state) & (TCPF_CLOSE |TCPF_SYN_SENT )) && - peer ==1 ) +if (!inet->inet_dport || + (((1 << sk->sk_state) & (TCPF_CLOSE |TCPF_SYN_SENT )) && + peer ==1 )) { +release_sock (sk);return -ENOTCONN ; + } sin->sin6_port = inet->inet_dport; sin->sin6_addr = sk->sk_v6_daddr;if (np->sndflow) sin->sin6_flowinfo = np->flow_label; -BPF_CGROUP_RUN_SA_PROG_LOCK (sk, (struct sockaddr *)sin, -CGROUP_INET6_GETPEERNAME , -NULL ); +BPF_CGROUP_RUN_SA_PROG (sk, (struct sockaddr *)sin, +CGROUP_INET6_GETPEERNAME ); }else {if (ipv6_addr_any (&sk->sk_v6_rcv_saddr)) sin->sin6_addr = np->saddr;else sin->sin6_addr = sk->sk_v6_rcv_saddr; sin->sin6_port = inet->inet_sport; -BPF_CGROUP_RUN_SA_PROG_LOCK (sk, (struct sockaddr *)sin, -CGROUP_INET6_GETSOCKNAME , -NULL ); +BPF_CGROUP_RUN_SA_PROG (sk, (struct sockaddr *)sin, +CGROUP_INET6_GETSOCKNAME ); } sin->sin6_scope_id =ipv6_iface_scope_id (&sin->sin6_addr, sk->sk_bound_dev_if); +release_sock (sk);return sizeof (*sin); }EXPORT_SYMBOL (inet6_getname);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 310/917 x86/hyperv: Protect set_hv_tscchange_cb() against getting preempted
In reply to Greg Kroah-HartmanFrom: Vitaly Kuznetsov <[email protected]>
[ Upstream commit 285f68afa8b20f752b0b7194d54980b5e0e27b75 ]
The following issue is observed with CONFIG_DEBUG_PREEMPT when KVM loads:
KVM: vmx: using Hyper-V Enlightened VMCS
BUG: using smp_processor_id() in preemptible [00000000] code: systemd-udevd/488 caller is set_hv_tscchange_cb+0x16/0x80 CPU: 1 PID: 488 Comm: systemd-udevd Not tainted 5.15.0-rc5+ #396 Hardware name: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS Hyper-V UEFI Release v4.0 12/17/2019 Call Trace: dump_stack_lvl+0x6a/0x9a check_preemption_disabled+0xde/0xe0 ? kvm_gen_update_masterclock+0xd0/0xd0 [kvm] set_hv_tscchange_cb+0x16/0x80 kvm_arch_init+0x23f/0x290 [kvm] kvm_init+0x30/0x310 [kvm] vmx_init+0xaf/0x134 [kvm_intel] ...
set_hv_tscchange_cb() can get preempted in between acquiring smp_processor_id() and writing to HV_X64_MSR_REENLIGHTENMENT_CONTROL. This is not an issue by itself: HV_X64_MSR_REENLIGHTENMENT_CONTROL is a partition-wide MSR and it doesn't matter which particular CPU will be used to receive reenlightenment notifications. The only real problem can (in theory) be observed if the CPU whose id was acquired with smp_processor_id() goes offline before we manage to write to the MSR, the logic in hv_cpu_die() won't be able to reassign it correctly.
--- arch/x86/hyperv/hv_init.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/x86/hyperv/hv_init.c +4 -1
@@ -139,7 +139,6 @@ void set_hv_tscchange_cb(void (*cb)(void))struct hv_reenlightenment_control re_ctrl = { .vector =HYPERV_REENLIGHTENMENT_VECTOR , .enabled =1 , - .target_vp = hv_vp_index[smp_processor_id ()] };struct hv_tsc_emulation_control emu_ctrl = {.enabled =1 };
@@ -153,8 +152,12 @@ void set_hv_tscchange_cb(void (*cb)(void))/* Make sure callback is registered before we write to MSRs */ wmb (); + re_ctrl.target_vp = hv_vp_index[get_cpu ()]; +wrmsrl (HV_X64_MSR_REENLIGHTENMENT_CONTROL , *((u64 *)&re_ctrl));wrmsrl (HV_X64_MSR_TSC_EMULATION_CONTROL , *((u64 *)&emu_ctrl)); + +put_cpu (); }EXPORT_SYMBOL_GPL (set_hv_tscchange_cb);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 311/917 drm/amd/display: dcn20_resource_construct reduce scope of FPU enabled
In reply to Greg Kroah-HartmanFrom: Anson Jacob <[email protected]>
[ Upstream commit bc39a69a2ac484e6575a958567c162ef56c9f278 ]
Limit when FPU is enabled to only functions that does FPU operations for dcn20_resource_construct, which gets called during driver initialization.
Enabling FPU operation disables preemption. Sleeping functions(mutex (un)lock, memory allocation using GFP_KERNEL, etc.) should not be called when preemption is disabled.
Fixes the following case caught by enablingCONFIG_DEBUG_ATOMIC_SLEEP in kernel config
[ 1.338434] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:281 [ 1.347395] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 197, name: systemd-udevd [ 1.356356] CPU: 7 PID: 197 Comm: systemd-udevd Not tainted 5.13.0+ #3 [ 1.356358] Hardware name: System manufacturer System Product Name/PRIME X570-PRO, BIOS 3405 02/01/2021 [ 1.356360] Call Trace: [ 1.356361] dump_stack+0x6b/0x86 [ 1.356366] ___might_sleep.cold+0x87/0x98 [ 1.356370] __might_sleep+0x4b/0x80 [ 1.356372] mutex_lock+0x21/0x50 [ 1.356376] smu_get_uclk_dpm_states+0x3f/0x80 [amdgpu] [ 1.356538] pp_nv_get_uclk_dpm_states+0x35/0x50 [amdgpu] [ 1.356711] init_soc_bounding_box+0xf9/0x210 [amdgpu] [ 1.356892] ? create_object+0x20d/0x340 [ 1.356897] ? dcn20_resource_construct+0x46f/0xd30 [amdgpu] [ 1.357077] dcn20_resource_construct+0x4b1/0xd30 [amdgpu]
...
Tested on: 5700XT (NAVI10 0x1002:0x731F 0x1DA2:0xE410 0xC1)
--- .../drm/amd/display/dc/dcn20/dcn20_resource.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +9 -7
@@ -3668,16 +3668,22 @@ static bool init_soc_bounding_box(struct dc *dc, clock_limits_available = (status ==PP_SMU_RESULT_OK ); } -if (clock_limits_available && uclk_states_available && num_states) +if (clock_limits_available && uclk_states_available && num_states) { +DC_FP_START ();dcn20_update_bounding_box (dc, loaded_bb, &max_clocks, uclk_states, num_states); -else if (clock_limits_available) +DC_FP_END (); + }else if (clock_limits_available) { +DC_FP_START ();dcn20_cap_soc_clocks (loaded_bb, max_clocks); +DC_FP_END (); + } } loaded_ip->max_num_otg = pool->base.res_cap->num_timing_generator; loaded_ip->max_num_dpp = pool->base.pipe_count; +DC_FP_START ();dcn20_patch_bounding_box (dc, loaded_bb); - +DC_FP_END ();return true; }
@@ -3697,8 +3703,6 @@ static bool dcn20_resource_construct(enum dml_project dml_project_version =get_dml_project_version (ctx->asic_id.hw_internal_rev); -DC_FP_START (); - ctx->dc_bios->regs = &bios_regs; pool->base.funcs = &dcn20_res_pool_funcs;
@@ -4047,12 +4051,10 @@ static bool dcn20_resource_construct( pool->base.oem_device =NULL ; } -DC_FP_END ();return true; create_fail: -DC_FP_END ();dcn20_resource_destruct (pool);return false;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 312/917 selftests/core: fix conflicting types compile error for close_range()
In reply to Greg Kroah-HartmanFrom: Shuah Khan <[email protected]>
[ Upstream commit f35dcaa0a8a29188ed61083d153df1454cf89d08 ]
close_range() test type conflicts with close_range() library call in x86_64-linux-gnu/bits/unistd_ext.h. Fix it by changing the name to core_close_range().
gcc -g -I../../../../usr/include/ close_range_test.c -o ../tools/testing/selftests/core/close_range_test
In file included from close_range_test.c:16:
close_range_test.c:57:6: error: conflicting types for ‘close_range’; have ‘void(struct __test_metadata *)’
57 | TEST(close_range)
| ^~~~~~~~~~~
../kselftest_harness.h:181:21: note: in definition of macro ‘__TEST_IMPL’
181 | static void test_name(struct __test_metadata *_metadata); \
| ^~~~~~~~~
close_range_test.c:57:1: note: in expansion of macro ‘TEST’
57 | TEST(close_range)
| ^~~~
In file included from /usr/include/unistd.h:1204,
from close_range_test.c:13:
/usr/include/x86_64-linux-gnu/bits/unistd_ext.h:56:12: note: previous declaration of ‘close_range’ with type ‘int(unsigned int, unsigned int, int)’
56 | extern int close_range (unsigned int __fd, unsigned int __max_fd,
| ^~~~~~~~~~~--- tools/testing/selftests/core/close_range_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/core/close_range_test.c +1 -1
@@ -54,7 +54,7 @@ static inline int sys_close_range(unsigned int fd, unsigned int max_fd,#define ARRAY_SIZE (x) (sizeof(x) / sizeof((x)[0]))#endif -TEST (close_range) +TEST (core_close_range) {int i, ret;int open_fds[101 ];
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 313/917 perf/x86/intel: Fix ICL/SPR INST_RETIRED.PREC_DIST encodings
In reply to Greg Kroah-HartmanFrom: Stephane Eranian <[email protected]>
[ Upstream commit 2de71ee153efa93099d2ab864acffeec70a8dcd5 ]
This patch fixes the encoding for INST_RETIRED.PREC_DIST as published by Intel (download.01.org/perfmon/) for Icelake. The official encoding
is event code 0x00 umask 0x1, a change from Skylake where it was code 0xc0 umask 0x1.
With this patch applied it is possible to run:
$ perf record -a -e cpu/event=0x00,umask=0x1/pp .....
Whereas before this would fail.
To avoid problems with tools which may use the old code, we maintain the old encoding for Icelake.
--- arch/x86/events/intel/core.c | 5 +++-- arch/x86/events/intel/ds.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-)
arch/x86/events/intel/core.c +3 -2
@@ -243,7 +243,8 @@ static struct extra_reg intel_skl_extra_regs[] __read_mostly = {static struct event_constraint intel_icl_event_constraints[] = {FIXED_EVENT_CONSTRAINT (0x00c0 ,0 ),/* INST_RETIRED.ANY */ -FIXED_EVENT_CONSTRAINT (0x01c0 ,0 ),/* INST_RETIRED.PREC_DIST */ +FIXED_EVENT_CONSTRAINT (0x01c0 ,0 ),/* old INST_RETIRED.PREC_DIST */ +FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* INST_RETIRED.PREC_DIST */ FIXED_EVENT_CONSTRAINT (0x003c ,1 ),/* CPU_CLK_UNHALTED.CORE */ FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* CPU_CLK_UNHALTED.REF */ FIXED_EVENT_CONSTRAINT (0x0400 ,3 ),/* SLOTS */
@@ -288,7 +289,7 @@ static struct extra_reg intel_spr_extra_regs[] __read_mostly = {static struct event_constraint intel_spr_event_constraints[] = {FIXED_EVENT_CONSTRAINT (0x00c0 ,0 ),/* INST_RETIRED.ANY */ -FIXED_EVENT_CONSTRAINT (0x01c0 ,0 ),/* INST_RETIRED.PREC_DIST */ +FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* INST_RETIRED.PREC_DIST */ FIXED_EVENT_CONSTRAINT (0x003c ,1 ),/* CPU_CLK_UNHALTED.CORE */ FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* CPU_CLK_UNHALTED.REF */ FIXED_EVENT_CONSTRAINT (0x0400 ,3 ),/* SLOTS */
arch/x86/events/intel/ds.c +3 -2
@@ -923,7 +923,8 @@ struct event_constraint intel_skl_pebs_event_constraints[] = { };struct event_constraint intel_icl_pebs_event_constraints[] = { -INTEL_FLAGS_UEVENT_CONSTRAINT (0x1c0 ,0x100000000ULL ),/* INST_RETIRED.PREC_DIST */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x01c0 ,0x100000000ULL ),/* old INST_RETIRED.PREC_DIST */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x0100 ,0x100000000ULL ),/* INST_RETIRED.PREC_DIST */ INTEL_FLAGS_UEVENT_CONSTRAINT (0x0400 ,0x800000000ULL ),/* SLOTS */ INTEL_PLD_CONSTRAINT (0x1cd ,0xff ),/* MEM_TRANS_RETIRED.LOAD_LATENCY */
@@ -943,7 +944,7 @@ struct event_constraint intel_icl_pebs_event_constraints[] = { };struct event_constraint intel_spr_pebs_event_constraints[] = { -INTEL_FLAGS_UEVENT_CONSTRAINT (0x1c0 ,0x100000000ULL ), +INTEL_FLAGS_UEVENT_CONSTRAINT (0x100 ,0x100000000ULL ),/* INST_RETIRED.PREC_DIST */ INTEL_FLAGS_UEVENT_CONSTRAINT (0x0400 ,0x800000000ULL ),INTEL_FLAGS_EVENT_CONSTRAINT (0xc0 ,0xfe ),
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 314/917 parisc: fix warning in flush_tlb_all
In reply to Greg Kroah-HartmanFrom: Sven Schnelle <[email protected]>
[ Upstream commit 1030d681319b43869e0d5b568b9d0226652d1a6f ]
I've got the following splat after enabling preemption:
[ 3.724721] BUG: using __this_cpu_add() in preemptible [00000000] code: swapper/0/1 [ 3.734630] caller is __this_cpu_preempt_check+0x38/0x50 [ 3.740635] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.15.0-rc4-64bit+ #324 [ 3.744605] Hardware name: 9000/785/C8000 [ 3.744605] Backtrace: [ 3.744605] [<00000000401d9d58>] show_stack+0x74/0xb0 [ 3.744605] [<0000000040c27bd4>] dump_stack_lvl+0x10c/0x188 [ 3.744605] [<0000000040c27c84>] dump_stack+0x34/0x48 [ 3.744605] [<0000000040c33438>] check_preemption_disabled+0x178/0x1b0 [ 3.744605] [<0000000040c334f8>] __this_cpu_preempt_check+0x38/0x50 [ 3.744605] [<00000000401d632c>] flush_tlb_all+0x58/0x2e0 [ 3.744605] [<00000000401075c0>] 0x401075c0 [ 3.744605] [<000000004010b8fc>] 0x4010b8fc [ 3.744605] [<00000000401080fc>] 0x401080fc [ 3.744605] [<00000000401d5224>] do_one_initcall+0x128/0x378 [ 3.744605] [<0000000040102de8>] 0x40102de8 [ 3.744605] [<0000000040c33864>] kernel_init+0x60/0x3a8 [ 3.744605] [<00000000401d1020>] ret_from_kernel_thread+0x20/0x28 [ 3.744605]
Fix this by moving the __inc_irq_stat() into the locked section.
--- arch/parisc/mm/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/parisc/mm/init.c +2 -2
@@ -842,9 +842,9 @@ void flush_tlb_all(void) {int do_recycle; -__inc_irq_stat (irq_tlb_count); do_recycle =0 ;spin_lock (&sid_lock); +__inc_irq_stat (irq_tlb_count);if (dirty_space_ids >RECYCLE_THRESHOLD ) {BUG_ON (recycle_inuse);/* FIXME: Use a semaphore/wait queue here */ get_dirty_sids (&recycle_ndirty,recycle_dirty_array);
@@ -863,8 +863,8 @@ void flush_tlb_all(void)#else void flush_tlb_all (void ) { -__inc_irq_stat (irq_tlb_count);spin_lock (&sid_lock); +__inc_irq_stat (irq_tlb_count);flush_tlb_all_local (NULL );recycle_sids ();spin_unlock (&sid_lock);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 315/917 task_stack: Fix end_of_stack() for architectures with upwards-growing stack
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
[ Upstream commit 9cc2fa4f4a92ccc6760d764e7341be46ee8aaaa1 ]
The function end_of_stack() returns a pointer to the last entry of a stack. For architectures like parisc where the stack grows upwards return the pointer to the highest address in the stack.
Without this change I faced a crash on parisc, because the stackleak functionality wrote STACKLEAK_POISON to the lowest address and thus overwrote the first 4 bytes of the task_struct which included the TIF_FLAGS.
--- include/linux/sched/task_stack.h | 4 ++++ 1 file changed, 4 insertions(+)
include/linux/sched/task_stack.h +4 -0
@@ -25,7 +25,11 @@ static inline void *task_stack_page(const struct task_struct *task)static inline unsigned long *end_of_stack (const struct task_struct *task) { +#ifdef CONFIG_STACK_GROWSUP +return (unsigned long *)((unsigned long )task->stack +THREAD_SIZE ) -1 ; +#else return task->stack; +#endif }#elif !defined(__HAVE_THREAD_FUNCTIONS)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 316/917 erofs: dont trigger WARN() when decompression fails
In reply to Greg Kroah-HartmanFrom: Gao Xiang <[email protected]>
[ Upstream commit a0961f351d82d43ab0b845304caa235dfe249ae9 ]
syzbot reported a WARNING [1] due to corrupted compressed data.
As Dmitry said, "If this is not a kernel bug, then the code should not use WARN. WARN if for kernel bugs and is recognized as such by all testing systems and humans."
[1] https://lore.kernel.org/r/[email protected]
--- fs/erofs/decompressor.c | 1 - 1 file changed, 1 deletion(-)
fs/erofs/decompressor.c +0 -1
@@ -233,7 +233,6 @@ static int z_erofs_lz4_decompress(struct z_erofs_decompress_req *rq, u8 *out)erofs_err (rq->sb,"failed to decompress %d in[%u, %u] out[%u]" , ret, rq->inputsize, inputmargin, rq->outputsize); -WARN_ON (1 );print_hex_dump (KERN_DEBUG ,"[ in]: " ,DUMP_PREFIX_OFFSET ,16 ,1 , src + inputmargin, rq->inputsize, true); print_hex_dump(KERN_DEBUG, "[out]: ", DUMP_PREFIX_OFFSET,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 317/917 parisc/unwind: fix unwinder when CONFIG_64BIT is enabled
In reply to Greg Kroah-HartmanFrom: Sven Schnelle <[email protected]>
[ Upstream commit 8e0ba125c2bf1030af3267058019ba86da96863f ]
With 64 bit kernels unwind_special() is not working because it compares the pc to the address of the function descriptor. Add a helper function that compares pc with the dereferenced address. This fixes all of the backtraces on my c8000. Without this changes, a lot of backtraces are missing in kdb or the show-all-tasks command from /proc/sysrq-trigger.
--- arch/parisc/kernel/unwind.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
arch/parisc/kernel/unwind.c +14 -7
@@ -21,6 +21,8 @@#include <asm/ptrace.h> #include <asm/unwind.h> +#include <asm/switch_to.h> +#include <asm/sections.h> /* #define DEBUG 1 */ #ifdef DEBUG
@@ -203,6 +205,11 @@ int __init unwind_init(void)return 0 ; } +static bool pc_is_kernel_fn (unsigned long pc,void *fn) +{ +return (unsigned long )dereference_kernel_function_descriptor (fn) == pc; +} +static int unwind_special (struct unwind_frame_info *info,unsigned long pc,int frame_size) {/*
@@ -221,7 +228,7 @@ static int unwind_special(struct unwind_frame_info *info, unsigned long pc, intextern void *const _call_on_stack;#endif /* CONFIG_IRQSTACKS */ -if (pc == (unsigned long ) &handle_interruption) { +if (pc_is_kernel_fn (pc, handle_interruption)) {struct pt_regs *regs = (struct pt_regs *)(info->sp - frame_size -PT_SZ_ALGN );dbg ("Unwinding through handle_interruption()\n" ); info->prev_sp = regs->gr[30 ];
@@ -229,13 +236,13 @@ static int unwind_special(struct unwind_frame_info *info, unsigned long pc, intreturn 1 ; } -if (pc == (unsigned long ) &ret_from_kernel_thread || - pc == (unsigned long ) &syscall_exit) { +if (pc_is_kernel_fn (pc, ret_from_kernel_thread) || +pc_is_kernel_fn (pc, syscall_exit)) { info->prev_sp = info->prev_ip =0 ;return 1 ; } -if (pc == (unsigned long ) &intr_return) { +if (pc_is_kernel_fn (pc, intr_return)) {struct pt_regs *regs;dbg ("Found intr_return()\n" );
@@ -246,20 +253,20 @@ static int unwind_special(struct unwind_frame_info *info, unsigned long pc, intreturn 1 ; } -if (pc == (unsigned long ) &_switch_to_ret) { +if (pc_is_kernel_fn (pc, _switch_to) || +pc_is_kernel_fn (pc, _switch_to_ret)) { info->prev_sp = info->sp -CALLEE_SAVE_FRAME_SIZE ; info->prev_ip = *(unsigned long *)(info->prev_sp -RP_OFFSET );return 1 ; }#ifdef CONFIG_IRQSTACKS -if (pc == (unsigned long ) &_call_on_stack) { +if (pc_is_kernel_fn (pc, _call_on_stack)) { info->prev_sp = *(unsigned long *)(info->sp -FRAME_SIZE -REG_SZ ); info->prev_ip = *(unsigned long *)(info->sp -FRAME_SIZE -RP_OFFSET );return 1 ; }#endif -return 0 ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 318/917 parisc/kgdb: add kgdb_roundup() to make kgdb work with idle polling
In reply to Greg Kroah-HartmanFrom: Sven Schnelle <[email protected]>
[ Upstream commit 66e29fcda1824f0427966fbee2bd2c85bf362c82 ]
With idle polling, IPIs are not sent when a CPU idle, but queued and run later from do_idle(). The default kgdb_call_nmi_hook() implementation gets the pointer to struct pt_regs from get_irq_reqs(), which doesn't work in that case because it was not called from the IPI interrupt handler. Fix it by defining our own kgdb_roundup() function which sents an IPI_ENTER_KGDB. When that IPI is received on the target CPU kgdb_nmicallback() is called.
--- arch/parisc/kernel/smp.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
arch/parisc/kernel/smp.c +17 -2
@@ -29,6 +29,7 @@#include <linux/bitops.h> #include <linux/ftrace.h> #include <linux/cpu.h> +#include <linux/kgdb.h> #include <linux/atomic.h> #include <asm/current.h>
@@ -69,7 +70,10 @@ enum ipi_message_type {IPI_CALL_FUNC ,IPI_CPU_START ,IPI_CPU_STOP , - IPI_CPU_TEST +IPI_CPU_TEST , +#ifdef CONFIG_KGDB + IPI_ENTER_KGDB, +#endif };
@@ -167,7 +171,12 @@ ipi_interrupt(int irq, void *dev_id)case IPI_CPU_TEST :smp_debug (100 ,KERN_DEBUG "CPU%d is alive!\n" , this_cpu);break ; - +#ifdef CONFIG_KGDB +case IPI_ENTER_KGDB : +smp_debug (100 ,KERN_DEBUG "CPU%d ENTER_KGDB\n" , this_cpu); +kgdb_nmicallback (raw_smp_processor_id (),get_irq_regs ()); +break ; +#endif default :printk (KERN_CRIT "Unknown IPI num on CPU%d: %lu\n" , this_cpu, which);
@@ -226,6 +235,12 @@ send_IPI_allbutself(enum ipi_message_type op) } } +#ifdef CONFIG_KGDB +void kgdb_roundup_cpus (void ) +{ +send_IPI_allbutself (IPI_ENTER_KGDB ); +} +#endif inline void smp_send_stop (void ) {send_IPI_allbutself (IPI_CPU_STOP ); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 319/917 netfilter: conntrack: set on IPS_ASSURED if flows enters internal stream state
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit b7b1d02fc43925a4d569ec221715db2dfa1ce4f5 ]
The internal stream state sets the timeout to 120 seconds 2 seconds after the creation of the flow, attach this internal stream state to the IPS_ASSURED flag for consistent event reporting.
Before this patch:
[NEW] udp 17 30 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 [UNREPLIED] src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [UPDATE] udp 17 30 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [UPDATE] udp 17 30 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [ASSURED] [DESTROY] udp 17 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [ASSURED]
Note IPS_ASSURED for the flow not yet in the internal stream state.
after this update:
[NEW] udp 17 30 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 [UNREPLIED] src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [UPDATE] udp 17 30 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [UPDATE] udp 17 120 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [ASSURED] [DESTROY] udp 17 src=10.246.11.13 dst=216.239.35.0 sport=37282 dport=123 src=216.239.35.0 dst=10.246.11.13 sport=123 dport=37282 [ASSURED]
Before this patch, short-lived UDP flows never entered IPS_ASSURED, so they were already candidate flow to be deleted by early_drop under stress.
Before this patch, IPS_ASSURED is set on regardless the internal stream state, attach this internal stream state to IPS_ASSURED.
packet #1 (original direction) enters NEW state
packet #2 (reply direction) enters ESTABLISHED state, sets on IPS_SEEN_REPLY paclet #3 (any direction) sets on IPS_ASSURED (if 2 seconds since the
creation has passed by).
--- net/netfilter/nf_conntrack_proto_udp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
net/netfilter/nf_conntrack_proto_udp.c +5 -2
@@ -104,10 +104,13 @@ int nf_conntrack_udp_packet(struct nf_conn *ct,*/ if (test_bit (IPS_SEEN_REPLY_BIT , &ct->status)) {unsigned long extra = timeouts[UDP_CT_UNREPLIED ]; +bool stream = false;/* Still active after two seconds? Extend timeout. */ -if (time_after (jiffies, ct->proto.udp.stream_ts)) +if (time_after (jiffies, ct->proto.udp.stream_ts)) { extra = timeouts[UDP_CT_REPLIED ]; + stream = true; + }nf_ct_refresh_acct (ct, ctinfo, skb, extra);
@@ -116,7 +119,7 @@ int nf_conntrack_udp_packet(struct nf_conn *ct,return NF_ACCEPT ;/* Also, more likely to be important, and not a probe */ -if (!test_and_set_bit (IPS_ASSURED_BIT , &ct->status)) +if (stream && !test_and_set_bit (IPS_ASSURED_BIT , &ct->status))nf_conntrack_event_cache (IPCT_ASSURED , ct); }else {nf_ct_refresh_acct (ct, ctinfo, skb, timeouts[UDP_CT_UNREPLIED ]);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 320/917 selftests/bpf: Fix strobemeta selftest regression
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 0133c20480b14820d43c37c0e9502da4bffcad3a ]
After most recent nightly Clang update strobemeta selftests started failing with the following error (relevant portion of assembly included):
1624: (85) call bpf_probe_read_user_str#114
1625: (bf) r1 = r0
1626: (18) r2 = 0xfffffffe
1628: (5f) r1 &= r2
1629: (55) if r1 != 0x0 goto pc+7
1630: (07) r9 += 104
1631: (6b) *(u16 *)(r9 +0) = r0
1632: (67) r0 <<= 32
1633: (77) r0 >>= 32
1634: (79) r1 = *(u64 *)(r10 -456)
1635: (0f) r1 += r0
1636: (7b) *(u64 *)(r10 -456) = r1
1637: (79) r1 = *(u64 *)(r10 -368)
1638: (c5) if r1 s< 0x1 goto pc+778
1639: (bf) r6 = r8
1640: (0f) r6 += r7
1641: (b4) w1 = 0
1642: (6b) *(u16 *)(r6 +108) = r1
1643: (79) r3 = *(u64 *)(r10 -352)
1644: (79) r9 = *(u64 *)(r10 -456)
1645: (bf) r1 = r9
1646: (b4) w2 = 1
1647: (85) call bpf_probe_read_user_str#114
R1 unbounded memory access, make sure to bounds check any such access
In the above code r0 and r1 are implicitly related. Clang knows that, but verifier isn't able to infer this relationship.
Yonghong Song narrowed down this "regression" in code generation to a recent Clang optimization change ([0]), which for BPF target generates code pattern that BPF verifier can't handle and loses track of register boundaries.
This patch works around the issue by adding an BPF assembly-based helper that helps to prove to the verifier that upper bound of the register is a given constant by controlling the exact share of generated BPF instruction sequence. This fixes the immediate issue for strobemeta selftest.
[0] https://github.com/llvm/llvm-project/commit/acabad9ff6bf13e00305d9d8621ee8eafc1f8b08
--- tools/testing/selftests/bpf/progs/strobemeta.h | 11 +++++++++++ 1 file changed, 11 insertions(+)
tools/testing/selftests/bpf/progs/strobemeta.h +11 -0
@@ -10,6 +10,14 @@#include <linux/types.h> #include <bpf/bpf_helpers.h> +#define bpf_clamp_umax (VAR ,UMAX ) \ + asm volatile ( \ + "if %0 <= %[max] goto +1\n" \ + "%0 = %[max]\n" \ + : "+r"(VAR) \ + : [max]"i"(UMAX) \ + ) +typedef uint32_t pid_t ;struct task_struct {};
@@ -413,6 +421,7 @@ static __always_inline void *read_map_var(struct strobemeta_cfg *cfg, len =bpf_probe_read_user_str (payload,STROBE_MAX_STR_LEN , map.tag);if (len <=STROBE_MAX_STR_LEN ) { +bpf_clamp_umax (len,STROBE_MAX_STR_LEN ); descr->tag_len = len; payload += len; }
@@ -430,6 +439,7 @@ static __always_inline void *read_map_var(struct strobemeta_cfg *cfg, len =bpf_probe_read_user_str (payload,STROBE_MAX_STR_LEN , map.entries[i].key);if (len <=STROBE_MAX_STR_LEN ) { +bpf_clamp_umax (len,STROBE_MAX_STR_LEN ); descr->key_lens[i] = len; payload += len; }
@@ -437,6 +447,7 @@ static __always_inline void *read_map_var(struct strobemeta_cfg *cfg, len =bpf_probe_read_user_str (payload,STROBE_MAX_STR_LEN , map.entries[i].val);if (len <=STROBE_MAX_STR_LEN ) { +bpf_clamp_umax (len,STROBE_MAX_STR_LEN ); descr->val_lens[i] = len; payload += len; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 321/917 fbdev/efifb: Release PCI devices runtime PM ref during FB destroy
In reply to Greg Kroah-HartmanFrom: Imre Deak <[email protected]>
[ Upstream commit 55285e21f04517939480966164a33898c34b2af2 ]
Atm the EFI FB platform driver gets a runtime PM reference for the associated GFX PCI device during probing the EFI FB platform device and releases it only when the platform device gets unbound.
When fbcon switches to the FB provided by the PCI device's driver (for instance i915/drmfb), the EFI FB will get only unregistered without the EFI FB platform device getting unbound, keeping the runtime PM reference acquired during the platform device probing. This reference will prevent the PCI driver from runtime suspending the device.
Fix this by releasing the RPM reference from the EFI FB's destroy hook, called when the FB gets unregistered.
While at it assert that pm_runtime_get_sync() didn't fail.
v2:
- Move pm_runtime_get_sync() before register_framebuffer() to avoid its race wrt. efifb_destroy()->pm_runtime_put(). (Daniel)
- Assert that pm_runtime_get_sync() didn't fail.
- Clarify commit message wrt. platform/PCI device/driver and driver removal vs. device unbinding.
--- drivers/video/fbdev/efifb.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/video/fbdev/efifb.c +14 -7
@@ -47,6 +47,8 @@ static bool use_bgrt = true;static bool request_mem_succeeded = false;static u64 mem_flags =EFI_MEMORY_WC |EFI_MEMORY_UC ; +static struct pci_dev *efifb_pci_dev;/* dev with BAR covering the efifb */ +static struct fb_var_screeninfo efifb_defined = { .activate =FB_ACTIVATE_NOW , .height =-1 ,
@@ -243,6 +245,9 @@ static inline void efifb_show_boot_graphics(struct fb_info *info) {}static void efifb_destroy (struct fb_info *info) { +if (efifb_pci_dev) +pm_runtime_put (&efifb_pci_dev->dev); +if (info->screen_base) {if (mem_flags & (EFI_MEMORY_UC |EFI_MEMORY_WC ))iounmap (info->screen_base);
@@ -333,7 +338,6 @@ ATTRIBUTE_GROUPS(efifb);static bool pci_dev_disabled;/* FB base matches BAR of a disabled device */ -static struct pci_dev *efifb_pci_dev;/* dev with BAR covering the efifb */ static struct resource *bar_resource;static u64 bar_offset;
@@ -569,17 +573,22 @@ static int efifb_probe(struct platform_device *dev)pr_err ("efifb: cannot allocate colormap\n" ); goto err_groups; } + +if (efifb_pci_dev) +WARN_ON (pm_runtime_get_sync (&efifb_pci_dev->dev) <0 ); + err =register_framebuffer (info);if (err <0 ) {pr_err ("efifb: cannot register framebuffer\n" ); - goto err_fb_dealoc; + goto err_put_rpm_ref; }fb_info (info,"%s frame buffer device\n" , info->fix.id); -if (efifb_pci_dev) -pm_runtime_get_sync (&efifb_pci_dev->dev);return 0 ; -err_fb_dealoc: +err_put_rpm_ref: +if (efifb_pci_dev) +pm_runtime_put (&efifb_pci_dev->dev); +fb_dealloc_cmap (&info->cmap); err_groups:sysfs_remove_groups (&dev->dev.kobj, efifb_groups);
@@ -603,8 +612,6 @@ static int efifb_remove(struct platform_device *pdev)unregister_framebuffer (info);sysfs_remove_groups (&pdev->dev.kobj, efifb_groups);framebuffer_release (info); -if (efifb_pci_dev) -pm_runtime_put (&efifb_pci_dev->dev);return 0 ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 322/917 drm/bridge: anx7625: Propagate errors from sp_tx_rst_aux()
In reply to Greg Kroah-HartmanFrom: Robert Foss <[email protected]>
[ Upstream commit 7f16d0f3b8e2d13f940e944cd17044ca8eeb8b32 ]
The return value of sp_tx_rst_aux() is not propagated, which means both compiler warnings and potential errors not being handled.
--- drivers/gpu/drm/bridge/analogix/anx7625.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/gpu/drm/bridge/analogix/anx7625.c +8 -4
@@ -720,7 +720,7 @@ static int edid_read(struct anx7625_data *ctx, ret =sp_tx_aux_rd (ctx,0xf1 );if (ret) { -sp_tx_rst_aux (ctx); + ret =sp_tx_rst_aux (ctx);DRM_DEV_DEBUG_DRIVER (dev,"edid read fail, reset!\n" ); }else { ret = anx7625_reg_block_read(ctx, ctx->i2c.rx_p0_client,
@@ -735,7 +735,7 @@ static int edid_read(struct anx7625_data *ctx,if (cnt >EDID_TRY_CNT )return -EIO ; -return 0 ; +return ret; } static int segments_edid_read(struct anx7625_data *ctx,
@@ -785,7 +785,7 @@ static int segments_edid_read(struct anx7625_data *ctx,if (cnt >EDID_TRY_CNT )return -EIO ; -return 0 ; +return ret; } static int sp_tx_edid_read(struct anx7625_data *ctx,
@@ -887,7 +887,11 @@ static int sp_tx_edid_read(struct anx7625_data *ctx, }/* Reset aux channel */ -sp_tx_rst_aux (ctx); + ret =sp_tx_rst_aux (ctx); +if (ret <0 ) { +DRM_DEV_ERROR (dev,"Failed to reset aux channel!\n" ); +return ret; + }return (blocks_num +1 ); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 323/917 perf/x86/intel/uncore: Fix Intel SPR CHA event constraints
In reply to Greg Kroah-HartmanFrom: Kan Liang <[email protected]>
[ Upstream commit 9d756e408e080d40e7916484b00c802026e6d1ad ]
SPR CHA events have the exact same event constraints as SKX, so add the constraints.
--- arch/x86/events/intel/uncore_snbep.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/events/intel/uncore_snbep.c +1 -0
@@ -5649,6 +5649,7 @@ static struct intel_uncore_type spr_uncore_chabox = { .event_mask = SPR_CHA_PMON_EVENT_MASK, .event_mask_ext = SPR_RAW_EVENT_MASK_EXT, .num_shared_regs = 1, + .constraints = skx_uncore_chabox_constraints, .ops = &spr_uncore_chabox_ops, .format_group = &spr_uncore_chabox_format_group, .attr_update = uncore_alias_groups,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 324/917 perf/x86/intel/uncore: Fix Intel SPR IIO event constraints
In reply to Greg Kroah-HartmanFrom: Kan Liang <[email protected]>
[ Upstream commit 67c5d44384f8dc57e1c1b3040423cfce99b578cd ]
SPR IIO events have the exact same event constraints as ICX, so add the constraints.
--- arch/x86/events/intel/uncore_snbep.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/events/intel/uncore_snbep.c +1 -0
@@ -5661,6 +5661,7 @@ static struct intel_uncore_type spr_uncore_iio = { .event_mask_ext = SNR_IIO_PMON_RAW_EVENT_MASK_EXT, .format_group = &snr_uncore_iio_format_group, .attr_update = uncore_alias_groups, + .constraints = icx_uncore_iio_constraints, };static struct attribute *spr_uncore_raw_formats_attr[] = {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 325/917 perf/x86/intel/uncore: Fix Intel SPR M2PCIE event constraints
In reply to Greg Kroah-HartmanFrom: Kan Liang <[email protected]>
[ Upstream commit f01d7d558e1855d4aa8e927b86111846536dd476 ]
Similar to the ICX M2PCIE events, some of the SPR M2PCIE events also have constraints. Add the constraints for SPR M2PCIE.
--- arch/x86/events/intel/uncore_snbep.c | 7 +++++++ 1 file changed, 7 insertions(+)
arch/x86/events/intel/uncore_snbep.c +7 -0
@@ -5690,9 +5690,16 @@ static struct intel_uncore_type spr_uncore_irp = { }; +static struct event_constraint spr_uncore_m2pcie_constraints[] = { +UNCORE_EVENT_CONSTRAINT (0x14 ,0x3 ), +UNCORE_EVENT_CONSTRAINT (0x2d ,0x3 ), +EVENT_CONSTRAINT_END +}; +static struct intel_uncore_type spr_uncore_m2pcie = {SPR_UNCORE_COMMON_FORMAT (), .name ="m2pcie" , + .constraints = spr_uncore_m2pcie_constraints, };static struct intel_uncore_type spr_uncore_pcu = {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 326/917 perf/x86/intel/uncore: Fix Intel SPR M3UPI event constraints
In reply to Greg Kroah-HartmanFrom: Kan Liang <[email protected]>
[ Upstream commit 4034fb207e302cc0b1f304084d379640c1fb1436 ]
SPR M3UPI have the exact same event constraints as ICX, so add the constraints.
--- arch/x86/events/intel/uncore_snbep.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/events/intel/uncore_snbep.c +1 -0
@@ -5776,6 +5776,7 @@ static struct intel_uncore_type spr_uncore_upi = {static struct intel_uncore_type spr_uncore_m3upi = {SPR_UNCORE_PCI_COMMON_FORMAT (), .name ="m3upi" , + .constraints = icx_uncore_m3upi_constraints, };static struct intel_uncore_type spr_uncore_mdf = {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 327/917 drm/bridge: it66121: Initialize {device,vendor}_ids
In reply to Greg Kroah-HartmanFrom: Paul Cercueil <[email protected]>
[ Upstream commit 3a5f3d61de657bc1c2b53b77d065c5526f982e10 ]
These two arrays are populated with data read from the I2C device through regmap_read(), and the data is then compared with hardcoded vendor/product ID values of supported chips.
However, the return value of regmap_read() was never checked. This is fine, as long as the two arrays are zero-initialized, so that we don't compare the vendor/product IDs against whatever garbage is left on the stack.
Address this issue by zero-initializing these two arrays.
--- drivers/gpu/drm/bridge/ite-it66121.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/ite-it66121.c +1 -1
@@ -889,7 +889,7 @@ unlock:static int it66121_probe (struct i2c_client *client,const struct i2c_device_id *id) { -u32 vendor_ids[2 ], device_ids[2 ], revision_id; +u32 revision_id, vendor_ids[2 ] = {0 }, device_ids[2 ] = {0 };struct device_node *ep;int ret;struct it66121_ctx *ctx;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 328/917 drm/bridge: it66121: Wait for next bridge to be probed
In reply to Greg Kroah-HartmanFrom: Paul Cercueil <[email protected]>
[ Upstream commit 8b03e3fc79189b17d31a82f5e175698802a11e87 ]
If run before the next bridge is initialized, of_drm_find_bridge() will give us a NULL pointer.
If that's the case, return -EPROBE_DEFER; we may have more luck next time.
--- drivers/gpu/drm/bridge/ite-it66121.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/bridge/ite-it66121.c +3 -0
@@ -924,6 +924,9 @@ static int it66121_probe(struct i2c_client *client, ctx->next_bridge =of_drm_find_bridge (ep);of_node_put (ep); +if (!ctx->next_bridge) +return -EPROBE_DEFER ; +i2c_set_clientdata (client, ctx);mutex_init (&ctx->lock);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 329/917 Bluetooth: fix init and cleanup of sco_conn.timeout_work
In reply to Greg Kroah-HartmanFrom: Desmond Cheong Zhi Xi <[email protected]>
[ Upstream commit 49d8a5606428ca0962d09050a5af81461ff90fbb ]
Before freeing struct sco_conn, all delayed timeout work should be cancelled. Otherwise, sco_sock_timeout could potentially use the sco_conn after it has been freed.
Additionally, sco_conn.timeout_work should be initialized when the connection is allocated, not when the channel is added. This is because an sco_conn can create channels with multiple sockets over its lifetime, which happens if sockets are released but the connection isn't deleted.
--- net/bluetooth/sco.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
net/bluetooth/sco.c +4 -5
@@ -133,6 +133,7 @@ static struct sco_conn *sco_conn_add(struct hci_conn *hcon)return NULL ;spin_lock_init (&conn->lock); +INIT_DELAYED_WORK (&conn->timeout_work, sco_sock_timeout); hcon->sco_data = conn; conn->hcon = hcon;
@@ -197,11 +198,11 @@ static void sco_conn_del(struct hci_conn *hcon, int err)sco_chan_del (sk, err);release_sock (sk);sock_put (sk); - -/* Ensure no more work items will run before freeing conn. */ -cancel_delayed_work_sync (&conn->timeout_work); } +/* Ensure no more work items will run before freeing conn. */ +cancel_delayed_work_sync (&conn->timeout_work); + hcon->sco_data =NULL ;kfree (conn); }
@@ -214,8 +215,6 @@ static void __sco_chan_add(struct sco_conn *conn, struct sock *sk,sco_pi (sk)->conn = conn; conn->sk = sk; -INIT_DELAYED_WORK (&conn->timeout_work, sco_sock_timeout); -if (parent)bt_accept_enqueue (parent, sk, true); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 330/917 libbpf: Dont crash on object files with no symbol tables
In reply to Greg Kroah-HartmanFrom: Toke Høiland-Jørgensen <[email protected]>
[ Upstream commit 03e601f48b2da6fb44d0f7b86957a8f6bacfb347 ]
If libbpf encounters an ELF file that has been stripped of its symbol table, it will crash in bpf_object__add_programs() when trying to dereference the obj->efile.symbols pointer.
Fix this by erroring out of bpf_object__elf_collect() if it is not able able to find the symbol table.
v2:
- Move check into bpf_object__elf_collect() and add nice error message
--- tools/lib/bpf/libbpf.c | 6 ++++++ 1 file changed, 6 insertions(+)
tools/lib/bpf/libbpf.c +6 -0
@@ -2993,6 +2993,12 @@ static int bpf_object__elf_collect(struct bpf_object *obj) } } +if (!obj->efile.symbols) { +pr_warn ("elf: couldn't find symbol table in %s, stripped object file?\n" , + obj->path); +return -ENOENT ; + } + scn =NULL ;while ((scn =elf_nextscn (elf, scn)) !=NULL ) { idx++;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 331/917 Bluetooth: hci_uart: fix GPF in h5_recv
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit 2fc7acb69fa3573d4bf7a90c323296d840daf330 ]
Syzbot hit general protection fault in h5_recv(). The problem was in missing NULL check.
hu->serdev can be NULL and we cannot blindly pass &serdev->dev somewhere, since it can cause GPF.
--- drivers/bluetooth/hci_h5.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/bluetooth/hci_h5.c +5 -3
@@ -587,9 +587,11 @@ static int h5_recv(struct hci_uart *hu, const void *data, int count) count -= processed; } -pm_runtime_get (&hu->serdev->dev); -pm_runtime_mark_last_busy (&hu->serdev->dev); -pm_runtime_put_autosuspend (&hu->serdev->dev); +if (hu->serdev) { +pm_runtime_get (&hu->serdev->dev); +pm_runtime_mark_last_busy (&hu->serdev->dev); +pm_runtime_put_autosuspend (&hu->serdev->dev); + }return 0 ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 332/917 rcu: Fix existing exp request check in sync_sched_exp_online_cleanup()
In reply to Greg Kroah-HartmanFrom: Neeraj Upadhyay <[email protected]>
[ Upstream commit f0b2b2df5423fb369ac762c77900bc7765496d58 ]
The sync_sched_exp_online_cleanup() checks to see if RCU needs an expedited quiescent state from the incoming CPU, sending it an IPI if so. Before sending IPI, it checks whether expedited qs need has been already requested for the incoming CPU, by checking rcu_data.cpu_no_qs.b.exp for the current cpu, on which sync_sched_exp_online_cleanup() is running. This works for the case where incoming CPU is same as self. However, for the case where incoming CPU is different from self, expedited request won't get marked, which can potentially delay reporting of expedited quiescent state for the incoming CPU.
--- kernel/rcu/tree_exp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/tree_exp.h +1 -1
@@ -760,7 +760,7 @@ static void sync_sched_exp_online_cleanup(int cpu) my_cpu =get_cpu ();/* Quiescent state either not needed or already requested, leave. */ if (!(READ_ONCE (rnp->expmask) & rdp->grpmask) || -__this_cpu_read (rcu_data.cpu_no_qs.b.exp)) { + rdp->cpu_no_qs.b.exp) {put_cpu ();return ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 333/917 MIPS: lantiq: dma: fix burst length for DEU
In reply to Greg Kroah-HartmanFrom: Aleksander Jan Bajkowski <[email protected]>
[ Upstream commit 5ad74d39c51dd41b3c819f4f5396655f0629b4fd ]
The current definition of 2W burst length is invalid. This patch fixes it. Current downstream DEU driver doesn't use DMA. An incorrect burst length value doesn't cause any errors. This patch also adds other burst length values.
--- arch/mips/lantiq/xway/dma.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
arch/mips/lantiq/xway/dma.c +7 -2
@@ -41,7 +41,11 @@#define DMA_IRQ_ACK 0x7e/* IRQ status register */ #define DMA_POLL BIT(31)/* turn on channel polling */ #define DMA_CLK_DIV4 BIT(6)/* polling clock divider */ -#define DMA_2W_BURST BIT(1)/* 2 word burst length */ +#define DMA_PCTRL_2W_BURST 0x1/* 2 word burst length */ +#define DMA_PCTRL_4W_BURST 0x2/* 4 word burst length */ +#define DMA_PCTRL_8W_BURST 0x3/* 8 word burst length */ +#define DMA_TX_BURST_SHIFT 4/* tx burst shift */ +#define DMA_RX_BURST_SHIFT 2/* rx burst shift */ #define DMA_ETOP_ENDIANNESS (0xf << 8)/* endianness swap etop channels */ #define DMA_WEIGHT (BIT(17) | BIT(16))/* default channel wheight */
@@ -192,7 +196,8 @@ ltq_dma_init_port(int p)break ;case DMA_PORT_DEU : -ltq_dma_w32 ((DMA_2W_BURST <<4 ) | (DMA_2W_BURST <<2 ), +ltq_dma_w32 ((DMA_PCTRL_2W_BURST <<DMA_TX_BURST_SHIFT ) | + (DMA_PCTRL_2W_BURST <<DMA_RX_BURST_SHIFT ),LTQ_DMA_PCTRL );break ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 334/917 x86/xen: Mark cpu_bringup_and_idle() as dead_end_function
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
[ Upstream commit 9af9dcf11bda3e2c0e24c1acaacb8685ad974e93 ]
The asm_cpu_bringup_and_idle() function is required to push the return value on the stack in order to make ORC happy, but the only reason objtool doesn't complain is because of a happy accident.
The thing is that asm_cpu_bringup_and_idle() doesn't return, so validate_branch() never terminates and falls through to the next function, which in the normal case is the hypercall_page. And that, as it happens, is 4095 NOPs and a RET.
Make asm_cpu_bringup_and_idle() terminate on it's own, by making the function it calls as a dead-end. This way we no longer rely on what code happens to come after.
--- tools/objtool/check.c | 1 + 1 file changed, 1 insertion(+)
tools/objtool/check.c +1 -0
@@ -173,6 +173,7 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func,"rewind_stack_do_exit" ,"kunit_try_catch_throw" ,"xen_start_kernel" , + "cpu_bringup_and_idle", };if (!func)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 335/917 objtool: Handle __sanitize_cov*() tail calls
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
[ Upstream commit f56dae88a81fded66adf2bea9922d1d98d1da14f ]
Turns out the compilers also generate tail calls to __sanitize_cov*(), make sure to also patch those out in noinstr code.
--- tools/objtool/arch/x86/decode.c | 20 ++++ tools/objtool/check.c | 158 ++++++++++++++------------- tools/objtool/include/objtool/arch.h | 1 + 3 files changed, 105 insertions(+), 74 deletions(-)
tools/objtool/arch/x86/decode.c +20 -0
@@ -659,6 +659,26 @@ const char *arch_nop_insn(int len)return nops[len-1 ]; } +#define BYTE_RET 0xC3 + +const char *arch_ret_insn (int len) +{ +static const char ret[5 ][5 ] = { + {BYTE_RET }, + {BYTE_RET ,BYTES_NOP1 }, + {BYTE_RET ,BYTES_NOP2 }, + {BYTE_RET ,BYTES_NOP3 }, + {BYTE_RET ,BYTES_NOP4 }, + }; + +if (len <1 || len >5 ) { +WARN ("invalid RET size: %d\n" , len); +return NULL ; + } + +return ret[len-1 ]; +} +/* asm/alternative.h ? */ #define ALTINSTR_FLAG_INV (1 << 15)
tools/objtool/check.c +84 -74
213 lines not on this page · raw message
tools/objtool/include/objtool/arch.h +1 -0
@@ -82,6 +82,7 @@ unsigned long arch_jump_destination(struct instruction *insn);unsigned long arch_dest_reloc_offset (int addend);const char *arch_nop_insn (int len); +const char *arch_ret_insn (int len);int arch_decode_hint_reg (struct instruction *insn,u8 sp_reg);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 336/917 net/mlx5: Publish and unpublish all devlink parameters at once
In reply to Greg Kroah-HartmanFrom: Leon Romanovsky <[email protected]>
[ Upstream commit e9310aed8e6a5003abb2aa6b9229d2fb9ceb9e85 ]
The devlink parameters were published in two steps despite being static and known in advance.
First step was to use devlink_params_publish() which iterated over all known up to that point parameters and sent notification messages. In second step, the call was devlink_param_publish() that looped over same parameters list and sent notification for new parameters.
In order to simplify the API, move devlink_params_publish() to be called when all parameters were already added and save the need to iterate over parameters list again.
As a side effect, this change fixes the error unwind flow in which parameters were not marked as unpublished.
--- drivers/net/ethernet/mellanox/mlx5/core/devlink.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/devlink.c +2 -8
@@ -625,7 +625,6 @@ static int mlx5_devlink_eth_param_register(struct devlink *devlink)devlink_param_driverinit_value_set (devlink,DEVLINK_PARAM_GENERIC_ID_ENABLE_ETH , value); -devlink_param_publish (devlink, &enable_eth_param);return 0 ; }
@@ -636,7 +635,6 @@ static void mlx5_devlink_eth_param_unregister(struct devlink *devlink)if (!mlx5_eth_supported (dev))return ; -devlink_param_unpublish (devlink, &enable_eth_param);devlink_param_unregister (devlink, &enable_eth_param); }
@@ -672,7 +670,6 @@ static int mlx5_devlink_rdma_param_register(struct devlink *devlink)devlink_param_driverinit_value_set (devlink,DEVLINK_PARAM_GENERIC_ID_ENABLE_RDMA , value); -devlink_param_publish (devlink, &enable_rdma_param);return 0 ; }
@@ -681,7 +678,6 @@ static void mlx5_devlink_rdma_param_unregister(struct devlink *devlink)if (!IS_ENABLED (CONFIG_MLX5_INFINIBAND ))return ; -devlink_param_unpublish (devlink, &enable_rdma_param);devlink_param_unregister (devlink, &enable_rdma_param); }
@@ -706,7 +702,6 @@ static int mlx5_devlink_vnet_param_register(struct devlink *devlink)devlink_param_driverinit_value_set (devlink,DEVLINK_PARAM_GENERIC_ID_ENABLE_VNET , value); -devlink_param_publish (devlink, &enable_rdma_param);return 0 ; }
@@ -717,7 +712,6 @@ static void mlx5_devlink_vnet_param_unregister(struct devlink *devlink)if (!mlx5_vnet_supported (dev))return ; -devlink_param_unpublish (devlink, &enable_vnet_param);devlink_param_unregister (devlink, &enable_vnet_param); }
@@ -808,7 +802,6 @@ int mlx5_devlink_register(struct devlink *devlink)if (err) goto params_reg_err;mlx5_devlink_set_params_init_values (devlink); -devlink_params_publish (devlink); err =mlx5_devlink_auxdev_params_register (devlink);if (err)
@@ -818,6 +811,7 @@ int mlx5_devlink_register(struct devlink *devlink)if (err) goto traps_reg_err; +devlink_params_publish (devlink);return 0 ; traps_reg_err:
@@ -832,9 +826,9 @@ params_reg_err:void mlx5_devlink_unregister (struct devlink *devlink) { +devlink_params_unpublish (devlink);mlx5_devlink_traps_unregister (devlink);mlx5_devlink_auxdev_params_unregister (devlink); -devlink_params_unpublish (devlink);devlink_params_unregister (devlink, mlx5_devlink_params,ARRAY_SIZE (mlx5_devlink_params));devlink_unregister (devlink);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 337/917 drm/v3d: fix wait for TMU write combiner flush
In reply to Greg Kroah-HartmanFrom: Iago Toral Quiroga <[email protected]>
[ Upstream commit e4f868191138975f2fdf2f37c11318b47db4acc9 ]
The hardware sets the TMUWCF bit back to 0 when the TMU write combiner flush completes so we should be checking for that instead of the L2TFLS bit.
v2 (Melissa Wen):
- Add Signed-off-by and Fixes tags.
- Change the error message for the timeout to be more clear.
Fixes spurious Vulkan CTS failures in:
dEQP-VK.binding_model.descriptorset_random.*
--- drivers/gpu/drm/v3d/v3d_gem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/v3d/v3d_gem.c +2 -2
@@ -197,8 +197,8 @@ v3d_clean_caches(struct v3d_dev *v3d)V3D_CORE_WRITE (core,V3D_CTL_L2TCACTL ,V3D_L2TCACTL_TMUWCF );if (wait_for (!(V3D_CORE_READ (core,V3D_CTL_L2TCACTL ) & -V3D_L2TCACTL_L2TFLS ),100 )) { -DRM_ERROR ("Timeout waiting for L1T write combiner flush\n" ); +V3D_L2TCACTL_TMUWCF ),100 )) { +DRM_ERROR ("Timeout waiting for TMU write combiner flush\n" ); }mutex_lock (&v3d->cache_clean_lock);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 338/917 crypto: sm4 - Do not change section of ck and sbox
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 4a7e1e5fc294687a8941fa3eeb4a7e8539ca5e2f ]
When building with clang and GNU as, there is a warning about ignored changed section attributes:
/tmp/sm4-c916c8.s: Assembler messages:/tmp/sm4-c916c8.s:677: Warning: ignoring changed section attributes for .data..cacheline_aligned
"static const" places the data in .rodata but __cacheline_aligned has the section attribute to place it in .data..cacheline_aligned, in addition to the aligned attribute.
To keep the alignment but avoid attempting to change sections, use the ____cacheline_aligned attribute, which is just the aligned attribute.
--- lib/crypto/sm4.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/crypto/sm4.c +2 -2
@@ -15,7 +15,7 @@ static const u32 fk[4] = {0xa3b1bac6 ,0x56aa3350 ,0x677d9197 ,0xb27022dc }; -static const u32 __cacheline_aligned ck[32] = { +static const u32 ____cacheline_aligned ck[32 ] = {0x00070e15 ,0x1c232a31 ,0x383f464d ,0x545b6269 ,0x70777e85 ,0x8c939aa1 ,0xa8afb6bd ,0xc4cbd2d9 , 0xe0e7eef5, 0xfc030a11, 0x181f262d, 0x343b4249,
@@ -26,7 +26,7 @@ static const u32 __cacheline_aligned ck[32] = {0x10171e25 ,0x2c333a41 ,0x484f565d ,0x646b7279 }; -static const u8 __cacheline_aligned sbox[256] = { +static const u8 ____cacheline_aligned sbox[256 ] = {0xd6 ,0x90 ,0xe9 ,0xfe ,0xcc ,0xe1 ,0x3d ,0xb7 ,0x16 ,0xb6 ,0x14 ,0xc2 ,0x28 ,0xfb ,0x2c ,0x05 , 0x2b, 0x67, 0x9a, 0x76, 0x2a, 0xbe, 0x04, 0xc3,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 339/917 virtio-gpu: fix possible memory allocation failure
In reply to Greg Kroah-HartmanFrom: liuyuntao <[email protected]>
[ Upstream commit 5bd4f20de8acad37dbb3154feb34dbc36d506c02 ]
When kmem_cache_zalloc in virtio_gpu_get_vbuf fails, it will return an error code. But none of its callers checks this error code, and a core dump will take place.
Considering many of its callers can't handle such error, I add a __GFP_NOFAIL flag when calling kmem_cache_zalloc to make sure it won't fail, and delete those unused error handlings.
--- drivers/gpu/drm/virtio/virtgpu_vq.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/gpu/drm/virtio/virtgpu_vq.c +1 -7
@@ -91,9 +91,7 @@ virtio_gpu_get_vbuf(struct virtio_gpu_device *vgdev, {struct virtio_gpu_vbuffer *vbuf; - vbuf =kmem_cache_zalloc (vgdev->vbufs,GFP_KERNEL ); -if (!vbuf) -return ERR_PTR (-ENOMEM ); + vbuf =kmem_cache_zalloc (vgdev->vbufs,GFP_KERNEL | __GFP_NOFAIL);BUG_ON (size >MAX_INLINE_CMD_SIZE || size <sizeof (struct virtio_gpu_ctrl_hdr ));
@@ -147,10 +145,6 @@ static void *virtio_gpu_alloc_cmd_resp(struct virtio_gpu_device *vgdev, vbuf =virtio_gpu_get_vbuf (vgdev, cmd_size, resp_size, resp_buf, cb); -if (IS_ERR (vbuf)) { - *vbuffer_p =NULL ; -return ERR_CAST (vbuf); - } *vbuffer_p = vbuf;return (struct virtio_gpu_command *)vbuf->buf; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 340/917 lockdep: Let lock_is_held_type() detect recursive read as read
In reply to Greg Kroah-HartmanFrom: Sebastian Andrzej Siewior <[email protected]>
[ Upstream commit 2507003a1d10917c9158077bf6030719d02c941e ]
lock_is_held_type(, 1) detects acquired read locks. It only recognized locks acquired with lock_acquire_shared(). Read locks acquired with lock_acquire_shared_recursive() are not recognized because a `2' is stored as the read value.
Rework the check to additionally recognise lock's read value one and two as a read held lock.
--- kernel/locking/lockdep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/locking/lockdep.c +1 -1
@@ -5366,7 +5366,7 @@ int __lock_is_held(const struct lockdep_map *lock, int read)struct held_lock *hlock = curr->held_locks + i;if (match_held_lock (hlock, lock)) { -if (read ==-1 || hlock->read == read) +if (read ==-1 || !!hlock->read == read)return LOCK_STATE_HELD ;return LOCK_STATE_NOT_HELD ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 341/917 net: net_namespace: Fix undefined member in key_remove_domain()
In reply to Greg Kroah-HartmanFrom: Yajun Deng <[email protected]>
[ Upstream commit aed0826b0cf2e488900ab92193893e803d65c070 ]
The key_domain member in struct net only exists if we define CONFIG_KEYS. So we should add the define when we used key_domain.
--- net/core/net_namespace.c | 4 ++++ 1 file changed, 4 insertions(+)
net/core/net_namespace.c +4 -0
@@ -473,7 +473,9 @@ struct net *copy_net_ns(unsigned long flags,if (rv <0 ) { put_userns: +#ifdef CONFIG_KEYS key_remove_domain (net->key_domain); +#endif put_user_ns (user_ns);net_free (net); dec_ucounts:
@@ -605,7 +607,9 @@ static void cleanup_net(struct work_struct *work)list_for_each_entry_safe (net, tmp, &net_exit_list, exit_list) {list_del_init (&net->exit_list);dec_net_namespaces (net->ucounts); +#ifdef CONFIG_KEYS key_remove_domain (net->key_domain); +#endif put_user_ns (net->user_ns);net_free (net); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 342/917 net: phylink: dont call netif_carrier_off() with NULL netdev
In reply to Greg Kroah-HartmanFrom: Russell King (Oracle) <[email protected]>
[ Upstream commit cbcca2e3961eac736566ac13ef0d0bf6f0b764ec ]
Dan Carpenter points out that we have a code path that permits a NULL netdev pointer to be passed to netif_carrier_off(), which will cause a kernel oops. In any case, we need to set pl->old_link_state to false to have the desired effect when there is no netdev present.
--- drivers/net/phy/phylink.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/phy/phylink.c +4 -1
@@ -1333,7 +1333,10 @@ void phylink_suspend(struct phylink *pl, bool mac_wol)* but one would hope all packets have been sent. This * also means phylink_resolve() will do nothing. */ -netif_carrier_off (pl->netdev); +if (pl->netdev) +netif_carrier_off (pl->netdev); +else + pl->old_link_state = false;/* We do not call mac_link_down() here as we want the * link to remain up to receive the WoL packets.
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 343/917 drm: bridge: it66121: Fix return value it66121_probe
In reply to Greg Kroah-HartmanFrom: Alex Bee <[email protected]>
[ Upstream commit f3bc07eba481942a246926c5b934199e7ccd567b ]
Currently it66121_probe returns -EPROBE_DEFER if the there is no remote endpoint found in the device tree which doesn't seem helpful, since this is not going to change later and it is never checked if the next bridge has been initialized yet. It will fail in that case later while doing drm_bridge_attach for the next bridge in it66121_bridge_attach.
Since the bindings documentation for it66121 bridge driver states there has to be a remote endpoint defined, its safe to return -EINVAL in that case.
This additonally adds a check, if the remote endpoint is enabled and returns -EPROBE_DEFER, if the remote bridge hasn't been initialized (yet).
--- drivers/gpu/drm/bridge/ite-it66121.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/ite-it66121.c +14 -2
@@ -918,11 +918,23 @@ static int it66121_probe(struct i2c_client *client,return -EINVAL ; ep =of_graph_get_remote_node (dev->of_node,1 ,-1 ); -if (!ep) -return -EPROBE_DEFER ; +if (!ep) { +dev_err (ctx->dev,"The endpoint is unconnected\n" ); +return -EINVAL ; + } + +if (!of_device_is_available (ep)) { +of_node_put (ep); +dev_err (ctx->dev,"The remote device is disabled\n" ); +return -ENODEV ; + } ctx->next_bridge =of_drm_find_bridge (ep);of_node_put (ep); +if (!ctx->next_bridge) { +dev_dbg (ctx->dev,"Next bridge not found, deferring probe\n" ); +return -EPROBE_DEFER ; + }if (!ctx->next_bridge)return -EPROBE_DEFER ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 344/917 spi: Fixed division by zero warning
In reply to Greg Kroah-HartmanFrom: Yoshitaka Ikeda <[email protected]>
[ Upstream commit 09134c5322df9f105d9ed324051872d5d0e162aa ]
The reason for dividing by zero is because the dummy bus width is zero, but if the dummy n bytes is zero, it indicates that there is no data transfer, so there is no need for calculation.
--- drivers/spi/atmel-quadspi.c | 2 +- drivers/spi/spi-bcm-qspi.c | 3 ++- drivers/spi/spi-mtk-nor.c | 2 +- drivers/spi/spi-stm32-qspi.c | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-)
drivers/spi/atmel-quadspi.c +1 -1
@@ -310,7 +310,7 @@ static int atmel_qspi_set_cfg(struct atmel_qspi *aq,return mode; ifr |= atmel_qspi_modes[mode].config; -if (op->dummy.buswidth && op->dummy.nbytes) +if (op->dummy.nbytes) dummy_cycles = op->dummy.nbytes *8 / op->dummy.buswidth;/*
drivers/spi/spi-bcm-qspi.c +2 -1
@@ -395,7 +395,8 @@ static int bcm_qspi_bspi_set_flex_mode(struct bcm_qspi *qspi,if (addrlen ==BSPI_ADDRLEN_4BYTES ) bpp =BSPI_BPP_ADDR_SELECT_MASK ; - bpp |= (op->dummy.nbytes *8 ) / op->dummy.buswidth; +if (op->dummy.nbytes) + bpp |= (op->dummy.nbytes *8 ) / op->dummy.buswidth;switch (width) {case SPI_NBITS_SINGLE :
drivers/spi/spi-mtk-nor.c +1 -1
@@ -160,7 +160,7 @@ static bool mtk_nor_match_read(const struct spi_mem_op *op) {int dummy =0 ; -if (op->dummy.buswidth) +if (op->dummy.nbytes) dummy = op->dummy.nbytes *BITS_PER_BYTE / op->dummy.buswidth;if ((op->data.buswidth ==2 ) || (op->data.buswidth ==4 )) {
drivers/spi/spi-stm32-qspi.c +1 -1
@@ -397,7 +397,7 @@ static int stm32_qspi_send(struct spi_mem *mem, const struct spi_mem_op *op) ccr |=FIELD_PREP (CCR_ADSIZE_MASK , op->addr.nbytes -1 ); } -if (op->dummy.buswidth && op->dummy.nbytes) +if (op->dummy.nbytes) ccr |=FIELD_PREP (CCR_DCYC_MASK , op->dummy.nbytes *8 / op->dummy.buswidth);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 345/917 cgroup: Make rebind_subsystems() disable v2 controllers all at once
In reply to Greg Kroah-HartmanFrom: Waiman Long <[email protected]>
[ Upstream commit 7ee285395b211cad474b2b989db52666e0430daf ]
It was found that the following warning was displayed when remounting controllers from cgroup v2 to v1:
[ 8042.997778] WARNING: CPU: 88 PID: 80682 at kernel/cgroup/cgroup.c:3130 cgroup_apply_control_disable+0x158/0x190 : [ 8043.091109] RIP: 0010:cgroup_apply_control_disable+0x158/0x190 [ 8043.096946] Code: ff f6 45 54 01 74 39 48 8d 7d 10 48 c7 c6 e0 46 5a a4 e8 7b 67 33 00 e9 41 ff ff ff 49 8b 84 24 e8 01 00 00 0f b7 40 08 eb 95 <0f> 0b e9 5f ff ff ff 48 83 c4 08 5b 5d 41 5c 41 5d 41 5e 41 5f c3 [ 8043.115692] RSP: 0018:ffffba8a47c23d28 EFLAGS: 00010202 [ 8043.120916] RAX: 0000000000000036 RBX: ffffffffa624ce40 RCX: 000000000000181a [ 8043.128047] RDX: ffffffffa63c43e0 RSI: ffffffffa63c43e0 RDI: ffff9d7284ee1000 [ 8043.135180] RBP: ffff9d72874c5800 R08: ffffffffa624b090 R09: 0000000000000004 [ 8043.142314] R10: ffffffffa624b080 R11: 0000000000002000 R12: ffff9d7284ee1000 [ 8043.149447] R13: ffff9d7284ee1000 R14: ffffffffa624ce70 R15: ffffffffa6269e20 [ 8043.156576] FS: 00007f7747cff740(0000) GS:ffff9d7a5fc00000(0000) knlGS:0000000000000000 [ 8043.164663] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 8043.170409] CR2: 00007f7747e96680 CR3: 0000000887d60001 CR4: 00000000007706e0 [ 8043.177539] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 8043.184673] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 8043.191804] PKRU: 55555554 [ 8043.194517] Call Trace: [ 8043.196970] rebind_subsystems+0x18c/0x470 [ 8043.201070] cgroup_setup_root+0x16c/0x2f0 [ 8043.205177] cgroup1_root_to_use+0x204/0x2a0 [ 8043.209456] cgroup1_get_tree+0x3e/0x120 [ 8043.213384] vfs_get_tree+0x22/0xb0 [ 8043.216883] do_new_mount+0x176/0x2d0 [ 8043.220550] __x64_sys_mount+0x103/0x140 [ 8043.224474] do_syscall_64+0x38/0x90 [ 8043.228063] entry_SYSCALL_64_after_hwframe+0x44/0xae
It was caused by the fact that rebind_subsystem() disables controllers to be rebound one by one. If more than one disabled controllers are originally from the default hierarchy, it means that cgroup_apply_control_disable() will be called multiple times for the same default hierarchy. A controller may be killed by css_kill() in the first round. In the second round, the killed controller may not be completely dead yet leading to the warning.
To avoid this problem, we collect all the ssid's of controllers that needed to be disabled from the default hierarchy and then disable them in one go instead of one by one.
--- kernel/cgroup/cgroup.c | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-)
kernel/cgroup/cgroup.c +27 -4
@@ -1740,6 +1740,7 @@ int rebind_subsystems(struct cgroup_root *dst_root, u16 ss_mask)struct cgroup *dcgrp = &dst_root->cgrp;struct cgroup_subsys *ss;int ssid, i, ret; +u16 dfl_disable_ss_mask =0 ;lockdep_assert_held (&cgroup_mutex);
@@ -1756,8 +1757,28 @@ int rebind_subsystems(struct cgroup_root *dst_root, u16 ss_mask)/* can't move between two non-dummy roots either */ if (ss->root != &cgrp_dfl_root && dst_root != &cgrp_dfl_root)return -EBUSY ; + +/* +* Collect ssid's that need to be disabled from default +* hierarchy. +*/ +if (ss->root == &cgrp_dfl_root) + dfl_disable_ss_mask |=1 << ssid; + }while_each_subsys_mask (); +if (dfl_disable_ss_mask) { +struct cgroup *scgrp = &cgrp_dfl_root.cgrp; + +/* +* Controllers from default hierarchy that need to be rebound +* are all disabled together in one go. +*/ + cgrp_dfl_root.subsys_mask &= ~dfl_disable_ss_mask; +WARN_ON (cgroup_apply_control (scgrp)); +cgroup_finalize_control (scgrp,0 ); + } + do_each_subsys_mask(ss, ssid, ss_mask) {struct cgroup_root *src_root = ss->root;struct cgroup *scgrp = &src_root->cgrp;
@@ -1766,10 +1787,12 @@ int rebind_subsystems(struct cgroup_root *dst_root, u16 ss_mask)WARN_ON (!css ||cgroup_css (dcgrp, ss)); -/* disable from the source */ - src_root->subsys_mask &= ~(1 << ssid); -WARN_ON (cgroup_apply_control (scgrp)); -cgroup_finalize_control (scgrp,0 ); +if (src_root != &cgrp_dfl_root) { +/* disable from the source */ + src_root->subsys_mask &= ~(1 << ssid); +WARN_ON (cgroup_apply_control (scgrp)); +cgroup_finalize_control (scgrp,0 ); + }/* rebind */ RCU_INIT_POINTER (scgrp->subsys[ssid],NULL );
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 346/917 wcn36xx: Fix Antenna Diversity Switching
In reply to Greg Kroah-HartmanFrom: Bryan O'Donoghue <[email protected]>
[ Upstream commit 701668d3bfa03dabc5095fc383d5315544ee5b31 ]
We have been tracking a strange bug with Antenna Diversity Switching (ADS) on wcn3680b for a while.
ADS is configured like this:
A. Via a firmware configuration table baked into the NV area.
1. Defines if ADS is enabled.
2. Defines which GPIOs are connected to which antenna enable pin.
3. Defines which antenna/GPIO is primary and which is secondary.
B. WCN36XX_CFG_VAL(ANTENNA_DIVERSITY, N)
N is a bitmask of available antenna.
Setting N to 3 indicates a bitmask of enabled antenna (1 | 2).
Obviously then we can set N to 1 or N to 2 to fix to a particular antenna and disable antenna diversity.
C. WCN36XX_CFG_VAL(ASD_PROBE_INTERVAL, XX)
XX is the number of beacons between each antenna RSSI check. Setting this value to 50 means, every 50 received beacons, run the ADS algorithm.
D. WCN36XX_CFG_VAL(ASD_TRIGGER_THRESHOLD, YY)
YY is a two's complement integer which specifies the RSSI decibel threshold below which ADS will run.
We default to -60db here, meaning a measured RSSI <= -60db will trigger an ADS probe.
E. WCN36XX_CFG_VAL(ASD_RTT_RSSI_HYST_THRESHOLD, Z)
Z is a hysteresis value, indicating a delta which the RSSI must exceed for the antenna switch to be valid.
For example if HYST_THRESHOLD == 3 AntennaId1-RSSI == -60db and AntennaId-2-RSSI == -58db then firmware will not switch antenna. The threshold needs to be -57db or better to satisfy the criteria.
F. A firmware feature bit also exists ANTENNA_DIVERSITY_SELECTION.
This feature bit is used by the firmware to report if ANTENNA_DIVERSITY_SELECTION is supported. The host is not required to toggle this bit to enable or disable ADS.
ADS works like this:
A. Every XX beacons the firmware switches to or remains on the primary
antenna.
B. The firmware then sends a Request-To-Send (RTS) packet to the AP.
C. The firmware waits for a Clear-To-Send (CTS) response from the AP.
D. The firmware then notes the received RSSI on the CTS packet.
E. The firmware then repeats steps A-D on the secondary antenna.
F. Subsequently if the RSSI on the measured antenna is better than
ASD_TRIGGER_THRESHOLD + the active antenna's RSSI then the measured antenna becomes the active antenna.
G. If RSSI rises past ASD_TRIGGER_THRESHOLD then ADS doesn't run at
all even if there is a substantially better RSSI on the alternative antenna.
What we have been observing is that the RTS packet is being sent but the MAC address is a byte-swapped version of the target MAC. The ADS/RTS MAC is corrupted only when the link is encrypted, if the AP is open the RTS MAC is correct. Similarly if we configure the firmware to an RTS/CTS sequence for regular data - the transmitted RTS MAC is correctly formatted.
Internally the wcn36xx firmware uses the indexes in the SMD commands to populate and extract data from specific entries in an STA lookup table. The AP's MAC appears a number of times in different indexes within this lookup table, so the MAC address extracted for the data-transmit RTS and the MAC address extracted for the ADS/RTS packet are not the same STA table index.
Our analysis indicates the relevant firmware STA table index is "bssSelfStaIdx".
There is an STA populate function responsible for formatting the MAC address of the bssSelfStaIdx including byte-swapping the MAC address.
Its clear then that the required STA populate command did not run for bssSelfStaIdx.
So taking a look at the sequence of SMD commands sent to the firmware we see the following downstream when moving from an unencrypted to encrypted BSS setup.
- WLAN_HAL_CONFIG_BSS_REQ
- WLAN_HAL_CONFIG_STA_REQ
- WLAN_HAL_SET_STAKEY_REQ
Upstream in wcn36xx we have
- WLAN_HAL_CONFIG_BSS_REQ
- WLAN_HAL_SET_STAKEY_REQ
The solution then is to add the missing WLAN_HAL_CONFIG_STA_REQ between WLAN_HAL_CONFIG_BSS_REQ and WLAN_HAL_SET_STAKEY_REQ.
No surprise WLAN_HAL_CONFIG_STA_REQ is the routine responsible for populating the STA lookup table in the firmware and once done the MAC sent by the ADS routine is in the correct byte-order.
This bug is apparent with ADS but it is also the case that any other firmware routine that depends on the "bssSelfStaIdx" would retrieve malformed data on an encrypted link.
--- drivers/net/wireless/ath/wcn36xx/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/wcn36xx/main.c +3 -1
@@ -571,12 +571,14 @@ static int wcn36xx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,if (IEEE80211_KEY_FLAG_PAIRWISE & key_conf->flags) { sta_priv->is_data_encrypted = true;/* Reconfigure bss with encrypt_type */ -if (NL80211_IFTYPE_STATION == vif->type) +if (NL80211_IFTYPE_STATION == vif->type) {wcn36xx_smd_config_bss (wcn, vif, sta, sta->addr, true); +wcn36xx_smd_config_sta (wcn, vif, sta); + } wcn36xx_smd_set_stakey(wcn, vif_priv->encrypt_type,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 347/917 wilc1000: fix possible memory leak in cfg_scan_result()
In reply to Greg Kroah-HartmanFrom: Ajay Singh <[email protected]>
[ Upstream commit 3c719fed0f3a5e95b1d164609ecc81c4191ade70 ]
When the BSS reference holds a valid reference, it is not freed. The 'if' condition is wrong. Instead of the 'if (bss)' check, the 'if (!bss)' check is used.
The issue is solved by removing the unnecessary 'if' check because cfg80211_put_bss() already performs the NULL validation.
--- drivers/net/wireless/microchip/wilc1000/cfg80211.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/microchip/wilc1000/cfg80211.c +1 -2
@@ -129,8 +129,7 @@ static void cfg_scan_result(enum scan_event scan_event, info->frame_len, (s32 )info->rssi *100 , GFP_KERNEL); -if (!bss) -cfg80211_put_bss (wiphy, bss); +cfg80211_put_bss (wiphy, bss); }else if (scan_event ==SCAN_EVENT_DONE ) {mutex_lock (&priv->scan_req_lock);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 348/917 Bluetooth: btmtkuart: fix a memleak in mtk_hci_wmt_sync
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit 3e5f2d90c28f9454e421108554707620bc23269d ]
bdev->evt_skb will get freed in the normal path and one error path of mtk_hci_wmt_sync, while the other error paths do not free it, which may cause a memleak. This bug is suggested by a static analysis tool, please advise.
--- drivers/bluetooth/btmtkuart.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/bluetooth/btmtkuart.c +8 -5
@@ -158,8 +158,10 @@ static int mtk_hci_wmt_sync(struct hci_dev *hdev,int err; hlen =sizeof (*hdr) + wmt_params->dlen; -if (hlen >255 ) -return -EINVAL ; +if (hlen >255 ) { + err = -EINVAL ; + goto err_free_skb; + } hdr = (struct mtk_wmt_hdr *)&wc; hdr->dir =1 ;
@@ -173,7 +175,7 @@ static int mtk_hci_wmt_sync(struct hci_dev *hdev, err =__hci_cmd_send (hdev,0xfc6f , hlen, &wc);if (err <0 ) {clear_bit (BTMTKUART_TX_WAIT_VND_EVT , &bdev->tx_state); -return err; + goto err_free_skb; }/* The vendor specific WMT commands are all answered by a vendor
@@ -190,13 +192,14 @@ static int mtk_hci_wmt_sync(struct hci_dev *hdev,if (err == -EINTR ) {bt_dev_err (hdev,"Execution of wmt command interrupted" );clear_bit (BTMTKUART_TX_WAIT_VND_EVT , &bdev->tx_state); -return err; + goto err_free_skb; }if (err) {bt_dev_err (hdev,"Execution of wmt command timed out" );clear_bit (BTMTKUART_TX_WAIT_VND_EVT , &bdev->tx_state); -return -ETIMEDOUT ; + err = -ETIMEDOUT ; + goto err_free_skb; }/* Parse and handle the return WMT event */
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 349/917 drm/amdgpu: Fix crash on device remove/driver unload
In reply to Greg Kroah-HartmanFrom: Andrey Grodzovsky <[email protected]>
[ Upstream commit d82e2c249c8ffaec20fa618611ea2ab4dcfd4d01 ]
Crash:
BUG: unable to handle page fault for address: 00000000000010e1 RIP: 0010:vega10_power_gate_vce+0x26/0x50 [amdgpu] Call Trace: pp_set_powergating_by_smu+0x16a/0x2b0 [amdgpu] amdgpu_dpm_set_powergating_by_smu+0x92/0xf0 [amdgpu] amdgpu_dpm_enable_vce+0x2e/0xc0 [amdgpu] vce_v4_0_hw_fini+0x95/0xa0 [amdgpu] amdgpu_device_fini_hw+0x232/0x30d [amdgpu] amdgpu_driver_unload_kms+0x5c/0x80 [amdgpu] amdgpu_pci_remove+0x27/0x40 [amdgpu] pci_device_remove+0x3e/0xb0 device_release_driver_internal+0x103/0x1d0 device_release_driver+0x12/0x20 pci_stop_bus_device+0x79/0xa0 pci_stop_and_remove_bus_device_locked+0x1b/0x30 remove_store+0x7b/0x90 dev_attr_store+0x17/0x30 sysfs_kf_write+0x4b/0x60 kernfs_fop_write_iter+0x151/0x1e0
Why:
VCE/UVD had dependency on SMC block for their suspend but SMC block is the first to do HW fini due to some constraints
How:
Since the original patch was dealing with suspend issues move the SMC block dependency back into suspend hooks as was done in V1 of the original patches.
Keep flushing idle work both in suspend and HW fini seuqnces since it's essential in both cases.
--- drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c | 24 ++++++++------- drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c | 24 ++++++++------- drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c | 24 ++++++++------- drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c | 32 ++++++++++--------- drivers/gpu/drm/amd/amdgpu/vce_v2_0.c | 19 +++++++----- drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 28 +++++++++-------- drivers/gpu/drm/amd/amdgpu/vce_v4_0.c | 44 ++++++++++++++------------- 7 files changed, 105 insertions(+), 90 deletions(-)
drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c +13 -11
@@ -698,6 +698,19 @@ static int uvd_v3_1_hw_fini(void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle; +cancel_delayed_work_sync (&adev->uvd.idle_work); + +if (RREG32 (mmUVD_STATUS) !=0 ) +uvd_v3_1_stop (adev); + +return 0 ; +} + +static int uvd_v3_1_suspend (void *handle) +{ +int r; +struct amdgpu_device *adev = (struct amdgpu_device *)handle; +/* * Proper cleanups before halting the HW engine: * - cancel the delayed idle work
@@ -722,17 +735,6 @@ static int uvd_v3_1_hw_fini(void *handle) AMD_CG_STATE_GATE); } -if (RREG32 (mmUVD_STATUS) !=0 ) -uvd_v3_1_stop (adev); - -return 0 ; -} - -static int uvd_v3_1_suspend (void *handle) -{ -int r; -struct amdgpu_device *adev = (struct amdgpu_device *)handle; - r =uvd_v3_1_hw_fini (adev);if (r)return r;
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +13 -11
@@ -212,6 +212,19 @@ static int uvd_v4_2_hw_fini(void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle; +cancel_delayed_work_sync (&adev->uvd.idle_work); + +if (RREG32 (mmUVD_STATUS) !=0 ) +uvd_v4_2_stop (adev); + +return 0 ; +} + +static int uvd_v4_2_suspend (void *handle) +{ +int r; +struct amdgpu_device *adev = (struct amdgpu_device *)handle; +/* * Proper cleanups before halting the HW engine: * - cancel the delayed idle work
@@ -236,17 +249,6 @@ static int uvd_v4_2_hw_fini(void *handle) AMD_CG_STATE_GATE); } -if (RREG32 (mmUVD_STATUS) !=0 ) -uvd_v4_2_stop (adev); - -return 0 ; -} - -static int uvd_v4_2_suspend (void *handle) -{ -int r; -struct amdgpu_device *adev = (struct amdgpu_device *)handle; - r =uvd_v4_2_hw_fini (adev);if (r)return r;
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +13 -11
@@ -210,6 +210,19 @@ static int uvd_v5_0_hw_fini(void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle; +cancel_delayed_work_sync (&adev->uvd.idle_work); + +if (RREG32 (mmUVD_STATUS) !=0 ) +uvd_v5_0_stop (adev); + +return 0 ; +} + +static int uvd_v5_0_suspend (void *handle) +{ +int r; +struct amdgpu_device *adev = (struct amdgpu_device *)handle; +/* * Proper cleanups before halting the HW engine: * - cancel the delayed idle work
@@ -234,17 +247,6 @@ static int uvd_v5_0_hw_fini(void *handle) AMD_CG_STATE_GATE); } -if (RREG32 (mmUVD_STATUS) !=0 ) -uvd_v5_0_stop (adev); - -return 0 ; -} - -static int uvd_v5_0_suspend (void *handle) -{ -int r; -struct amdgpu_device *adev = (struct amdgpu_device *)handle; - r =uvd_v5_0_hw_fini (adev);if (r)return r;
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +17 -15
@@ -606,6 +606,23 @@ static int uvd_v7_0_hw_fini(void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle; +cancel_delayed_work_sync (&adev->uvd.idle_work); + +if (!amdgpu_sriov_vf (adev)) +uvd_v7_0_stop (adev); +else { +/* full access mode, so don't touch any UVD register */ +DRM_DEBUG ("For SRIOV client, shouldn't do anything.\n" ); + } + +return 0 ; +} + +static int uvd_v7_0_suspend (void *handle) +{ +int r; +struct amdgpu_device *adev = (struct amdgpu_device *)handle; +/* * Proper cleanups before halting the HW engine: * - cancel the delayed idle work
@@ -630,21 +647,6 @@ static int uvd_v7_0_hw_fini(void *handle) AMD_CG_STATE_GATE); } -if (!amdgpu_sriov_vf (adev)) -uvd_v7_0_stop (adev); -else { -/* full access mode, so don't touch any UVD register */ -DRM_DEBUG ("For SRIOV client, shouldn't do anything.\n" ); - } - -return 0 ; -} - -static int uvd_v7_0_suspend (void *handle) -{ -int r; -struct amdgpu_device *adev = (struct amdgpu_device *)handle; - r =uvd_v7_0_hw_fini (adev);if (r)return r;
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +11 -8
@@ -479,6 +479,17 @@ static int vce_v2_0_hw_fini(void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle; +cancel_delayed_work_sync (&adev->vce.idle_work); + +return 0 ; +} + +static int vce_v2_0_suspend (void *handle) +{ +int r; +struct amdgpu_device *adev = (struct amdgpu_device *)handle; + +/* * Proper cleanups before halting the HW engine: * - cancel the delayed idle work
@@ -502,14 +513,6 @@ static int vce_v2_0_hw_fini(void *handle) AMD_CG_STATE_GATE); } -return 0 ; -} - -static int vce_v2_0_suspend (void *handle) -{ -int r; -struct amdgpu_device *adev = (struct amdgpu_device *)handle; - r =vce_v2_0_hw_fini (adev);if (r)return r;
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +15 -13
@@ -490,6 +490,21 @@ static int vce_v3_0_hw_fini(void *handle)int r;struct amdgpu_device *adev = (struct amdgpu_device *)handle; +cancel_delayed_work_sync (&adev->vce.idle_work); + + r =vce_v3_0_wait_for_idle (handle); +if (r) +return r; + +vce_v3_0_stop (adev); +return vce_v3_0_set_clockgating_state (adev,AMD_CG_STATE_GATE ); +} + +static int vce_v3_0_suspend (void *handle) +{ +int r; +struct amdgpu_device *adev = (struct amdgpu_device *)handle; +/* * Proper cleanups before halting the HW engine: * - cancel the delayed idle work
@@ -513,19 +528,6 @@ static int vce_v3_0_hw_fini(void *handle) AMD_CG_STATE_GATE); } - r =vce_v3_0_wait_for_idle (handle); -if (r) -return r; - -vce_v3_0_stop (adev); -return vce_v3_0_set_clockgating_state (adev,AMD_CG_STATE_GATE ); -} - -static int vce_v3_0_suspend (void *handle) -{ -int r; -struct amdgpu_device *adev = (struct amdgpu_device *)handle; - r =vce_v3_0_hw_fini (adev);if (r)return r;
drivers/gpu/drm/amd/amdgpu/vce_v4_0.c +23 -21
58 lines not on this page · raw message
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 350/917 drm/amd/display: Pass display_pipe_params_st as const in DML
In reply to Greg Kroah-HartmanFrom: Harry Wentland <[email protected]>
[ Upstream commit 22667e6ec6b2ce9ca706e9061660b059725d009c ]
[Why]
This neither needs to be on the stack nor passed by value to each function call. In fact, when building with clang it seems to break the Linux's default 1024 byte stack frame limit.
[How]
We can simply pass this as a const pointer.
This patch fixes these Coverity IDs
Addresses-Coverity-ID: 1424031: ("Big parameter passed by value")
Addresses-Coverity-ID: 1423970: ("Big parameter passed by value")
Addresses-Coverity-ID: 1423941: ("Big parameter passed by value")
Addresses-Coverity-ID: 1451742: ("Big parameter passed by value")
Addresses-Coverity-ID: 1451887: ("Big parameter passed by value")
Addresses-Coverity-ID: 1454146: ("Big parameter passed by value")
Addresses-Coverity-ID: 1454152: ("Big parameter passed by value")
Addresses-Coverity-ID: 1454413: ("Big parameter passed by value")
Addresses-Coverity-ID: 1466144: ("Big parameter passed by value")
Addresses-Coverity-ID: 1487237: ("Big parameter passed by value")
--- .../drm/amd/display/dc/dcn20/dcn20_resource.c | 2 +- .../dc/dml/dcn20/display_rq_dlg_calc_20.c | 6 +- .../dc/dml/dcn20/display_rq_dlg_calc_20.h | 4 +- .../dc/dml/dcn20/display_rq_dlg_calc_20v2.c | 6 +- .../dc/dml/dcn20/display_rq_dlg_calc_20v2.h | 4 +- .../dc/dml/dcn21/display_rq_dlg_calc_21.c | 62 ++++++++-------- .../dc/dml/dcn21/display_rq_dlg_calc_21.h | 4 +- .../dc/dml/dcn30/display_rq_dlg_calc_30.c | 72 +++++++++---------- .../dc/dml/dcn30/display_rq_dlg_calc_30.h | 4 +- .../dc/dml/dcn31/display_rq_dlg_calc_31.c | 68 +++++++++--------- .../dc/dml/dcn31/display_rq_dlg_calc_31.h | 4 +- .../drm/amd/display/dc/dml/display_mode_lib.h | 4 +- 12 files changed, 120 insertions(+), 120 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +1 -1
@@ -3152,7 +3152,7 @@ void dcn20_calculate_dlg_params( context->bw_ctx.dml.funcs.rq_dlg_get_rq_reg (&context->bw_ctx.dml, &context->res_ctx.pipe_ctx[i].rq_regs, - pipes[pipe_idx].pipe); + &pipes[pipe_idx].pipe); pipe_idx++; } }
drivers/gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20.c +3 -3
@@ -768,12 +768,12 @@ static void dml20_rq_dlg_get_rq_params(struct display_mode_lib *mode_lib,void dml20_rq_dlg_get_rq_reg (struct display_mode_lib *mode_lib,display_rq_regs_st *rq_regs, -const display_pipe_params_st pipe_param) +const display_pipe_params_st *pipe_param) {display_rq_params_st rq_param = {0 };memset (rq_regs,0 ,sizeof (*rq_regs)); -dml20_rq_dlg_get_rq_params (mode_lib, &rq_param, pipe_param.src); +dml20_rq_dlg_get_rq_params (mode_lib, &rq_param, pipe_param->src);extract_rq_regs (mode_lib, rq_regs, rq_param);print__rq_regs_st (mode_lib, *rq_regs);
@@ -1549,7 +1549,7 @@ static void dml20_rq_dlg_get_dlg_params(struct display_mode_lib *mode_lib, void dml20_rq_dlg_get_dlg_reg(struct display_mode_lib *mode_lib, display_dlg_regs_st *dlg_regs, display_ttu_regs_st *ttu_regs, - display_e2e_pipe_params_st *e2e_pipe_param, + const display_e2e_pipe_params_st *e2e_pipe_param, const unsigned int num_pipes, const unsigned int pipe_idx, const bool cstate_en,
drivers/gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20.h +2 -2
@@ -43,7 +43,7 @@ struct display_mode_lib;void dml20_rq_dlg_get_rq_reg (struct display_mode_lib *mode_lib,display_rq_regs_st *rq_regs, -const display_pipe_params_st pipe_param); +const display_pipe_params_st *pipe_param);// Function: dml_rq_dlg_get_dlg_reg
@@ -61,7 +61,7 @@ void dml20_rq_dlg_get_dlg_reg(struct display_mode_lib *mode_lib, display_dlg_regs_st *dlg_regs, display_ttu_regs_st *ttu_regs, - display_e2e_pipe_params_st *e2e_pipe_param, + const display_e2e_pipe_params_st *e2e_pipe_param, const unsigned int num_pipes, const unsigned int pipe_idx, const bool cstate_en,
drivers/gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20v2.c +3 -3
@@ -768,12 +768,12 @@ static void dml20v2_rq_dlg_get_rq_params(struct display_mode_lib *mode_lib,void dml20v2_rq_dlg_get_rq_reg (struct display_mode_lib *mode_lib,display_rq_regs_st *rq_regs, -const display_pipe_params_st pipe_param) +const display_pipe_params_st *pipe_param) {display_rq_params_st rq_param = {0 };memset (rq_regs,0 ,sizeof (*rq_regs)); -dml20v2_rq_dlg_get_rq_params (mode_lib, &rq_param, pipe_param.src); +dml20v2_rq_dlg_get_rq_params (mode_lib, &rq_param, pipe_param->src);extract_rq_regs (mode_lib, rq_regs, rq_param);print__rq_regs_st (mode_lib, *rq_regs);
@@ -1550,7 +1550,7 @@ static void dml20v2_rq_dlg_get_dlg_params(struct display_mode_lib *mode_lib, void dml20v2_rq_dlg_get_dlg_reg(struct display_mode_lib *mode_lib, display_dlg_regs_st *dlg_regs, display_ttu_regs_st *ttu_regs, - display_e2e_pipe_params_st *e2e_pipe_param, + const display_e2e_pipe_params_st *e2e_pipe_param, const unsigned int num_pipes, const unsigned int pipe_idx, const bool cstate_en,
drivers/gpu/drm/amd/display/dc/dml/dcn20/display_rq_dlg_calc_20v2.h +2 -2
@@ -43,7 +43,7 @@ struct display_mode_lib;void dml20v2_rq_dlg_get_rq_reg (struct display_mode_lib *mode_lib,display_rq_regs_st *rq_regs, -const display_pipe_params_st pipe_param); +const display_pipe_params_st *pipe_param);// Function: dml_rq_dlg_get_dlg_reg
@@ -61,7 +61,7 @@ void dml20v2_rq_dlg_get_dlg_reg(struct display_mode_lib *mode_lib, display_dlg_regs_st *dlg_regs, display_ttu_regs_st *ttu_regs, - display_e2e_pipe_params_st *e2e_pipe_param, + const display_e2e_pipe_params_st *e2e_pipe_param, const unsigned int num_pipes, const unsigned int pipe_idx, const bool cstate_en,
drivers/gpu/drm/amd/display/dc/dml/dcn21/display_rq_dlg_calc_21.c +31 -31
133 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml/dcn21/display_rq_dlg_calc_21.h +2 -2
@@ -44,7 +44,7 @@ struct display_mode_lib;void dml21_rq_dlg_get_rq_reg (struct display_mode_lib *mode_lib,display_rq_regs_st *rq_regs, -const display_pipe_params_st pipe_param); +const display_pipe_params_st *pipe_param);// Function: dml_rq_dlg_get_dlg_reg // Calculate and return DLG and TTU register struct given the system setting
@@ -61,7 +61,7 @@ void dml21_rq_dlg_get_dlg_reg(struct display_mode_lib *mode_lib, display_dlg_regs_st *dlg_regs, display_ttu_regs_st *ttu_regs, - display_e2e_pipe_params_st *e2e_pipe_param, + const display_e2e_pipe_params_st *e2e_pipe_param, const unsigned int num_pipes, const unsigned int pipe_idx, const bool cstate_en,
drivers/gpu/drm/amd/display/dc/dml/dcn30/display_rq_dlg_calc_30.c +36 -36
144 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml/dcn30/display_rq_dlg_calc_30.h +2 -2
@@ -41,7 +41,7 @@ struct display_mode_lib;// See also: <display_rq_regs_st> void dml30_rq_dlg_get_rq_reg (struct display_mode_lib *mode_lib,display_rq_regs_st *rq_regs, -const display_pipe_params_st pipe_param); +const display_pipe_params_st *pipe_param);// Function: dml_rq_dlg_get_dlg_reg // Calculate and return DLG and TTU register struct given the system setting
@@ -57,7 +57,7 @@ void dml30_rq_dlg_get_rq_reg(struct display_mode_lib *mode_lib, void dml30_rq_dlg_get_dlg_reg(struct display_mode_lib *mode_lib, display_dlg_regs_st *dlg_regs, display_ttu_regs_st *ttu_regs, - display_e2e_pipe_params_st *e2e_pipe_param, + const display_e2e_pipe_params_st *e2e_pipe_param, const unsigned int num_pipes, const unsigned int pipe_idx, const bool cstate_en,
drivers/gpu/drm/amd/display/dc/dml/dcn31/display_rq_dlg_calc_31.c +34 -34
133 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dml/dcn31/display_rq_dlg_calc_31.h +2 -2
@@ -41,7 +41,7 @@ struct display_mode_lib;// See also: <display_rq_regs_st> void dml31_rq_dlg_get_rq_reg (struct display_mode_lib *mode_lib,display_rq_regs_st *rq_regs, -const display_pipe_params_st pipe_param); +const display_pipe_params_st *pipe_param);// Function: dml_rq_dlg_get_dlg_reg // Calculate and return DLG and TTU register struct given the system setting
@@ -57,7 +57,7 @@ void dml31_rq_dlg_get_rq_reg(struct display_mode_lib *mode_lib, void dml31_rq_dlg_get_dlg_reg(struct display_mode_lib *mode_lib, display_dlg_regs_st *dlg_regs, display_ttu_regs_st *ttu_regs, - display_e2e_pipe_params_st *e2e_pipe_param, + const display_e2e_pipe_params_st *e2e_pipe_param, const unsigned int num_pipes, const unsigned int pipe_idx, const bool cstate_en,
drivers/gpu/drm/amd/display/dc/dml/display_mode_lib.h +2 -2
@@ -49,7 +49,7 @@ struct dml_funcs {struct display_mode_lib *mode_lib, display_dlg_regs_st *dlg_regs, display_ttu_regs_st *ttu_regs, - display_e2e_pipe_params_st *e2e_pipe_param, + const display_e2e_pipe_params_st *e2e_pipe_param, const unsigned int num_pipes, const unsigned int pipe_idx, const bool cstate_en,
@@ -60,7 +60,7 @@ struct dml_funcs {void (*rq_dlg_get_rq_reg)(struct display_mode_lib *mode_lib,display_rq_regs_st *rq_regs, -const display_pipe_params_st pipe_param); +const display_pipe_params_st *pipe_param);void (*recalculate)(struct display_mode_lib *mode_lib);void (*validate)(struct display_mode_lib *mode_lib); };
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 351/917 drm/amdgpu: move amdgpu_virt_release_full_gpu to fini_early stage
In reply to Greg Kroah-HartmanFrom: Guchun Chen <[email protected]>
[ Upstream commit 6effad8abe0ba4db3d9c58ed585127858a990f35 ]
adev->rmmio is set to be NULL in amdgpu_device_unmap_mmio to prevent access after pci_remove, however, in SRIOV case, amdgpu_virt_release_full_gpu will still use adev->rmmio for access after amdgpu_device_unmap_mmio. The patch is to move such SRIOV calling earlier to fini_early stage.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -4
@@ -2745,6 +2745,11 @@ static int amdgpu_device_ip_fini_early(struct amdgpu_device *adev) adev->ip_blocks[i].status.hw = false; } +if (amdgpu_sriov_vf (adev)) { +if (amdgpu_virt_release_full_gpu (adev, false)) +DRM_ERROR ("failed to release exclusive mode on fini\n" ); + } +return 0 ; }
@@ -2805,10 +2810,6 @@ static int amdgpu_device_ip_fini(struct amdgpu_device *adev)amdgpu_ras_fini (adev); -if (amdgpu_sriov_vf (adev)) -if (amdgpu_virt_release_full_gpu (adev, false)) -DRM_ERROR ("failed to release exclusive mode on fini\n" ); -return 0 ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 352/917 crypto: caam - disable pkc for non-E SoCs
In reply to Greg Kroah-HartmanFrom: Michael Walle <[email protected]>
[ Upstream commit f20311cc9c58052e0b215013046cbf390937910c ]
On newer CAAM versions, not all accelerators are disabled if the SoC is a non-E variant. While the driver checks most of the modules for availability, there is one - PKHA - which sticks out. On non-E variants it is still reported as available, that is the number of instances is non-zero, but it has limited functionality. In particular it doesn't support encryption and decryption, but just signing and verifying. This is indicated by a bit in the PKHA_MISC field. Take this bit into account if we are checking for availability.
This will the following error:
[ 8.167817] caam_jr 8020000.jr: 20000b0f: CCB: desc idx 11: : Invalid CHA selected.
Tested on an NXP LS1028A (non-E) SoC.
--- drivers/crypto/caam/caampkc.c | 19 +++++++++++++++---- drivers/crypto/caam/regs.h | 3 +++ 2 files changed, 18 insertions(+), 4 deletions(-)
drivers/crypto/caam/caampkc.c +15 -4
@@ -1153,16 +1153,27 @@ static struct caam_akcipher_alg caam_rsa = {int caam_pkc_init (struct device *ctrldev) {struct caam_drv_private *priv =dev_get_drvdata (ctrldev); -u32 pk_inst; +u32 pk_inst, pkha;int err; init_done = false;/* Determine public key hardware accelerator presence. */ -if (priv->era <10 ) +if (priv->era <10 ) { pk_inst = (rd_reg32 (&priv->ctrl->perfmon.cha_num_ls) &CHA_ID_LS_PK_MASK ) >>CHA_ID_LS_PK_SHIFT ; -else - pk_inst =rd_reg32 (&priv->ctrl->vreg.pkha) &CHA_VER_NUM_MASK ; + }else { + pkha =rd_reg32 (&priv->ctrl->vreg.pkha); + pk_inst = pkha &CHA_VER_NUM_MASK ; + +/* +* Newer CAAMs support partially disabled functionality. If this is the +* case, the number is non-zero, but this bit is set to indicate that +* no encryption or decryption is supported. Only signing and verifying +* is supported. +*/ +if (pkha &CHA_VER_MISC_PKHA_NO_CRYPT ) + pk_inst =0 ; + }/* Do not register algorithms if PKHA is not present. */ if (!pk_inst)
drivers/crypto/caam/regs.h +3 -0
@@ -322,6 +322,9 @@ struct version_regs {/* CHA Miscellaneous Information - AESA_MISC specific */ #define CHA_VER_MISC_AES_GCM BIT(1 + CHA_VER_MISC_SHIFT) +/* CHA Miscellaneous Information - PKHA_MISC specific */ +#define CHA_VER_MISC_PKHA_NO_CRYPT BIT(7 + CHA_VER_MISC_SHIFT) +/* * caam_perfmon - Performance Monitor/Secure Memory Status/ * CAAM Global Status/Component Version IDs
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 353/917 crypto: qat - power up 4xxx device
In reply to Greg Kroah-HartmanFrom: Giovanni Cabiddu <[email protected]>
[ Upstream commit ca605f97dae4bf070b7c584aec23c1c922e4d823 ]
After reset or boot, QAT 4xxx devices are inactive and require to be explicitly activated.
This is done by writing the DRV_ACTIVE bit in the PM_INTERRUPT register and polling the PM_INIT_STATE to make sure that the transaction has completed properly.
If this is not done, the driver will fail the initialization sequence reporting the following message:
[ 22.081193] 4xxx 0000:f7:00.0: enabling device (0140 -> 0142)
[ 22.720285] QAT: AE0 is inactive!!
[ 22.720287] QAT: failed to get device out of reset
[ 22.720288] 4xxx 0000:f7:00.0: qat_hal_clr_reset error
[ 22.720290] 4xxx 0000:f7:00.0: Failed to init the AEs
[ 22.720290] 4xxx 0000:f7:00.0: Failed to initialise Acceleration Engine
[ 22.720789] 4xxx 0000:f7:00.0: Resetting device qat_dev0
[ 22.825099] 4xxx: probe of 0000:f7:00.0 failed with error -14The patch also temporarily disables the power management source of interrupt, to avoid possible spurious interrupts as the power management feature is not fully supported.
The device init function has been added to adf_dev_init(), and not in the probe of 4xxx to make sure that the device is re-enabled in case of reset.
Note that the error code reported by hw_data->init_device() in adf_dev_init() has been shadowed for consistency with the other calls in the same function.
--- .../crypto/qat/qat_4xxx/adf_4xxx_hw_data.c | 31 +++++++++++++++++++ .../crypto/qat/qat_4xxx/adf_4xxx_hw_data.h | 10 ++++++ .../crypto/qat/qat_common/adf_accel_devices.h | 1 + drivers/crypto/qat/qat_common/adf_init.c | 5 +++ 4 files changed, 47 insertions(+)
drivers/crypto/qat/qat_4xxx/adf_4xxx_hw_data.c +31 -0
@@ -1,5 +1,6 @@// SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only) /* Copyright(c) 2020 Intel Corporation */ +#include <linux/iopoll.h> #include <adf_accel_devices.h> #include <adf_common_drv.h> #include <adf_pf2vf_msg.h>
@@ -161,6 +162,35 @@ static void adf_enable_ints(struct adf_accel_dev *accel_dev)ADF_CSR_WR (addr,ADF_4XXX_SMIAPF_MASK_OFFSET ,0 ); } +static int adf_init_device (struct adf_accel_dev *accel_dev) +{ +void __iomem *addr; +u32 status; +u32 csr; +int ret; + + addr = (&GET_BARS (accel_dev)[ADF_4XXX_PMISC_BAR ])->virt_addr; + +/* Temporarily mask PM interrupt */ + csr =ADF_CSR_RD (addr,ADF_4XXX_ERRMSK2 ); + csr |=ADF_4XXX_PM_SOU ; +ADF_CSR_WR (addr,ADF_4XXX_ERRMSK2 , csr); + +/* Set DRV_ACTIVE bit to power up the device */ +ADF_CSR_WR (addr,ADF_4XXX_PM_INTERRUPT ,ADF_4XXX_PM_DRV_ACTIVE ); + +/* Poll status register to make sure the device is powered up */ + ret =read_poll_timeout (ADF_CSR_RD , status, + status &ADF_4XXX_PM_INIT_STATE , +ADF_4XXX_PM_POLL_DELAY_US , +ADF_4XXX_PM_POLL_TIMEOUT_US , true, addr, +ADF_4XXX_PM_STATUS ); +if (ret) +dev_err (&GET_DEV (accel_dev),"Failed to power up the device\n" ); + +return ret; +} +static int adf_enable_pf2vf_comms (struct adf_accel_dev *accel_dev) {return 0 ;
@@ -215,6 +245,7 @@ void adf_init_hw_data_4xxx(struct adf_hw_device_data *hw_data) hw_data->exit_arb = adf_exit_arb; hw_data->get_arb_mapping = adf_get_arbiter_mapping; hw_data->enable_ints = adf_enable_ints; + hw_data->init_device = adf_init_device; hw_data->reset_device = adf_reset_flr; hw_data->admin_ae_mask =ADF_4XXX_ADMIN_AE_MASK ; hw_data->uof_get_num_objs = uof_get_num_objs;
drivers/crypto/qat/qat_4xxx/adf_4xxx_hw_data.h +10 -0
@@ -62,6 +62,16 @@#define ADF_4XXX_ADMINMSGLR_OFFSET (0x500578)#define ADF_4XXX_MAILBOX_BASE_OFFSET (0x600970) +/* Power management */ +#define ADF_4XXX_PM_POLL_DELAY_US 20 +#define ADF_4XXX_PM_POLL_TIMEOUT_US USEC_PER_SEC +#define ADF_4XXX_PM_STATUS (0x50A00C) +#define ADF_4XXX_PM_INTERRUPT (0x50A028) +#define ADF_4XXX_PM_DRV_ACTIVE BIT(20) +#define ADF_4XXX_PM_INIT_STATE BIT(21) +/* Power management source in ERRSOU2 and ERRMSK2 */ +#define ADF_4XXX_PM_SOU BIT(18) +/* Firmware Binaries */ #define ADF_4XXX_FW "qat_4xxx.bin"#define ADF_4XXX_MMP "qat_4xxx_mmp.bin"
drivers/crypto/qat/qat_common/adf_accel_devices.h +1 -0
@@ -166,6 +166,7 @@ struct adf_hw_device_data {int (*init_arb)(struct adf_accel_dev *accel_dev);void (*exit_arb)(struct adf_accel_dev *accel_dev);const u32 *(*get_arb_mapping)(void ); +int (*init_device)(struct adf_accel_dev *accel_dev);void (*disable_iov)(struct adf_accel_dev *accel_dev);void (*configure_iov_threads)(struct adf_accel_dev *accel_dev,bool enable);
drivers/crypto/qat/qat_common/adf_init.c +5 -0
@@ -79,6 +79,11 @@ int adf_dev_init(struct adf_accel_dev *accel_dev)return -EFAULT ; } +if (hw_data->init_device && hw_data->init_device (accel_dev)) { +dev_err (&GET_DEV (accel_dev),"Failed to initialize device\n" ); +return -EFAULT ; + } +if (hw_data->init_admin_comms && hw_data->init_admin_comms (accel_dev)) {dev_err (&GET_DEV (accel_dev),"Failed initialize admin comms\n" );return -EFAULT ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 354/917 Bluetooth: hci_h5: Fix (runtime)suspend issues on RTL8723BS HCIs
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 9a9023f314873241a43b5a2b96e9c0caaa958433 ]
The recently added H5_WAKEUP_DISABLE h5->flags flag gets checked in h5_btrtl_open(), but it gets set in h5_serdev_probe() *after* calling hci_uart_register_device() and thus after h5_btrtl_open() is called, set this flag earlier.
Also on devices where suspend/resume involves fully re-probing the HCI, runtime-pm suspend should not be used, make the runtime-pm setup conditional on the H5_WAKEUP_DISABLE flag too.
This fixes the HCI being removed and then re-added every 10 seconds because it was being reprobed as soon as it was runtime-suspended.
--- drivers/bluetooth/hci_h5.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
drivers/bluetooth/hci_h5.c +11 -9
@@ -848,6 +848,8 @@ static int h5_serdev_probe(struct serdev_device *serdev) h5->vnd = data->vnd; } +if (data->driver_info &H5_INFO_WAKEUP_DISABLE ) +set_bit (H5_WAKEUP_DISABLE , &h5->flags); h5->enable_gpio =devm_gpiod_get_optional (dev,"enable" ,GPIOD_OUT_LOW );if (IS_ERR (h5->enable_gpio))
@@ -862,9 +864,6 @@ static int h5_serdev_probe(struct serdev_device *serdev)if (err)return err; -if (data->driver_info &H5_INFO_WAKEUP_DISABLE ) -set_bit (H5_WAKEUP_DISABLE , &h5->flags); -return 0 ; }
@@ -964,11 +963,13 @@ static void h5_btrtl_open(struct h5 *h5)serdev_device_set_parity (h5->hu->serdev,SERDEV_PARITY_EVEN );serdev_device_set_baudrate (h5->hu->serdev,115200 ); -pm_runtime_set_active (&h5->hu->serdev->dev); -pm_runtime_use_autosuspend (&h5->hu->serdev->dev); -pm_runtime_set_autosuspend_delay (&h5->hu->serdev->dev, -SUSPEND_TIMEOUT_MS ); -pm_runtime_enable (&h5->hu->serdev->dev); +if (!test_bit (H5_WAKEUP_DISABLE , &h5->flags)) { +pm_runtime_set_active (&h5->hu->serdev->dev); +pm_runtime_use_autosuspend (&h5->hu->serdev->dev); +pm_runtime_set_autosuspend_delay (&h5->hu->serdev->dev, +SUSPEND_TIMEOUT_MS ); +pm_runtime_enable (&h5->hu->serdev->dev); + }/* The controller needs up to 500ms to wakeup */ gpiod_set_value_cansleep (h5->enable_gpio,1 );
@@ -978,7 +979,8 @@ static void h5_btrtl_open(struct h5 *h5)static void h5_btrtl_close (struct h5 *h5) { -pm_runtime_disable (&h5->hu->serdev->dev); +if (!test_bit (H5_WAKEUP_DISABLE , &h5->flags)) +pm_runtime_disable (&h5->hu->serdev->dev);gpiod_set_value_cansleep (h5->device_wake_gpio,0 );gpiod_set_value_cansleep (h5->enable_gpio,0 );
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 355/917 bnxt_en: Check devlink allocation and registration status
In reply to Greg Kroah-HartmanFrom: Leon Romanovsky <[email protected]>
[ Upstream commit e624c70e1131e145bd0510b8a700b5e2d112e377 ]
devlink is a software interface that doesn't depend on any hardware capabilities. The failure in SW means memory issues, wrong parameters, programmer error e.t.c.
Like any other such interface in the kernel, the returned status of devlink APIs should be checked and propagated further and not ignored.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 5 ++++- drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 13 ++++++------- drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h | 13 ------------- 3 files changed, 10 insertions(+), 21 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +4 -1
@@ -13370,7 +13370,9 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) }bnxt_inv_fw_health_reg (bp); -bnxt_dl_register (bp); + rc =bnxt_dl_register (bp); +if (rc) + goto init_err_dl; rc =register_netdev (dev);if (rc)
@@ -13390,6 +13392,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) init_err_cleanup:bnxt_dl_unregister (bp); +init_err_dl:bnxt_shutdown_tc (bp);bnxt_clear_int_mode (bp);
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c +6 -7
@@ -134,7 +134,7 @@ void bnxt_dl_fw_reporters_create(struct bnxt *bp) {struct bnxt_fw_health *health = bp->fw_health; -if (!bp->dl || !health) +if (!health)return ;if (!(bp->fw_cap &BNXT_FW_CAP_HOT_RESET ) || health->fw_reset_reporter)
@@ -188,7 +188,7 @@ void bnxt_dl_fw_reporters_destroy(struct bnxt *bp, bool all) {struct bnxt_fw_health *health = bp->fw_health; -if (!bp->dl || !health) +if (!health)return ; if ((all || !(bp->fw_cap & BNXT_FW_CAP_HOT_RESET)) &&
@@ -781,6 +781,7 @@ int bnxt_dl_register(struct bnxt *bp) {const struct devlink_ops *devlink_ops;struct devlink_port_attrs attrs = {}; +struct bnxt_dl *bp_dl;struct devlink *dl;int rc;
@@ -795,7 +796,9 @@ int bnxt_dl_register(struct bnxt *bp)return -ENOMEM ; } -bnxt_link_bp_to_dl (bp, dl); + bp->dl = dl; + bp_dl =devlink_priv (dl); + bp_dl->bp = bp;/* Add switchdev eswitch mode setting, if SRIOV supported */ if (pci_find_ext_capability(bp->pdev, PCI_EXT_CAP_ID_SRIOV) &&
@@ -833,7 +836,6 @@ err_dl_port_unreg: err_dl_unreg:devlink_unregister (dl); err_dl_free: -bnxt_link_bp_to_dl (bp,NULL );devlink_free (dl);return rc; }
@@ -842,9 +844,6 @@ void bnxt_dl_unregister(struct bnxt *bp) {struct devlink *dl = bp->dl; -if (!dl) -return ; -if (BNXT_PF (bp)) {bnxt_dl_params_unregister (bp);devlink_port_unregister (&bp->dl_port);
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.h +0 -13
@@ -20,19 +20,6 @@ static inline struct bnxt *bnxt_get_bp_from_dl(struct devlink *dl)return ((struct bnxt_dl *)devlink_priv (dl))->bp; } -/* To clear devlink pointer from bp, pass NULL dl */ -static inline void bnxt_link_bp_to_dl (struct bnxt *bp,struct devlink *dl) -{ - bp->dl = dl; - -/* add a back pointer in dl to bp */ -if (dl) { -struct bnxt_dl *bp_dl =devlink_priv (dl); - - bp_dl->bp = bp; - } -} -#define NVM_OFF_MSIX_VEC_PER_PF_MAX 108#define NVM_OFF_MSIX_VEC_PER_PF_MIN 114#define NVM_OFF_IGNORE_ARI 164
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 356/917 qed: Dont ignore devlink allocation failures
In reply to Greg Kroah-HartmanFrom: Leon Romanovsky <[email protected]>
[ Upstream commit e6a54d6f221301347aaf9d83bb1f23129325c1c5 ]
devlink is a software interface that doesn't depend on any hardware capabilities. The failure in SW means memory issues, wrong parameters, programmer error e.t.c.
Like any other such interface in the kernel, the returned status of devlink APIs should be checked and propagated further and not ignored.
--- drivers/net/ethernet/qlogic/qede/qede_main.c | 12 +++++------- drivers/scsi/qedf/qedf_main.c | 2 ++ 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/net/ethernet/qlogic/qede/qede_main.c +5 -7
@@ -1176,19 +1176,17 @@ static int __qede_probe(struct pci_dev *pdev, u32 dp_module, u8 dp_level, edev->devlink = qed_ops->common->devlink_register (cdev);if (IS_ERR (edev->devlink)) {DP_NOTICE (edev,"Cannot register devlink\n" ); + rc =PTR_ERR (edev->devlink); edev->devlink =NULL ; -/* Go on, we can live without devlink */ + goto err3; } }else {struct net_device *ndev =pci_get_drvdata (pdev); +struct qed_devlink *qdl; edev =netdev_priv (ndev); - -if (edev->devlink) { -struct qed_devlink *qdl =devlink_priv (edev->devlink); - - qdl->cdev = cdev; - } + qdl =devlink_priv (edev->devlink); + qdl->cdev = cdev; edev->cdev = cdev;memset (&edev->stats,0 ,sizeof (edev->stats));memcpy (&edev->dev_info, &dev_info,sizeof (dev_info));
drivers/scsi/qedf/qedf_main.c +2 -0
@@ -3416,7 +3416,9 @@ retry_probe: qedf->devlink = qed_ops->common->devlink_register (qedf->cdev);if (IS_ERR (qedf->devlink)) {QEDF_ERR (&qedf->dbg_ctx,"Cannot register devlink\n" ); + rc =PTR_ERR (qedf->devlink); qedf->devlink =NULL ; + goto err2; } }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 357/917 rxrpc: Fix _usecs_to_jiffies() by using usecs_to_jiffies()
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit acde891c243c1ed85b19d4d5042bdf00914f5739 ]
Directly using _usecs_to_jiffies() might be unsafe, so it's better to use usecs_to_jiffies() instead.
Because we can see that the result of _usecs_to_jiffies() could be larger than MAX_JIFFY_OFFSET values without the check of the input.
--- net/rxrpc/rtt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/rxrpc/rtt.c +1 -1
@@ -22,7 +22,7 @@ static u32 rxrpc_rto_min_us(struct rxrpc_peer *peer)static u32 __rxrpc_set_rto (const struct rxrpc_peer *peer) { -return _usecs_to_jiffies ((peer->srtt_us >>3 ) + peer->rttvar_us); +return usecs_to_jiffies ((peer->srtt_us >>3 ) + peer->rttvar_us); }static u32 rxrpc_bound_rto (u32 rto)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 358/917 mptcp: do not shrink snd_nxt when recovering
In reply to Greg Kroah-HartmanFrom: Florian Westphal <[email protected]>
[ Upstream commit 0d199e4363b482badcedba764e2aceab53a4a10a ]
When recovering after a link failure, snd_nxt should not be set to a lower value. Else, update of snd_nxt is broken because:
msk->snd_nxt += ret; (where ret is number of bytes sent)
assumes that snd_nxt always moves forward.
After reduction, its possible that snd_nxt update gets out of sync:
dfrag we just sent might have had a data sequence number even past recovery_snd_nxt.
This change factors the common msk state update to a helper and updates snd_nxt based on the current dfrag data sequence number.
The conditional is required for the recovery phase where we may re-transmit old dfrags that are before current snd_nxt.
After this change, snd_nxt only moves forward and covers all in-sequence data that was transmitted.
recovery_snd_nxt is retained to detect when recovery has completed.
--- net/mptcp/options.c | 8 +++----- net/mptcp/protocol.c | 43 +++++++++++++++++++++++++++++++------------ 2 files changed, 34 insertions(+), 17 deletions(-)
net/mptcp/options.c +3 -5
@@ -1019,11 +1019,9 @@ static void ack_update_msk(struct mptcp_sock *msk, old_snd_una = msk->snd_una; new_snd_una =mptcp_expand_seq (old_snd_una, mp_opt->data_ack, mp_opt->ack64); -/* ACK for data not even sent yet and even above recovery bound? Ignore.*/ -if (unlikely (after64 (new_snd_una, snd_nxt))) { -if (!msk->recovery ||after64 (new_snd_una, msk->recovery_snd_nxt)) - new_snd_una = old_snd_una; - } +/* ACK for data not even sent yet? Ignore.*/ +if (unlikely (after64 (new_snd_una, snd_nxt))) + new_snd_una = old_snd_una; new_wnd_end = new_snd_una +tcp_sk (ssk)->snd_wnd;
net/mptcp/protocol.c +31 -12
77 lines not on this page · raw message
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 359/917 fortify: Fix dropped strcpy() compile-time write overflow check
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit 072af0c638dc8a5c7db2edc4dddbd6d44bee3bdb ]
The implementation for intra-object overflow in str*-family functions accidentally dropped compile-time write overflow checking in strcpy(), leaving it entirely to run-time. Add back the intended check.
--- include/linux/fortify-string.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
include/linux/fortify-string.h +4 -1
@@ -280,7 +280,10 @@ __FORTIFY_INLINE char *strcpy(char *p, const char *q)if (p_size == (size_t )-1 && q_size == (size_t )-1 )return __underlying_strcpy (p, q); size =strlen (q) +1 ; -/* test here to use the more stringent object size */ +/* Compile-time check for const size overflow. */ +if (__builtin_constant_p (size) && p_size < size) +__write_overflow (); +/* Run-time check for dynamic size overflow. */ if (p_size < size)fortify_panic (__func__);memcpy (p, q, size);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 360/917 mac80211: twt: dont use potentially unaligned pointer
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit 7ff379ba2d4b7b205240e666601fe302207d73f8 ]
Since we're pointing into a frame, the pointer to the twt_agrt->req_type struct member is potentially not aligned properly. Open-code le16p_replace_bits() to avoid passing an unaligned pointer.
--- net/mac80211/s1g.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
net/mac80211/s1g.c +5 -3
@@ -104,9 +104,11 @@ ieee80211_s1g_rx_twt_setup(struct ieee80211_sub_if_data *sdata,/* broadcast TWT not supported yet */ if (twt->control &IEEE80211_TWT_CONTROL_NEG_TYPE_BROADCAST ) { -le16p_replace_bits (&twt_agrt->req_type, -TWT_SETUP_CMD_REJECT , -IEEE80211_TWT_REQTYPE_SETUP_CMD ); + twt_agrt->req_type &= + ~cpu_to_le16 (IEEE80211_TWT_REQTYPE_SETUP_CMD ); + twt_agrt->req_type |= +le16_encode_bits (TWT_SETUP_CMD_REJECT , +IEEE80211_TWT_REQTYPE_SETUP_CMD ); goto out; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 361/917 cfg80211: always free wiphy specific regdomain
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit e53e9828a8d2c6545e01ff9711f1221f2fd199ce ]
In the (somewhat unlikely) event that we allocate a wiphy, then add a regdomain to it, and then fail registration, we leak the regdomain. Fix this by just always freeing it at the end, in the normal cases we'll free (and NULL) it during wiphy_unregister(). This happened when the wiphy settings were bad, and since they can be controlled by userspace with hwsim, syzbot was able to find this issue.
--- net/wireless/core.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
net/wireless/core.c +10 -0
@@ -1081,6 +1081,16 @@ void cfg80211_dev_free(struct cfg80211_registered_device *rdev)list_for_each_entry_safe (scan, tmp, &rdev->bss_list, list)cfg80211_put_bss (&rdev->wiphy, &scan->pub);mutex_destroy (&rdev->wiphy.mtx); + +/* +* The 'regd' can only be non-NULL if we never finished +* initializing the wiphy and thus never went through the +* unregister path - e.g. in failure scenarios. Thus, it +* cannot have been visible to anyone if non-NULL, so we +* can just free it here. +*/ +kfree (rcu_dereference_raw (rdev->wiphy.regd)); +kfree (rdev); }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 362/917 net/mlx5: Accept devlink user input after driver initialization complete
In reply to Greg Kroah-HartmanFrom: Leon Romanovsky <[email protected]>
[ Upstream commit 64ea2d0e7263b67d8efc93fa1baace041ed36d1e ]
The change of devlink_alloc() to accept device makes sure that device is fully initialized and device_register() does nothing except allowing users to use that devlink instance.
Such change ensures that no user input will be usable till that point and it eliminates the need to worry about internal locking as long as devlink_register is called last since all accesses to the devlink are during initialization.
This change fixes the following lockdep warning.
======================================================
WARNING: possible circular locking dependency detected
5.14.0-rc2+ #27 Not tainted
------------------------------------------------------
devlink/265 is trying to acquire lock:
ffff8880133c2bc0 (&dev->intf_state_mutex){+.+.}-{3:3}, at: mlx5_unload_one+0x1e/0xa0 [mlx5_core] but task is already holding lock:
ffffffff8362b468 (devlink_mutex){+.+.}-{3:3}, at: devlink_nl_pre_doit+0x2b/0x8d0 which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #1 (devlink_mutex){+.+.}-{3:3}:
__mutex_lock+0x149/0x1310
devlink_register+0xe7/0x280
mlx5_devlink_register+0x118/0x480 [mlx5_core]
mlx5_init_one+0x34b/0x440 [mlx5_core]
probe_one+0x480/0x6e0 [mlx5_core]
pci_device_probe+0x2a0/0x4a0
really_probe+0x1cb/0xba0
__driver_probe_device+0x18f/0x470
driver_probe_device+0x49/0x120
__driver_attach+0x1ce/0x400
bus_for_each_dev+0x11e/0x1a0
bus_add_driver+0x309/0x570
driver_register+0x20f/0x390
0xffffffffa04a0062
do_one_initcall+0xd5/0x400
do_init_module+0x1c8/0x760
load_module+0x7d9d/0xa4b0
__do_sys_finit_module+0x118/0x1a0
do_syscall_64+0x3d/0x90
entry_SYSCALL_64_after_hwframe+0x44/0xae-> #0 (&dev->intf_state_mutex){+.+.}-{3:3}:
__lock_acquire+0x2999/0x5a40
lock_acquire+0x1a9/0x4a0
__mutex_lock+0x149/0x1310
mlx5_unload_one+0x1e/0xa0 [mlx5_core]
mlx5_devlink_reload_down+0x185/0x2b0 [mlx5_core]
devlink_reload+0x1f2/0x640
devlink_nl_cmd_reload+0x6c3/0x10d0
genl_family_rcv_msg_doit+0x1e9/0x2f0
genl_rcv_msg+0x27f/0x4a0
netlink_rcv_skb+0x11e/0x340
genl_rcv+0x24/0x40
netlink_unicast+0x433/0x700
netlink_sendmsg+0x6fb/0xbe0
sock_sendmsg+0xb0/0xe0
__sys_sendto+0x192/0x240
__x64_sys_sendto+0xdc/0x1b0
do_syscall_64+0x3d/0x90
entry_SYSCALL_64_after_hwframe+0x44/0xaeother info that might help us debug this:
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(devlink_mutex);
lock(&dev->intf_state_mutex);
lock(devlink_mutex); lock(&dev->intf_state_mutex);
*** DEADLOCK ***
3 locks held by devlink/265:
#0: ffffffff836371d0 (cb_lock){++++}-{3:3}, at: genl_rcv+0x15/0x40
#1: ffffffff83637288 (genl_mutex){+.+.}-{3:3}, at: genl_rcv_msg+0x31a/0x4a0 #2: ffffffff8362b468 (devlink_mutex){+.+.}-{3:3}, at: devlink_nl_pre_doit+0x2b/0x8d0
stack backtrace: CPU: 0 PID: 265 Comm: devlink Not tainted 5.14.0-rc2+ #27 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014 Call Trace: dump_stack_lvl+0x45/0x59 check_noncircular+0x268/0x310 ? print_circular_bug+0x460/0x460 ? __kernel_text_address+0xe/0x30 ? alloc_chain_hlocks+0x1e6/0x5a0 __lock_acquire+0x2999/0x5a40 ? lockdep_hardirqs_on_prepare+0x3e0/0x3e0 ? add_lock_to_list.constprop.0+0x6c/0x530 lock_acquire+0x1a9/0x4a0 ? mlx5_unload_one+0x1e/0xa0 [mlx5_core] ? lock_release+0x6c0/0x6c0 ? lockdep_hardirqs_on_prepare+0x3e0/0x3e0 ? lock_is_held_type+0x98/0x110 __mutex_lock+0x149/0x1310 ? mlx5_unload_one+0x1e/0xa0 [mlx5_core] ? lock_is_held_type+0x98/0x110 ? mlx5_unload_one+0x1e/0xa0 [mlx5_core] ? find_held_lock+0x2d/0x110 ? mutex_lock_io_nested+0x1160/0x1160 ? mlx5_lag_is_active+0x72/0x90 [mlx5_core] ? lock_downgrade+0x6d0/0x6d0 ? do_raw_spin_lock+0x12e/0x270 ? rwlock_bug.part.0+0x90/0x90 ? mlx5_unload_one+0x1e/0xa0 [mlx5_core] mlx5_unload_one+0x1e/0xa0 [mlx5_core] mlx5_devlink_reload_down+0x185/0x2b0 [mlx5_core] ? netlink_broadcast_filtered+0x308/0xac0 ? mlx5_devlink_info_get+0x1f0/0x1f0 [mlx5_core] ? __build_skb_around+0x110/0x2b0 ? __alloc_skb+0x113/0x2b0 devlink_reload+0x1f2/0x640 ? devlink_unregister+0x1e0/0x1e0 ? security_capable+0x51/0x90 devlink_nl_cmd_reload+0x6c3/0x10d0 ? devlink_nl_cmd_get_doit+0x1e0/0x1e0 ? devlink_nl_pre_doit+0x72/0x8d0 genl_family_rcv_msg_doit+0x1e9/0x2f0 ? __lock_acquire+0x15e2/0x5a40 ? genl_family_rcv_msg_attrs_parse.constprop.0+0x240/0x240 ? mutex_lock_io_nested+0x1160/0x1160 ? security_capable+0x51/0x90 genl_rcv_msg+0x27f/0x4a0 ? genl_get_cmd+0x3c0/0x3c0 ? lock_acquire+0x1a9/0x4a0 ? devlink_nl_cmd_get_doit+0x1e0/0x1e0 ? lock_release+0x6c0/0x6c0 netlink_rcv_skb+0x11e/0x340 ? genl_get_cmd+0x3c0/0x3c0 ? netlink_ack+0x930/0x930 genl_rcv+0x24/0x40 netlink_unicast+0x433/0x700 ? netlink_attachskb+0x750/0x750 ? __alloc_skb+0x113/0x2b0 netlink_sendmsg+0x6fb/0xbe0 ? netlink_unicast+0x700/0x700 ? netlink_unicast+0x700/0x700 sock_sendmsg+0xb0/0xe0 __sys_sendto+0x192/0x240 ? __x64_sys_getpeername+0xb0/0xb0 ? do_sys_openat2+0x10a/0x370 ? down_write_nested+0x150/0x150 ? do_user_addr_fault+0x215/0xd50 ? __x64_sys_openat+0x11f/0x1d0 ? __x64_sys_open+0x1a0/0x1a0 __x64_sys_sendto+0xdc/0x1b0 ? syscall_enter_from_user_mode+0x1d/0x50 do_syscall_64+0x3d/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f50b50b6b3a Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb b8 0f 1f 00 f3 0f 1e fa 41 89 ca 64 8b 04 25 18 00 00 00 85 c0 75 15 b8 2c 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 76 c3 0f 1f 44 00 00 55 48 83 ec 30 44 89 4c RSP: 002b:00007fff6c0d3f38 EFLAGS: 00000246 ORIG_RAX: 000000000000002c RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 00007f50b50b6b3a RDX: 0000000000000038 RSI: 000055763ac08440 RDI: 0000000000000003 RBP: 000055763ac08410 R08: 00007f50b5192200 R09: 000000000000000c R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 000055763ac08410 R15: 000055763ac08440 mlx5_core 0000:00:09.0: firmware version: 4.8.9999 mlx5_core 0000:00:09.0: 0.000 Gb/s available PCIe bandwidth (8.0 GT/s PCIe x255 link) mlx5_core 0000:00:09.0 eth1: Link up
--- drivers/net/ethernet/mellanox/mlx5/core/devlink.c | 12 ++---------- drivers/net/ethernet/mellanox/mlx5/core/main.c | 2 ++ .../net/ethernet/mellanox/mlx5/core/sf/dev/driver.c | 2 ++ 3 files changed, 6 insertions(+), 10 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/devlink.c +2 -10
@@ -793,14 +793,11 @@ int mlx5_devlink_register(struct devlink *devlink) {int err; - err =devlink_register (devlink); -if (err) -return err; - err =devlink_params_register (devlink, mlx5_devlink_params,ARRAY_SIZE (mlx5_devlink_params));if (err) - goto params_reg_err; +return err; +mlx5_devlink_set_params_init_values (devlink); err =mlx5_devlink_auxdev_params_register (devlink);
@@ -811,7 +808,6 @@ int mlx5_devlink_register(struct devlink *devlink)if (err) goto traps_reg_err; -devlink_params_publish (devlink);return 0 ; traps_reg_err:
@@ -819,17 +815,13 @@ traps_reg_err: auxdev_reg_err:devlink_params_unregister (devlink, mlx5_devlink_params,ARRAY_SIZE (mlx5_devlink_params)); -params_reg_err: -devlink_unregister (devlink);return err; }void mlx5_devlink_unregister (struct devlink *devlink) { -devlink_params_unpublish (devlink);mlx5_devlink_traps_unregister (devlink);mlx5_devlink_auxdev_params_unregister (devlink);devlink_params_unregister (devlink, mlx5_devlink_params,ARRAY_SIZE (mlx5_devlink_params)); -devlink_unregister (devlink); }
drivers/net/ethernet/mellanox/mlx5/core/main.c +2 -0
@@ -1537,6 +1537,7 @@ static int probe_one(struct pci_dev *pdev, const struct pci_device_id *id)dev_err (&pdev->dev,"mlx5_crdump_enable failed with error code %d\n" , err);pci_save_state (pdev); +devlink_register (devlink);if (!mlx5_core_is_mp_slave (dev))devlink_reload_enable (devlink);return 0 ;
@@ -1559,6 +1560,7 @@ static void remove_one(struct pci_dev *pdev)struct devlink *devlink =priv_to_devlink (dev);devlink_reload_disable (devlink); +devlink_unregister (devlink);mlx5_crdump_disable (dev);mlx5_drain_health_wq (dev);mlx5_uninit_one (dev);
drivers/net/ethernet/mellanox/mlx5/core/sf/dev/driver.c +2 -0
@@ -46,6 +46,7 @@ static int mlx5_sf_dev_probe(struct auxiliary_device *adev, const struct auxiliamlx5_core_warn (mdev,"mlx5_init_one err=%d\n" , err); goto init_one_err; } +devlink_register (devlink);devlink_reload_enable (devlink);return 0 ;
@@ -65,6 +66,7 @@ static void mlx5_sf_dev_remove(struct auxiliary_device *adev) devlink =priv_to_devlink (sf_dev->mdev);devlink_reload_disable (devlink); +devlink_unregister (devlink);mlx5_uninit_one (sf_dev->mdev);iounmap (sf_dev->mdev->iseg);mlx5_mdev_uninit (sf_dev->mdev);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 363/917 net: dsa: rtl8366rb: Fix off-by-one bug
In reply to Greg Kroah-HartmanFrom: Linus Walleij <[email protected]>
[ Upstream commit 5f5f12f5d4b108399130bb5c11f07765851d9cdb ]
The max VLAN number with non-4K VLAN activated is 15, and the range is 0..15. Not 16.
The impact should be low since we by default have 4K VLAN and thus have 4095 VLANs to play with in this switch. There will not be a problem unless the code is rewritten to only use 16 VLANs.
--- drivers/net/dsa/rtl8366rb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/rtl8366rb.c +1 -1
@@ -1350,7 +1350,7 @@ static int rtl8366rb_set_mc_index(struct realtek_smi *smi, int port, int index)static bool rtl8366rb_is_vlan_valid (struct realtek_smi *smi,unsigned int vlan) { -unsigned int max =RTL8366RB_NUM_VLANS ; +unsigned int max =RTL8366RB_NUM_VLANS -1 ;if (smi->vlan4k_enabled) max =RTL8366RB_NUM_VIDS -1 ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 364/917 net: dsa: rtl8366: Fix a bug in deleting VLANs
In reply to Greg Kroah-HartmanFrom: Linus Walleij <[email protected]>
[ Upstream commit d8251b9db34a2cbc5619b610e7e8aad1d165c531 ]
We were checking that the MC (member config) was != 0 for some reason, all we need to check is that the config has no ports, i.e. no members. Then it can be recycled. This must be some misunderstanding.
--- drivers/net/dsa/rtl8366.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/rtl8366.c +1 -1
@@ -457,7 +457,7 @@ int rtl8366_vlan_del(struct dsa_switch *ds, int port,* anymore then clear the whole member * config so it can be reused. */ -if (!vlanmc.member && vlanmc.untag) { +if (!vlanmc.member) { vlanmc.vid =0 ; vlanmc.priority =0 ; vlanmc.fid =0 ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 365/917 bpf/tests: Fix error in tail call limit tests
In reply to Greg Kroah-HartmanFrom: Johan Almbladh <[email protected]>
[ Upstream commit 18935a72eb25525b655262579e1652362a3b29bb ]
This patch fixes an error in the tail call limit test that caused the test to fail on for x86-64 JIT. Previously, the register R0 was used to report the total number of tail calls made. However, after a tail call fall-through, the value of the R0 register is undefined. Now, all tail call error path tests instead use context state to store the count.
--- lib/test_bpf.c | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-)
lib/test_bpf.c +27 -10
@@ -8992,10 +8992,15 @@ static __init int test_bpf(void)struct tail_call_test {const char *descr;struct bpf_insn insns[MAX_INSNS ]; +int flags;int result;int stack_depth; }; +/* Flags that can be passed to tail call test cases */ +#define FLAG_NEED_STATE BIT(0) +#define FLAG_RESULT_IN_STATE BIT(1) +/* * Magic marker used in test snippets for tail calls below. * BPF_LD/MOV to R2 and R2 with this immediate value is replaced
@@ -9065,32 +9070,38 @@ static struct tail_call_test tail_call_tests[] = { { "Tail call error path, max count reached", .insns = { -BPF_ALU64_IMM (BPF_ADD ,R1 ,1 ), -BPF_ALU64_REG (BPF_MOV ,R0 ,R1 ), +BPF_LDX_MEM (BPF_W ,R2 ,R1 ,0 ), +BPF_ALU64_IMM (BPF_ADD ,R2 ,1 ), +BPF_STX_MEM (BPF_W ,R1 ,R2 ,0 ),TAIL_CALL (0 ), BPF_EXIT_INSN(), }, - .result =MAX_TAIL_CALL_CNT +1 , + .flags =FLAG_NEED_STATE |FLAG_RESULT_IN_STATE , + .result = (MAX_TAIL_CALL_CNT + 1 + 1) * MAX_TESTRUNS, }, {"Tail call error path, NULL target" , .insns = { -BPF_ALU64_IMM (BPF_MOV ,R0 ,-1 ), +BPF_LDX_MEM (BPF_W ,R2 ,R1 ,0 ), +BPF_ALU64_IMM (BPF_ADD ,R2 ,1 ), +BPF_STX_MEM (BPF_W ,R1 ,R2 ,0 ),TAIL_CALL (TAIL_CALL_NULL ), -BPF_ALU64_IMM (BPF_MOV ,R0 ,1 ), BPF_EXIT_INSN(), }, - .result =1 , + .flags =FLAG_NEED_STATE |FLAG_RESULT_IN_STATE , + .result = MAX_TESTRUNS, }, {"Tail call error path, index out of range" , .insns = { -BPF_ALU64_IMM (BPF_MOV ,R0 ,-1 ), +BPF_LDX_MEM (BPF_W ,R2 ,R1 ,0 ), +BPF_ALU64_IMM (BPF_ADD ,R2 ,1 ), +BPF_STX_MEM (BPF_W ,R1 ,R2 ,0 ),TAIL_CALL (TAIL_CALL_INVALID ), -BPF_ALU64_IMM (BPF_MOV ,R0 ,1 ), BPF_EXIT_INSN(), }, - .result = 1, + .flags =FLAG_NEED_STATE |FLAG_RESULT_IN_STATE , + .result = MAX_TESTRUNS, }, };
@@ -9196,6 +9207,8 @@ static __init int test_tail_calls(struct bpf_array *progs)for (i =0 ; i <ARRAY_SIZE (tail_call_tests); i++) {struct tail_call_test *test = &tail_call_tests[i];struct bpf_prog *fp = progs->ptrs[i]; +int *data =NULL ; +int state =0 ;u64 duration;int ret;
@@ -9212,7 +9225,11 @@ static __init int test_tail_calls(struct bpf_array *progs)if (fp->jited) jit_cnt++; - ret =__run_one (fp,NULL ,MAX_TESTRUNS , &duration); +if (test->flags &FLAG_NEED_STATE ) + data = &state; + ret =__run_one (fp, data,MAX_TESTRUNS , &duration); +if (test->flags &FLAG_RESULT_IN_STATE ) + ret = state;if (ret == test->result) {pr_cont ("%lld PASS" , duration); pass_cnt++;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 366/917 ath11k: fix some sleeping in atomic bugs
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit aadf7c81a0771b8f1c97dabca6a48bae1b387779 ]
The ath11k_dbring_bufs_replenish() and ath11k_dbring_fill_bufs() take a "gfp" parameter but they since they take spinlocks, the allocations they do have to be atomic. This causes a bug because ath11k_dbring_buf_setup passes GFP_KERNEL for the gfp flags.
The fix is to use GFP_ATOMIC and remove the unused parameters.
--- drivers/net/wireless/ath/ath11k/dbring.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/net/wireless/ath/ath11k/dbring.c +7 -9
@@ -8,8 +8,7 @@static int ath11k_dbring_bufs_replenish (struct ath11k *ar,struct ath11k_dbring *ring, -struct ath11k_dbring_element *buff, -gfp_t gfp) +struct ath11k_dbring_element *buff) {struct ath11k_base *ab = ar->ab;struct hal_srng *srng;
@@ -35,7 +34,7 @@ static int ath11k_dbring_bufs_replenish(struct ath11k *ar, goto err;spin_lock_bh (&ring->idr_lock); - buf_id =idr_alloc (&ring->bufs_idr, buff,0 , ring->bufs_max, gfp); + buf_id =idr_alloc (&ring->bufs_idr, buff,0 , ring->bufs_max,GFP_ATOMIC );spin_unlock_bh (&ring->idr_lock);if (buf_id <0 ) { ret = -ENOBUFS ;
@@ -72,8 +71,7 @@ err: }static int ath11k_dbring_fill_bufs (struct ath11k *ar, -struct ath11k_dbring *ring, -gfp_t gfp) +struct ath11k_dbring *ring) {struct ath11k_dbring_element *buff;struct hal_srng *srng;
@@ -92,11 +90,11 @@ static int ath11k_dbring_fill_bufs(struct ath11k *ar, size =sizeof (*buff) + ring->buf_sz + align -1 ;while (num_remain >0 ) { - buff =kzalloc (size, gfp); + buff =kzalloc (size,GFP_ATOMIC );if (!buff)break ; - ret =ath11k_dbring_bufs_replenish (ar, ring, buff, gfp); + ret =ath11k_dbring_bufs_replenish (ar, ring, buff);if (ret) {ath11k_warn (ar->ab,"failed to replenish db ring num_remain %d req_ent %d\n" , num_remain, req_entries);
@@ -176,7 +174,7 @@ int ath11k_dbring_buf_setup(struct ath11k *ar, ring->hp_addr =ath11k_hal_srng_get_hp_addr (ar->ab, srng); ring->tp_addr =ath11k_hal_srng_get_tp_addr (ar->ab, srng); - ret =ath11k_dbring_fill_bufs (ar, ring,GFP_KERNEL ); + ret =ath11k_dbring_fill_bufs (ar, ring);return ret; }
@@ -322,7 +320,7 @@ int ath11k_dbring_buffer_release_event(struct ath11k_base *ab, }memset (buff,0 , size); -ath11k_dbring_bufs_replenish (ar, ring, buff,GFP_ATOMIC ); +ath11k_dbring_bufs_replenish (ar, ring, buff); }spin_unlock_bh (&srng->lock);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 367/917 ath11k: Avoid race during regd updates
In reply to Greg Kroah-HartmanFrom: Sriram R <[email protected]>
[ Upstream commit 1db2b0d0a39102238fcbf9092cefa65a710642e9 ]
Whenever ath11k is bootup with a user country already set, cfg80211 notifies this country info to ath11k soon after registration, where the notification is sent to the firmware for fetching the rules of this user country input.
Multiple race conditions could be seen in this scenario where a new request is either lost as pointed in [1] or a new regd overwrites the default regd provided by the firmware during bootup. Note that, the default regd is used for intersection purpose and hence it should not be overwritten.
The main reason as pointed by [1] is the usage of ATH11K_FLAG_REGISTERED flag which is updated after completion of core registration, whereas the reg notification from cfg80211 and wmi events for the corresponding request can happen much before that. Since the ATH11K_FLAG_REGISTERED is currently used to determine if the event containing reg rules belong to default regd or for user request, there is a possibility of the default regd getting overwritten.
Since the default reg rules will be received only once per pdev on firmware load, the above flag based check can be replaced with a check to see if default_regd is already set, so that we can now always update the new_regd. Also if the new_regd is set, this will be always used to update the reg rules for the registered phy.
[1] https://patchwork.kernel.org/project/linux-wireless/patch/1829665.1PRlr7bOQj@ripper/
Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-01460-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath11k/mac.c | 2 +- drivers/net/wireless/ath/ath11k/reg.c | 11 ++++++----- drivers/net/wireless/ath/ath11k/reg.h | 2 +- drivers/net/wireless/ath/ath11k/wmi.c | 16 ++++++---------- 4 files changed, 14 insertions(+), 17 deletions(-)
drivers/net/wireless/ath/ath11k/mac.c +1 -1
@@ -6590,7 +6590,7 @@ static int __ath11k_mac_register(struct ath11k *ar) ar->hw->wiphy->interface_modes &= ~BIT (NL80211_IFTYPE_MONITOR );/* Apply the regd received during initialization */ - ret =ath11k_regd_update (ar, true); + ret =ath11k_regd_update (ar);if (ret) {ath11k_err (ar->ab,"ath11k regd update failed: %d\n" , ret); goto err_unregister_hw;
drivers/net/wireless/ath/ath11k/reg.c +6 -5
@@ -198,7 +198,7 @@ static void ath11k_copy_regd(struct ieee80211_regdomain *regd_orig, sizeof(struct ieee80211_reg_rule)); } -int ath11k_regd_update (struct ath11k *ar,bool init) +int ath11k_regd_update (struct ath11k *ar) {struct ieee80211_regdomain *regd, *regd_copy =NULL ;int ret, regd_len, pdev_id;
@@ -209,7 +209,10 @@ int ath11k_regd_update(struct ath11k *ar, bool init)spin_lock_bh (&ab->base_lock); -if (init) { +/* Prefer the latest regd update over default if it's available */ +if (ab->new_regd[pdev_id]) { + regd = ab->new_regd[pdev_id]; + }else {/* Apply the regd received during init through * WMI_REG_CHAN_LIST_CC event. In case of failure to * receive the regd, initialize with a default world
@@ -222,8 +225,6 @@ int ath11k_regd_update(struct ath11k *ar, bool init) "failed to receive default regd during init\n"); regd = (struct ieee80211_regdomain *)&ath11k_world_regd; } - }else { - regd = ab->new_regd[pdev_id]; }if (!regd) {
@@ -683,7 +684,7 @@ void ath11k_regd_update_work(struct work_struct *work) regd_update_work);int ret; - ret =ath11k_regd_update (ar, false); + ret =ath11k_regd_update (ar);if (ret) {/* Firmware has already moved to the new regd. We need * to maintain channel consistency across FW, Host driver
drivers/net/wireless/ath/ath11k/reg.h +1 -1
@@ -31,6 +31,6 @@ void ath11k_regd_update_work(struct work_struct *work);struct ieee80211_regdomain *ath11k_reg_build_regd (struct ath11k_base *ab,struct cur_regulatory_info *reg_info,bool intersect); -int ath11k_regd_update (struct ath11k *ar,bool init); +int ath11k_regd_update (struct ath11k *ar);int ath11k_reg_update_chan_list (struct ath11k *ar);#endif
drivers/net/wireless/ath/ath11k/wmi.c +6 -10
@@ -5841,10 +5841,10 @@ static int ath11k_reg_chan_list_event(struct ath11k_base *ab, struct sk_buff *sk }spin_lock (&ab->base_lock); -if (test_bit (ATH11K_FLAG_REGISTERED , &ab->dev_flags)) { -/* Once mac is registered, ar is valid and all CC events from -* fw is considered to be received due to user requests -* currently. +if (ab->default_regd[pdev_idx]) { +/* The initial rules from FW after WMI Init is to build +* the default regd. From then on, any rules updated for +* the pdev could be due to user reg changes. * Free previously built regd before assigning the newly * generated regd to ar. NULL pointer handling will be * taken care by kfree itself.
@@ -5854,13 +5854,9 @@ static int ath11k_reg_chan_list_event(struct ath11k_base *ab, struct sk_buff *sk ab->new_regd[pdev_idx] = regd;ieee80211_queue_work (ar->hw, &ar->regd_update_work); }else { -/* Multiple events for the same *ar is not expected. But we -* can still clear any previously stored default_regd if we -* are receiving this event for the same radio by mistake. -* NULL pointer handling will be taken care by kfree itself. +/* This regd would be applied during mac registration and is +* held constant throughout for regd intersection purpose */ -kfree (ab->default_regd[pdev_idx]); -/* This regd would be applied during mac registration */ ab->default_regd[pdev_idx] = regd; } ab->dfs_region = reg_info->dfs_region;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 368/917 ath11k: fix packet drops due to incorrect 6 GHz freq value in rx status
In reply to Greg Kroah-HartmanFrom: Pradeep Kumar Chitrapu <[email protected]>
[ Upstream commit 9d6ae1f5cf733c0e8d7f904c501fd015c4b9f0f4 ]
Frequency in rx status is being filled incorrectly in the 6 GHz band as channel number received is invalid in this case which is causing packet drops. So fix that.
--- drivers/net/wireless/ath/ath11k/dp_rx.c | 9 ++++++--- drivers/net/wireless/ath/ath11k/wmi.c | 10 +++++++--- 2 files changed, 13 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath11k/dp_rx.c +6 -3
@@ -2337,8 +2337,10 @@ static void ath11k_dp_rx_h_ppdu(struct ath11k *ar, struct hal_rx_desc *rx_desc, channel_num = meta_data; center_freq = meta_data >>16 ; -if (center_freq >=5935 && center_freq <=7105 ) { +if (center_freq >=ATH11K_MIN_6G_FREQ && + center_freq <=ATH11K_MAX_6G_FREQ ) { rx_status->band =NL80211_BAND_6GHZ ; + rx_status->freq = center_freq; }else if (channel_num >=1 && channel_num <=14 ) { rx_status->band =NL80211_BAND_2GHZ ; }else if (channel_num >=36 && channel_num <=173 ) {
@@ -2356,8 +2358,9 @@ static void ath11k_dp_rx_h_ppdu(struct ath11k *ar, struct hal_rx_desc *rx_desc, rx_desc, sizeof(struct hal_rx_desc)); } - rx_status->freq =ieee80211_channel_to_frequency (channel_num, - rx_status->band); +if (rx_status->band !=NL80211_BAND_6GHZ ) + rx_status->freq =ieee80211_channel_to_frequency (channel_num, + rx_status->band);ath11k_dp_rx_h_rate (ar, rx_desc, rx_status); }
drivers/net/wireless/ath/ath11k/wmi.c +7 -3
@@ -6127,8 +6127,10 @@ static void ath11k_mgmt_rx_event(struct ath11k_base *ab, struct sk_buff *skb)if (rx_ev.status &WMI_RX_STATUS_ERR_MIC ) status->flag |=RX_FLAG_MMIC_ERROR ; -if (rx_ev.chan_freq >=ATH11K_MIN_6G_FREQ ) { +if (rx_ev.chan_freq >=ATH11K_MIN_6G_FREQ && + rx_ev.chan_freq <=ATH11K_MAX_6G_FREQ ) { status->band =NL80211_BAND_6GHZ ; + status->freq = rx_ev.chan_freq; }else if (rx_ev.channel >=1 && rx_ev.channel <=14 ) { status->band =NL80211_BAND_2GHZ ; }else if (rx_ev.channel >=36 && rx_ev.channel <=ATH11K_MAX_5G_CHAN ) {
@@ -6149,8 +6151,10 @@ static void ath11k_mgmt_rx_event(struct ath11k_base *ab, struct sk_buff *skb) sband = &ar->mac.sbands[status->band]; - status->freq =ieee80211_channel_to_frequency (rx_ev.channel, - status->band); +if (status->band !=NL80211_BAND_6GHZ ) + status->freq =ieee80211_channel_to_frequency (rx_ev.channel, + status->band); + status->signal = rx_ev.snr +ATH11K_DEFAULT_NOISE_FLOOR ; status->rate_idx =ath11k_mac_bitrate_to_idx (sband, rx_ev.rate /100 );
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 369/917 ath11k: Fix memory leak in ath11k_qmi_driver_event_work
In reply to Greg Kroah-HartmanFrom: Baochen Qiang <[email protected]>
[ Upstream commit 72de799aa9e3e064b35238ef053d2f0a49db055a ]
The buffer pointed to by event is not freed in case ATH11K_FLAG_UNREGISTERING bit is set, resulting in memory leak, so fix it.
Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1
--- drivers/net/wireless/ath/ath11k/qmi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath11k/qmi.c +3 -1
@@ -2707,8 +2707,10 @@ static void ath11k_qmi_driver_event_work(struct work_struct *work)list_del (&event->list);spin_unlock (&qmi->event_lock); -if (test_bit (ATH11K_FLAG_UNREGISTERING , &ab->dev_flags)) +if (test_bit (ATH11K_FLAG_UNREGISTERING , &ab->dev_flags)) { +kfree (event);return ; + }switch (event->type) {case ATH11K_QMI_EVENT_SERVER_ARRIVE :
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 370/917 gve: DQO: avoid unused variable warnings
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 1e0083bd0777e4a418a6710d9ee04b979cdbe5cc ]
The use of dma_unmap_addr()/dma_unmap_len() in the driver causes multiple warnings when these macros are defined as empty, e.g. in an ARCH=i386 allmodconfig build:
drivers/net/ethernet/google/gve/gve_tx_dqo.c: In function 'gve_tx_add_skb_no_copy_dqo':drivers/net/ethernet/google/gve/gve_tx_dqo.c:494:40: error: unused variable 'buf' [-Werror=unused-variable]
494 | struct gve_tx_dma_buf *buf =
This is not how the NEED_DMA_MAP_STATE macros are meant to work, as they rely on never using local variables or a temporary structure like gve_tx_dma_buf.
Remote the gve_tx_dma_buf definition and open-code the contents in all places to avoid the warning. This causes some rather long lines but otherwise ends up making the driver slightly smaller.
--- drivers/net/ethernet/google/gve/gve.h | 13 ++- drivers/net/ethernet/google/gve/gve_tx.c | 23 +++--- drivers/net/ethernet/google/gve/gve_tx_dqo.c | 84 +++++++++----------- 3 files changed, 54 insertions(+), 66 deletions(-)
drivers/net/ethernet/google/gve/gve.h +6 -7
@@ -224,11 +224,6 @@ struct gve_tx_iovec {u32 iov_padding;/* padding associated with this segment */ }; -struct gve_tx_dma_buf { -DEFINE_DMA_UNMAP_ADDR (dma); -DEFINE_DMA_UNMAP_LEN (len); -}; -/* Tracks the memory in the fifo occupied by the skb. Mapped 1:1 to a desc * ring entry but only used for a pkt_desc not a seg_desc */
@@ -236,7 +231,10 @@ struct gve_tx_buffer_state {struct sk_buff *skb;/* skb for this pkt */ union {struct gve_tx_iovec iov[GVE_TX_MAX_IOVEC ];/* segments of this pkt */ -struct gve_tx_dma_buf buf; +struct { +DEFINE_DMA_UNMAP_ADDR (dma); +DEFINE_DMA_UNMAP_LEN (len); + }; }; };
@@ -280,7 +278,8 @@ struct gve_tx_pending_packet_dqo {* All others correspond to `skb`'s frags and should be unmapped with * `dma_unmap_page`. */ -struct gve_tx_dma_buf bufs[MAX_SKB_FRAGS +1 ]; +DEFINE_DMA_UNMAP_ADDR (dma[MAX_SKB_FRAGS +1 ]); +DEFINE_DMA_UNMAP_LEN (len[MAX_SKB_FRAGS +1 ]);u16 num_bufs;/* Linked list index to next element in the list, or -1 if none */
drivers/net/ethernet/google/gve/gve_tx.c +10 -13
@@ -303,15 +303,15 @@ static inline int gve_skb_fifo_bytes_required(struct gve_tx_ring *tx,static void gve_tx_unmap_buf (struct device *dev,struct gve_tx_buffer_state *info) {if (info->skb) { -dma_unmap_single (dev,dma_unmap_addr (&info->buf, dma), -dma_unmap_len (&info->buf, len), +dma_unmap_single (dev,dma_unmap_addr (info, dma), +dma_unmap_len (info, len),DMA_TO_DEVICE ); -dma_unmap_len_set (&info->buf, len,0 ); +dma_unmap_len_set (info, len,0 ); }else { -dma_unmap_page (dev,dma_unmap_addr (&info->buf, dma), -dma_unmap_len (&info->buf, len), +dma_unmap_page (dev,dma_unmap_addr (info, dma), +dma_unmap_len (info, len),DMA_TO_DEVICE ); -dma_unmap_len_set (&info->buf, len,0 ); +dma_unmap_len_set (info, len,0 ); } }
@@ -491,7 +491,6 @@ static int gve_tx_add_skb_no_copy(struct gve_priv *priv, struct gve_tx_ring *tx,struct gve_tx_buffer_state *info;bool is_gso =skb_is_gso (skb);u32 idx = tx->req & tx->mask; -struct gve_tx_dma_buf *buf;u64 addr;u32 len;int i;
@@ -515,9 +514,8 @@ static int gve_tx_add_skb_no_copy(struct gve_priv *priv, struct gve_tx_ring *tx, tx->dma_mapping_error++; goto drop; } - buf = &info->buf; -dma_unmap_len_set (buf, len, len); -dma_unmap_addr_set (buf, dma, addr); +dma_unmap_len_set (info, len, len); +dma_unmap_addr_set (info, dma, addr); payload_nfrags = shinfo->nr_frags;if (hlen < len) {
@@ -549,10 +547,9 @@ static int gve_tx_add_skb_no_copy(struct gve_priv *priv, struct gve_tx_ring *tx, tx->dma_mapping_error++; goto unmap_drop; } - buf = &tx->info[idx].buf; tx->info[idx].skb =NULL ; -dma_unmap_len_set (buf, len, len); -dma_unmap_addr_set (buf, dma, addr); +dma_unmap_len_set (&tx->info[idx], len, len); +dma_unmap_addr_set (&tx->info[idx], dma, addr);gve_tx_fill_seg_desc (seg_desc, skb, is_gso, len, addr); }
drivers/net/ethernet/google/gve/gve_tx_dqo.c +38 -46
160 lines not on this page · raw message
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 371/917 ath10k: Fix missing frame timestamp for beacon/probe-resp
In reply to Greg Kroah-HartmanFrom: Loic Poulain <[email protected]>
[ Upstream commit e6dfbc3ba90cc2b619229be56b485f085a0a8e1c ]
When receiving a beacon or probe response, we should update the boottime_ns field which is the timestamp the frame was received at. (cf mac80211.h)
This fixes a scanning issue with Android since it relies on this timestamp to determine when the AP has been seen for the last time (via the nl80211 BSS_LAST_SEEN_BOOTTIME parameter).
--- drivers/net/wireless/ath/ath10k/wmi.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/ath/ath10k/wmi.c +4 -0
@@ -2610,6 +2610,10 @@ int ath10k_wmi_event_mgmt_rx(struct ath10k *ar, struct sk_buff *skb)if (ieee80211_is_beacon (hdr->frame_control))ath10k_mac_handle_beacon (ar, skb); +if (ieee80211_is_beacon (hdr->frame_control) || +ieee80211_is_probe_resp (hdr->frame_control)) + status->boottime_ns =ktime_get_boottime_ns (); + ath10k_dbg(ar, ATH10K_DBG_MGMT, "event mgmt rx skb %pK len %d ftype %02x stype %02x\n", skb, skb->len,
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 372/917 ath10k: sdio: Add missing BH locking around napi_schdule()
In reply to Greg Kroah-HartmanFrom: Fabio Estevam <[email protected]>
[ Upstream commit 019edd01d174ce4bb2e517dd332922514d176601 ]
On a i.MX-based board with a QCA9377 Wifi chip, the following errors are seen after launching the 'hostapd' application:
hostapd /etc/wifi.conf
Configuration file: /etc/wifi.conf
wlan0: interface state UNINITIALIZED->COUNTRY_UPDATE
NOHZ tick-stop error: Non-RCU local softirq work is pending, handler #08!!! Using interface wlan0 with hwaddr 00:1f:7b:31:04:a0 and ssid "thessid"
IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
wlan0: interface state COUNTRY_UPDATE->ENABLED
wlan0: AP-ENABLED
NOHZ tick-stop error: Non-RCU local softirq work is pending, handler #08!!! NOHZ tick-stop error: Non-RCU local softirq work is pending, handler #08!!! NOHZ tick-stop error: Non-RCU local softirq work is pending, handler #08!!! NOHZ tick-stop error: Non-RCU local softirq work is pending, handler #08!!!
...
Fix this problem by adding the BH locking around napi-schedule(), in the same way it was done in commit e63052a5dd3c ("mlx5e: add add missing BH locking around napi_schdule()").
Its commit log provides the following explanation:
"It's not correct to call napi_schedule() in pure process context. Because we use __raise_softirq_irqoff() we require callers to be in a context which will eventually lead to softirq handling (hardirq, bh disabled, etc.).
With code as is users will see:
NOHZ tick-stop error: Non-RCU local softirq work is pending, handler #08!!! "
--- drivers/net/wireless/ath/ath10k/sdio.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/sdio.c +4 -1
@@ -1363,8 +1363,11 @@ static void ath10k_rx_indication_async_work(struct work_struct *work) ep->ep_ops.ep_rx_complete (ar, skb); } -if (test_bit (ATH10K_FLAG_CORE_REGISTERED , &ar->dev_flags)) +if (test_bit (ATH10K_FLAG_CORE_REGISTERED , &ar->dev_flags)) { +local_bh_disable ();napi_schedule (&ar->napi); +local_bh_enable (); + } }static int ath10k_sdio_read_rtc_state (struct ath10k_sdio *ar_sdio,unsigned char *state)
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 373/917 drm/ttm: stop calling tt_swapin in vm_access
In reply to Greg Kroah-HartmanFrom: Matthew Auld <[email protected]>
[ Upstream commit f5d28856b89baab4232a9f841e565763fcebcdf9 ]
In commit:
commit 09ac4fcb3f255e9225967c75f5893325c116cdbe
Author: Felix Kuehling <[email protected]> Date: Thu Jul 13 17:01:16 2017 -0400
drm/ttm: Implement vm_operations_struct.access v2
we added the vm_access hook, where we also directly call tt_swapin for some reason. If something is swapped-out then the ttm_tt must also be unpopulated, and since access_kmap should also call tt_populate, if needed, then swapping-in will already be handled there.
If anything, calling tt_swapin directly here would likely always fail since the tt->pages won't yet be populated, or worse since the tt->pages array is never actually cleared in unpopulate this might lead to a nasty uaf.
--- drivers/gpu/drm/ttm/ttm_bo_vm.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/gpu/drm/ttm/ttm_bo_vm.c +0 -5
@@ -519,11 +519,6 @@ int ttm_bo_vm_access(struct vm_area_struct *vma, unsigned long addr,switch (bo->resource->mem_type) {case TTM_PL_SYSTEM : -if (unlikely (bo->ttm->page_flags &TTM_PAGE_FLAG_SWAPPED )) { - ret =ttm_tt_swapin (bo->ttm); -if (unlikely (ret !=0 )) -return ret; - } fallthrough;case TTM_PL_TT : ret =ttm_bo_vm_access_kmap (bo, offset, buf, len, write);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 374/917 arm64: mm: update max_pfn after memory hotplug
In reply to Greg Kroah-HartmanFrom: Sudarshan Rajagopalan <[email protected]>
[ Upstream commit 8fac67ca236b961b573355e203dbaf62a706a2e5 ]
After new memory blocks have been hotplugged, max_pfn and max_low_pfn needs updating to reflect on new PFNs being hot added to system. Without this patch, debug-related functions that use max_pfn such as get_max_dump_pfn() or read_page_owner() will not work with any page in memory that is hot-added after boot.
--- arch/arm64/mm/mmu.c | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm64/mm/mmu.c +5 -0
@@ -1499,6 +1499,11 @@ int arch_add_memory(int nid, u64 start, u64 size,if (ret)__remove_pgd_mapping (swapper_pg_dir,__phys_to_virt (start), size); +else { + max_pfn =PFN_UP (start + size); + max_low_pfn = max_pfn; + } +return ret; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 375/917 drm/amdgpu: fix warning for overflow check
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 335aea75b0d95518951cad7c4c676e6f1c02c150 ]
The overflow check in amdgpu_bo_list_create() causes a warning with clang-14 on 64-bit architectures, since the limit can never be exceeded.
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c:74:18: error: result of comparison of constant 256204778801521549 with expression of type 'unsigned int' is always false [-Werror,-Wtautological-constant-out-of-range-compare]
if (num_entries > (SIZE_MAX - sizeof(struct amdgpu_bo_list))
~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The check remains useful for 32-bit architectures, so just avoid the warning by using size_t as the type for the count.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c +1 -1
@@ -61,7 +61,7 @@ static void amdgpu_bo_list_free(struct kref *ref)int amdgpu_bo_list_create (struct amdgpu_device *adev,struct drm_file *filp,struct drm_amdgpu_bo_list_entry *info, -unsigned num_entries,struct amdgpu_bo_list **result) +size_t num_entries,struct amdgpu_bo_list **result) {unsigned last_entry =0 , first_userptr = num_entries;struct amdgpu_bo_list_entry *array;
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.h +1 -1
@@ -61,7 +61,7 @@ int amdgpu_bo_create_list_entry_array(struct drm_amdgpu_bo_list_in *in,int amdgpu_bo_list_create (struct amdgpu_device *adev,struct drm_file *filp,struct drm_amdgpu_bo_list_entry *info, -unsigned num_entries, +size_t num_entries,struct amdgpu_bo_list **list); static inline struct amdgpu_bo_list_entry *
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 376/917 libbpf: Fix skel_internal.h to set errno on loader retval < 0
In reply to Greg Kroah-HartmanFrom: Kumar Kartikeya Dwivedi <[email protected]>
[ Upstream commit e68ac0082787f4e8ee6ae5b19076ec7709ce715b ]
When the loader indicates an internal error (result of a checked bpf system call), it returns the result in attr.test.retval. However, tests that rely on ASSERT_OK_PTR on NULL (returned from light skeleton) may miss that NULL denotes an error if errno is set to 0. This would result in skel pointer being NULL, while ASSERT_OK_PTR returning 1, leading to a SEGV on dereference of skel, because libbpf_get_error relies on the assumption that errno is always set in case of error for ptr == NULL.
In particular, this was observed for the ksyms_module test. When executed using ./test_progs -t ksyms, prior tests manipulated errno and the test didn't crash when it failed at ksyms_module load, while using ./test_progs -t ksyms_module crashed due to errno being untouched.
--- tools/lib/bpf/skel_internal.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
tools/lib/bpf/skel_internal.h +4 -2
@@ -105,10 +105,12 @@ static inline int bpf_load_and_run(struct bpf_load_and_run_opts *opts) err =skel_sys_bpf (BPF_PROG_RUN , &attr,sizeof (attr));if (err <0 || (int )attr.test.retval <0 ) { opts->errstr ="failed to execute loader prog" ; -if (err <0 ) +if (err <0 ) { err = -errno; -else + }else { err = (int )attr.test.retval; + errno = -err; + } goto out; } err =0 ;
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 377/917 media: em28xx: add missing em28xx_close_extension
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit 2c98b8a3458df03abdc6945bbef67ef91d181938 ]
If em28xx dev has ->dev_next pointer, we need to delete ->dev_next list node from em28xx_extension_devlist on disconnect to avoid UAF bugs and corrupted list bugs, since driver frees this pointer on disconnect.
--- drivers/media/usb/em28xx/em28xx-cards.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/media/usb/em28xx/em28xx-cards.c +4 -1
@@ -4139,8 +4139,11 @@ static void em28xx_usb_disconnect(struct usb_interface *intf)em28xx_close_extension (dev); -if (dev->dev_next) +if (dev->dev_next) { +em28xx_close_extension (dev->dev_next);em28xx_release_resources (dev->dev_next); + } +em28xx_release_resources (dev);if (dev->dev_next) {
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 378/917 media: meson-ge2d: Fix rotation parameter changes detection in ge2d_s_ctrl()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 4b9e3e8af4b336eefca1f1ee535bc4b6734ed6aa ]
There is likely a typo here. To be consistent, we should compare 'fmt.height' with 'ctx->out.pix_fmt.height', not 'ctx->out.pix_fmt.width'.
Instead of fixing the test, just remove it and copy 'fmt' unconditionally.
--- drivers/media/platform/meson/ge2d/ge2d.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/media/platform/meson/ge2d/ge2d.c +1 -5
@@ -779,11 +779,7 @@ static int ge2d_s_ctrl(struct v4l2_ctrl *ctrl)* If the rotation parameter changes the OUTPUT frames * parameters, take them in account */ -if (fmt.width != ctx->out.pix_fmt.width || - fmt.height != ctx->out.pix_fmt.width || - fmt.bytesperline > ctx->out.pix_fmt.bytesperline || - fmt.sizeimage > ctx->out.pix_fmt.sizeimage) - ctx->out.pix_fmt = fmt; + ctx->out.pix_fmt = fmt;break ; }
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 379/917 media: cxd2880-spi: Fix a null pointer dereference on error handling path
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 11b982e950d2138e90bd120501df10a439006ff8 ]
Currently the null pointer check on dvb_spi->vcc_supply is inverted and this leads to only null values of the dvb_spi->vcc_supply being passed to the call of regulator_disable causing null pointer dereferences. Fix this by only calling regulator_disable if dvb_spi->vcc_supply is not null.
Addresses-Coverity: ("Dereference after null check")
--- drivers/media/spi/cxd2880-spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/spi/cxd2880-spi.c +1 -1
@@ -618,7 +618,7 @@ fail_frontend: fail_attach:dvb_unregister_adapter (&dvb_spi->adapter); fail_adapter: -if (!dvb_spi->vcc_supply) +if (dvb_spi->vcc_supply)regulator_disable (dvb_spi->vcc_supply); fail_regulator:kfree (dvb_spi);
Signature · 1 line
2.33.0
Greg Kroah-Hartman
maintainerPATCH 380/917 media: ttusb-dec: avoid release of non-acquired mutex
In reply to Greg Kroah-HartmanFrom: Evgeny Novikov <[email protected]>
[ Upstream commit 36b9d695aa6fb8e9a312db21af41f90824d16ab4 ]
ttusb_dec_send_command() invokes mutex_lock_interruptible() that can fail but then it releases the non-acquired mutex. The patch fixes that.
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/media/usb/ttusb-dec/ttusb_dec.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/media/usb/ttusb-dec/ttusb_dec.c +5 -5
@@ -327,7 +327,7 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command, result =mutex_lock_interruptible (&dec->usb_mutex);if (result) {printk ("%s: Failed to lock usb mutex.\n" , __func__); - goto err; + goto err_free; } b[0 ] =0xaa ;
@@ -349,7 +349,7 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command,if (result) {printk ("%s: command bulk message failed: error %d\n" , __func__, result); - goto err; + goto err_mutex_unlock; } result = usb_bulk_msg(dec->udev, dec->result_pipe, b,
@@ -358,7 +358,7 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command,if (result) {printk ("%s: result bulk message failed: error %d\n" , __func__, result); - goto err; + goto err_mutex_unlock; }else {if (debug) { printk(KERN_DEBUG "%s: result: %*ph\n",
@@ -371,9 +371,9 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command,memcpy (cmd_result, &b[4 ], b[3 ]); } -err: +err_mutex_unlock:mutex_unlock (&dec->usb_mutex); - +err_free:kfree (b);return result; }
Signature · 1 line
2.33.0