Revert "evm: Fix memleak in init_desc"
Subsystems (11)
Sasha Levin
maintainerPATCH 1/16 Revert "evm: Fix memleak in init_desc"
From: Xiu Jianfeng <[email protected]>
[ Upstream commit 51dd64bb99e4478fc5280171acd8e1b529eadaf7 ]
This reverts commit ccf11dbaa07b328fa469415c362d33459c140a37.
Commit ccf11dbaa07b ("evm: Fix memleak in init_desc") said there is memleak in init_desc. That may be incorrect, as we can see, tmp_tfm is saved in one of the two global variables hmac_tfm or evm_tfm[hash_algo], then if init_desc is called next time, there is no need to alloc tfm again, so in the error path of kmalloc desc or crypto_shash_init(desc), It is not a problem without freeing tmp_tfm.
And also that commit did not reset the global variable to NULL after freeing tmp_tfm and this makes *tfm a dangling pointer which may cause a UAF issue.
--- security/integrity/evm/evm_crypto.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
security/integrity/evm/evm_crypto.c +2 -5
@@ -75,7 +75,7 @@ static struct shash_desc *init_desc(char type, uint8_t hash_algo) {long rc;const char *algo; -struct crypto_shash **tfm, *tmp_tfm =NULL ; +struct crypto_shash **tfm, *tmp_tfm;struct shash_desc *desc;if (type ==EVM_XATTR_HMAC ) {
@@ -120,16 +120,13 @@ static struct shash_desc *init_desc(char type, uint8_t hash_algo) alloc: desc =kmalloc (sizeof (*desc) +crypto_shash_descsize (*tfm),GFP_KERNEL ); -if (!desc) { -crypto_free_shash (tmp_tfm); +if (!desc)return ERR_PTR (-ENOMEM ); - } desc->tfm = *tfm; rc =crypto_shash_init (desc);if (rc) { -crypto_free_shash (tmp_tfm);kfree (desc);return ERR_PTR (rc); }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 2/16 ARM: rockchip: Add missing of_node_put() in rockchip_suspend_init()
From: Liang He <[email protected]>
[ Upstream commit f4470dbfb5ff92804650bc71d115c3f150d430f6 ]
In rockchip_suspend_init(), of_find_matching_node_and_match() will return a node pointer with refcount incremented. We should use of_node_put() in fail path or when it is not used anymore.
--- arch/arm/mach-rockchip/pm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
arch/arm/mach-rockchip/pm.c +5 -2
@@ -311,7 +311,7 @@ void __init rockchip_suspend_init(void) &match);if (!match) {pr_err ("Failed to find PMU node\n" ); -return ; + goto out_put; } pm_data = (struct rockchip_pm_data *) match->data;
@@ -320,9 +320,12 @@ void __init rockchip_suspend_init(void)if (ret) {pr_err ("%s: matches init error %d\n" , __func__, ret); -return ; + goto out_put; } }suspend_set_ops (pm_data->ops); + +out_put: +of_node_put (np); }
Signature · 7 lines
2.35.1 _______________________________________________ Linux-rockchip mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-rockchip
Sasha Levin
maintainerPATCH 3/16 x86/kvm/vmx: Make noinstr clean
In reply to Sasha LevinFrom: Peter Zijlstra <[email protected]>
[ Upstream commit 742ab6df974ae8384a2dd213db1a3a06cf6d8936 ]
The recent mmio_stale_data fixes broke the noinstr constraints:
vmlinux.o: warning: objtool: vmx_vcpu_enter_exit+0x15b: call to wrmsrl.constprop.0() leaves .noinstr.text section vmlinux.o: warning: objtool: vmx_vcpu_enter_exit+0x1bf: call to kvm_arch_has_assigned_device() leaves .noinstr.text section
make it all happy again.
--- arch/x86/kvm/vmx/vmx.c | 6 +++--- arch/x86/kvm/x86.c | 4 ++-- include/linux/kvm_host.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-)
arch/x86/kvm/vmx/vmx.c +3 -3
@@ -358,9 +358,9 @@ static __always_inline void vmx_disable_fb_clear(struct vcpu_vmx *vmx)if (!vmx->disable_fb_clear)return ; -rdmsrl (MSR_IA32_MCU_OPT_CTRL , msr); + msr =__rdmsr (MSR_IA32_MCU_OPT_CTRL ); msr |=FB_CLEAR_DIS ; -wrmsrl (MSR_IA32_MCU_OPT_CTRL , msr); +native_wrmsrl (MSR_IA32_MCU_OPT_CTRL , msr);/* Cache the MSR value to avoid reading it later */ vmx->msr_ia32_mcu_opt_ctrl = msr; }
@@ -371,7 +371,7 @@ static __always_inline void vmx_enable_fb_clear(struct vcpu_vmx *vmx)return ; vmx->msr_ia32_mcu_opt_ctrl &= ~FB_CLEAR_DIS ; -wrmsrl (MSR_IA32_MCU_OPT_CTRL , vmx->msr_ia32_mcu_opt_ctrl); +native_wrmsrl (MSR_IA32_MCU_OPT_CTRL , vmx->msr_ia32_mcu_opt_ctrl); }static void vmx_update_fb_clear_dis (struct kvm_vcpu *vcpu,struct vcpu_vmx *vmx)
arch/x86/kvm/x86.c +2 -2
@@ -10329,9 +10329,9 @@ void kvm_arch_end_assignment(struct kvm *kvm) }EXPORT_SYMBOL_GPL (kvm_arch_end_assignment); -bool kvm_arch_has_assigned_device (struct kvm *kvm) +bool noinstr kvm_arch_has_assigned_device(struct kvm *kvm) { -return atomic_read (&kvm->arch.assigned_device_count); +return arch_atomic_read (&kvm->arch.assigned_device_count); }EXPORT_SYMBOL_GPL (kvm_arch_has_assigned_device);
include/linux/kvm_host.h +1 -1
@@ -929,7 +929,7 @@ static inline void kvm_arch_end_assignment(struct kvm *kvm) { } -static inline bool kvm_arch_has_assigned_device (struct kvm *kvm) +static __always_inline bool kvm_arch_has_assigned_device(struct kvm *kvm) {return false; }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 4/16 x86/bugs: Keep a per-CPU IA32_SPEC_CTRL value
In reply to Sasha LevinFrom: Peter Zijlstra <[email protected]>
[ Upstream commit caa0ff24d5d0e02abce5e65c3d2b7f20a6617be5 ]
Due to TIF_SSBD and TIF_SPEC_IB the actual IA32_SPEC_CTRL value can differ from x86_spec_ctrl_base. As such, keep a per-CPU value reflecting the current task's MSR content.
[jpoimboe: rename]
--- arch/x86/include/asm/nospec-branch.h | 1 + arch/x86/kernel/cpu/bugs.c | 28 +++++++++++++++++++++++----- arch/x86/kernel/process.c | 2 +- 3 files changed, 25 insertions(+), 6 deletions(-)
arch/x86/include/asm/nospec-branch.h +1 -0
@@ -281,6 +281,7 @@ static inline void indirect_branch_prediction_barrier(void)/* The Intel SPEC CTRL MSR base value cache */ extern u64 x86_spec_ctrl_base; +extern void write_spec_ctrl_current (u64 val);/* * With retpoline, we must use IBRS to restrict branch prediction
arch/x86/kernel/cpu/bugs.c +23 -5
@@ -46,11 +46,29 @@ static void __init taa_select_mitigation(void);static void __init mmio_select_mitigation (void );static void __init srbds_select_mitigation (void ); -/* The base value of the SPEC_CTRL MSR that always has to be preserved. */ +/* The base value of the SPEC_CTRL MSR without task-specific bits set */ u64 x86_spec_ctrl_base;EXPORT_SYMBOL_GPL (x86_spec_ctrl_base); + +/* The current value of the SPEC_CTRL MSR with task-specific bits set */ +DEFINE_PER_CPU (u64, x86_spec_ctrl_current); +EXPORT_SYMBOL_GPL (x86_spec_ctrl_current); +static DEFINE_MUTEX (spec_ctrl_mutex); +/* +* Keep track of the SPEC_CTRL MSR value for the current task, which may differ +* from x86_spec_ctrl_base due to STIBP/SSB in __speculation_ctrl_update(). +*/ +void write_spec_ctrl_current (u64 val) +{ +if (this_cpu_read (x86_spec_ctrl_current) == val) +return ; + +this_cpu_write (x86_spec_ctrl_current, val); +wrmsrl (MSR_IA32_SPEC_CTRL , val); +} +/* * The vendor and possibly platform specific bits which can be modified in * x86_spec_ctrl_base.
@@ -1102,7 +1120,7 @@ static void __init spectre_v2_select_mitigation(void)if (spectre_v2_in_eibrs_mode (mode)) {/* Force it so VMEXIT will restore correctly */ x86_spec_ctrl_base |=SPEC_CTRL_IBRS ; -wrmsrl (MSR_IA32_SPEC_CTRL , x86_spec_ctrl_base); +write_spec_ctrl_current (x86_spec_ctrl_base); }switch (mode) {
@@ -1157,7 +1175,7 @@ static void __init spectre_v2_select_mitigation(void)static void update_stibp_msr (void * __unused) { -wrmsrl (MSR_IA32_SPEC_CTRL , x86_spec_ctrl_base); +write_spec_ctrl_current (x86_spec_ctrl_base); }/* Update x86_spec_ctrl_base in case SMT state changed. */
@@ -1400,7 +1418,7 @@ static enum ssb_mitigation __init __ssb_select_mitigation(void)x86_amd_ssb_disable (); }else { x86_spec_ctrl_base |=SPEC_CTRL_SSBD ; -wrmsrl (MSR_IA32_SPEC_CTRL , x86_spec_ctrl_base); +write_spec_ctrl_current (x86_spec_ctrl_base); } }
@@ -1617,7 +1635,7 @@ int arch_prctl_spec_ctrl_get(struct task_struct *task, unsigned long which)void x86_spec_ctrl_setup_ap (void ) {if (boot_cpu_has (X86_FEATURE_MSR_SPEC_CTRL )) -wrmsrl (MSR_IA32_SPEC_CTRL , x86_spec_ctrl_base); +write_spec_ctrl_current (x86_spec_ctrl_base);if (ssb_mode ==SPEC_STORE_BYPASS_DISABLE )x86_amd_ssb_disable ();
arch/x86/kernel/process.c +1 -1
@@ -449,7 +449,7 @@ static __always_inline void __speculation_ctrl_update(unsigned long tifp, }if (updmsr) -wrmsrl (MSR_IA32_SPEC_CTRL , msr); +write_spec_ctrl_current (msr); }static unsigned long speculation_ctrl_update_tif (struct task_struct *tsk)
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 5/16 x86/bugs: Optimize SPEC_CTRL MSR writes
In reply to Sasha LevinFrom: Peter Zijlstra <[email protected]>
[ Upstream commit c779bc1a9002fa474175b80e72b85c9bf628abb0 ]
When changing SPEC_CTRL for user control, the WRMSR can be delayed until return-to-user when KERNEL_IBRS has been enabled.
This avoids an MSR write during context switch.
--- arch/x86/include/asm/nospec-branch.h | 2 +- arch/x86/kernel/cpu/bugs.c | 18 ++++++++++++------ arch/x86/kernel/process.c | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-)
arch/x86/include/asm/nospec-branch.h +1 -1
@@ -281,7 +281,7 @@ static inline void indirect_branch_prediction_barrier(void)/* The Intel SPEC CTRL MSR base value cache */ extern u64 x86_spec_ctrl_base; -extern void write_spec_ctrl_current (u64 val); +extern void write_spec_ctrl_current (u64 val,bool force);/* * With retpoline, we must use IBRS to restrict branch prediction
arch/x86/kernel/cpu/bugs.c +12 -6
@@ -60,13 +60,19 @@ static DEFINE_MUTEX(spec_ctrl_mutex);* Keep track of the SPEC_CTRL MSR value for the current task, which may differ * from x86_spec_ctrl_base due to STIBP/SSB in __speculation_ctrl_update(). */ -void write_spec_ctrl_current (u64 val) +void write_spec_ctrl_current (u64 val,bool force) {if (this_cpu_read (x86_spec_ctrl_current) == val)return ;this_cpu_write (x86_spec_ctrl_current, val); -wrmsrl (MSR_IA32_SPEC_CTRL , val); + +/* +* When KERNEL_IBRS this MSR is written on return-to-user, unless +* forced the update can be delayed until that time. +*/ +if (force || !cpu_feature_enabled (X86_FEATURE_KERNEL_IBRS )) +wrmsrl (MSR_IA32_SPEC_CTRL , val); }/*
@@ -1120,7 +1126,7 @@ static void __init spectre_v2_select_mitigation(void)if (spectre_v2_in_eibrs_mode (mode)) {/* Force it so VMEXIT will restore correctly */ x86_spec_ctrl_base |=SPEC_CTRL_IBRS ; -write_spec_ctrl_current (x86_spec_ctrl_base); +write_spec_ctrl_current (x86_spec_ctrl_base, true); }switch (mode) {
@@ -1175,7 +1181,7 @@ static void __init spectre_v2_select_mitigation(void)static void update_stibp_msr (void * __unused) { -write_spec_ctrl_current (x86_spec_ctrl_base); +write_spec_ctrl_current (x86_spec_ctrl_base, true); }/* Update x86_spec_ctrl_base in case SMT state changed. */
@@ -1418,7 +1424,7 @@ static enum ssb_mitigation __init __ssb_select_mitigation(void)x86_amd_ssb_disable (); }else { x86_spec_ctrl_base |=SPEC_CTRL_SSBD ; -write_spec_ctrl_current (x86_spec_ctrl_base); +write_spec_ctrl_current (x86_spec_ctrl_base, true); } }
@@ -1635,7 +1641,7 @@ int arch_prctl_spec_ctrl_get(struct task_struct *task, unsigned long which)void x86_spec_ctrl_setup_ap (void ) {if (boot_cpu_has (X86_FEATURE_MSR_SPEC_CTRL )) -write_spec_ctrl_current (x86_spec_ctrl_base); +write_spec_ctrl_current (x86_spec_ctrl_base, true);if (ssb_mode ==SPEC_STORE_BYPASS_DISABLE )x86_amd_ssb_disable ();
arch/x86/kernel/process.c +1 -1
@@ -449,7 +449,7 @@ static __always_inline void __speculation_ctrl_update(unsigned long tifp, }if (updmsr) -write_spec_ctrl_current (msr); +write_spec_ctrl_current (msr, false); }static unsigned long speculation_ctrl_update_tif (struct task_struct *tsk)
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 6/16 wifi: mac80211: do not wake queues on a vif that is being stopped
In reply to Sasha LevinFrom: Felix Fietkau <[email protected]>
[ Upstream commit f856373e2f31ffd340e47e2b00027bd4070f74b3 ]
When a vif is being removed and sdata->bss is cleared, __ieee80211_wake_txqs can still be called on it, which crashes as soon as sdata->bss is being dereferenced.
To fix this properly, check for SDATA_STATE_RUNNING before waking queues, and take the fq lock when setting it (to ensure that __ieee80211_wake_txqs observes the change when running on a different CPU)
--- net/mac80211/iface.c | 2 ++ net/mac80211/util.c | 3 +++ 2 files changed, 5 insertions(+)
net/mac80211/iface.c +2 -0
@@ -803,7 +803,9 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,bool cancel_scan;struct cfg80211_nan_func *func; +spin_lock_bh (&local->fq.lock);clear_bit (SDATA_STATE_RUNNING , &sdata->state); +spin_unlock_bh (&local->fq.lock); cancel_scan =rcu_access_pointer (local->scan_sdata) == sdata;if (cancel_scan)
net/mac80211/util.c +3 -0
@@ -250,6 +250,9 @@ static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac)local_bh_disable ();spin_lock (&fq->lock); +if (!test_bit (SDATA_STATE_RUNNING , &sdata->state)) + goto out; +if (sdata->vif.type ==NL80211_IFTYPE_AP ) ps = &sdata->bss->ps;
Signature · 1 line
2.35.1
Re: [PATCH AUTOSEL 5.4 06/16] wifi: mac80211: do not wake queues on a vif that is being stopped
I think this one had a regression and needs another init-lock-early patch to keep from causing problems?
It certainly broke my 5.17-ish kernel...
Thanks,
Ben
Quoted 50 lines · Sasha Levin
From: Felix Fietkau <[email protected]>
[ Upstream commit
f856373e2f31ffd340e47e2b00027bd4070f74b3]When a vif is being removed and
sdata->bssis cleared,__ieee80211_wake_txqscan still be called on it, which crashes as soon assdata->bssis being dereferenced.
To fix this properly, check forSDATA_STATE_RUNNINGbefore waking queues, and take the fq lock when setting it (to ensure that__ieee80211_wake_txqsobserves the change when running on a different CPU)Signed-off-by Felix Fietkau <[email protected]>Signed-off-by Johannes Berg <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- net/mac80211/iface.c | 2 ++ net/mac80211/util.c | 3 +++ 2 files changed, 5 insertions(+)net/mac80211/iface.c +2
-0@@ -803,7 +803,9 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,bool cancel_scan;struct cfg80211_nan_func *func; +spin_lock_bh (&local->fq.lock);clear_bit (SDATA_STATE_RUNNING , &sdata->state); +spin_unlock_bh (&local->fq.lock); cancel_scan =rcu_access_pointer (local->scan_sdata) == sdata;if (cancel_scan)net/mac80211/util.c +3
-0@@ -250,6 +250,9 @@ static void __ieee80211_wake_txqs(struct ieee80211_sub_if_data *sdata, int ac)local_bh_disable ();spin_lock (&fq->lock); +if (!test_bit (SDATA_STATE_RUNNING , &sdata->state)) + goto out; +if (sdata->vif.type ==NL80211_IFTYPE_AP ) ps = &sdata->bss->ps;
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Re: [PATCH AUTOSEL 5.4 06/16] wifi: mac80211: do not wake queues on a vif that is being stopped
Quoted 3 lines · Ben Greear
I think this one had a regression and needs another init-lock-early patch to keep from causing problems?
Yes, for now we should drop it from all stable trees. We'll re-assess the situation later if it's needed there or not, I guess.
johannes
Re: [PATCH AUTOSEL 5.4 06/16] wifi: mac80211: do not wake queues on a vif that is being stopped
Quoted 10 lines · Johannes Berg
Quoted 3 lines · Ben Greear
I think this one had a regression and needs another init-lock-early patch to keep from causing problems?
Yes, for now we should drop it from all stable trees. We'll re-assess the situation later if it's needed there or not, I guess.
johannes
I think there is a second problem with this patch:
If I create multiple station vdevs (on mtk7916 radio, not sure that matters much or not), and admin up a few of them, but leave remainder down, then the queues on the originally-down-vdevs are never started and so tx-path-hang on those stations.
I am not sure the best way to fix this.
Thanks,
Ben
Signature · 2 lines
Ben Greear <[email protected]> Candela Technologies Inc http://www.candelatech.com
Sasha Levin
maintainerPATCH 7/16 wifi: cfg80211: Allow P2P client interface to indicate port authorization
In reply to Sasha LevinFrom: Vinayak Yadawad <[email protected]>
[ Upstream commit 8d70f33ed7207e82e51d5a4436c8ba2268a83b14 ]
In case of 4way handshake offload, cfg80211_port_authorized enables driver to indicate successful 4way handshake to cfg80211 layer. Currently this path of port authorization is restricted to interface type NL80211_IFTYPE_STATION. This patch extends the use of port authorization API for P2P client as well.
--- net/wireless/sme.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/wireless/sme.c +2 -1
@@ -1032,7 +1032,8 @@ void __cfg80211_port_authorized(struct wireless_dev *wdev, const u8 *bssid) {ASSERT_WDEV_LOCK (wdev); -if (WARN_ON (wdev->iftype !=NL80211_IFTYPE_STATION )) +if (WARN_ON (wdev->iftype !=NL80211_IFTYPE_STATION && + wdev->iftype !=NL80211_IFTYPE_P2P_CLIENT ))return ; if (WARN_ON(!wdev->current_bss) ||
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 8/16 drm: panel-orientation-quirks: Add quirk for the Lenovo Yoga Tablet 2 830
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit 144248515246e52a3706de1ee928af29a63794b8 ]
The Lenovo Yoga Tablet 2 830F / 830L use a panel which has been mounted 90 degrees rotated. Add a quirk for this.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +15 -0
@@ -266,6 +266,21 @@ static const struct dmi_system_id orientation_data[] = { DMI_MATCH(DMI_PRODUCT_NAME, "Lenovo YB1-X9"), }, .driver_data = (void *)&lcd1200x1920_rightside_up, + }, { /* Lenovo Yoga Tablet 2 830F / 830L */ + .matches = { +/* +* Note this also matches the Lenovo Yoga Tablet 2 1050F/L +* since that uses the same mainboard. The resolution match +* will limit this to only matching on the 830F/L. Neither has +* any external video outputs so those are not a concern. +*/ +DMI_MATCH (DMI_SYS_VENDOR ,"Intel Corp." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"VALLEYVIEW C0 PLATFORM" ), +DMI_MATCH (DMI_BOARD_NAME ,"BYT-T FFD8" ), +/* Partial match on beginning of BIOS version */ + DMI_MATCH(DMI_BIOS_VERSION, "BLADE_21"), + }, + .driver_data = (void *)&lcd1200x1920_rightside_up, }, { /* OneGX1 Pro */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "SYSTEM_MANUFACTURER"),
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 9/16 nilfs2: fix incorrect masking of permission flags for symlinks
In reply to Sasha LevinFrom: Ryusuke Konishi <[email protected]>
[ Upstream commit 5924e6ec1585445f251ea92713eb15beb732622a ]
The permission flags of newly created symlinks are wrongly dropped on nilfs2 with the current umask value even though symlinks should have 777 (rwxrwxrwx) permissions:
$ umask 0022 $ touch file && ln -s file symlink; ls -l file symlink -rw-r--r--. 1 root root 0 Jun 23 16:29 file lrwxr-xr-x. 1 root root 4 Jun 23 16:29 symlink -> file
This fixes the bug by inserting a missing check that excludes symlinks.
--- fs/nilfs2/nilfs.h | 3 +++ 1 file changed, 3 insertions(+)
fs/nilfs2/nilfs.h +3 -0
@@ -198,6 +198,9 @@ static inline int nilfs_acl_chmod(struct inode *inode)static inline int nilfs_init_acl (struct inode *inode,struct inode *dir) { +if (S_ISLNK (inode->i_mode)) +return 0 ; + inode->i_mode &= ~current_umask ();return 0 ; }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 10/16 ASoC: ti: omap-mcbsp: duplicate sysfs error
In reply to Sasha LevinFrom: David Owens <[email protected]>
[ Upstream commit f0d96937d31c4615a6418e4bed5cee50a952040e ]
Convert to managed versions of sysfs and clk allocation to simplify unbinding and error handling in probe. Managed sysfs node creation specifically addresses the following error seen the second time probe is attempted after sdma_pcm_platform_register() previously requsted probe deferral:
sysfs: cannot create duplicate filename '/devices/platform/68000000.ocp/49022000.mcbsp/max_tx_thres'
--- sound/soc/ti/omap-mcbsp-priv.h | 2 -- sound/soc/ti/omap-mcbsp-st.c | 14 ++------------ sound/soc/ti/omap-mcbsp.c | 19 ++----------------- 3 files changed, 4 insertions(+), 31 deletions(-)
sound/soc/ti/omap-mcbsp-priv.h +0 -2
@@ -316,8 +316,6 @@ static inline int omap_mcbsp_read(struct omap_mcbsp *mcbsp, u16 reg,/* Sidetone specific API */ int omap_mcbsp_st_init (struct platform_device *pdev); -void omap_mcbsp_st_cleanup (struct platform_device *pdev); -int omap_mcbsp_st_start (struct omap_mcbsp *mcbsp);int omap_mcbsp_st_stop (struct omap_mcbsp *mcbsp);
sound/soc/ti/omap-mcbsp-st.c +2 -12
@@ -350,7 +350,7 @@ int omap_mcbsp_st_init(struct platform_device *pdev)if (!st_data)return -ENOMEM ; - st_data->mcbsp_iclk =clk_get (mcbsp->dev,"ick" ); + st_data->mcbsp_iclk =devm_clk_get (mcbsp->dev,"ick" );if (IS_ERR (st_data->mcbsp_iclk)) {dev_warn (mcbsp->dev,"Failed to get ick, sidetone might be broken\n" );
@@ -362,7 +362,7 @@ int omap_mcbsp_st_init(struct platform_device *pdev)if (!st_data->io_base_st)return -ENOMEM ; - ret =sysfs_create_group (&mcbsp->dev->kobj, &sidetone_attr_group); + ret =devm_device_add_group (mcbsp->dev, &sidetone_attr_group);if (ret)return ret;
@@ -371,16 +371,6 @@ int omap_mcbsp_st_init(struct platform_device *pdev)return 0 ; } -void omap_mcbsp_st_cleanup (struct platform_device *pdev) -{ -struct omap_mcbsp *mcbsp =platform_get_drvdata (pdev); - -if (mcbsp->st_data) { -sysfs_remove_group (&mcbsp->dev->kobj, &sidetone_attr_group); -clk_put (mcbsp->st_data->mcbsp_iclk); - } -} -static int omap_mcbsp_st_info_volsw (struct snd_kcontrol *kcontrol,struct snd_ctl_elem_info *uinfo) {
sound/soc/ti/omap-mcbsp.c +2 -17
@@ -706,8 +706,7 @@ static int omap_mcbsp_init(struct platform_device *pdev) mcbsp->max_tx_thres =max_thres (mcbsp) -0x10 ; mcbsp->max_rx_thres =max_thres (mcbsp) -0x10 ; - ret =sysfs_create_group (&mcbsp->dev->kobj, - &additional_attr_group); + ret =devm_device_add_group (mcbsp->dev, &additional_attr_group);if (ret) {dev_err (mcbsp->dev,"Unable to create additional controls\n" );
@@ -715,16 +714,7 @@ static int omap_mcbsp_init(struct platform_device *pdev) } } - ret =omap_mcbsp_st_init (pdev); -if (ret) - goto err_st; - -return 0 ; - -err_st: -if (mcbsp->pdata->buffer_size) -sysfs_remove_group (&mcbsp->dev->kobj, &additional_attr_group); -return ret; +return omap_mcbsp_st_init (pdev); }/*
@@ -1435,11 +1425,6 @@ static int asoc_mcbsp_remove(struct platform_device *pdev)if (pm_qos_request_active (&mcbsp->pm_qos_req))pm_qos_remove_request (&mcbsp->pm_qos_req); -if (mcbsp->pdata->buffer_size) -sysfs_remove_group (&mcbsp->dev->kobj, &additional_attr_group); - -omap_mcbsp_st_cleanup (pdev); -return 0 ; }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 11/16 ASoC: wm8998: Fix event generation for input mux
In reply to Sasha LevinFrom: Charles Keepax <[email protected]>
[ Upstream commit 15b2e5d10ccf32a1a1ae7c636511e2f51320fdb5 ]
wm8998_inmux_put returns the value of snd_soc_dapm_mux_update_power, which returns a 1 if a path was found for the kcontrol. This is obviously different to the expected return a 1 if the control was updated value. This results in spurious notifications to user-space. Update the handling to only return a 1 when the value is changed.
--- sound/soc/codecs/wm8998.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
sound/soc/codecs/wm8998.c +14 -7
@@ -108,6 +108,7 @@ static int wm8998_inmux_put(struct snd_kcontrol *kcontrol,struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;unsigned int mode_reg, mode_index;unsigned int mux, inmode, src_val, mode_val; +int change, ret; mux = ucontrol->value.enumerated.item[0 ];if (mux >1 )
@@ -137,14 +138,20 @@ static int wm8998_inmux_put(struct snd_kcontrol *kcontrol,snd_soc_component_update_bits (component, mode_reg,ARIZONA_IN1_MODE_MASK , mode_val); -snd_soc_component_update_bits (component, e->reg, -ARIZONA_IN1L_SRC_MASK | -ARIZONA_IN1L_SRC_SE_MASK , - src_val); + change =snd_soc_component_update_bits (component, e->reg, +ARIZONA_IN1L_SRC_MASK | +ARIZONA_IN1L_SRC_SE_MASK , + src_val); -return snd_soc_dapm_mux_update_power (dapm, kcontrol, - ucontrol->value.enumerated.item[0 ], - e,NULL ); + ret =snd_soc_dapm_mux_update_power (dapm, kcontrol, + ucontrol->value.enumerated.item[0 ], + e,NULL ); +if (ret <0 ) { +dev_err (arizona->dev,"Failed to update demux power state: %d\n" , ret); +return ret; + } + +return change; }static const char *const wm8998_inmux_texts[] = {
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 12/16 ASoC: cs47l92: Fix event generation for OUT1 demux
In reply to Sasha LevinFrom: Charles Keepax <[email protected]>
[ Upstream commit 870d72ab9228575b2f005c9a23ea08787e0f63e6 ]
cs47l92_put_demux returns the value of snd_soc_dapm_mux_update_power, which returns a 1 if a path was found for the kcontrol. This is obviously different to the expected return a 1 if the control was updated value. This results in spurious notifications to user-space. Update the handling to only return a 1 when the value is changed.
--- sound/soc/codecs/cs47l92.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
sound/soc/codecs/cs47l92.c +7 -1
@@ -119,7 +119,13 @@ static int cs47l92_put_demux(struct snd_kcontrol *kcontrol, end:snd_soc_dapm_mutex_unlock (dapm); -return snd_soc_dapm_mux_update_power (dapm, kcontrol, mux, e,NULL ); + ret =snd_soc_dapm_mux_update_power (dapm, kcontrol, mux, e,NULL ); +if (ret <0 ) { +dev_err (madera->dev,"Failed to update demux power state: %d\n" , ret); +return ret; + } + +return change; } static SOC_ENUM_SINGLE_DECL(cs47l92_outdemux_enum,
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 13/16 scsi: target: Fix WRITE_SAME No Data Buffer crash
In reply to Sasha LevinFrom: Mike Christie <[email protected]>
[ Upstream commit ccd3f449052449a917a3e577d8ba0368f43b8f29 ]
In newer version of the SBC specs, we have a NDOB bit that indicates there is no data buffer that gets written out. If this bit is set using commands like "sg_write_same --ndob" we will crash in target_core_iblock/file's execute_write_same handlers when we go to access the se_cmd->t_data_sg because its NULL.
This patch adds a check for the NDOB bit in the common WRITE SAME code because we don't support it. And, it adds a check for zero SG elements in each handler in case the initiator tries to send a normal WRITE SAME with no data buffer.
--- drivers/target/target_core_file.c | 3 +++ drivers/target/target_core_iblock.c | 4 ++++ drivers/target/target_core_sbc.c | 6 ++++++ 3 files changed, 13 insertions(+)
drivers/target/target_core_file.c +3 -0
@@ -455,6 +455,9 @@ fd_execute_write_same(struct se_cmd *cmd)return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE ; } +if (!cmd->t_data_nents) +return TCM_INVALID_CDB_FIELD ; +if (cmd->t_data_nents >1 || cmd->t_data_sg[0 ].length != cmd->se_dev->dev_attrib.block_size) { pr_err("WRITE_SAME: Illegal SGL t_data_nents: %u length: %u"
drivers/target/target_core_iblock.c +4 -0
@@ -458,6 +458,10 @@ iblock_execute_write_same(struct se_cmd *cmd) " backends not supported\n");return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE ; } + +if (!cmd->t_data_nents) +return TCM_INVALID_CDB_FIELD ; + sg = &cmd->t_data_sg[0 ]; if (cmd->t_data_nents > 1 ||
drivers/target/target_core_sbc.c +6 -0
@@ -312,6 +312,12 @@ sbc_setup_write_same(struct se_cmd *cmd, unsigned char flags, struct sbc_ops *oppr_warn ("WRITE SAME with ANCHOR not supported\n" );return TCM_INVALID_CDB_FIELD ; } + +if (flags &0x01 ) { +pr_warn ("WRITE SAME with NDOB not supported\n" ); +return TCM_INVALID_CDB_FIELD ; + } +/* * Special case for WRITE_SAME w/ UNMAP=1 that ends up getting * translated into block discard requests within backend code.
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 14/16 platform/x86: asus-wmi: Add key mappings
In reply to Sasha LevinFrom: Misaka19465 <[email protected]>
[ Upstream commit f56e676a7f1ca7de9002526df3d2ee0e47dfd8ce ]
On laptops like ASUS TUF Gaming A15, which have hotkeys to start Armoury Crate or AURA Sync, these hotkeys are unavailable. This patch add mappings for them.
--- drivers/platform/x86/asus-nb-wmi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/platform/x86/asus-nb-wmi.c +2 -0
@@ -529,6 +529,7 @@ static const struct key_entry asus_nb_wmi_keymap[] = { { KE_KEY, 0x31, { KEY_VOLUMEDOWN } }, { KE_KEY, 0x32, { KEY_MUTE } }, { KE_KEY, 0x35, { KEY_SCREENLOCK } }, + { KE_KEY, 0x38, { KEY_PROG3 } }, /* Armoury Crate */ { KE_KEY, 0x40, { KEY_PREVIOUSSONG } }, { KE_KEY, 0x41, { KEY_NEXTSONG } }, { KE_KEY, 0x43, { KEY_STOPCD } }, /* Stop/Eject */
@@ -578,6 +579,7 @@ static const struct key_entry asus_nb_wmi_keymap[] = { { KE_KEY, 0xA5, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + TV + HDMI */ { KE_KEY, 0xA6, { KEY_SWITCHVIDEOMODE } }, /* SDSP CRT + TV + HDMI */ { KE_KEY, 0xA7, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + CRT + TV + HDMI */ + { KE_KEY, 0xB3, { KEY_PROG4 } }, /* AURA */ { KE_KEY, 0xB5, { KEY_CALC } }, { KE_KEY, 0xC4, { KEY_KBDILLUMUP } }, { KE_KEY, 0xC5, { KEY_KBDILLUMDOWN } },
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 15/16 scsi: pm80xx: Fix 'Unknown' max/min linkrate
In reply to Sasha LevinFrom: Changyuan Lyu <[email protected]>
[ Upstream commit e78276cadb669d3e55cffe66bd166ff3c8572e38 ]
Currently, the data flow of the max/min linkrate in the driver is
* in pm8001_get_lrate_mode():
hardcoded value ==> struct sas_phy
* in pm8001_bytes_dmaed():
struct pm8001_phy ==> struct sas_phy
* in pm8001_phy_control():
libsas data ==> struct pm8001_phy
Since pm8001_bytes_dmaed() follows pm8001_get_lrate_mode(), and the fields in struct pm8001_phy are not initialized, sysfs /sys/class/sas_phy/phy-*/maximum_linkrate always shows Unknown.
To fix the issue, change the dataflow to the following:
* in pm8001_phy_init():
initial value ==> struct pm8001_phy
* in pm8001_get_lrate_mode():
struct pm8001_phy ==> struct sas_phy
* in pm8001_phy_control():
libsas data ==> struct pm8001_phy
For negotiated linkrate, the current dataflow is:
* in pm8001_get_lrate_mode():
iomb data ==> struct asd_sas_phy ==> struct sas_phy
* in pm8001_bytes_dmaed():
struct asd_sas_phy ==> struct sas_phy
Since pm8001_bytes_dmaed() follows pm8001_get_lrate_mode(), the assignment statements in pm8001_bytes_dmaed() are unnecessary and cleaned up.
--- drivers/scsi/pm8001/pm8001_hwi.c | 19 +++---------------- drivers/scsi/pm8001/pm8001_init.c | 2 ++ 2 files changed, 5 insertions(+), 16 deletions(-)
drivers/scsi/pm8001/pm8001_hwi.c +3 -16
@@ -3249,15 +3249,6 @@ void pm8001_bytes_dmaed(struct pm8001_hba_info *pm8001_ha, int i)if (!phy->phy_attached)return ; -if (sas_phy->phy) { -struct sas_phy *sphy = sas_phy->phy; - sphy->negotiated_linkrate = sas_phy->linkrate; - sphy->minimum_linkrate = phy->minimum_linkrate; - sphy->minimum_linkrate_hw =SAS_LINK_RATE_1_5_GBPS ; - sphy->maximum_linkrate = phy->maximum_linkrate; - sphy->maximum_linkrate_hw = phy->maximum_linkrate; - } -if (phy->phy_type &PORT_TYPE_SAS ) {struct sas_identify_frame *id; id = (struct sas_identify_frame *)phy->frame_rcvd;
@@ -3281,26 +3272,22 @@ void pm8001_get_lrate_mode(struct pm8001_phy *phy, u8 link_rate)switch (link_rate) {case PHY_SPEED_120 : phy->sas_phy.linkrate =SAS_LINK_RATE_12_0_GBPS ; - phy->sas_phy.phy->negotiated_linkrate =SAS_LINK_RATE_12_0_GBPS ;break ;case PHY_SPEED_60 : phy->sas_phy.linkrate =SAS_LINK_RATE_6_0_GBPS ; - phy->sas_phy.phy->negotiated_linkrate =SAS_LINK_RATE_6_0_GBPS ;break ;case PHY_SPEED_30 : phy->sas_phy.linkrate =SAS_LINK_RATE_3_0_GBPS ; - phy->sas_phy.phy->negotiated_linkrate =SAS_LINK_RATE_3_0_GBPS ;break ;case PHY_SPEED_15 : phy->sas_phy.linkrate =SAS_LINK_RATE_1_5_GBPS ; - phy->sas_phy.phy->negotiated_linkrate =SAS_LINK_RATE_1_5_GBPS ;break ; } sas_phy->negotiated_linkrate = phy->sas_phy.linkrate; - sas_phy->maximum_linkrate_hw =SAS_LINK_RATE_6_0_GBPS ; + sas_phy->maximum_linkrate_hw = phy->maximum_linkrate; sas_phy->minimum_linkrate_hw =SAS_LINK_RATE_1_5_GBPS ; - sas_phy->maximum_linkrate =SAS_LINK_RATE_6_0_GBPS ; - sas_phy->minimum_linkrate =SAS_LINK_RATE_1_5_GBPS ; + sas_phy->maximum_linkrate = phy->maximum_linkrate; + sas_phy->minimum_linkrate = phy->minimum_linkrate; }/**
drivers/scsi/pm8001/pm8001_init.c +2 -0
@@ -123,6 +123,8 @@ static void pm8001_phy_init(struct pm8001_hba_info *pm8001_ha, int phy_id)struct asd_sas_phy *sas_phy = &phy->sas_phy; phy->phy_state =PHY_LINK_DISABLE ; phy->pm8001_ha = pm8001_ha; + phy->minimum_linkrate =SAS_LINK_RATE_1_5_GBPS ; + phy->maximum_linkrate =SAS_LINK_RATE_6_0_GBPS ; sas_phy->enabled = (phy_id < pm8001_ha->chip->n_phy) ?1 :0 ; sas_phy->class =SAS ; sas_phy->iproto =SAS_PROTOCOL_ALL ;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 16/16 scsi: pm80xx: Set stopped phy's linkrate to Disabled
In reply to Sasha LevinFrom: Changyuan Lyu <[email protected]>
[ Upstream commit 355bf2e036c954317ddc4a9618b4f7e38ea5a970 ]
Negotiated link rate needs to be updated to 'Disabled' when phy is stopped.
--- drivers/scsi/pm8001/pm80xx_hwi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/scsi/pm8001/pm80xx_hwi.c +5 -1
@@ -3406,8 +3406,12 @@ static int mpi_phy_stop_resp(struct pm8001_hba_info *pm8001_ha, void *piomb)pm8001_printk ("phy:0x%x status:0x%x\n" , phyid, status));if (status ==PHY_STOP_SUCCESS || - status ==PHY_STOP_ERR_DEVICE_ATTACHED ) + status ==PHY_STOP_ERR_DEVICE_ATTACHED ) { phy->phy_state =PHY_LINK_DISABLE ; + phy->sas_phy.phy->negotiated_linkrate =SAS_PHY_DISABLED ; + phy->sas_phy.linkrate =SAS_PHY_DISABLED ; + } +return 0 ; }
Signature · 1 line
2.35.1