iommu/vt-d: Add RPLS to quirk list to skip TE disabling
Subsystems (29)
Sasha Levin
maintainerPATCH 1/76 iommu/vt-d: Add RPLS to quirk list to skip TE disabling
From: Tejas Upadhyay <[email protected]>
[ Upstream commit 0a967f5bfd9134b89681cae58deb222e20840e76 ]
The VT-d spec requires (10.4.4 Global Command Register, TE field) that:
Hardware implementations supporting DMA draining must drain any in-flight DMA read/write requests queued within the Root-Complex before completing the translation enable command and reflecting the status of the command through the TES field in the Global Status register.
Unfortunately, some integrated graphic devices fail to do so after some kind of power state transition. As the result, the system might stuck in iommu_disable_translati on(), waiting for the completion of TE transition.
This adds RPLS to a quirk list for those devices and skips TE disabling if the qurik hits.
--- drivers/iommu/intel/iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/intel/iommu.c +1 -1
@@ -6296,7 +6296,7 @@ static void quirk_igfx_skip_te_disable(struct pci_dev *dev) ver = (dev->device >>8 ) &0xff ;if (ver !=0x45 && ver !=0x46 && ver !=0x4c && ver !=0x4e && ver !=0x8a && ver !=0x98 && - ver !=0x9a ) + ver !=0x9a && ver !=0xa7 )return ;if (risky_device (dev))
Signature · 6 lines
2.35.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Sasha Levin
maintainerPATCH 2/76 drm/virtio: fix NULL pointer dereference in virtio_gpu_conn_get_modes
From: Liu Zixian <[email protected]>
[ Upstream commit 194d250cdc4a40ccbd179afd522a9e9846957402 ]
drm_cvt_mode may return NULL and we should check it.
This bug is found by syzkaller:
FAULT_INJECTION stacktrace:
[ 168.567394] FAULT_INJECTION: forcing a failure. name failslab, interval 1, probability 0, space 0, times 1 [ 168.567403] CPU: 1 PID: 6425 Comm: syz Kdump: loaded Not tainted 4.19.90-vhulk2201.1.0.h1035.kasan.eulerosv2r10.aarch64 #1 [ 168.567406] Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015 [ 168.567408] Call trace: [ 168.567414] dump_backtrace+0x0/0x310 [ 168.567418] show_stack+0x28/0x38 [ 168.567423] dump_stack+0xec/0x15c [ 168.567427] should_fail+0x3ac/0x3d0 [ 168.567437] __should_failslab+0xb8/0x120 [ 168.567441] should_failslab+0x28/0xc0 [ 168.567445] kmem_cache_alloc_trace+0x50/0x640 [ 168.567454] drm_mode_create+0x40/0x90 [ 168.567458] drm_cvt_mode+0x48/0xc78 [ 168.567477] virtio_gpu_conn_get_modes+0xa8/0x140 [virtio_gpu] [ 168.567485] drm_helper_probe_single_connector_modes+0x3a4/0xd80 [ 168.567492] drm_mode_getconnector+0x2e0/0xa70 [ 168.567496] drm_ioctl_kernel+0x11c/0x1d8 [ 168.567514] drm_ioctl+0x558/0x6d0 [ 168.567522] do_vfs_ioctl+0x160/0xf30 [ 168.567525] ksys_ioctl+0x98/0xd8 [ 168.567530] __arm64_sys_ioctl+0x50/0xc8 [ 168.567536] el0_svc_common+0xc8/0x320 [ 168.567540] el0_svc_handler+0xf8/0x160 [ 168.567544] el0_svc+0x10/0x218
KASAN stacktrace:
[ 168.567561] BUG: KASAN: null-ptr-deref in virtio_gpu_conn_get_modes+0xb4/0x140 [virtio_gpu] [ 168.567565] Read of size 4 at addr 0000000000000054 by task syz/6425 [ 168.567566] [ 168.567571] CPU: 1 PID: 6425 Comm: syz Kdump: loaded Not tainted 4.19.90-vhulk2201.1.0.h1035.kasan.eulerosv2r10.aarch64 #1 [ 168.567573] Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015 [ 168.567575] Call trace: [ 168.567578] dump_backtrace+0x0/0x310 [ 168.567582] show_stack+0x28/0x38 [ 168.567586] dump_stack+0xec/0x15c [ 168.567591] kasan_report+0x244/0x2f0 [ 168.567594] __asan_load4+0x58/0xb0 [ 168.567607] virtio_gpu_conn_get_modes+0xb4/0x140 [virtio_gpu] [ 168.567612] drm_helper_probe_single_connector_modes+0x3a4/0xd80 [ 168.567617] drm_mode_getconnector+0x2e0/0xa70 [ 168.567621] drm_ioctl_kernel+0x11c/0x1d8 [ 168.567624] drm_ioctl+0x558/0x6d0 [ 168.567628] do_vfs_ioctl+0x160/0xf30 [ 168.567632] ksys_ioctl+0x98/0xd8 [ 168.567636] __arm64_sys_ioctl+0x50/0xc8 [ 168.567641] el0_svc_common+0xc8/0x320 [ 168.567645] el0_svc_handler+0xf8/0x160 [ 168.567649] el0_svc+0x10/0x218
--- drivers/gpu/drm/virtio/virtgpu_display.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/virtio/virtgpu_display.c +2 -0
@@ -177,6 +177,8 @@ static int virtio_gpu_conn_get_modes(struct drm_connector *connector)DRM_DEBUG ("add mode: %dx%d\n" , width, height); mode =drm_cvt_mode (connector->dev, width, height,60 , false, false, false); +if (!mode) +return count; mode->type |=DRM_MODE_TYPE_PREFERRED ;drm_mode_probed_add (connector, mode); count++;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 3/76 selftests/bpf: Fix vfs_link kprobe definition
In reply to Sasha LevinFrom: Nikolay Borisov <[email protected]>
[ Upstream commit e299bcd4d16ff86f46c48df1062c8aae0eca1ed8 ]
Since commit 6521f8917082 ("namei: prepare for idmapped mounts") vfs_link's prototype was changed, the kprobe definition in profiler selftest in turn wasn't updated. The result is that all argument after the first are now stored in different registers. This means that self-test has been broken ever since. Fix it by updating the kprobe definition accordingly.
--- tools/testing/selftests/bpf/progs/profiler.inc.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/progs/profiler.inc.h +3 -2
@@ -826,8 +826,9 @@ int kprobe_ret__do_filp_open(struct pt_regs* ctx) SEC("kprobe/vfs_link")int BPF_KPROBE (kprobe__vfs_link , -struct dentry * old_dentry,struct inode * dir, -struct dentry * new_dentry,struct inode ** delegated_inode) +struct dentry * old_dentry,struct user_namespace *mnt_userns, +struct inode * dir,struct dentry * new_dentry, +struct inode ** delegated_inode) {struct bpf_func_stats_ctx stats_ctx;bpf_stats_enter (&stats_ctx, profiler_bpf_vfs_link);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 4/76 mwifiex: add mutex lock for call in mwifiex_dfs_chan_sw_work_queue
In reply to Sasha LevinFrom: Niels Dossche <[email protected]>
[ Upstream commit 3e12968f6d12a34b540c39cbd696a760cc4616f0 ]
cfg80211_ch_switch_notify uses ASSERT_WDEV_LOCK to assert that net_device->ieee80211_ptr->mtx (which is the same as priv->wdev.mtx) is held during the function's execution. mwifiex_dfs_chan_sw_work_queue is one of its callers, which does not hold that lock, therefore violating the assertion.
Add a lock around the call.
Disclaimer:
I am currently working on a static analyser to detect missing locks. This was a reported case. I manually verified the report by looking at the code, so that I do not send wrong information or patches. After concluding that this seems to be a true positive, I created this patch.
However, as I do not in fact have this particular hardware, I was unable to test it.
--- drivers/net/wireless/marvell/mwifiex/11h.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/marvell/mwifiex/11h.c +2 -0
@@ -303,5 +303,7 @@ void mwifiex_dfs_chan_sw_work_queue(struct work_struct *work)mwifiex_dbg (priv->adapter,MSG ,"indicating channel switch completion to kernel\n" ); +mutex_lock (&priv->wdev.mtx);cfg80211_ch_switch_notify (priv->netdev, &priv->dfs_chandef); +mutex_unlock (&priv->wdev.mtx); }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 5/76 b43legacy: Fix assigning negative value to unsigned variable
In reply to Sasha LevinFrom: Haowen Bai <[email protected]>
[ Upstream commit 3f6b867559b3d43a7ce1b4799b755e812fc0d503 ]
fix warning reported by smatch:drivers/net/wireless/broadcom/b43legacy/phy.c:1181 b43legacy_phy_lo_b_measure()
warn: assigning (-772) to unsigned variable 'fval'
--- drivers/net/wireless/broadcom/b43legacy/phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/broadcom/b43legacy/phy.c +1 -1
@@ -1123,7 +1123,7 @@ void b43legacy_phy_lo_b_measure(struct b43legacy_wldev *dev)struct b43legacy_phy *phy = &dev->phy;u16 regstack[12 ] = {0 };u16 mls; -u16 fval; +s16 fval;int i;int j;
Signature · 7 lines
2.35.1 _______________________________________________ b43-dev mailing list [email protected] http://lists.infradead.org/mailman/listinfo/b43-dev
Sasha Levin
maintainerPATCH 6/76 b43: Fix assigning negative value to unsigned variable
In reply to Sasha LevinFrom: Haowen Bai <[email protected]>
[ Upstream commit 11800d893b38e0e12d636c170c1abc19c43c730c ]
fix warning reported by smatch:drivers/net/wireless/broadcom/b43/phy_n.c:585 b43_nphy_adjust_lna_gain_table()
warn: assigning (-2) to unsigned variable '*(lna_gain[0])'
--- drivers/net/wireless/broadcom/b43/phy_n.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/broadcom/b43/phy_n.c +1 -1
@@ -582,7 +582,7 @@ static void b43_nphy_adjust_lna_gain_table(struct b43_wldev *dev)u16 data[4 ];s16 gain[2 ];u16 minmax[2 ]; -static const u16 lna_gain[4 ] = {-2 ,10 ,19 ,25 }; +static const s16 lna_gain[4 ] = {-2 ,10 ,19 ,25 };if (nphy->hang_avoid)b43_nphy_stay_in_carrier_search (dev,1 );
Signature · 7 lines
2.35.1 _______________________________________________ b43-dev mailing list [email protected] http://lists.infradead.org/mailman/listinfo/b43-dev
Sasha Levin
maintainerPATCH 7/76 ipw2x00: Fix potential NULL dereference in libipw_xmit()
In reply to Sasha LevinFrom: Haowen Bai <[email protected]>
[ Upstream commit e8366bbabe1d207cf7c5b11ae50e223ae6fc278b ]
crypt and crypt->ops could be null, so we need to checking null before dereference
--- drivers/net/wireless/intel/ipw2x00/libipw_tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intel/ipw2x00/libipw_tx.c +1 -1
@@ -383,7 +383,7 @@ netdev_tx_t libipw_xmit(struct sk_buff *skb, struct net_device *dev)/* Each fragment may need to have room for encryption * pre/postfix */ -if (host_encrypt) +if (host_encrypt && crypt && crypt->ops) bytes_per_frag -= crypt->ops->extra_mpdu_prefix_len + crypt->ops->extra_mpdu_postfix_len;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 8/76 ipv6: fix locking issues with loops over idev->addr_list
In reply to Sasha LevinFrom: Niels Dossche <[email protected]>
[ Upstream commit 51454ea42c1ab4e0c2828bb0d4d53957976980de ]
idev->addr_list needs to be protected by idev->lock. However, it is not always possible to do so while iterating and performing actions on inet6_ifaddr instances. For example, multiple functions (like addrconf_{join,leave}_anycast) eventually call down to other functions that acquire the idev->lock. The current code temporarily unlocked the idev->lock during the loops, which can cause race conditions. Moving the locks up is also not an appropriate solution as the ordering of lock acquisition will be inconsistent with for example mc_lock.
This solution adds an additional field to inet6_ifaddr that is used to temporarily add the instances to a temporary list while holding idev->lock. The temporary list can then be traversed without holding idev->lock. This change was done in two places. In addrconf_ifdown, the list_for_each_entry_safe variant of the list loop is also no longer necessary as there is no deletion within that specific loop.
--- include/net/if_inet6.h | 8 ++++++++ net/ipv6/addrconf.c | 30 ++++++++++++++++++++++++------ 2 files changed, 32 insertions(+), 6 deletions(-)
include/net/if_inet6.h +8 -0
@@ -64,6 +64,14 @@ struct inet6_ifaddr {struct hlist_node addr_lst;struct list_head if_list; +/* +* Used to safely traverse idev->addr_list in process context +* if the idev->lock needed to protect idev->addr_list cannot be held. +* In that case, add the items to this list temporarily and iterate +* without holding idev->lock. +* See addrconf_ifdown and dev_forward_change. +*/ +struct list_head if_list_aux;struct list_head tmp_list;struct inet6_ifaddr *ifpub;
net/ipv6/addrconf.c +24 -6
@@ -789,6 +789,7 @@ static void dev_forward_change(struct inet6_dev *idev) {struct net_device *dev;struct inet6_ifaddr *ifa; +LIST_HEAD (tmp_addr_list);if (!idev)return ;
@@ -807,14 +808,24 @@ static void dev_forward_change(struct inet6_dev *idev) } } +read_lock_bh (&idev->lock);list_for_each_entry (ifa, &idev->addr_list, if_list) {if (ifa->flags&IFA_F_TENTATIVE )continue ; +list_add_tail (&ifa->if_list_aux, &tmp_addr_list); + } +read_unlock_bh (&idev->lock); + +while (!list_empty (&tmp_addr_list)) { + ifa =list_first_entry (&tmp_addr_list, + struct inet6_ifaddr, if_list_aux); +list_del (&ifa->if_list_aux);if (idev->cnf.forwarding)addrconf_join_anycast (ifa);else addrconf_leave_anycast (ifa); } +inet6_netconf_notify_devconf (dev_net (dev),RTM_NEWNETCONF ,NETCONFA_FORWARDING , dev->ifindex, &idev->cnf);
@@ -3710,7 +3721,8 @@ static int addrconf_ifdown(struct net_device *dev, bool unregister)unsigned long event = unregister ?NETDEV_UNREGISTER :NETDEV_DOWN ;struct net *net =dev_net (dev);struct inet6_dev *idev; -struct inet6_ifaddr *ifa, *tmp; +struct inet6_ifaddr *ifa; +LIST_HEAD (tmp_addr_list);bool keep_addr = false;bool was_ready;int state, i;
@@ -3802,16 +3814,23 @@ static int addrconf_ifdown(struct net_device *dev, bool unregister)write_lock_bh (&idev->lock); } -list_for_each_entry_safe (ifa, tmp, &idev->addr_list, if_list) { +list_for_each_entry (ifa, &idev->addr_list, if_list) +list_add_tail (&ifa->if_list_aux, &tmp_addr_list); +write_unlock_bh (&idev->lock); + +while (!list_empty (&tmp_addr_list)) {struct fib6_info *rt =NULL ;bool keep; + ifa =list_first_entry (&tmp_addr_list, + struct inet6_ifaddr, if_list_aux); +list_del (&ifa->if_list_aux); +addrconf_del_dad_work (ifa); keep = keep_addr && (ifa->flags &IFA_F_PERMANENT ) && !addr_is_local (&ifa->addr); -write_unlock_bh (&idev->lock);spin_lock_bh (&ifa->lock);if (keep) {
@@ -3842,15 +3861,14 @@ static int addrconf_ifdown(struct net_device *dev, bool unregister)addrconf_leave_solict (ifa->idev, &ifa->addr); } -write_lock_bh (&idev->lock);if (!keep) { +write_lock_bh (&idev->lock);list_del_rcu (&ifa->if_list); +write_unlock_bh (&idev->lock);in6_ifa_put (ifa); } } -write_unlock_bh (&idev->lock); -/* Step 5: Discard anycast and multicast list */ if (unregister) {ipv6_ac_destroy_dev (idev);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 9/76 fbcon: Consistently protect deferred_takeover with console_lock()
In reply to Sasha LevinFrom: Daniel Vetter <[email protected]>
[ Upstream commit 43553559121ca90965b572cf8a1d6d0fd618b449 ]
This shouldn't be a problem in practice since until we've actually taken over the console there's nothing we've registered with the console/vt subsystem, so the exit/unbind path that check this can't do the wrong thing. But it's confusing, so fix it by moving it a tad later.
--- drivers/video/fbdev/core/fbcon.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/video/fbdev/core/fbcon.c +3 -2
@@ -3300,6 +3300,9 @@ static void fbcon_register_existing_fbs(struct work_struct *work)console_lock (); + deferred_takeover = false; + logo_shown =FBCON_LOGO_DONTSHOW ; +for_each_registered_fb (i)fbcon_fb_registered (registered_fb[i]);
@@ -3317,8 +3320,6 @@ static int fbcon_output_notifier(struct notifier_block *nb,pr_info ("fbcon: Taking over console\n" );dummycon_unregister_output_notifier (&fbcon_output_nb); - deferred_takeover = false; - logo_shown =FBCON_LOGO_DONTSHOW ;/* We may get called in atomic context */ schedule_work (&fbcon_deferred_takeover_work);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 10/76 x86/platform/uv: Update TSC sync state for UV5
In reply to Sasha LevinFrom: Mike Travis <[email protected]>
[ Upstream commit bb3ab81bdbd53f88f26ffabc9fb15bd8466486ec ]
The UV5 platform synchronizes the TSCs among all chassis, and will not proceed to OS boot without achieving synchronization. Previous UV platforms provided a register indicating successful synchronization. This is no longer available on UV5. On this platform TSC_ADJUST should not be reset by the kernel.
--- arch/x86/kernel/apic/x2apic_uv_x.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
arch/x86/kernel/apic/x2apic_uv_x.c +7 -1
@@ -199,7 +199,13 @@ static void __init uv_tsc_check_sync(void)int mmr_shift;char *state; -/* Different returns from different UV BIOS versions */ +/* UV5 guarantees synced TSCs; do not zero TSC_ADJUST */ +if (!is_uv (UV2 |UV3 |UV4 )) { +mark_tsc_async_resets ("UV5+" ); +return ; + } + +/* UV2,3,4, UV BIOS TSC sync state available */ mmr =uv_early_read_mmr (UVH_TSC_SYNC_MMR ); mmr_shift =is_uv2_hub () ?UVH_TSC_SYNC_SHIFT_UV2K :UVH_TSC_SYNC_SHIFT ;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 11/76 ACPICA: Avoid cache flush inside virtual machines
In reply to Sasha LevinFrom: "Kirill A. Shutemov" <[email protected]>
[ Upstream commit e2efb6359e620521d1e13f69b2257de8ceaa9475 ]
While running inside virtual machine, the kernel can bypass cache flushing. Changing sleep state in a virtual machine doesn't affect the host system sleep state and cannot lead to data loss.
Before entering sleep states, the ACPI code flushes caches to prevent data loss using the WBINVD instruction. This mechanism is required on bare metal.
But, any use WBINVD inside of a guest is worthless. Changing sleep state in a virtual machine doesn't affect the host system sleep state and cannot lead to data loss, so most hypervisors simply ignore it. Despite this, the ACPI code calls WBINVD unconditionally anyway. It's useless, but also normally harmless.
In TDX guests, though, WBINVD stops being harmless; it triggers a virtualization exception (#VE). If the ACPI cache-flushing WBINVD were left in place, TDX guests would need handling to recover from the exception.
Avoid using WBINVD whenever running under a hypervisor. This both removes the useless WBINVDs and saves TDX from implementing WBINVD handling.
--- arch/x86/include/asm/acenv.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
arch/x86/include/asm/acenv.h +13 -1
@@ -13,7 +13,19 @@/* Asm macros */ -#define ACPI_FLUSH_CPU_CACHE () wbinvd() +/* +* ACPI_FLUSH_CPU_CACHE() flushes caches on entering sleep states. +* It is required to prevent data loss. +* +* While running inside virtual machine, the kernel can bypass cache flushing. +* Changing sleep state in a virtual machine doesn't affect the host system +* sleep state and cannot lead to data loss. +*/ +#define ACPI_FLUSH_CPU_CACHE () \ +do { \ + if (!cpu_feature_enabled(X86_FEATURE_HYPERVISOR)) \ + wbinvd(); \ +} while (0)int __acpi_acquire_global_lock (unsigned int *lock);int __acpi_release_global_lock (unsigned int *lock);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 12/76 drm/komeda: return early if drm_universal_plane_init() fails.
In reply to Sasha LevinFrom: Liviu Dudau <[email protected]>
[ Upstream commit c8f76c37cc3668ee45e081e76a15f24a352ebbdd ]
If drm_universal_plane_init() fails early we jump to the common cleanup code that calls komeda_plane_destroy() which in turn could access the uninitalised drm_plane and crash. Return early if an error is detected without going through the common code.
--- drivers/gpu/drm/arm/display/komeda/komeda_plane.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/arm/display/komeda/komeda_plane.c +4 -2
@@ -274,8 +274,10 @@ static int komeda_plane_add(struct komeda_kms_dev *kms,komeda_put_fourcc_list (formats); -if (err) - goto cleanup; +if (err) { +kfree (kplane); +return err; + }drm_plane_helper_add (plane, &komeda_plane_helper_funcs);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 13/76 rcu-tasks: Fix race in schedule and flush work
In reply to Sasha LevinFrom: Padmanabha Srinivasaiah <[email protected]>
[ Upstream commit f75fd4b9221d93177c50dcfde671b2e907f53e86 ]
While booting secondary CPUs, cpus_read_[lock/unlock] is not keeping online cpumask stable. The transient online mask results in below calltrace.
[ 0.324121] CPU1: Booted secondary processor 0x0000000001 [0x410fd083] [ 0.346652] Detected PIPT I-cache on CPU2 [ 0.347212] CPU2: Booted secondary processor 0x0000000002 [0x410fd083] [ 0.377255] Detected PIPT I-cache on CPU3 [ 0.377823] CPU3: Booted secondary processor 0x0000000003 [0x410fd083] [ 0.379040] ------------[ cut here ]------------ [ 0.383662] WARNING: CPU: 0 PID: 10 at kernel/workqueue.c:3084 __flush_work+0x12c/0x138 [ 0.384850] Modules linked in: [ 0.385403] CPU: 0 PID: 10 Comm: rcu_tasks_rude_ Not tainted 5.17.0-rc3-v8+ #13 [ 0.386473] Hardware name: Raspberry Pi 4 Model B Rev 1.4 (DT) [ 0.387289] pstate: 20000005 (nzCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 0.388308] pc : __flush_work+0x12c/0x138 [ 0.388970] lr : __flush_work+0x80/0x138 [ 0.389620] sp : ffffffc00aaf3c60 [ 0.390139] x29: ffffffc00aaf3d20 x28: ffffffc009c16af0 x27: ffffff80f761df48 [ 0.391316] x26: 0000000000000004 x25: 0000000000000003 x24: 0000000000000100 [ 0.392493] x23: ffffffffffffffff x22: ffffffc009c16b10 x21: ffffffc009c16b28 [ 0.393668] x20: ffffffc009e53861 x19: ffffff80f77fbf40 x18: 00000000d744fcc9 [ 0.394842] x17: 000000000000000b x16: 00000000000001c2 x15: ffffffc009e57550 [ 0.396016] x14: 0000000000000000 x13: ffffffffffffffff x12: 0000000100000000 [ 0.397190] x11: 0000000000000462 x10: ffffff8040258008 x9 : 0000000100000000 [ 0.398364] x8 : 0000000000000000 x7 : ffffffc0093c8bf4 x6 : 0000000000000000 [ 0.399538] x5 : 0000000000000000 x4 : ffffffc00a976e40 x3 : ffffffc00810444c [ 0.400711] x2 : 0000000000000004 x1 : 0000000000000000 x0 : 0000000000000000 [ 0.401886] Call trace: [ 0.402309] __flush_work+0x12c/0x138 [ 0.402941] schedule_on_each_cpu+0x228/0x278 [ 0.403693] rcu_tasks_rude_wait_gp+0x130/0x144 [ 0.404502] rcu_tasks_kthread+0x220/0x254 [ 0.405264] kthread+0x174/0x1ac [ 0.405837] ret_from_fork+0x10/0x20 [ 0.406456] irq event stamp: 102 [ 0.406966] hardirqs last enabled at (101): [<ffffffc0093c8468>] _raw_spin_unlock_irq+0x78/0xb4 [ 0.408304] hardirqs last disabled at (102): [<ffffffc0093b8270>] el1_dbg+0x24/0x5c [ 0.409410] softirqs last enabled at (54): [<ffffffc0081b80c8>] local_bh_enable+0xc/0x2c [ 0.410645] softirqs last disabled at (50): [<ffffffc0081b809c>] local_bh_disable+0xc/0x2c [ 0.411890] ---[ end trace 0000000000000000 ]--- [ 0.413000] smp: Brought up 1 node, 4 CPUs [ 0.413762] SMP: Total of 4 processors activated. [ 0.414566] CPU features: detected: 32-bit EL0 Support [ 0.415414] CPU features: detected: 32-bit EL1 Support [ 0.416278] CPU features: detected: CRC32 instructions [ 0.447021] Callback from call_rcu_tasks_rude() invoked. [ 0.506693] Callback from call_rcu_tasks() invoked.
This commit therefore fixes this issue by applying a single-CPU optimization to the RCU Tasks Rude grace-period process. The key point here is that the purpose of this RCU flavor is to force a schedule on each online CPU since some past event. But the rcu_tasks_rude_wait_gp() function runs in the context of the RCU Tasks Rude's grace-period kthread, so there must already have been a context switch on the current CPU since the call to either synchronize_rcu_tasks_rude() or call_rcu_tasks_rude(). So if there is only a single CPU online, RCU Tasks Rude's grace-period kthread does not need to anything at all.
It turns out that the rcu_tasks_rude_wait_gp() function's call to schedule_on_each_cpu() causes problems during early boot. During that time, there is only one online CPU, namely the boot CPU. Therefore, applying this single-CPU optimization fixes early-boot instances of this problem.
--- kernel/rcu/tasks.h | 3 +++ 1 file changed, 3 insertions(+)
kernel/rcu/tasks.h +3 -0
@@ -620,6 +620,9 @@ static void rcu_tasks_be_rude(struct work_struct *work)// Wait for one rude RCU-tasks grace period. static void rcu_tasks_rude_wait_gp (struct rcu_tasks *rtp) { +if (num_online_cpus () <=1 ) +return ;// Fastpath for only one CPU. + rtp->n_ipis +=cpumask_weight (cpu_online_mask);schedule_on_each_cpu (rcu_tasks_be_rude); }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 14/76 rcu: Make TASKS_RUDE_RCU select IRQ_WORK
In reply to Sasha LevinFrom: "Paul E. McKenney" <[email protected]>
[ Upstream commit 46e861be589881e0905b9ade3d8439883858721c ]
The TASKS_RUDE_RCU does not select IRQ_WORK, which can result in build failures for kernels that do not otherwise select IRQ_WORK. This commit therefore causes the TASKS_RUDE_RCU Kconfig option to select IRQ_WORK.
--- kernel/rcu/Kconfig | 1 + 1 file changed, 1 insertion(+)
kernel/rcu/Kconfig +1 -0
@@ -86,6 +86,7 @@ config TASKS_RCU config TASKS_RUDE_RCU def_bool 0 + select IRQ_WORK help This option enables a task-based RCU implementation that uses only context switch (including preemption) and user-mode
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 15/76 sfc: ef10: Fix assigning negative value to unsigned variable
In reply to Sasha LevinFrom: Haowen Bai <[email protected]>
[ Upstream commit b8ff3395fbdf3b79a99d0ef410fc34c51044121e ]
fix warning reported by smatch:
251 drivers/net/ethernet/sfc/ef10.c:2259 efx_ef10_tx_tso_desc()
warn: assigning (-208) to unsigned variable 'ip_tot_len'
--- drivers/net/ethernet/sfc/ef10.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/sfc/ef10.c +1 -1
@@ -2240,7 +2240,7 @@ int efx_ef10_tx_tso_desc(struct efx_tx_queue *tx_queue, struct sk_buff *skb,* guaranteed to satisfy the second as we only attempt TSO if * inner_network_header <= 208. */ - ip_tot_len = -EFX_TSO2_MAX_HDRLEN ; + ip_tot_len =0x10000 -EFX_TSO2_MAX_HDRLEN ;EFX_WARN_ON_ONCE_PARANOID (mss +EFX_TSO2_MAX_HDRLEN + (tcp->doff <<2u ) > ip_tot_len);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 16/76 ALSA: jack: Access input_dev under mutex
In reply to Sasha LevinFrom: Amadeusz Sławiński <[email protected]>
[ Upstream commit 1b6a6fc5280e97559287b61eade2d4b363e836f2 ]
It is possible when using ASoC that input_dev is unregistered while calling snd_jack_report, which causes NULL pointer dereference. In order to prevent this serialize access to input_dev using mutex lock.
--- include/sound/jack.h | 1 + sound/core/jack.c | 34 +++++++++++++++++++++++++++------- 2 files changed, 28 insertions(+), 7 deletions(-)
include/sound/jack.h +1 -0
@@ -62,6 +62,7 @@ struct snd_jack {const char *id;#ifdef CONFIG_SND_JACK_INPUT_DEV struct input_dev *input_dev; +struct mutex input_dev_lock;int registered;int type;char name[100 ];
sound/core/jack.c +27 -7
@@ -34,8 +34,11 @@ static int snd_jack_dev_disconnect(struct snd_device *device)#ifdef CONFIG_SND_JACK_INPUT_DEV struct snd_jack *jack = device->device_data; -if (!jack->input_dev) +mutex_lock (&jack->input_dev_lock); +if (!jack->input_dev) { +mutex_unlock (&jack->input_dev_lock);return 0 ; + }/* If the input device is registered with the input subsystem * then we need to use a different deallocator. */
@@ -44,6 +47,7 @@ static int snd_jack_dev_disconnect(struct snd_device *device) else input_free_device(jack->input_dev); jack->input_dev =NULL ; +mutex_unlock (&jack->input_dev_lock);#endif /* CONFIG_SND_JACK_INPUT_DEV */ return 0 ; }
@@ -82,8 +86,11 @@ static int snd_jack_dev_register(struct snd_device *device)snprintf (jack->name,sizeof (jack->name),"%s %s" , card->shortname, jack->id); -if (!jack->input_dev) +mutex_lock (&jack->input_dev_lock); +if (!jack->input_dev) { +mutex_unlock (&jack->input_dev_lock);return 0 ; + } jack->input_dev->name = jack->name;
@@ -108,6 +115,7 @@ static int snd_jack_dev_register(struct snd_device *device)if (err ==0 ) jack->registered =1 ; +mutex_unlock (&jack->input_dev_lock); return err; }#endif /* CONFIG_SND_JACK_INPUT_DEV */
@@ -228,9 +236,11 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,return -ENOMEM ; } -/* don't creat input device for phantom jack */ -if (!phantom_jack) {#ifdef CONFIG_SND_JACK_INPUT_DEV +mutex_init (&jack->input_dev_lock); + +/* don't create input device for phantom jack */ +if (!phantom_jack) {int i; jack->input_dev =input_allocate_device ();
@@ -248,8 +258,8 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,input_set_capability (jack->input_dev,EV_SW , jack_switch_types[i]); -#endif /* CONFIG_SND_JACK_INPUT_DEV */ } +#endif /* CONFIG_SND_JACK_INPUT_DEV */ err =snd_device_new (card,SNDRV_DEV_JACK , jack, &ops);if (err <0 )
@@ -289,10 +299,14 @@ EXPORT_SYMBOL(snd_jack_new);void snd_jack_set_parent (struct snd_jack *jack,struct device *parent) {WARN_ON (jack->registered); -if (!jack->input_dev) +mutex_lock (&jack->input_dev_lock); +if (!jack->input_dev) { +mutex_unlock (&jack->input_dev_lock);return ; + } jack->input_dev->dev.parent = parent; +mutex_unlock (&jack->input_dev_lock); }EXPORT_SYMBOL (snd_jack_set_parent);
@@ -340,6 +354,8 @@ EXPORT_SYMBOL(snd_jack_set_key);/** * snd_jack_report - Report the current status of a jack +* Note: This function uses mutexes and should be called from a +* context which can sleep (such as a workqueue). * * @jack: The jack to report status for * @status: The current status of the jack
@@ -359,8 +375,11 @@ void snd_jack_report(struct snd_jack *jack, int status) status & jack_kctl->mask_bits);#ifdef CONFIG_SND_JACK_INPUT_DEV -if (!jack->input_dev) +mutex_lock (&jack->input_dev_lock); +if (!jack->input_dev) { +mutex_unlock (&jack->input_dev_lock);return ; + }for (i =0 ; i <ARRAY_SIZE (jack->key); i++) {int testbit =SND_JACK_BTN_0 >> i;
@@ -379,6 +398,7 @@ void snd_jack_report(struct snd_jack *jack, int status) }input_sync (jack->input_dev); +mutex_unlock (&jack->input_dev_lock);#endif /* CONFIG_SND_JACK_INPUT_DEV */ }EXPORT_SYMBOL (snd_jack_report);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 17/76 spi: spi-rspi: Remove setting {src,dst}_{addr,addr_width} based on DMA direction
In reply to Sasha LevinFrom: Biju Das <[email protected]>
[ Upstream commit 6f381481a5b236cb53d6de2c49c6ef83a4d0f432 ]
The direction field in the DMA config is deprecated. The rspi driver sets {src,dst}_{addr,addr_width} based on the DMA direction and it results in dmaengine_slave_config() failure as RZ DMAC driver validates {src,dst}_addr_width values independent of DMA direction.
This patch fixes the issue by passing both {src,dst}_{addr,addr_width} values independent of DMA direction.
--- drivers/spi/spi-rspi.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/spi/spi-rspi.c +6 -9
@@ -1107,14 +1107,11 @@ static struct dma_chan *rspi_request_dma_chan(struct device *dev, }memset (&cfg,0 ,sizeof (cfg)); + cfg.dst_addr = port_addr +RSPI_SPDR ; + cfg.src_addr = port_addr +RSPI_SPDR ; + cfg.dst_addr_width =DMA_SLAVE_BUSWIDTH_1_BYTE ; + cfg.src_addr_width =DMA_SLAVE_BUSWIDTH_1_BYTE ; cfg.direction = dir; -if (dir ==DMA_MEM_TO_DEV ) { - cfg.dst_addr = port_addr; - cfg.dst_addr_width =DMA_SLAVE_BUSWIDTH_1_BYTE ; - }else { - cfg.src_addr = port_addr; - cfg.src_addr_width =DMA_SLAVE_BUSWIDTH_1_BYTE ; - } ret =dmaengine_slave_config (chan, &cfg);if (ret) {
@@ -1145,12 +1142,12 @@ static int rspi_request_dma(struct device *dev, struct spi_controller *ctlr, } ctlr->dma_tx =rspi_request_dma_chan (dev,DMA_MEM_TO_DEV , dma_tx_id, - res->start +RSPI_SPDR ); + res->start);if (!ctlr->dma_tx)return -ENODEV ; ctlr->dma_rx =rspi_request_dma_chan (dev,DMA_DEV_TO_MEM , dma_rx_id, - res->start +RSPI_SPDR ); + res->start);if (!ctlr->dma_rx) {dma_release_channel (ctlr->dma_tx); ctlr->dma_tx =NULL ;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 18/76 tools/power turbostat: fix ICX DRAM power numbers
In reply to Sasha LevinFrom: Len Brown <[email protected]>
[ Upstream commit 6397b6418935773a34b533b3348b03f4ce3d7050 ]
ICX (and its duplicates) require special hard-coded DRAM RAPL units, rather than using the generic RAPL energy units.
--- tools/power/x86/turbostat/turbostat.c | 1 + 1 file changed, 1 insertion(+)
tools/power/x86/turbostat/turbostat.c +1 -0
@@ -4189,6 +4189,7 @@ rapl_dram_energy_units_probe(int model, double rapl_energy_units)case INTEL_FAM6_HASWELL_X :/* HSX */ case INTEL_FAM6_BROADWELL_X :/* BDX */ case INTEL_FAM6_XEON_PHI_KNL :/* KNL */ +case INTEL_FAM6_ICELAKE_X :/* ICX */ return (rapl_dram_energy_units =15.3 /1000000 );default :return (rapl_energy_units);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 19/76 drm/amd/pm: fix double free in si_parse_power_table()
In reply to Sasha LevinFrom: Keita Suzuki <[email protected]>
[ Upstream commit f3fa2becf2fc25b6ac7cf8d8b1a2e4a86b3b72bd ]
In function si_parse_power_table(), array adev->pm.dpm.ps and its member is allocated. If the allocation of each member fails, the array itself is freed and returned with an error code. However, the array is later freed again in si_dpm_fini() function which is called when the function returns an error.
This leads to potential double free of the array adev->pm.dpm.ps, as well as leak of its array members, since the members are not freed in the allocation function and the array is not nulled when freed. In addition adev->pm.dpm.num_ps, which keeps track of the allocated array member, is not updated until the member allocation is successfully finished, this could also lead to either use after free, or uninitialized variable access in si_dpm_fini().
Fix this by postponing the free of the array until si_dpm_fini() and increment adev->pm.dpm.num_ps everytime the array member is allocated.
--- drivers/gpu/drm/amd/pm/powerplay/si_dpm.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/si_dpm.c +3 -5
@@ -7250,17 +7250,15 @@ static int si_parse_power_table(struct amdgpu_device *adev)if (!adev->pm.dpm.ps)return -ENOMEM ; power_state_offset = (u8 *)state_array->states; -for (i =0 ; i < state_array->ucNumEntries; i++) { +for (adev->pm.dpm.num_ps =0 , i =0 ; i < state_array->ucNumEntries; i++) {u8 *idx; power_state = (union pplib_power_state *)power_state_offset; non_clock_array_index = power_state->v2.nonClockInfoIndex; non_clock_info = (struct _ATOM_PPLIB_NONCLOCK_INFO *) &non_clock_info_array->nonClockInfo[non_clock_array_index]; ps =kzalloc (sizeof (struct si_ps ),GFP_KERNEL ); -if (ps ==NULL ) { -kfree (adev->pm.dpm.ps); +if (ps ==NULL )return -ENOMEM ; - } adev->pm.dpm.ps[i].ps_priv = ps; si_parse_pplib_non_clock_info(adev, &adev->pm.dpm.ps[i], non_clock_info,
@@ -7282,8 +7280,8 @@ static int si_parse_power_table(struct amdgpu_device *adev) k++; } power_state_offset +=2 + power_state->v2.ucNumDPMLevels; + adev->pm.dpm.num_ps++; } - adev->pm.dpm.num_ps = state_array->ucNumEntries;/* fill in the vce power states */ for (i =0 ; i < adev->pm.dpm.num_of_vce_states; i++) {
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 20/76 ath9k: fix QCA9561 PA bias level
In reply to Sasha LevinFrom: Thibaut VARÈNE <[email protected]>
[ Upstream commit e999a5da28a0e0f7de242d841ef7d5e48f4646ae ]
This patch fixes an invalid TX PA DC bias level on QCA9561, which results in a very low output power and very low throughput as devices are further away from the AP (compared to other 2.4GHz APs).
This patch was suggested by Felix Fietkau, who noted[1]:
"The value written to that register is wrong, because while the mask definition AR_CH0_TOP2_XPABIASLVL uses a different value for 9561, the shift definition AR_CH0_TOP2_XPABIASLVL_S is hardcoded to 12, which is wrong for 9561."
In real life testing, without this patch the 2.4GHz throughput on Yuncore XD3200 is around 10Mbps sitting next to the AP, and closer to practical maximum with the patch applied.
[1] https://lore.kernel.org/all/[email protected]
--- drivers/net/wireless/ath/ath9k/ar9003_phy.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/ar9003_phy.h +1 -1
@@ -720,7 +720,7 @@#define AR_CH0_TOP2 (AR_SREV_9300(ah) ? 0x1628c : \ (AR_SREV_9462(ah) ? 0x16290 : 0x16284))#define AR_CH0_TOP2_XPABIASLVL (AR_SREV_9561(ah) ? 0x1e00 : 0xf000) -#define AR_CH0_TOP2_XPABIASLVL_S 12 +#define AR_CH0_TOP2_XPABIASLVL_S (AR_SREV_9561(ah) ? 9 : 12)#define AR_CH0_XTAL (AR_SREV_9300(ah) ? 0x16294 : \ ((AR_SREV_9462(ah) || AR_SREV_9565(ah)) ? 0x16298 : \
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 21/76 media: venus: hfi: avoid null dereference in deinit
In reply to Sasha LevinFrom: Luca Weiss <[email protected]>
[ Upstream commit 86594f6af867b5165d2ba7b5a71fae3a5961e56c ]
If venus_probe fails at pm_runtime_put_sync the error handling first calls hfi_destroy and afterwards hfi_core_deinit. As hfi_destroy sets core->ops to NULL, hfi_core_deinit cannot call the core_deinit function anymore.
Avoid this null pointer derefence by skipping the call when necessary.
--- drivers/media/platform/qcom/venus/hfi.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/media/platform/qcom/venus/hfi.c +3 -0
@@ -104,6 +104,9 @@ int hfi_core_deinit(struct venus_core *core, bool blocking)mutex_lock (&core->lock); } +if (!core->ops) + goto unlock; + ret = core->ops->core_deinit (core);if (!ret)
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 22/76 media: pci: cx23885: Fix the error handling in cx23885_initdev()
In reply to Sasha LevinFrom: Zheyu Ma <[email protected]>
[ Upstream commit e8123311cf06d7dae71e8c5fe78e0510d20cd30b ]
When the driver fails to call the dma_set_mask(), the driver will get the following splat:
[ 55.853884] BUG: KASAN: use-after-free in __process_removed_driver+0x3c/0x240 [ 55.854486] Read of size 8 at addr ffff88810de60408 by task modprobe/590 [ 55.856822] Call Trace: [ 55.860327] __process_removed_driver+0x3c/0x240 [ 55.861347] bus_for_each_dev+0x102/0x160 [ 55.861681] i2c_del_driver+0x2f/0x50
This is because the driver has initialized the i2c related resources in cx23885_dev_setup() but not released them in error handling, fix this bug by modifying the error path that jumps after failing to call the dma_set_mask().
--- drivers/media/pci/cx23885/cx23885-core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/pci/cx23885/cx23885-core.c +3 -3
@@ -2154,7 +2154,7 @@ static int cx23885_initdev(struct pci_dev *pci_dev, err =pci_set_dma_mask (pci_dev,0xffffffff );if (err) {pr_err ("%s/0: Oops: no 32bit PCI DMA ???\n" , dev->name); - goto fail_ctrl; + goto fail_dma_set_mask; } err = request_irq(pci_dev->irq, cx23885_irq,
@@ -2162,7 +2162,7 @@ static int cx23885_initdev(struct pci_dev *pci_dev,if (err <0 ) {pr_err ("%s: can't get IRQ %d\n" , dev->name, pci_dev->irq); - goto fail_irq; + goto fail_dma_set_mask; }switch (dev->board) {
@@ -2184,7 +2184,7 @@ static int cx23885_initdev(struct pci_dev *pci_dev,return 0 ; -fail_irq: +fail_dma_set_mask:cx23885_dev_unregister (dev); fail_ctrl:v4l2_ctrl_handler_free (hdl);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 23/76 media: cx25821: Fix the warning when removing the module
In reply to Sasha LevinFrom: Zheyu Ma <[email protected]>
[ Upstream commit 2203436a4d24302871617373a7eb21bc17e38762 ]
When removing the module, we will get the following warning:
[ 14.746697] remove_proc_entry: removing non-empty directory 'irq/21', leaking at least 'cx25821[1]' [ 14.747449] WARNING: CPU: 4 PID: 368 at fs/proc/generic.c:717 remove_proc_entry+0x389/0x3f0 [ 14.751611] RIP: 0010:remove_proc_entry+0x389/0x3f0 [ 14.759589] Call Trace: [ 14.759792] <TASK> [ 14.759975] unregister_irq_proc+0x14c/0x170 [ 14.760340] irq_free_descs+0x94/0xe0 [ 14.760640] mp_unmap_irq+0xb6/0x100 [ 14.760937] acpi_unregister_gsi_ioapic+0x27/0x40 [ 14.761334] acpi_pci_irq_disable+0x1d3/0x320 [ 14.761688] pci_disable_device+0x1ad/0x380 [ 14.762027] ? _raw_spin_unlock_irqrestore+0x2d/0x60 [ 14.762442] ? cx25821_shutdown+0x20/0x9f0 [cx25821] [ 14.762848] cx25821_finidev+0x48/0xc0 [cx25821] [ 14.763242] pci_device_remove+0x92/0x240
Fix this by freeing the irq before call pci_disable_device().
--- drivers/media/pci/cx25821/cx25821-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/pci/cx25821/cx25821-core.c +1 -1
@@ -1340,11 +1340,11 @@ static void cx25821_finidev(struct pci_dev *pci_dev)struct cx25821_dev *dev =get_cx25821 (v4l2_dev);cx25821_shutdown (dev); -pci_disable_device (pci_dev);/* unregister stuff */ if (pci_dev->irq)free_irq (pci_dev->irq, dev); +pci_disable_device (pci_dev);cx25821_dev_unregister (dev);v4l2_device_unregister (v4l2_dev);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 24/76 md/bitmap: don't set sb values if can't pass sanity check
In reply to Sasha LevinFrom: Heming Zhao <[email protected]>
[ Upstream commit e68cb83a57a458b01c9739e2ad9cb70b04d1e6d2 ]
If bitmap area contains invalid data, kernel will crash then mdadm triggers "Segmentation fault".
This is cluster-md speical bug. In non-clustered env, mdadm will handle broken metadata case. In clustered array, only kernel space handles bitmap slot info. But even this bug only happened in clustered env, current sanity check is wrong, the code should be changed.
How to trigger: (faulty injection)
dd if=/dev/zero bs=1M count=1 oflag=direct of=/dev/sda
dd if=/dev/zero bs=1M count=1 oflag=direct of=/dev/sdb mdadm -C /dev/md0 -b clustered -e 1.2 -n 2 -l mirror /dev/sda /dev/sdb mdadm -Ss
echo aaa > magic.txt
== below modifying slot 2 bitmap data ==
dd if=magic.txt of=/dev/sda seek=16384 bs=1 count=3 <== destroy magic dd if=/dev/zero of=/dev/sda seek=16436 bs=1 count=4 <== ZERO chunksize mdadm -A /dev/md0 /dev/sda /dev/sdb
== kernel crashes. mdadm outputs "Segmentation fault" ==
Reason of kernel crash:
In md_bitmap_read_sb (called by md_bitmap_create), bad bitmap magic didn't block chunksize assignment, and zero value made DIV_ROUND_UP_SECTOR_T() trigger "divide error".
Crash log:
kernel: md: md0 stopped. kernel: md/raid1:md0: not clean -- starting background reconstruction kernel: md/raid1:md0: active with 2 out of 2 mirrors kernel: dlm: ... ... kernel: md-cluster: Joined cluster 44810aba-38bb-e6b8-daca-bc97a0b254aa slot 1 kernel: md0: invalid bitmap file superblock: bad magic kernel: md_bitmap_copy_from_slot can't get bitmap from slot 2 kernel: md-cluster: Could not gather bitmaps from slot 2 kernel: divide error: 0000 [#1] SMP NOPTI kernel: CPU: 0 PID: 1603 Comm: mdadm Not tainted 5.14.6-1-default kernel: Hardware name: QEMU Standard PC (i440FX + PIIX, 1996) kernel: RIP: 0010:md_bitmap_create+0x1d1/0x850 [md_mod] kernel: RSP: 0018:ffffc22ac0843ba0 EFLAGS: 00010246 kernel: ... ... kernel: Call Trace: kernel: ? dlm_lock_sync+0xd0/0xd0 [md_cluster 77fe..7a0] kernel: md_bitmap_copy_from_slot+0x2c/0x290 [md_mod 24ea..d3a] kernel: load_bitmaps+0xec/0x210 [md_cluster 77fe..7a0] kernel: md_bitmap_load+0x81/0x1e0 [md_mod 24ea..d3a] kernel: do_md_run+0x30/0x100 [md_mod 24ea..d3a] kernel: md_ioctl+0x1290/0x15a0 [md_mod 24ea....d3a] kernel: ? mddev_unlock+0xaa/0x130 [md_mod 24ea..d3a] kernel: ? blkdev_ioctl+0xb1/0x2b0 kernel: block_ioctl+0x3b/0x40 kernel: __x64_sys_ioctl+0x7f/0xb0 kernel: do_syscall_64+0x59/0x80 kernel: ? exit_to_user_mode_prepare+0x1ab/0x230 kernel: ? syscall_exit_to_user_mode+0x18/0x40 kernel: ? do_syscall_64+0x69/0x80 kernel: entry_SYSCALL_64_after_hwframe+0x44/0xae kernel: RIP: 0033:0x7f4a15fa722b kernel: ... ... kernel: ---[ end trace 8afa7612f559c868 ]--- kernel: RIP: 0010:md_bitmap_create+0x1d1/0x850 [md_mod]
--- drivers/md/md-bitmap.c | 44 ++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 21 deletions(-)
drivers/md/md-bitmap.c +23 -21
@@ -639,14 +639,6 @@ static int md_bitmap_read_sb(struct bitmap *bitmap) daemon_sleep =le32_to_cpu (sb->daemon_sleep) *HZ ; write_behind =le32_to_cpu (sb->write_behind); sectors_reserved =le32_to_cpu (sb->sectors_reserved); -/* Setup nodes/clustername only if bitmap version is -* cluster-compatible -*/ -if (sb->version ==cpu_to_le32 (BITMAP_MAJOR_CLUSTERED )) { - nodes =le32_to_cpu (sb->nodes); -strlcpy (bitmap->mddev->bitmap_info.cluster_name, - sb->cluster_name,64 ); - }/* verify that the bitmap-specific fields are valid */ if (sb->magic !=cpu_to_le32 (BITMAP_MAGIC ))
@@ -668,6 +660,16 @@ static int md_bitmap_read_sb(struct bitmap *bitmap) goto out; } +/* +* Setup nodes/clustername only if bitmap version is +* cluster-compatible +*/ +if (sb->version ==cpu_to_le32 (BITMAP_MAJOR_CLUSTERED )) { + nodes =le32_to_cpu (sb->nodes); +strlcpy (bitmap->mddev->bitmap_info.cluster_name, + sb->cluster_name,64 ); + } +/* keep the array size field of the bitmap superblock up to date */ sb->sync_size =cpu_to_le64 (bitmap->mddev->resync_max_sectors);
@@ -700,9 +702,9 @@ static int md_bitmap_read_sb(struct bitmap *bitmap) out:kunmap_atomic (sb); -/* Assigning chunksize is required for "re_read" */ - bitmap->mddev->bitmap_info.chunksize = chunksize;if (err ==0 && nodes && (bitmap->cluster_slot <0 )) { +/* Assigning chunksize is required for "re_read" */ + bitmap->mddev->bitmap_info.chunksize = chunksize; err =md_setup_cluster (bitmap->mddev, nodes);if (err) { pr_warn("%s: Could not setup cluster service (%d)\n",
@@ -713,18 +715,18 @@ static int md_bitmap_read_sb(struct bitmap *bitmap) goto re_read; } - out_no_sb: -if (test_bit (BITMAP_STALE , &bitmap->flags)) - bitmap->events_cleared = bitmap->mddev->events; - bitmap->mddev->bitmap_info.chunksize = chunksize; - bitmap->mddev->bitmap_info.daemon_sleep = daemon_sleep; - bitmap->mddev->bitmap_info.max_write_behind = write_behind; - bitmap->mddev->bitmap_info.nodes = nodes; -if (bitmap->mddev->bitmap_info.space ==0 || - bitmap->mddev->bitmap_info.space > sectors_reserved) - bitmap->mddev->bitmap_info.space = sectors_reserved; -if (err) { +if (err ==0 ) { +if (test_bit (BITMAP_STALE , &bitmap->flags)) + bitmap->events_cleared = bitmap->mddev->events; + bitmap->mddev->bitmap_info.chunksize = chunksize; + bitmap->mddev->bitmap_info.daemon_sleep = daemon_sleep; + bitmap->mddev->bitmap_info.max_write_behind = write_behind; + bitmap->mddev->bitmap_info.nodes = nodes; +if (bitmap->mddev->bitmap_info.space ==0 || + bitmap->mddev->bitmap_info.space > sectors_reserved) + bitmap->mddev->bitmap_info.space = sectors_reserved; + }else {md_bitmap_print_sb (bitmap);if (bitmap->cluster_slot <0 )md_cluster_stop (bitmap->mddev);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 25/76 mmc: jz4740: Apply DMA engine limits to maximum segment size
In reply to Sasha LevinFrom: Aidan MacDonald <[email protected]>
[ Upstream commit afadb04f1d6e74b18a253403f5274cde5e3fd7bd ]
Do what is done in other DMA-enabled MMC host drivers (cf. host/mmci.c) and limit the maximum segment size based on the DMA engine's capabilities. This is needed to avoid warnings like the following with CONFIG_DMA_API_DEBUG=y.
------------[ cut here ]------------
WARNING: CPU: 0 PID: 21 at kernel/dma/debug.c:1162 debug_dma_map_sg+0x2f4/0x39c
DMA-API: jz4780-dma 13420000.dma-controller: mapping sg segment longer than device claims to support [len=98304] [max=65536]
CPU: 0 PID: 21 Comm: kworker/0:1H Not tainted 5.18.0-rc1 #19
Workqueue: kblockd blk_mq_run_work_fn
Stack : 81575aec 00000004 80620000 80620000 80620000 805e7358 00000009 801537ac
814c832c 806276e3 806e34b4 80620000 81575aec 00000001 81575ab8 09291444
00000000 00000000 805e7358 81575958 ffffffea 8157596c 00000000 636f6c62
6220646b 80387a70 0000000f 6d5f6b6c 80620000 00000000 81575ba4 00000009
805e170c 80896640 00000001 00010000 00000000 00000000 00006098 806e0000
...
Call Trace:
[<80107670>] show_stack+0x84/0x120
[<80528cd8>] __warn+0xb8/0xec
[<80528d78>] warn_slowpath_fmt+0x6c/0xb8
[<8016f1d4>] debug_dma_map_sg+0x2f4/0x39c
[<80169d4c>] __dma_map_sg_attrs+0xf0/0x118
[<8016a27c>] dma_map_sg_attrs+0x14/0x28
[<804f66b4>] jz4740_mmc_prepare_dma_data+0x74/0xa4
[<804f6714>] jz4740_mmc_pre_request+0x30/0x54
[<804f4ff4>] mmc_blk_mq_issue_rq+0x6e0/0x7bc
[<804f5590>] mmc_mq_queue_rq+0x220/0x2d4
[<8038b2c0>] blk_mq_dispatch_rq_list+0x480/0x664
[<80391040>] blk_mq_do_dispatch_sched+0x2dc/0x370
[<80391468>] __blk_mq_sched_dispatch_requests+0xec/0x164
[<80391540>] blk_mq_sched_dispatch_requests+0x44/0x94
[<80387900>] __blk_mq_run_hw_queue+0xb0/0xcc
[<80134c14>] process_one_work+0x1b8/0x264
[<80134ff8>] worker_thread+0x2ec/0x3b8
[<8013b13c>] kthread+0x104/0x10c
[<80101dcc>] ret_from_kernel_thread+0x14/0x1c
---[ end trace 0000000000000000 ]------ drivers/mmc/host/jz4740_mmc.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
drivers/mmc/host/jz4740_mmc.c +20 -0
@@ -236,6 +236,26 @@ static int jz4740_mmc_acquire_dma_channels(struct jz4740_mmc_host *host)return PTR_ERR (host->dma_rx); } +/* +* Limit the maximum segment size in any SG entry according to +* the parameters of the DMA engine device. +*/ +if (host->dma_tx) { +struct device *dev = host->dma_tx->device->dev; +unsigned int max_seg_size =dma_get_max_seg_size (dev); + +if (max_seg_size < host->mmc->max_seg_size) + host->mmc->max_seg_size = max_seg_size; + } + +if (host->dma_rx) { +struct device *dev = host->dma_rx->device->dev; +unsigned int max_seg_size =dma_get_max_seg_size (dev); + +if (max_seg_size < host->mmc->max_seg_size) + host->mmc->max_seg_size = max_seg_size; + } +return 0 ; }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 26/76 drivers: mmc: sdhci_am654: Add the quirk to set TESTCD bit
In reply to Sasha LevinFrom: Vignesh Raghavendra <[email protected]>
[ Upstream commit c7666240ec76422cb7546bd07cc8ae80dc0ccdd2 ]
The ARASAN MMC controller on Keystone 3 class of devices need the SDCD line to be connected for proper functioning. Similar to the issue pointed out in sdhci-of-arasan.c driver, commit 3794c542641f ("mmc:
sdhci-of-arasan: Set controller to test mode when no CD bit").
In cases where this can't be connected, add a quirk to force the controller into test mode and set the TESTCD bit. Use the flag "ti,fails-without-test-cd", to implement this above quirk when required.
--- drivers/mmc/host/sdhci_am654.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci_am654.c +22 -1
@@ -147,6 +147,9 @@ struct sdhci_am654_data {int drv_strength;int strb_sel;u32 flags; +u32 quirks; + +#define SDHCI_AM654_QUIRK_FORCE_CDTEST BIT(0) };struct sdhci_am654_driver_data {
@@ -369,6 +372,21 @@ static void sdhci_am654_write_b(struct sdhci_host *host, u8 val, int reg) } } +static void sdhci_am654_reset (struct sdhci_host *host,u8 mask) +{ +u8 ctrl; +struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host); +struct sdhci_am654_data *sdhci_am654 =sdhci_pltfm_priv (pltfm_host); + +sdhci_reset (host, mask); + +if (sdhci_am654->quirks &SDHCI_AM654_QUIRK_FORCE_CDTEST ) { + ctrl =sdhci_readb (host,SDHCI_HOST_CONTROL ); + ctrl |=SDHCI_CTRL_CDTEST_INS |SDHCI_CTRL_CDTEST_EN ; +sdhci_writeb (host, ctrl,SDHCI_HOST_CONTROL ); + } +} +static int sdhci_am654_execute_tuning (struct mmc_host *mmc,u32 opcode) {struct sdhci_host *host =mmc_priv (mmc);
@@ -500,7 +518,7 @@ static struct sdhci_ops sdhci_j721e_4bit_ops = { .set_clock = sdhci_j721e_4bit_set_clock, .write_b = sdhci_am654_write_b, .irq = sdhci_am654_cqhci_irq, - .reset = sdhci_reset, + .reset = sdhci_am654_reset, };static const struct sdhci_pltfm_data sdhci_j721e_4bit_pdata = {
@@ -719,6 +737,9 @@ static int sdhci_am654_get_of_property(struct platform_device *pdev,device_property_read_u32 (dev,"ti,clkbuf-sel" , &sdhci_am654->clkbuf_sel); +if (device_property_read_bool (dev,"ti,fails-without-test-cd" )) + sdhci_am654->quirks |=SDHCI_AM654_QUIRK_FORCE_CDTEST ; +sdhci_get_of_property (pdev);return 0 ;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 27/76 drm/sun4i: Add support for D1 TCONs
In reply to Sasha LevinFrom: Samuel Holland <[email protected]>
[ Upstream commit b9b52d2f4aafa2bd637ace0f24615bdad8e49f01 ]
D1 has a TCON TOP, so its quirks are similar to those for the R40 TCONs. While there are some register changes, the part of the TCON TV supported by the driver matches the R40 quirks, so that quirks structure can be reused. D1 has the first supported TCON LCD with a TCON TOP, so the TCON LCD needs a new quirks structure.
D1's TCON LCD hardware supports LVDS; in fact it provides dual-link LVDS from a single TCON. However, it comes with a brand new LVDS PHY. Since this PHY has not been tested, leave out LVDS driver support for now.
--- drivers/gpu/drm/sun4i/sun4i_tcon.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/sun4i/sun4i_tcon.c +8 -0
@@ -1544,6 +1544,12 @@ static const struct sun4i_tcon_quirks sun9i_a80_tcon_tv_quirks = { .needs_edp_reset = true, }; +static const struct sun4i_tcon_quirks sun20i_d1_lcd_quirks = { + .has_channel_0 = true, + .dclk_min_div =1 , + .set_mux = sun8i_r40_tcon_tv_set_mux, +}; +/* sun4i_drv uses this list to check if a device node is a TCON */ const struct of_device_id sun4i_tcon_of_table[] = { { .compatible ="allwinner,sun4i-a10-tcon" , .data = &sun4i_a10_quirks },
@@ -1561,6 +1567,8 @@ const struct of_device_id sun4i_tcon_of_table[] = { { .compatible = "allwinner,sun8i-v3s-tcon", .data = &sun8i_v3s_quirks }, { .compatible = "allwinner,sun9i-a80-tcon-lcd", .data = &sun9i_a80_tcon_lcd_quirks }, { .compatible = "allwinner,sun9i-a80-tcon-tv", .data = &sun9i_a80_tcon_tv_quirks }, + { .compatible = "allwinner,sun20i-d1-tcon-lcd", .data = &sun20i_d1_lcd_quirks }, + { .compatible = "allwinner,sun20i-d1-tcon-tv", .data = &sun8i_r40_tv_quirks }, { } };MODULE_DEVICE_TABLE (of, sun4i_tcon_of_table);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 28/76 scsi: megaraid: Fix error check return value of register_chrdev()
In reply to Sasha LevinFrom: Lv Ruyi <[email protected]>
[ Upstream commit c5acd61dbb32b6bda0f3a354108f2b8dcb788985 ]
If major equals 0, register_chrdev() returns an error code when it fails. This function dynamically allocates a major and returns its number on success, so we should use "< 0" to check it instead of "!".
--- drivers/scsi/megaraid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/megaraid.c +1 -1
@@ -4634,7 +4634,7 @@ static int __init megaraid_init(void)* major number allocation. */ major =register_chrdev (0 ,"megadev_legacy" , &megadev_fops); -if (!major) { +if (major <0 ) {printk (KERN_WARNING "megaraid: failed to register char device\n" ); }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 29/76 scsi: ufs: Use pm_runtime_resume_and_get() instead of pm_runtime_get_sync()
In reply to Sasha LevinFrom: Minghao Chi <[email protected]>
[ Upstream commit 75b8715e20a20bc7b4844835e4035543a2674200 ]
Using pm_runtime_resume_and_get() to replace pm_runtime_get_sync() and pm_runtime_put_noidle(). This change is just to simplify the code, no actual functional changes.
--- drivers/scsi/ufs/ti-j721e-ufs.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/scsi/ufs/ti-j721e-ufs.c +2 -4
@@ -29,11 +29,9 @@ static int ti_j721e_ufs_probe(struct platform_device *pdev)return PTR_ERR (regbase);pm_runtime_enable (dev); - ret =pm_runtime_get_sync (dev); -if (ret <0 ) { -pm_runtime_put_noidle (dev); + ret =pm_runtime_resume_and_get (dev); +if (ret <0 ) goto disable_pm; - }/* Select MPHY refclk frequency */ clk =devm_clk_get (dev,NULL );
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 30/76 scsi: lpfc: Fix resource leak in lpfc_sli4_send_seq_to_ulp()
In reply to Sasha LevinFrom: James Smart <[email protected]>
[ Upstream commit 646db1a560f44236b7278b822ca99a1d3b6ea72c ]
If no handler is found in lpfc_complete_unsol_iocb() to match the rctl of a received frame, the frame is dropped and resources are leaked.
Fix by returning resources when discarding an unhandled frame type. Update lpfc_fc_frame_check() handling of NOP basic link service.
--- drivers/scsi/lpfc/lpfc_sli.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_sli.c +4 -2
@@ -17445,7 +17445,6 @@ lpfc_fc_frame_check(struct lpfc_hba *phba, struct fc_frame_header *fc_hdr)case FC_RCTL_ELS_REP :/* extended link services reply */ case FC_RCTL_ELS4_REQ :/* FC-4 ELS request */ case FC_RCTL_ELS4_REP :/* FC-4 ELS reply */ -case FC_RCTL_BA_NOP :/* basic link service NOP */ case FC_RCTL_BA_ABTS :/* basic link service abort */ case FC_RCTL_BA_RMC :/* remove connection */ case FC_RCTL_BA_ACC :/* basic accept */
@@ -17466,6 +17465,7 @@ lpfc_fc_frame_check(struct lpfc_hba *phba, struct fc_frame_header *fc_hdr) fc_vft_hdr = (struct fc_vft_header *)fc_hdr; fc_hdr = &((struct fc_frame_header *)fc_vft_hdr)[1 ];return lpfc_fc_frame_check (phba, fc_hdr); +case FC_RCTL_BA_NOP :/* basic link service NOP */ default : goto drop; }
@@ -18284,12 +18284,14 @@ lpfc_sli4_send_seq_to_ulp(struct lpfc_vport *vport,if (!lpfc_complete_unsol_iocb (phba, phba->sli4_hba.els_wq->pring, iocbq, fc_hdr->fh_r_ctl, - fc_hdr->fh_type)) + fc_hdr->fh_type)) {lpfc_printf_log (phba,KERN_ERR ,LOG_TRACE_EVENT ,"2540 Ring %d handler: unexpected Rctl " "x%x Type x%x received\n" ,LPFC_ELS_RING , fc_hdr->fh_r_ctl, fc_hdr->fh_type); +lpfc_in_buf_free (phba, &seq_dmabuf->dbuf); + }/* Free iocb created in lpfc_prep_seq */ list_for_each_entry_safe(curr_iocb, next_iocb,
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 31/76 ath11k: disable spectral scan during spectral deinit
In reply to Sasha LevinFrom: Hari Chandrakanthan <[email protected]>
[ Upstream commit 161c64de239c7018e0295e7e0520a19f00aa32dc ]
When ath11k modules are removed using rmmod with spectral scan enabled, crash is observed. Different crash trace is observed for each crash.
Send spectral scan disable WMI command to firmware before cleaning the spectral dbring in the spectral_deinit API to avoid this crash.
call trace from one of the crash observed:
[ 1252.880802] Unable to handle kernel NULL pointer dereference at virtual address 00000008 [ 1252.882722] pgd = 0f42e886 [ 1252.890955] [00000008] *pgd=00000000 [ 1252.893478] Internal error: Oops: 5 [#1] PREEMPT SMP ARM [ 1253.093035] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.4.89 #0 [ 1253.115261] Hardware name: Generic DT based system [ 1253.121149] PC is at ath11k_spectral_process_data+0x434/0x574 [ath11k] [ 1253.125940] LR is at 0x88e31017 [ 1253.132448] pc : [<7f9387b8>] lr : [<88e31017>] psr: a0000193 [ 1253.135488] sp : 80d01bc8 ip : 00000001 fp : 970e0000 [ 1253.141737] r10: 88e31000 r9 : 970ec000 r8 : 00000080 [ 1253.146946] r7 : 94734040 r6 : a0000113 r5 : 00000057 r4 : 00000000 [ 1253.152159] r3 : e18cb694 r2 : 00000217 r1 : 1df1f000 r0 : 00000001 [ 1253.158755] Flags: NzCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment user [ 1253.165266] Control: 10c0383d Table: 5e71006a DAC: 00000055 [ 1253.172472] Process swapper/0 (pid: 0, stack limit = 0x60870141) [ 1253.458055] [<7f9387b8>] (ath11k_spectral_process_data [ath11k]) from [<7f917fdc>] (ath11k_dbring_buffer_release_event+0x214/0x2e4 [ath11k]) [ 1253.466139] [<7f917fdc>] (ath11k_dbring_buffer_release_event [ath11k]) from [<7f8ea3c4>] (ath11k_wmi_tlv_op_rx+0x1840/0x29cc [ath11k]) [ 1253.478807] [<7f8ea3c4>] (ath11k_wmi_tlv_op_rx [ath11k]) from [<7f8fe868>] (ath11k_htc_rx_completion_handler+0x180/0x4e0 [ath11k]) [ 1253.490699] [<7f8fe868>] (ath11k_htc_rx_completion_handler [ath11k]) from [<7f91308c>] (ath11k_ce_per_engine_service+0x2c4/0x3b4 [ath11k]) [ 1253.502386] [<7f91308c>] (ath11k_ce_per_engine_service [ath11k]) from [<7f9a4198>] (ath11k_pci_ce_tasklet+0x28/0x80 [ath11k_pci]) [ 1253.514811] [<7f9a4198>] (ath11k_pci_ce_tasklet [ath11k_pci]) from [<8032227c>] (tasklet_action_common.constprop.2+0x64/0xe8) [ 1253.526476] [<8032227c>] (tasklet_action_common.constprop.2) from [<803021e8>] (__do_softirq+0x130/0x2d0) [ 1253.537756] [<803021e8>] (__do_softirq) from [<80322610>] (irq_exit+0xcc/0xe8) [ 1253.547304] [<80322610>] (irq_exit) from [<8036a4a4>] (__handle_domain_irq+0x60/0xb4) [ 1253.554428] [<8036a4a4>] (__handle_domain_irq) from [<805eb348>] (gic_handle_irq+0x4c/0x90) [ 1253.562321] [<805eb348>] (gic_handle_irq) from [<80301a78>] (__irq_svc+0x58/0x8c)
Tested-on: QCN6122 hw1.0 AHB WLAN.HK.2.6.0.1-00851-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath11k/spectral.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/net/wireless/ath/ath11k/spectral.c +9 -8
@@ -214,7 +214,10 @@ static int ath11k_spectral_scan_config(struct ath11k *ar,return -ENODEV ; arvif->spectral_enabled = (mode !=ATH11K_SPECTRAL_DISABLED ); + +spin_lock_bh (&ar->spectral.lock); ar->spectral.mode = mode; +spin_unlock_bh (&ar->spectral.lock); ret = ath11k_wmi_vdev_spectral_enable(ar, arvif->vdev_id, ATH11K_WMI_SPECTRAL_TRIGGER_CMD_CLEAR,
@@ -829,9 +832,6 @@ static inline void ath11k_spectral_ring_free(struct ath11k *ar) {struct ath11k_spectral *sp = &ar->spectral; -if (!sp->enabled) -return ; -ath11k_dbring_srng_cleanup (ar, &sp->rx_ring);ath11k_dbring_buf_cleanup (ar, &sp->rx_ring); }
@@ -883,15 +883,16 @@ void ath11k_spectral_deinit(struct ath11k_base *ab)if (!sp->enabled)continue ; -ath11k_spectral_debug_unregister (ar); -ath11k_spectral_ring_free (ar); +mutex_lock (&ar->conf_mutex); +ath11k_spectral_scan_config (ar,ATH11K_SPECTRAL_DISABLED ); +mutex_unlock (&ar->conf_mutex);spin_lock_bh (&sp->lock); - - sp->mode =ATH11K_SPECTRAL_DISABLED ; sp->enabled = false; -spin_unlock_bh (&sp->lock); + +ath11k_spectral_debug_unregister (ar); +ath11k_spectral_ring_free (ar); } }
Signature · 7 lines
2.35.1 -- ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
Sasha Levin
maintainerPATCH 32/76 ASoC: Intel: bytcr_rt5640: Add quirk for the HP Pro Tablet 408
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit ce216cfa84a4e1c23b105e652c550bdeaac9e922 ]
Add a quirk for the HP Pro Tablet 408, this BYTCR tablet has no CHAN package in its ACPI tables and uses SSP0-AIF1 rather then SSP0-AIF2 which is the default for BYTCR devices.
It also uses DMIC1 for the internal mic rather then the default IN3 and it uses JD2 rather then the default JD1 for jack-detect.
--- sound/soc/intel/boards/bytcr_rt5640.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
sound/soc/intel/boards/bytcr_rt5640.c +12 -0
@@ -615,6 +615,18 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = {BYT_RT5640_OVCD_SF_0P75 | BYT_RT5640_MCLK_EN), }, + { /* HP Pro Tablet 408 */ + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Hewlett-Packard" ), + DMI_MATCH(DMI_PRODUCT_NAME, "HP Pro Tablet 408"), + }, + .driver_data = (void *)(BYT_RT5640_DMIC1_MAP | +BYT_RT5640_JD_SRC_JD2_IN4N | +BYT_RT5640_OVCD_TH_1500UA | +BYT_RT5640_OVCD_SF_0P75 | +BYT_RT5640_SSP0_AIF1 | + BYT_RT5640_MCLK_EN), + }, { /* HP Stream 7 */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 33/76 drm/plane: Move range check for format_count earlier
In reply to Sasha LevinFrom: Steven Price <[email protected]>
[ Upstream commit 4b674dd69701c2e22e8e7770c1706a69f3b17269 ]
While the check for format_count > 64 in __drm_universal_plane_init() shouldn't be hit (it's a WARN_ON), in its current position it will then leak the plane->format_types array and fail to call drm_mode_object_unregister() leaking the modeset identifier. Move it to the start of the function to avoid allocating those resources in the first place.
--- drivers/gpu/drm/drm_plane.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/drm_plane.c +7 -7
@@ -186,6 +186,13 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane,if (WARN_ON (config->num_total_plane >=32 ))return -EINVAL ; +/* +* First driver to need more than 64 formats needs to fix this. Each +* format is encoded as a bit and the current code only supports a u64. +*/ +if (WARN_ON (format_count >64 )) +return -EINVAL ; +WARN_ON (drm_drv_uses_atomic_modeset (dev) && (!funcs->atomic_destroy_state || !funcs->atomic_duplicate_state));
@@ -207,13 +214,6 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane,return -ENOMEM ; } -/* -* First driver to need more than 64 formats needs to fix this. Each -* format is encoded as a bit and the current code only supports a u64. -*/ -if (WARN_ON (format_count >64 )) -return -EINVAL ; -if (format_modifiers) {const uint64_t *temp_modifiers = format_modifiers;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 34/76 drm/amd/pm: fix the compile warning
In reply to Sasha LevinFrom: Evan Quan <[email protected]>
[ Upstream commit 555238d92ac32dbad2d77ad2bafc48d17391990c ]
Fix the compile warning below:drivers/gpu/drm/amd/amdgpu/../pm/legacy-dpm/kv_dpm.c:1641kv_get_acp_boot_level() warn: always true condition '(table->entries[i]->clk >= 0) => (0-u32max >= 0)'
--- drivers/gpu/drm/amd/pm/powerplay/kv_dpm.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/kv_dpm.c +1 -13
@@ -1609,19 +1609,7 @@ static int kv_update_samu_dpm(struct amdgpu_device *adev, bool gate)static u8 kv_get_acp_boot_level (struct amdgpu_device *adev) { -u8 i; -struct amdgpu_clock_voltage_dependency_table *table = - &adev->pm.dpm.dyn_state.acp_clock_voltage_dependency_table; - -for (i =0 ; i < table->count; i++) { -if (table->entries[i].clk >=0 )/* XXX */ -break ; - } - -if (i >= table->count) - i = table->count -1 ; - -return i; +return 0 ; }static void kv_update_acp_boot_level (struct amdgpu_device *adev)
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 35/76 ath10k: skip ath10k_halt during suspend for driver state RESTARTING
In reply to Sasha LevinFrom: Abhishek Kumar <[email protected]>
[ Upstream commit b72a4aff947ba807177bdabb43debaf2c66bee05 ]
Double free crash is observed when FW recovery(caused by wmi timeout/crash) is followed by immediate suspend event. The FW recovery is triggered by ath10k_core_restart() which calls driver clean up via ath10k_halt(). When the suspend event occurs between the FW recovery, the restart worker thread is put into frozen state until suspend completes. The suspend event triggers ath10k_stop() which again triggers ath10k_halt() The double invocation of ath10k_halt() causes ath10k_htt_rx_free() to be called twice(Note: ath10k_htt_rx_alloc was not called by restart worker thread because of its frozen state), causing the crash.
To fix this, during the suspend flow, skip call to ath10k_halt() in ath10k_stop() when the current driver state is ATH10K_STATE_RESTARTING. Also, for driver state ATH10K_STATE_RESTARTING, call ath10k_wait_for_suspend() in ath10k_stop(). This is because call to ath10k_wait_for_suspend() is skipped later in
[ath10k_halt() > ath10k_core_stop()] for the driver state ATH10K_STATE_RESTARTING.
The frozen restart worker thread will be cancelled during resume when the device comes out of suspend.
Below is the crash stack for reference:
[ 428.469167] ------------[ cut here ]------------ [ 428.469180] kernel BUG at mm/slub.c:4150! [ 428.469193] invalid opcode: 0000 [#1] PREEMPT SMP NOPTI [ 428.469219] Workqueue: events_unbound async_run_entry_fn [ 428.469230] RIP: 0010:kfree+0x319/0x31b [ 428.469241] RSP: 0018:ffffa1fac015fc30 EFLAGS: 00010246 [ 428.469247] RAX: ffffedb10419d108 RBX: ffff8c05262b0000 [ 428.469252] RDX: ffff8c04a8c07000 RSI: 0000000000000000 [ 428.469256] RBP: ffffa1fac015fc78 R08: 0000000000000000 [ 428.469276] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 428.469285] Call Trace: [ 428.469295] ? dma_free_attrs+0x5f/0x7d [ 428.469320] ath10k_core_stop+0x5b/0x6f [ 428.469336] ath10k_halt+0x126/0x177 [ 428.469352] ath10k_stop+0x41/0x7e [ 428.469387] drv_stop+0x88/0x10e [ 428.469410] __ieee80211_suspend+0x297/0x411 [ 428.469441] rdev_suspend+0x6e/0xd0 [ 428.469462] wiphy_suspend+0xb1/0x105 [ 428.469483] ? name_show+0x2d/0x2d [ 428.469490] dpm_run_callback+0x8c/0x126 [ 428.469511] ? name_show+0x2d/0x2d [ 428.469517] __device_suspend+0x2e7/0x41b [ 428.469523] async_suspend+0x1f/0x93 [ 428.469529] async_run_entry_fn+0x3d/0xd1 [ 428.469535] process_one_work+0x1b1/0x329 [ 428.469541] worker_thread+0x213/0x372 [ 428.469547] kthread+0x150/0x15f [ 428.469552] ? pr_cont_work+0x58/0x58 [ 428.469558] ? kthread_blkcg+0x31/0x31
Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00288-QCARMSWPZ-1
--- drivers/net/wireless/ath/ath10k/mac.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath10k/mac.c +18 -2
@@ -5170,13 +5170,29 @@ static int ath10k_start(struct ieee80211_hw *hw)static void ath10k_stop (struct ieee80211_hw *hw) {struct ath10k *ar = hw->priv; +u32 opt;ath10k_drain_tx (ar);mutex_lock (&ar->conf_mutex);if (ar->state !=ATH10K_STATE_OFF ) { -if (!ar->hw_rfkill_on) -ath10k_halt (ar); +if (!ar->hw_rfkill_on) { +/* If the current driver state is RESTARTING but not yet +* fully RESTARTED because of incoming suspend event, +* then ath10k_halt() is already called via +* ath10k_core_restart() and should not be called here. +*/ +if (ar->state !=ATH10K_STATE_RESTARTING ) { +ath10k_halt (ar); + }else { +/* Suspending here, because when in RESTARTING +* state, ath10k_core_stop() skips +* ath10k_wait_for_suspend(). +*/ + opt =WMI_PDEV_SUSPEND_AND_DISABLE_INTR ; +ath10k_wait_for_suspend (ar, opt); + } + } ar->state =ATH10K_STATE_OFF ; }mutex_unlock (&ar->conf_mutex);
Signature · 7 lines
2.35.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Sasha Levin
maintainerPATCH 36/76 arm64: compat: Do not treat syscall number as ESR_ELx for a bad syscall
In reply to Sasha LevinFrom: Alexandru Elisei <[email protected]>
[ Upstream commit 3fed9e551417b84038b15117732ea4505eee386b ]
If a compat process tries to execute an unknown system call above the __ARM_NR_COMPAT_END number, the kernel sends a SIGILL signal to the offending process. Information about the error is printed to dmesg in compat_arm_syscall() -> arm64_notify_die() -> arm64_force_sig_fault() -> arm64_show_signal().
arm64_show_signal() interprets a non-zero value for current->thread.fault_code as an exception syndrome and displays the message associated with the ESR_ELx.EC field (bits 31:26). current->thread.fault_code is set in compat_arm_syscall() -> arm64_notify_die() with the bad syscall number instead of a valid ESR_ELx value. This means that the ESR_ELx.EC field has the value that the user set for the syscall number and the kernel can end up printing bogus exception messages*. For example, for the syscall number 0x68000000, which evaluates to ESR_ELx.EC value of 0x1A (ESR_ELx_EC_FPAC) the kernel prints this error:
[ 18.349161] syscall[300]: unhandled exception: ERET/ERETAA/ERETAB, ESR 0x68000000, Oops - bad compat syscall(2) in syscall[10000+50000] [ 18.350639] CPU: 2 PID: 300 Comm: syscall Not tainted 5.18.0-rc1 #79 [ 18.351249] Hardware name: Pine64 RockPro64 v2.0 (DT)
[..]
which is misleading, as the bad compat syscall has nothing to do with pointer authentication.
Stop arm64_show_signal() from printing exception syndrome information by having compat_arm_syscall() set the ESR_ELx value to 0, as it has no meaning for an invalid system call number. The example above now becomes:
[ 19.935275] syscall[301]: unhandled exception: Oops - bad compat syscall(2) in syscall[10000+50000] [ 19.936124] CPU: 1 PID: 301 Comm: syscall Not tainted 5.18.0-rc1-00005-g7e08006d4102 #80 [ 19.936894] Hardware name: Pine64 RockPro64 v2.0 (DT)
[..]
which although shows less information because the syscall number, wrongfully advertised as the ESR value, is missing, it is better than showing plainly wrong information. The syscall number can be easily obtained with strace.
*A 32-bit value above or equal to 0x8000_0000 is interpreted as a negative integer in compat_arm_syscal() and the condition scno < __ARM_NR_COMPAT_END evaluates to true; the syscall will exit to userspace in this case with the ENOSYS error code instead of arm64_notify_die() being called.
--- arch/arm64/kernel/sys_compat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/sys_compat.c +1 -1
@@ -115,6 +115,6 @@ long compat_arm_syscall(struct pt_regs *regs, int scno) (compat_thumb_mode (regs) ?2 :4 );arm64_notify_die ("Oops - bad compat syscall(2)" , regs, -SIGILL ,ILL_ILLTRP , addr, scno); +SIGILL ,ILL_ILLTRP , addr,0 );return 0 ; }
Signature · 7 lines
2.35.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 37/76 drm: msm: fix error check return value of irq_of_parse_and_map()
In reply to Sasha LevinFrom: Lv Ruyi <[email protected]>
[ Upstream commit b9e4f1d2b505df8e2439b63e67afaa287c1c43e2 ]
The irq_of_parse_and_map() function returns 0 on failure, and does not return an negative value.
Patchwork: https://patchwork.freedesktop.org/patch/483175/
--- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +3 -3
@@ -598,9 +598,9 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev) pdev = mdp5_kms->pdev; irq =irq_of_parse_and_map (pdev->dev.of_node,0 ); -if (irq <0 ) { - ret = irq; -DRM_DEV_ERROR (&pdev->dev,"failed to get irq: %d\n" , ret); +if (!irq) { + ret = -EINVAL ; +DRM_DEV_ERROR (&pdev->dev,"failed to get irq\n" ); goto fail; }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 38/76 ipv6: Don't send rs packets to the interface of ARPHRD_TUNNEL
In reply to Sasha LevinFrom: jianghaoran <[email protected]>
[ Upstream commit b52e1cce31ca721e937d517411179f9196ee6135 ]
ARPHRD_TUNNEL interface can't process rs packets
and will generate TX errors
ex:
ip tunnel add ethn mode ipip local 192.168.1.1 remote 192.168.1.2 ifconfig ethn x.x.x.x
ethn: flags=209<UP,POINTOPOINT,RUNNING,NOARP> mtu 1480
inet x.x.x.x netmask 255.255.255.255 destination x.x.x.x inet6 fe80::5efe:ac1e:3cdb prefixlen 64 scopeid 0x20<link>
tunnel txqueuelen 1000 (IPIP Tunnel)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 3 dropped 0 overruns 0 carrier 0 collisions 0
--- net/ipv6/addrconf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv6/addrconf.c +2 -1
@@ -4200,7 +4200,8 @@ static void addrconf_dad_completed(struct inet6_ifaddr *ifp, bool bump_id, send_rs = send_mld &&ipv6_accept_ra (ifp->idev) && ifp->idev->cnf.rtr_solicits !=0 && - (dev->flags&IFF_LOOPBACK ) ==0 ; + (dev->flags &IFF_LOOPBACK ) ==0 && + (dev->type !=ARPHRD_TUNNEL );read_unlock_bh (&ifp->idev->lock);/* While dad is in progress mld report's source address is in6_addrany.
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 39/76 net/mlx5: fs, delete the FTE when there are no rules attached to it
In reply to Sasha LevinFrom: Mark Bloch <[email protected]>
[ Upstream commit 7b0c6338597613f465d131bd939a51844a00455a ]
When an FTE has no children is means all the rules where removed and the FTE can be deleted regardless of the dests_size value. While dests_size should be 0 when there are no children be extra careful not to leak memory or get firmware syndrome if the proper bookkeeping of dests_size wasn't done.
--- drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +5 -5
@@ -2024,16 +2024,16 @@ void mlx5_del_flow_rules(struct mlx5_flow_handle *handle)down_write_ref_node (&fte->node, false);for (i = handle->num_rules -1 ; i >=0 ; i--)tree_remove_node (&handle->rule[i]->node, true); -if (fte->dests_size) { -if (fte->modify_mask) -modify_fte (fte); -up_write_ref_node (&fte->node, false); - }else if (list_empty (&fte->node.children)) { +if (list_empty (&fte->node.children)) {del_hw_fte (&fte->node);/* Avoid double call to del_hw_fte */ fte->node.del_hw_func =NULL ;up_write_ref_node (&fte->node, false);tree_put_node (&fte->node, false); + }else if (fte->dests_size) { +if (fte->modify_mask) +modify_fte (fte); +up_write_ref_node (&fte->node, false); }else {up_write_ref_node (&fte->node, false); }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 40/76 ASoC: dapm: Don't fold register value changes into notifications
In reply to Sasha LevinFrom: Mark Brown <[email protected]>
[ Upstream commit ad685980469b9f9b99d4d6ea05f4cb8f57cb2234 ]
DAPM tracks and reports the value presented to the user from DAPM controls separately to the register value, these may diverge during initialisation or when an autodisable control is in use.
When writing DAPM controls we currently report that a change has occurred if either the DAPM value or the value stored in the register has changed, meaning that if the two are out of sync we may appear to report a spurious event to userspace. Since we use this folded in value for nothing other than the value reported to userspace simply drop the folding in of the register change.
--- sound/soc/soc-dapm.c | 2 -- 1 file changed, 2 deletions(-)
sound/soc/soc-dapm.c +0 -2
@@ -3427,7 +3427,6 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, update.val = val; card->update = &update; } - change |= reg_change; ret =soc_dapm_mixer_update_power (card, kcontrol, connect, rconnect);
@@ -3529,7 +3528,6 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, update.val = val; card->update = &update; } - change |= reg_change; ret =soc_dapm_mux_update_power (card, kcontrol, item[0 ], e);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 41/76 mlxsw: spectrum_dcb: Do not warn about priority changes
In reply to Sasha LevinFrom: Petr Machata <[email protected]>
[ Upstream commit b6b584562cbe7dc357083459d6dd5b171e12cadb ]
The idea behind the warnings is that the user would get warned in case when more than one priority is configured for a given DSCP value on a netdevice.
The warning is currently wrong, because dcb_ieee_getapp_mask() returns the first matching entry, not all of them, and the warning will then claim that some priority is "current", when in fact it is not.
But more importantly, the warning is misleading in general. Consider the following commands:
# dcb app flush dev swp19 dscp-prio # dcb app add dev swp19 dscp-prio 24:3 # dcb app replace dev swp19 dscp-prio 24:2
The last command will issue the following warning:
mlxsw_spectrum3 0000:07:00.0 swp19: Ignoring new priority 2 for DSCP 24 in favor of current value of 3
The reason is that the "replace" command works by first adding the new value, and then removing all old values. This is the only way to make the replacement without causing the traffic to be prioritized to whatever the chip defaults to. The warning is issued in response to adding the new priority, and then no warning is shown when the old priority is removed. The upshot is that the canonical way to change traffic prioritization always produces a warning about ignoring the new priority, but what gets configured is in fact what the user intended.
An option to just emit warning every time that the prioritization changes just to make it clear that it happened is obviously unsatisfactory.
Therefore, in this patch, remove the warnings.
--- drivers/net/ethernet/mellanox/mlxsw/spectrum_dcb.c | 13 ------------- 1 file changed, 13 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_dcb.c +0 -13
@@ -168,8 +168,6 @@ static int mlxsw_sp_dcbnl_ieee_setets(struct net_device *dev,static int mlxsw_sp_dcbnl_app_validate (struct net_device *dev,struct dcb_app *app) { -int prio; -if (app->priority >=IEEE_8021QAZ_MAX_TCS ) {netdev_err (dev,"APP entry with priority value %u is invalid\n" , app->priority);
@@ -183,17 +181,6 @@ static int mlxsw_sp_dcbnl_app_validate(struct net_device *dev, app->protocol);return -EINVAL ; } - -/* Warn about any DSCP APP entries with the same PID. */ - prio =fls (dcb_ieee_getapp_mask (dev, app)); -if (prio--) { -if (prio < app->priority) -netdev_warn (dev,"Choosing priority %d for DSCP %d in favor of previously-active value of %d\n" , - app->priority, app->protocol, prio); -else if (prio > app->priority) -netdev_warn (dev,"Ignoring new priority %d for DSCP %d in favor of current value of %d\n" , - app->priority, app->protocol, prio); - }break ;case IEEE_8021QAZ_APP_SEL_ETHERTYPE :
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 42/76 mlxsw: Treat LLDP packets as control
In reply to Sasha LevinFrom: Petr Machata <[email protected]>
[ Upstream commit 0106668cd2f91bf913fb78972840dedfba80a3c3 ]
When trapping packets for on-CPU processing, Spectrum machines differentiate between control and non-control traps. Traffic trapped through non-control traps is treated as data and kept in shared buffer in pools 0-4. Traffic trapped through control traps is kept in the dedicated control buffer 9. The advantage of marking traps as control is that pressure in the data plane does not prevent the control traffic to be processed.
When the LLDP trap was introduced, it was marked as a control trap. But then in commit aed4b5721143 ("mlxsw: spectrum: PTP: Hook into packet receive path"), PTP traps were introduced. Because Ethernet-encapsulated PTP packets look to the Spectrum-1 ASIC as LLDP traffic and are trapped under the LLDP trap, this trap was reconfigured as non-control, in sync with the PTP traps.
There is however no requirement that PTP traffic be handled as data. Besides, the usual encapsulation for PTP traffic is UDP, not bare Ethernet, and that is in deployments that even need PTP, which is far less common than LLDP. This is reflected by the default policer, which was not bumped up to the 19Kpps / 24Kpps that is the expected load of a PTP-enabled Spectrum-1 switch.
Marking of LLDP trap as non-control was therefore probably misguided. In this patch, change it back to control.
--- drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c +1 -1
@@ -709,7 +709,7 @@ static const struct mlxsw_sp_trap_item mlxsw_sp_trap_items_arr[] = { .trap = MLXSW_SP_TRAP_CONTROL(LLDP, LLDP, TRAP), .listeners_arr = {MLXSW_RXL (mlxsw_sp_rx_ptp_listener,LLDP ,TRAP_TO_CPU , - false, SP_LLDP, DISCARD), + true, SP_LLDP, DISCARD), }, }, {
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 43/76 drm/amdgpu/ucode: Remove firmware load type check in amdgpu_ucode_free_bo
In reply to Sasha LevinFrom: Alice Wong <[email protected]>
[ Upstream commit ab0cd4a9ae5b4679b714d8dbfedc0901fecdce9f ]
When psp_hw_init failed, it will set the load_type to AMDGPU_FW_LOAD_DIRECT. During amdgpu_device_ip_fini, amdgpu_ucode_free_bo checks that load_type is AMDGPU_FW_LOAD_DIRECT and skips deallocating fw_buf causing memory leak. Remove load_type check in amdgpu_ucode_free_bo.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +1 -2
@@ -625,8 +625,7 @@ int amdgpu_ucode_create_bo(struct amdgpu_device *adev)void amdgpu_ucode_free_bo (struct amdgpu_device *adev) { -if (adev->firmware.load_type !=AMDGPU_FW_LOAD_DIRECT ) -amdgpu_bo_free_kernel (&adev->firmware.fw_buf, +amdgpu_bo_free_kernel (&adev->firmware.fw_buf, &adev->firmware.fw_buf_mc, &adev->firmware.fw_buf_ptr); }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 44/76 HID: bigben: fix slab-out-of-bounds Write in bigben_probe
In reply to Sasha LevinFrom: Dongliang Mu <[email protected]>
[ Upstream commit fc4ef9d5724973193bfa5ebed181dba6de3a56db ]
There is a slab-out-of-bounds Write bug in hid-bigbenff driver. The problem is the driver assumes the device must have an input but some malicious devices violate this assumption.
Fix this by checking hid_device's input is non-empty before its usage.
--- drivers/hid/hid-bigbenff.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/hid/hid-bigbenff.c +6 -0
@@ -347,6 +347,12 @@ static int bigben_probe(struct hid_device *hid, bigben->report =list_entry (report_list->next, struct hid_report, list); +if (list_empty (&hid->inputs)) { +hid_err (hid,"no inputs found\n" ); + error = -ENODEV ; + goto error_hw_stop; + } + hidinput = list_first_entry(&hid->inputs, struct hid_input, list);set_bit (FF_RUMBLE , hidinput->input->ffbit);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 45/76 ASoC: tscs454: Add endianness flag in snd_soc_component_driver
In reply to Sasha LevinFrom: Charles Keepax <[email protected]>
[ Upstream commit ff69ec96b87dccb3a29edef8cec5d4fefbbc2055 ]
The endianness flag is used on the CODEC side to specify an ambivalence to endian, typically because it is lost over the hardware link. This device receives audio over an I2S DAI and as such should have endianness applied.
A fixup is also required to use the width directly rather than relying on the format in hw_params, now both little and big endian would be supported. It is worth noting this changes the behaviour of S24_LE to use a word length of 24 rather than 32. This would appear to be a correction since the fact S24_LE is stored as 32 bits should not be presented over the bus.
--- sound/soc/codecs/tscs454.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
sound/soc/codecs/tscs454.c +6 -6
@@ -3115,18 +3115,17 @@ static int set_aif_sample_format(struct snd_soc_component *component,unsigned int width;int ret; -switch (format) { -case SNDRV_PCM_FORMAT_S16_LE : +switch (snd_pcm_format_width (format)) { +case 16 : width =FV_WL_16 ;break ; -case SNDRV_PCM_FORMAT_S20_3LE : +case 20 : width =FV_WL_20 ;break ; -case SNDRV_PCM_FORMAT_S24_3LE : +case 24 : width =FV_WL_24 ;break ; -case SNDRV_PCM_FORMAT_S24_LE : -case SNDRV_PCM_FORMAT_S32_LE : +case 32 : width =FV_WL_32 ;break ;default :
@@ -3321,6 +3320,7 @@ static const struct snd_soc_component_driver soc_component_dev_tscs454 = { .num_dapm_routes = ARRAY_SIZE(tscs454_intercon), .controls = tscs454_snd_controls, .num_controls = ARRAY_SIZE(tscs454_snd_controls), + .endianness = 1, };#define TSCS454_RATES SNDRV_PCM_RATE_8000_96000
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 46/76 net: remove two BUG() from skb_checksum_help()
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit d7ea0d9df2a6265b2b180d17ebc64b38105968fc ]
I have a syzbot report that managed to get a crash in skb_checksum_help()
If syzbot can trigger these BUG(), it makes sense to replace them with more friendly WARN_ON_ONCE() since skb_checksum_help() can instead return an error code.
Note that syzbot will still crash there, until real bug is fixed.
--- net/core/dev.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/core/dev.c +6 -2
@@ -3241,11 +3241,15 @@ int skb_checksum_help(struct sk_buff *skb) } offset =skb_checksum_start_offset (skb); -BUG_ON (offset >=skb_headlen (skb)); + ret = -EINVAL ; +if (WARN_ON_ONCE (offset >=skb_headlen (skb))) + goto out; + csum =skb_checksum (skb, offset, skb->len - offset,0 ); offset += skb->csum_offset; -BUG_ON (offset +sizeof (__sum16) >skb_headlen (skb)); +if (WARN_ON_ONCE (offset +sizeof (__sum16) >skb_headlen (skb))) + goto out; ret =skb_ensure_writable (skb, offset +sizeof (__sum16));if (ret)
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 47/76 s390/preempt: disable __preempt_count_add() optimization for PROFILE_ALL_BRANCHES
In reply to Sasha LevinFrom: Heiko Carstens <[email protected]>
[ Upstream commit 63678eecec57fc51b778be3da35a397931287170 ]
gcc 12 does not (always) optimize away code that should only be generated if parameters are constant and within in a certain range. This depends on various obscure kernel config options, however in particular PROFILE_ALL_BRANCHES can trigger this compile error:
In function ‘__atomic_add_const’,
inlined from ‘__preempt_count_add.part.0’ at ./arch/s390/include/asm/preempt.h:50:3:
./arch/s390/include/asm/atomic_ops.h:80:9: error: impossible constraint in ‘asm’
80 | asm volatile( \
| ^~~Workaround this by simply disabling the optimization for PROFILE_ALL_BRANCHES, since the kernel will be so slow, that this optimization won't matter at all.
--- arch/s390/include/asm/preempt.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
arch/s390/include/asm/preempt.h +11 -4
@@ -46,10 +46,17 @@ static inline bool test_preempt_need_resched(void)static inline void __preempt_count_add (int val) { -if (__builtin_constant_p (val) && (val >=-128 ) && (val <=127 )) -__atomic_add_const (val, &S390_lowcore.preempt_count); -else -__atomic_add (val, &S390_lowcore.preempt_count); +/* +* With some obscure config options and CONFIG_PROFILE_ALL_BRANCHES +* enabled, gcc 12 fails to handle __builtin_constant_p(). +*/ +if (!IS_ENABLED (CONFIG_PROFILE_ALL_BRANCHES )) { +if (__builtin_constant_p (val) && (val >=-128 ) && (val <=127 )) { +__atomic_add_const (val, &S390_lowcore.preempt_count); +return ; + } + } +__atomic_add (val, &S390_lowcore.preempt_count); }static inline void __preempt_count_sub (int val)
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 48/76 perf/amd/ibs: Cascade pmu init functions' return value
In reply to Sasha LevinFrom: Ravi Bangoria <[email protected]>
[ Upstream commit 39b2ca75eec8a33e2ffdb8aa0c4840ec3e3b472c ]
IBS pmu initialization code ignores return value provided by callee functions. Fix it.
--- arch/x86/events/amd/ibs.c | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-)
arch/x86/events/amd/ibs.c +29 -8
@@ -764,9 +764,10 @@ static __init int perf_ibs_pmu_init(struct perf_ibs *perf_ibs, char *name)return ret; } -static __init void perf_event_ibs_init (void ) +static __init int perf_event_ibs_init (void ) {struct attribute **attr = ibs_op_format_attrs; +int ret;/* * Some chips fail to reset the fetch count when it is written; instead
@@ -778,7 +779,9 @@ static __init void perf_event_ibs_init(void)if (boot_cpu_data.x86 ==0x19 && boot_cpu_data.x86_model <0x10 ) perf_ibs_fetch.fetch_ignore_if_zero_rip =1 ; -perf_ibs_pmu_init (&perf_ibs_fetch,"ibs_fetch" ); + ret =perf_ibs_pmu_init (&perf_ibs_fetch,"ibs_fetch" ); +if (ret) +return ret;if (ibs_caps &IBS_CAPS_OPCNT ) { perf_ibs_op.config_mask |=IBS_OP_CNT_CTL ;
@@ -791,15 +794,35 @@ static __init void perf_event_ibs_init(void) perf_ibs_op.cnt_mask |= IBS_OP_MAX_CNT_EXT_MASK; } -perf_ibs_pmu_init (&perf_ibs_op,"ibs_op" ); + ret =perf_ibs_pmu_init (&perf_ibs_op,"ibs_op" ); +if (ret) + goto err_op; + + ret =register_nmi_handler (NMI_LOCAL , perf_ibs_nmi_handler,0 ,"perf_ibs" ); +if (ret) + goto err_nmi; -register_nmi_handler (NMI_LOCAL , perf_ibs_nmi_handler,0 ,"perf_ibs" );pr_info ("perf: AMD IBS detected (0x%08x)\n" , ibs_caps); +return 0 ; + +err_nmi: +perf_pmu_unregister (&perf_ibs_op.pmu); +free_percpu (perf_ibs_op.pcpu); + perf_ibs_op.pcpu =NULL ; +err_op: +perf_pmu_unregister (&perf_ibs_fetch.pmu); +free_percpu (perf_ibs_fetch.pcpu); + perf_ibs_fetch.pcpu =NULL ; + +return ret; }#else /* defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_AMD) */ -static __init void perf_event_ibs_init (void ) { } +static __init int perf_event_ibs_init (void ) +{ +return 0 ; +}#endif
@@ -1069,9 +1092,7 @@ static __init int amd_ibs_init(void) x86_pmu_amd_ibs_starting_cpu, x86_pmu_amd_ibs_dying_cpu); -perf_event_ibs_init (); - -return 0 ; +return perf_event_ibs_init (); }/* Since we need the pci subsystem to init ibs we can't do this earlier: */
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 49/76 spi: stm32-qspi: Fix wait_cmd timeout in APM mode
In reply to Sasha LevinFrom: Patrice Chotard <[email protected]>
[ Upstream commit d83d89ea68b4726700fa87b22db075e4217e691c ]
In APM mode, TCF and TEF flags are not set. To avoid timeout in stm32_qspi_wait_cmd(), don't check if TCF/TEF are set.
--- drivers/spi/spi-stm32-qspi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/spi/spi-stm32-qspi.c +2 -1
@@ -295,7 +295,8 @@ static int stm32_qspi_wait_cmd(struct stm32_qspi *qspi,if (!op->data.nbytes) goto wait_nobusy; -if (readl_relaxed (qspi->io_base +QSPI_SR ) &SR_TCF ) +if ((readl_relaxed (qspi->io_base +QSPI_SR ) &SR_TCF ) || + qspi->fmode ==CCR_FMODE_APM ) goto out;reinit_completion (&qspi->data_completion);
Signature · 7 lines
2.35.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 50/76 dma-debug: change allocation mode from GFP_NOWAIT to GFP_ATIOMIC
In reply to Sasha LevinFrom: Mikulas Patocka <[email protected]>
[ Upstream commit 84bc4f1dbbbb5f8aa68706a96711dccb28b518e5 ]
We observed the error "cacheline tracking ENOMEM, dma-debug disabled" during a light system load (copying some files). The reason for this error is that the dma_active_cacheline radix tree uses GFP_NOWAIT allocation - so it can't access the emergency memory reserves and it fails as soon as anybody reaches the watermark.
This patch changes GFP_NOWAIT to GFP_ATOMIC, so that it can access the emergency memory reserves.
--- kernel/dma/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/dma/debug.c +1 -1
@@ -448,7 +448,7 @@ void debug_dma_dump_mappings(struct device *dev)* other hand, consumes a single dma_debug_entry, but inserts 'nents' * entries into the tree. */ -static RADIX_TREE(dma_active_cacheline, GFP_NOWAIT); +static RADIX_TREE(dma_active_cacheline, GFP_ATOMIC);static DEFINE_SPINLOCK (radix_lock);#define ACTIVE_CACHELINE_MAX_OVERLAP ((1 << RADIX_TREE_MAX_TAGS) - 1)#define CACHELINE_PER_PAGE_SHIFT (PAGE_SHIFT - L1_CACHE_SHIFT)
Signature · 6 lines
2.35.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Sasha Levin
maintainerPATCH 51/76 ACPI: PM: Block ASUS B1400CEAE from suspend to idle by default
In reply to Sasha LevinFrom: Mario Limonciello <[email protected]>
[ Upstream commit d52848620de00cde4a3a5df908e231b8c8868250 ]
ASUS B1400CEAE fails to resume from suspend to idle by default. This was bisected back to commit df4f9bc4fb9c ("nvme-pci: add support for ACPI StorageD3Enable property") but this is a red herring to the problem.
Before this commit the system wasn't getting into deepest sleep state. Presumably this commit is allowing entry into deepest sleep state as advertised by firmware, but there are some other problems related to the wakeup.
As it is confirmed the system works properly with S3, set the default for this system to S3.
--- drivers/acpi/sleep.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/acpi/sleep.c +12 -0
@@ -377,6 +377,18 @@ static const struct dmi_system_id acpisleep_dmi_table[] __initconst = { DMI_MATCH(DMI_PRODUCT_NAME, "20GGA00L00"), }, }, +/* +* ASUS B1400CEAE hangs on resume from suspend (see +* https://bugzilla.kernel.org/show_bug.cgi?id=215742). +*/ + { + .callback = init_default_s3, + .ident = "ASUS B1400CEAE", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "ASUS EXPERTBOOK B1400CEAE"), + }, + }, {}, };
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 52/76 ipmi:ssif: Check for NULL msg when handling events and messages
In reply to Sasha LevinFrom: Corey Minyard <[email protected]>
[ Upstream commit 7602b957e2404e5f98d9a40b68f1fd27f0028712 ]
Even though it's not possible to get into the SSIF_GETTING_MESSAGES and SSIF_GETTING_EVENTS states without a valid message in the msg field, it's probably best to be defensive here and check and print a log, since that means something else went wrong.
Also add a default clause to that switch statement to release the lock and print a log, in case the state variable gets messed up somehow.
--- drivers/char/ipmi/ipmi_ssif.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
drivers/char/ipmi/ipmi_ssif.c +23 -0
@@ -840,6 +840,14 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result,break ;case SSIF_GETTING_EVENTS : +if (!msg) { +/* Should never happen, but just in case. */ +dev_warn (&ssif_info->client->dev, +"No message set while getting events\n" ); +ipmi_ssif_unlock_cond (ssif_info, flags); +break ; + } +if ((result <0 ) || (len <3 ) || (msg->rsp[2 ] !=0 )) {/* Error getting event, probably done. */ msg->done (msg);
@@ -864,6 +872,14 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result,break ;case SSIF_GETTING_MESSAGES : +if (!msg) { +/* Should never happen, but just in case. */ +dev_warn (&ssif_info->client->dev, +"No message set while getting messages\n" ); +ipmi_ssif_unlock_cond (ssif_info, flags); +break ; + } +if ((result <0 ) || (len <3 ) || (msg->rsp[2 ] !=0 )) {/* Error getting event, probably done. */ msg->done (msg);
@@ -887,6 +903,13 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result,deliver_recv_msg (ssif_info, msg); }break ; + +default : +/* Should never happen, but just in case. */ +dev_warn (&ssif_info->client->dev, +"Invalid state in message done handling: %d\n" , + ssif_info->ssif_state); +ipmi_ssif_unlock_cond (ssif_info, flags); } flags =ipmi_ssif_lock_cond (ssif_info, &oflags);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 53/76 ipmi: Fix pr_fmt to avoid compilation issues
In reply to Sasha LevinFrom: Corey Minyard <[email protected]>
[ Upstream commit 2ebaf18a0b7fb764bba6c806af99fe868cee93de ]
The was it was wouldn't work in some situations, simplify it. What was there was unnecessary complexity.
--- drivers/char/ipmi/ipmi_msghandler.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/char/ipmi/ipmi_msghandler.c +2 -2
@@ -11,8 +11,8 @@* Copyright 2002 MontaVista Software Inc. */ -#define pr_fmt (fmt) "%s" fmt, "IPMI message handler: " -#define dev_fmt pr_fmt +#define pr_fmt (fmt) "IPMI message handler: " fmt +#define dev_fmt (fmt) pr_fmt(fmt)#include <linux/module.h> #include <linux/errno.h>
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 54/76 rtlwifi: Use pr_warn instead of WARN_ONCE
In reply to Sasha LevinFrom: Dongliang Mu <[email protected]>
[ Upstream commit ad732da434a2936128769216eddaece3b1af4588 ]
This memory allocation failure can be triggered by fault injection or high pressure testing, resulting a WARN.
Fix this by replacing WARN with pr_warn.
--- drivers/net/wireless/realtek/rtlwifi/usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtlwifi/usb.c +1 -1
@@ -1015,7 +1015,7 @@ int rtl_usb_probe(struct usb_interface *intf, hw =ieee80211_alloc_hw (sizeof (struct rtl_priv ) +sizeof (struct rtl_usb_priv ), &rtl_ops);if (!hw) { -WARN_ONCE (true,"rtl_usb: ieee80211 alloc failed\n" ); +pr_warn ("rtl_usb: ieee80211 alloc failed\n" );return -ENOMEM ; } rtlpriv = hw->priv;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 55/76 media: rga: fix possible memory leak in rga_probe
In reply to Sasha LevinFrom: Hangyu Hua <[email protected]>
[ Upstream commit a71eb6025305192e646040cd76ccacb5bd48a1b5 ]
rga->m2m_dev needs to be freed when rga_probe fails.
--- drivers/media/platform/rockchip/rga/rga.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/media/platform/rockchip/rga/rga.c +4 -2
@@ -868,7 +868,7 @@ static int rga_probe(struct platform_device *pdev) ret =pm_runtime_resume_and_get (rga->dev);if (ret <0 ) - goto rel_vdev; + goto rel_m2m; rga->version.major = (rga_read (rga,RGA_VERSION_INFO ) >>24 ) &0xFF ; rga->version.minor = (rga_read (rga,RGA_VERSION_INFO ) >>20 ) &0x0F ;
@@ -884,7 +884,7 @@ static int rga_probe(struct platform_device *pdev) DMA_ATTR_WRITE_COMBINE);if (!rga->cmdbuf_virt) { ret = -ENOMEM ; - goto rel_vdev; + goto rel_m2m; } rga->src_mmu_pages =
@@ -921,6 +921,8 @@ static int rga_probe(struct platform_device *pdev) free_dma:dma_free_attrs (rga->dev,RGA_CMDBUF_SIZE , rga->cmdbuf_virt, rga->cmdbuf_phy,DMA_ATTR_WRITE_COMBINE ); +rel_m2m: +v4l2_m2m_release (rga->m2m_dev); rel_vdev:video_device_release (vfd); unreg_v4l2_dev:
Signature · 7 lines
2.35.1 _______________________________________________ Linux-rockchip mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-rockchip
Sasha Levin
maintainerPATCH 56/76 media: coda: limit frame interval enumeration to supported encoder frame sizes
In reply to Sasha LevinFrom: Philipp Zabel <[email protected]>
[ Upstream commit 67e33dd957880879e785cfea83a3aa24bd5c5577 ]
Let VIDIOC_ENUM_FRAMEINTERVALS return -EINVAL if userspace queries frame intervals for frame sizes unsupported by the encoder. Fixes the following v4l2-compliance failure:
fail: v4l2-test-formats.cpp(123): found frame intervals for invalid size 47x16
fail: v4l2-test-formats.cpp(282): node->codec_mask & STATEFUL_ENCODER
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: FAIL
[hverkuil: drop incorrect 'For decoder devices, return -ENOTTY.' in the commit log]
--- drivers/media/platform/coda/coda-common.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/media/platform/coda/coda-common.c +14 -6
@@ -1318,7 +1318,8 @@ static int coda_enum_frameintervals(struct file *file, void *fh, struct v4l2_frmivalenum *f) {struct coda_ctx *ctx =fh_to_ctx (fh); -int i; +struct coda_q_data *q_data; +const struct coda_codec *codec;if (f->index)return -EINVAL ;
@@ -1327,12 +1328,19 @@ static int coda_enum_frameintervals(struct file *file, void *fh,if (!ctx->vdoa && f->pixel_format ==V4L2_PIX_FMT_YUYV )return -EINVAL ; -for (i =0 ; i <CODA_MAX_FORMATS ; i++) { -if (f->pixel_format == ctx->cvd->src_formats[i] || - f->pixel_format == ctx->cvd->dst_formats[i]) -break ; +if (coda_format_normalize_yuv (f->pixel_format) ==V4L2_PIX_FMT_YUV420 ) { + q_data =get_q_data (ctx,V4L2_BUF_TYPE_VIDEO_CAPTURE ); + codec =coda_find_codec (ctx->dev, f->pixel_format, + q_data->fourcc); + }else { + codec =coda_find_codec (ctx->dev,V4L2_PIX_FMT_YUV420 , + f->pixel_format); } -if (i ==CODA_MAX_FORMATS ) +if (!codec) +return -EINVAL ; + +if (f->width <MIN_W || f->width > codec->max_w || + f->height <MIN_H || f->height > codec->max_h)return -EINVAL ; f->type =V4L2_FRMIVAL_TYPE_CONTINUOUS ;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 57/76 media: imon: reorganize serialization
In reply to Sasha LevinFrom: Tetsuo Handa <[email protected]>
[ Upstream commit db264d4c66c0fe007b5d19fd007707cd0697603d ]
Since usb_register_dev() from imon_init_display() from imon_probe() holds minor_rwsem while display_open() which holds driver_lock and ictx->lock is called with minor_rwsem held from usb_open(), holding driver_lock or ictx->lock when calling usb_register_dev() causes circular locking dependency problem.
Since usb_deregister_dev() from imon_disconnect() holds minor_rwsem while display_open() which holds driver_lock is called with minor_rwsem held, holding driver_lock when calling usb_deregister_dev() also causes circular locking dependency problem.
Sean Young explained that the problem is there are imon devices which have two usb interfaces, even though it is one device. The probe and disconnect function of both usb interfaces can run concurrently.
Alan Stern responded that the driver and USB cores guarantee that when an interface is probed, both the interface and its USB device are locked. Ditto for when the disconnect callback gets run. So concurrent probing/ disconnection of multiple interfaces on the same device is not possible.
Therefore, we don't need locks for handling race between imon_probe() and imon_disconnect(). But we still need to handle race between display_open() /vfd_write()/lcd_write()/display_close() and imon_disconnect(), for disconnect event can happen while file descriptors are in use.
Since "struct file"->private_data is set by display_open(), vfd_write()/ lcd_write()/display_close() can assume that "struct file"->private_data is not NULL even after usb_set_intfdata(interface, NULL) was called.
Replace insufficiently held driver_lock with refcount_t based management. Add a boolean flag for recording whether imon_disconnect() was already called. Use RCU for accessing this boolean flag and refcount_t.
Since the boolean flag for imon_disconnect() is shared, disconnect event on either intf0 or intf1 affects both interfaces. But I assume that this change does not matter, for usually disconnect event would not happen while interfaces are in use.
--- drivers/media/rc/imon.c | 99 +++++++++++++++++++---------------------- 1 file changed, 47 insertions(+), 52 deletions(-)
drivers/media/rc/imon.c +47 -52
@@ -153,6 +153,24 @@ struct imon_context {const struct imon_usb_dev_descr *dev_descr;/* device description with key */ /* table for front panels */ +/* +* Fields for deferring free_imon_context(). +* +* Since reference to "struct imon_context" is stored into +* "struct file"->private_data, we need to remember +* how many file descriptors might access this "struct imon_context". +*/ +refcount_t users; +/* +* Use a flag for telling display_open()/vfd_write()/lcd_write() that +* imon_disconnect() was already called. +*/ +bool disconnected; +/* +* We need to wait for RCU grace period in order to allow +* display_open() to safely check ->disconnected and increment ->users. +*/ +struct rcu_head rcu; };#define TOUCH_TIMEOUT (HZ/30)
@@ -160,18 +178,18 @@ struct imon_context {/* vfd character device file operations */ static const struct file_operations vfd_fops = { .owner =THIS_MODULE , - .open = &display_open, - .write = &vfd_write, - .release = &display_close, + .open = display_open, + .write = vfd_write, + .release = display_close, .llseek = noop_llseek, };/* lcd character device file operations */ static const struct file_operations lcd_fops = { .owner =THIS_MODULE , - .open = &display_open, - .write = &lcd_write, - .release = &display_close, + .open = display_open, + .write = lcd_write, + .release = display_close, .llseek = noop_llseek, };
@@ -439,9 +457,6 @@ static struct usb_driver imon_driver = { .id_table = imon_usb_id_table, }; -/* to prevent races between open() and disconnect(), probing, etc */ -static DEFINE_MUTEX (driver_lock); -/* Module bookkeeping bits */ MODULE_AUTHOR (MOD_AUTHOR );MODULE_DESCRIPTION (MOD_DESC );
@@ -481,9 +496,11 @@ static void free_imon_context(struct imon_context *ictx)struct device *dev = ictx->dev;usb_free_urb (ictx->tx_urb); +WARN_ON (ictx->dev_present_intf0);usb_free_urb (ictx->rx_urb_intf0); +WARN_ON (ictx->dev_present_intf1);usb_free_urb (ictx->rx_urb_intf1); -kfree (ictx); +kfree_rcu (ictx, rcu);dev_dbg (dev,"%s: iMON context freed\n" , __func__); }
@@ -499,9 +516,6 @@ static int display_open(struct inode *inode, struct file *file)int subminor;int retval =0 ; -/* prevent races with disconnect */ -mutex_lock (&driver_lock); - subminor =iminor (inode); interface =usb_find_interface (&imon_driver, subminor);if (!interface) {
@@ -509,13 +523,16 @@ static int display_open(struct inode *inode, struct file *file) retval = -ENODEV ; goto exit; } - ictx =usb_get_intfdata (interface); -if (!ictx) { +rcu_read_lock (); + ictx =usb_get_intfdata (interface); +if (!ictx || ictx->disconnected || !refcount_inc_not_zero (&ictx->users)) { +rcu_read_unlock ();pr_err ("no context found for minor %d\n" , subminor); retval = -ENODEV ; goto exit; } +rcu_read_unlock ();mutex_lock (&ictx->lock);
@@ -533,8 +550,10 @@ static int display_open(struct inode *inode, struct file *file)mutex_unlock (&ictx->lock); +if (retval &&refcount_dec_and_test (&ictx->users)) +free_imon_context (ictx); + exit: -mutex_unlock (&driver_lock);return retval; }
@@ -544,16 +563,9 @@ static int display_open(struct inode *inode, struct file *file)*/ static int display_close (struct inode *inode,struct file *file) { -struct imon_context *ictx =NULL ; +struct imon_context *ictx = file->private_data;int retval =0 ; - ictx = file->private_data; - -if (!ictx) { -pr_err ("no context for device\n" ); -return -ENODEV ; - } -mutex_lock (&ictx->lock);if (!ictx->display_supported) {
@@ -568,6 +580,8 @@ static int display_close(struct inode *inode, struct file *file) }mutex_unlock (&ictx->lock); +if (refcount_dec_and_test (&ictx->users)) +free_imon_context (ictx);return retval; }
@@ -937,15 +951,12 @@ static ssize_t vfd_write(struct file *file, const char __user *buf,int offset;int seq;int retval =0 ; -struct imon_context *ictx; +struct imon_context *ictx = file->private_data;static const unsigned char vfd_packet6[] = {0x01 ,0x00 ,0x00 ,0x00 ,0x00 ,0xFF ,0xFF }; - ictx = file->private_data; -if (!ictx) { -pr_err_ratelimited ("no context for device\n" ); +if (ictx->disconnected)return -ENODEV ; - }mutex_lock (&ictx->lock);
@@ -1021,13 +1032,10 @@ static ssize_t lcd_write(struct file *file, const char __user *buf, size_t n_bytes, loff_t *pos) { int retval = 0; -struct imon_context *ictx; +struct imon_context *ictx = file->private_data; - ictx = file->private_data; -if (!ictx) { -pr_err_ratelimited ("no context for device\n" ); +if (ictx->disconnected)return -ENODEV ; - }mutex_lock (&ictx->lock);
@@ -2405,7 +2413,6 @@ static int imon_probe(struct usb_interface *interface,int ifnum, sysfs_err;int ret =0 ;struct imon_context *ictx =NULL ; -struct imon_context *first_if_ctx =NULL ;u16 vendor, product; usbdev =usb_get_dev (interface_to_usbdev (interface));
@@ -2417,17 +2424,12 @@ static int imon_probe(struct usb_interface *interface,dev_dbg (dev,"%s: found iMON device (%04x:%04x, intf%d)\n" , __func__, vendor, product, ifnum); -/* prevent races probing devices w/multiple interfaces */ -mutex_lock (&driver_lock); - first_if =usb_ifnum_to_if (usbdev,0 );if (!first_if) { ret = -ENODEV ; goto fail; } - first_if_ctx =usb_get_intfdata (first_if); -if (ifnum ==0 ) { ictx =imon_init_intf0 (interface, id);if (!ictx) {
@@ -2435,9 +2437,11 @@ static int imon_probe(struct usb_interface *interface, ret = -ENODEV ; goto fail; } +refcount_set (&ictx->users,1 ); }else {/* this is the secondary interface on the device */ +struct imon_context *first_if_ctx =usb_get_intfdata (first_if);/* fail early if first intf failed to register */ if (!first_if_ctx) {
@@ -2451,14 +2455,13 @@ static int imon_probe(struct usb_interface *interface, ret = -ENODEV ; goto fail; } +refcount_inc (&ictx->users); }usb_set_intfdata (interface, ictx);if (ifnum ==0 ) { -mutex_lock (&ictx->lock); -if (product ==0xffdc && ictx->rf_device) { sysfs_err =sysfs_create_group (&interface->dev.kobj, &imon_rf_attr_group);
@@ -2469,21 +2472,17 @@ static int imon_probe(struct usb_interface *interface,if (ictx->display_supported)imon_init_display (ictx, interface); - -mutex_unlock (&ictx->lock); }dev_info (dev,"iMON device (%04x:%04x, intf%d) on usb<%d:%d> initialized\n" , vendor, product, ifnum, usbdev->bus->busnum, usbdev->devnum); -mutex_unlock (&driver_lock);usb_put_dev (usbdev);return 0 ; fail: -mutex_unlock (&driver_lock);usb_put_dev (usbdev);dev_err (dev,"unable to register, err %d\n" , ret);
@@ -2499,10 +2498,8 @@ static void imon_disconnect(struct usb_interface *interface)struct device *dev;int ifnum; -/* prevent races with multi-interface device probing and display_open */ -mutex_lock (&driver_lock); - ictx =usb_get_intfdata (interface); + ictx->disconnected = true; dev = ictx->dev; ifnum = interface->cur_altsetting->desc.bInterfaceNumber;
@@ -2543,11 +2540,9 @@ static void imon_disconnect(struct usb_interface *interface) } } -if (!ictx->dev_present_intf0 && !ictx->dev_present_intf1) +if (refcount_dec_and_test (&ictx->users))free_imon_context (ictx); -mutex_unlock (&driver_lock); -dev_dbg (dev,"%s: iMON device (intf%d) disconnected\n" , __func__, ifnum); }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 58/76 media: cec-adap.c: fix is_configuring state
In reply to Sasha LevinFrom: Hans Verkuil <[email protected]>
[ Upstream commit 59267fc34f4900dcd2ec3295f6be04b79aee2186 ]
If an adapter is trying to claim a free logical address then it is in the 'is_configuring' state. If during that process the cable is disconnected (HPD goes low, which in turn invalidates the physical address), then cec_adap_unconfigure() is called, and that set the is_configuring boolean to false, even though the thread that's trying to claim an LA is still running.
Don't touch the is_configuring bool in cec_adap_unconfigure(), it will eventually be cleared by the thread. By making that change the cec_config_log_addr() function also had to change: it was aborting if is_configuring became false (since that is what cec_adap_unconfigure() did), but that no longer works. Instead check if the physical address is invalid. That is a much more appropriate check anyway.
This fixes a bug where the the adapter could be disabled even though the device was still configuring. This could cause POLL transmits to time out.
--- drivers/media/cec/core/cec-adap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/cec/core/cec-adap.c +3 -3
@@ -1271,7 +1271,7 @@ static int cec_config_log_addr(struct cec_adapter *adap,* While trying to poll the physical address was reset * and the adapter was unconfigured, so bail out. */ -if (!adap->is_configuring) +if (adap->phys_addr ==CEC_PHYS_ADDR_INVALID )return -EINTR ;if (err)
@@ -1328,7 +1328,6 @@ static void cec_adap_unconfigure(struct cec_adapter *adap) adap->phys_addr != CEC_PHYS_ADDR_INVALID)WARN_ON (adap->ops->adap_log_addr (adap,CEC_LOG_ADDR_INVALID )); adap->log_addrs.log_addr_mask =0 ; - adap->is_configuring = false; adap->is_configured = false;cec_flush (adap);wake_up_interruptible (&adap->kthread_waitq);
@@ -1520,9 +1519,10 @@ static int cec_config_thread_func(void *arg)for (i =0 ; i < las->num_log_addrs; i++) las->log_addr[i] =CEC_LOG_ADDR_INVALID ;cec_adap_unconfigure (adap); + adap->is_configuring = false; adap->kthread_config =NULL ; -mutex_unlock (&adap->lock);complete (&adap->config_completion); +mutex_unlock (&adap->lock);return 0 ; }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 59/76 openrisc: start CPU timer early in boot
In reply to Sasha LevinFrom: "Jason A. Donenfeld" <[email protected]>
[ Upstream commit 516dd4aacd67a0f27da94f3fe63fe0f4dbab6e2b ]
In order to measure the boot process, the timer should be switched on as early in boot as possible. As well, the commit defines the get_cycles macro, like the previous patches in this series, so that generic code is aware that it's implemented by the platform, as is done on other archs.
--- arch/openrisc/include/asm/timex.h | 1 + arch/openrisc/kernel/head.S | 9 +++++++++ 2 files changed, 10 insertions(+)
arch/openrisc/include/asm/timex.h +1 -0
@@ -23,6 +23,7 @@ static inline cycles_t get_cycles(void) {return mfspr (SPR_TTCR ); } +#define get_cycles get_cycles/* This isn't really used any more */ #define CLOCK_TICK_RATE 1000
arch/openrisc/kernel/head.S +9 -0
@@ -521,6 +521,15 @@ _start: l.ori r3,r0,0x1 l.mtspr r0,r3,SPR_SR + /* + * Start the TTCR as early as possible, so that the RNG can make use of + * measurements of boot time from the earliest opportunity. Especially + * important is that the TTCR does not return zero by the time we reach + * rand_initialize(). + */ + l.movhi r3,hi(SPR_TTMR_CR) + l.mtspr r0,r3,SPR_TTMR + CLEAR_GPR(r1) CLEAR_GPR(r2) CLEAR_GPR(r3)
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 60/76 nvme-pci: fix a NULL pointer dereference in nvme_alloc_admin_tags
In reply to Sasha LevinFrom: "Smith, Kyle Miller (Nimble Kernel)" <[email protected]>
[ Upstream commit da42761181627e9bdc37d18368b827948a583929 ]
In nvme_alloc_admin_tags, the admin_q can be set to an error (typically -ENOMEM) if the blk_mq_init_queue call fails to set up the queue, which is checked immediately after the call. However, when we return the error message up the stack, to nvme_reset_work the error takes us to nvme_remove_dead_ctrl()
nvme_dev_disable()
nvme_suspend_queue(&dev->queues[0]).
Here, we only check that the admin_q is non-NULL, rather than not an error or NULL, and begin quiescing a queue that never existed, leading to bad / NULL pointer dereference.
--- drivers/nvme/host/pci.c | 1 + 1 file changed, 1 insertion(+)
drivers/nvme/host/pci.c +1 -0
@@ -1666,6 +1666,7 @@ static int nvme_alloc_admin_tags(struct nvme_dev *dev) dev->ctrl.admin_q =blk_mq_init_queue (&dev->admin_tagset);if (IS_ERR (dev->ctrl.admin_q)) {blk_mq_free_tag_set (&dev->admin_tagset); + dev->ctrl.admin_q =NULL ;return -ENOMEM ; }if (!blk_get_queue (dev->ctrl.admin_q)) {
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 61/76 ASoC: rt5645: Fix errorenous cleanup order
In reply to Sasha LevinFrom: Lin Ma <[email protected]>
[ Upstream commit 2def44d3aec59e38d2701c568d65540783f90f2f ]
There is a logic error when removing rt5645 device as the function rt5645_i2c_remove() first cancel the &rt5645->jack_detect_work and delete the &rt5645->btn_check_timer latter. However, since the timer handler rt5645_btn_check_callback() will re-queue the jack_detect_work, this cleanup order is buggy.
That is, once the del_timer_sync in rt5645_i2c_remove is concurrently run with the rt5645_btn_check_callback, the canceled jack_detect_work will be rescheduled again, leading to possible use-after-free.
This patch fix the issue by placing the del_timer_sync function before the cancel_delayed_work_sync.
--- sound/soc/codecs/rt5645.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
sound/soc/codecs/rt5645.c +6 -1
@@ -4095,9 +4095,14 @@ static int rt5645_i2c_remove(struct i2c_client *i2c)if (i2c->irq)free_irq (i2c->irq, rt5645); +/* +* Since the rt5645_btn_check_callback() can queue jack_detect_work, +* the timer need to be delted first +*/ +del_timer_sync (&rt5645->btn_check_timer); +cancel_delayed_work_sync (&rt5645->jack_detect_work);cancel_delayed_work_sync (&rt5645->rcclock_work); -del_timer_sync (&rt5645->btn_check_timer);regulator_bulk_disable (ARRAY_SIZE (rt5645->supplies), rt5645->supplies);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 62/76 nbd: Fix hung on disconnect request if socket is closed before
In reply to Sasha LevinFrom: Xie Yongji <[email protected]>
[ Upstream commit 491bf8f236fdeec698fa6744993f1ecf3fafd1a5 ]
When userspace closes the socket before sending a disconnect request, the following I/O requests will be blocked in wait_for_reconnect() until dead timeout. This will cause the following disconnect request also hung on blk_mq_quiesce_queue(). That means we have no way to disconnect a nbd device if there are some I/O requests waiting for reconnecting until dead timeout. It's not expected. So let's wake up the thread waiting for reconnecting directly when a disconnect request is sent.
--- drivers/block/nbd.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/block/nbd.c +9 -4
@@ -880,11 +880,15 @@ static int wait_for_reconnect(struct nbd_device *nbd)struct nbd_config *config = nbd->config;if (!config->dead_conn_timeout)return 0 ; -if (test_bit (NBD_RT_DISCONNECTED , &config->runtime_flags)) + +if (!wait_event_timeout (config->conn_wait, +test_bit (NBD_RT_DISCONNECTED , + &config->runtime_flags) || +atomic_read (&config->live_connections) >0 , + config->dead_conn_timeout))return 0 ; -return wait_event_timeout (config->conn_wait, -atomic_read (&config->live_connections) >0 , - config->dead_conn_timeout) >0 ; + +return !test_bit (NBD_RT_DISCONNECTED , &config->runtime_flags); }static int nbd_handle_cmd (struct nbd_cmd *cmd,int index)
@@ -2029,6 +2033,7 @@ static void nbd_disconnect_and_put(struct nbd_device *nbd)mutex_lock (&nbd->config_lock);nbd_disconnect (nbd);sock_shutdown (nbd); +wake_up (&nbd->config->conn_wait);/* * Make sure recv thread has finished, so it does not drop the last * config ref and try to destroy the workqueue from inside the work
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 63/76 net: phy: micrel: Allow probing without .driver_data
In reply to Sasha LevinFrom: Fabio Estevam <[email protected]>
[ Upstream commit f2ef6f7539c68c6bd6c32323d8845ee102b7c450 ]
Currently, if the .probe element is present in the phy_driver structure and the .driver_data is not, a NULL pointer dereference happens.
Allow passing .probe without .driver_data by inserting NULL checks for priv->type.
--- drivers/net/phy/micrel.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/phy/micrel.c +6 -5
@@ -283,7 +283,7 @@ static int kszphy_config_reset(struct phy_device *phydev) } } -if (priv->led_mode >=0 ) +if (priv->type && priv->led_mode >=0 )kszphy_setup_led (phydev, priv->type->led_mode_reg, priv->led_mode);return 0 ;
@@ -299,10 +299,10 @@ static int kszphy_config_init(struct phy_device *phydev) type = priv->type; -if (type->has_broadcast_disable) +if (type && type->has_broadcast_disable)kszphy_broadcast_disable (phydev); -if (type->has_nand_tree_disable) +if (type && type->has_nand_tree_disable)kszphy_nand_tree_disable (phydev);return kszphy_config_reset (phydev);
@@ -1112,7 +1112,7 @@ static int kszphy_probe(struct phy_device *phydev) priv->type = type; -if (type->led_mode_reg) { +if (type && type->led_mode_reg) { ret =of_property_read_u32 (np,"micrel,led-mode" , &priv->led_mode);if (ret)
@@ -1133,7 +1133,8 @@ static int kszphy_probe(struct phy_device *phydev)unsigned long rate =clk_get_rate (clk);bool rmii_ref_clk_sel_25_mhz; - priv->rmii_ref_clk_sel = type->has_rmii_ref_clk_sel; +if (type) + priv->rmii_ref_clk_sel = type->has_rmii_ref_clk_sel; rmii_ref_clk_sel_25_mhz =of_property_read_bool (np,"micrel,rmii-reference-clock-select-25-mhz" );
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 64/76 media: exynos4-is: Fix compile warning
In reply to Sasha LevinFrom: Kwanghoon Son <[email protected]>
[ Upstream commit e080f5c1f2b6d02c02ee5d674e0e392ccf63bbaf ]
Declare static on function 'fimc_isp_video_device_unregister'.
When VIDEO_EXYNOS4_ISP_DMA_CAPTURE=n, compiler warns about
warning: no previous prototype for function [-Wmissing-prototypes]
--- drivers/media/platform/exynos4-is/fimc-isp-video.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/exynos4-is/fimc-isp-video.h +1 -1
@@ -32,7 +32,7 @@ static inline int fimc_isp_video_device_register(struct fimc_isp *isp,return 0 ; } -void fimc_isp_video_device_unregister (struct fimc_isp *isp, +static inline void fimc_isp_video_device_unregister (struct fimc_isp *isp,enum v4l2_buf_type type) { }
Signature · 7 lines
2.35.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 65/76 ASoC: max98357a: remove dependency on GPIOLIB
In reply to Sasha LevinFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit 21ca3274333f5c1cbbf9d91e5b33f4f2463859b2 ]
commit dcc2c012c7691 ("ASoC: Fix gpiolib dependencies") removed a series of unnecessary dependencies on GPIOLIB when the gpio was optional.
A similar simplification seems valid for max98357a, so remove the dependency as well. This will avoid the following warning
WARNING: unmet direct dependencies detected for SND_SOC_MAX98357A
Depends on [n]: SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && GPIOLIB [=n]
Selected by [y]:
- SND_SOC_INTEL_SOF_CS42L42_MACH [=y] && SOUND [=y] && !UML &&
SND [=y] && SND_SOC [=y] && SND_SOC_INTEL_MACH [=y] &&
(SND_SOC_SOF_HDA_LINK [=y] || SND_SOC_SOF_BAYTRAIL [=n]) && I2C
[=y] && ACPI [=y] && SND_HDA_CODEC_HDMI [=y] &&
SND_SOC_SOF_HDA_AUDIO_CODEC [=y] && (MFD_INTEL_LPSS [=y] ||
COMPILE_TEST [=n])--- sound/soc/codecs/Kconfig | 1 - 1 file changed, 1 deletion(-)
sound/soc/codecs/Kconfig +0 -1
@@ -857,7 +857,6 @@ config SND_SOC_MAX98095 config SND_SOC_MAX98357A tristate "Maxim MAX98357A CODEC" - depends on GPIOLIB config SND_SOC_MAX98371 tristate
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 66/76 ASoC: rt1015p: remove dependency on GPIOLIB
In reply to Sasha LevinFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit b390c25c6757b9d56cecdfbf6d55f15fc89a6386 ]
commit dcc2c012c7691 ("ASoC: Fix gpiolib dependencies") removed a series of unnecessary dependencies on GPIOLIB when the gpio was optional.
A similar simplification seems valid for rt1015p, so remove the dependency as well. This will avoid the following warning
WARNING: unmet direct dependencies detected for SND_SOC_RT1015P
Depends on [n]: SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] &&
GPIOLIB [=n]
Selected by [y]:
- SND_SOC_INTEL_SOF_RT5682_MACH [=y] && SOUND [=y] && !UML && SND
[=y] && SND_SOC [=y] && SND_SOC_INTEL_MACH [=y] &&
(SND_SOC_SOF_HDA_LINK [=y] || SND_SOC_SOF_BAYTRAIL [=n]) && I2C
[=y] && ACPI [=y] && (SND_HDA_CODEC_HDMI [=y] &&
SND_SOC_SOF_HDA_AUDIO_CODEC [=y] && (MFD_INTEL_LPSS [=y] ||
COMPILE_TEST [=y]) || SND_SOC_SOF_BAYTRAIL [=n] &&
(X86_INTEL_LPSS [=n] || COMPILE_TEST [=y]))--- sound/soc/codecs/Kconfig | 1 - 1 file changed, 1 deletion(-)
sound/soc/codecs/Kconfig +0 -1
@@ -1098,7 +1098,6 @@ config SND_SOC_RT1015 config SND_SOC_RT1015P tristate - depends on GPIOLIB config SND_SOC_RT1305 tristate
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 67/76 can: mcp251xfd: silence clang's -Wunaligned-access warning
In reply to Sasha LevinFrom: Vincent Mailhol <[email protected]>
[ Upstream commit 1a6dd9996699889313327be03981716a8337656b ]
clang emits a -Wunaligned-access warning on unionmcp251xfd_tx_ojb_load_buf.
The reason is that field hw_tx_obj (not declared as packed) is being packed right after a 16 bits field inside a packed struct:
| union mcp251xfd_tx_obj_load_buf {
| struct __packed {
| struct mcp251xfd_buf_cmd cmd;
| /* ^ 16 bits fields */
| struct mcp251xfd_hw_tx_obj_raw hw_tx_obj;
| /* ^ not declared as packed */
| } nocrc;
| struct __packed {
| struct mcp251xfd_buf_cmd_crc cmd;
| struct mcp251xfd_hw_tx_obj_raw hw_tx_obj;
| __be16 crc;
| } crc;
| } ____cacheline_aligned;Starting from LLVM 14, having an unpacked struct nested in a packed struct triggers a warning. c.f. [1].
This is a false positive because the field is always being accessed with the relevant put_unaligned_*() function. Adding __packed to the structure declaration silences the warning.
[1] https://github.com/llvm/llvm-project/issues/55520
--- drivers/net/can/spi/mcp251xfd/mcp251xfd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/spi/mcp251xfd/mcp251xfd.h +1 -1
@@ -426,7 +426,7 @@ struct mcp251xfd_hw_tef_obj {/* The tx_obj_raw version is used in spi async, i.e. without * regmap. We have to take care of endianness ourselves. */ -struct mcp251xfd_hw_tx_obj_raw { +struct __packed mcp251xfd_hw_tx_obj_raw {__le32 id;__le32 flags; u8 data[sizeof_field(struct canfd_frame, data)];
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 68/76 x86/microcode: Add explicit CPU vendor dependency
In reply to Sasha LevinFrom: Borislav Petkov <[email protected]>
[ Upstream commit 9c55d99e099bd7aa6b91fce8718505c35d5dfc65 ]
Add an explicit dependency to the respective CPU vendor so that the respective microcode support for it gets built only when that support is enabled.
--- arch/x86/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/Kconfig +2 -2
@@ -1321,7 +1321,7 @@ config MICROCODE config MICROCODE_INTEL bool "Intel microcode loading support" - depends on MICROCODE + depends on CPU_SUP_INTEL && MICROCODE default MICROCODE help This options enables microcode patch loading support for Intel
@@ -1333,7 +1333,7 @@ config MICROCODE_INTEL config MICROCODE_AMD bool "AMD microcode loading support" - depends on MICROCODE + depends on CPU_SUP_AMD && MICROCODE help If you select this option, microcode patch loading support for AMD processors will be enabled.
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 69/76 ARM: 9201/1: spectre-bhb: rely on linker to emit cross-section literal loads
In reply to Sasha LevinFrom: Ard Biesheuvel <[email protected]>
[ Upstream commit ad12c2f1587c6ec9b52ff226f438955bfae6ad89 ]
The assembler does not permit 'LDR PC, <sym>' when the symbol lives in a different section, which is why we have been relying on rather fragile open-coded arithmetic to load the address of the vector_swi routine into the program counter using a single LDR instruction in the SWI slot in the vector table. The literal was moved to a different section to in commit 19accfd373847 ("ARM: move vector stubs") to ensure that the vector stubs page does not need to be mapped readable for user space, which is the case for the vector page itself, as it carries the kuser helpers as well.
So the cross-section literal load is open-coded, and this relies on the address of vector_swi to be at the very start of the vector stubs page, and we won't notice if we got it wrong until booting the kernel and see it break. Fortunately, it was guaranteed to break, so this was fragile but not problematic.
Now that we have added two other variants of the vector table, we have 3 occurrences of the same trick, and so the size of our ISA/compiler/CPU validation space has tripled, in a way that may cause regressions to only be observed once booting the image in question on a CPU that exercises a particular vector table.
So let's switch to true cross section references, and let the linker fix them up like it fixes up all the other cross section references in the vector page.
--- arch/arm/kernel/entry-armv.S | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)
arch/arm/kernel/entry-armv.S +15 -7
@@ -1074,10 +1074,15 @@ ENDPROC(vector_bhb_bpiall_\name) .endm .section .stubs, "ax", %progbits - @ This must be the first word + @ These need to remain at the start of the section so that + @ they are in range of the 'SWI' entries in the vector tables + @ located 4k down. +.L__vector_swi: .word vector_swi #ifdef CONFIG_HARDEN_BRANCH_HISTORY +.L__vector_bhb_loop8_swi: .word vector_bhb_loop8_swi +.L__vector_bhb_bpiall_swi: .word vector_bhb_bpiall_swi #endif
@@ -1220,10 +1225,11 @@ vector_addrexcptn: .globl vector_fiq .section .vectors, "ax", %progbits -.L__vectors_start: W(b) vector_rst W(b) vector_und - W(ldr) pc, .L__vectors_start + 0x1000 +ARM( .reloc ., R_ARM_LDR_PC_G0, .L__vector_swi ) +THUMB( .reloc ., R_ARM_THM_PC12, .L__vector_swi ) + W(ldr) pc, . W(b) vector_pabt W(b) vector_dabt W(b) vector_addrexcptn
@@ -1232,10 +1238,11 @@ vector_addrexcptn: #ifdef CONFIG_HARDEN_BRANCH_HISTORY .section .vectors.bhb.loop8, "ax", %progbits -.L__vectors_bhb_loop8_start: W(b) vector_rst W(b) vector_bhb_loop8_und - W(ldr) pc, .L__vectors_bhb_loop8_start + 0x1004 +ARM( .reloc ., R_ARM_LDR_PC_G0, .L__vector_bhb_loop8_swi ) +THUMB( .reloc ., R_ARM_THM_PC12, .L__vector_bhb_loop8_swi ) + W(ldr) pc, . W(b) vector_bhb_loop8_pabt W(b) vector_bhb_loop8_dabt W(b) vector_addrexcptn
@@ -1243,10 +1250,11 @@ vector_addrexcptn: W(b) vector_bhb_loop8_fiq .section .vectors.bhb.bpiall, "ax", %progbits -.L__vectors_bhb_bpiall_start: W(b) vector_rst W(b) vector_bhb_bpiall_und - W(ldr) pc, .L__vectors_bhb_bpiall_start + 0x1008 +ARM( .reloc ., R_ARM_LDR_PC_G0, .L__vector_bhb_bpiall_swi ) +THUMB( .reloc ., R_ARM_THM_PC12, .L__vector_bhb_bpiall_swi ) + W(ldr) pc, . W(b) vector_bhb_bpiall_pabt W(b) vector_bhb_bpiall_dabt W(b) vector_addrexcptn
Signature · 7 lines
2.35.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH AUTOSEL 5.10 69/76] ARM: 9201/1: spectre-bhb: rely on linker to emit cross-section literal loads
AUTONAK
Quoted 104 lines · Sasha Levin
From: Ard Biesheuvel <[email protected]>
[ Upstream commit
ad12c2f1587c6ec9b52ff226f438955bfae6ad89]The assembler does not permit 'LDR PC, <sym>' when the symbol lives in a different section, which is why we have been relying on rather fragile open-coded arithmetic to load the address of the
vector_swiroutine into the program counter using a single LDR instruction in the SWI slot in the vector table. The literal was moved to a different section to in commit19accfd373847("ARM: move vector stubs") to ensure that the vector stubs page does not need to be mapped readable for user space, which is the case for the vector page itself, as it carries the kuser helpers as well.So the cross-section literal load is open-coded, and this relies on the address of
vector_swito be at the very start of the vector stubs page, and we won't notice if we got it wrong until booting the kernel and see it break. Fortunately, it was guaranteed to break, so this was fragile but not problematic.Now that we have added two other variants of the vector table, we have 3 occurrences of the same trick, and so the size of our ISA/compiler/CPU validation space has tripled, in a way that may cause regressions to only be observed once booting the image in question on a CPU that exercises a particular vector table.
So let's switch to true cross section references, and let the linker fix them up like it fixes up all the other cross section references in the vector page.
Signed-off-by Ard Biesheuvel <[email protected]>Signed-off-by Russell King (Oracle) <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- arch/arm/kernel/entry-armv.S | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)arch/arm/kernel/entry-armv.S +15
-8@@ -1074,10 +1074,15 @@ ENDPROC(vector_bhb_bpiall_\name) .endm .section .stubs, "ax", %progbits - @ This must be the first word + @ These need to remain at the start of the section so that + @ they are in range of the 'SWI' entries in the vector tables + @ located 4k down. +.L__vector_swi: .word vector_swi #ifdef CONFIG_HARDEN_BRANCH_HISTORY +.L__vector_bhb_loop8_swi: .word vector_bhb_loop8_swi +.L__vector_bhb_bpiall_swi: .word vector_bhb_bpiall_swi #endif@@ -1220,10 +1225,11 @@ vector_addrexcptn: .globl vector_fiq .section .vectors, "ax", %progbits -.L__vectors_start: W(b) vector_rst W(b) vector_und - W(ldr) pc, .L__vectors_start + 0x1000 +ARM( .reloc ., R_ARM_LDR_PC_G0, .L__vector_swi ) +THUMB( .reloc ., R_ARM_THM_PC12, .L__vector_swi ) + W(ldr) pc, . W(b) vector_pabt W(b) vector_dabt W(b) vector_addrexcptn@@ -1232,10 +1238,11 @@ vector_addrexcptn: #ifdef CONFIG_HARDEN_BRANCH_HISTORY .section .vectors.bhb.loop8, "ax", %progbits -.L__vectors_bhb_loop8_start: W(b) vector_rst W(b) vector_bhb_loop8_und - W(ldr) pc, .L__vectors_bhb_loop8_start + 0x1004 +ARM( .reloc ., R_ARM_LDR_PC_G0, .L__vector_bhb_loop8_swi ) +THUMB( .reloc ., R_ARM_THM_PC12, .L__vector_bhb_loop8_swi ) + W(ldr) pc, . W(b) vector_bhb_loop8_pabt W(b) vector_bhb_loop8_dabt W(b) vector_addrexcptn@@ -1243,10 +1250,11 @@ vector_addrexcptn: W(b) vector_bhb_loop8_fiq .section .vectors.bhb.bpiall, "ax", %progbits -.L__vectors_bhb_bpiall_start: W(b) vector_rst W(b) vector_bhb_bpiall_und - W(ldr) pc, .L__vectors_bhb_bpiall_start + 0x1008 +ARM( .reloc ., R_ARM_LDR_PC_G0, .L__vector_bhb_bpiall_swi ) +THUMB( .reloc ., R_ARM_THM_PC12, .L__vector_bhb_bpiall_swi ) + W(ldr) pc, . W(b) vector_bhb_bpiall_pabt W(b) vector_bhb_bpiall_dabt W(b) vector_addrexcptn --2.35.1
Sasha Levin
maintainerPATCH 70/76 m68k: atari: Make Atari ROM port I/O write macros return void
In reply to Sasha LevinFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 30b5e6ef4a32ea4985b99200e06d6660a69f9246 ]
The macros implementing Atari ROM port I/O writes do not cast away their output, unlike similar implementations for other I/O buses. When they are combined using conditional expressions in the definitions of outb() and friends, this triggers sparse warnings like:
drivers/net/appletalk/cops.c:382:17: error: incompatible types in conditional expression (different base types):
drivers/net/appletalk/cops.c:382:17: unsigned char
drivers/net/appletalk/cops.c:382:17: void
Fix this by adding casts to "void".
--- arch/m68k/include/asm/raw_io.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/m68k/include/asm/raw_io.h +3 -3
@@ -80,14 +80,14 @@ ({ u16 __v = le16_to_cpu(*(__force volatile u16 *) (addr)); __v; })#define rom_out_8 (addr, b) \ - ({u8 __maybe_unused __w, __v = (b); u32 _addr = ((u32) (addr)); \ + (void)({u8 __maybe_unused __w, __v = (b); u32 _addr = ((u32) (addr)); \ __w = ((*(__force volatile u8 *) ((_addr | 0x10000) + (__v<<1)))); })#define rom_out_be16 (addr, w) \ - ({u16 __maybe_unused __w, __v = (w); u32 _addr = ((u32) (addr)); \ + (void)({u16 __maybe_unused __w, __v = (w); u32 _addr = ((u32) (addr)); \ __w = ((*(__force volatile u16 *) ((_addr & 0xFFFF0000UL) + ((__v & 0xFF)<<1)))); \ __w = ((*(__force volatile u16 *) ((_addr | 0x10000) + ((__v >> 8)<<1)))); })#define rom_out_le16 (addr, w) \ - ({u16 __maybe_unused __w, __v = (w); u32 _addr = ((u32) (addr)); \ + (void)({u16 __maybe_unused __w, __v = (w); u32 _addr = ((u32) (addr)); \ __w = ((*(__force volatile u16 *) ((_addr & 0xFFFF0000UL) + ((__v >> 8)<<1)))); \ __w = ((*(__force volatile u16 *) ((_addr | 0x10000) + ((__v & 0xFF)<<1)))); })
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 71/76 hwmon: Make chip parameter for with_info API mandatory
In reply to Sasha LevinFrom: Guenter Roeck <[email protected]>
[ Upstream commit ddaefa209c4ac791c1262e97c9b2d0440c8ef1d5 ]
Various attempts were made recently to "convert" the old hwmon_device_register() API to devm_hwmon_device_register_with_info() by just changing the function name without actually converting the driver. Prevent this from happening by making the 'chip' parameter of devm_hwmon_device_register_with_info() mandatory.
--- Documentation/hwmon/hwmon-kernel-api.rst | 2 +- drivers/hwmon/hwmon.c | 16 +++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-)
Documentation/hwmon/hwmon-kernel-api.rst +1 -1
@@ -72,7 +72,7 @@ hwmon_device_register_with_info is the most comprehensive and preferred means to register a hardware monitoring device. It creates the standard sysfs attributes in the hardware monitoring core, letting the driver focus on reading from and writing to the chip instead of having to bother with sysfs attributes. -The parent device parameter cannot be NULL with non-NULL chip info. Its +The parent device parameter as well as the chip parameter must not be NULL. Its parameters are described in more detail below. devm_hwmon_device_register_with_info is similar to
drivers/hwmon/hwmon.c +7 -9
@@ -818,11 +818,12 @@ EXPORT_SYMBOL_GPL(hwmon_device_register_with_groups);/** * hwmon_device_register_with_info - register w/ hwmon -* @dev: the parent device -* @name: hwmon name attribute -* @drvdata: driver data to attach to created device -* @chip: pointer to hwmon chip information +* @dev: the parent device (mandatory) +* @name: hwmon name attribute (mandatory) +* @drvdata: driver data to attach to created device (optional) +* @chip: pointer to hwmon chip information (mandatory) * @extra_groups: pointer to list of additional non-standard attribute groups +* (optional) * * hwmon_device_unregister() must be called when the device is no * longer needed.
@@ -835,13 +836,10 @@ hwmon_device_register_with_info(struct device *dev, const char *name, const struct hwmon_chip_info *chip, const struct attribute_group **extra_groups) { - if (!name) - return ERR_PTR(-EINVAL); - -if (chip && (!chip->ops || !chip->ops->is_visible || !chip->info)) + if (!dev || !name || !chip) return ERR_PTR(-EINVAL); -if (chip && !dev) +if (!chip->ops || !chip->ops->is_visible || !chip->info)return ERR_PTR (-EINVAL );return __hwmon_device_register (dev, name, drvdata, chip, extra_groups);
Signature · 1 line
2.35.1
Guenter Roeck
maintainerRe: [PATCH AUTOSEL 5.10 71/76] hwmon: Make chip parameter for with_info API mandatory
Quoted 4 lines · Sasha Levin
From: Guenter Roeck <[email protected]>
[ Upstream commit
ddaefa209c4ac791c1262e97c9b2d0440c8ef1d5]
Quoted 8 lines
Various attempts were made recently to "convert" the old
hwmon_device_register()API todevm_hwmon_device_register_with_info()by just changing the function name without actually converting the driver. Prevent this from happening by making the 'chip' parameter ofdevm_hwmon_device_register_with_info()mandatory.Signed-off-by Guenter Roeck <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Please drop.
Quoted 55 lines
--- Documentation/hwmon/hwmon-kernel-api.rst | 2 +- drivers/hwmon/hwmon.c | 16 +++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-)Documentation/hwmon/hwmon-kernel-api.rst +1
-1@@ -72,7 +72,7 @@ hwmon_device_register_with_info is the most comprehensive and preferred means to register a hardware monitoring device. It creates the standard sysfs attributes in the hardware monitoring core, letting the driver focus on reading from and writing to the chip instead of having to bother with sysfs attributes. -The parent device parameter cannot be NULL with non-NULL chip info. Its +The parent device parameter as well as the chip parameter must not be NULL. Its parameters are described in more detail below. devm_hwmon_device_register_with_info is similar todrivers/hwmon/hwmon.c +7
-9@@ -818,11 +818,12 @@ EXPORT_SYMBOL_GPL(hwmon_device_register_with_groups);/** * hwmon_device_register_with_info - register w/ hwmon -* @dev: the parent device -* @name: hwmon name attribute -* @drvdata: driver data to attach to created device -* @chip: pointer to hwmon chip information +* @dev: the parent device (mandatory) +* @name: hwmon name attribute (mandatory) +* @drvdata: driver data to attach to created device (optional) +* @chip: pointer to hwmon chip information (mandatory) * @extra_groups: pointer to list of additional non-standard attribute groups +* (optional) * * hwmon_device_unregister() must be called when the device is no * longer needed. @@ -835,13 +836,10 @@ hwmon_device_register_with_info(struct device *dev, const char *name, const struct hwmon_chip_info *chip, const struct attribute_group **extra_groups) { - if (!name) - return ERR_PTR(-EINVAL); - -if (chip && (!chip->ops || !chip->ops->is_visible || !chip->info)) + if (!dev || !name || !chip) return ERR_PTR(-EINVAL); -if (chip && !dev) +if (!chip->ops || !chip->ops->is_visible || !chip->info)return ERR_PTR (-EINVAL );return __hwmon_device_register (dev, name, drvdata, chip, extra_groups);
Sasha Levin
maintainerPATCH 72/76 rxrpc: Return an error to sendmsg if call failed
In reply to Sasha LevinFrom: David Howells <[email protected]>
[ Upstream commit 4ba68c5192554876bd8c3afd904e3064d2915341 ]
If at the end of rxrpc sendmsg() or rxrpc_kernel_send_data() the call that was being given data was aborted remotely or otherwise failed, return an error rather than returning the amount of data buffered for transmission.
The call (presumably) did not complete, so there's not much point continuing with it. AF_RXRPC considers it "complete" and so will be unwilling to do anything else with it - and won't send a notification for it, deeming the return from sendmsg sufficient.
Not returning an error causes afs to incorrectly handle a StoreData operation that gets interrupted by a change of address due to NAT reconfiguration.
This doesn't normally affect most operations since their request parameters tend to fit into a single UDP packet and afs_make_call() returns before the server responds; StoreData is different as it involves transmission of a lot of data.
This can be triggered on a client by doing something like:
dd if=/dev/zero of=/afs/example.com/foo bs=1M count=512
at one prompt, and then changing the network address at another prompt, e.g.:
ifconfig enp6s0 inet 192.168.6.2 && route add 192.168.6.1 dev enp6s0
Tracing packets on an Auristor fileserver looks something like:
192.168.6.1 -> 192.168.6.3 RX 107 ACK Idle Seq: 0 Call: 4 Source Port: 7000 Destination Port: 7001 192.168.6.3 -> 192.168.6.1 AFS (RX) 1482 FS Request: Unknown(64538) (64538) 192.168.6.3 -> 192.168.6.1 AFS (RX) 1482 FS Request: Unknown(64538) (64538) 192.168.6.1 -> 192.168.6.3 RX 107 ACK Idle Seq: 0 Call: 4 Source Port: 7000 Destination Port: 7001 <ARP exchange for 192.168.6.2> 192.168.6.2 -> 192.168.6.1 AFS (RX) 1482 FS Request: Unknown(0) (0) 192.168.6.2 -> 192.168.6.1 AFS (RX) 1482 FS Request: Unknown(0) (0) 192.168.6.1 -> 192.168.6.2 RX 107 ACK Exceeds Window Seq: 0 Call: 4 Source Port: 7000 Destination Port: 7001 192.168.6.1 -> 192.168.6.2 RX 74 ABORT Seq: 0 Call: 4 Source Port: 7000 Destination Port: 7001 192.168.6.1 -> 192.168.6.2 RX 74 ABORT Seq: 29321 Call: 4 Source Port: 7000 Destination Port: 7001
The Auristor fileserver logs code -453 (RXGEN_SS_UNMARSHAL), but the abort code received by kafs is -5 (RX_PROTOCOL_ERROR) as the rx layer sees the condition and generates an abort first and the unmarshal error is a consequence of that at the application layer.
--- net/rxrpc/sendmsg.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/rxrpc/sendmsg.c +6 -0
@@ -461,6 +461,12 @@ static int rxrpc_send_data(struct rxrpc_sock *rx, success: ret = copied; +if (READ_ONCE (call->state) ==RXRPC_CALL_COMPLETE ) { +read_lock_bh (&call->state_lock); +if (call->error <0 ) + ret = call->error; +read_unlock_bh (&call->state_lock); + } out: call->tx_pending = skb;_leave (" = %d" , ret);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 73/76 rxrpc, afs: Fix selection of abort codes
In reply to Sasha LevinFrom: David Howells <[email protected]>
[ Upstream commit de696c4784f0706884458893c5a6c39b3a3ff65c ]
The RX_USER_ABORT code should really only be used to indicate that the user of the rxrpc service (ie. userspace) implicitly caused a call to be aborted
- for instance if the AF_RXRPC socket is closed whilst the call was in progress. (The user may also explicitly abort a call and specify the abort code to use).
Change some of the points of generation to use other abort codes instead:
(1) Abort the call with RXGEN_SS_UNMARSHAL or RXGEN_CC_UNMARSHAL if we see ENOMEM and EFAULT during received data delivery and abort with RX_CALL_DEAD in the default case.
(2) Abort with RXGEN_SS_MARSHAL if we get ENOMEM whilst trying to send a reply.
(3) Abort with RX_CALL_DEAD if we stop hearing from the peer if we had heard from the peer and abort with RX_CALL_TIMEOUT if we hadn't.
(4) Abort with RX_CALL_DEAD if we try to disconnect a call that's not completed successfully or been aborted.
--- fs/afs/rxrpc.c | 8 +++++--- net/rxrpc/call_event.c | 4 ++-- net/rxrpc/conn_object.c | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-)
fs/afs/rxrpc.c +5 -3
@@ -572,6 +572,8 @@ static void afs_deliver_to_call(struct afs_call *call)case -ENODATA :case -EBADMSG :case -EMSGSIZE : +case -ENOMEM : +case -EFAULT : abort_code =RXGEN_CC_UNMARSHAL ;if (state !=AFS_CALL_CL_AWAIT_REPLY ) abort_code =RXGEN_SS_UNMARSHAL ;
@@ -579,7 +581,7 @@ static void afs_deliver_to_call(struct afs_call *call) abort_code, ret, "KUM"); goto local_abort;default : - abort_code =RX_USER_ABORT ; + abort_code =RX_CALL_DEAD ;rxrpc_kernel_abort_call (call->net->socket, call->rxcall, abort_code, ret,"KER" ); goto local_abort;
@@ -871,7 +873,7 @@ void afs_send_empty_reply(struct afs_call *call)case -ENOMEM :_debug ("oom" );rxrpc_kernel_abort_call (net->socket, call->rxcall, -RX_USER_ABORT , -ENOMEM ,"KOO" ); +RXGEN_SS_MARSHAL , -ENOMEM ,"KOO" ); fallthrough;default :_leave (" [error]" );
@@ -913,7 +915,7 @@ void afs_send_simple_reply(struct afs_call *call, const void *buf, size_t len)if (n == -ENOMEM ) {_debug ("oom" );rxrpc_kernel_abort_call (net->socket, call->rxcall, -RX_USER_ABORT , -ENOMEM ,"KOO" ); +RXGEN_SS_MARSHAL , -ENOMEM ,"KOO" ); }_leave (" [error]" ); }
net/rxrpc/call_event.c +2 -2
@@ -377,9 +377,9 @@ void rxrpc_process_call(struct work_struct *work)if (test_bit (RXRPC_CALL_RX_HEARD , &call->flags) && (int )call->conn->hi_serial - (int )call->rx_serial >0 ) {trace_rxrpc_call_reset (call); -rxrpc_abort_call ("EXP" , call,0 ,RX_USER_ABORT , -ECONNRESET ); +rxrpc_abort_call ("EXP" , call,0 ,RX_CALL_DEAD , -ECONNRESET ); }else { -rxrpc_abort_call ("EXP" , call,0 ,RX_USER_ABORT , -ETIME ); +rxrpc_abort_call ("EXP" , call,0 ,RX_CALL_TIMEOUT , -ETIME ); }set_bit (RXRPC_CALL_EV_ABORT , &call->events); goto recheck_state;
net/rxrpc/conn_object.c +1 -1
@@ -184,7 +184,7 @@ void __rxrpc_disconnect_call(struct rxrpc_connection *conn, chan->last_type =RXRPC_PACKET_TYPE_ABORT ;break ;default : - chan->last_abort =RX_USER_ABORT ; + chan->last_abort =RX_CALL_DEAD ; chan->last_type =RXRPC_PACKET_TYPE_ABORT ;break ; }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 74/76 eth: tg3: silence the GCC 12 array-bounds warning
In reply to Sasha LevinFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 9dec850fd7c210a04b4707df8e6c95bfafdd6a4b ]
GCC 12 currently generates a rather inconsistent warning:
drivers/net/ethernet/broadcom/tg3.c:17795:51: warning: array subscript 5 is above array bounds of ‘struct tg3_napi[5]’ [-Warray-bounds]
17795 | struct tg3_napi *tnapi = &tp->napi[i];
| ~~~~~~~~^~~
i is guaranteed < tp->irq_max which in turn is either 1 or 5. There are more loops like this one in the driver, but strangely GCC 12 dislikes only this single one.
Silence this silliness for now.
--- drivers/net/ethernet/broadcom/Makefile | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ethernet/broadcom/Makefile +5 -0
@@ -16,3 +16,8 @@ obj-$(CONFIG_BGMAC_BCMA) += bgmac-bcma.o bgmac-bcma-mdio.o obj-$(CONFIG_BGMAC_PLATFORM) += bgmac-platform.o obj-$(CONFIG_SYSTEMPORT) += bcmsysport.o obj-$(CONFIG_BNXT) += bnxt/ + +# FIXME: temporarily silence -Warray-bounds on non W=1+ builds +ifndef KBUILD_EXTRA_WARN +CFLAGS_tg3.o += -Wno-array-bounds +endif
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 75/76 selftests/bpf: fix btf_dump/btf_dump due to recent clang change
In reply to Sasha LevinFrom: Yonghong Song <[email protected]>
[ Upstream commit 4050764cbaa25760aab40857f723393c07898474 ]
Latest llvm-project upstream had a change of behavior related to qualifiers on function return type ([1]). This caused selftests btf_dump/btf_dump failure. The following example shows what changed.
$ cat t.c
typedef const char * const (* const (* const fn_ptr_arr2_t[5])())(char * (*)(int));
struct t {
int a;
fn_ptr_arr2_t l;
};
int foo(struct t *arg) {
return arg->a;
}Compiled with latest upstream llvm15,
$ clang -O2 -g -target bpf -S -emit-llvm t.c
The related generated debuginfo IR looks like:
!16 = !DIDerivedType(tag: DW_TAG_typedef, name: "fn_ptr_arr2_t", file: !1, line: 1, baseType: !17)
!17 = !DICompositeType(tag: DW_TAG_array_type, baseType: !18, size: 320, elements: !32)
!18 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !19)
!19 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !20, size: 64)
!20 = !DISubroutineType(types: !21)
!21 = !{!22, null}
!22 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !23, size: 64)
!23 = !DISubroutineType(types: !24)
!24 = !{!25, !28}
!25 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !26, size: 64)
!26 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !27)
!27 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
You can see two intermediate const qualifier to pointer are dropped in debuginfo IR.With llvm14, we have following debuginfo IR:
!16 = !DIDerivedType(tag: DW_TAG_typedef, name: "fn_ptr_arr2_t", file: !1, line: 1, baseType: !17) !17 = !DICompositeType(tag: DW_TAG_array_type, baseType: !18, size: 320, elements: !34) !18 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !19)
!19 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !20, size: 64)
!20 = !DISubroutineType(types: !21)
!21 = !{!22, null}
!22 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !23)
!23 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !24, size: 64)
!24 = !DISubroutineType(types: !25)
!25 = !{!26, !30}
!26 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !27)
!27 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !28, size: 64)
!28 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !29)
!29 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
All const qualifiers are preserved.
To adapt the selftest to both old and new llvm, this patch removed the intermediate const qualifier in const-to-ptr types, to make the test succeed again.
[1] https://reviews.llvm.org/D125919
--- tools/testing/selftests/bpf/progs/btf_dump_test_case_syntax.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/progs/btf_dump_test_case_syntax.c +1 -1
@@ -94,7 +94,7 @@ typedef void (* (*signal_t)(int, void (*)(int)))(int);typedef char * (*fn_ptr_arr1_t [10 ])(int **); -typedef char * (*const (*const fn_ptr_arr2_t [5 ])())(char * (*)(int )); +typedef char * (* (*const fn_ptr_arr2_t [5 ])())(char * (*)(int ));struct struct_w_typedefs {int_t a;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 76/76 gfs2: use i_lock spin_lock for inode qadata
In reply to Sasha LevinFrom: Bob Peterson <[email protected]>
[ Upstream commit 5fcff61eea9efd1f4b60e89d2d686b5feaea100f ]
Before this patch, functions gfs2_qa_get and _put used the i_rw_mutex to prevent simultaneous access to its i_qadata. But i_rw_mutex is now used for many other things, including iomap_begin and end, which causes a conflict according to lockdep. We cannot just remove the lock since simultaneous opens (gfs2_open -> gfs2_open_common -> gfs2_qa_get) can then stomp on each others values for i_qadata.
This patch solves the conflict by using the i_lock spin_lock in the inode to prevent simultaneous access.
--- fs/gfs2/quota.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-)
fs/gfs2/quota.c +20 -12
@@ -531,34 +531,42 @@ static void qdsb_put(struct gfs2_quota_data *qd)*/ int gfs2_qa_get (struct gfs2_inode *ip) { -int error =0 ;struct gfs2_sbd *sdp =GFS2_SB (&ip->i_inode); +struct inode *inode = &ip->i_inode;if (sdp->sd_args.ar_quota ==GFS2_QUOTA_OFF )return 0 ; -down_write (&ip->i_rw_mutex); +spin_lock (&inode->i_lock);if (ip->i_qadata ==NULL ) { - ip->i_qadata =kmem_cache_zalloc (gfs2_qadata_cachep,GFP_NOFS ); -if (!ip->i_qadata) { - error = -ENOMEM ; - goto out; - } +struct gfs2_qadata *tmp; + +spin_unlock (&inode->i_lock); + tmp =kmem_cache_zalloc (gfs2_qadata_cachep,GFP_NOFS ); +if (!tmp) +return -ENOMEM ; + +spin_lock (&inode->i_lock); +if (ip->i_qadata ==NULL ) + ip->i_qadata = tmp; +else +kmem_cache_free (gfs2_qadata_cachep, tmp); } ip->i_qadata->qa_ref++; -out: -up_write (&ip->i_rw_mutex); -return error; +spin_unlock (&inode->i_lock); +return 0 ; }void gfs2_qa_put (struct gfs2_inode *ip) { -down_write (&ip->i_rw_mutex); +struct inode *inode = &ip->i_inode; + +spin_lock (&inode->i_lock);if (ip->i_qadata && --ip->i_qadata->qa_ref ==0 ) {kmem_cache_free (gfs2_qadata_cachep, ip->i_qadata); ip->i_qadata =NULL ; } -up_write (&ip->i_rw_mutex); +spin_unlock (&inode->i_lock); }int gfs2_quota_hold (struct gfs2_inode *ip,kuid_t uid,kgid_t gid)
Signature · 1 line
2.35.1