hwmon: (da9052) Synchronize access with mfd
Subsystems (50)
Sasha Levin
maintainerPATCH 42/606 x86: Fix early boot crash on gcc-10, third try
In reply to Sasha LevinFrom: Borislav Petkov <[email protected]>
commit a9a3ed1eff3601b63aea4fb462d8b3b92c7c1e7e upstream.
... or the odyssey of trying to disable the stack protector for the function which generates the stack canary value.
The whole story started with Sergei reporting a boot crash with a kernel built with gcc-10:
Kernel panic — not syncing: stack-protector: Kernel stack is corrupted in: start_secondary
CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.6.0-rc5—00235—gfffb08b37df9 #139
Hardware name: Gigabyte Technology Co., Ltd. To be filled by O.E.M./H77M—D3H, BIOS F12 11/14/2013
Call Trace:
dump_stack
panic
? start_secondary
__stack_chk_fail
start_secondary
secondary_startup_64
-—-[ end Kernel panic — not syncing: stack—protector: Kernel stack is corrupted in: start_secondaryThis happens because gcc-10 tail-call optimizes the last function call in start_secondary() - cpu_startup_entry() - and thus emits a stack canary check which fails because the canary value changes after the boot_init_stack_canary() call.
To fix that, the initial attempt was to mark the one function which generates the stack canary with:
__attribute__((optimize("-fno-stack-protector"))) ... start_secondary(void *unused)
however, using the optimize attribute doesn't work cumulatively as the attribute does not add to but rather replaces previously supplied optimization options - roughly all -fxxx options.
The key one among them being -fno-omit-frame-pointer and thus leading to not present frame pointer - frame pointer which the kernel needs.
The next attempt to prevent compilers from tail-call optimizing the last function call cpu_startup_entry(), shy of carving out start_secondary() into a separate compilation unit and building it with -fno-stack-protector, was to add an empty asm("").
This current solution was short and sweet, and reportedly, is supported by both compilers but we didn't get very far this time: future (LTO?) optimization passes could potentially eliminate this, which leads us to the third attempt: having an actual memory barrier there which the compiler cannot ignore or move around etc.
That should hold for a long time, but hey we said that about the other two solutions too so...
--- arch/x86/include/asm/stackprotector.h | 7 ++++++- arch/x86/kernel/smpboot.c | 8 ++++++++ arch/x86/xen/smp_pv.c | 1 + include/linux/compiler.h | 6 ++++++ init/main.c | 2 ++ 5 files changed, 23 insertions(+), 1 deletion(-)
arch/x86/include/asm/stackprotector.h +6 -1
@@ -55,8 +55,13 @@/* * Initialize the stackprotector canary value. * -* NOTE: this must only be called from functions that never return, +* NOTE: this must only be called from functions that never return * and it must always be inlined. +* +* In addition, it should be called from a compilation unit for which +* stack protector is disabled. Alternatively, the caller should not end +* with a function call which gets tail-call optimized as that would +* lead to checking a modified canary value. */ static __always_inline void boot_init_stack_canary(void) {
arch/x86/kernel/smpboot.c +8 -0
@@ -262,6 +262,14 @@ static void notrace start_secondary(void *unused)wmb ();cpu_startup_entry (CPUHP_AP_ONLINE_IDLE ); + +/* +* Prevent tail call to cpu_startup_entry() because the stack protector +* guard has been changed a couple of function calls up, in +* boot_init_stack_canary() and must not be checked before tail calling +* another function. +*/ +prevent_tail_call_optimization (); }/**
arch/x86/xen/smp_pv.c +1 -0
@@ -92,6 +92,7 @@ asmlinkage __visible void cpu_bringup_and_idle(void)cpu_bringup ();boot_init_stack_canary ();cpu_startup_entry (CPUHP_AP_ONLINE_IDLE ); +prevent_tail_call_optimization (); }void xen_smp_intr_free_pv (unsigned int cpu)
include/linux/compiler.h +6 -0
@@ -356,4 +356,10 @@ static inline void *offset_to_ptr(const int *off)/* &a[0] degrades to a pointer: a different type from an array */ #define __must_be_array (a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) +/* +* This is needed in functions which generate the stack canary, see +* arch/x86/kernel/smpboot.c::start_secondary() for an example. +*/ +#define prevent_tail_call_optimization () mb() +#endif /* __LINUX_COMPILER_H */
init/main.c +2 -0
@@ -1032,6 +1032,8 @@ asmlinkage __visible void __init start_kernel(void)/* Do the rest non-__init'ed, we're now alive */ arch_call_rest_init (); + +prevent_tail_call_optimization (); }/* Call all constructor functions linked into the kernel. */
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 45/606 clk: rockchip: fix incorrect configuration of rk3228 aclk_gpu* clocks
In reply to Sasha LevinFrom: Justin Swartz <[email protected]>
commit cec9d101d70a3509da9bd2e601e0b242154ce616 upstream.
The following changes prevent the unrecoverable freezes and rcu_sched stall warnings experienced in each of my attempts to take advantage of lima.
Replace the COMPOSITE_NOGATE definition of aclk_gpu_pre with a COMPOSITE that retains the selection of HDMIPHY as the PLL source, but instead makes uses of the aclk_gpu PLL source gate and parent names defined by mux_pll_src_4plls_p rather than mux_aclk_gpu_pre_p.
Remove the now unused mux_aclk_gpu_pre_p and the four named but also unused definitions (cpll_gpu, gpll_gpu, hdmiphy_gpu and usb480m_gpu) of the aclk_gpu PLL source gate.
Use the correct gate offset for aclk_gpu and aclk_gpu_noc.
--- drivers/clk/rockchip/clk-rk3228.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-)
drivers/clk/rockchip/clk-rk3228.c +4 -13
@@ -156,8 +156,6 @@ PNAME(mux_i2s_out_p) = { "i2s1_pre", "xin12m" };PNAME (mux_i2s2_p) = {"i2s2_src" ,"i2s2_frac" ,"xin12m" };PNAME (mux_sclk_spdif_p) = {"sclk_spdif_src" ,"spdif_frac" ,"xin12m" }; -PNAME (mux_aclk_gpu_pre_p) = {"cpll_gpu" ,"gpll_gpu" ,"hdmiphy_gpu" ,"usb480m_gpu" }; -PNAME (mux_uart0_p) = {"uart0_src" ,"uart0_frac" ,"xin24m" };PNAME (mux_uart1_p) = {"uart1_src" ,"uart1_frac" ,"xin24m" };PNAME (mux_uart2_p) = {"uart2_src" ,"uart2_frac" ,"xin24m" };
@@ -468,16 +466,9 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = { RK2928_CLKSEL_CON(24), 6, 10, DFLAGS, RK2928_CLKGATE_CON(2), 8, GFLAGS), -GATE (0 ,"cpll_gpu" ,"cpll" ,0 , -RK2928_CLKGATE_CON (3 ),13 ,GFLAGS ), -GATE (0 ,"gpll_gpu" ,"gpll" ,0 , -RK2928_CLKGATE_CON (3 ),13 ,GFLAGS ), -GATE (0 ,"hdmiphy_gpu" ,"hdmiphy" ,0 , -RK2928_CLKGATE_CON (3 ),13 ,GFLAGS ), -GATE (0 ,"usb480m_gpu" ,"usb480m" ,0 , +COMPOSITE (0 ,"aclk_gpu_pre" , mux_pll_src_4plls_p,0 , +RK2928_CLKSEL_CON (34 ),5 ,2 ,MFLAGS ,0 ,5 ,DFLAGS ,RK2928_CLKGATE_CON (3 ),13 ,GFLAGS ), -COMPOSITE_NOGATE (0 ,"aclk_gpu_pre" , mux_aclk_gpu_pre_p,0 , -RK2928_CLKSEL_CON (34 ),5 ,2 ,MFLAGS ,0 ,5 ,DFLAGS ), COMPOSITE(SCLK_SPI0, "sclk_spi0", mux_pll_src_2plls_p, 0, RK2928_CLKSEL_CON(25), 8, 1, MFLAGS, 0, 7, DFLAGS,
@@ -582,8 +573,8 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = {GATE (0 ,"pclk_peri_noc" ,"pclk_peri" ,CLK_IGNORE_UNUSED ,RK2928_CLKGATE_CON (12 ),2 ,GFLAGS ),/* PD_GPU */ -GATE (ACLK_GPU ,"aclk_gpu" ,"aclk_gpu_pre" ,0 ,RK2928_CLKGATE_CON (13 ),14 ,GFLAGS ), -GATE (0 ,"aclk_gpu_noc" ,"aclk_gpu_pre" ,0 ,RK2928_CLKGATE_CON (13 ),15 ,GFLAGS ), +GATE (ACLK_GPU ,"aclk_gpu" ,"aclk_gpu_pre" ,0 ,RK2928_CLKGATE_CON (7 ),14 ,GFLAGS ), +GATE (0 ,"aclk_gpu_noc" ,"aclk_gpu_pre" ,0 ,RK2928_CLKGATE_CON (7 ),15 ,GFLAGS ),/* PD_BUS */ GATE(0, "sclk_initmem_mbist", "aclk_cpu", 0, RK2928_CLKGATE_CON(8), 1, GFLAGS),
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 49/606 usb: gadget: tegra-xudc: Fix idle suspend/resume
In reply to Sasha LevinFrom: Thierry Reding <[email protected]>
commit 0534d40160cb9505073b0ecf5e7210daee319a66 upstream.
When the XUDC device is idle (i.e. powergated), care must be taken not to access any registers because that would lead to a crash.
Move the call to tegra_xudc_device_mode_off() into the same conditional as the tegra_xudc_powergate() call to make sure we only force device mode off if the XUDC is actually powered up.
--- drivers/usb/gadget/udc/tegra-xudc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/usb/gadget/udc/tegra-xudc.c +4 -4
@@ -3740,11 +3740,11 @@ static int __maybe_unused tegra_xudc_suspend(struct device *dev)flush_work (&xudc->usb_role_sw_work); -/* Forcibly disconnect before powergating. */ -tegra_xudc_device_mode_off (xudc); - -if (!pm_runtime_status_suspended (dev)) +if (!pm_runtime_status_suspended (dev)) { +/* Forcibly disconnect before powergating. */ +tegra_xudc_device_mode_off (xudc);tegra_xudc_powergate (xudc); + }pm_runtime_disable (dev);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 60/606 arm64: dts: rockchip: Replace RK805 PMIC node name with "pmic" on rk3328 boards
In reply to Sasha LevinFrom: Chen-Yu Tsai <[email protected]>
commit 83b994129fb4c18a8460fd395864a28740e5e7fb upstream.
In some board device tree files, "rk805" was used for the RK805 PMIC's node name. However the policy for device trees is that generic names should be used.
Replace the "rk805" node name with the generic "pmic" name.
--- arch/arm64/boot/dts/rockchip/rk3328-evb.dts | 2 +- arch/arm64/boot/dts/rockchip/rk3328-rock64.dts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/rockchip/rk3328-evb.dts +1 -1
@@ -92,7 +92,7 @@ &gmac2phy { &i2c1 { status = "okay"; - rk805: rk805@18 { + rk805: pmic@18 { compatible = "rockchip,rk805"; reg = <0x18>; interrupt-parent = <&gpio2>;
arch/arm64/boot/dts/rockchip/rk3328-rock64.dts +1 -1
@@ -169,7 +169,7 @@ &hdmiphy { &i2c1 { status = "okay"; - rk805: rk805@18 { + rk805: pmic@18 { compatible = "rockchip,rk805"; reg = <0x18>; interrupt-parent = <&gpio2>;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 61/606 arm64: dts: rockchip: Rename dwc3 device nodes on rk3399 to make dtc happy
In reply to Sasha LevinFrom: Chen-Yu Tsai <[email protected]>
commit 190c7f6fd43a776d4a6da1dac44408104649e9b7 upstream.
The device tree compiler complains that the dwc3 nodes have regs properties but no matching unit addresses.
Add the unit addresses to the device node name. While at it, also rename the nodes from "dwc3" to "usb", as guidelines require device nodes have generic names.
--- arch/arm64/boot/dts/rockchip/rk3399.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/rockchip/rk3399.dtsi +2 -2
@@ -410,7 +410,7 @@ usbdrd3_0: usb@fe800000 { reset-names = "usb3-otg"; status = "disabled"; - usbdrd_dwc3_0: dwc3 { + usbdrd_dwc3_0: usb@fe800000 { compatible = "snps,dwc3"; reg = <0x0 0xfe800000 0x0 0x100000>; interrupts = <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH 0>;
@@ -446,7 +446,7 @@ usbdrd3_1: usb@fe900000 { reset-names = "usb3-otg"; status = "disabled"; - usbdrd_dwc3_1: dwc3 { + usbdrd_dwc3_1: usb@fe900000 { compatible = "snps,dwc3"; reg = <0x0 0xfe900000 0x0 0x100000>; interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH 0>;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 111/606 vhost/vsock: fix packet delivery order to monitoring devices
In reply to Sasha LevinFrom: Stefano Garzarella <[email protected]>
[ Upstream commit 107bc0766b9feb5113074c753735a3f115c2141f ]
We want to deliver packets to monitoring devices before it is put in the virtqueue, to avoid that replies can appear in the packet capture before the transmitted packet.
--- drivers/vhost/vsock.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/vhost/vsock.c +5 -5
@@ -181,14 +181,14 @@ vhost_transport_do_send_pkt(struct vhost_vsock *vsock,break ; } -vhost_add_used (vq, head,sizeof (pkt->hdr) + payload_len); - added = true; - -/* Deliver to monitoring devices all correctly transmitted -* packets. +/* Deliver to monitoring devices all packets that we +* will transmit. */ virtio_transport_deliver_tap_pkt (pkt); +vhost_add_used (vq, head,sizeof (pkt->hdr) + payload_len); + added = true; + pkt->off += payload_len; total_len += payload_len;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 123/606 ceph: fix double unlock in handle_cap_export()
In reply to Sasha LevinFrom: Wu Bo <[email protected]>
[ Upstream commit 4d8e28ff3106b093d98bfd2eceb9b430c70a8758 ]
If the ceph_mdsc_open_export_target_session() return fails, it will do a "goto retry", but the session mutex has already been unlocked. Re-lock the mutex in that case to ensure that we don't unlock it twice.
--- fs/ceph/caps.c | 1 + 1 file changed, 1 insertion(+)
fs/ceph/caps.c +1 -0
@@ -3707,6 +3707,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,WARN_ON (1 ); tsession =NULL ; target =-1 ; +mutex_lock (&session->s_mutex); } goto retry;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 126/606 platform/x86: asus-nb-wmi: Do not load on Asus T100TA and T200TA
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit 3bd12da7f50b8bc191fcb3bab1f55c582234df59 ]
asus-nb-wmi does not add any extra functionality on these Asus Transformer books. They have detachable keyboards, so the hotkeys are send through a HID device (and handled by the hid-asus driver) and also the rfkill functionality is not used on these devices.
Besides not adding any extra functionality, initializing the WMI interface on these devices actually has a negative side-effect. For some reason the \_SB.ATKD.INIT() function which asus_wmi_platform_init() calls drives GPO2 (INT33FC:02) pin 8, which is connected to the front facing webcam LED, high and there is no (WMI or other) interface to drive this low again causing the LED to be permanently on, even during suspend.
This commit adds a blacklist of DMI system_ids on which not to load the asus-nb-wmi and adds these Transformer books to this list. This fixes the webcam LED being permanently on under Linux.
--- drivers/platform/x86/asus-nb-wmi.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/platform/x86/asus-nb-wmi.c +24 -0
@@ -515,9 +515,33 @@ static struct asus_wmi_driver asus_nb_wmi_driver = { .detect_quirks = asus_nb_wmi_quirks, }; +static const struct dmi_system_id asus_nb_wmi_blacklist[]__initconst = { + { +/* +* asus-nb-wm adds no functionality. The T100TA has a detachable +* USB kbd, so no hotkeys and it has no WMI rfkill; and loading +* asus-nb-wm causes the camera LED to turn and _stay_ on. +*/ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"ASUSTeK COMPUTER INC." ), +DMI_EXACT_MATCH (DMI_PRODUCT_NAME ,"T100TA" ), + }, + }, + { +/* The Asus T200TA has the same issue as the T100TA */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"ASUSTeK COMPUTER INC." ), +DMI_EXACT_MATCH (DMI_PRODUCT_NAME ,"T200TA" ), + }, + }, + {}/* Terminating entry */ +};static int __init asus_nb_wmi_init (void ) { +if (dmi_check_system (asus_nb_wmi_blacklist)) +return -ENODEV ; +return asus_wmi_register_driver (&asus_nb_wmi_driver); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 148/606 scsi: target: Put lun_ref at end of tmr processing
In reply to Sasha LevinFrom: Bodo Stroesser <[email protected]>
commit f2e6b75f6ee82308ef7b00f29e71e5f1c6b3d52a upstream.
Testing with Loopback I found that, after a Loopback LUN has executed a TMR, I can no longer unlink the LUN. The rm command hangs in transport_clear_lun_ref() at wait_for_completion(&lun->lun_shutdown_comp) The reason is, that transport_lun_remove_cmd() is not called at the end of target_tmr_work().
It seems, that in other fabrics this call happens implicitly when the fabric drivers call transport_generic_free_cmd() during their ->queue_tm_rsp().
Unfortunately Loopback seems to not comply to the common way of calling transport_generic_free_cmd() from ->queue_*(). Instead it calls transport_generic_free_cmd() from its
->check_stop_free() only.
But the ->check_stop_free() is called by transport_cmd_check_stop_to_fabric() after it has reset the se_cmd->se_lun pointer. Therefore the following transport_generic_free_cmd() skips the transport_lun_remove_cmd().
So this patch re-adds the transport_lun_remove_cmd() at the end of target_tmr_work(), which was removed during commit 2c9fa49e100f ("scsi:
target/core: Make ABORT and LUN RESET handling synchronous").
For fabrics using transport_generic_free_cmd() in the usual way the double call to transport_lun_remove_cmd() doesn't harm, as transport_lun_remove_cmd() checks for this situation and does not release lun_ref twice.
--- drivers/target/target_core_transport.c | 1 + 1 file changed, 1 insertion(+)
drivers/target/target_core_transport.c +1 -0
@@ -3349,6 +3349,7 @@ static void target_tmr_work(struct work_struct *work) cmd->se_tfo->queue_tm_rsp (cmd); +transport_lun_remove_cmd (cmd);transport_cmd_check_stop_to_fabric (cmd);return ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 156/606 dmaengine: tegra210-adma: Fix an error handling path in 'tegra_adma_probe()'
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
commit 3a5fd0dbd87853f8bd2ea275a5b3b41d6686e761 upstream.
Commit b53611fb1ce9 ("dmaengine: tegra210-adma: Fix crash during probe") has moved some code in the probe function and reordered the error handling path accordingly.
However, a goto has been missed.
Fix it and goto the right label if 'dma_async_device_register()' fails, so that all resources are released.
--- drivers/dma/tegra210-adma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/tegra210-adma.c +1 -1
@@ -900,7 +900,7 @@ static int tegra_adma_probe(struct platform_device *pdev) ret =dma_async_device_register (&tdma->dma_dev);if (ret <0 ) {dev_err (&pdev->dev,"ADMA registration failed: %d\n" , ret); - goto irq_dispose; + goto rpm_put; } ret = of_dma_controller_register(pdev->dev.of_node,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 164/606 Revert "gfs2: Don't demote a glock until its revokes are written"
In reply to Sasha LevinFrom: Bob Peterson <[email protected]>
[ Upstream commit b14c94908b1b884276a6608dea3d0b1b510338b7 ]
This reverts commit df5db5f9ee112e76b5202fbc331f990a0fc316d6.
This patch fixes a regression: patch df5db5f9ee112 allowed function run_queue() to bypass its call to do_xmote() if revokes were queued for the glock. That's wrong because its call to do_xmote() is what is responsible for calling the go_sync() glops functions to sync both the ail list and any revokes queued for it. By bypassing the call, gfs2 could get into a stand-off where the glock could not be demoted until its revokes are written back, but the revokes would not be written back because do_xmote() was never called.
It "sort of" works, however, because there are other mechanisms like the log flush daemon (logd) that can sync the ail items and revokes, if it deems it necessary. The problem is: without file system pressure, it might never deem it necessary.
--- fs/gfs2/glock.c | 3 --- 1 file changed, 3 deletions(-)
fs/gfs2/glock.c +0 -3
@@ -645,9 +645,6 @@ __acquires(&gl->gl_lockref.lock) goto out_unlock;if (nonblock) goto out_sched; -smp_mb (); -if (atomic_read (&gl->gl_revokes) !=0 ) - goto out_sched;set_bit (GLF_DEMOTE_IN_PROGRESS , &gl->gl_flags);GLOCK_BUG_ON (gl, gl->gl_demote_state ==LM_ST_EXCLUSIVE ); gl->gl_target = gl->gl_demote_state;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 165/606 virtio-balloon: Revert "virtio-balloon: Switch back to OOM handler for VIRTIO_BALLOON_F_DEFLATE_ON_OOM"
In reply to Sasha LevinFrom: "Michael S. Tsirkin" <[email protected]>
[ Upstream commit 835a6a649d0dd1b1f46759eb60fff2f63ed253a7 ]
This reverts commit 5a6b4cc5b7a1892a8d7f63d6cbac6e0ae2a9d031.
It has been queued properly in the akpm tree, this version is just creating conflicts.
--- drivers/virtio/virtio_balloon.c | 107 +++++++++++++++++++------------- 1 file changed, 63 insertions(+), 44 deletions(-)
drivers/virtio/virtio_balloon.c +63 -44
@@ -14,7 +14,6 @@#include <linux/slab.h> #include <linux/module.h> #include <linux/balloon_compaction.h> -#include <linux/oom.h> #include <linux/wait.h> #include <linux/mm.h> #include <linux/mount.h>
@@ -28,9 +27,7 @@*/ #define VIRTIO_BALLOON_PAGES_PER_PAGE (unsigned)(PAGE_SIZE >> VIRTIO_BALLOON_PFN_SHIFT)#define VIRTIO_BALLOON_ARRAY_PFNS_MAX 256 -/* Maximum number of (4k) pages to deflate on OOM notifications. */ -#define VIRTIO_BALLOON_OOM_NR_PAGES 256 -#define VIRTIO_BALLOON_OOM_NOTIFY_PRIORITY 80 +#define VIRTBALLOON_OOM_NOTIFY_PRIORITY 80#define VIRTIO_BALLOON_FREE_PAGE_ALLOC_FLAG (__GFP_NORETRY | __GFP_NOWARN | \ __GFP_NOMEMALLOC)
@@ -115,11 +112,8 @@ struct virtio_balloon {/* Memory statistics */ struct virtio_balloon_stat stats[VIRTIO_BALLOON_S_NR ]; -/* Shrinker to return free pages - VIRTIO_BALLOON_F_FREE_PAGE_HINT */ +/* To register a shrinker to shrink memory upon memory pressure */ struct shrinker shrinker; - -/* OOM notifier to deflate on OOM - VIRTIO_BALLOON_F_DEFLATE_ON_OOM */ -struct notifier_block oom_nb; };static struct virtio_device_id id_table[] = {
@@ -794,13 +788,50 @@ static unsigned long shrink_free_pages(struct virtio_balloon *vb,return blocks_freed *VIRTIO_BALLOON_HINT_BLOCK_PAGES ; } +static unsigned long leak_balloon_pages (struct virtio_balloon *vb, +unsigned long pages_to_free) +{ +return leak_balloon (vb, pages_to_free *VIRTIO_BALLOON_PAGES_PER_PAGE ) / +VIRTIO_BALLOON_PAGES_PER_PAGE ; +} + +static unsigned long shrink_balloon_pages (struct virtio_balloon *vb, +unsigned long pages_to_free) +{ +unsigned long pages_freed =0 ; + +/* +* One invocation of leak_balloon can deflate at most +* VIRTIO_BALLOON_ARRAY_PFNS_MAX balloon pages, so we call it +* multiple times to deflate pages till reaching pages_to_free. +*/ +while (vb->num_pages && pages_freed < pages_to_free) + pages_freed +=leak_balloon_pages (vb, + pages_to_free - pages_freed); + +update_balloon_size (vb); + +return pages_freed; +} +static unsigned long virtio_balloon_shrinker_scan (struct shrinker *shrinker,struct shrink_control *sc) { +unsigned long pages_to_free, pages_freed =0 ;struct virtio_balloon *vb =container_of (shrinker, struct virtio_balloon, shrinker); -return shrink_free_pages (vb, sc->nr_to_scan); + pages_to_free = sc->nr_to_scan; + +if (virtio_has_feature (vb->vdev,VIRTIO_BALLOON_F_FREE_PAGE_HINT )) + pages_freed =shrink_free_pages (vb, pages_to_free); + +if (pages_freed >= pages_to_free) +return pages_freed; + + pages_freed +=shrink_balloon_pages (vb, pages_to_free - pages_freed); + +return pages_freed; } static unsigned long virtio_balloon_shrinker_count(struct shrinker *shrinker,
@@ -808,22 +839,26 @@ static unsigned long virtio_balloon_shrinker_count(struct shrinker *shrinker, {struct virtio_balloon *vb =container_of (shrinker, struct virtio_balloon, shrinker); +unsigned long count; + + count = vb->num_pages /VIRTIO_BALLOON_PAGES_PER_PAGE ; + count += vb->num_free_page_blocks *VIRTIO_BALLOON_HINT_BLOCK_PAGES ; -return vb->num_free_page_blocks *VIRTIO_BALLOON_HINT_BLOCK_PAGES ; +return count; } -static int virtio_balloon_oom_notify (struct notifier_block *nb, -unsigned long dummy,void *parm) +static void virtio_balloon_unregister_shrinker (struct virtio_balloon *vb) { -struct virtio_balloon *vb =container_of (nb, - struct virtio_balloon, oom_nb); -unsigned long *freed = parm; +unregister_shrinker (&vb->shrinker); +} - *freed +=leak_balloon (vb,VIRTIO_BALLOON_OOM_NR_PAGES ) / -VIRTIO_BALLOON_PAGES_PER_PAGE ; -update_balloon_size (vb); +static int virtio_balloon_register_shrinker (struct virtio_balloon *vb) +{ + vb->shrinker.scan_objects = virtio_balloon_shrinker_scan; + vb->shrinker.count_objects = virtio_balloon_shrinker_count; + vb->shrinker.seeks =DEFAULT_SEEKS ; -return NOTIFY_OK ; +return register_shrinker (&vb->shrinker); }static int virtballoon_probe (struct virtio_device *vdev)
@@ -900,35 +935,22 @@ static int virtballoon_probe(struct virtio_device *vdev) virtio_cwrite(vb->vdev, struct virtio_balloon_config, poison_val, &poison_val); } - -/* -* We're allowed to reuse any free pages, even if they are -* still to be processed by the host. -*/ - vb->shrinker.scan_objects = virtio_balloon_shrinker_scan; - vb->shrinker.count_objects = virtio_balloon_shrinker_count; - vb->shrinker.seeks =DEFAULT_SEEKS ; - err =register_shrinker (&vb->shrinker); + } +/* +* We continue to use VIRTIO_BALLOON_F_DEFLATE_ON_OOM to decide if a +* shrinker needs to be registered to relieve memory pressure. +*/ +if (virtio_has_feature (vb->vdev,VIRTIO_BALLOON_F_DEFLATE_ON_OOM )) { + err =virtio_balloon_register_shrinker (vb);if (err) goto out_del_balloon_wq; } -if (virtio_has_feature (vdev,VIRTIO_BALLOON_F_DEFLATE_ON_OOM )) { - vb->oom_nb.notifier_call = virtio_balloon_oom_notify; - vb->oom_nb.priority =VIRTIO_BALLOON_OOM_NOTIFY_PRIORITY ; - err =register_oom_notifier (&vb->oom_nb); -if (err <0 ) - goto out_unregister_shrinker; - } -virtio_device_ready (vdev);if (towards_target (vb))virtballoon_changed (vdev);return 0 ; -out_unregister_shrinker: -if (virtio_has_feature (vdev,VIRTIO_BALLOON_F_FREE_PAGE_HINT )) -unregister_shrinker (&vb->shrinker); out_del_balloon_wq:if (virtio_has_feature (vdev,VIRTIO_BALLOON_F_FREE_PAGE_HINT ))destroy_workqueue (vb->balloon_wq);
@@ -967,11 +989,8 @@ static void virtballoon_remove(struct virtio_device *vdev) {struct virtio_balloon *vb = vdev->priv; -if (virtio_has_feature (vdev,VIRTIO_BALLOON_F_DEFLATE_ON_OOM )) -unregister_oom_notifier (&vb->oom_nb); -if (virtio_has_feature (vdev,VIRTIO_BALLOON_F_FREE_PAGE_HINT )) -unregister_shrinker (&vb->shrinker); - +if (virtio_has_feature (vb->vdev,VIRTIO_BALLOON_F_DEFLATE_ON_OOM )) +virtio_balloon_unregister_shrinker (vb);spin_lock_irq (&vb->stop_update_lock); vb->stop_update = true;spin_unlock_irq (&vb->stop_update_lock);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 185/606 s390/kaslr: add support for R_390_JMP_SLOT relocation type
In reply to Sasha LevinFrom: Gerald Schaefer <[email protected]>
commit 4c1cbcbd6c56c79de2c07159be4f55386bb0bef2 upstream.
With certain kernel configurations, the R_390_JMP_SLOT relocation type might be generated, which is not expected by the KASLR relocation code, and the kernel stops with the message "Unknown relocation type".
This was found with a zfcpdump kernel config, where CONFIG_MODULES=n and CONFIG_VFIO=n. In that case, symbol_get() is used on undefined __weak symbols in virt/kvm/vfio.c, which results in the generation of R_390_JMP_SLOT relocation types.
Fix this by handling R_390_JMP_SLOT similar to R_390_GLOB_DAT.
--- arch/s390/kernel/machine_kexec_reloc.c | 1 + 1 file changed, 1 insertion(+)
arch/s390/kernel/machine_kexec_reloc.c +1 -0
@@ -28,6 +28,7 @@ int arch_kexec_do_relocs(int r_type, void *loc, unsigned long val,break ;case R_390_64 :/* Direct 64 bit. */ case R_390_GLOB_DAT : +case R_390_JMP_SLOT : *(u64 *)loc = val;break ;case R_390_PC16 :/* PC relative 16 bit. */
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 189/606 sh: include linux/time_types.h for sockios
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
commit fc94cf2092c7c1267fa2deb8388d624f50eba808 upstream.
Using the socket ioctls on arch/sh (and only there) causes build time problems when __kernel_old_timeval/__kernel_old_timespec are not already visible to the compiler.
Add an explict include line for the header that defines these structures.
--- arch/sh/include/uapi/asm/sockios.h | 2 ++ 1 file changed, 2 insertions(+)
arch/sh/include/uapi/asm/sockios.h +2 -0
@@ -2,6 +2,8 @@#ifndef __ASM_SH_SOCKIOS_H#define __ASM_SH_SOCKIOS_H +#include <linux/time_types.h> +/* Socket-level I/O control calls. */ #define FIOGETOWN _IOR('f', 123, int)#define FIOSETOWN _IOW('f', 124, int)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 190/606 sparc32: use PUD rather than PGD to get PMD in srmmu_nocache_init()
In reply to Sasha LevinFrom: Mike Rapoport <[email protected]>
commit c2bc26f7ca1ff1165bb6669a7a4cccc20ffd2ced upstream.
The kbuild test robot reported the following warning:
arch/sparc/mm/srmmu.c: In function 'srmmu_nocache_init': arch/sparc/mm/srmmu.c:300:9: error: variable 'pud' set but not used [-Werror=unused-but-set-variable] 300 | pud_t *pud;
This warning is caused by misprint in the page table traversal in srmmu_nocache_init() function which accessed a PMD entry using PGD rather than PUD.
Since sparc32 has only 3 page table levels, the PGD and PUD are essentially the same and usage of __nocache_fix() removed the type checking.
Use PUD for the consistency and to silence the compiler warning.
--- arch/sparc/mm/srmmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sparc/mm/srmmu.c +1 -1
@@ -333,7 +333,7 @@ static void __init srmmu_nocache_init(void) pgd =pgd_offset_k (vaddr); p4d =p4d_offset (__nocache_fix (pgd), vaddr); pud =pud_offset (__nocache_fix (p4d), vaddr); - pmd =pmd_offset (__nocache_fix (pgd), vaddr); + pmd =pmd_offset (__nocache_fix (pud), vaddr); pte =pte_offset_kernel (__nocache_fix (pmd), vaddr); pteval = ((paddr >>4 ) |SRMMU_ET_PTE |SRMMU_PRIV );
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 191/606 sparc32: fix page table traversal in srmmu_nocache_init()
In reply to Sasha LevinFrom: Mike Rapoport <[email protected]>
commit 0cfc8a8d70dcd51db783e8e87917e02149c71458 upstream.
The srmmu_nocache_init() uses __nocache_fix() macro to add an offset to page table entry to access srmmu_nocache_pool.
But since sparc32 has only three actual page table levels, pgd, p4d and pud are essentially the same thing and pgd_offset() and p4d_offset() are no-ops, the __nocache_fix() should be done only at PUD level.
Remove __nocache_fix() for p4d_offset() and pud_offset() and keep it only for PUD and lower levels.
--- arch/sparc/mm/srmmu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/sparc/mm/srmmu.c +2 -2
@@ -331,8 +331,8 @@ static void __init srmmu_nocache_init(void)while (vaddr < srmmu_nocache_end) { pgd =pgd_offset_k (vaddr); - p4d =p4d_offset (__nocache_fix (pgd), vaddr); - pud =pud_offset (__nocache_fix (p4d), vaddr); + p4d =p4d_offset (pgd, vaddr); + pud =pud_offset (p4d, vaddr); pmd =pmd_offset (__nocache_fix (pud), vaddr); pte =pte_offset_kernel (__nocache_fix (pmd), vaddr);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 207/606 ax25: fix setsockopt(SO_BINDTODEVICE)
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit 687775cec056b38a4c8f3291e0dd7a9145f7b667 ]
syzbot was able to trigger this trace [1], probably by using a zero optlen.
While we are at it, cap optlen to IFNAMSIZ - 1 instead of IFNAMSIZ.
[1]
BUG: KMSAN: uninit-value in strnlen+0xf9/0x170 lib/string.c:569 CPU: 0 PID: 8807 Comm: syz-executor483 Not tainted 5.7.0-rc4-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x1c9/0x220 lib/dump_stack.c:118 kmsan_report+0xf7/0x1e0 mm/kmsan/kmsan_report.c:121 __msan_warning+0x58/0xa0 mm/kmsan/kmsan_instr.c:215 strnlen+0xf9/0x170 lib/string.c:569 dev_name_hash net/core/dev.c:207 [inline] netdev_name_node_lookup net/core/dev.c:277 [inline] __dev_get_by_name+0x75/0x2b0 net/core/dev.c:778 ax25_setsockopt+0xfa3/0x1170 net/ax25/af_ax25.c:654 __compat_sys_setsockopt+0x4ed/0x910 net/compat.c:403 __do_compat_sys_setsockopt net/compat.c:413 [inline] __se_compat_sys_setsockopt+0xdd/0x100 net/compat.c:410 __ia32_compat_sys_setsockopt+0x62/0x80 net/compat.c:410 do_syscall_32_irqs_on arch/x86/entry/common.c:339 [inline] do_fast_syscall_32+0x3bf/0x6d0 arch/x86/entry/common.c:398 entry_SYSENTER_compat+0x68/0x77 arch/x86/entry/entry_64_compat.S:139 RIP: 0023:0xf7f57dd9 Code: 90 e8 0b 00 00 00 f3 90 0f ae e8 eb f9 8d 74 26 00 89 3c 24 c3 90 90 90 90 90 90 90 90 90 90 90 90 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 eb 0d 90 90 90 90 90 90 90 90 90 90 90 90 RSP: 002b:00000000ffae8c1c EFLAGS: 00000217 ORIG_RAX: 000000000000016e RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000000101 RDX: 0000000000000019 RSI: 0000000020000000 RDI: 0000000000000004 RBP: 0000000000000012 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
Local variable ----devname@ax25_setsockopt created at:
ax25_setsockopt+0xe6/0x1170 net/ax25/af_ax25.c:536 ax25_setsockopt+0xe6/0x1170 net/ax25/af_ax25.c:536
--- net/ax25/af_ax25.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/ax25/af_ax25.c +4 -2
@@ -635,8 +635,10 @@ static int ax25_setsockopt(struct socket *sock, int level, int optname,break ;case SO_BINDTODEVICE : -if (optlen >IFNAMSIZ ) - optlen =IFNAMSIZ ; +if (optlen >IFNAMSIZ -1 ) + optlen =IFNAMSIZ -1 ; + +memset (devname,0 ,sizeof (devname));if (copy_from_user (devname, optval, optlen)) { res = -EFAULT ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 226/606 sctp: Don't add the shutdown timer if its already been added
In reply to Sasha LevinFrom: Neil Horman <[email protected]>
[ Upstream commit 20a785aa52c82246055a089e55df9dac47d67da1 ]
This BUG halt was reported a while back, but the patch somehow got missed:
PID: 2879 TASK: c16adaa0 CPU: 1 COMMAND: "sctpn"
#0 [f418dd28] crash_kexec at c04a7d8c
#1 [f418dd7c] oops_end at c0863e02
#2 [f418dd90] do_invalid_op at c040aaca
#3 [f418de28] error_code (via invalid_op) at c08631a5
EAX: f34baac0 EBX: 00000090 ECX: f418deb0 EDX: f5542950 EBP: 00000000
DS: 007b ESI: f34ba800 ES: 007b EDI: f418dea0 GS: 00e0
CS: 0060 EIP: c046fa5e ERR: ffffffff EFLAGS: 00010286
#4 [f418de5c] add_timer at c046fa5e
#5 [f418de68] sctp_do_sm at f8db8c77 [sctp]
#6 [f418df30] sctp_primitive_SHUTDOWN at f8dcc1b5 [sctp]
#7 [f418df48] inet_shutdown at c080baf9
#8 [f418df5c] sys_shutdown at c079eedf
#9 [f418df70] sys_socketcall at c079fe88
EAX: ffffffda EBX: 0000000d ECX: bfceea90 EDX: 0937af98
DS: 007b ESI: 0000000c ES: 007b EDI: b7150ae4
SS: 007b ESP: bfceea7c EBP: bfceeaa8 GS: 0033
CS: 0073 EIP: b775c424 ERR: 00000066 EFLAGS: 00000282It appears that the side effect that starts the shutdown timer was processed multiple times, which can happen as multiple paths can trigger it. This of course leads to the BUG halt in add_timer getting called.
Fix seems pretty straightforward, just check before the timer is added if its already been started. If it has mod the timer instead to min(current expiration, new expiration)
Its been tested but not confirmed to fix the problem, as the issue has only occured in production environments where test kernels are enjoined from being installed. It appears to be a sane fix to me though. Also, recentely, Jere found a reproducer posted on list to confirm that this resolves the issues
--- net/sctp/sm_sideeffect.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
net/sctp/sm_sideeffect.c +11 -3
@@ -1523,9 +1523,17 @@ static int sctp_cmd_interpreter(enum sctp_event_type event_type, timeout = asoc->timeouts[cmd->obj.to];BUG_ON (!timeout); - timer->expires = jiffies + timeout; -sctp_association_hold (asoc); -add_timer (timer); +/* +* SCTP has a hard time with timer starts. Because we process +* timer starts as side effects, it can be hard to tell if we +* have already started a timer or not, which leads to BUG +* halts when we call add_timer. So here, instead of just starting +* a timer, if the timer is already started, and just mod +* the timer with the shorter of the two expiration times +*/ +if (!timer_pending (timer)) +sctp_association_hold (asoc); +timer_reduce (timer, jiffies + timeout);break ;case SCTP_CMD_TIMER_RESTART :
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 227/606 sctp: Start shutdown on association restart if in SHUTDOWN-SENT state and socket is closed
In reply to Sasha LevinFrom: Jere Leppänen <[email protected]>
[ Upstream commit d3e8e4c11870413789f029a71e72ae6e971fe678 ]
Commit bdf6fa52f01b ("sctp: handle association restarts when the socket is closed.") starts shutdown when an association is restarted, if in SHUTDOWN-PENDING state and the socket is closed. However, the rationale stated in that commit applies also when in SHUTDOWN-SENT state - we don't want to move an association to ESTABLISHED state when the socket has been closed, because that results in an association that is unreachable from user space.
The problem scenario:
1. Client crashes and/or restarts.
2. Server (using one-to-one socket) calls close(). SHUTDOWN is lost.
3. Client reconnects using the same addresses and ports.
4. Server's association is restarted. The association and the socket move to ESTABLISHED state, even though the server process has closed its descriptor.
Also, after step 4 when the server process exits, some resources are leaked in an attempt to release the underlying inet sock structure in ESTABLISHED state:
IPv4: Attempt to release TCP socket in state 1 00000000377288c7
Fix by acting the same way as in SHUTDOWN-PENDING state. That is, if an association is restarted in SHUTDOWN-SENT state and the socket is closed, then start shutdown and don't move the association or the socket to ESTABLISHED state.
--- net/sctp/sm_statefuns.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
net/sctp/sm_statefuns.c +5 -4
@@ -1856,12 +1856,13 @@ static enum sctp_disposition sctp_sf_do_dupcook_a(/* Update the content of current association. */ sctp_add_cmd_sf (commands,SCTP_CMD_UPDATE_ASSOC ,SCTP_ASOC (new_asoc));sctp_add_cmd_sf (commands,SCTP_CMD_EVENT_ULP ,SCTP_ULPEVENT (ev)); -if (sctp_state (asoc,SHUTDOWN_PENDING ) && +if ((sctp_state (asoc,SHUTDOWN_PENDING ) || +sctp_state (asoc,SHUTDOWN_SENT )) && (sctp_sstate (asoc->base.sk,CLOSING ) ||sock_flag (asoc->base.sk,SOCK_DEAD ))) { -/* if were currently in SHUTDOWN_PENDING, but the socket -* has been closed by user, don't transition to ESTABLISHED. -* Instead trigger SHUTDOWN bundled with COOKIE_ACK. +/* If the socket has been closed by user, don't +* transition to ESTABLISHED. Instead trigger SHUTDOWN +* bundled with COOKIE_ACK. */ sctp_add_cmd_sf (commands,SCTP_CMD_REPLY ,SCTP_CHUNK (repl)); return sctp_sf_do_9_2_start_shutdown(net, ep, asoc,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 240/606 Revert "virtio-balloon: Revert "virtio-balloon: Switch back to OOM handler for VIRTIO_BALLOON_F_DEFLATE_ON_OOM""
In reply to Sasha LevinFrom: Greg Kroah-Hartman <[email protected]>
This reverts commit 37681282be8e89ae8baf26753bf489837d74e08e which is commit 835a6a649d0dd1b1f46759eb60fff2f63ed253a7 upstream.
Jiri and David agree that it is not needed in the 5.6.y tree, so revert it.
--- drivers/virtio/virtio_balloon.c | 107 +++++++++++++------------------- 1 file changed, 44 insertions(+), 63 deletions(-)
drivers/virtio/virtio_balloon.c +44 -63
@@ -14,6 +14,7 @@#include <linux/slab.h> #include <linux/module.h> #include <linux/balloon_compaction.h> +#include <linux/oom.h> #include <linux/wait.h> #include <linux/mm.h> #include <linux/mount.h>
@@ -27,7 +28,9 @@*/ #define VIRTIO_BALLOON_PAGES_PER_PAGE (unsigned)(PAGE_SIZE >> VIRTIO_BALLOON_PFN_SHIFT)#define VIRTIO_BALLOON_ARRAY_PFNS_MAX 256 -#define VIRTBALLOON_OOM_NOTIFY_PRIORITY 80 +/* Maximum number of (4k) pages to deflate on OOM notifications. */ +#define VIRTIO_BALLOON_OOM_NR_PAGES 256 +#define VIRTIO_BALLOON_OOM_NOTIFY_PRIORITY 80#define VIRTIO_BALLOON_FREE_PAGE_ALLOC_FLAG (__GFP_NORETRY | __GFP_NOWARN | \ __GFP_NOMEMALLOC)
@@ -112,8 +115,11 @@ struct virtio_balloon {/* Memory statistics */ struct virtio_balloon_stat stats[VIRTIO_BALLOON_S_NR ]; -/* To register a shrinker to shrink memory upon memory pressure */ +/* Shrinker to return free pages - VIRTIO_BALLOON_F_FREE_PAGE_HINT */ struct shrinker shrinker; + +/* OOM notifier to deflate on OOM - VIRTIO_BALLOON_F_DEFLATE_ON_OOM */ +struct notifier_block oom_nb; };static struct virtio_device_id id_table[] = {
@@ -788,50 +794,13 @@ static unsigned long shrink_free_pages(struct virtio_balloon *vb,return blocks_freed *VIRTIO_BALLOON_HINT_BLOCK_PAGES ; } -static unsigned long leak_balloon_pages (struct virtio_balloon *vb, -unsigned long pages_to_free) -{ -return leak_balloon (vb, pages_to_free *VIRTIO_BALLOON_PAGES_PER_PAGE ) / -VIRTIO_BALLOON_PAGES_PER_PAGE ; -} - -static unsigned long shrink_balloon_pages (struct virtio_balloon *vb, -unsigned long pages_to_free) -{ -unsigned long pages_freed =0 ; - -/* -* One invocation of leak_balloon can deflate at most -* VIRTIO_BALLOON_ARRAY_PFNS_MAX balloon pages, so we call it -* multiple times to deflate pages till reaching pages_to_free. -*/ -while (vb->num_pages && pages_freed < pages_to_free) - pages_freed +=leak_balloon_pages (vb, - pages_to_free - pages_freed); - -update_balloon_size (vb); - -return pages_freed; -} -static unsigned long virtio_balloon_shrinker_scan (struct shrinker *shrinker,struct shrink_control *sc) { -unsigned long pages_to_free, pages_freed =0 ;struct virtio_balloon *vb =container_of (shrinker, struct virtio_balloon, shrinker); - pages_to_free = sc->nr_to_scan; - -if (virtio_has_feature (vb->vdev,VIRTIO_BALLOON_F_FREE_PAGE_HINT )) - pages_freed =shrink_free_pages (vb, pages_to_free); - -if (pages_freed >= pages_to_free) -return pages_freed; - - pages_freed +=shrink_balloon_pages (vb, pages_to_free - pages_freed); - -return pages_freed; +return shrink_free_pages (vb, sc->nr_to_scan); } static unsigned long virtio_balloon_shrinker_count(struct shrinker *shrinker,
@@ -839,26 +808,22 @@ static unsigned long virtio_balloon_shrinker_count(struct shrinker *shrinker, {struct virtio_balloon *vb =container_of (shrinker, struct virtio_balloon, shrinker); -unsigned long count; - - count = vb->num_pages /VIRTIO_BALLOON_PAGES_PER_PAGE ; - count += vb->num_free_page_blocks *VIRTIO_BALLOON_HINT_BLOCK_PAGES ; -return count; +return vb->num_free_page_blocks *VIRTIO_BALLOON_HINT_BLOCK_PAGES ; } -static void virtio_balloon_unregister_shrinker (struct virtio_balloon *vb) +static int virtio_balloon_oom_notify (struct notifier_block *nb, +unsigned long dummy,void *parm) { -unregister_shrinker (&vb->shrinker); -} +struct virtio_balloon *vb =container_of (nb, + struct virtio_balloon, oom_nb); +unsigned long *freed = parm; -static int virtio_balloon_register_shrinker (struct virtio_balloon *vb) -{ - vb->shrinker.scan_objects = virtio_balloon_shrinker_scan; - vb->shrinker.count_objects = virtio_balloon_shrinker_count; - vb->shrinker.seeks =DEFAULT_SEEKS ; + *freed +=leak_balloon (vb,VIRTIO_BALLOON_OOM_NR_PAGES ) / +VIRTIO_BALLOON_PAGES_PER_PAGE ; +update_balloon_size (vb); -return register_shrinker (&vb->shrinker); +return NOTIFY_OK ; }static int virtballoon_probe (struct virtio_device *vdev)
@@ -935,22 +900,35 @@ static int virtballoon_probe(struct virtio_device *vdev) virtio_cwrite(vb->vdev, struct virtio_balloon_config, poison_val, &poison_val); } - } -/* -* We continue to use VIRTIO_BALLOON_F_DEFLATE_ON_OOM to decide if a -* shrinker needs to be registered to relieve memory pressure. -*/ -if (virtio_has_feature (vb->vdev,VIRTIO_BALLOON_F_DEFLATE_ON_OOM )) { - err =virtio_balloon_register_shrinker (vb); + +/* +* We're allowed to reuse any free pages, even if they are +* still to be processed by the host. +*/ + vb->shrinker.scan_objects = virtio_balloon_shrinker_scan; + vb->shrinker.count_objects = virtio_balloon_shrinker_count; + vb->shrinker.seeks =DEFAULT_SEEKS ; + err =register_shrinker (&vb->shrinker);if (err) goto out_del_balloon_wq; } +if (virtio_has_feature (vdev,VIRTIO_BALLOON_F_DEFLATE_ON_OOM )) { + vb->oom_nb.notifier_call = virtio_balloon_oom_notify; + vb->oom_nb.priority =VIRTIO_BALLOON_OOM_NOTIFY_PRIORITY ; + err =register_oom_notifier (&vb->oom_nb); +if (err <0 ) + goto out_unregister_shrinker; + } +virtio_device_ready (vdev);if (towards_target (vb))virtballoon_changed (vdev);return 0 ; +out_unregister_shrinker: +if (virtio_has_feature (vdev,VIRTIO_BALLOON_F_FREE_PAGE_HINT )) +unregister_shrinker (&vb->shrinker); out_del_balloon_wq:if (virtio_has_feature (vdev,VIRTIO_BALLOON_F_FREE_PAGE_HINT ))destroy_workqueue (vb->balloon_wq);
@@ -989,8 +967,11 @@ static void virtballoon_remove(struct virtio_device *vdev) {struct virtio_balloon *vb = vdev->priv; -if (virtio_has_feature (vb->vdev,VIRTIO_BALLOON_F_DEFLATE_ON_OOM )) -virtio_balloon_unregister_shrinker (vb); +if (virtio_has_feature (vdev,VIRTIO_BALLOON_F_DEFLATE_ON_OOM )) +unregister_oom_notifier (&vb->oom_nb); +if (virtio_has_feature (vdev,VIRTIO_BALLOON_F_FREE_PAGE_HINT )) +unregister_shrinker (&vb->shrinker); +spin_lock_irq (&vb->stop_update_lock); vb->stop_update = true;spin_unlock_irq (&vb->stop_update_lock);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 251/606 ARM: dts: rockchip: fix phy nodename for rk3228-evb
In reply to Sasha LevinFrom: Johan Jonker <[email protected]>
[ Upstream commit 287e0d538fcec2f6e8eb1e565bf0749f3b90186d ]
A test with the command below gives for example this error:
arch/arm/boot/dts/rk3228-evb.dt.yaml: phy@0:
'#phy-cells' is a required property
The phy nodename is normally used by a phy-handle. This node is however compatible with "ethernet-phy-id1234.d400", "ethernet-phy-ieee802.3-c22" which is just been added to 'ethernet-phy.yaml'. So change nodename to 'ethernet-phy' for which '#phy-cells' is not a required property
make ARCH=arm dtbs_check DT_SCHEMA_FILES=~/.local/lib/python3.5/site-packages/dtschema/schemas/ phy/phy-provider.yaml
--- arch/arm/boot/dts/rk3228-evb.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/rk3228-evb.dts +1 -1
@@ -46,7 +46,7 @@ mdio { #address-cells = <1>; #size-cells = <0>; - phy: phy@0 { + phy: ethernet-phy@0 { compatible = "ethernet-phy-id1234.d400", "ethernet-phy-ieee802.3-c22"; reg = <0>; clocks = <&cru SCLK_MAC_PHY>;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 252/606 ARM: dts: rockchip: fix phy nodename for rk3229-xms6
In reply to Sasha LevinFrom: Johan Jonker <[email protected]>
[ Upstream commit 621c8d0c233e260232278a4cfd3380caa3c1da29 ]
A test with the command below gives for example this error:
arch/arm/boot/dts/rk3229-xms6.dt.yaml: phy@0:
'#phy-cells' is a required property
The phy nodename is normally used by a phy-handle. This node is however compatible with "ethernet-phy-id1234.d400", "ethernet-phy-ieee802.3-c22" which is just been added to 'ethernet-phy.yaml'. So change nodename to 'ethernet-phy' for which '#phy-cells' is not a required property
make ARCH=arm dtbs_check DT_SCHEMA_FILES=~/.local/lib/python3.5/site-packages/dtschema/schemas/ phy/phy-provider.yaml
--- arch/arm/boot/dts/rk3229-xms6.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/rk3229-xms6.dts +1 -1
@@ -150,7 +150,7 @@ mdio { #address-cells = <1>; #size-cells = <0>; - phy: phy@0 { + phy: ethernet-phy@0 { compatible = "ethernet-phy-id1234.d400", "ethernet-phy-ieee802.3-c22"; reg = <0>;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 253/606 arm64: dts: rockchip: fix status for &gmac2phy in rk3328-evb.dts
In reply to Sasha LevinFrom: Johan Jonker <[email protected]>
[ Upstream commit c617ed88502d0b05149e7f32f3b3fd8a0663f7e2 ]
The status was removed of the '&gmac2phy' node with the apply of a patch long time ago, so fix status for '&gmac2phy' in 'rk3328-evb.dts'.
--- arch/arm64/boot/dts/rockchip/rk3328-evb.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk3328-evb.dts +1 -1
@@ -86,7 +86,7 @@ &gmac2phy { assigned-clock-rate = <50000000>; assigned-clocks = <&cru SCLK_MAC2PHY>; assigned-clock-parents = <&cru SCLK_MAC2PHY_SRC>; - + status = "okay"; }; &i2c1 {
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 254/606 arm64: dts: rockchip: swap interrupts interrupt-names rk3399 gpu node
In reply to Sasha LevinFrom: Johan Jonker <[email protected]>
[ Upstream commit c604fd810bda667bdc20b2c041917baa7803e0fb ]
Dts files with Rockchip rk3399 'gpu' nodes were manually verified. In order to automate this process arm,mali-midgard.txt has been converted to yaml. In the new setup dtbs_check with arm,mali-midgard.yaml expects interrupts and interrupt-names values in the same order. Fix this for rk3399.
make ARCH=arm64 dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/gpu/ arm,mali-midgard.yaml
--- arch/arm64/boot/dts/rockchip/rk3399.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/rockchip/rk3399.dtsi +4 -4
@@ -1890,10 +1890,10 @@ edp_in_vopl: endpoint@1 { gpu: gpu@ff9a0000 { compatible = "rockchip,rk3399-mali", "arm,mali-t860"; reg = <0x0 0xff9a0000 0x0 0x10000>; - interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH 0>, - <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH 0>, - <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH 0>; - interrupt-names = "gpu", "job", "mmu"; + interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH 0>, + <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH 0>, + <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH 0>; + interrupt-names = "job", "mmu", "gpu"; clocks = <&cru ACLK_GPU>; #cooling-cells = <2>; power-domains = <&power RK3399_PD_GPU>;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 255/606 ARM: dts: rockchip: swap clock-names of gpu nodes
In reply to Sasha LevinFrom: Johan Jonker <[email protected]>
[ Upstream commit b14f3898d2c25a9b47a61fb879d0b1f3af92c59b ]
Dts files with Rockchip 'gpu' nodes were manually verified. In order to automate this process arm,mali-utgard.txt has been converted to yaml. In the new setup dtbs_check with arm,mali-utgard.yaml expects clock-names values
in the same order, so fix that.
--- arch/arm/boot/dts/rk3036.dtsi | 2 +- arch/arm/boot/dts/rk322x.dtsi | 2 +- arch/arm/boot/dts/rk3xxx.dtsi | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/rk3036.dtsi +1 -1
@@ -128,7 +128,7 @@ gpu: gpu@10090000 { assigned-clocks = <&cru SCLK_GPU>; assigned-clock-rates = <100000000>; clocks = <&cru SCLK_GPU>, <&cru SCLK_GPU>; - clock-names = "core", "bus"; + clock-names = "bus", "core"; resets = <&cru SRST_GPU>; status = "disabled"; };
arch/arm/boot/dts/rk322x.dtsi +1 -1
@@ -561,7 +561,7 @@ gpu: gpu@20000000 { "pp1", "ppmmu1"; clocks = <&cru ACLK_GPU>, <&cru ACLK_GPU>; - clock-names = "core", "bus"; + clock-names = "bus", "core"; resets = <&cru SRST_GPU_A>; status = "disabled"; };
arch/arm/boot/dts/rk3xxx.dtsi +1 -1
@@ -84,7 +84,7 @@ gpu: gpu@10090000 { compatible = "arm,mali-400"; reg = <0x10090000 0x10000>; clocks = <&cru ACLK_GPU>, <&cru ACLK_GPU>; - clock-names = "core", "bus"; + clock-names = "bus", "core"; assigned-clocks = <&cru ACLK_GPU>; assigned-clock-rates = <100000000>; resets = <&cru SRST_GPU>;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 256/606 ARM: dts: rockchip: fix pinctrl sub nodename for spi in rk322x.dtsi
In reply to Sasha LevinFrom: Johan Jonker <[email protected]>
[ Upstream commit 855bdca1781c79eb661f89c8944c4a719ce720e8 ]
A test with the command below gives these errors:
arch/arm/boot/dts/rk3229-evb.dt.yaml: spi-0:
'#address-cells' is a required property arch/arm/boot/dts/rk3229-evb.dt.yaml: spi-1:
'#address-cells' is a required property arch/arm/boot/dts/rk3229-xms6.dt.yaml: spi-0:
'#address-cells' is a required property arch/arm/boot/dts/rk3229-xms6.dt.yaml: spi-1:
'#address-cells' is a required property
The $nodename pattern for spi nodes is "^spi(@.*|-[0-9a-f])*$". To prevent warnings rename 'spi-0' and 'spi-1' pinctrl sub nodenames to 'spi0' and 'spi1' in 'rk322x.dtsi'.
make ARCH=arm dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/spi/spi-controller.yaml
--- arch/arm/boot/dts/rk322x.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/rk322x.dtsi +2 -2
@@ -1033,7 +1033,7 @@ i2c3_xfer: i2c3-xfer { }; }; - spi-0 { + spi0 { spi0_clk: spi0-clk { rockchip,pins = <0 RK_PB1 2 &pcfg_pull_up>; };
@@ -1051,7 +1051,7 @@ spi0_cs1: spi0-cs1 { }; }; - spi-1 { + spi1 { spi1_clk: spi1-clk { rockchip,pins = <0 RK_PC7 2 &pcfg_pull_up>; };
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 257/606 gpio: tegra: mask GPIO IRQs during IRQ shutdown
In reply to Sasha LevinFrom: Stephen Warren <[email protected]>
[ Upstream commit 0cf253eed5d2bdf7bb3152457b38f39b012955f7 ]
The driver currently leaves GPIO IRQs unmasked even when the GPIO IRQ client has released the GPIO IRQ. This allows the HW to raise IRQs, and SW to process them, after shutdown. Fix this by masking the IRQ when it's shut down. This is usually taken care of by the irqchip core, but since this driver has a custom irq_shutdown implementation, it must do this explicitly itself.
--- drivers/gpio/gpio-tegra.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpio/gpio-tegra.c +1 -0
@@ -368,6 +368,7 @@ static void tegra_gpio_irq_shutdown(struct irq_data *d)struct tegra_gpio_info *tgi = bank->tgi;unsigned int gpio = d->hwirq; +tegra_gpio_irq_mask (d);gpiochip_unlock_as_irq (&tgi->gc, gpio); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 263/606 gfs2: move privileged user check to gfs2_quota_lock_check
In reply to Sasha LevinFrom: Bob Peterson <[email protected]>
[ Upstream commit 4ed0c30811cb4d30ef89850b787a53a84d5d2bcb ]
Before this patch, function gfs2_quota_lock checked if it was called from a privileged user, and if so, it bypassed the quota check:
superuser can operate outside the quotas.
That's the wrong place for the check because the lock/unlock functions are separate from the lock_check function, and you can do lock and unlock without actually checking the quotas.
This patch moves the check to gfs2_quota_lock_check.
--- fs/gfs2/quota.c | 3 +-- fs/gfs2/quota.h | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-)
fs/gfs2/quota.c +1 -2
@@ -1040,8 +1040,7 @@ int gfs2_quota_lock(struct gfs2_inode *ip, kuid_t uid, kgid_t gid)u32 x;int error =0 ; -if (capable (CAP_SYS_RESOURCE ) || - sdp->sd_args.ar_quota !=GFS2_QUOTA_ON ) +if (sdp->sd_args.ar_quota !=GFS2_QUOTA_ON )return 0 ; error =gfs2_quota_hold (ip, uid, gid);
fs/gfs2/quota.h +2 -1
@@ -44,7 +44,8 @@ static inline int gfs2_quota_lock_check(struct gfs2_inode *ip,int ret; ap->allowed =UINT_MAX ;/* Assume we are permitted a whole lot */ -if (sdp->sd_args.ar_quota ==GFS2_QUOTA_OFF ) +if (capable (CAP_SYS_RESOURCE ) || + sdp->sd_args.ar_quota ==GFS2_QUOTA_OFF )return 0 ; ret =gfs2_quota_lock (ip,NO_UID_QUOTA_CHANGE ,NO_GID_QUOTA_CHANGE );if (ret)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 264/606 gfs2: Grab glock reference sooner in gfs2_add_revoke
In reply to Sasha LevinFrom: Andreas Gruenbacher <[email protected]>
[ Upstream commit f4e2f5e1a527ce58fc9f85145b03704779a3123e ]
This patch rearranges gfs2_add_revoke so that the extra glock reference is added earlier on in the function to avoid races in which the glock is freed before the new reference is taken.
--- fs/gfs2/log.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/gfs2/log.c +3 -3
@@ -603,13 +603,13 @@ void gfs2_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd)struct buffer_head *bh = bd->bd_bh;struct gfs2_glock *gl = bd->bd_gl; + sdp->sd_log_num_revoke++; +if (atomic_inc_return (&gl->gl_revokes) ==1 ) +gfs2_glock_hold (gl); bh->b_private =NULL ; bd->bd_blkno = bh->b_blocknr;gfs2_remove_from_ail (bd);/* drops ref on bh */ bd->bd_bh =NULL ; - sdp->sd_log_num_revoke++; -if (atomic_inc_return (&gl->gl_revokes) ==1 ) -gfs2_glock_hold (gl);set_bit (GLF_LFLUSH , &gl->gl_flags);list_add (&bd->bd_list, &sdp->sd_log_revokes); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 293/606 gpio: mvebu: Fix probing for chips without PWM
In reply to Sasha LevinFrom: Sascha Hauer <[email protected]>
[ Upstream commit 19c26d90ff4ca08ef2a2fef23cc9c13cfbfd891e ]
The PWM iomem resource is optional and its presence indicates whether the GPIO chip has a PWM or not, which is why mvebu_pwm_probe() returned successfully when the PWM resource was not present. With f51b18d92b66 the driver switched to devm_platform_ioremap_resource_byname() and its error return is propagated to the caller, so now a missing PWM resource leads to a probe error in the driver.
To fix this explicitly test for the presence of the PWM resource and return successfully when it's not there. Do this check before the check for the clock is done (which GPIO chips without a PWM do not have). Also move the existing comment why the PWM resource is optional up to the actual check.
--- drivers/gpio/gpio-mvebu.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/gpio/gpio-mvebu.c +9 -6
@@ -782,6 +782,15 @@ static int mvebu_pwm_probe(struct platform_device *pdev, "marvell,armada-370-gpio"))return 0 ; +/* +* There are only two sets of PWM configuration registers for +* all the GPIO lines on those SoCs which this driver reserves +* for the first two GPIO chips. So if the resource is missing +* we can't treat it as an error. +*/ +if (!platform_get_resource_byname (pdev,IORESOURCE_MEM ,"pwm" )) +return 0 ; +if (IS_ERR (mvchip->clk))return PTR_ERR (mvchip->clk);
@@ -804,12 +813,6 @@ static int mvebu_pwm_probe(struct platform_device *pdev, mvchip->mvpwm = mvpwm; mvpwm->mvchip = mvchip; -/* -* There are only two sets of PWM configuration registers for -* all the GPIO lines on those SoCs which this driver reserves -* for the first two GPIO chips. So if the resource is missing -* we can't treat it as an error. -*/ mvpwm->membase =devm_platform_ioremap_resource_byname (pdev,"pwm" );if (IS_ERR (mvpwm->membase))return PTR_ERR (mvpwm->membase);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 325/606 libceph: ignore pool overlay and cache logic on redirects
In reply to Sasha LevinFrom: Jerry Lee <[email protected]>
[ Upstream commit 890bd0f8997ae6ac0a367dd5146154a3963306dd ]
OSD client should ignore cache/overlay flag if got redirect reply. Otherwise, the client hangs when the cache tier is in forward mode.
[ idryomov: Redirects are effectively deprecated and no longer
used or tested. The original tiering modes based on redirects are inherently flawed because redirects can race and reorder, potentially resulting in data corruption. The new proxy and readproxy tiering modes should be used instead of forward and readforward. Still marking for stable as obviously correct, though. ]
Cc: [email protected]
URL: https://tracker.ceph.com/issues/23296
URL: https://tracker.ceph.com/issues/36406
--- net/ceph/osd_client.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/ceph/osd_client.c +3 -1
@@ -3652,7 +3652,9 @@ static void handle_reply(struct ceph_osd *osd, struct ceph_msg *msg)* supported. */ req->r_t.target_oloc.pool = m.redirect.oloc.pool; - req->r_flags |=CEPH_OSD_FLAG_REDIRECTED ; + req->r_flags |=CEPH_OSD_FLAG_REDIRECTED | +CEPH_OSD_FLAG_IGNORE_OVERLAY | +CEPH_OSD_FLAG_IGNORE_CACHE ; req->r_tid =0 ;__submit_request (req, false); goto out_unlock_osdc;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 2/606 s390/ism: fix error return code in ism_probe()
In reply to Sasha LevinFrom: Wei Yongjun <[email protected]>
[ Upstream commit 29b74cb75e3572d83708745e81e24d37837415f9 ]
Fix to return negative error code -ENOMEM from the smcd_alloc_dev() error handling case instead of 0, as done elsewhere in this function.
--- drivers/s390/net/ism_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/s390/net/ism_drv.c +3 -1
@@ -521,8 +521,10 @@ static int ism_probe(struct pci_dev *pdev, const struct pci_device_id *id) ism->smcd =smcd_alloc_dev (&pdev->dev,dev_name (&pdev->dev), &ism_ops,ISM_NR_DMBS ); -if (!ism->smcd) +if (!ism->smcd) { + ret = -ENOMEM ; goto err_resource; + } ism->smcd->priv = ism; ret =ism_dev_init (ism);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 3/606 drm/i915: Handle idling during i915_gem_evict_something busy loops
In reply to Sasha LevinFrom: Chris Wilson <[email protected]>
[ Upstream commit 955da9d77435acac066139e9d7f7723ce7204a1d ]
i915_gem_evict_something() is charged with finding a slot within the GTT that we may reuse. Since our goal is not to stall, we first look for a slot that only overlaps idle vma. To this end, on the first pass we move any active vma to the end of the search list. However, we only stopped moving active vma after we see the first active vma twice. If during the search, that first active vma completed, we would not notice and keep on extending the search list.
--- drivers/gpu/drm/i915/i915_gem_evict.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/i915_gem_evict.c +12 -14
@@ -130,6 +130,13 @@ i915_gem_evict_something(struct i915_address_space *vm, active =NULL ;INIT_LIST_HEAD (&eviction_list);list_for_each_entry_safe (vma, next, &vm->bound_list, vm_link) { +if (vma == active) {/* now seen this vma twice */ +if (flags &PIN_NONBLOCK ) +break ; + + active =ERR_PTR (-EAGAIN ); + } +/* * We keep this list in a rough least-recently scanned order * of active elements (inactive elements are cheap to reap).
@@ -145,21 +152,12 @@ i915_gem_evict_something(struct i915_address_space *vm,* To notice when we complete one full cycle, we record the * first active element seen, before moving it to the tail. */ -if (i915_vma_is_active (vma)) { -if (vma == active) { -if (flags &PIN_NONBLOCK ) -break ; - - active =ERR_PTR (-EAGAIN ); - } - -if (active !=ERR_PTR (-EAGAIN )) { -if (!active) - active = vma; +if (active !=ERR_PTR (-EAGAIN ) &&i915_vma_is_active (vma)) { +if (!active) + active = vma; -list_move_tail (&vma->vm_link, &vm->bound_list); -continue ; - } +list_move_tail (&vma->vm_link, &vm->bound_list); +continue ; }if (mark_free (&scan, vma, flags, &eviction_list))
Signature · 6 lines
2.25.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Sasha Levin
maintainerPATCH 10/606 Stop the ad-hoc games with -Wno-maybe-initialized
In reply to Sasha LevinFrom: Linus Torvalds <[email protected]>
commit 78a5255ffb6a1af189a83e493d916ba1c54d8c75 upstream.
We have some rather random rules about when we accept the "maybe-initialized" warnings, and when we don't.
For example, we consider it unreliable for gcc versions < 4.9, but also if -O3 is enabled, or if optimizing for size. And then various kernel config options disabled it, because they know that they trigger that warning by confusing gcc sufficiently (ie PROFILE_ALL_BRANCHES).
And now gcc-10 seems to be introducing a lot of those warnings too, so it falls under the same heading as 4.9 did.
At the same time, we have a very straightforward way to _enable_ that warning when wanted: use "W=2" to enable more warnings.
So stop playing these ad-hoc games, and just disable that warning by default, with the known and straight-forward "if you want to work on the extra compiler warnings, use W=123".
Would it be great to have code that is always so obvious that it never confuses the compiler whether a variable is used initialized or not? Yes, it would. In a perfect world, the compilers would be smarter, and our source code would be simpler.
That's currently not the world we live in, though.
--- Makefile | 7 +++---- init/Kconfig | 18 ------------------ kernel/trace/Kconfig | 1 - 3 files changed, 3 insertions(+), 23 deletions(-)
Makefile +3 -4
@@ -708,10 +708,6 @@ else ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE KBUILD_CFLAGS += -Os endif -ifdef CONFIG_CC_DISABLE_WARN_MAYBE_UNINITIALIZED -KBUILD_CFLAGS += -Wno-maybe-uninitialized -endif - # Tell gcc to never replace conditional load with a non-conditional one KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0)
@@ -861,6 +857,9 @@ KBUILD_CFLAGS += -Wno-pointer-sign # disable stringop warnings in gcc 8+ KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation) +# Enabled with W=2, disabled by default as noisy +KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized) + # disable invalid "can't wrap" optimizations for signed / pointers KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow)
init/Kconfig +0 -18
@@ -36,22 +36,6 @@ config TOOLS_SUPPORT_RELR config CC_HAS_ASM_INLINE def_bool $(success,echo 'void foo(void) { asm inline (""); }' | $(CC) -x c - -c -o /dev/null) -config CC_HAS_WARN_MAYBE_UNINITIALIZED - def_bool $(cc-option,-Wmaybe-uninitialized) - help - GCC >= 4.7 supports this option. - -config CC_DISABLE_WARN_MAYBE_UNINITIALIZED - bool - depends on CC_HAS_WARN_MAYBE_UNINITIALIZED - default CC_IS_GCC && GCC_VERSION < 40900 # unreliable for GCC < 4.9 - help - GCC's -Wmaybe-uninitialized is not reliable by definition. - Lots of false positive warnings are produced in some cases. - - If this option is enabled, -Wno-maybe-uninitialzed is passed - to the compiler to suppress maybe-uninitialized warnings. - config CONSTRUCTORS bool depends on !UML
@@ -1249,14 +1233,12 @@ config CC_OPTIMIZE_FOR_PERFORMANCE config CC_OPTIMIZE_FOR_PERFORMANCE_O3 bool "Optimize more for performance (-O3)" depends on ARC - imply CC_DISABLE_WARN_MAYBE_UNINITIALIZED # avoid false positives help Choosing this option will pass "-O3" to your compiler to optimize the kernel yet more for performance. config CC_OPTIMIZE_FOR_SIZE bool "Optimize for size (-Os)" - imply CC_DISABLE_WARN_MAYBE_UNINITIALIZED # avoid false positives help Choosing this option will pass "-Os" to your compiler resulting in a smaller kernel.
kernel/trace/Kconfig +0 -1
@@ -466,7 +466,6 @@ config PROFILE_ANNOTATED_BRANCHES config PROFILE_ALL_BRANCHES bool "Profile all if conditionals" if !FORTIFY_SOURCE select TRACE_BRANCH_PROFILING - imply CC_DISABLE_WARN_MAYBE_UNINITIALIZED # avoid false positives help This tracer profiles all branch conditions. Every if () taken in the kernel is recorded whether it hit or miss.
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 11/606 gcc-10: disable 'zero-length-bounds' warning for now
In reply to Sasha LevinFrom: Linus Torvalds <[email protected]>
commit 5c45de21a2223fe46cf9488c99a7fbcf01527670 upstream.
This is a fine warning, but we still have a number of zero-length arrays in the kernel that come from the traditional gcc extension. Yes, they are getting converted to flexible arrays, but in the meantime the gcc-10 warning about zero-length bounds is very verbose, and is hiding other issues.
I missed one actual build failure because it was hidden among hundreds of lines of warning. Thankfully I caught it on the second go before pushing things out, but it convinced me that I really need to disable the new warnings for now.
We'll hopefully be all done with our conversion to flexible arrays in the not too distant future, and we can then re-enable this warning.
--- Makefile | 3 +++ 1 file changed, 3 insertions(+)
Makefile +3 -0
@@ -857,6 +857,9 @@ KBUILD_CFLAGS += -Wno-pointer-sign # disable stringop warnings in gcc 8+ KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation) +# We'll want to enable this eventually, but it's not going away for 5.7 at least +KBUILD_CFLAGS += $(call cc-disable-warning, zero-length-bounds) + # Enabled with W=2, disabled by default as noisy KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 12/606 gcc-10: disable 'array-bounds' warning for now
In reply to Sasha LevinFrom: Linus Torvalds <[email protected]>
commit 44720996e2d79e47d508b0abe99b931a726a3197 upstream.
This is another fine warning, related to the 'zero-length-bounds' one, but hitting the same historical code in the kernel.
Because C didn't historically support flexible array members, we have code that instead uses a one-sized array, the same way we have cases of zero-sized arrays.
The one-sized arrays come from either not wanting to use the gcc zero-sized array extension, or from a slight convenience-feature, where particularly for strings, the size of the structure now includes the allocation for the final NUL character.
So with a "char name[1];" at the end of a structure, you can do things like
v = my_malloc(sizeof(struct vendor) + strlen(name));
and avoid the "+1" for the terminator.
Yes, the modern way to do that is with a flexible array, and using 'offsetof()' instead of 'sizeof()', and adding the "+1" by hand. That also technically gets the size "more correct" in that it avoids any alignment (and thus padding) issues, but this is another long-term cleanup thing that will not happen for 5.7.
So disable the warning for now, even though it's potentially quite useful. Having a slew of warnings that then hide more urgent new issues is not an improvement.
--- Makefile | 1 + 1 file changed, 1 insertion(+)
Makefile +1 -0
@@ -859,6 +859,7 @@ KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation) # We'll want to enable this eventually, but it's not going away for 5.7 at least KBUILD_CFLAGS += $(call cc-disable-warning, zero-length-bounds) +KBUILD_CFLAGS += $(call cc-disable-warning, array-bounds) # Enabled with W=2, disabled by default as noisy KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 6/606 bpf: Fix bug in mmap() implementation for BPF array map
In reply to Sasha Levin[ Upstream commit 333291ce5055f2039afc907badaf5b66bc1adfdc ]
mmap() subsystem allows user-space application to memory-map region with initial page offset. This wasn't taken into account in initial implementation of BPF array memory-mapping. This would result in wrong pages, not taking into account requested page shift, being memory-mmaped into user-space. This patch fixes this gap and adds a test for such scenario.
--- kernel/bpf/arraymap.c | 7 ++++++- tools/testing/selftests/bpf/prog_tests/mmap.c | 9 +++++++++ 2 files changed, 15 insertions(+), 1 deletion(-)
kernel/bpf/arraymap.c +6 -1
@@ -486,7 +486,12 @@ static int array_map_mmap(struct bpf_map *map, struct vm_area_struct *vma)if (!(map->map_flags &BPF_F_MMAPABLE ))return -EINVAL ; -return remap_vmalloc_range (vma,array_map_vmalloc_addr (array), pgoff); +if (vma->vm_pgoff *PAGE_SIZE + (vma->vm_end - vma->vm_start) > +PAGE_ALIGN ((u64 )array->map.max_entries * array->elem_size)) +return -EINVAL ; + +return remap_vmalloc_range (vma,array_map_vmalloc_addr (array), + vma->vm_pgoff + pgoff); }const struct bpf_map_ops array_map_ops = {
tools/testing/selftests/bpf/prog_tests/mmap.c +9 -0
@@ -197,6 +197,15 @@ void test_mmap(void)CHECK_FAIL (map_data->val[far] !=3 *321 );munmap (tmp2,4 * page_size); + +/* map all 4 pages, but with pg_off=1 page, should fail */ + tmp1 =mmap (NULL ,4 * page_size,PROT_READ ,MAP_SHARED |MAP_FIXED , + data_map_fd, page_size/* initial page shift */ ); +if (CHECK (tmp1 !=MAP_FAILED ,"adv_mmap7" ,"unexpected success" )) { +munmap (tmp1,4 * page_size); + goto cleanup; + } + cleanup:if (bss_mmaped)CHECK_FAIL (munmap (bss_mmaped, bss_sz));
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 13/606 gcc-10: disable 'stringop-overflow' warning for now
In reply to Sasha LevinFrom: Linus Torvalds <[email protected]>
commit 5a76021c2eff7fcf2f0918a08fd8a37ce7922921 upstream.
This is the final array bounds warning removal for gcc-10 for now.
Again, the warning is good, and we should re-enable all these warnings when we have converted all the legacy array declaration cases to flexible arrays. But in the meantime, it's just noise.
--- Makefile | 1 + 1 file changed, 1 insertion(+)
Makefile +1 -0
@@ -860,6 +860,7 @@ KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation) # We'll want to enable this eventually, but it's not going away for 5.7 at least KBUILD_CFLAGS += $(call cc-disable-warning, zero-length-bounds) KBUILD_CFLAGS += $(call cc-disable-warning, array-bounds) +KBUILD_CFLAGS += $(call cc-disable-warning, stringop-overflow) # Enabled with W=2, disabled by default as noisy KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 9/606 net/rds: Use ERR_PTR for rds_message_alloc_sgs()
In reply to Sasha LevinFrom: Jason Gunthorpe <[email protected]>
commit 7dba92037baf3fa00b4880a31fd532542264994c upstream.
Returning the error code via a 'int *ret' when the function returns a pointer is very un-kernely and causes gcc 10's static analysis to choke:
net/rds/message.c: In function ‘rds_message_map_pages’:net/rds/message.c:358:10: warning: ‘ret’ may be used uninitialized in this function [-Wmaybe-uninitialized]
358 | return ERR_PTR(ret);
Use a typical ERR_PTR return instead.
--- net/rds/message.c | 19 ++++++------------- net/rds/rdma.c | 12 ++++++++---- net/rds/rds.h | 3 +-- net/rds/send.c | 6 ++++-- 4 files changed, 19 insertions(+), 21 deletions(-)
net/rds/message.c +6 -13
@@ -308,26 +308,20 @@ struct rds_message *rds_message_alloc(unsigned int extra_len, gfp_t gfp)/* * RDS ops use this to grab SG entries from the rm's sg pool. */ -struct scatterlist *rds_message_alloc_sgs (struct rds_message *rm,int nents, -int *ret) +struct scatterlist *rds_message_alloc_sgs (struct rds_message *rm,int nents) {struct scatterlist *sg_first = (struct scatterlist *) &rm[1 ];struct scatterlist *sg_ret; -if (WARN_ON (!ret)) -return NULL ; -if (nents <=0 ) {pr_warn ("rds: alloc sgs failed! nents <= 0\n" ); - *ret = -EINVAL ; -return NULL ; +return ERR_PTR (-EINVAL ); }if (rm->m_used_sgs + nents > rm->m_total_sgs) {pr_warn ("rds: alloc sgs failed! total %d used %d nents %d\n" , rm->m_total_sgs, rm->m_used_sgs, nents); - *ret = -ENOMEM ; -return NULL ; +return ERR_PTR (-ENOMEM ); } sg_ret = &sg_first[rm->m_used_sgs];
@@ -343,7 +337,6 @@ struct rds_message *rds_message_map_pages(unsigned long *page_addrs, unsigned inunsigned int i;int num_sgs =DIV_ROUND_UP (total_len,PAGE_SIZE );int extra_bytes = num_sgs *sizeof (struct scatterlist ); -int ret; rm =rds_message_alloc (extra_bytes,GFP_NOWAIT );if (!rm)
@@ -352,10 +345,10 @@ struct rds_message *rds_message_map_pages(unsigned long *page_addrs, unsigned inset_bit (RDS_MSG_PAGEVEC , &rm->m_flags); rm->m_inc.i_hdr.h_len =cpu_to_be32 (total_len); rm->data.op_nents =DIV_ROUND_UP (total_len,PAGE_SIZE ); - rm->data.op_sg =rds_message_alloc_sgs (rm, num_sgs, &ret); -if (!rm->data.op_sg) { + rm->data.op_sg =rds_message_alloc_sgs (rm, num_sgs); +if (IS_ERR (rm->data.op_sg)) {rds_message_put (rm); -return ERR_PTR (ret); +return ERR_CAST (rm->data.op_sg); }for (i =0 ; i < rm->data.op_nents; ++i) {
net/rds/rdma.c +8 -4
@@ -664,9 +664,11 @@ int rds_cmsg_rdma_args(struct rds_sock *rs, struct rds_message *rm, op->op_odp_mr =NULL ;WARN_ON (!nr_pages); - op->op_sg =rds_message_alloc_sgs (rm, nr_pages, &ret); -if (!op->op_sg) + op->op_sg =rds_message_alloc_sgs (rm, nr_pages); +if (IS_ERR (op->op_sg)) { + ret =PTR_ERR (op->op_sg); goto out_pages; + }if (op->op_notify || op->op_recverr) {/* We allocate an uninitialized notifier here, because
@@ -905,9 +907,11 @@ int rds_cmsg_atomic(struct rds_sock *rs, struct rds_message *rm, rm->atomic.op_silent = !!(args->flags &RDS_RDMA_SILENT ); rm->atomic.op_active =1 ; rm->atomic.op_recverr = rs->rs_recverr; - rm->atomic.op_sg =rds_message_alloc_sgs (rm,1 , &ret); -if (!rm->atomic.op_sg) + rm->atomic.op_sg =rds_message_alloc_sgs (rm,1 ); +if (IS_ERR (rm->atomic.op_sg)) { + ret =PTR_ERR (rm->atomic.op_sg); goto err; + }/* verify 8 byte-aligned */ if (args->local_addr &0x7 ) {
net/rds/rds.h +1 -2
@@ -852,8 +852,7 @@ rds_conn_connecting(struct rds_connection *conn)/* message.c */ struct rds_message *rds_message_alloc (unsigned int nents,gfp_t gfp); -struct scatterlist *rds_message_alloc_sgs (struct rds_message *rm,int nents, -int *ret); +struct scatterlist *rds_message_alloc_sgs (struct rds_message *rm,int nents);int rds_message_copy_from_user (struct rds_message *rm,struct iov_iter *from,bool zcopy);struct rds_message *rds_message_map_pages (unsigned long *page_addrs,unsigned int total_len);
net/rds/send.c +4 -2
@@ -1274,9 +1274,11 @@ int rds_sendmsg(struct socket *sock, struct msghdr *msg, size_t payload_len)/* Attach data to the rm */ if (payload_len) { - rm->data.op_sg =rds_message_alloc_sgs (rm, num_sgs, &ret); -if (!rm->data.op_sg) + rm->data.op_sg =rds_message_alloc_sgs (rm, num_sgs); +if (IS_ERR (rm->data.op_sg)) { + ret =PTR_ERR (rm->data.op_sg); goto out; + } ret =rds_message_copy_from_user (rm, &msg->msg_iter, zcopy);if (ret) goto out;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 14/606 gcc-10: disable 'restrict' warning for now
In reply to Sasha LevinFrom: Linus Torvalds <[email protected]>
commit adc71920969870dfa54e8f40dac8616284832d02 upstream.
gcc-10 now warns about passing aliasing pointers to functions that take restricted pointers.
That's actually a great warning, and if we ever start using 'restrict' in the kernel, it might be quite useful. But right now we don't, and it turns out that the only thing this warns about is an idiom where we have declared a few functions to be "printf-like" (which seems to make gcc pick up the restricted pointer thing), and then we print to the same buffer that we also use as an input.
And people do that as an odd concatenation pattern, with code like this:
#define sysfs_show_gen_prop(buffer, fmt, ...) \
snprintf(buffer, PAGE_SIZE, "%s"fmt, buffer, __VA_ARGS__)where we have 'buffer' as both the destination of the final result, and as the initial argument.
Yes, it's a bit questionable. And outside of the kernel, people do have standard declarations like
int snprintf( char *restrict buffer, size_t bufsz,
const char *restrict format, ... );
where that output buffer is marked as a restrict pointer that cannot alias with any other arguments.
But in the context of the kernel, that 'use snprintf() to concatenate to the end result' does work, and the pattern shows up in multiple places. And we have not marked our own version of snprintf() as taking restrict pointers, so the warning is incorrect for now, and gcc picks it up on its own.
If we do start using 'restrict' in the kernel (and it might be a good idea if people find places where it matters), we'll need to figure out how to avoid this issue for snprintf and friends. But in the meantime, this warning is not useful.
--- Makefile | 3 +++ 1 file changed, 3 insertions(+)
Makefile +3 -0
@@ -862,6 +862,9 @@ KBUILD_CFLAGS += $(call cc-disable-warning, zero-length-bounds) KBUILD_CFLAGS += $(call cc-disable-warning, array-bounds) KBUILD_CFLAGS += $(call cc-disable-warning, stringop-overflow) +# Another good warning that we'll want to enable eventually +KBUILD_CFLAGS += $(call cc-disable-warning, restrict) + # Enabled with W=2, disabled by default as noisy KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 16/606 gcc-10: mark more functions __init to avoid section mismatch warnings
In reply to Sasha LevinFrom: Linus Torvalds <[email protected]>
commit e99332e7b4cda6e60f5b5916cf9943a79dbef902 upstream.
It seems that for whatever reason, gcc-10 ends up not inlining a couple of functions that used to be inlined before. Even if they only have one single callsite - it looks like gcc may have decided that the code was unlikely, and not worth inlining.
The code generation difference is harmless, but caused a few new section mismatch errors, since the (now no longer inlined) function wasn't in the __init section, but called other init functions:
Section mismatch in reference from the function kexec_free_initrd() to the function .init.text:free_initrd_mem() Section mismatch in reference from the function tpm2_calc_event_log_size() to the function .init.text:early_memremap() Section mismatch in reference from the function tpm2_calc_event_log_size() to the function .init.text:early_memunmap()
So add the appropriate __init annotation to make modpost not complain. In both cases there were trivially just a single callsite from another __init function.
--- drivers/firmware/efi/tpm.c | 2 +- init/initramfs.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/firmware/efi/tpm.c +1 -1
@@ -16,7 +16,7 @@int efi_tpm_final_log_size;EXPORT_SYMBOL (efi_tpm_final_log_size); -static int tpm2_calc_event_log_size (void *data,int count,void *size_info) +static int __init tpm2_calc_event_log_size (void *data,int count,void *size_info) {struct tcg_pcr_event2_head *header;int event_size, size =0 ;
init/initramfs.c +1 -1
@@ -542,7 +542,7 @@ void __weak free_initrd_mem(unsigned long start, unsigned long end) }#ifdef CONFIG_KEXEC_CORE -static bool kexec_free_initrd (void ) +static bool __init kexec_free_initrd (void ) {unsigned long crashk_start = (unsigned long )__va (crashk_res.start);unsigned long crashk_end = (unsigned long )__va (crashk_res.end);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 23/606 ALSA: hda/realtek - Add COEF workaround for ASUS ZenBook UX431DA
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
commit 1b94e59d30afecf18254ad413e953e7587645a20 upstream.
ASUS ZenBook UX431DA requires an additional COEF setup when booted from the recent Windows 10, otherwise it produces the noisy output. The quirk turns on COEF 0x1b bit 10 that has been cleared supposedly due to the pop noise reduction.
--- sound/pci/hda/patch_realtek.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
sound/pci/hda/patch_realtek.c +13 -0
@@ -5978,6 +5978,7 @@ enum {ALC294_FIXUP_ASUS_DUAL_SPK ,ALC285_FIXUP_THINKPAD_HEADSET_JACK ,ALC294_FIXUP_ASUS_HPE , +ALC294_FIXUP_ASUS_COEF_1B , ALC285_FIXUP_HP_GPIO_LED, };
@@ -7112,6 +7113,17 @@ static const struct hda_fixup alc269_fixups[] = { .chained = true, .chain_id =ALC294_FIXUP_ASUS_HEADSET_MIC }, + [ALC294_FIXUP_ASUS_COEF_1B] = { + .type = HDA_FIXUP_VERBS, + .v.verbs = (const struct hda_verb []) { +/* Set bit 10 to correct noisy output after reboot from +* Windows 10 (due to pop noise reduction?) +*/ + {0x20 ,AC_VERB_SET_COEF_INDEX ,0x1b }, + {0x20 ,AC_VERB_SET_PROC_COEF ,0x4e4b }, + { } + }, + }, [ALC285_FIXUP_HP_GPIO_LED] = { .type = HDA_FIXUP_FUNC, .v.func = alc285_fixup_hp_gpio_led,
@@ -7283,6 +7295,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x1043 ,0x19ce ,"ASUS B9450FA" ,ALC294_FIXUP_ASUS_HPE ),SND_PCI_QUIRK (0x1043 ,0x1a13 ,"Asus G73Jw" ,ALC269_FIXUP_ASUS_G73JW ),SND_PCI_QUIRK (0x1043 ,0x1a30 ,"ASUS X705UD" ,ALC256_FIXUP_ASUS_MIC ), +SND_PCI_QUIRK (0x1043 ,0x1b11 ,"ASUS UX431DA" ,ALC294_FIXUP_ASUS_COEF_1B ),SND_PCI_QUIRK (0x1043 ,0x1b13 ,"Asus U41SV" ,ALC269_FIXUP_INV_DMIC ),SND_PCI_QUIRK (0x1043 ,0x1bbd ,"ASUS Z550MA" ,ALC255_FIXUP_ASUS_MIC_NO_PRESENCE ), SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 26/606 usb: core: hub: limit HUB_QUIRK_DISABLE_AUTOSUSPEND to USB5534B
In reply to Sasha LevinFrom: Eugeniu Rosca <[email protected]>
commit 76e1ef1d81a4129d7e2fb8c48c83b166d1c8e040 upstream.
On Tue, May 12, 2020 at 09:36:07PM +0800, Kai-Heng Feng wrote [1]:
Quoted 1 line
This patch prevents my Raven Ridge xHCI from getting runtime suspend.
The problem described in v5.6 commit 1208f9e1d758c9 ("USB: hub: Fix the broken detection of USB3 device in SMSC hub") applies solely to the USB5534B hub [2] present on the Kingfisher Infotainment Carrier Board, manufactured by Shimafuji Electric Inc [3].
Despite that, the aforementioned commit applied the quirk to _all_ hubs carrying vendor ID 0x424 (i.e. SMSC), of which there are more [4] than initially expected. Consequently, the quirk is now enabled on platforms carrying SMSC/Microchip hub models which potentially don't exhibit the original issue.
To avoid reports like [1], further limit the quirk's scope to USB5534B [2], by employing both Vendor and Product ID checks.
Tested on H3ULCB + Kingfisher rev. M05.
[1] https://lore.kernel.org/linux-renesas-soc/[email protected]/
[2] https://www.microchip.com/wwwproducts/en/USB5534B
[3] http://www.shimafuji.co.jp/wp/wp-content/uploads/2018/08/SBEV-RCAR-KF-M06Board_HWSpecificationEN_Rev130.pdf
[4] https://devicehunt.com/search/type/usb/vendor/0424/device/any
--- drivers/usb/core/hub.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/usb/core/hub.c +5 -1
@@ -39,6 +39,7 @@#define USB_VENDOR_GENESYS_LOGIC 0x05e3#define USB_VENDOR_SMSC 0x0424 +#define USB_PRODUCT_USB5534B 0x5534#define HUB_QUIRK_CHECK_PORT_AUTOSUSPEND 0x01#define HUB_QUIRK_DISABLE_AUTOSUSPEND 0x02
@@ -5621,8 +5622,11 @@ static void hub_event(struct work_struct *work) }static const struct usb_device_id hub_id_table[] = { - { .match_flags =USB_DEVICE_ID_MATCH_VENDOR |USB_DEVICE_ID_MATCH_INT_CLASS , + { .match_flags =USB_DEVICE_ID_MATCH_VENDOR + |USB_DEVICE_ID_MATCH_PRODUCT + |USB_DEVICE_ID_MATCH_INT_CLASS , .idVendor =USB_VENDOR_SMSC , + .idProduct =USB_PRODUCT_USB5534B , .bInterfaceClass =USB_CLASS_HUB , .driver_info =HUB_QUIRK_DISABLE_AUTOSUSPEND }, { .match_flags =USB_DEVICE_ID_MATCH_VENDOR
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 31/606 Make the "Reducing compressed framebufer size" message be DRM_INFO_ONCE()
In reply to Sasha LevinFrom: Peter Jones <[email protected]>
commit 82152d424b6cb6fc1ede7d03d69c04e786688740 upstream.
This was sort of annoying me:
random:~$ dmesg | tail -1 [523884.039227] [drm] Reducing the compressed framebuffer size. This may lead to less power savings than a non-reduced-size. Try to increase stolen memory size if available in BIOS. random:~$ dmesg | grep -c "Reducing the compressed" 47
This patch makes it DRM_INFO_ONCE() just like the similar message farther down in that function is pr_info_once().
--- drivers/gpu/drm/i915/display/intel_fbc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/i915/display/intel_fbc.c +1 -2
@@ -478,8 +478,7 @@ static int intel_fbc_alloc_cfb(struct drm_i915_private *dev_priv,if (!ret) goto err_llb;else if (ret >1 ) { -DRM_INFO ("Reducing the compressed framebuffer size. This may lead to less power savings than a non-reduced-size. Try to increase stolen memory size if available in BIOS.\n" ); - +DRM_INFO_ONCE ("Reducing the compressed framebuffer size. This may lead to less power savings than a non-reduced-size. Try to increase stolen memory size if available in BIOS.\n" ); } fbc->threshold = ret;
Signature · 6 lines
2.25.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Sasha Levin
maintainerPATCH 33/606 ARM: dts: imx27-phytec-phycard-s-rdk: Fix the I2C1 pinctrl entries
In reply to Sasha LevinFrom: Fabio Estevam <[email protected]>
commit 0caf34350a25907515d929a9c77b9b206aac6d1e upstream.
The I2C2 pins are already used and the following errors are seen:
imx27-pinctrl 10015000.iomuxc: pin MX27_PAD_I2C2_SDA already requested by 10012000.i2c; cannot claim for 1001d000.i2c imx27-pinctrl 10015000.iomuxc: pin-69 (1001d000.i2c) status -22
imx27-pinctrl 10015000.iomuxc: could not request pin 69 (MX27_PAD_I2C2_SDA) from group i2c2grp on device 10015000.iomuxc imx-i2c 1001d000.i2c: Error applying setting, reverse things back
imx-i2c: probe of 1001d000.i2c failed with error -22
Fix it by adding the correct I2C1 IOMUX entries for the pinctrl_i2c1 group.
--- arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/imx27-phytec-phycard-s-rdk.dts +2 -2
@@ -75,8 +75,8 @@ &iomuxc { imx27-phycard-s-rdk { pinctrl_i2c1: i2c1grp { fsl,pins = < - MX27_PAD_I2C2_SDA__I2C2_SDA 0x0 - MX27_PAD_I2C2_SCL__I2C2_SCL 0x0 + MX27_PAD_I2C_DATA__I2C_DATA 0x0 + MX27_PAD_I2C_CLK__I2C_CLK 0x0 >; };
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 36/606 drm/amd/amdgpu: add raven1 part to the gfxoff quirk list
In reply to Sasha LevinFrom: Tom St Denis <[email protected]>
commit 975f543e7522e17b8a4bf34d7daeac44819aee5a upstream.
On my raven1 system (rev c6) with VBIOS 113-RAVEN-114 GFXOFF is not stable (resulting in large block tiling noise in some applications).
Disabling GFXOFF via the quirk list fixes the problems for me.
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -0
@@ -1177,6 +1177,8 @@ static const struct amdgpu_gfxoff_quirk amdgpu_gfxoff_quirk_list[] = { { 0x1002, 0x15dd, 0x1002, 0x15dd, 0xc8 },/* https://bugzilla.kernel.org/show_bug.cgi?id=207171 */ { 0x1002, 0x15dd, 0x103c, 0x83e7, 0xd3 }, +/* GFXOFF is unstable on C6 parts with a VBIOS 113-RAVEN-114 */ + { 0x1002, 0x15dd, 0x1002, 0x15dd, 0xc6 }, { 0, 0, 0, 0, 0 }, };
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 35/606 drm/amd/display: add basic atomic check for cursor plane
In reply to Sasha LevinFrom: Simon Ser <[email protected]>
commit 626bf90fe03fa080d8df06bb0397c95c53ae8e27 upstream.
This patch adds a basic cursor check when an atomic test-only commit is performed. The position and size of the cursor plane is checked.
This should fix user-space relying on atomic checks to assign buffers to planes.
References: https://github.com/emersion/libliftoff/issues/46
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +24 -2
@@ -7716,6 +7716,7 @@ static int dm_update_plane_state(struct dc *dc,struct drm_crtc_state *old_crtc_state, *new_crtc_state;struct dm_crtc_state *dm_new_crtc_state, *dm_old_crtc_state;struct dm_plane_state *dm_new_plane_state, *dm_old_plane_state; +struct amdgpu_crtc *new_acrtc;bool needs_reset;int ret =0 ;
@@ -7725,9 +7726,30 @@ static int dm_update_plane_state(struct dc *dc, dm_new_plane_state =to_dm_plane_state (new_plane_state); dm_old_plane_state =to_dm_plane_state (old_plane_state); -/*TODO Implement atomic check for cursor plane */ -if (plane->type ==DRM_PLANE_TYPE_CURSOR ) +/*TODO Implement better atomic check for cursor plane */ +if (plane->type ==DRM_PLANE_TYPE_CURSOR ) { +if (!enable || !new_plane_crtc || +drm_atomic_plane_disabling (plane->state, new_plane_state)) +return 0 ; + + new_acrtc =to_amdgpu_crtc (new_plane_crtc); + +if ((new_plane_state->crtc_w > new_acrtc->max_cursor_width) || + (new_plane_state->crtc_h > new_acrtc->max_cursor_height)) { +DRM_DEBUG_ATOMIC ("Bad cursor size %d x %d\n" , + new_plane_state->crtc_w, new_plane_state->crtc_h); +return -EINVAL ; + } + +if (new_plane_state->crtc_x <= -new_acrtc->max_cursor_width || + new_plane_state->crtc_y <= -new_acrtc->max_cursor_height) { +DRM_DEBUG_ATOMIC ("Bad cursor position %d, %d\n" , + new_plane_state->crtc_x, new_plane_state->crtc_y); +return -EINVAL ; + } +return 0 ; + } needs_reset =should_reset_plane (state, plane, old_plane_state, new_plane_state);
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 37/606 drm/i915/tgl+: Fix interrupt handling for DP AUX transactions
In reply to Sasha LevinFrom: Imre Deak <[email protected]>
commit 4457a9db2bdec2360ddb15242341696108167886 upstream.
Unmask/enable AUX interrupts on all ports on TGL+. So far the interrupts worked only on port A, which meant each transaction on other ports took 10ms.
--- drivers/gpu/drm/i915/i915_irq.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +3 -13
@@ -3324,7 +3324,7 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv)u32 de_pipe_masked =gen8_de_pipe_fault_mask (dev_priv) |GEN8_PIPE_CDCLK_CRC_DONE ;u32 de_pipe_enables; -u32 de_port_masked =GEN8_AUX_CHANNEL_A ; +u32 de_port_masked =gen8_de_port_aux_mask (dev_priv);u32 de_port_enables;u32 de_misc_masked =GEN8_DE_EDP_PSR ;enum pipe pipe;
@@ -3332,18 +3332,8 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv)if (INTEL_GEN (dev_priv) <=10 ) de_misc_masked |=GEN8_DE_MISC_GSE ; -if (INTEL_GEN (dev_priv) >=9 ) { - de_port_masked |=GEN9_AUX_CHANNEL_B |GEN9_AUX_CHANNEL_C | -GEN9_AUX_CHANNEL_D ; -if (IS_GEN9_LP (dev_priv)) - de_port_masked |=BXT_DE_PORT_GMBUS ; - } - -if (INTEL_GEN (dev_priv) >=11 ) - de_port_masked |=ICL_AUX_CHANNEL_E ; - -if (IS_CNL_WITH_PORT_F (dev_priv) ||INTEL_GEN (dev_priv) >=11 ) - de_port_masked |=CNL_AUX_CHANNEL_F ; +if (IS_GEN9_LP (dev_priv)) + de_port_masked |=BXT_DE_PORT_GMBUS ; de_pipe_enables = de_pipe_masked |GEN8_PIPE_VBLANK |GEN8_PIPE_FIFO_UNDERRUN ;
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 39/606 powerpc/32s: Fix build failure with CONFIG_PPC_KUAP_DEBUG
In reply to Sasha LevinFrom: Christophe Leroy <[email protected]>
commit 4833ce06e6855d526234618b746ffb71d6612c9a upstream.
gpr2 is not a parametre of kuap_check(), it doesn't exist.
Use gpr instead.
--- arch/powerpc/include/asm/book3s/32/kup.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/include/asm/book3s/32/kup.h +1 -1
@@ -75,7 +75,7 @@ .macro kuap_check current, gpr#ifdef CONFIG_PPC_KUAP_DEBUG - lwz \gpr2, KUAP(thread) + lwz \gpr, KUAP(thread) 999: twnei \gpr, 0 EMIT_BUG_ENTRY 999b, __FILE__, __LINE__, (BUGFLAG_WARNING | BUGFLAG_ONCE)#endif
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 38/606 powerpc/vdso32: Fallback on getres syscall when clock is unknown
In reply to Sasha LevinFrom: Christophe Leroy <[email protected]>
commit e963b7a28b2bf2416304e1a15df967fcf662aff5 upstream.
There are other clocks than the standard ones, for instance per process clocks. Therefore, being above the last standard clock doesn't mean it is a bad clock. So, fallback to syscall instead of returning -EINVAL inconditionaly.
--- arch/powerpc/kernel/vdso32/gettimeofday.S | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/powerpc/kernel/vdso32/gettimeofday.S +3 -3
@@ -218,11 +218,11 @@ V_FUNCTION_BEGIN(__kernel_clock_getres) blr /* - * invalid clock + * syscall fallback */ 99: - li r3, EINVAL - crset so + li r0,__NR_clock_getres + sc blr .cfi_endproc V_FUNCTION_END(__kernel_clock_getres)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 41/606 KVM: x86: Fix pkru save/restore when guest CR4.PKE=0, move it to x86.c
In reply to Sasha LevinFrom: Babu Moger <[email protected]>
commit 37486135d3a7b03acc7755b63627a130437f066a upstream.
Though rdpkru and wrpkru are contingent upon CR4.PKE, the PKRU resource isn't. It can be read with XSAVE and written with XRSTOR. So, if we don't set the guest PKRU value here(kvm_load_guest_xsave_state), the guest can read the host value.
In case of kvm_load_host_xsave_state, guest with CR4.PKE clear could potentially use XRSTOR to change the host PKRU value.
While at it, move pkru state save/restore to common code and the host_pkru field to kvm_vcpu_arch. This will let SVM support protection keys.
Message-Id: <158932794619.44260.14508381096663848853.stgit@naples-babu.amd.com>
--- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/vmx/vmx.c | 18 ------------------ arch/x86/kvm/x86.c | 17 +++++++++++++++++ 3 files changed, 18 insertions(+), 18 deletions(-)
arch/x86/include/asm/kvm_host.h +1 -0
@@ -574,6 +574,7 @@ struct kvm_vcpu_arch {unsigned long cr4;unsigned long cr4_guest_owned_bits;unsigned long cr8; +u32 host_pkru;u32 pkru;u32 hflags;u64 efer;
arch/x86/kvm/vmx/vmx.c +0 -18
@@ -1380,7 +1380,6 @@ void vmx_vcpu_load(struct kvm_vcpu *vcpu, int cpu)vmx_vcpu_pi_load (vcpu, cpu); - vmx->host_pkru =read_pkru (); vmx->host_debugctlmsr =get_debugctlmsr (); }
@@ -6538,11 +6537,6 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu)kvm_load_guest_xsave_state (vcpu); -if (static_cpu_has (X86_FEATURE_PKU ) && -kvm_read_cr4_bits (vcpu,X86_CR4_PKE ) && - vcpu->arch.pkru != vmx->host_pkru) -__write_pkru (vcpu->arch.pkru); -pt_guest_enter (vmx);atomic_switch_perf_msrs (vmx);
@@ -6631,18 +6625,6 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu)pt_guest_exit (vmx); -/* -* eager fpu is enabled if PKEY is supported and CR4 is switched -* back on host, so it is safe to read guest PKRU from current -* XSAVE. -*/ -if (static_cpu_has (X86_FEATURE_PKU ) && -kvm_read_cr4_bits (vcpu,X86_CR4_PKE )) { - vcpu->arch.pkru =rdpkru (); -if (vcpu->arch.pkru != vmx->host_pkru) -__write_pkru (vmx->host_pkru); - } -kvm_load_host_xsave_state (vcpu); vmx->nested.nested_run_pending =0 ;
arch/x86/kvm/x86.c +17 -0
@@ -809,11 +809,25 @@ void kvm_load_guest_xsave_state(struct kvm_vcpu *vcpu) vcpu->arch.ia32_xss != host_xss)wrmsrl (MSR_IA32_XSS , vcpu->arch.ia32_xss); } + +if (static_cpu_has (X86_FEATURE_PKU ) && + (kvm_read_cr4_bits (vcpu,X86_CR4_PKE ) || + (vcpu->arch.xcr0 &XFEATURE_MASK_PKRU )) && + vcpu->arch.pkru != vcpu->arch.host_pkru) +__write_pkru (vcpu->arch.pkru); }EXPORT_SYMBOL_GPL (kvm_load_guest_xsave_state);void kvm_load_host_xsave_state (struct kvm_vcpu *vcpu) { +if (static_cpu_has (X86_FEATURE_PKU ) && + (kvm_read_cr4_bits (vcpu,X86_CR4_PKE ) || + (vcpu->arch.xcr0 &XFEATURE_MASK_PKRU ))) { + vcpu->arch.pkru =rdpkru (); +if (vcpu->arch.pkru != vcpu->arch.host_pkru) +__write_pkru (vcpu->arch.host_pkru); + } +if (kvm_read_cr4_bits (vcpu,X86_CR4_OSXSAVE )) {if (vcpu->arch.xcr0 != host_xcr0)
@@ -3529,6 +3543,9 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) kvm_x86_ops->vcpu_load (vcpu, cpu); +/* Save host pkru register if supported */ + vcpu->arch.host_pkru =read_pkru (); +/* Apply any externally detected TSC adjustments (due to suspend) */ if (unlikely (vcpu->arch.tsc_offset_adjustment)) {adjust_tsc_offset_host (vcpu, vcpu->arch.tsc_offset_adjustment);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 44/606 exec: Move would_dump into flush_old_exec
In reply to Sasha LevinFrom: "Eric W. Biederman" <[email protected]>
commit f87d1c9559164294040e58f5e3b74a162bf7c6e8 upstream.
I goofed when I added mm->user_ns support to would_dump. I missed the fact that in the case of binfmt_loader, binfmt_em86, binfmt_misc, and binfmt_script bprm->file is reassigned. Which made the move of would_dump from setup_new_exec to __do_execve_file before exec_binprm incorrect as it can result in would_dump running on the script instead of the interpreter of the script.
The net result is that the code stopped making unreadable interpreters undumpable. Which allows them to be ptraced and written to disk without special permissions. Oops.
The move was necessary because the call in set_new_exec was after bprm->mm was no longer valid.
To correct this mistake move the misplaced would_dump from __do_execve_file into flos_old_exec, before exec_mmap is called.
I tested and confirmed that without this fix I can attach with gdb to a script with an unreadable interpreter, and with this fix I can not.
--- fs/exec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/exec.c +2 -2
@@ -1277,6 +1277,8 @@ int flush_old_exec(struct linux_binprm * bprm)*/ set_mm_exe_file (bprm->mm, bprm->file); +would_dump (bprm, bprm->file); +/* * Release all of the old mmap stuff */
@@ -1820,8 +1822,6 @@ static int __do_execve_file(int fd, struct filename *filename,if (retval <0 ) goto out; -would_dump (bprm, bprm->file); - retval =exec_binprm (bprm);if (retval <0 ) goto out;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 54/606 Revert "ALSA: hda/realtek: Fix pop noise on ALC225"
In reply to Sasha LevinFrom: Kai-Heng Feng <[email protected]>
commit f41224efcf8aafe80ea47ac870c5e32f3209ffc8 upstream.
This reverts commit 3b36b13d5e69d6f51ff1c55d1b404a74646c9757.
Enable power save node breaks some systems with ACL225. Revert the patch and use a platform specific quirk for the original issue isntead.
--- sound/pci/hda/patch_realtek.c | 2 -- 1 file changed, 2 deletions(-)
sound/pci/hda/patch_realtek.c +0 -2
@@ -8121,8 +8121,6 @@ static int patch_alc269(struct hda_codec *codec) spec->gen.mixer_nid =0 ;break ;case 0x10ec0225 : - codec->power_save_node =1 ; -/* fall through */ case 0x10ec0295 :case 0x10ec0299 : spec->codec_variant =ALC269_TYPE_ALC225 ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 55/606 clk: ti: clkctrl: Fix Bad of_node_put within clkctrl_get_name
In reply to Sasha LevinFrom: Tero Kristo <[email protected]>
commit e1f9e0d28ff025564dfdb1001a7839b4af5db2e2 upstream.
clkctrl_get_name incorrectly calls of_node_put when it is not really doing of_node_get. This causes a boot time warning later on:
[ 0.000000] OF: ERROR: Bad of_node_put() on /ocp/interconnect@4a000000/segmen
t@0/target-module@5000/cm_core_aon@0/ipu-cm@500/ipu1-clkctrl@20
Fix by dropping the of_node_put from the function.
--- drivers/clk/ti/clkctrl.c | 1 - 1 file changed, 1 deletion(-)
drivers/clk/ti/clkctrl.c +0 -1
@@ -461,7 +461,6 @@ static char * __init clkctrl_get_name(struct device_node *np)return name; } } -of_node_put (np);return NULL ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 58/606 arm64: dts: qcom: msm8996: Reduce vdd_apc voltage
In reply to Sasha LevinFrom: Bjorn Andersson <[email protected]>
commit 28810eecae08f9458a44831978e36f14ed182c80 upstream.
Some msm8996 based devices are unstable when run with VDD_APC of 1.23V, which is listed as the maximum voltage in "Turbo" mode. Given that the CPU cluster is not run in "Turbo" mode, reduce this to 0.98V - the maximum voltage for nominal operation.
--- arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/apq8096-db820c.dtsi +2 -2
@@ -658,8 +658,8 @@ s10 { s11 { qcom,saw-leader; regulator-always-on; - regulator-min-microvolt = <1230000>; - regulator-max-microvolt = <1230000>; + regulator-min-microvolt = <980000>; + regulator-max-microvolt = <980000>; }; };
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 64/606 arm64: dts: renesas: r8a77980: Fix IPMMU VIP[01] nodes
In reply to Sasha LevinFrom: Yoshihiro Shimoda <[email protected]>
commit f4d71c6ea9e58c07dd4d02d09c5dd9bb780ec4b1 upstream.
Missing the renesas,ipmmu-main property on ipmmu_vip[01] nodes.
--- arch/arm64/boot/dts/renesas/r8a77980.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/renesas/r8a77980.dtsi +2 -0
@@ -1318,6 +1318,7 @@ ipmmu_vi0: mmu@febd0000 { ipmmu_vip0: mmu@e7b00000 { compatible = "renesas,ipmmu-r8a77980"; reg = <0 0xe7b00000 0 0x1000>; + renesas,ipmmu-main = <&ipmmu_mm 4>; power-domains = <&sysc R8A77980_PD_ALWAYS_ON>; #iommu-cells = <1>; };
@@ -1325,6 +1326,7 @@ ipmmu_vip0: mmu@e7b00000 { ipmmu_vip1: mmu@e7960000 { compatible = "renesas,ipmmu-r8a77980"; reg = <0 0xe7960000 0 0x1000>; + renesas,ipmmu-main = <&ipmmu_mm 11>; power-domains = <&sysc R8A77980_PD_ALWAYS_ON>; #iommu-cells = <1>; };
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 65/606 ARM: dts: r8a7740: Add missing extal2 to CPG node
In reply to Sasha LevinFrom: Geert Uytterhoeven <[email protected]>
commit e47cb97f153193d4b41ca8d48127da14513d54c7 upstream.
The Clock Pulse Generator (CPG) device node lacks the extal2 clock. This may lead to a failure registering the "r" clock, or to a wrong parent for the "usb24s" clock, depending on MD_CK2 pin configuration and boot loader CPG_USBCKCR register configuration.
This went unnoticed, as this does not affect the single upstream board configuration, which relies on the first clock input only.
--- arch/arm/boot/dts/r8a7740.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/r8a7740.dtsi +1 -1
@@ -479,7 +479,7 @@ fsibck_clk: fsibck { cpg_clocks: cpg_clocks@e6150000 { compatible = "renesas,r8a7740-cpg-clocks"; reg = <0xe6150000 0x10000>; - clocks = <&extal1_clk>, <&extalr_clk>; + clocks = <&extal1_clk>, <&extal2_clk>, <&extalr_clk>; #clock-cells = <1>; clock-output-names = "system", "pllc0", "pllc1", "pllc2", "r",
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 22/606 ALSA: hda/realtek - Limit int mic boost for Thinkpad T530
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
commit b590b38ca305d6d7902ec7c4f7e273e0069f3bcc upstream.
Lenovo Thinkpad T530 seems to have a sensitive internal mic capture that needs to limit the mic boost like a few other Thinkpad models. Although we may change the quirk for ALC269_FIXUP_LENOVO_DOCK, this hits way too many other laptop models, so let's add a new fixup model that limits the internal mic boost on top of the existing quirk and apply to only T530.
--- sound/pci/hda/patch_realtek.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
sound/pci/hda/patch_realtek.c +9 -1
@@ -5856,6 +5856,7 @@ enum {ALC269_FIXUP_HP_LINE1_MIC1_LED ,ALC269_FIXUP_INV_DMIC ,ALC269_FIXUP_LENOVO_DOCK , +ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST ,ALC269_FIXUP_NO_SHUTUP ,ALC286_FIXUP_SONY_MIC_NO_PRESENCE , ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
@@ -6175,6 +6176,12 @@ static const struct hda_fixup alc269_fixups[] = { .chained = true, .chain_id =ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT }, + [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc269_fixup_limit_int_mic_boost, + .chained = true, + .chain_id = ALC269_FIXUP_LENOVO_DOCK, + }, [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = { .type = HDA_FIXUP_FUNC, .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
@@ -7317,7 +7324,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x17aa ,0x21b8 ,"Thinkpad Edge 14" ,ALC269_FIXUP_SKU_IGNORE ),SND_PCI_QUIRK (0x17aa ,0x21ca ,"Thinkpad L412" ,ALC269_FIXUP_SKU_IGNORE ),SND_PCI_QUIRK (0x17aa ,0x21e9 ,"Thinkpad Edge 15" ,ALC269_FIXUP_SKU_IGNORE ), -SND_PCI_QUIRK (0x17aa ,0x21f6 ,"Thinkpad T530" ,ALC269_FIXUP_LENOVO_DOCK ), +SND_PCI_QUIRK (0x17aa ,0x21f6 ,"Thinkpad T530" ,ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST ),SND_PCI_QUIRK (0x17aa ,0x21fa ,"Thinkpad X230" ,ALC269_FIXUP_LENOVO_DOCK ),SND_PCI_QUIRK (0x17aa ,0x21f3 ,"Thinkpad T430" ,ALC269_FIXUP_LENOVO_DOCK ), SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
@@ -7456,6 +7463,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = { {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"}, {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"}, {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"}, + {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"}, {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"}, {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"}, {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 74/606 KVM: x86: Fix off-by-one error in kvm_vcpu_ioctl_x86_setup_mce
In reply to Sasha LevinFrom: Jim Mattson <[email protected]>
commit c4e0e4ab4cf3ec2b3f0b628ead108d677644ebd9 upstream.
Bank_num is a one-based count of banks, not a zero-based index. It overflows the allocated space only when strictly greater than KVM_MAX_MCE_BANKS.
Message-Id: <[email protected]>
--- arch/x86/kvm/x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/x86.c +1 -1
@@ -3739,7 +3739,7 @@ static int kvm_vcpu_ioctl_x86_setup_mce(struct kvm_vcpu *vcpu,unsigned bank_num = mcg_cap &0xff , bank; r = -EINVAL ; -if (!bank_num || bank_num >=KVM_MAX_MCE_BANKS ) +if (!bank_num || bank_num >KVM_MAX_MCE_BANKS ) goto out;if (mcg_cap & ~(kvm_mce_cap_supported |0xff |0xff0000 )) goto out;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 75/606 bpf: Enforce returning 0 for fentry/fexit progs
In reply to Sasha LevinFrom: Yonghong Song <[email protected]>
commit e92888c72fbdc6f9d07b3b0604c012e81d7c0da7 upstream.
Currently, tracing/fentry and tracing/fexit prog return values are not enforced. In trampoline codes, the fentry/fexit prog return values are ignored. Let us enforce it to be 0 to avoid confusion and allows potential future extension.
This patch also explicitly added return value checking for tracing/raw_tp, tracing/fmod_ret, and freplace programs such that these program return values can be anything. The purpose are two folds:
1. to make it explicit about return value expectations for these programs in verifier.
2. for tracing prog_type, if a future attach type is added, the default is -ENOTSUPP which will enforce to specify return value ranges explicitly.
--- kernel/bpf/verifier.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
kernel/bpf/verifier.c +16 -0
@@ -6498,6 +6498,22 @@ static int check_return_code(struct bpf_verifier_env *env)return 0 ; range =tnum_const (0 );break ; +case BPF_PROG_TYPE_TRACING : +switch (env->prog->expected_attach_type) { +case BPF_TRACE_FENTRY : +case BPF_TRACE_FEXIT : + range =tnum_const (0 ); +break ; +case BPF_TRACE_RAW_TP : +return 0 ; +default : +return -ENOTSUPP ; + } +break ; +case BPF_PROG_TYPE_EXT : +/* freplace program can return anything as its return value +* depends on the to-be-replaced kernel func or bpf program. +*/ default :return 0 ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 78/606 Makefile: disallow data races on gcc-10 as well
In reply to Sasha LevinFrom: Sergei Trofimovich <[email protected]>
commit b1112139a103b4b1101d0d2d72931f2d33d8c978 upstream.
gcc-10 will rename --param=allow-store-data-races=0 to -fno-allow-store-data-races.
The flag change happened at https://gcc.gnu.org/PR92046.
--- Makefile | 1 + 1 file changed, 1 insertion(+)
Makefile +1 -0
@@ -710,6 +710,7 @@ endif # Tell gcc to never replace conditional load with a non-conditional one KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) +KBUILD_CFLAGS += $(call cc-option,-fno-allow-store-data-races) include scripts/Makefile.kcov include scripts/Makefile.gcc-plugins
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 79/606 Linux 5.6.14
In reply to Sasha LevinFrom: Greg Kroah-Hartman <[email protected]>
--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 VERSION = 5 PATCHLEVEL = 6 -SUBLEVEL = 13 +SUBLEVEL = 14 EXTRAVERSION = NAME = Kleptomaniac Octopus
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 82/606 ima: Set file->f_mode instead of file->f_flags in ima_calc_file_hash()
In reply to Sasha LevinFrom: Roberto Sassu <[email protected]>
[ Upstream commit 0014cc04e8ec077dc482f00c87dfd949cfe2b98f ]
Commit a408e4a86b36 ("ima: open a new file instance if no read permissions") tries to create a new file descriptor to calculate a file digest if the file has not been opened with O_RDONLY flag. However, if a new file descriptor cannot be obtained, it sets the FMODE_READ flag to file->f_flags instead of file->f_mode.
This patch fixes this issue by replacing f_flags with f_mode as it was before that commit.
--- security/integrity/ima/ima_crypto.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
security/integrity/ima/ima_crypto.c +6 -6
@@ -413,7 +413,7 @@ int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash)loff_t i_size;int rc;struct file *f = file; -bool new_file_instance = false, modified_flags = false; +bool new_file_instance = false, modified_mode = false;/* * For consistency, fail file's opened with the O_DIRECT flag on
@@ -433,13 +433,13 @@ int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash) f =dentry_open (&file->f_path, flags, file->f_cred);if (IS_ERR (f)) {/* -* Cannot open the file again, lets modify f_flags +* Cannot open the file again, lets modify f_mode * of original and continue */ pr_info_ratelimited ("Unable to reopen file for reading.\n" ); f = file; - f->f_flags |=FMODE_READ ; - modified_flags = true; + f->f_mode |=FMODE_READ ; + modified_mode = true; }else { new_file_instance = true; }
@@ -457,8 +457,8 @@ int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash) out:if (new_file_instance)fput (f); -else if (modified_flags) - f->f_flags &= ~FMODE_READ ; +else if (modified_mode) + f->f_mode &= ~FMODE_READ ;return rc; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 85/606 ovl: potential crash in ovl_fid_to_fh()
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit 9aafc1b0187322fa4fd4eb905d0903172237206c ]
The "buflen" value comes from the user and there is a potential that it could be zero. In do_handle_to_path() we know that "handle->handle_bytes" is non-zero and we do:
handle_dwords = handle->handle_bytes >> 2;
So values 1-3 become zero. Then in ovl_fh_to_dentry() we do:
int len = fh_len << 2;
So now len is in the "0,4-128" range and a multiple of 4. But if "buflen" is zero it will try to copy negative bytes when we do the memcpy in ovl_fid_to_fh().
memcpy(&fh->fb, fid, buflen - OVL_FH_WIRE_OFFSET);
And that will lead to a crash. Thanks to Amir Goldstein for his help with this patch.
--- fs/overlayfs/export.c | 3 +++ 1 file changed, 3 insertions(+)
fs/overlayfs/export.c +3 -0
@@ -777,6 +777,9 @@ static struct ovl_fh *ovl_fid_to_fh(struct fid *fid, int buflen, int fh_type)if (fh_type !=OVL_FILEID_V0 )return ERR_PTR (-EINVAL ); +if (buflen <=OVL_FH_WIRE_OFFSET ) +return ERR_PTR (-EINVAL ); + fh =kzalloc (buflen,GFP_KERNEL );if (!fh)return ERR_PTR (-ENOMEM );
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 84/606 ima: Fix return value of ima_write_policy()
In reply to Sasha LevinFrom: Roberto Sassu <[email protected]>
[ Upstream commit 2e3a34e9f409ebe83d1af7cd2f49fca7af97dfac ]
This patch fixes the return value of ima_write_policy() when a new policy is directly passed to IMA and the current policy requires appraisal of the file containing the policy. Currently, if appraisal is not in ENFORCE mode, ima_write_policy() returns 0 and leads user space applications to an endless loop. Fix this issue by denying the operation regardless of the appraisal mode.
--- security/integrity/ima/ima_fs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
security/integrity/ima/ima_fs.c +1 -2
@@ -340,8 +340,7 @@ static ssize_t ima_write_policy(struct file *file, const char __user *buf,integrity_audit_msg (AUDIT_INTEGRITY_STATUS ,NULL ,NULL ,"policy_update" ,"signed policy required" ,1 ,0 ); -if (ima_appraise &IMA_APPRAISE_ENFORCE ) - result = -EACCES ; + result = -EACCES ; }else { result =ima_parse_add_rule (data); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 86/606 ubifs: fix wrong use of crypto_shash_descsize()
In reply to Sasha LevinFrom: Eric Biggers <[email protected]>
[ Upstream commit 3c3c32f85b6cc05e5db78693457deff03ac0f434 ]
crypto_shash_descsize() returns the size of the shash_desc context needed to compute the hash, not the size of the hash itself.
crypto_shash_digestsize() would be correct, or alternatively using c->hash_len and c->hmac_desc_len which already store the correct values. But actually it's simpler to just use stack arrays, so do that instead.
--- fs/ubifs/auth.c | 17 ++++------------- fs/ubifs/replay.c | 13 ++----------- 2 files changed, 6 insertions(+), 24 deletions(-)
fs/ubifs/auth.c +4 -13
@@ -79,13 +79,9 @@ int ubifs_prepare_auth_node(struct ubifs_info *c, void *node, struct shash_desc *inhash) {struct ubifs_auth_node *auth = node; -u8 *hash; +u8 hash[UBIFS_HASH_ARR_SZ ];int err; - hash =kmalloc (crypto_shash_descsize (c->hash_tfm),GFP_NOFS ); -if (!hash) -return -ENOMEM ; - {SHASH_DESC_ON_STACK (hash_desc, c->hash_tfm);
@@ -94,21 +90,16 @@ int ubifs_prepare_auth_node(struct ubifs_info *c, void *node, err =crypto_shash_final (hash_desc, hash);if (err) - goto out; +return err; } err =ubifs_hash_calc_hmac (c, hash, auth->hmac);if (err) - goto out; +return err; auth->ch.node_type =UBIFS_AUTH_NODE ;ubifs_prepare_node (c, auth,ubifs_auth_node_sz (c),0 ); - - err =0 ; -out: -kfree (hash); - -return err; +return 0 ; } static struct shash_desc *ubifs_get_desc(const struct ubifs_info *c,
fs/ubifs/replay.c +2 -11
@@ -601,18 +601,12 @@ static int authenticate_sleb(struct ubifs_info *c, struct ubifs_scan_leb *sleb,struct ubifs_scan_node *snod;int n_nodes =0 ;int err; -u8 *hash, *hmac; +u8 hash[UBIFS_HASH_ARR_SZ ]; +u8 hmac[UBIFS_HMAC_ARR_SZ ];if (!ubifs_authenticated (c))return sleb->nodes_cnt; - hash =kmalloc (crypto_shash_descsize (c->hash_tfm),GFP_NOFS ); - hmac =kmalloc (c->hmac_desc_len,GFP_NOFS ); -if (!hash || !hmac) { - err = -ENOMEM ; - goto out; - } -list_for_each_entry (snod, &sleb->nodes, list) { n_nodes++;
@@ -662,9 +656,6 @@ static int authenticate_sleb(struct ubifs_info *c, struct ubifs_scan_leb *sleb, err =0 ; } out: -kfree (hash); -kfree (hmac); -return err ? err : n_nodes - n_not_auth; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 89/606 fix multiplication overflow in copy_fdtable()
In reply to Sasha LevinFrom: Al Viro <[email protected]>
[ Upstream commit 4e89b7210403fa4a8acafe7c602b6212b7af6c3b ]
cpy and set really should be size_t; we won't get an overflow on that, since sysctl_nr_open can't be set above ~(size_t)0 / sizeof(void *), so nr that would've managed to overflow size_t on that multiplication won't get anywhere near copy_fdtable() - we'll fail with EMFILE before that.
--- fs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/file.c +1 -1
@@ -70,7 +70,7 @@ static void copy_fd_bitmaps(struct fdtable *nfdt, struct fdtable *ofdt,*/ static void copy_fdtable (struct fdtable *nfdt,struct fdtable *ofdt) { -unsigned int cpy, set; +size_t cpy, set;BUG_ON (nfdt->max_fds < ofdt->max_fds);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 90/606 pipe: Fix pipe_full() test in opipe_prep().
In reply to Sasha LevinFrom: Tetsuo Handa <[email protected]>
[ Upstream commit 566d136289dc57816ac290de87a9a0f7d9bd3cbb ]
syzbot is reporting that splice()ing from non-empty read side to already-full write side causes unkillable task, for opipe_prep() is by error not inverting pipe_full() test.
CPU: 0 PID: 9460 Comm: syz-executor.5 Not tainted 5.6.0-rc3-next-20200228-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:rol32 include/linux/bitops.h:105 [inline]
RIP: 0010:iterate_chain_key kernel/locking/lockdep.c:369 [inline]
RIP: 0010:__lock_acquire+0x6a3/0x5270 kernel/locking/lockdep.c:4178
Call Trace:
lock_acquire+0x197/0x420 kernel/locking/lockdep.c:4720
__mutex_lock_common kernel/locking/mutex.c:956 [inline]
__mutex_lock+0x156/0x13c0 kernel/locking/mutex.c:1103
pipe_lock_nested fs/pipe.c:66 [inline]
pipe_double_lock+0x1a0/0x1e0 fs/pipe.c:104
splice_pipe_to_pipe fs/splice.c:1562 [inline]
do_splice+0x35f/0x1520 fs/splice.c:1141
__do_sys_splice fs/splice.c:1447 [inline]
__se_sys_splice fs/splice.c:1427 [inline]
__x64_sys_splice+0x2b5/0x320 fs/splice.c:1427
do_syscall_64+0xf6/0x790 arch/x86/entry/common.c:295
entry_SYSCALL_64_after_hwframe+0x49/0xbe--- fs/splice.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/splice.c +1 -1
@@ -1503,7 +1503,7 @@ static int opipe_prep(struct pipe_inode_info *pipe, unsigned int flags)* Check pipe occupancy without the inode lock first. This function * is speculative anyways, so missing one is ok. */ -if (pipe_full (pipe->head, pipe->tail, pipe->max_usage)) +if (!pipe_full (pipe->head, pipe->tail, pipe->max_usage))return 0 ; ret =0 ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 92/606 i2c: fix missing pm_runtime_put_sync in i2c_device_probe
In reply to Sasha LevinFrom: Alain Volmat <[email protected]>
[ Upstream commit 3c3dd56f760da056e821ac177e3ad0de4209a435 ]
In case of the I2C client exposes the flag I2C_CLIENT_HOST_NOTIFY, pm_runtime_get_sync is called in order to always keep active the adapter. However later on, pm_runtime_put_sync is never called within the function in case of an error. This commit add this error handling.
--- drivers/i2c/i2c-core-base.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)
drivers/i2c/i2c-core-base.c +16 -6
@@ -338,8 +338,10 @@ static int i2c_device_probe(struct device *dev) }else if (ACPI_COMPANION (dev)) { irq =i2c_acpi_get_irq (client); } -if (irq == -EPROBE_DEFER ) -return irq; +if (irq == -EPROBE_DEFER ) { + status = irq; + goto put_sync_adapter; + }if (irq <0 ) irq =0 ;
@@ -353,15 +355,19 @@ static int i2c_device_probe(struct device *dev)*/ if (!driver->id_table && !i2c_acpi_match_device (dev->driver->acpi_match_table, client) && - !i2c_of_match_device (dev->driver->of_match_table, client)) -return -ENODEV ; + !i2c_of_match_device (dev->driver->of_match_table, client)) { + status = -ENODEV ; + goto put_sync_adapter; + }if (client->flags &I2C_CLIENT_WAKE ) {int wakeirq; wakeirq =of_irq_get_byname (dev->of_node,"wakeup" ); -if (wakeirq == -EPROBE_DEFER ) -return wakeirq; +if (wakeirq == -EPROBE_DEFER ) { + status = wakeirq; + goto put_sync_adapter; + }device_init_wakeup (&client->dev, true);
@@ -408,6 +414,10 @@ static int i2c_device_probe(struct device *dev) err_clear_wakeup_irq:dev_pm_clear_wake_irq (&client->dev);device_init_wakeup (&client->dev, false); +put_sync_adapter: +if (client->flags &I2C_CLIENT_HOST_NOTIFY ) +pm_runtime_put_sync (&client->adapter->dev); +return status; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 94/606 iommu/amd: Fix get_acpihid_device_id()
In reply to Sasha LevinFrom: Raul E Rangel <[email protected]>
[ Upstream commit ea90228c7b2ae6646bb6381385229aabb6f14cd2 ]
acpi_dev_hid_uid_match() expects a null pointer for UID if it doesn't exist. The acpihid_map_entry contains a char buffer for holding the UID. If no UID was provided in the IVRS table, this buffer will be zeroed. If we pass in a null string, acpi_dev_hid_uid_match() will return false because it will try and match an empty string to the ACPI UID of the device.
--- drivers/iommu/amd_iommu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iommu/amd_iommu.c +2 -1
@@ -127,7 +127,8 @@ static inline int get_acpihid_device_id(struct device *dev,return -ENODEV ;list_for_each_entry (p, &acpihid_map, list) { -if (acpi_dev_hid_uid_match (adev, p->hid, p->uid)) { +if (acpi_dev_hid_uid_match (adev, p->hid, + p->uid[0 ] ? p->uid :NULL )) {if (entry) *entry = p;return p->devid;
Signature · 6 lines
2.25.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Sasha Levin
maintainerPATCH 93/606 iommu/amd: Fix over-read of ACPI UID from IVRS table
In reply to Sasha LevinFrom: Alexander Monakov <[email protected]>
[ Upstream commit e461b8c991b9202b007ea2059d953e264240b0c9 ]
IVRS parsing code always tries to read 255 bytes from memory when retrieving ACPI device path, and makes an assumption that firmware provides a zero-terminated string. Both of those are bugs: the entry is likely to be shorter than 255 bytes, and zero-termination is not guaranteed.
With Acer SF314-42 firmware these issues manifest visibly in dmesg:
AMD-Vi: ivrs, add hid:AMDI0020, uid:\_SB.FUR0\xf0\xa5, rdevid:160
AMD-Vi: ivrs, add hid:AMDI0020, uid:\_SB.FUR1\xf0\xa5, rdevid:160
AMD-Vi: ivrs, add hid:AMDI0020, uid:\_SB.FUR2\xf0\xa5, rdevid:160
AMD-Vi: ivrs, add hid:AMDI0020, uid:\_SB.FUR3>\x83e\x8d\x9a\xd1...
The first three lines show how the code over-reads adjacent table entries into the UID, and in the last line it even reads garbage data beyond the end of the IVRS table itself.
Since each entry has the length of the UID (uidl member of ivhd_entry struct), use that for memcpy, and manually add a zero terminator.
Avoid zero-filling hid and uid arrays up front, and instead ensure the uid array is always zero-terminated. No change needed for the hid array, as it was already properly zero-terminated.
--- drivers/iommu/amd_iommu_init.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/iommu/amd_iommu_init.c +5 -4
@@ -1329,8 +1329,8 @@ static int __init init_iommu_from_acpi(struct amd_iommu *iommu, }case IVHD_DEV_ACPI_HID : {u16 devid; -u8 hid[ACPIHID_HID_LEN ] = {0 }; -u8 uid[ACPIHID_UID_LEN ] = {0 }; +u8 hid[ACPIHID_HID_LEN ]; +u8 uid[ACPIHID_UID_LEN ];int ret;if (h->type !=0x40 ) {
@@ -1347,6 +1347,7 @@ static int __init init_iommu_from_acpi(struct amd_iommu *iommu,break ; } + uid[0 ] ='\0' ;switch (e->uidf) {case UID_NOT_PRESENT :
@@ -1361,8 +1362,8 @@ static int __init init_iommu_from_acpi(struct amd_iommu *iommu,break ;case UID_IS_CHARACTER : -memcpy (uid, (u8 *)(&e->uid),ACPIHID_UID_LEN -1 ); - uid[ACPIHID_UID_LEN -1 ] ='\0' ; +memcpy (uid, &e->uid, e->uidl); + uid[e->uidl] ='\0' ;break ;default :
Signature · 6 lines
2.25.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Sasha Levin
maintainerPATCH 95/606 evm: Fix a small race in init_desc()
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit 8433856947217ebb5697a8ff9c4c9cad4639a2cf ]
The IS_ERR_OR_NULL() function has two conditions and if we got really unlucky we could hit a race where "ptr" started as an error pointer and then was set to NULL. Both conditions would be false even though the pointer at the end was NULL.
This patch fixes the problem by ensuring that "*tfm" can only be NULL or valid. I have introduced a "tmp_tfm" variable to make that work. I also reversed a condition and pulled the code in one tab.
--- security/integrity/evm/evm_crypto.c | 44 ++++++++++++++--------------- 1 file changed, 22 insertions(+), 22 deletions(-)
security/integrity/evm/evm_crypto.c +22 -22
@@ -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; +struct crypto_shash **tfm, *tmp_tfm;struct shash_desc *desc;if (type ==EVM_XATTR_HMAC ) {
@@ -93,31 +93,31 @@ static struct shash_desc *init_desc(char type, uint8_t hash_algo) algo = hash_algo_name[hash_algo]; } -if (IS_ERR_OR_NULL (*tfm)) { -mutex_lock (&mutex); -if (*tfm) - goto out; - *tfm =crypto_alloc_shash (algo,0 ,CRYPTO_NOLOAD ); -if (IS_ERR (*tfm)) { - rc =PTR_ERR (*tfm); -pr_err ("Can not allocate %s (reason: %ld)\n" , algo, rc); - *tfm =NULL ; +if (*tfm) + goto alloc; +mutex_lock (&mutex); +if (*tfm) + goto unlock; + + tmp_tfm =crypto_alloc_shash (algo,0 ,CRYPTO_NOLOAD ); +if (IS_ERR (tmp_tfm)) { +pr_err ("Can not allocate %s (reason: %ld)\n" , algo, +PTR_ERR (tmp_tfm)); +mutex_unlock (&mutex); +return ERR_CAST (tmp_tfm); + } +if (type ==EVM_XATTR_HMAC ) { + rc =crypto_shash_setkey (tmp_tfm, evmkey, evmkey_len); +if (rc) { +crypto_free_shash (tmp_tfm);mutex_unlock (&mutex);return ERR_PTR (rc); } -if (type ==EVM_XATTR_HMAC ) { - rc =crypto_shash_setkey (*tfm, evmkey, evmkey_len); -if (rc) { -crypto_free_shash (*tfm); - *tfm =NULL ; -mutex_unlock (&mutex); -return ERR_PTR (rc); - } - } -out: -mutex_unlock (&mutex); } - + *tfm = tmp_tfm; +unlock: +mutex_unlock (&mutex); +alloc: desc =kmalloc (sizeof (*desc) +crypto_shash_descsize (*tfm),GFP_KERNEL );if (!desc)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 96/606 i2c: mux: demux-pinctrl: Fix an error handling path in 'i2c_demux_pinctrl_probe()'
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit e9d1a0a41d4486955e96552293c1fcf1fce61602 ]
A call to 'i2c_demux_deactivate_master()' is missing in the error handling path, as already done in the remove function.
--- drivers/i2c/muxes/i2c-demux-pinctrl.c | 1 + 1 file changed, 1 insertion(+)
drivers/i2c/muxes/i2c-demux-pinctrl.c +1 -0
@@ -272,6 +272,7 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev) err_rollback_available:device_remove_file (&pdev->dev, &dev_attr_available_masters); err_rollback: +i2c_demux_deactivate_master (priv);for (j =0 ; j < i; j++) {of_node_put (priv->chan[j].parent_np);of_changeset_destroy (&priv->chan[j].chgset);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 101/606 kbuild: avoid concurrency issue in parallel building dtbs and dtbs_check
In reply to Sasha LevinFrom: Masahiro Yamada <[email protected]>
[ Upstream commit b5154bf63e5577faaaca1d942df274f7de91dd2a ]
'make dtbs_check' checks the shecma in addition to building *.dtb files, in other words, 'make dtbs_check' is a super-set of 'make dtbs'. So, you do not have to do 'make dtbs dtbs_check', but I want to keep the build system as robust as possible in any use.
Currently, 'dtbs' and 'dtbs_check' are independent of each other. In parallel building, two threads descend into arch/*/boot/dts/, one for dtbs and the other for dtbs_check, then end up with building the same DTB simultaneously.
This commit fixes the concurrency issue. Otherwise, I see build errors like follows:
$ make ARCH=arm64 defconfig $ make -j16 ARCH=arm64 DT_SCHEMA_FILES=Documentation/devicetree/bindings/arm/psci.yaml dtbs dtbs_check <snip> DTC arch/arm64/boot/dts/qcom/sdm845-cheza-r2.dtb DTC arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtb DTC arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-lite2.dtb DTC arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-lite2.dtb DTC arch/arm64/boot/dts/freescale/imx8mn-evk.dtb DTC arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-one-plus.dtb DTC arch/arm64/boot/dts/zte/zx296718-pcbox.dtb DTC arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dt.yaml DTC arch/arm64/boot/dts/amlogic/meson-gxl-s905d-p230.dtb DTC arch/arm64/boot/dts/xilinx/zynqmp-zc1254-revA.dtb DTC arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dtb DTC arch/arm64/boot/dts/rockchip/rk3399-gru-scarlet-inx.dtb DTC arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-one-plus.dtb CHECK arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dt.yaml fixdep: error opening file: arch/arm64/boot/dts/allwinner/.sun50i-h6-orangepi-lite2.dtb.d: No such file or directory make[2]: *** [scripts/Makefile.lib:296: arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-lite2.dtb] Error 2 make[2]: *** Deleting file 'arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-lite2.dtb' make[2]: *** Waiting for unfinished jobs.... DTC arch/arm64/boot/dts/rockchip/rk3399-gru-scarlet-kd.dtb DTC arch/arm64/boot/dts/amlogic/meson-gxl-s905d-p231.dtb DTC arch/arm64/boot/dts/xilinx/zynqmp-zc1275-revA.dtb DTC arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dtb fixdep: parse error; no targets found make[2]: *** [scripts/Makefile.lib:296: arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-one-plus.dtb] Error 1 make[2]: *** Deleting file 'arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-one-plus.dtb' make[1]: *** [scripts/Makefile.build:505: arch/arm64/boot/dts/allwinner] Error 2 make[1]: *** Waiting for unfinished jobs.... DTC arch/arm64/boot/dts/renesas/r8a77951-salvator-xs.dtb
--- Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
Makefile +6 -2
@@ -1248,11 +1248,15 @@ ifneq ($(dtstree),) $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@ PHONY += dtbs dtbs_install dtbs_check -dtbs dtbs_check: include/config/kernel.release scripts_dtc +dtbs: include/config/kernel.release scripts_dtc $(Q)$(MAKE) $(build)=$(dtstree) +ifneq ($(filter dtbs_check, $(MAKECMDGOALS)),) +dtbs: dt_binding_check +endif + dtbs_check: export CHECK_DTBS=1 -dtbs_check: dt_binding_check +dtbs_check: dtbs dtbs_install: $(Q)$(MAKE) $(dtbinst)=$(dtstree)
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 100/606 iommu: Fix deferred domain attachment
In reply to Sasha LevinFrom: Joerg Roedel <[email protected]>
[ Upstream commit bd421264ed307dd296eab036851221b225071a32 ]
The IOMMU core code has support for deferring the attachment of a domain to a device. This is needed in kdump kernels where the new domain must not be attached to a device before the device driver takes it over.
When the AMD IOMMU driver got converted to use the dma-iommu implementation, the deferred attaching got lost. The code in dma-iommu.c has support for deferred attaching, but it calls into iommu_attach_device() to actually do it. But iommu_attach_device() will check if the device should be deferred in it code-path and do nothing, breaking deferred attachment.
Move the is_deferred_attach() check out of the attach_device path and into iommu_group_add_device() to make deferred attaching work from the dma-iommu code.
--- drivers/iommu/iommu.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/iommu/iommu.c +11 -6
@@ -692,6 +692,15 @@ static int iommu_group_create_direct_mappings(struct iommu_group *group,return ret; } +static bool iommu_is_attach_deferred (struct iommu_domain *domain, +struct device *dev) +{ +if (domain->ops->is_attach_deferred) +return domain->ops->is_attach_deferred (domain, dev); + +return false; +} +/** * iommu_group_add_device - add a device to an iommu group * @group: the group into which to add the device (reference should be held)
@@ -746,7 +755,7 @@ int iommu_group_add_device(struct iommu_group *group, struct device *dev)mutex_lock (&group->mutex);list_add_tail (&device->list, &group->devices); -if (group->domain) +if (group->domain && !iommu_is_attach_deferred (group->domain, dev)) ret =__iommu_attach_device (group->domain, dev);mutex_unlock (&group->mutex);if (ret)
@@ -1652,9 +1661,6 @@ static int __iommu_attach_device(struct iommu_domain *domain, struct device *dev) {int ret; -if ((domain->ops->is_attach_deferred !=NULL ) && - domain->ops->is_attach_deferred (domain, dev)) -return 0 ;if (unlikely (domain->ops->attach_dev ==NULL ))return -ENODEV ;
@@ -1726,8 +1732,7 @@ EXPORT_SYMBOL_GPL(iommu_sva_unbind_gpasid);static void __iommu_detach_device (struct iommu_domain *domain,struct device *dev) { -if ((domain->ops->is_attach_deferred !=NULL ) && - domain->ops->is_attach_deferred (domain, dev)) +if (iommu_is_attach_deferred (domain, dev))return ;if (unlikely (domain->ops->detach_dev ==NULL ))
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 106/606 HID: alps: Add AUI1657 device ID
In reply to Sasha LevinFrom: Artem Borisov <[email protected]>
[ Upstream commit 640e403b1fd24e7f31ac6f29f0b6a21d285ed729 ]
This device is used on Lenovo V130-15IKB variants and uses the same registers as U1.
--- drivers/hid/hid-alps.c | 1 + drivers/hid/hid-ids.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/hid/hid-alps.c +1 -0
@@ -802,6 +802,7 @@ static int alps_probe(struct hid_device *hdev, const struct hid_device_id *id)break ;case HID_DEVICE_ID_ALPS_U1_DUAL :case HID_DEVICE_ID_ALPS_U1 : +case HID_DEVICE_ID_ALPS_1657 : data->dev_type =U1 ;break ;default :
drivers/hid/hid-ids.h +1 -1
@@ -81,7 +81,7 @@#define HID_DEVICE_ID_ALPS_U1 0x1215#define HID_DEVICE_ID_ALPS_T4_BTNLESS 0x120C#define HID_DEVICE_ID_ALPS_1222 0x1222 - +#define HID_DEVICE_ID_ALPS_1657 0x121E#define USB_VENDOR_ID_AMI 0x046b#define USB_DEVICE_ID_AMI_VIRT_KEYBOARD_AND_MOUSE 0xff10
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 107/606 HID: alps: ALPS_1657 is too specific; use U1_UNICORN_LEGACY instead
In reply to Sasha LevinFrom: Jiri Kosina <[email protected]>
[ Upstream commit 185af3e775b693f773d9a4b5a8c3cda69fc8ca0f ]
HID_DEVICE_ID_ALPS_1657 PID is too specific, as there are many other ALPS hardware IDs using this particular touchpad.
Rename the identifier to HID_DEVICE_ID_ALPS_U1_UNICORN_LEGACY in order to describe reality better.
--- drivers/hid/hid-alps.c | 2 +- drivers/hid/hid-ids.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/hid/hid-alps.c +1 -1
@@ -802,7 +802,7 @@ static int alps_probe(struct hid_device *hdev, const struct hid_device_id *id)break ;case HID_DEVICE_ID_ALPS_U1_DUAL :case HID_DEVICE_ID_ALPS_U1 : -case HID_DEVICE_ID_ALPS_1657 : +case HID_DEVICE_ID_ALPS_U1_UNICORN_LEGACY : data->dev_type =U1 ;break ;default :
drivers/hid/hid-ids.h +1 -1
@@ -79,9 +79,9 @@#define HID_DEVICE_ID_ALPS_U1_DUAL_PTP 0x121F#define HID_DEVICE_ID_ALPS_U1_DUAL_3BTN_PTP 0x1220#define HID_DEVICE_ID_ALPS_U1 0x1215 +#define HID_DEVICE_ID_ALPS_U1_UNICORN_LEGACY 0x121E#define HID_DEVICE_ID_ALPS_T4_BTNLESS 0x120C#define HID_DEVICE_ID_ALPS_1222 0x1222 -#define HID_DEVICE_ID_ALPS_1657 0x121E#define USB_VENDOR_ID_AMI 0x046b#define USB_DEVICE_ID_AMI_VIRT_KEYBOARD_AND_MOUSE 0xff10
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 108/606 scsi: qla2xxx: Fix hang when issuing nvme disconnect-all in NPIV
In reply to Sasha LevinFrom: Arun Easi <[email protected]>
[ Upstream commit 45a76264c26fd8cfd0c9746196892d9b7e2657ee ]
In NPIV environment, a NPIV host may use a queue pair created by base host or other NPIVs, so the check for a queue pair created by this NPIV is not correct, and can cause an abort to fail, which in turn means the NVME command not returned. This leads to hang in nvme_fc layer in nvme_fc_delete_association() which waits for all I/Os to be returned, which is seen as hang in the application.
--- drivers/scsi/qla2xxx/qla_mbx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_mbx.c +1 -1
@@ -3117,7 +3117,7 @@ qla24xx_abort_command(srb_t *sp)ql_dbg (ql_dbg_mbx + ql_dbg_verbose, vha,0x108c ,"Entered %s.\n" , __func__); -if (vha->flags.qpairs_available && sp->qpair) +if (sp->qpair) req = sp->qpair->req;else return QLA_FUNCTION_FAILED ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 103/606 gcc-common.h: Update for GCC 10
In reply to Sasha LevinFrom: Frédéric Pierret (fepitre) <[email protected]>
[ Upstream commit c7527373fe28f97d8a196ab562db5589be0d34b9 ]
Remove "params.h" include, which has been dropped in GCC 10.
Remove is_a_helper() macro, which is now defined in gimple.h, as seen when running './scripts/gcc-plugin.sh g++ g++ gcc':
In file included from <stdin>:1:./gcc-plugins/gcc-common.h:852:13: error: redefinition of ‘static bool is_a_helper<T>::test(U*) [with U = const gimple; T = const ggoto*]’
852 | inline bool is_a_helper<const ggoto *>::test(const_gimple gs)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./gcc-plugins/gcc-common.h:125,
from <stdin>:1:
/usr/lib/gcc/x86_64-redhat-linux/10/plugin/include/gimple.h:1037:1: note: ‘static bool is_a_helper<T>::test(U*) [with U = const gimple; T = const ggoto*]’ previously declared here
1037 | is_a_helper <const ggoto *>::test (const gimple *gs)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~Add -Wno-format-diag to scripts/gcc-plugins/Makefile to avoid meaningless warnings from error() formats used by plugins:
scripts/gcc-plugins/structleak_plugin.c: In function ‘int plugin_init(plugin_name_args*, plugin_gcc_version*)’:scripts/gcc-plugins/structleak_plugin.c:253:12: warning: unquoted sequence of 2 consecutive punctuation characters ‘'-’ in format [-Wformat-diag]
253 | error(G_("unknown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--- scripts/gcc-plugins/Makefile | 1 + scripts/gcc-plugins/gcc-common.h | 4 ++++ 2 files changed, 5 insertions(+)
scripts/gcc-plugins/Makefile +1 -0
@@ -11,6 +11,7 @@ else HOST_EXTRACXXFLAGS += -I$(GCC_PLUGINS_DIR)/include -I$(src) -std=gnu++98 -fno-rtti HOST_EXTRACXXFLAGS += -fno-exceptions -fasynchronous-unwind-tables -ggdb HOST_EXTRACXXFLAGS += -Wno-narrowing -Wno-unused-variable + HOST_EXTRACXXFLAGS += -Wno-format-diag export HOST_EXTRACXXFLAGS endif
scripts/gcc-plugins/gcc-common.h +4 -0
@@ -35,7 +35,9 @@#include "ggc.h" #include "timevar.h" +#if BUILDING_GCC_VERSION <10000 #include "params.h" +#endif #if BUILDING_GCC_VERSION <=4009 #include "pointer-set.h"
@@ -847,6 +849,7 @@ static inline gimple gimple_build_assign_with_ops(enum tree_code subcode, tree l return gimple_build_assign(lhs, subcode, op1, op2 PASS_MEM_STAT); } +#if BUILDING_GCC_VERSION <10000 template <> template <> inline bool is_a_helper<const ggoto *>::test(const_gimple gs)
@@ -860,6 +863,7 @@ inline bool is_a_helper<const greturn *>::test(const_gimple gs) {return gs->code ==GIMPLE_RETURN ; } +#endif static inline gasm *as_a_gasm (gimple stmt) {
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 121/606 gtp: set NLM_F_MULTI flag in gtp_genl_dump_pdp()
In reply to Sasha LevinFrom: Yoshiyuki Kurauchi <[email protected]>
[ Upstream commit 846c68f7f1ac82c797a2f1db3344a2966c0fe2e1 ]
In drivers/net/gtp.c, gtp_genl_dump_pdp() should set NLM_F_MULTI flag since it returns multipart message.
This patch adds a new arg "flags" in gtp_genl_fill_info() so that flags can be set by the callers.
--- drivers/net/gtp.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/gtp.c +5 -4
@@ -1169,11 +1169,11 @@ static int gtp_genl_del_pdp(struct sk_buff *skb, struct genl_info *info)static struct genl_family gtp_genl_family;static int gtp_genl_fill_info (struct sk_buff *skb,u32 snd_portid,u32 snd_seq, -u32 type,struct pdp_ctx *pctx) +int flags,u32 type,struct pdp_ctx *pctx) {void *genlh; - genlh =genlmsg_put (skb, snd_portid, snd_seq, >p_genl_family,0 , + genlh =genlmsg_put (skb, snd_portid, snd_seq, >p_genl_family, flags, type);if (genlh ==NULL ) goto nlmsg_failure;
@@ -1227,8 +1227,8 @@ static int gtp_genl_get_pdp(struct sk_buff *skb, struct genl_info *info) goto err_unlock; } - err =gtp_genl_fill_info (skb2,NETLINK_CB (skb).portid, - info->snd_seq, info->nlhdr->nlmsg_type, pctx); + err =gtp_genl_fill_info (skb2,NETLINK_CB (skb).portid, info->snd_seq, +0 , info->nlhdr->nlmsg_type, pctx);if (err <0 ) goto err_unlock_free;
@@ -1271,6 +1271,7 @@ static int gtp_genl_dump_pdp(struct sk_buff *skb,gtp_genl_fill_info (skb,NETLINK_CB (cb->skb).portid, cb->nlh->nlmsg_seq, +NLM_F_MULTI , cb->nlh->nlmsg_type, pctx)) { cb->args[0] = i; cb->args[1 ] = j;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 127/606 iommu/amd: Do not loop forever when trying to increase address space
In reply to Sasha LevinFrom: Joerg Roedel <[email protected]>
[ Upstream commit 5b8a9a047b6cad361405c7900c1e1cdd378c4589 ]
When increase_address_space() fails to allocate memory, alloc_pte() will call it again until it succeeds. Do not loop forever while trying to increase the address space and just return an error instead.
--- drivers/iommu/amd_iommu.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/iommu/amd_iommu.c +12 -1
@@ -1500,8 +1500,19 @@ static u64 *alloc_pte(struct protection_domain *domain,amd_iommu_domain_get_pgtable (domain, &pgtable);while (address >PM_LEVEL_SIZE (pgtable.mode)) { - *updated =increase_address_space (domain, address, gfp) || *updated; +bool upd =increase_address_space (domain, address, gfp); + +/* Read new values to check if update was successful */ amd_iommu_domain_get_pgtable (domain, &pgtable); + +/* +* Return an error if there is no memory to update the +* page-table. +*/ +if (!upd && (address >PM_LEVEL_SIZE (pgtable.mode))) +return NULL ; + + *updated = *updated || upd; }
Signature · 6 lines
2.25.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Sasha Levin
maintainerPATCH 128/606 iommu/amd: Call domain_flush_complete() in update_domain()
In reply to Sasha LevinFrom: Joerg Roedel <[email protected]>
[ Upstream commit f44a4d7e4f1cdef73c90b1dc749c4d8a7372a8eb ]
The update_domain() function is expected to also inform the hardware about domain changes. This needs a COMPLETION_WAIT command to be sent to all IOMMUs which use the domain.
--- drivers/iommu/amd_iommu.c | 1 + 1 file changed, 1 insertion(+)
drivers/iommu/amd_iommu.c +1 -0
@@ -2345,6 +2345,7 @@ static void update_domain(struct protection_domain *domain)/* Flush domain TLB(s) and wait for completion */ domain_flush_tlb_pde (domain); +domain_flush_complete (domain); }int __init amd_iommu_init_api (void )
Signature · 6 lines
2.25.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Sasha Levin
maintainerPATCH 129/606 drm/amd/display: fix counter in wait_for_no_pipes_pending
In reply to Sasha LevinFrom: Roman Li <[email protected]>
[ Upstream commit 80797dd6f1a525d1160c463d6a9f9d29af182cbb ]
[Why]
Wait counter is not being reset for each pipe.
[How]
Move counter reset into pipe loop scope.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +2 -3
@@ -803,11 +803,10 @@ static void disable_dangling_plane(struct dc *dc, struct dc_state *context)static void wait_for_no_pipes_pending (struct dc *dc,struct dc_state *context) {int i; -int count =0 ; -struct pipe_ctx *pipe;PERF_TRACE ();for (i =0 ; i <MAX_PIPES ; i++) { - pipe = &context->res_ctx.pipe_ctx[i]; +int count =0 ; +struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];if (!pipe->plane_state)continue ;
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 130/606 drm/amd/display: Prevent dpcd reads with passive dongles
In reply to Sasha LevinFrom: Aurabindo Pillai <[email protected]>
[ Upstream commit e6142dd511425cb827b5db869f489eb81f5f994d ]
[why]
During hotplug, a DP port may be connected to the sink through passive adapter which does not support DPCD reads. Issuing reads without checking for this condition will result in errors
[how]
Ensure the link is in aux_mode before initiating operation that result in a DPCD read.
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +11 -6
@@ -1941,17 +1941,22 @@ amdgpu_dm_update_connector_after_detect(struct amdgpu_dm_connector *aconnector)dc_sink_retain (aconnector->dc_sink);if (sink->dc_edid.length ==0 ) { aconnector->edid =NULL ; -drm_dp_cec_unset_edid (&aconnector->dm_dp_aux.aux); +if (aconnector->dc_link->aux_mode) { +drm_dp_cec_unset_edid ( + &aconnector->dm_dp_aux.aux); + } }else { aconnector->edid = - (struct edid *) sink->dc_edid.raw_edid; - + (struct edid *)sink->dc_edid.raw_edid;drm_connector_update_edid_property (connector, - aconnector->edid); -drm_dp_cec_set_edid (&aconnector->dm_dp_aux.aux, - aconnector->edid); + aconnector->edid); + +if (aconnector->dc_link->aux_mode) +drm_dp_cec_set_edid (&aconnector->dm_dp_aux.aux, + aconnector->edid); } +amdgpu_dm_update_freesync_caps (connector, aconnector->edid); }else {
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 139/606 ALSA: hda/realtek - Enable headset mic of ASUS UX550GE with ALC295
In reply to Sasha LevinFrom: Jian-Hong Pan <[email protected]>
[ Upstream commit ad97d667854c2fbce05a004e107f358ef4b04cf6 ]
The ASUS laptop UX550GE with ALC295 can't detect the headset microphone until ALC295_FIXUP_ASUS_MIC_NO_PRESENCE quirk applied.
--- sound/pci/hda/patch_realtek.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/pci/hda/patch_realtek.c +4 -0
@@ -8050,6 +8050,10 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { {0x12, 0x90a60130}, {0x17, 0x90170110}, {0x21, 0x03211020}), + SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE, + {0x12, 0x90a60120}, + {0x17, 0x90170110}, + {0x21, 0x04211030}), SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE, {0x12, 0x90a60130}, {0x17, 0x90170110},
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 142/606 bpf: Add bpf_probe_read_{user, kernel}_str() to do_refine_retval_range
In reply to Sasha LevinFrom: Daniel Borkmann <[email protected]>
commit 47cc0ed574abcbbde0cf143ddb21a0baed1aa2df upstream.
Given bpf_probe_read{,str}() BPF helpers are now only available under CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE, we need to add the drop-in replacements of bpf_probe_read_{kernel,user}_str() to do_refine_retval_range() as well to avoid hitting the same issue as in 849fa50662fbc ("bpf/verifier:
refine retval R0 state for bpf_get_stack helper").
--- kernel/bpf/verifier.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/bpf/verifier.c +3 -1
@@ -4113,7 +4113,9 @@ static int do_refine_retval_range(struct bpf_verifier_env *env,if (ret_type !=RET_INTEGER || (func_id != BPF_FUNC_get_stack && - func_id != BPF_FUNC_probe_read_str)) + func_id != BPF_FUNC_probe_read_str && + func_id != BPF_FUNC_probe_read_kernel_str && + func_id != BPF_FUNC_probe_read_user_str))return 0 ;/* Error case where ret is in interval [S32MIN, -1]. */
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 19/606 bootconfig: Fix to prevent warning message if no bootconfig option
In reply to Sasha LevinFrom: Masami Hiramatsu <[email protected]>
commit 611d0a95d46b0977a530b4d538948c69d447b001 upstream.
Commit de462e5f1071 ("bootconfig: Fix to remove bootconfig data from initrd while boot") causes a cosmetic regression on dmesg, which warns "no bootconfig data" message without bootconfig cmdline option.
Fix setup_boot_config() by moving no bootconfig check after commandline option check.
--- init/main.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
init/main.c +6 -4
@@ -398,9 +398,8 @@ static void __init setup_boot_config(const char *cmdline)char *data, *copy;int ret; +/* Cut out the bootconfig data even if we have no bootconfig option */ data =get_boot_config_from_initrd (&size, &csum); -if (!data) - goto not_found;strlcpy (tmp_cmdline, boot_command_line,COMMAND_LINE_SIZE ); parse_args("bootconfig", tmp_cmdline, NULL, 0, 0, 0, NULL,
@@ -409,6 +408,11 @@ static void __init setup_boot_config(const char *cmdline)if (!bootconfig_found)return ; +if (!data) { +pr_err ("'bootconfig' found on command line, but no bootconfig found\n" ); +return ; + } +if (size >=XBC_DATA_MAX ) {pr_err ("bootconfig size %d greater than max size %d\n" , size,XBC_DATA_MAX );
@@ -440,8 +444,6 @@ static void __init setup_boot_config(const char *cmdline) extra_init_args = xbc_make_cmdline("init"); }return ; -not_found: -pr_err ("'bootconfig' found on command line, but no bootconfig found\n" ); }#else
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 151/606 drm/etnaviv: fix perfmon domain interation
In reply to Sasha LevinFrom: Christian Gmeiner <[email protected]>
commit 40b697e256ccdb88aaff424b44b4d300eb8460e8 upstream.
The GC860 has one GPU device which has a 2d and 3d core. In this case we want to expose perfmon information for both cores.
The driver has one array which contains all possible perfmon domains with some meta data - doms_meta. Here we can see that for the GC860 two elements of that array are relevant:
doms_3d: is at index 0 in the doms_meta array with 8 perfmon domains
doms_2d: is at index 1 in the doms_meta array with 1 perfmon domain
The userspace driver wants to get a list of all perfmon domains and their perfmon signals. This is done by iterating over all domains and their signals. If the userspace driver wants to access the domain with id 8 the kernel driver fails and returns invalid data from doms_3d with and invalid offset.
This results in:
Unable to handle kernel paging request at virtual address 00000000
On such a device it is not possible to use the userspace driver at all.
The fix for this off-by-one error is quite simple.
--- drivers/gpu/drm/etnaviv/etnaviv_perfmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/etnaviv/etnaviv_perfmon.c +1 -1
@@ -453,7 +453,7 @@ static const struct etnaviv_pm_domain *pm_domain(const struct etnaviv_gpu *gpu,if (!(gpu->identity.features & meta->feature))continue ; -if (meta->nr_domains < (index - offset)) { +if (index - offset >= meta->nr_domains) { offset += meta->nr_domains;continue ; }
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 157/606 drm/etnaviv: Fix a leak in submit_pin_objects()
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
commit ad99cb5e783bb03d512092db3387ead9504aad3d upstream.
If the mapping address is wrong then we have to release the reference to it before returning -EINVAL.
--- drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c +3 -1
@@ -238,8 +238,10 @@ static int submit_pin_objects(struct etnaviv_gem_submit *submit) }if ((submit->flags &ETNA_SUBMIT_SOFTPIN ) && - submit->bos[i].va != mapping->iova) + submit->bos[i].va != mapping->iova) { +etnaviv_gem_mapping_unreference (mapping);return -EINVAL ; + }atomic_inc (&etnaviv_obj->gpu_active);
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 24/606 ALSA: rawmidi: Fix racy buffer resize under concurrent accesses
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
commit c1f6e3c818dd734c30f6a7eeebf232ba2cf3181d upstream.
The rawmidi core allows user to resize the runtime buffer via ioctl, and this may lead to UAF when performed during concurrent reads or
writes: the read/write functions unlock the runtime lock temporarily during copying form/to user-space, and that's the race window.
This patch fixes the hole by introducing a reference counter for the runtime buffer read/write access and returns -EBUSY error when the resize is performed concurrently against read/write.
Note that the ref count field is a simple integer instead of refcount_t here, since the all contexts accessing the buffer is basically protected with a spinlock, hence we need no expensive atomic ops. Also, note that this busy check is needed only against read / write functions, and not in receive/transmit callbacks; the race can happen only at the spinlock hole mentioned in the above, while the whole function is protected for receive / transmit callbacks.
--- include/sound/rawmidi.h | 1 + sound/core/rawmidi.c | 31 +++++++++++++++++++++++++++---- 2 files changed, 28 insertions(+), 4 deletions(-)
include/sound/rawmidi.h +1 -0
@@ -61,6 +61,7 @@ struct snd_rawmidi_runtime {size_t avail_min;/* min avail for wakeup */ size_t avail;/* max used buffer for wakeup */ size_t xruns;/* over/underruns counter */ +int buffer_ref;/* buffer reference count */ /* misc */ spinlock_t lock;wait_queue_head_t sleep;
sound/core/rawmidi.c +27 -4
@@ -120,6 +120,17 @@ static void snd_rawmidi_input_event_work(struct work_struct *work) runtime->event (runtime->substream); } +/* buffer refcount management: call with runtime->lock held */ +static inline void snd_rawmidi_buffer_ref (struct snd_rawmidi_runtime *runtime) +{ + runtime->buffer_ref++; +} + +static inline void snd_rawmidi_buffer_unref (struct snd_rawmidi_runtime *runtime) +{ + runtime->buffer_ref--; +} +static int snd_rawmidi_runtime_create (struct snd_rawmidi_substream *substream) {struct snd_rawmidi_runtime *runtime;
@@ -669,6 +680,11 @@ static int resize_runtime_buffer(struct snd_rawmidi_runtime *runtime,if (!newbuf)return -ENOMEM ;spin_lock_irq (&runtime->lock); +if (runtime->buffer_ref) { +spin_unlock_irq (&runtime->lock); +kvfree (newbuf); +return -EBUSY ; + } oldbuf = runtime->buffer; runtime->buffer = newbuf; runtime->buffer_size = params->buffer_size;
@@ -1019,8 +1035,10 @@ static long snd_rawmidi_kernel_read1(struct snd_rawmidi_substream *substream,long result =0 , count1;struct snd_rawmidi_runtime *runtime = substream->runtime;unsigned long appl_ptr; +int err =0 ;spin_lock_irqsave (&runtime->lock, flags); +snd_rawmidi_buffer_ref (runtime);while (count >0 && runtime->avail) { count1 = runtime->buffer_size - runtime->appl_ptr;if (count1 > count)
@@ -1039,16 +1057,19 @@ static long snd_rawmidi_kernel_read1(struct snd_rawmidi_substream *substream,if (userbuf) {spin_unlock_irqrestore (&runtime->lock, flags);if (copy_to_user (userbuf + result, - runtime->buffer + appl_ptr, count1)) { -return result >0 ? result : -EFAULT ; - } + runtime->buffer + appl_ptr, count1)) + err = -EFAULT ;spin_lock_irqsave (&runtime->lock, flags); +if (err) + goto out; } result += count1; count -= count1; } + out: +snd_rawmidi_buffer_unref (runtime);spin_unlock_irqrestore (&runtime->lock, flags); -return result; +return result >0 ? result : err; } long snd_rawmidi_kernel_read(struct snd_rawmidi_substream *substream,
@@ -1342,6 +1363,7 @@ static long snd_rawmidi_kernel_write1(struct snd_rawmidi_substream *substream,return -EAGAIN ; } } +snd_rawmidi_buffer_ref (runtime);while (count >0 && runtime->avail >0 ) { count1 = runtime->buffer_size - runtime->appl_ptr;if (count1 > count)
@@ -1373,6 +1395,7 @@ static long snd_rawmidi_kernel_write1(struct snd_rawmidi_substream *substream, } __end: count1 = runtime->avail < runtime->buffer_size; +snd_rawmidi_buffer_unref (runtime);spin_unlock_irqrestore (&runtime->lock, flags);if (count1)snd_rawmidi_output_trigger (substream,1 );
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 162/606 drm/i915/gvt: Init DPLL/DDI vreg for virtual display instead of inheritance.
In reply to Sasha LevinFrom: Colin Xu <[email protected]>
commit f965b68188ab59a40a421ced1b05a2fea638465c upstream.
Init value of some display vregs rea inherited from host pregs. When host display in different status, i.e. all monitors unpluged, different display configurations, etc., GVT virtual display setup don't consistent thus may lead to guest driver consider display goes malfunctional.
The added init vreg values are based on PRMs and fixed by calcuation from current configuration (only PIPE_A) and the virtual EDID.
--- drivers/gpu/drm/i915/gvt/display.c | 49 +++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/gvt/display.c +44 -5
@@ -207,14 +207,41 @@ static void emulate_monitor_status_change(struct intel_vgpu *vgpu)SKL_FUSE_PG_DIST_STATUS (SKL_PG0 ) |SKL_FUSE_PG_DIST_STATUS (SKL_PG1 ) |SKL_FUSE_PG_DIST_STATUS (SKL_PG2 ); -vgpu_vreg_t (vgpu,LCPLL1_CTL ) |= -LCPLL_PLL_ENABLE | -LCPLL_PLL_LOCK ; -vgpu_vreg_t (vgpu,LCPLL2_CTL ) |=LCPLL_PLL_ENABLE ; - +/* +* Only 1 PIPE enabled in current vGPU display and PIPE_A is +* tied to TRANSCODER_A in HW, so it's safe to assume PIPE_A, +* TRANSCODER_A can be enabled. PORT_x depends on the input of +* setup_virtual_dp_monitor, we can bind DPLL0 to any PORT_x +* so we fixed to DPLL0 here. +* Setup DPLL0: DP link clk 1620 MHz, non SSC, DP Mode +*/ +vgpu_vreg_t (vgpu,DPLL_CTRL1 ) = +DPLL_CTRL1_OVERRIDE (DPLL_ID_SKL_DPLL0 ); +vgpu_vreg_t (vgpu,DPLL_CTRL1 ) |= +DPLL_CTRL1_LINK_RATE (DPLL_CTRL1_LINK_RATE_1620 ,DPLL_ID_SKL_DPLL0 ); +vgpu_vreg_t (vgpu,LCPLL1_CTL ) = +LCPLL_PLL_ENABLE |LCPLL_PLL_LOCK ; +vgpu_vreg_t (vgpu,DPLL_STATUS ) =DPLL_LOCK (DPLL_ID_SKL_DPLL0 ); +/* +* Golden M/N are calculated based on: +* 24 bpp, 4 lanes, 154000 pixel clk (from virtual EDID), +* DP link clk 1620 MHz and non-constant_n. +* TODO: calculate DP link symbol clk and stream clk m/n. +*/ +vgpu_vreg_t (vgpu,PIPE_DATA_M1 (TRANSCODER_A )) =63 <<TU_SIZE_SHIFT ; +vgpu_vreg_t (vgpu,PIPE_DATA_M1 (TRANSCODER_A )) |=0x5b425e ; +vgpu_vreg_t (vgpu,PIPE_DATA_N1 (TRANSCODER_A )) =0x800000 ; +vgpu_vreg_t (vgpu,PIPE_LINK_M1 (TRANSCODER_A )) =0x3cd6e ; +vgpu_vreg_t (vgpu,PIPE_LINK_N1 (TRANSCODER_A )) =0x80000 ; }if (intel_vgpu_has_monitor_on_port (vgpu,PORT_B )) { +vgpu_vreg_t (vgpu,DPLL_CTRL2 ) &= + ~DPLL_CTRL2_DDI_CLK_OFF (PORT_B ); +vgpu_vreg_t (vgpu,DPLL_CTRL2 ) |= +DPLL_CTRL2_DDI_CLK_SEL (DPLL_ID_SKL_DPLL0 ,PORT_B ); +vgpu_vreg_t (vgpu,DPLL_CTRL2 ) |= +DPLL_CTRL2_DDI_SEL_OVERRIDE (PORT_B );vgpu_vreg_t (vgpu,SFUSE_STRAP ) |=SFUSE_STRAP_DDIB_DETECTED ; vgpu_vreg_t(vgpu, TRANS_DDI_FUNC_CTL(TRANSCODER_A)) &= ~(TRANS_DDI_BPC_MASK | TRANS_DDI_MODE_SELECT_MASK |
@@ -235,6 +262,12 @@ static void emulate_monitor_status_change(struct intel_vgpu *vgpu) }if (intel_vgpu_has_monitor_on_port (vgpu,PORT_C )) { +vgpu_vreg_t (vgpu,DPLL_CTRL2 ) &= + ~DPLL_CTRL2_DDI_CLK_OFF (PORT_C ); +vgpu_vreg_t (vgpu,DPLL_CTRL2 ) |= +DPLL_CTRL2_DDI_CLK_SEL (DPLL_ID_SKL_DPLL0 ,PORT_C ); +vgpu_vreg_t (vgpu,DPLL_CTRL2 ) |= +DPLL_CTRL2_DDI_SEL_OVERRIDE (PORT_C );vgpu_vreg_t (vgpu,SDEISR ) |=SDE_PORTC_HOTPLUG_CPT ; vgpu_vreg_t(vgpu, TRANS_DDI_FUNC_CTL(TRANSCODER_A)) &= ~(TRANS_DDI_BPC_MASK | TRANS_DDI_MODE_SELECT_MASK |
@@ -255,6 +288,12 @@ static void emulate_monitor_status_change(struct intel_vgpu *vgpu) }if (intel_vgpu_has_monitor_on_port (vgpu,PORT_D )) { +vgpu_vreg_t (vgpu,DPLL_CTRL2 ) &= + ~DPLL_CTRL2_DDI_CLK_OFF (PORT_D ); +vgpu_vreg_t (vgpu,DPLL_CTRL2 ) |= +DPLL_CTRL2_DDI_CLK_SEL (DPLL_ID_SKL_DPLL0 ,PORT_D ); +vgpu_vreg_t (vgpu,DPLL_CTRL2 ) |= +DPLL_CTRL2_DDI_SEL_OVERRIDE (PORT_D );vgpu_vreg_t (vgpu,SDEISR ) |=SDE_PORTD_HOTPLUG_CPT ; vgpu_vreg_t(vgpu, TRANS_DDI_FUNC_CTL(TRANSCODER_A)) &= ~(TRANS_DDI_BPC_MASK | TRANS_DDI_MODE_SELECT_MASK |
Signature · 6 lines
2.25.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Sasha Levin
maintainerPATCH 163/606 drm/i915: Propagate error from completed fences
In reply to Sasha LevinFrom: Chris Wilson <[email protected]>
commit bc850943486887e3859597a266767f95db90aa72 upstream.
We need to preserve fatal errors from fences that are being terminated as we hook them up.
--- drivers/gpu/drm/i915/i915_request.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_request.c +3 -1
@@ -947,8 +947,10 @@ i915_request_await_request(struct i915_request *to, struct i915_request *from)GEM_BUG_ON (to == from);GEM_BUG_ON (to->timeline == from->timeline); -if (i915_request_completed (from)) +if (i915_request_completed (from)) { +i915_sw_fence_set_error_once (&to->submit, from->fence.error);return 0 ; + }if (to->engine->schedule) { ret = i915_sched_node_add_dependency(&to->sched,
Signature · 6 lines
2.25.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Sasha Levin
maintainerPATCH 168/606 kbuild: Remove debug info from kallsyms linking
In reply to Sasha LevinFrom: Kees Cook <[email protected]>
[ Upstream commit af73d78bd384aa9b8789aa6e7ddbb165f971276f ]
When CONFIG_DEBUG_INFO is enabled, the two kallsyms linking steps spend time collecting and writing the dwarf sections to the temporary output files. kallsyms does not need this information, and leaving it off halves their linking time. This is especially noticeable without CONFIG_DEBUG_INFO_REDUCED. The BTF linking stage, however, does still need those details.
Refactor the BTF and kallsyms generation stages slightly for more regularized temporary names. Skip debug during kallsyms links. Additionally move "info BTF" to the correct place since commit 8959e39272d6 ("kbuild: Parameterize kallsyms generation and correct reporting"), which added "info LD ..." to vmlinux_link calls.
For a full debug info build with BTF, my link time goes from 1m06s to 0m54s, saving about 12 seconds, or 18%.
--- scripts/link-vmlinux.sh | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-)
scripts/link-vmlinux.sh +19 -9
@@ -63,12 +63,18 @@ vmlinux_link() local lds="${objtree}/${KBUILD_LDS}" local output=${1} local objects + local strip_debug info LD ${output} # skip output file argument shift + # The kallsyms linking does not need debug symbols included. + if [ "$output" != "${output#.tmp_vmlinux.kallsyms}" ] ; then + strip_debug=-Wl,--strip-debug + fi + if [ "${SRCARCH}" != "um" ]; then objects="--whole-archive \ ${KBUILD_VMLINUX_OBJS} \
@@ -79,6 +85,7 @@ vmlinux_link() ${@}" ${LD} ${KBUILD_LDFLAGS} ${LDFLAGS_vmlinux} \ + ${strip_debug#-Wl,} \ -o ${output} \ -T ${lds} ${objects} else
@@ -91,6 +98,7 @@ vmlinux_link() ${@}" ${CC} ${CFLAGS_vmlinux} \ + ${strip_debug} \ -o ${output} \ -Wl,-T,${lds} \ ${objects} \
@@ -106,6 +114,8 @@ gen_btf() { local pahole_ver local bin_arch + local bin_format + local bin_file if ! [ -x "$(command -v ${PAHOLE})" ]; then echo >&2 "BTF: ${1}: pahole (${PAHOLE}) is not available"
@@ -118,8 +128,9 @@ gen_btf() return 1 fi - info "BTF" ${2} vmlinux_link ${1} + + info "BTF" ${2} LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} -J ${1} # dump .BTF section into raw binary file to link with final vmlinux
@@ -127,11 +138,12 @@ gen_btf() cut -d, -f1 | cut -d' ' -f2) bin_format=$(LANG=C ${OBJDUMP} -f ${1} | grep 'file format' | \ awk '{print $4}') + bin_file=.btf.vmlinux.bin ${OBJCOPY} --change-section-address .BTF=0 \ --set-section-flags .BTF=alloc -O binary \ - --only-section=.BTF ${1} .btf.vmlinux.bin + --only-section=.BTF ${1} $bin_file ${OBJCOPY} -I binary -O ${bin_format} -B ${bin_arch} \ - --rename-section .data=.BTF .btf.vmlinux.bin ${2} + --rename-section .data=.BTF $bin_file ${2} } # Create ${2} .o file with all symbols from the ${1} object file
@@ -166,8 +178,8 @@ kallsyms() kallsyms_step() { kallsymso_prev=${kallsymso} - kallsymso=.tmp_kallsyms${1}.o - kallsyms_vmlinux=.tmp_vmlinux${1} + kallsyms_vmlinux=.tmp_vmlinux.kallsyms${1} + kallsymso=${kallsyms_vmlinux}.o vmlinux_link ${kallsyms_vmlinux} "${kallsymso_prev}" ${btf_vmlinux_bin_o} kallsyms ${kallsyms_vmlinux} ${kallsymso}
@@ -190,7 +202,6 @@ cleanup() { rm -f .btf.* rm -f .tmp_System.map - rm -f .tmp_kallsyms* rm -f .tmp_vmlinux* rm -f System.map rm -f vmlinux
@@ -257,9 +268,8 @@ tr '\0' '\n' < modules.builtin.modinfo | sed -n 's/^[[:alnum:]:_]*\.file=//p' | btf_vmlinux_bin_o="" if [ -n "${CONFIG_DEBUG_INFO_BTF}" ]; then - if gen_btf .tmp_vmlinux.btf .btf.vmlinux.bin.o ; then - btf_vmlinux_bin_o=.btf.vmlinux.bin.o - else + btf_vmlinux_bin_o=.btf.vmlinux.bin.o + if ! gen_btf .tmp_vmlinux.btf $btf_vmlinux_bin_o ; then echo >&2 "Failed to generate BTF for vmlinux" echo >&2 "Try to disable CONFIG_DEBUG_INFO_BTF" exit 1
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 43/606 x86/unwind/orc: Fix error handling in __unwind_start()
In reply to Sasha LevinFrom: Josh Poimboeuf <[email protected]>
commit 71c95825289f585014fe9741b051d32a7a916680 upstream.
The unwind_state 'error' field is used to inform the reliable unwinding code that the stack trace can't be trusted. Set this field for all errors in __unwind_start().
Also, move the zeroing out of the unwind_state struct to before the ORC table initialization check, to prevent the caller from reading uninitialized data if the ORC table is corrupted.
--- arch/x86/kernel/unwind_orc.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
arch/x86/kernel/unwind_orc.c +9 -7
@@ -611,23 +611,23 @@ EXPORT_SYMBOL_GPL(unwind_next_frame);void __unwind_start (struct unwind_state *state,struct task_struct *task,struct pt_regs *regs,unsigned long *first_frame) { -if (!orc_init) - goto done; -memset (state,0 ,sizeof (*state)); state->task = task; +if (!orc_init) + goto err; +/* * Refuse to unwind the stack of a task while it's executing on another * CPU. This check is racy, but that's ok: the unwinder has other * checks to prevent it from going off the rails. */ if (task_on_another_cpu (task)) - goto done; + goto err;if (regs) {if (user_mode (regs)) - goto done; + goto the_end; state->ip = regs->ip; state->sp = regs->sp;
@@ -660,6 +660,7 @@ void __unwind_start(struct unwind_state *state, struct task_struct *task,* generate some kind of backtrace if this happens. */ void *next_page = (void *)PAGE_ALIGN ((unsigned long )state->sp); + state->error = true;if (get_stack_info (next_page, state->task, &state->stack_info, &state->stack_mask))return ;
@@ -685,8 +686,9 @@ void __unwind_start(struct unwind_state *state, struct task_struct *task,return ; -done: +err: + state->error = true; +the_end: state->stack_info.type =STACK_TYPE_UNKNOWN ; -return ; }EXPORT_SYMBOL_GPL (__unwind_start);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 25/606 ALSA: usb-audio: Add control message quirk delay for Kingston HyperX headset
In reply to Sasha LevinFrom: Jesus Ramos <[email protected]>
commit 073919e09ca445d4486968e3f851372ff44cf2b5 upstream.
Kingston HyperX headset with 0951:16ad also needs the same quirk for delaying the frequency controls.
--- sound/usb/quirks.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
sound/usb/quirks.c +5 -4
@@ -1592,13 +1592,14 @@ void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe, && (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS)msleep (20 ); -/* Zoom R16/24, Logitech H650e, Jabra 550a needs a tiny delay here, -* otherwise requests like get/set frequency return as failed despite -* actually succeeding. +/* Zoom R16/24, Logitech H650e, Jabra 550a, Kingston HyperX needs a tiny +* delay here, otherwise requests like get/set frequency return as +* failed despite actually succeeding. */ if ((chip->usb_id ==USB_ID (0x1686 ,0x00dd ) || chip->usb_id ==USB_ID (0x046d ,0x0a46 ) || - chip->usb_id ==USB_ID (0x0b0e ,0x0349 )) && + chip->usb_id ==USB_ID (0x0b0e ,0x0349 ) || + chip->usb_id ==USB_ID (0x0951 ,0x16ad )) && (requesttype &USB_TYPE_MASK ) ==USB_TYPE_CLASS )usleep_range (1000 ,2000 ); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 180/606 misc: rtsx: Add short delay after exit from ASPM
In reply to Sasha LevinFrom: Klaus Doth <[email protected]>
commit 7a839dbab1be59f5ed3b3b046de29e166784c9b4 upstream.
DMA transfers to and from the SD card stall for 10 seconds and run into timeout on RTS5260 card readers after ASPM was enabled.
Adding a short msleep after disabling ASPM fixes the issue on several Dell Precision 7530/7540 systems I tested.
This function is only called when waking up after the chip went into power-save after not transferring data for a few seconds. The added msleep does therefore not change anything in data transfer speed or induce any excessive waiting while data transfers are running, or the chip is sleeping. Only the transition from sleep to active is affected.
--- drivers/misc/cardreader/rtsx_pcr.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/misc/cardreader/rtsx_pcr.c +3 -0
@@ -142,6 +142,9 @@ static void rtsx_comm_pm_full_on(struct rtsx_pcr *pcr)rtsx_disable_aspm (pcr); +/* Fixes DMA transfer timout issue after disabling ASPM on RTS5260 */ +msleep (1 ); +if (option->ltr_enabled)rtsx_set_ltr_latency (pcr, option->ltr_active_latency);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 181/606 tty: serial: add missing spin_lock_init for SiFive serial console
In reply to Sasha LevinFrom: Sagar Shrikant Kadam <[email protected]>
commit 17b4efdf4e4867079012a48ca10d965fe9d68822 upstream.
An uninitialised spin lock for sifive serial console raises a bad magic spin_lock error as reported and discussed here [1]. Initialising the spin lock resolves the issue.
The fix is tested on HiFive Unleashed A00 board with Linux 5.7-rc4 and OpenSBI v0.7
[1] https://lore.kernel.org/linux-riscv/[email protected]
--- drivers/tty/serial/sifive.c | 1 + 1 file changed, 1 insertion(+)
drivers/tty/serial/sifive.c +1 -0
@@ -840,6 +840,7 @@ console_initcall(sifive_console_init);static void __ssp_add_console_port (struct sifive_serial_port *ssp) { +spin_lock_init (&ssp->port.lock); sifive_serial_console_ports[ssp->port.line] = ssp; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 183/606 ipack: tpci200: fix error return code in tpci200_register()
In reply to Sasha LevinFrom: Wei Yongjun <[email protected]>
commit 133317479f0324f6faaf797c4f5f3e9b1b36ce35 upstream.
Fix to return negative error code -ENOMEM from the ioremap() error handling case instead of 0, as done elsewhere in this function.
--- drivers/ipack/carriers/tpci200.c | 1 + 1 file changed, 1 insertion(+)
drivers/ipack/carriers/tpci200.c +1 -0
@@ -306,6 +306,7 @@ static int tpci200_register(struct tpci200_board *tpci200)"(bn 0x%X, sn 0x%X) failed to map driver user space!" , tpci200->info->pdev->bus->number, tpci200->info->pdev->devfn); + res = -ENOMEM ; goto out_release_mem8_space; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 184/606 s390/pci: Fix s390_mmio_read/write with MIO
In reply to Sasha LevinFrom: Niklas Schnelle <[email protected]>
commit f058599e22d59e594e5aae1dc10560568d8f4a8b upstream.
The s390_mmio_read/write syscalls are currently broken when running with MIO.
The new pcistb_mio/pcstg_mio/pcilg_mio instructions are executed similiarly to normal load/store instructions and do address translation in the current address space. That means inside the kernel they are aware of mappings into kernel address space while outside the kernel they use user space mappings (usually created through mmap'ing a PCI device file).
Now when existing user space applications use the s390_pci_mmio_write and s390_pci_mmio_read syscalls, they pass I/O addresses that are mapped into user space so as to be usable with the new instructions without needing a syscall. Accessing these addresses with the old instructions as done currently leads to a kernel panic.
Also, for such a user space mapping there may not exist an equivalent kernel space mapping which means we can't just use the new instructions in kernel space.
Instead of replicating user mappings in the kernel which then might collide with other mappings, we can conceptually execute the new instructions as if executed by the user space application using the secondary address space. This even allows us to directly store to the user pointer without the need for copy_to/from_user().
--- arch/s390/include/asm/pci_io.h | 10 +- arch/s390/pci/pci_mmio.c | 213 ++++++++++++++++++++++++++++++++- 2 files changed, 219 insertions(+), 4 deletions(-)
arch/s390/include/asm/pci_io.h +8 -2
@@ -8,6 +8,10 @@#include <linux/slab.h> #include <asm/pci_insn.h> +/* I/O size constraints */ +#define ZPCI_MAX_READ_SIZE 8 +#define ZPCI_MAX_WRITE_SIZE 128 +/* I/O Map */ #define ZPCI_IOMAP_SHIFT 48#define ZPCI_IOMAP_ADDR_BASE 0x8000000000000000UL
@@ -140,7 +144,8 @@ static inline int zpci_memcpy_fromio(void *dst,while (n >0 ) { size =zpci_get_max_write_size ((u64 __force ) src, - (u64 ) dst, n,8 ); + (u64 ) dst, n, +ZPCI_MAX_READ_SIZE ); rc =zpci_read_single (dst, src, size);if (rc)break ;
@@ -161,7 +166,8 @@ static inline int zpci_memcpy_toio(volatile void __iomem *dst,while (n >0 ) { size =zpci_get_max_write_size ((u64 __force ) dst, - (u64 ) src, n,128 ); + (u64 ) src, n, +ZPCI_MAX_WRITE_SIZE );if (size >8 )/* main path */ rc =zpci_write_block (dst, src, size);else
arch/s390/pci/pci_mmio.c +211 -2
248 lines not on this page · raw message
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 186/606 device-dax: don't leak kernel memory to user space after unloading kmem
In reply to Sasha LevinFrom: David Hildenbrand <[email protected]>
commit 60858c00e5f018eda711a3aa84cf62214ef62d61 upstream.
Assume we have kmem configured and loaded:
[root@localhost ~]# cat /proc/iomem
...
140000000-33fffffff : Persistent Memory$
140000000-1481fffff : namespace0.0
150000000-33fffffff : dax0.0
150000000-33fffffff : System RAMAssume we try to unload kmem. This force-unloading will work, even if memory cannot get removed from the system.
[root@localhost ~]# rmmod kmem
[ 86.380228] removing memory fails, because memory [0x0000000150000000-0x0000000157ffffff] is onlined ... [ 86.431225] kmem dax0.0: DAX region [mem 0x150000000-0x33fffffff] cannot be hotremoved until the next reboot
Now, we can reconfigure the namespace:
[root@localhost ~]# ndctl create-namespace --force --reconfig=namespace0.0 --mode=devdax [ 131.409351] nd_pmem namespace0.0: could not reserve region [mem 0x140000000-0x33fffffff]dax [ 131.410147] nd_pmem: probe of namespace0.0 failed with error -16namespace0.0 --mode=devdax ...
This fails as expected due to the busy memory resource, and the memory cannot be used. However, the dax0.0 device is removed, and along its name.
The name of the memory resource now points at freed memory (name of the device):
[root@localhost ~]# cat /proc/iomem
...
140000000-33fffffff : Persistent Memory
140000000-1481fffff : namespace0.0
150000000-33fffffff : �_�^7_��/_��wR��WQ���^��� ...
150000000-33fffffff : System RAMWe have to make sure to duplicate the string. While at it, remove the superfluous setting of the name and fixup a stale comment.
--- drivers/dax/kmem.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/dax/kmem.c +11 -3
@@ -22,6 +22,7 @@ int dev_dax_kmem_probe(struct device *dev)resource_size_t kmem_size;resource_size_t kmem_end;struct resource *new_res; +const char *new_res_name;int numa_node;int rc;
@@ -48,11 +49,16 @@ int dev_dax_kmem_probe(struct device *dev) kmem_size &= ~(memory_block_size_bytes () -1 ); kmem_end = kmem_start + kmem_size; -/* Region is permanently reserved. Hot-remove not yet implemented. */ - new_res =request_mem_region (kmem_start, kmem_size,dev_name (dev)); + new_res_name =kstrdup (dev_name (dev),GFP_KERNEL ); +if (!new_res_name) +return -ENOMEM ; + +/* Region is permanently reserved if hotremove fails. */ + new_res =request_mem_region (kmem_start, kmem_size, new_res_name);if (!new_res) {dev_warn (dev,"could not reserve region [%pa-%pa]\n" , &kmem_start, &kmem_end); +kfree (new_res_name);return -EBUSY ; }
@@ -63,12 +69,12 @@ int dev_dax_kmem_probe(struct device *dev)* unknown to us that will break add_memory() below. */ new_res->flags =IORESOURCE_SYSTEM_RAM ; - new_res->name =dev_name (dev); rc =add_memory (numa_node, new_res->start,resource_size (new_res));if (rc) {release_resource (new_res);kfree (new_res); +kfree (new_res_name);return rc; } dev_dax->dax_kmem_res = new_res;
@@ -83,6 +89,7 @@ static int dev_dax_kmem_remove(struct device *dev)struct resource *res = dev_dax->dax_kmem_res;resource_size_t kmem_start = res->start;resource_size_t kmem_size =resource_size (res); +const char *res_name = res->name;int rc;/*
@@ -102,6 +109,7 @@ static int dev_dax_kmem_remove(struct device *dev)/* Release and free dax resources */ release_resource (res);kfree (res); +kfree (res_name); dev_dax->dax_kmem_res =NULL ;return 0 ;
Signature · 4 lines
2.25.1 _______________________________________________ Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]
Sasha Levin
maintainerPATCH 187/606 rapidio: fix an error in get_user_pages_fast() error handling
In reply to Sasha LevinFrom: John Hubbard <[email protected]>
commit ffca476a0a8d26de767cc41d62b8ca7f540ecfdd upstream.
In the case of get_user_pages_fast() returning fewer pages than requested, rio_dma_transfer() does not quite do the right thing. It attempts to release all the pages that were requested, rather than just the pages that were pinned.
Fix the error handling so that only the pages that were successfully pinned are released.
--- drivers/rapidio/devices/rio_mport_cdev.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/rapidio/devices/rio_mport_cdev.c +5 -0
@@ -877,6 +877,11 @@ rio_dma_transfer(struct file *filp, u32 transfer_mode,rmcd_error ("pinned %ld out of %ld pages" , pinned, nr_pages); ret = -EFAULT ; +/* +* Set nr_pages up to mean "how many pages to unpin, in +* the error handler: +*/ + nr_pages = pinned; goto err_pg; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 188/606 kasan: disable branch tracing for core runtime
In reply to Sasha LevinFrom: Marco Elver <[email protected]>
commit 33cd65e73abd693c00c4156cf23677c453b41b3b upstream.
During early boot, while KASAN is not yet initialized, it is possible to enter reporting code-path and end up in kasan_report().
While uninitialized, the branch there prevents generating any reports, however, under certain circumstances when branches are being traced (TRACE_BRANCH_PROFILING), we may recurse deep enough to cause kernel reboots without warning.
To prevent similar issues in future, we should disable branch tracing for the core runtime.
--- mm/kasan/Makefile | 8 ++++---- mm/kasan/generic.c | 1 - mm/kasan/tags.c | 1 - 3 files changed, 4 insertions(+), 6 deletions(-)
mm/kasan/Makefile +4 -4
@@ -14,10 +14,10 @@ CFLAGS_REMOVE_tags.o = $(CC_FLAGS_FTRACE) # Function splitter causes unnecessary splits in __asan_load1/__asan_store1 # see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63533 -CFLAGS_common.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -CFLAGS_generic.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -CFLAGS_generic_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -CFLAGS_tags.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) +CFLAGS_common.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING +CFLAGS_generic.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING +CFLAGS_generic_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING +CFLAGS_tags.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING obj-$(CONFIG_KASAN) := common.o init.o report.o obj-$(CONFIG_KASAN_GENERIC) += generic.o generic_report.o quarantine.o
mm/kasan/generic.c +0 -1
@@ -15,7 +15,6 @@*/ #define pr_fmt (fmt) KBUILD_MODNAME ": " fmt -#define DISABLE_BRANCH_PROFILING #include <linux/export.h> #include <linux/interrupt.h>
mm/kasan/tags.c +0 -1
@@ -12,7 +12,6 @@*/ #define pr_fmt (fmt) KBUILD_MODNAME ": " fmt -#define DISABLE_BRANCH_PROFILING #include <linux/export.h> #include <linux/interrupt.h>
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 192/606 z3fold: fix use-after-free when freeing handles
In reply to Sasha LevinFrom: Uladzislau Rezki <[email protected]>
commit d8f117abb380ba968b5e3ef2042d901c02872a4c upstream.
free_handle() for a foreign handle may race with inter-page compaction, what can lead to memory corruption.
To avoid that, take write lock not read lock in free_handle to be synchronized with __release_z3fold_page().
For example KASAN can detect it:
==================================================================
BUG: KASAN: use-after-free in LZ4_decompress_safe+0x2c4/0x3b8
Read of size 1 at addr ffffffc976695ca3 by task GoogleApiHandle/4121
CPU: 0 PID: 4121 Comm: GoogleApiHandle Tainted: P S OE 4.19.81-perf+ #162
Hardware name: Sony Mobile Communications. PDX-203(KONA) (DT)
Call trace:
LZ4_decompress_safe+0x2c4/0x3b8
lz4_decompress_crypto+0x3c/0x70
crypto_decompress+0x58/0x70
zcomp_decompress+0xd4/0x120
...Apart from that, initialize zhdr->mapped_count in init_z3fold_page() and remove "newpage" variable because it is not used anywhere.
--- mm/z3fold.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
mm/z3fold.c +6 -5
@@ -318,16 +318,16 @@ static inline void free_handle(unsigned long handle) slots =handle_to_slots (handle);write_lock (&slots->lock); *(unsigned long *)handle =0 ; -write_unlock (&slots->lock); -if (zhdr->slots == slots) +if (zhdr->slots == slots) { +write_unlock (&slots->lock);return ;/* simple case, nothing else to do */ + }/* we are freeing a foreign handle if we are here */ zhdr->foreign_handles--; is_free = true; -read_lock (&slots->lock);if (!test_bit (HANDLES_ORPHANED , &slots->pool)) { -read_unlock (&slots->lock); +write_unlock (&slots->lock);return ; }for (i =0 ; i <=BUDDY_MASK ; i++) {
@@ -336,7 +336,7 @@ static inline void free_handle(unsigned long handle)break ; } } -read_unlock (&slots->lock); +write_unlock (&slots->lock);if (is_free) {struct z3fold_pool *pool =slots_to_pool (slots);
@@ -422,6 +422,7 @@ static struct z3fold_header *init_z3fold_page(struct page *page, bool headless, zhdr->start_middle =0 ; zhdr->cpu =-1 ; zhdr->foreign_handles =0 ; + zhdr->mapped_count =0 ; zhdr->slots = slots; zhdr->pool = pool;INIT_LIST_HEAD (&zhdr->buddy);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 197/606 s390/kexec_file: fix initrd location for kdump kernel
In reply to Sasha LevinFrom: Philipp Rudo <[email protected]>
commit 70b690547d5ea1a3d135a4cc39cd1e08246d0c3a upstream.
initrd_start must not point at the location the initrd is loaded into the crashkernel memory but at the location it will be after the crashkernel memory is swapped with the memory at 0.
--- arch/s390/kernel/machine_kexec_file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/kernel/machine_kexec_file.c +1 -1
@@ -151,7 +151,7 @@ static int kexec_file_add_initrd(struct kimage *image, buf.mem += crashk_res.start; buf.memsz = buf.bufsz; - data->parm->initrd_start = buf.mem; + data->parm->initrd_start = data->memsz; data->parm->initrd_size = buf.memsz; data->memsz += buf.memsz;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 206/606 Linux 5.6.15
In reply to Sasha LevinFrom: Greg Kroah-Hartman <[email protected]>
--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 VERSION = 5 PATCHLEVEL = 6 -SUBLEVEL = 14 +SUBLEVEL = 15 EXTRAVERSION = NAME = Kleptomaniac Octopus
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 205/606 sched/fair: Fix enqueue_task_fair() warning some more
In reply to Sasha LevinFrom: Phil Auld <[email protected]>
[ Upstream commit b34cb07dde7c2346dec73d053ce926aeaa087303 ]
sched/fair: Fix enqueue_task_fair warning some more
The recent patch, fe61468b2cb (sched/fair: Fix enqueue_task_fair warning) did not fully resolve the issues with the rq->tmp_alone_branch != &rq->leaf_cfs_rq_list warning in enqueue_task_fair. There is a case where the first for_each_sched_entity loop exits due to on_rq, having incompletely updated the list. In this case the second for_each_sched_entity loop can further modify se. The later code to fix up the list management fails to do what is needed because se does not point to the sched_entity which broke out of the first loop. The list is not fixed up because the throttled parent was already added back to the list by a task enqueue in a parallel child hierarchy.
Address this by calling list_add_leaf_cfs_rq if there are throttled parents while doing the second for_each_sched_entity loop.
--- kernel/sched/fair.c | 7 +++++++ 1 file changed, 7 insertions(+)
kernel/sched/fair.c +7 -0
@@ -5298,6 +5298,13 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags)/* end evaluation on encountering a throttled cfs_rq */ if (cfs_rq_throttled (cfs_rq)) goto enqueue_throttle; + +/* +* One parent has been throttled and cfs_rq removed from the +* list. Add it back to not break the leaf list. +*/ +if (throttled_hierarchy (cfs_rq)) +list_add_leaf_cfs_rq (cfs_rq); } enqueue_throttle:
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 72/606 RDMA/uverbs: Move IB_EVENT_DEVICE_FATAL to destroy_uobj
In reply to Sasha LevinFrom: Jason Gunthorpe <[email protected]>
commit ccfdbaa5cf4601b9b71601893029dcc9245c002b upstream.
When multiple async FDs were allowed to exist the idea was for all broadcast events to be delivered to all async FDs, however IB_EVENT_DEVICE_FATAL was missed.
Instead of having ib_uverbs_free_hw_resources() special case the global async_fd, have it cause the event during the uobject destruction. Every async fd is now a uobject so simply generate the IB_EVENT_DEVICE_FATAL while destroying the async fd uobject. This ensures every async FD gets a copy of the event.
--- drivers/infiniband/core/uverbs.h | 3 +++ drivers/infiniband/core/uverbs_main.c | 10 +++------- drivers/infiniband/core/uverbs_std_types_async_fd.c | 4 ++++ 3 files changed, 10 insertions(+), 7 deletions(-)
drivers/infiniband/core/uverbs.h +3 -0
@@ -228,6 +228,9 @@ void ib_uverbs_release_ucq(struct ib_uverbs_completion_event_file *ev_file, struct ib_ucq_object *uobj);void ib_uverbs_release_uevent (struct ib_uevent_object *uobj);void ib_uverbs_release_file (struct kref *ref); +void ib_uverbs_async_handler (struct ib_uverbs_async_event_file *async_file, +__u64 element,__u64 event, +struct list_head *obj_list,u32 *counter);void ib_uverbs_comp_handler (struct ib_cq *cq,void *cq_context);void ib_uverbs_cq_event_handler (struct ib_event *event,void *context_ptr);
drivers/infiniband/core/uverbs_main.c +3 -7
@@ -386,10 +386,9 @@ void ib_uverbs_comp_handler(struct ib_cq *cq, void *cq_context)kill_fasync (&ev_queue->async_queue,SIGIO ,POLL_IN ); } -static void -ib_uverbs_async_handler (struct ib_uverbs_async_event_file *async_file, -__u64 element,__u64 event,struct list_head *obj_list, -u32 *counter) +void ib_uverbs_async_handler (struct ib_uverbs_async_event_file *async_file, +__u64 element,__u64 event, +struct list_head *obj_list,u32 *counter) {struct ib_uverbs_event *entry;unsigned long flags;
@@ -1187,9 +1186,6 @@ static void ib_uverbs_free_hw_resources(struct ib_uverbs_device *uverbs_dev,*/ mutex_unlock (&uverbs_dev->lists_mutex); -ib_uverbs_async_handler (READ_ONCE (file->async_file),0 , -IB_EVENT_DEVICE_FATAL ,NULL ,NULL ); -uverbs_destroy_ufile_hw (file,RDMA_REMOVE_DRIVER_REMOVE );kref_put (&file->ref, ib_uverbs_release_file);
drivers/infiniband/core/uverbs_std_types_async_fd.c +4 -0
@@ -26,6 +26,10 @@ static int uverbs_async_event_destroy_uobj(struct ib_uobject *uobj, container_of(uobj, struct ib_uverbs_async_event_file, uobj);ib_unregister_event_handler (&event_file->event_handler); + +if (why ==RDMA_REMOVE_DRIVER_REMOVE ) +ib_uverbs_async_handler (event_file,0 ,IB_EVENT_DEVICE_FATAL , +NULL ,NULL );return 0 ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 210/606 felix: Fix initialization of ioremap resources
In reply to Sasha LevinFrom: Claudiu Manoil <[email protected]>
[ Upstream commit b4024c9e5c57902155d3b5e7de482e245f492bff ]
The caller of devm_ioremap_resource(), either accidentally or by wrong assumption, is writing back derived resource data to global static resource initialization tables that should have been constant. Meaning that after it computes the final physical start address it saves the address for no reason in the static tables. This doesn't affect the first driver probing after reboot, but it breaks consecutive driver reloads (i.e. driver unbind & bind) because the initialization tables no longer have the correct initial values. So the next probe() will map the device registers to wrong physical addresses, causing ARM SError async exceptions.
This patch fixes all of the above.
--- drivers/net/dsa/ocelot/felix.c | 23 +++++++++++------------ drivers/net/dsa/ocelot/felix.h | 6 +++--- drivers/net/dsa/ocelot/felix_vsc9959.c | 22 ++++++++++------------ 3 files changed, 24 insertions(+), 27 deletions(-)
drivers/net/dsa/ocelot/felix.c +11 -12
@@ -385,6 +385,7 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports)struct ocelot *ocelot = &felix->ocelot;phy_interface_t *port_phy_modes;resource_size_t switch_base; +struct resource res;int port, i, err; ocelot->num_phys_ports = num_phys_ports;
@@ -416,17 +417,16 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports)for (i =0 ; i <TARGET_MAX ; i++) {struct regmap *target; -struct resource *res;if (!felix->info->target_io_res[i].name)continue ; - res = &felix->info->target_io_res[i]; - res->flags =IORESOURCE_MEM ; - res->start += switch_base; - res->end += switch_base; +memcpy (&res, &felix->info->target_io_res[i],sizeof (res)); + res.flags =IORESOURCE_MEM ; + res.start += switch_base; + res.end += switch_base; - target =ocelot_regmap_init (ocelot, res); + target =ocelot_regmap_init (ocelot, &res);if (IS_ERR (target)) {dev_err (ocelot->dev,"Failed to map device memory space\n" );
@@ -447,7 +447,6 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports)for (port =0 ; port < num_phys_ports; port++) {struct ocelot_port *ocelot_port;void __iomem *port_regs; -struct resource *res; ocelot_port = devm_kzalloc(ocelot->dev, sizeof(struct ocelot_port),
@@ -459,12 +458,12 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports)return -ENOMEM ; } - res = &felix->info->port_io_res[port]; - res->flags =IORESOURCE_MEM ; - res->start += switch_base; - res->end += switch_base; +memcpy (&res, &felix->info->port_io_res[port],sizeof (res)); + res.flags =IORESOURCE_MEM ; + res.start += switch_base; + res.end += switch_base; - port_regs =devm_ioremap_resource (ocelot->dev, res); + port_regs =devm_ioremap_resource (ocelot->dev, &res);if (IS_ERR (port_regs)) {dev_err (ocelot->dev,"failed to map registers for port %d\n" , port);
drivers/net/dsa/ocelot/felix.h +3 -3
@@ -8,9 +8,9 @@/* Platform-specific information */ struct felix_info { -struct resource *target_io_res; -struct resource *port_io_res; -struct resource *imdio_res; +const struct resource *target_io_res; +const struct resource *port_io_res; +const struct resource *imdio_res;const struct reg_field *regfields;const u32 *const *map;const struct ocelot_ops *ops;
drivers/net/dsa/ocelot/felix_vsc9959.c +10 -12
@@ -328,10 +328,8 @@ static const u32 *vsc9959_regmap[] = { [GCB] = vsc9959_gcb_regmap, }; -/* Addresses are relative to the PCI device's base address and -* will be fixed up at ioremap time. -*/ -static struct resource vsc9959_target_io_res[] = { +/* Addresses are relative to the PCI device's base address */ +static const struct resource vsc9959_target_io_res[] = { [ANA ] = { .start =0x0280000 , .end =0x028ffff ,
@@ -374,7 +372,7 @@ static struct resource vsc9959_target_io_res[] = { }, }; -static struct resource vsc9959_port_io_res[] = { +static const struct resource vsc9959_port_io_res[] = { { .start =0x0100000 , .end =0x010ffff ,
@@ -410,7 +408,7 @@ static struct resource vsc9959_port_io_res[] = {/* Port MAC 0 Internal MDIO bus through which the SerDes acting as an * SGMII/QSGMII MAC PCS can be found. */ -static struct resource vsc9959_imdio_res = { +static const struct resource vsc9959_imdio_res = { .start =0x8030 , .end =0x8040 , .name ="imdio" ,
@@ -984,7 +982,7 @@ static int vsc9959_mdio_bus_alloc(struct ocelot *ocelot)struct device *dev = ocelot->dev;resource_size_t imdio_base;void __iomem *imdio_regs; -struct resource *res; +struct resource res;struct enetc_hw *hw;struct mii_bus *bus;int port;
@@ -1001,12 +999,12 @@ static int vsc9959_mdio_bus_alloc(struct ocelot *ocelot) imdio_base =pci_resource_start (felix->pdev, felix->info->imdio_pci_bar); - res = felix->info->imdio_res; - res->flags =IORESOURCE_MEM ; - res->start += imdio_base; - res->end += imdio_base; +memcpy (&res, felix->info->imdio_res,sizeof (res)); + res.flags =IORESOURCE_MEM ; + res.start += imdio_base; + res.end += imdio_base; - imdio_regs =devm_ioremap_resource (dev, res); + imdio_regs =devm_ioremap_resource (dev, &res);if (IS_ERR (imdio_regs)) {dev_err (dev,"failed to map internal MDIO registers\n" );return PTR_ERR (imdio_regs);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 211/606 net: don't return invalid table id error when we fall back to PF_UNSPEC
In reply to Sasha LevinFrom: Sabrina Dubroca <[email protected]>
[ Upstream commit 41b4bd986f86331efc599b9a3f5fb86ad92e9af9 ]
In case we can't find a ->dumpit callback for the requested (family,type) pair, we fall back to (PF_UNSPEC,type). In effect, we're in the same situation as if userspace had requested a PF_UNSPEC dump. For RTM_GETROUTE, that handler is rtnl_dump_all, which calls all the registered RTM_GETROUTE handlers.
The requested table id may or may not exist for all of those families. commit ae677bbb4441 ("net: Don't return invalid table id error when dumping all families") fixed the problem when userspace explicitly requests a PF_UNSPEC dump, but missed the fallback case.
For example, when we pass ipv6.disable=1 to a kernel with CONFIG_IP_MROUTE=y and CONFIG_IP_MROUTE_MULTIPLE_TABLES=y, the (PF_INET6, RTM_GETROUTE) handler isn't registered, so we end up in rtnl_dump_all, and listing IPv6 routes will unexpectedly print:
# ip -6 r Error: ipv4: MR table does not exist. Dump terminated
commit ae677bbb4441 introduced the dump_all_families variable, which gets set when userspace requests a PF_UNSPEC dump. However, we can't simply set the family to PF_UNSPEC in rtnetlink_rcv_msg in the fallback case to get dump_all_families == true, because some messages types (for example RTM_GETRULE and RTM_GETNEIGH) only register the PF_UNSPEC handler and use the family to filter in the kernel what is dumped to userspace. We would then export more entries, that userspace would have to filter. iproute does that, but other programs may not.
Instead, this patch removes dump_all_families and updates the RTM_GETROUTE handlers to check if the family that is being dumped is their own. When it's not, which covers both the intentional PF_UNSPEC dumps (as dump_all_families did) and the fallback case, ignore the missing table id error.
--- include/net/ip_fib.h | 1 - net/ipv4/fib_frontend.c | 3 +-- net/ipv4/ipmr.c | 2 +- net/ipv6/ip6_fib.c | 2 +- net/ipv6/ip6mr.c | 2 +- 5 files changed, 4 insertions(+), 6 deletions(-)
include/net/ip_fib.h +0 -1
@@ -257,7 +257,6 @@ struct fib_dump_filter {u32 table_id;/* filter_set is an optimization that an entry is set */ bool filter_set; -bool dump_all_families;bool dump_routes;bool dump_exceptions;unsigned char protocol;
net/ipv4/fib_frontend.c +1 -2
@@ -918,7 +918,6 @@ int ip_valid_fib_dump_req(struct net *net, const struct nlmsghdr *nlh,else filter->dump_exceptions = false; - filter->dump_all_families = (rtm->rtm_family ==AF_UNSPEC ); filter->flags = rtm->rtm_flags; filter->protocol = rtm->rtm_protocol; filter->rt_type = rtm->rtm_type;
@@ -990,7 +989,7 @@ static int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb)if (filter.table_id) { tb =fib_get_table (net, filter.table_id);if (!tb) { -if (filter.dump_all_families) +if (rtnl_msg_family (cb->nlh) !=PF_INET )return skb->len;NL_SET_ERR_MSG (cb->extack,"ipv4: FIB table does not exist" );
net/ipv4/ipmr.c +1 -1
@@ -2611,7 +2611,7 @@ static int ipmr_rtm_dumproute(struct sk_buff *skb, struct netlink_callback *cb) mrt =ipmr_get_table (sock_net (skb->sk), filter.table_id);if (!mrt) { -if (filter.dump_all_families) +if (rtnl_msg_family (cb->nlh) !=RTNL_FAMILY_IPMR )return skb->len;NL_SET_ERR_MSG (cb->extack,"ipv4: MR table does not exist" );
net/ipv6/ip6_fib.c +1 -1
@@ -664,7 +664,7 @@ static int inet6_dump_fib(struct sk_buff *skb, struct netlink_callback *cb)if (arg.filter.table_id) { tb =fib6_get_table (net, arg.filter.table_id);if (!tb) { -if (arg.filter.dump_all_families) +if (rtnl_msg_family (cb->nlh) !=PF_INET6 ) goto out;NL_SET_ERR_MSG_MOD (cb->extack,"FIB table does not exist" );
net/ipv6/ip6mr.c +1 -1
@@ -2501,7 +2501,7 @@ static int ip6mr_rtm_dumproute(struct sk_buff *skb, struct netlink_callback *cb) mrt =ip6mr_get_table (sock_net (skb->sk), filter.table_id);if (!mrt) { -if (filter.dump_all_families) +if (rtnl_msg_family (cb->nlh) !=RTNL_FAMILY_IP6MR )return skb->len;NL_SET_ERR_MSG_MOD (cb->extack,"MR table does not exist" );
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 212/606 net: dsa: mt7530: fix roaming from DSA user ports
In reply to Sasha LevinFrom: DENG Qingfang <[email protected]>
[ Upstream commit 5e5502e012b8129e11be616acb0f9c34bc8f8adb ]
When a client moves from a DSA user port to a software port in a bridge, it cannot reach any other clients that connected to the DSA user ports. That is because SA learning on the CPU port is disabled, so the switch ignores the client's frames from the CPU port and still thinks it is at the user port.
Fix it by enabling SA learning on the CPU port.
To prevent the switch from learning from flooding frames from the CPU port, set skb->offload_fwd_mark to 1 for unicast and broadcast frames, and let the switch flood them instead of trapping to the CPU port. Multicast frames still need to be trapped to the CPU port for snooping, so set the SA_DIS bit of the MTK tag to 1 when transmitting those frames to disable SA learning.
--- drivers/net/dsa/mt7530.c | 9 ++------- drivers/net/dsa/mt7530.h | 1 + net/dsa/tag_mtk.c | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 7 deletions(-)
drivers/net/dsa/mt7530.c +2 -7
@@ -639,11 +639,8 @@ mt7530_cpu_port_enable(struct mt7530_priv *priv,mt7530_write (priv,MT7530_PVC_P (port),PORT_SPEC_TAG ); -/* Disable auto learning on the cpu port */ -mt7530_set (priv,MT7530_PSC_P (port),SA_DIS ); - -/* Unknown unicast frame fordwarding to the cpu port */ -mt7530_set (priv,MT7530_MFC ,UNU_FFP (BIT (port))); +/* Unknown multicast frame forwarding to the cpu port */ +mt7530_rmw (priv,MT7530_MFC ,UNM_FFP_MASK ,UNM_FFP (BIT (port)));/* Set CPU port number */ if (priv->id ==ID_MT7621 )
@@ -1247,8 +1244,6 @@ mt7530_setup(struct dsa_switch *ds)/* Enable and reset MIB counters */ mt7530_mib_reset (ds); -mt7530_clear (priv,MT7530_MFC ,UNU_FFP_MASK ); -for (i =0 ; i <MT7530_NUM_PORTS ; i++) {/* Disable forwarding by default on all ports */ mt7530_rmw(priv, MT7530_PCR_P(i), PCR_MATRIX_MASK,
drivers/net/dsa/mt7530.h +1 -0
@@ -31,6 +31,7 @@ enum {#define MT7530_MFC 0x10#define BC_FFP (x) (((x) & 0xff) << 24)#define UNM_FFP (x) (((x) & 0xff) << 16) +#define UNM_FFP_MASK UNM_FFP(~0)#define UNU_FFP (x) (((x) & 0xff) << 8)#define UNU_FFP_MASK UNU_FFP(~0)#define CPU_EN BIT(7)
net/dsa/tag_mtk.c +15 -0
@@ -15,6 +15,7 @@#define MTK_HDR_XMIT_TAGGED_TPID_8100 1#define MTK_HDR_RECV_SOURCE_PORT_MASK GENMASK(2, 0)#define MTK_HDR_XMIT_DP_BIT_MASK GENMASK(5, 0) +#define MTK_HDR_XMIT_SA_DIS BIT(6)static struct sk_buff *mtk_tag_xmit (struct sk_buff *skb,struct net_device *dev)
@@ -22,6 +23,9 @@ static struct sk_buff *mtk_tag_xmit(struct sk_buff *skb,struct dsa_port *dp =dsa_slave_to_port (dev);u8 *mtk_tag;bool is_vlan_skb = true; +unsigned char *dest =eth_hdr (skb)->h_dest; +bool is_multicast_skb =is_multicast_ether_addr (dest) && + !is_broadcast_ether_addr (dest);/* Build the special tag after the MAC Source Address. If VLAN header * is present, it's required that VLAN header and special tag is
@@ -47,6 +51,10 @@ static struct sk_buff *mtk_tag_xmit(struct sk_buff *skb,MTK_HDR_XMIT_UNTAGGED ; mtk_tag[1 ] = (1 << dp->index) &MTK_HDR_XMIT_DP_BIT_MASK ; +/* Disable SA learning for multicast frames */ +if (unlikely (is_multicast_skb)) + mtk_tag[1 ] |=MTK_HDR_XMIT_SA_DIS ; +/* Tag control information is kept for 802.1Q */ if (!is_vlan_skb) { mtk_tag[2 ] =0 ;
@@ -61,6 +69,9 @@ static struct sk_buff *mtk_tag_rcv(struct sk_buff *skb, struct net_device *dev, {int port;__be16 *phdr, hdr; +unsigned char *dest =eth_hdr (skb)->h_dest; +bool is_multicast_skb =is_multicast_ether_addr (dest) && + !is_broadcast_ether_addr (dest);if (unlikely (!pskb_may_pull (skb,MTK_HDR_LEN )))return NULL ;
@@ -86,6 +97,10 @@ static struct sk_buff *mtk_tag_rcv(struct sk_buff *skb, struct net_device *dev,if (!skb->dev)return NULL ; +/* Only unicast or broadcast frames are offloaded */ +if (likely (!is_multicast_skb)) + skb->offload_fwd_mark =1 ; +return skb; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 76/606 selftests/bpf: Enforce returning 0 for fentry/fexit programs
In reply to Sasha LevinFrom: Yonghong Song <[email protected]>
commit 6d74f64b922b8394dccc52576659cb0dc0a1da7b upstream.
There are a few fentry/fexit programs returning non-0. The tests with these programs will break with the previous patch which enfoced return-0 rules. Fix them properly.
--- tools/testing/selftests/bpf/progs/test_overhead.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/progs/test_overhead.c +2 -2
@@ -33,13 +33,13 @@ int prog3(struct bpf_raw_tracepoint_args *ctx) SEC("fentry/__set_task_comm")int BPF_PROG (prog4 ,struct task_struct *tsk,const char *buf,bool exec) { -return !tsk; +return 0 ; } SEC("fexit/__set_task_comm")int BPF_PROG (prog5 ,struct task_struct *tsk,const char *buf,bool exec) { -return !tsk; +return 0 ; } char _license[] SEC("license") = "GPL";
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 216/606 net: ipip: fix wrong address family in init error path
In reply to Sasha LevinFrom: Vadim Fedorenko <[email protected]>
[ Upstream commit 57ebc8f08504f176eb0f25b3e0fde517dec61a4f ]
In case of error with MPLS support the code is misusing AF_INET instead of AF_MPLS.
--- net/ipv4/ipip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/ipip.c +1 -1
@@ -698,7 +698,7 @@ static int __init ipip_init(void) rtnl_link_failed:#if IS_ENABLED (CONFIG_MPLS ) -xfrm4_tunnel_deregister (&mplsip_handler,AF_INET ); +xfrm4_tunnel_deregister (&mplsip_handler,AF_MPLS ); xfrm_tunnel_mplsip_failed:#endif
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 221/606 net: revert "net: get rid of an signed integer overflow in ip_idents_reserve()"
In reply to Sasha LevinFrom: Yuqi Jin <[email protected]>
[ Upstream commit a6211caa634da39d861a47437ffcda8b38ef421b ]
Commit adb03115f459 ("net: get rid of an signed integer overflow in ip_idents_reserve()") used atomic_cmpxchg to replace "atomic_add_return" inside the function "ip_idents_reserve". The reason was to avoid UBSAN warning.
However, this change has caused performance degrade and in GCC-8, fno-strict-overflow is now mapped to -fwrapv -fwrapv-pointer
and signed integer overflow is now undefined by default at all
optimization levels[1]. Moreover, it was a bug in UBSAN vs -fwrapv /-fno-strict-overflow, so Let's revert it safely.
[1] https://gcc.gnu.org/gcc-8/changes.html
--- net/ipv4/route.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
net/ipv4/route.c +6 -8
@@ -491,18 +491,16 @@ u32 ip_idents_reserve(u32 hash, int segs)atomic_t *p_id = ip_idents + hash %IP_IDENTS_SZ ;u32 old =READ_ONCE (*p_tstamp);u32 now = (u32 )jiffies; -u32 new, delta =0 ; +u32 delta =0 ;if (old != now &&cmpxchg (p_tstamp, old, now) == old) delta =prandom_u32_max (now - old); -/* Do not use atomic_add_return() as it makes UBSAN unhappy */ -do { - old = (u32 )atomic_read (p_id); - new = old + delta + segs; - }while (atomic_cmpxchg (p_id, old, new) != old); - -return new - segs; +/* If UBSAN reports an error there, please make sure your compiler +* supports -fno-strict-overflow before reporting it that was a bug +* in UBSAN, and it has been fixed in GCC-8. +*/ +return atomic_add_return (segs + delta, p_id) - segs; }EXPORT_SYMBOL (ip_idents_reserve);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 135/606 ALSA: hda/realtek - Add supported new mute Led for HP
In reply to Sasha LevinFrom: Kailang Yang <[email protected]>
[ Upstream commit 431e76c3edd76d84a0ed1eb81a286b2ddecc5ee4 ]
HP Note Book supported new mute Led. Hardware PIN was not enough to meet old LED rule. JD2 to control playback mute led.
GPO3 to control capture mute led.
(ALC285 didn't control GPO3 via verb command) This two PIN just could control by COEF registers.
[ corrected typos by tiwai ]
--- sound/pci/hda/patch_realtek.c | 81 +++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+)
sound/pci/hda/patch_realtek.c +81 -0
@@ -86,6 +86,14 @@ struct alc_spec {unsigned int gpio_mute_led_mask;unsigned int gpio_mic_led_mask; +unsigned int mute_led_coef_idx; +unsigned int mute_led_coefbit_mask; +unsigned int mute_led_coefbit_on; +unsigned int mute_led_coefbit_off; +unsigned int mic_led_coef_idx; +unsigned int mic_led_coefbit_mask; +unsigned int mic_led_coefbit_on; +unsigned int mic_led_coefbit_off;hda_nid_t headset_mic_pin;hda_nid_t headphone_mic_pin;
@@ -4182,6 +4190,73 @@ static void alc280_fixup_hp_gpio4(struct hda_codec *codec, } } +/* update mute-LED according to the speaker mute state via COEF bit */ +static void alc_fixup_mute_led_coefbit_hook (void *private_data,int enabled) +{ +struct hda_codec *codec = private_data; +struct alc_spec *spec = codec->spec; + +if (spec->mute_led_polarity) + enabled = !enabled; + +/* temporarily power up/down for setting COEF bit */ + enabled ?alc_update_coef_idx (codec, spec->mute_led_coef_idx, + spec->mute_led_coefbit_mask, spec->mute_led_coefbit_off) : +alc_update_coef_idx (codec, spec->mute_led_coef_idx, + spec->mute_led_coefbit_mask, spec->mute_led_coefbit_on); +} + +static void alc285_fixup_hp_mute_led_coefbit (struct hda_codec *codec, +const struct hda_fixup *fix, +int action) +{ +struct alc_spec *spec = codec->spec; + +if (action ==HDA_FIXUP_ACT_PRE_PROBE ) { + spec->mute_led_polarity =0 ; + spec->mute_led_coef_idx =0x0b ; + spec->mute_led_coefbit_mask =1 <<3 ; + spec->mute_led_coefbit_on =1 <<3 ; + spec->mute_led_coefbit_off =0 ; + spec->gen.vmaster_mute.hook = alc_fixup_mute_led_coefbit_hook; + spec->gen.vmaster_mute_enum =1 ; + } +} + +/* turn on/off mic-mute LED per capture hook by coef bit */ +static void alc_hp_cap_micmute_update (struct hda_codec *codec) +{ +struct alc_spec *spec = codec->spec; + +if (spec->gen.micmute_led.led_value) +alc_update_coef_idx (codec, spec->mic_led_coef_idx, + spec->mic_led_coefbit_mask, spec->mic_led_coefbit_on); +else +alc_update_coef_idx (codec, spec->mic_led_coef_idx, + spec->mic_led_coefbit_mask, spec->mic_led_coefbit_off); +} + +static void alc285_fixup_hp_coef_micmute_led (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +struct alc_spec *spec = codec->spec; + +if (action ==HDA_FIXUP_ACT_PRE_PROBE ) { + spec->mic_led_coef_idx =0x19 ; + spec->mic_led_coefbit_mask =1 <<13 ; + spec->mic_led_coefbit_on =1 <<13 ; + spec->mic_led_coefbit_off =0 ; +snd_hda_gen_add_micmute_led (codec, alc_hp_cap_micmute_update); + } +} + +static void alc285_fixup_hp_mute_led (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +alc285_fixup_hp_mute_led_coefbit (codec, fix, action); +alc285_fixup_hp_coef_micmute_led (codec, fix, action); +} +#if IS_REACHABLE (CONFIG_INPUT )static void gpio2_mic_hotkey_event (struct hda_codec *codec,struct hda_jack_callback *event)
@@ -5980,6 +6055,7 @@ enum {ALC294_FIXUP_ASUS_HPE ,ALC294_FIXUP_ASUS_COEF_1B ,ALC285_FIXUP_HP_GPIO_LED , + ALC285_FIXUP_HP_MUTE_LED, }; static const struct hda_fixup alc269_fixups[] = {
@@ -7128,6 +7204,10 @@ static const struct hda_fixup alc269_fixups[] = { .type = HDA_FIXUP_FUNC, .v.func = alc285_fixup_hp_gpio_led, }, + [ALC285_FIXUP_HP_MUTE_LED] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc285_fixup_hp_mute_led, + }, }; static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -7273,6 +7353,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x8497 ,"HP Envy x360" ,ALC269_FIXUP_HP_MUTE_LED_MIC3 ),SND_PCI_QUIRK (0x103c ,0x84e7 ,"HP Pavilion 15" ,ALC269_FIXUP_HP_MUTE_LED_MIC3 ),SND_PCI_QUIRK (0x103c ,0x8736 ,"HP" ,ALC285_FIXUP_HP_GPIO_LED ), +SND_PCI_QUIRK (0x103c ,0x877a ,"HP" ,ALC285_FIXUP_HP_MUTE_LED ),SND_PCI_QUIRK (0x1043 ,0x103e ,"ASUS X540SA" ,ALC256_FIXUP_ASUS_MIC ),SND_PCI_QUIRK (0x1043 ,0x103f ,"ASUS TX300" ,ALC282_FIXUP_ASUS_TX300 ), SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 233/606 net/mlx5: Fix error flow in case of function_setup failure
In reply to Sasha LevinFrom: Shay Drory <[email protected]>
[ Upstream commit 4f7400d5cbaef676e00cdffb0565bf731c6bb09e ]
Currently, if an error occurred during mlx5_function_setup(), we keep dev->state as DEVICE_STATE_UP.
Fixing it by adding a goto label.
--- drivers/net/ethernet/mellanox/mlx5/core/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/main.c +2 -1
@@ -1179,7 +1179,7 @@ int mlx5_load_one(struct mlx5_core_dev *dev, bool boot) err =mlx5_function_setup (dev, boot);if (err) - goto out; + goto err_function;if (boot) { err =mlx5_init_once (dev);
@@ -1225,6 +1225,7 @@ int mlx5_load_one(struct mlx5_core_dev *dev, bool boot)mlx5_cleanup_once (dev); function_teardown:mlx5_function_teardown (dev, boot); +err_function: dev->state =MLX5_DEVICE_STATE_INTERNAL_ERROR ;mutex_unlock (&dev->intf_state_mutex);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 234/606 wireguard: noise: read preshared key while taking lock
In reply to Sasha LevinFrom: "Jason A. Donenfeld" <[email protected]>
[ Upstream commit bc67d371256f5c47d824e2eec51e46c8d62d022e ]
Prior we read the preshared key after dropping the handshake lock, which isn't an actual crypto issue if it races, but it's still not quite correct. So copy that part of the state into a temporary like we do with the rest of the handshake state variables. Then we can release the lock, operate on the temporary, and zero it out at the end of the function. In performance tests, the impact of this was entirely unnoticable, probably because those bytes are coming from the same cacheline as other things that are being copied out in the same manner.
--- drivers/net/wireguard/noise.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/wireguard/noise.c +5 -1
@@ -715,6 +715,7 @@ wg_noise_handshake_consume_response(struct message_handshake_response *src,u8 e[NOISE_PUBLIC_KEY_LEN ];u8 ephemeral_private[NOISE_PUBLIC_KEY_LEN ];u8 static_private[NOISE_PUBLIC_KEY_LEN ]; +u8 preshared_key[NOISE_SYMMETRIC_KEY_LEN ];down_read (&wg->static_identity.lock);
@@ -733,6 +734,8 @@ wg_noise_handshake_consume_response(struct message_handshake_response *src,memcpy (chaining_key, handshake->chaining_key,NOISE_HASH_LEN );memcpy (ephemeral_private, handshake->ephemeral_private,NOISE_PUBLIC_KEY_LEN ); +memcpy (preshared_key, handshake->preshared_key, +NOISE_SYMMETRIC_KEY_LEN );up_read (&handshake->lock);if (state !=HANDSHAKE_CREATED_INITIATION )
@@ -750,7 +753,7 @@ wg_noise_handshake_consume_response(struct message_handshake_response *src, goto fail;/* psk */ -mix_psk (chaining_key, hash, key, handshake->preshared_key); +mix_psk (chaining_key, hash, key, preshared_key);/* {} */ if (!message_decrypt(NULL, src->encrypted_nothing,
@@ -783,6 +786,7 @@ wg_noise_handshake_consume_response(struct message_handshake_response *src,memzero_explicit (chaining_key,NOISE_HASH_LEN );memzero_explicit (ephemeral_private,NOISE_PUBLIC_KEY_LEN );memzero_explicit (static_private,NOISE_PUBLIC_KEY_LEN ); +memzero_explicit (preshared_key,NOISE_SYMMETRIC_KEY_LEN );up_read (&wg->static_identity.lock);return ret_peer; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 235/606 wireguard: queueing: preserve flow hash across packet scrubbing
In reply to Sasha LevinFrom: "Jason A. Donenfeld" <[email protected]>
[ Upstream commit c78a0b4a78839d572d8a80f6a62221c0d7843135 ]
It's important that we clear most header fields during encapsulation and decapsulation, because the packet is substantially changed, and we don't want any info leak or logic bug due to an accidental correlation. But, for encapsulation, it's wrong to clear skb->hash, since it's used by fq_codel and flow dissection in general. Without it, classification does not proceed as usual. This change might make it easier to estimate the number of innerflows by examining clustering of out of order packets, but this shouldn't open up anything that can't already be inferred otherwise (e.g. syn packet size inference), and fq_codel can be disabled anyway.
Furthermore, it might be the case that the hash isn't used or queried at all until after wireguard transmits the encrypted UDP packet, which means skb->hash might still be zero at this point, and thus no hash taken over the inner packet data. In order to address this situation, we force a calculation of skb->hash before encrypting packet data.
Of course this means that fq_codel might transmit packets slightly more out of order than usual. Toke did some testing on beefy machines with high quantities of parallel flows and found that increasing the reply-attack counter to 8192 takes care of the most pathological cases pretty well.
--- drivers/net/wireguard/messages.h | 2 +- drivers/net/wireguard/queueing.h | 10 +++++++++- drivers/net/wireguard/receive.c | 2 +- drivers/net/wireguard/send.c | 7 ++++++- 4 files changed, 17 insertions(+), 4 deletions(-)
drivers/net/wireguard/messages.h +1 -1
@@ -32,7 +32,7 @@ enum cookie_values { };enum counter_values { -COUNTER_BITS_TOTAL =2048 , +COUNTER_BITS_TOTAL =8192 ,COUNTER_REDUNDANT_BITS =BITS_PER_LONG ,COUNTER_WINDOW_SIZE =COUNTER_BITS_TOTAL -COUNTER_REDUNDANT_BITS };
drivers/net/wireguard/queueing.h +9 -1
@@ -87,12 +87,20 @@ static inline bool wg_check_packet_protocol(struct sk_buff *skb)return real_protocol && skb->protocol == real_protocol; } -static inline void wg_reset_packet (struct sk_buff *skb) +static inline void wg_reset_packet (struct sk_buff *skb,bool encapsulating) { +u8 l4_hash = skb->l4_hash; +u8 sw_hash = skb->sw_hash; +u32 hash = skb->hash;skb_scrub_packet (skb, true);memset (&skb->headers_start,0 , offsetof(struct sk_buff , headers_end) - offsetof(struct sk_buff , headers_start)); +if (encapsulating) { + skb->l4_hash = l4_hash; + skb->sw_hash = sw_hash; + skb->hash = hash; + } skb->queue_mapping =0 ; skb->nohdr =0 ; skb->peeked =0 ;
drivers/net/wireguard/receive.c +1 -1
@@ -485,7 +485,7 @@ int wg_packet_rx_poll(struct napi_struct *napi, int budget)if (unlikely (wg_socket_endpoint_from_skb (&endpoint, skb))) goto next; -wg_reset_packet (skb); +wg_reset_packet (skb, false);wg_packet_consume_data_done (peer, skb, &endpoint); free = false;
drivers/net/wireguard/send.c +6 -1
@@ -170,6 +170,11 @@ static bool encrypt_packet(struct sk_buff *skb, struct noise_keypair *keypair)struct sk_buff *trailer;int num_frags; +/* Force hash calculation before encryption so that flow analysis is +* consistent over the inner packet. +*/ +skb_get_hash (skb); +/* Calculate lengths. */ padding_len =calculate_skb_padding (skb); trailer_len = padding_len +noise_encrypted_len (0 );
@@ -298,7 +303,7 @@ void wg_packet_encrypt_worker(struct work_struct *work) skb_list_walk_safe(first, skb, next) {if (likely (encrypt_packet (skb,PACKET_CB (first)->keypair))) { -wg_reset_packet (skb); +wg_reset_packet (skb, true); }else { state =PACKET_STATE_DEAD ;break ;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 236/606 wireguard: noise: separate receive counter from send counter
In reply to Sasha LevinFrom: "Jason A. Donenfeld" <[email protected]>
[ Upstream commit a9e90d9931f3a474f04bab782ccd9d77904941e9 ]
In "wireguard: queueing: preserve flow hash across packet scrubbing", we were required to slightly increase the size of the receive replay counter to something still fairly small, but an increase nonetheless. It turns out that we can recoup some of the additional memory overhead by splitting up the prior union type into two distinct types. Before, we used the same "noise_counter" union for both sending and receiving, with sending just using a simple atomic64_t, while receiving used the full replay counter checker. This meant that most of the memory being allocated for the sending counter was being wasted. Since the old "noise_counter" type increased in size in the prior commit, now is a good time to split up that union type into a distinct "noise_replay_ counter" for receiving and a boring atomic64_t for sending, each using neither more nor less memory than required.
Also, since sometimes the replay counter is accessed without necessitating additional accesses to the bitmap, we can reduce cache misses by hoisting the always-necessary lock above the bitmap in the struct layout. We also change a "noise_replay_counter" stack allocation to kmalloc in a -DDEBUG selftest so that KASAN doesn't trigger a stack frame warning.
All and all, removing a bit of abstraction in this commit makes the code simpler and smaller, in addition to the motivating memory usage recuperation. For example, passing around raw "noise_symmetric_key" structs is something that really only makes sense within noise.c, in the one place where the sending and receiving keys can safely be thought of as the same type of object; subsequent to that, it's important that we uniformly access these through keypair->{sending,receiving}, where their distinct roles are always made explicit. So this patch allows us to draw that distinction clearly as well.
--- drivers/net/wireguard/noise.c | 16 +++------ drivers/net/wireguard/noise.h | 14 ++++---- drivers/net/wireguard/receive.c | 42 ++++++++++++------------ drivers/net/wireguard/selftest/counter.c | 17 +++++++--- drivers/net/wireguard/send.c | 12 +++---- 5 files changed, 48 insertions(+), 53 deletions(-)
drivers/net/wireguard/noise.c +4 -12
@@ -104,6 +104,7 @@ static struct noise_keypair *keypair_create(struct wg_peer *peer)if (unlikely (!keypair))return NULL ; +spin_lock_init (&keypair->receiving_counter.lock); keypair->internal_id =atomic64_inc_return (&keypair_counter); keypair->entry.type =INDEX_HASHTABLE_KEYPAIR ; keypair->entry.peer = peer;
@@ -358,25 +359,16 @@ static void kdf(u8 *first_dst, u8 *second_dst, u8 *third_dst, const u8 *data,memzero_explicit (output,BLAKE2S_HASH_SIZE +1 ); } -static void symmetric_key_init (struct noise_symmetric_key *key) -{ -spin_lock_init (&key->counter.receive.lock); -atomic64_set (&key->counter.counter,0 ); -memset (key->counter.receive.backtrack,0 , -sizeof (key->counter.receive.backtrack)); - key->birthdate =ktime_get_coarse_boottime_ns (); - key->is_valid = true; -} -static void derive_keys (struct noise_symmetric_key *first_dst,struct noise_symmetric_key *second_dst,const u8 chaining_key[NOISE_HASH_LEN ]) { +u64 birthdate =ktime_get_coarse_boottime_ns ();kdf (first_dst->key, second_dst->key,NULL ,NULL ,NOISE_SYMMETRIC_KEY_LEN ,NOISE_SYMMETRIC_KEY_LEN ,0 ,0 , chaining_key); -symmetric_key_init (first_dst); -symmetric_key_init (second_dst); + first_dst->birthdate = second_dst->birthdate = birthdate; + first_dst->is_valid = second_dst->is_valid = true; } static bool __must_check mix_dh(u8 chaining_key[NOISE_HASH_LEN],
drivers/net/wireguard/noise.h +6 -8
@@ -15,18 +15,14 @@#include <linux/mutex.h> #include <linux/kref.h> -union noise_counter { -struct { -u64 counter; -unsigned long backtrack[COUNTER_BITS_TOTAL /BITS_PER_LONG ]; -spinlock_t lock; - } receive; -atomic64_t counter; +struct noise_replay_counter { +u64 counter; +spinlock_t lock; +unsigned long backtrack[COUNTER_BITS_TOTAL /BITS_PER_LONG ]; };struct noise_symmetric_key {u8 key[NOISE_SYMMETRIC_KEY_LEN ]; -union noise_counter counter;u64 birthdate;bool is_valid; };
@@ -34,7 +30,9 @@ struct noise_symmetric_key {struct noise_keypair {struct index_hashtable_entry entry;struct noise_symmetric_key sending; +atomic64_t sending_counter;struct noise_symmetric_key receiving; +struct noise_replay_counter receiving_counter;__le32 remote_index;bool i_am_the_initiator;struct kref refcount;
drivers/net/wireguard/receive.c +21 -21
109 lines not on this page · raw message
drivers/net/wireguard/selftest/counter.c +12 -5
@@ -6,18 +6,24 @@ #ifdef DEBUG bool __init wg_packet_counter_selftest(void) { + struct noise_replay_counter *counter; unsigned int test_num = 0, i; - union noise_counter counter; bool success = true; -#define T_INIT do { \ - memset(&counter, 0, sizeof(union noise_counter)); \ - spin_lock_init(&counter.receive.lock); \ + counter = kmalloc(sizeof(*counter), GFP_KERNEL); + if (unlikely(!counter)) { + pr_err("nonce counter self-test malloc: FAIL\n"); + return false; + } + +#define T_INIT do { \ + memset(counter, 0, sizeof(*counter)); \ + spin_lock_init(&counter->lock); \ } while (0) #define T_LIM (COUNTER_WINDOW_SIZE + 1) #define T(n, v) do { \ ++test_num; \ - if (counter_validate(&counter, n) != (v)) { \ + if (counter_validate(counter, n) != (v)) { \ pr_err("nonce counter self-test %u: FAIL\n", \ test_num); \ success = false; \
@@ -99,6 +105,7 @@ bool __init wg_packet_counter_selftest(void)if (success)pr_info ("nonce counter self-tests: pass\n" ); +kfree (counter); return success; }#endif
drivers/net/wireguard/send.c +5 -7
@@ -129,7 +129,7 @@ static void keep_key_fresh(struct wg_peer *peer)rcu_read_lock_bh (); keypair =rcu_dereference_bh (peer->keypairs.current_keypair); if (likely(keypair && READ_ONCE(keypair->sending.is_valid)) && - (unlikely(atomic64_read(&keypair->sending.counter.counter) > + (unlikely(atomic64_read(&keypair->sending_counter) > REKEY_AFTER_MESSAGES) || (keypair->i_am_the_initiator && unlikely(wg_birthdate_has_expired(keypair->sending.birthdate,
@@ -353,7 +353,6 @@ void wg_packet_purge_staged_packets(struct wg_peer *peer)void wg_packet_send_staged_packets (struct wg_peer *peer) { -struct noise_symmetric_key *key;struct noise_keypair *keypair;struct sk_buff_head packets;struct sk_buff *skb;
@@ -373,10 +372,9 @@ void wg_packet_send_staged_packets(struct wg_peer *peer)rcu_read_unlock_bh ();if (unlikely (!keypair)) goto out_nokey; - key = &keypair->sending; -if (unlikely (!READ_ONCE (key->is_valid))) +if (unlikely (!READ_ONCE (keypair->sending.is_valid))) goto out_nokey; -if (unlikely (wg_birthdate_has_expired (key->birthdate, +if (unlikely (wg_birthdate_has_expired (keypair->sending.birthdate,REJECT_AFTER_TIME ))) goto out_invalid;
@@ -391,7 +389,7 @@ void wg_packet_send_staged_packets(struct wg_peer *peer)*/ PACKET_CB (skb)->ds =ip_tunnel_ecn_encap (0 ,ip_hdr (skb), skb);PACKET_CB (skb)->nonce = -atomic64_inc_return (&key->counter.counter) -1 ; +atomic64_inc_return (&keypair->sending_counter) -1 ;if (unlikely (PACKET_CB (skb)->nonce >=REJECT_AFTER_MESSAGES )) goto out_invalid; }
@@ -403,7 +401,7 @@ void wg_packet_send_staged_packets(struct wg_peer *peer)return ; out_invalid: -WRITE_ONCE (key->is_valid, false); +WRITE_ONCE (keypair->sending.is_valid, false); out_nokey:wg_noise_keypair_put (keypair, false);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 242/606 net/mlx5: Annotate mutex destroy for root ns
In reply to Sasha LevinFrom: Roi Dayan <[email protected]>
commit 9ca415399dae133b00273a4283ef31d003a6818d upstream.
Invoke mutex_destroy() to catch any errors.
--- drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +6 -0
@@ -416,6 +416,12 @@ static void del_sw_ns(struct fs_node *node)static void del_sw_prio (struct fs_node *node) { +struct mlx5_flow_root_namespace *root_ns; +struct mlx5_flow_namespace *ns; + +fs_get_obj (ns, node); + root_ns = container_of(ns, struct mlx5_flow_root_namespace, ns); +mutex_destroy (&root_ns->chain_lock);kfree (node); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 243/606 net/tls: fix encryption error checking
In reply to Sasha LevinFrom: Vadim Fedorenko <[email protected]>
commit a7bff11f6f9afa87c25711db8050c9b5324db0e2 upstream.
bpf_exec_tx_verdict() can return negative value for copied variable. In that case this value will be pushed back to caller and the real error code will be lost. Fix it using signed type and checking for positive value.
--- net/tls/tls_sw.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
net/tls/tls_sw.c +6 -5
@@ -784,7 +784,7 @@ static int tls_push_record(struct sock *sk, int flags,static int bpf_exec_tx_verdict (struct sk_msg *msg,struct sock *sk,bool full_record,u8 record_type, -size_t *copied,int flags) +ssize_t *copied,int flags) {struct tls_context *tls_ctx =tls_get_ctx (sk);struct tls_sw_context_tx *ctx =tls_sw_ctx_tx (tls_ctx);
@@ -920,7 +920,8 @@ int tls_sw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)unsigned char record_type =TLS_RECORD_TYPE_DATA ;bool is_kvec =iov_iter_is_kvec (&msg->msg_iter);bool eor = !(msg->msg_flags &MSG_MORE ); -size_t try_to_copy, copied =0 ; +size_t try_to_copy; +ssize_t copied =0 ;struct sk_msg *msg_pl, *msg_en;struct tls_rec *rec;int required_size;
@@ -1129,7 +1130,7 @@ int tls_sw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)release_sock (sk);mutex_unlock (&tls_ctx->tx_lock); -return copied ? copied : ret; +return copied >0 ? copied : ret; } static int tls_sw_do_sendpage(struct sock *sk, struct page *page,
@@ -1143,7 +1144,7 @@ static int tls_sw_do_sendpage(struct sock *sk, struct page *page,struct sk_msg *msg_pl;struct tls_rec *rec;int num_async =0 ; -size_t copied =0 ; +ssize_t copied =0 ;bool full_record;int record_room;int ret =0 ;
@@ -1245,7 +1246,7 @@ static int tls_sw_do_sendpage(struct sock *sk, struct page *page, } sendpage_end: ret =sk_stream_error (sk, flags, ret); -return copied ? copied : ret; +return copied >0 ? copied : ret; } int tls_sw_sendpage_locked(struct sock *sk, struct page *page,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 259/606 ARM: dts: omap4-droid4: Fix flakey wlan by disabling internal pull for gpio
In reply to Sasha LevinFrom: Tony Lindgren <[email protected]>
[ Upstream commit 30fa60c678eaa27b8f2a531920d77f7184658f73 ]
The wlan on droid4 is flakey on some devices, and experiments have shown this gets fixed if we disable the internal pull for wlan gpio interrupt line.
The symptoms are that the wlan connection is very slow and almost useless with lots of wlcore firmware reboot warnings in the dmesg.
In addition to configuring the wlan gpio pulls, let's also configure the rest of the wlan sd pins. We have not configured those eariler as we're booting using kexec.
--- .../boot/dts/motorola-mapphone-common.dtsi | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+)
arch/arm/boot/dts/motorola-mapphone-common.dtsi +33 -0
@@ -367,6 +367,8 @@ &mmc2 { }; &mmc3 { + pinctrl-names = "default"; + pinctrl-0 = <&mmc3_pins>; vmmc-supply = <&wl12xx_vmmc>; /* uart2_tx.sdmmc3_dat1 pad as wakeirq */ interrupts-extended = <&wakeupgen GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH
@@ -472,6 +474,37 @@ OMAP4_IOPAD(0x09e, PIN_INPUT | MUX_MODE0) >; }; + /* + * Android uses PIN_OFF_INPUT_PULLDOWN | PIN_INPUT_PULLUP | MUX_MODE3 + * for gpio_100, but the internal pull makes wlan flakey on some + * devices. Off mode value should be tested if we have off mode working + * later on. + */ + mmc3_pins: pinmux_mmc3_pins { + pinctrl-single,pins = < + /* 0x4a10008e gpmc_wait2.gpio_100 d23 */ + OMAP4_IOPAD(0x08e, PIN_INPUT | MUX_MODE3) + + /* 0x4a100102 abe_mcbsp1_dx.sdmmc3_dat2 ab25 */ + OMAP4_IOPAD(0x102, PIN_INPUT_PULLUP | MUX_MODE1) + + /* 0x4a100104 abe_mcbsp1_fsx.sdmmc3_dat3 ac27 */ + OMAP4_IOPAD(0x104, PIN_INPUT_PULLUP | MUX_MODE1) + + /* 0x4a100118 uart2_cts.sdmmc3_clk ab26 */ + OMAP4_IOPAD(0x118, PIN_INPUT | MUX_MODE1) + + /* 0x4a10011a uart2_rts.sdmmc3_cmd ab27 */ + OMAP4_IOPAD(0x11a, PIN_INPUT_PULLUP | MUX_MODE1) + + /* 0x4a10011c uart2_rx.sdmmc3_dat0 aa25 */ + OMAP4_IOPAD(0x11c, PIN_INPUT_PULLUP | MUX_MODE1) + + /* 0x4a10011e uart2_tx.sdmmc3_dat1 aa26 */ + OMAP4_IOPAD(0x11e, PIN_INPUT_PULLUP | MUX_MODE1) + >; + }; + /* gpmc_ncs0.gpio_50 */ poweroff_gpio: pinmux_poweroff_pins { pinctrl-single,pins = <
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 260/606 ARM: dts: omap4-droid4: Fix occasional lost wakeirq for uart1
In reply to Sasha LevinFrom: Tony Lindgren <[email protected]>
[ Upstream commit 738b150ecefbffb6e55cfa8a3b66a844f777d8fb ]
Looks like using the UART CTS pin does not always trigger for a wake-up when the SoC is idle.
This is probably because the modem first uses gpio_149 to signal the SoC that data will be sent, and the CTS will only get used later when the data transfer is starting.
Let's fix the issue by configuring the gpio_149 pad as the wakeirq for UART. We have gpio_149 managed by the USB PHY for powering up the right USB mode, and after that, the gpio gets recycled as the modem wake-up pin. If needeed, the USB PHY can also later on be configured to use gpio_149 pad as the wakeirq as a shared irq.
Let's also configure the missing properties for uart-has-rtscts and current-speed for the modem port while at it. We already configure the hardware flow control pins with uart1_pins pinctrl setting.
--- arch/arm/boot/dts/motorola-mapphone-common.dtsi | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
arch/arm/boot/dts/motorola-mapphone-common.dtsi +7 -3
@@ -723,14 +723,18 @@ &timer9 { }; /* - * As uart1 is wired to mdm6600 with rts and cts, we can use the cts pin for - * uart1 wakeirq. + * The uart1 port is wired to mdm6600 with rts and cts. The modem uses gpio_149 + * for wake-up events for both the USB PHY and the UART. We can use gpio_149 + * pad as the shared wakeirq for the UART rather than the RX or CTS pad as we + * have gpio_149 trigger before the UART transfer starts. */ &uart1 { pinctrl-names = "default"; pinctrl-0 = <&uart1_pins>; interrupts-extended = <&wakeupgen GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH - &omap4_pmx_core 0xfc>; + &omap4_pmx_core 0x110>; + uart-has-rtscts; + current-speed = <115200>; }; &uart3 {
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 262/606 kselftests: dmabuf-heaps: Fix confused return value on expected error testing
In reply to Sasha LevinFrom: John Stultz <[email protected]>
[ Upstream commit 4bb9d46d47b105a774f9dca642f5271375bca4b2 ]
When I added the expected error testing, I forgot I need to set the return to zero when we successfully see an error.
Without this change we only end up testing a single heap before the test quits.
--- tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c +1 -0
@@ -351,6 +351,7 @@ static int test_alloc_errors(char *heap_name) }printf ("Expected error checking passed\n" ); + ret =0 ; out:if (dmabuf_fd >=0 )close (dmabuf_fd);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 265/606 drm/amdgpu: drop unnecessary cancel_delayed_work_sync on PG ungate
In reply to Sasha LevinFrom: Evan Quan <[email protected]>
[ Upstream commit 1fe48ec08d9f2e26d893a6c05bd6c99a3490f9ef ]
As this is already properly handled in amdgpu_gfx_off_ctrl(). In fact, this unnecessary cancel_delayed_work_sync may leave a small time window for race condition and is dangerous.
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 6 +----- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 12 +++--------- 2 files changed, 4 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1 -5
@@ -4241,11 +4241,7 @@ static int gfx_v10_0_set_powergating_state(void *handle,switch (adev->asic_type) {case CHIP_NAVI10 :case CHIP_NAVI14 : -if (!enable) { -amdgpu_gfx_off_ctrl (adev, false); -cancel_delayed_work_sync (&adev->gfx.gfx_off_delay_work); - }else -amdgpu_gfx_off_ctrl (adev, true); +amdgpu_gfx_off_ctrl (adev, enable);break ;default :break ;
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3 -9
@@ -4734,10 +4734,9 @@ static int gfx_v9_0_set_powergating_state(void *handle,switch (adev->asic_type) {case CHIP_RAVEN :case CHIP_RENOIR : -if (!enable) { +if (!enable)amdgpu_gfx_off_ctrl (adev, false); -cancel_delayed_work_sync (&adev->gfx.gfx_off_delay_work); - } +if (adev->pg_flags &AMD_PG_SUPPORT_RLC_SMU_HS ) {gfx_v9_0_enable_sck_slow_down_on_power_up (adev, true);gfx_v9_0_enable_sck_slow_down_on_power_down (adev, true);
@@ -4761,12 +4760,7 @@ static int gfx_v9_0_set_powergating_state(void *handle,amdgpu_gfx_off_ctrl (adev, true);break ;case CHIP_VEGA12 : -if (!enable) { -amdgpu_gfx_off_ctrl (adev, false); -cancel_delayed_work_sync (&adev->gfx.gfx_off_delay_work); - }else { -amdgpu_gfx_off_ctrl (adev, true); - } +amdgpu_gfx_off_ctrl (adev, enable);break ;default :break ;
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 136/606 ALSA: hda/realtek - Add HP new mute led supported for ALC236
In reply to Sasha LevinFrom: Kailang Yang <[email protected]>
[ Upstream commit 24164f434dc9c23cd34fca1e36acea9d0581bdde ]
HP new platform has new mute led feature.
COEF index 0x34 bit 5 to control playback mute led. COEF index 0x35 bit 2 and bit 3 to control Mic mute led.
[ corrected typos by tiwai ]
--- sound/pci/hda/patch_realtek.c | 44 +++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)
sound/pci/hda/patch_realtek.c +44 -0
@@ -4223,6 +4223,23 @@ static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec, } } +static void alc236_fixup_hp_mute_led_coefbit (struct hda_codec *codec, +const struct hda_fixup *fix, +int action) +{ +struct alc_spec *spec = codec->spec; + +if (action ==HDA_FIXUP_ACT_PRE_PROBE ) { + spec->mute_led_polarity =0 ; + spec->mute_led_coef_idx =0x34 ; + spec->mute_led_coefbit_mask =1 <<5 ; + spec->mute_led_coefbit_on =0 ; + spec->mute_led_coefbit_off =1 <<5 ; + spec->gen.vmaster_mute.hook = alc_fixup_mute_led_coefbit_hook; + spec->gen.vmaster_mute_enum =1 ; + } +} +/* turn on/off mic-mute LED per capture hook by coef bit */ static void alc_hp_cap_micmute_update (struct hda_codec *codec) {
@@ -4250,6 +4267,20 @@ static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec, } } +static void alc236_fixup_hp_coef_micmute_led (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +struct alc_spec *spec = codec->spec; + +if (action ==HDA_FIXUP_ACT_PRE_PROBE ) { + spec->mic_led_coef_idx =0x35 ; + spec->mic_led_coefbit_mask =3 <<2 ; + spec->mic_led_coefbit_on =2 <<2 ; + spec->mic_led_coefbit_off =1 <<2 ; +snd_hda_gen_add_micmute_led (codec, alc_hp_cap_micmute_update); + } +} +static void alc285_fixup_hp_mute_led (struct hda_codec *codec,const struct hda_fixup *fix,int action) {
@@ -4257,6 +4288,13 @@ static void alc285_fixup_hp_mute_led(struct hda_codec *codec,alc285_fixup_hp_coef_micmute_led (codec, fix, action); } +static void alc236_fixup_hp_mute_led (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +alc236_fixup_hp_mute_led_coefbit (codec, fix, action); +alc236_fixup_hp_coef_micmute_led (codec, fix, action); +} +#if IS_REACHABLE (CONFIG_INPUT )static void gpio2_mic_hotkey_event (struct hda_codec *codec,struct hda_jack_callback *event)
@@ -6056,6 +6094,7 @@ enum {ALC294_FIXUP_ASUS_COEF_1B ,ALC285_FIXUP_HP_GPIO_LED ,ALC285_FIXUP_HP_MUTE_LED , + ALC236_FIXUP_HP_MUTE_LED, }; static const struct hda_fixup alc269_fixups[] = {
@@ -7208,6 +7247,10 @@ static const struct hda_fixup alc269_fixups[] = { .type = HDA_FIXUP_FUNC, .v.func = alc285_fixup_hp_mute_led, }, + [ALC236_FIXUP_HP_MUTE_LED] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc236_fixup_hp_mute_led, + }, }; static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -7354,6 +7397,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x103c ,0x84e7 ,"HP Pavilion 15" ,ALC269_FIXUP_HP_MUTE_LED_MIC3 ),SND_PCI_QUIRK (0x103c ,0x8736 ,"HP" ,ALC285_FIXUP_HP_GPIO_LED ),SND_PCI_QUIRK (0x103c ,0x877a ,"HP" ,ALC285_FIXUP_HP_MUTE_LED ), +SND_PCI_QUIRK (0x103c ,0x877d ,"HP" ,ALC236_FIXUP_HP_MUTE_LED ),SND_PCI_QUIRK (0x1043 ,0x103e ,"ASUS X540SA" ,ALC256_FIXUP_ASUS_MIC ),SND_PCI_QUIRK (0x1043 ,0x103f ,"ASUS TX300" ,ALC282_FIXUP_ASUS_TX300 ), SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 266/606 drm/amd/powerplay: perform PG ungate prior to CG ungate
In reply to Sasha LevinFrom: Evan Quan <[email protected]>
[ Upstream commit f4fcfa4282c1a1bf51475ebb0ffda623eebf1191 ]
Since gfxoff should be disabled first before trying to access those GC registers.
--- drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 6 +++--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +3 -3
@@ -319,12 +319,12 @@ static void pp_dpm_en_umd_pstate(struct pp_hwmgr *hwmgr,if (*level & profile_mode_mask) { hwmgr->saved_dpm_level = hwmgr->dpm_level; hwmgr->en_umd_pstate = true; -amdgpu_device_ip_set_clockgating_state (hwmgr->adev, -AMD_IP_BLOCK_TYPE_GFX , -AMD_CG_STATE_UNGATE );amdgpu_device_ip_set_powergating_state (hwmgr->adev,AMD_IP_BLOCK_TYPE_GFX ,AMD_PG_STATE_UNGATE ); +amdgpu_device_ip_set_clockgating_state (hwmgr->adev, +AMD_IP_BLOCK_TYPE_GFX , +AMD_CG_STATE_UNGATE ); } }else {/* exit umd pstate, restore level, enable gfx cg*/
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +3 -3
@@ -1675,12 +1675,12 @@ static int smu_enable_umd_pstate(void *handle,if (*level & profile_mode_mask) { smu_dpm_ctx->saved_dpm_level = smu_dpm_ctx->dpm_level; smu_dpm_ctx->enable_umd_pstate = true; -amdgpu_device_ip_set_clockgating_state (smu->adev, -AMD_IP_BLOCK_TYPE_GFX , -AMD_CG_STATE_UNGATE );amdgpu_device_ip_set_powergating_state (smu->adev,AMD_IP_BLOCK_TYPE_GFX ,AMD_PG_STATE_UNGATE ); +amdgpu_device_ip_set_clockgating_state (smu->adev, +AMD_IP_BLOCK_TYPE_GFX , +AMD_CG_STATE_UNGATE ); } }else {/* exit umd pstate, restore level, enable gfx cg*/
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 267/606 drm/amdgpu: Use GEM obj reference for KFD BOs
In reply to Sasha LevinFrom: Felix Kuehling <[email protected]>
[ Upstream commit 39b3128d7ffd44e400e581e6f49e88cb42bef9a1 ]
Releasing the AMDGPU BO ref directly leads to problems when BOs were exported as DMA bufs. Releasing the GEM reference makes sure that the AMDGPU/TTM BO is not freed too early.
Also take a GEM reference when importing BOs from DMABufs to keep references to imported BOs balances properly.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +3 -2
@@ -1304,7 +1304,7 @@ int amdgpu_amdkfd_gpuvm_free_memory_of_gpu( }/* Free the BO*/ -amdgpu_bo_unref (&mem->bo); +drm_gem_object_put_unlocked (&mem->bo->tbo.base);mutex_destroy (&mem->lock);kfree (mem);
@@ -1647,7 +1647,8 @@ int amdgpu_amdkfd_gpuvm_import_dmabuf(struct kgd_dev *kgd, ALLOC_MEM_FLAGS_VRAM : ALLOC_MEM_FLAGS_GTT) |ALLOC_MEM_FLAGS_WRITABLE |ALLOC_MEM_FLAGS_EXECUTABLE ; - (*mem)->bo =amdgpu_bo_ref (bo); +drm_gem_object_get (&bo->tbo.base); + (*mem)->bo = bo; (*mem)->va = va; (*mem)->domain = (bo->preferred_domains &AMDGPU_GEM_DOMAIN_VRAM ) ?AMDGPU_GEM_DOMAIN_VRAM :AMDGPU_GEM_DOMAIN_GTT ;
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 269/606 usb: dwc3: pci: Enable extcon driver for Intel Merrifield
In reply to Sasha LevinFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 066c09593454e89bc605ffdff1c9810061f9b1e1 ]
Intel Merrifield provides a DR support via PMIC which has its own extcon driver.
Add a property string to link to that driver.
--- drivers/usb/dwc3/dwc3-pci.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/dwc3/dwc3-pci.c +1 -0
@@ -114,6 +114,7 @@ static const struct property_entry dwc3_pci_intel_properties[] = {static const struct property_entry dwc3_pci_mrfld_properties[] = {PROPERTY_ENTRY_STRING ("dr_mode" ,"otg" ), +PROPERTY_ENTRY_STRING ("linux,extcon-name" ,"mrfld_bcove_pwrsrc" ),PROPERTY_ENTRY_BOOL ("linux,sysdev_is_parent" ), {} };
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 273/606 drm/amd/amdgpu: Update update_config() logic
In reply to Sasha LevinFrom: "Leo (Hanghong) Ma" <[email protected]>
[ Upstream commit 650e723cecf2738dee828564396f3239829aba83 ]
[Why]
For MST case: when update_config is called to disable a stream, this clears the settings for all the streams on that link. We should only clear the settings for the stream that was disabled.
[How]
Clear the settings after the call to remove display is called.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c +5 -5
@@ -316,15 +316,15 @@ static void update_config(void *handle, struct cp_psp_stream_config *config)struct mod_hdcp_display *display = &hdcp_work[link_index].display;struct mod_hdcp_link *link = &hdcp_work[link_index].link; -memset (display,0 ,sizeof (*display)); -memset (link,0 ,sizeof (*link)); - - display->index = aconnector->base.index; -if (config->dpms_off) {hdcp_remove_display (hdcp_work, link_index, aconnector);return ; } + +memset (display,0 ,sizeof (*display)); +memset (link,0 ,sizeof (*link)); + + display->index = aconnector->base.index; display->state =MOD_HDCP_DISPLAY_ACTIVE ;if (aconnector->dc_sink !=NULL )
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 271/606 usb: gadget: legacy: fix redundant initialization warnings
In reply to Sasha LevinFrom: Masahiro Yamada <[email protected]>
[ Upstream commit d13cce757954fa663c69845611957396843ed87a ]
Fix the following cppcheck warnings:
drivers/usb/gadget/legacy/inode.c:1364:8: style: Redundant initialization for 'value'. The initialized value is overwritten$
value = -EOPNOTSUPP;
^
drivers/usb/gadget/legacy/inode.c:1331:15: note: value is initialized
int value = -EOPNOTSUPP;
^
drivers/usb/gadget/legacy/inode.c:1364:8: note: value is overwritten
value = -EOPNOTSUPP;
^
drivers/usb/gadget/legacy/inode.c:1817:8: style: Redundant initialization for 'value'. The initialized value is overwritten$
value = -EINVAL;
^
drivers/usb/gadget/legacy/inode.c:1787:18: note: value is initialized
ssize_t value = len, length = len;
^
drivers/usb/gadget/legacy/inode.c:1817:8: note: value is overwritten
value = -EINVAL;
^--- drivers/usb/gadget/legacy/inode.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/usb/gadget/legacy/inode.c +1 -2
@@ -1361,7 +1361,6 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) req->buf = dev->rbuf; req->context =NULL ; - value = -EOPNOTSUPP ;switch (ctrl->bRequest) {case USB_REQ_GET_DESCRIPTOR :
@@ -1784,7 +1783,7 @@ static ssize_t dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) { struct dev_data *dev = fd->private_data; -ssize_t value = len, length = len; +ssize_t value, length = len;unsigned total;u32 tag;char *kbuf;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 277/606 riscv: Add pgprot_writecombine/device and PAGE_SHARED defination if NOMMU
In reply to Sasha LevinFrom: Kefeng Wang <[email protected]>
[ Upstream commit fa8174aa225fe3d53b37552e5066e6f0301dbabd ]
Some drivers use PAGE_SHARED, pgprot_writecombine()/pgprot_device(), add the defination to fix build error if NOMMU.
--- arch/riscv/include/asm/mmio.h | 2 ++ arch/riscv/include/asm/pgtable.h | 1 + 2 files changed, 3 insertions(+)
arch/riscv/include/asm/mmio.h +2 -0
@@ -16,6 +16,8 @@#ifndef CONFIG_MMU #define pgprot_noncached (x) (x) +#define pgprot_writecombine (x) (x) +#define pgprot_device (x) (x)#endif /* CONFIG_MMU */ /* Generic IO read/write. These perform native-endian accesses. */
arch/riscv/include/asm/pgtable.h +1 -0
@@ -460,6 +460,7 @@ static inline int ptep_clear_flush_young(struct vm_area_struct *vma,#else /* CONFIG_MMU */ +#define PAGE_SHARED __pgprot(0)#define PAGE_KERNEL __pgprot(0)#define swapper_pg_dir NULL#define VMALLOC_START 0
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 281/606 csky: Fixup remove duplicate irq_disable
In reply to Sasha LevinFrom: Liu Yibin <[email protected]>
[ Upstream commit 6633a5aa8eb6bda70eb3a9837efd28a67ccc6e0a ]
Interrupt has been disabled in __schedule() with local_irq_disable() and enabled in finish_task_switch->finish_lock_switch() with local_irq_enabled(), So needn't to disable irq here.
--- arch/csky/kernel/entry.S | 2 -- 1 file changed, 2 deletions(-)
arch/csky/kernel/entry.S +0 -2
@@ -318,8 +318,6 @@ ENTRY(__switch_to) mfcr a2, psr /* Save PSR value */ stw a2, (a3, THREAD_SR) /* Save PSR in task struct */ - bclri a2, 6 /* Disable interrupts */ - mtcr a2, psr SAVE_SWITCH_STACK
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 282/606 drm/meson: pm resume add return errno branch
In reply to Sasha LevinFrom: Bernard Zhao <[email protected]>
[ Upstream commit c54a8f1f329197d83d941ad84c4aa38bf282cbbd ]
pm_resump api did not handle drm_mode_config_helper_resume error. This change add handle to return drm_mode_config_helper_resume`s error number. This code logic is aligned with api pm_suspend. After this change, the code maybe a bit readable.
--- drivers/gpu/drm/meson/meson_drv.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/meson/meson_drv.c +1 -3
@@ -412,9 +412,7 @@ static int __maybe_unused meson_drv_pm_resume(struct device *dev)if (priv->afbcd.ops) priv->afbcd.ops->init (priv); -drm_mode_config_helper_resume (priv->drm); - -return 0 ; +return drm_mode_config_helper_resume (priv->drm); }static int compare_of (struct device *dev,void *data)
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 285/606 cifs: Fix null pointer check in cifs_read
In reply to Sasha LevinFrom: Steve French <[email protected]>
[ Upstream commit 9bd21d4b1a767c3abebec203342f3820dcb84662 ]
Coverity scan noted a redundant null check
Coverity-id: 728517
--- fs/cifs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/file.c +1 -1
@@ -4060,7 +4060,7 @@ cifs_read(struct file *file, char *read_data, size_t read_size, loff_t *offset)* than it negotiated since it will refuse the read * then. */ -if ((tcon->ses) && !(tcon->ses->capabilities & +if (!(tcon->ses->capabilities & tcon->ses->server->vals->cap_large_files)) { current_read_size =min_t (uint, current_read_size, CIFSMaxBufSize);
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 137/606 ALSA: hda/realtek: Add quirk for Samsung Notebook
In reply to Sasha LevinFrom: Mike Pozulp <[email protected]>
[ Upstream commit 14425f1f521fdfe274a7bb390637c786432e08b4 ]
Some models of the Samsung Notebook 9 have very quiet and distorted headphone output. This quirk changes the VREF value of the ALC298 codec NID 0x1a from default HIZ to new 100.
[ adjusted to 5.7-base and rearranged in SSID order -- tiwai ]
--- sound/pci/hda/patch_realtek.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
sound/pci/hda/patch_realtek.c +10 -0
@@ -6095,6 +6095,7 @@ enum {ALC285_FIXUP_HP_GPIO_LED ,ALC285_FIXUP_HP_MUTE_LED ,ALC236_FIXUP_HP_MUTE_LED , + ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, }; static const struct hda_fixup alc269_fixups[] = {
@@ -7251,6 +7252,13 @@ static const struct hda_fixup alc269_fixups[] = { .type = HDA_FIXUP_FUNC, .v.func = alc236_fixup_hp_mute_led, }, + [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = { + .type = HDA_FIXUP_VERBS, + .v.verbs = (const struct hda_verb []) { + {0x1a ,AC_VERB_SET_PIN_WIDGET_CONTROL ,0xc5 }, + { } + }, + }, };static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -7446,6 +7454,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x10ec ,0x10f2 ,"Intel Reference board" ,ALC700_FIXUP_INTEL_REFERENCE ),SND_PCI_QUIRK (0x10f7 ,0x8338 ,"Panasonic CF-SZ6" ,ALC269_FIXUP_HEADSET_MODE ),SND_PCI_QUIRK (0x144d ,0xc109 ,"Samsung Ativ book 9 (NP900X3G)" ,ALC269_FIXUP_INV_DMIC ), +SND_PCI_QUIRK (0x144d ,0xc169 ,"Samsung Notebook 9 Pen (NP930SBE-K01US)" ,ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET ), +SND_PCI_QUIRK (0x144d ,0xc176 ,"Samsung Notebook 9 Pro (NP930MBE-K04US)" ,ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET ),SND_PCI_QUIRK (0x144d ,0xc740 ,"Samsung Ativ book 8 (NP870Z5G)" ,ALC269_FIXUP_ATIV_BOOK_8 ),SND_PCI_QUIRK (0x1458 ,0xfa53 ,"Gigabyte BXBT-2807" ,ALC283_FIXUP_HEADSET_MIC ), SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 289/606 Input: usbtouchscreen - add support for BonXeon TP
In reply to Sasha LevinFrom: James Hilliard <[email protected]>
[ Upstream commit e3b4f94ef52ae1592cbe199bd38dbdc0d58b2217 ]
Based on available information this uses the singletouch irtouch protocol. This is tested and confirmed to be fully functional on the BonXeon TP hardware I have.
--- drivers/input/touchscreen/usbtouchscreen.c | 1 + 1 file changed, 1 insertion(+)
drivers/input/touchscreen/usbtouchscreen.c +1 -0
@@ -182,6 +182,7 @@ static const struct usb_device_id usbtouch_devices[] = {#endif #ifdef CONFIG_TOUCHSCREEN_USB_IRTOUCH + {USB_DEVICE(0x255e, 0x0001), .driver_info = DEVTYPE_IRTOUCH}, {USB_DEVICE(0x595a, 0x0001), .driver_info = DEVTYPE_IRTOUCH}, {USB_DEVICE(0x6615, 0x0001), .driver_info = DEVTYPE_IRTOUCH}, {USB_DEVICE(0x6615, 0x0012), .driver_info = DEVTYPE_IRTOUCH_HIRES},
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 112/606 aquantia: Fix the media type of AQC100 ethernet controller in the driver
In reply to Sasha LevinFrom: Richard Clark <[email protected]>
[ Upstream commit 6de556c31061e3b9c36546ffaaac5fdb679a2f14 ]
The Aquantia AQC100 controller enables a SFP+ port, so the driver should configure the media type as '_TYPE_FIBRE' instead of '_TYPE_TP'.
--- drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c +1 -1
@@ -56,7 +56,7 @@ static const struct aq_board_revision_s hw_atl_boards[] = { { AQ_DEVICE_ID_D108, AQ_HWREV_2, &hw_atl_ops_b0, &hw_atl_b0_caps_aqc108, }, { AQ_DEVICE_ID_D109, AQ_HWREV_2, &hw_atl_ops_b0, &hw_atl_b0_caps_aqc109, }, - { AQ_DEVICE_ID_AQC100, AQ_HWREV_ANY, &hw_atl_ops_b1, &hw_atl_b0_caps_aqc107, }, + { AQ_DEVICE_ID_AQC100, AQ_HWREV_ANY, &hw_atl_ops_b1, &hw_atl_b0_caps_aqc100, }, { AQ_DEVICE_ID_AQC107, AQ_HWREV_ANY, &hw_atl_ops_b1, &hw_atl_b0_caps_aqc107, }, { AQ_DEVICE_ID_AQC108, AQ_HWREV_ANY, &hw_atl_ops_b1, &hw_atl_b0_caps_aqc108, }, { AQ_DEVICE_ID_AQC109, AQ_HWREV_ANY, &hw_atl_ops_b1, &hw_atl_b0_caps_aqc109, },
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 295/606 Input: synaptics-rmi4 - really fix attn_data use-after-free
In reply to Sasha LevinFrom: Evan Green <[email protected]>
[ Upstream commit d5a5e5b5fa7b86c05bf073acc0ba98fa280174ec ]
Fix a use-after-free noticed by running with KASAN enabled. If rmi_irq_fn() is run twice in a row, then rmi_f11_attention() (among others) will end up reading from drvdata->attn_data.data, which was freed and left dangling in rmi_irq_fn().
Commit 55edde9fff1a ("Input: synaptics-rmi4 - prevent UAF reported by KASAN") correctly identified and analyzed this bug. However the attempted fix only NULLed out a local variable, missing the fact that drvdata->attn_data is a struct, not a pointer.
NULL out the correct pointer in the driver data to prevent the attention functions from copying from it.
--- drivers/input/rmi4/rmi_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/rmi4/rmi_driver.c +1 -1
@@ -205,7 +205,7 @@ static irqreturn_t rmi_irq_fn(int irq, void *dev_id)if (count) {kfree (attn_data.data); - attn_data.data =NULL ; + drvdata->attn_data.data =NULL ; }if (!kfifo_is_empty (&drvdata->attn_fifo))
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 296/606 Input: synaptics-rmi4 - fix error return code in rmi_driver_probe()
In reply to Sasha LevinFrom: Wei Yongjun <[email protected]>
[ Upstream commit 5caab2da63207d6d631007f592f5219459e3454d ]
Fix to return a negative error code from the input_register_device() error handling case instead of 0, as done elsewhere in this function.
--- drivers/input/rmi4/rmi_driver.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/input/rmi4/rmi_driver.c +2 -1
@@ -1210,7 +1210,8 @@ static int rmi_driver_probe(struct device *dev)if (data->input) {rmi_driver_set_input_name (rmi_dev, data->input);if (!rmi_dev->xport->input) { -if (input_register_device (data->input)) { + retval =input_register_device (data->input); +if (retval) {dev_err (dev,"%s: Failed to register input device.\n" , __func__); goto err_destroy_functions;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 301/606 gpio: exar: Fix bad handling for ida_simple_get error path
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit 333830aa149a87cabeb5d30fbcf12eecc8040d2c ]
The commit 7ecced0934e5 ("gpio: exar: add a check for the return value of ida_simple_get fails") added a goto jump to the common error handler for ida_simple_get() error, but this is wrong in two ways:
it doesn't set the proper return code and, more badly, it invokes ida_simple_remove() with a negative index that shall lead to a kernel panic via BUG_ON().
This patch addresses those two issues.
--- drivers/gpio/gpio-exar.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpio/gpio-exar.c +5 -2
@@ -148,8 +148,10 @@ static int gpio_exar_probe(struct platform_device *pdev)mutex_init (&exar_gpio->lock); index =ida_simple_get (&ida_index,0 ,0 ,GFP_KERNEL ); -if (index <0 ) - goto err_destroy; +if (index <0 ) { + ret = index; + goto err_mutex_destroy; + }sprintf (exar_gpio->name,"exar_gpio%d" , index); exar_gpio->gpio_chip.label = exar_gpio->name;
@@ -176,6 +178,7 @@ static int gpio_exar_probe(struct platform_device *pdev) err_destroy:ida_simple_remove (&ida_index, index); +err_mutex_destroy:mutex_destroy (&exar_gpio->lock);return ret; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 304/606 gpu/drm: ingenic: Fix bogus crtc_atomic_check callback
In reply to Sasha LevinFrom: Paul Cercueil <[email protected]>
[ Upstream commit a53bcc19876498bdd3b4ef796c787295dcc498b4 ]
The code was comparing the SoC's maximum height with the mode's width, and vice-versa. D'oh.
--- drivers/gpu/drm/ingenic/ingenic-drm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/ingenic/ingenic-drm.c +2 -2
@@ -328,8 +328,8 @@ static int ingenic_drm_crtc_atomic_check(struct drm_crtc *crtc,if (!drm_atomic_crtc_needs_modeset (state))return 0 ; -if (state->mode.hdisplay > priv->soc_info->max_height || - state->mode.vdisplay > priv->soc_info->max_width) +if (state->mode.hdisplay > priv->soc_info->max_width || + state->mode.vdisplay > priv->soc_info->max_height)return -EINVAL ; rate = clk_round_rate(priv->pix_clk,
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 305/606 gpu/drm: Ingenic: Fix opaque pointer casted to wrong type
In reply to Sasha LevinFrom: Paul Cercueil <[email protected]>
[ Upstream commit abf56fadf0e208abfb13ad1ac0094416058da0ad ]
The opaque pointer passed to the IRQ handler is a pointer to the drm_device, not a pointer to our ingenic_drm structure.
It still worked, because our ingenic_drm structure contains the drm_device as its first field, so the pointer received had the same value, but this was not semantically correct.
--- drivers/gpu/drm/ingenic/ingenic-drm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/ingenic/ingenic-drm.c +1 -1
@@ -474,7 +474,7 @@ static int ingenic_drm_encoder_atomic_check(struct drm_encoder *encoder,static irqreturn_t ingenic_drm_irq_handler (int irq,void *arg) { -struct ingenic_drm *priv = arg; +struct ingenic_drm *priv =drm_device_get_priv (arg);unsigned int state;regmap_read (priv->map,JZ_REG_LCD_STATE , &state);
Signature · 6 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 306/606 IB/qib: Call kobject_put() when kobject_init_and_add() fails
In reply to Sasha LevinFrom: Kaike Wan <[email protected]>
[ Upstream commit a35cd6447effd5c239b564c80fa109d05ff3d114 ]
When kobject_init_and_add() returns an error in the function qib_create_port_files(), the function kobject_put() is not called for the corresponding kobject, which potentially leads to memory leak.
This patch fixes the issue by calling kobject_put() even if kobject_init_and_add() fails. In addition, the ppd->diagc_kobj is released along with other kobjects when the sysfs is unregistered.
--- drivers/infiniband/hw/qib/qib_sysfs.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/infiniband/hw/qib/qib_sysfs.c +5 -4
@@ -760,7 +760,7 @@ int qib_create_port_files(struct ib_device *ibdev, u8 port_num,qib_dev_err (dd,"Skipping linkcontrol sysfs info, (err %d) port %u\n" , ret, port_num); - goto bail; + goto bail_link; }kobject_uevent (&ppd->pport_kobj,KOBJ_ADD );
@@ -770,7 +770,7 @@ int qib_create_port_files(struct ib_device *ibdev, u8 port_num,qib_dev_err (dd,"Skipping sl2vl sysfs info, (err %d) port %u\n" , ret, port_num); - goto bail_link; + goto bail_sl; }kobject_uevent (&ppd->sl2vl_kobj,KOBJ_ADD );
@@ -780,7 +780,7 @@ int qib_create_port_files(struct ib_device *ibdev, u8 port_num,qib_dev_err (dd,"Skipping diag_counters sysfs info, (err %d) port %u\n" , ret, port_num); - goto bail_sl; + goto bail_diagc; }kobject_uevent (&ppd->diagc_kobj,KOBJ_ADD );
@@ -793,7 +793,7 @@ int qib_create_port_files(struct ib_device *ibdev, u8 port_num,qib_dev_err (dd,"Skipping Congestion Control sysfs info, (err %d) port %u\n" , ret, port_num); - goto bail_diagc; + goto bail_cc; }kobject_uevent (&ppd->pport_cc_kobj,KOBJ_ADD );
@@ -854,6 +854,7 @@ void qib_verbs_unregister_sysfs(struct qib_devdata *dd) &cc_table_bin_attr);kobject_put (&ppd->pport_cc_kobj); } +kobject_put (&ppd->diagc_kobj);kobject_put (&ppd->sl2vl_kobj);kobject_put (&ppd->pport_kobj); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 133/606 tools/bootconfig: Fix resource leak in apply_xbc()
In reply to Sasha LevinFrom: Yunfeng Ye <[email protected]>
[ Upstream commit 8842604446d1f005abcbf8c63c12eabdb5695094 ]
Fix the @data and @fd allocations that are leaked in the error path of apply_xbc().
--- tools/bootconfig/main.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
tools/bootconfig/main.c +6 -3
@@ -287,6 +287,7 @@ int apply_xbc(const char *path, const char *xbc_path) ret =delete_xbc (path);if (ret <0 ) {pr_err ("Failed to delete previous boot config: %d\n" , ret); +free (data);return ret; }
@@ -294,24 +295,26 @@ int apply_xbc(const char *path, const char *xbc_path) fd =open (path,O_RDWR |O_APPEND );if (fd <0 ) {pr_err ("Failed to open %s: %d\n" , path, fd); +free (data);return fd; }/* TODO: Ensure the @path is initramfs/initrd image */ ret =write (fd, data, size +8 );if (ret <0 ) {pr_err ("Failed to apply a boot config: %d\n" , ret); -return ret; + goto out; }/* Write a magic word of the bootconfig */ ret =write (fd,BOOTCONFIG_MAGIC ,BOOTCONFIG_MAGIC_LEN );if (ret <0 ) {pr_err ("Failed to apply a boot config magic: %d\n" , ret); -return ret; + goto out; } +out:close (fd);free (data); -return 0 ; +return ret; }int usage (void )
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 308/606 ARM: dts: bcm2835-rpi-zero-w: Fix led polarity
In reply to Sasha LevinFrom: Vincent Stehlé <[email protected]>
[ Upstream commit 58bb90ab415562eededb932455046924e65df342 ]
The status "ACT" led on the Raspberry Pi Zero W is on when GPIO 47 is low.
This has been verified on a board and somewhat confirmed by both the GPIO name ("STATUS_LED_N") and the reduced schematics [1].
--- arch/arm/boot/dts/bcm2835-rpi-zero-w.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/bcm2835-rpi-zero-w.dts +1 -1
@@ -24,7 +24,7 @@ chosen { leds { act { - gpios = <&gpio 47 GPIO_ACTIVE_HIGH>; + gpios = <&gpio 47 GPIO_ACTIVE_LOW>; }; };
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 310/606 ARM: dts: mmp3: Use the MMP3 compatible string for /clocks
In reply to Sasha LevinFrom: Lubomir Rintel <[email protected]>
[ Upstream commit ec7d12faf81de983efce8ff23f41c5d1bff14c41 ]
Clocks are in fact slightly different on MMP3. In particular, PLL2 is fixed to a different frequency, there's an extra PLL3, and the GPU clocks are configured differently.
--- arch/arm/boot/dts/mmp3.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/mmp3.dtsi +1 -1
@@ -531,7 +531,7 @@ l2: l2-cache-controller@d0020000 { }; soc_clocks: clocks@d4050000 { - compatible = "marvell,mmp2-clock"; + compatible = "marvell,mmp3-clock"; reg = <0xd4050000 0x1000>, <0xd4282800 0x400>, <0xd4015000 0x1000>;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 319/606 ALSA: hda/realtek - Add a model for Thinkpad T570 without DAC workaround
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit 399c01aa49e548c82d40f8161915a5941dd3c60e ]
We fixed the regression of the speaker volume for some Thinkpad models (e.g. T570) by the commit 54947cd64c1b ("ALSA: hda/realtek - Fix speaker output regression on Thinkpad T570"). Essentially it fixes the DAC / pin pairing by a static table. It was confirmed and merged to stable kernel later.
Now, interestingly, we got another regression report for the very same model (T570) about the similar problem, and the commit above was the culprit. That is, by some reason, there are devices that prefer the DAC1, and another device DAC2!
Unfortunately those have the same ID and we have no idea what can differentiate, in this patch, a new fixup model "tpt470-dock-fix" is provided, so that users with such a machine can apply it manually. When model=tpt470-dock-fix option is passed to snd-hda-intel module, it avoids the fixed DAC pairing and the DAC1 is assigned to the speaker like the earlier versions.
--- sound/pci/hda/patch_realtek.c | 36 +++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-)
sound/pci/hda/patch_realtek.c +26 -10
@@ -5484,18 +5484,9 @@ static void alc_fixup_tpt470_dock(struct hda_codec *codec, { 0x19, 0x21a11010 }, /* dock mic */ { } }; -/* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise -* the speaker output becomes too low by some reason on Thinkpads with -* ALC298 codec -*/ -static const hda_nid_t preferred_pairs[] = { -0x14 ,0x03 ,0x17 ,0x02 ,0x21 ,0x02 , -0 - };struct alc_spec *spec = codec->spec;if (action ==HDA_FIXUP_ACT_PRE_PROBE ) { - spec->gen.preferred_dacs = preferred_pairs; spec->parse_flags =HDA_PINCFG_NO_HP_FIXUP ;snd_hda_apply_pincfgs (codec, pincfgs); }else if (action ==HDA_FIXUP_ACT_INIT ) {
@@ -5508,6 +5499,23 @@ static void alc_fixup_tpt470_dock(struct hda_codec *codec, } } +static void alc_fixup_tpt470_dacs (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +/* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise +* the speaker output becomes too low by some reason on Thinkpads with +* ALC298 codec +*/ +static const hda_nid_t preferred_pairs[] = { +0x14 ,0x03 ,0x17 ,0x02 ,0x21 ,0x02 , +0 + }; +struct alc_spec *spec = codec->spec; + +if (action ==HDA_FIXUP_ACT_PRE_PROBE ) + spec->gen.preferred_dacs = preferred_pairs; +} +static void alc_shutup_dell_xps13 (struct hda_codec *codec) {struct alc_spec *spec = codec->spec;
@@ -6063,6 +6071,7 @@ enum {ALC700_FIXUP_INTEL_REFERENCE ,ALC274_FIXUP_DELL_BIND_DACS ,ALC274_FIXUP_DELL_AIO_LINEOUT_VERB , +ALC298_FIXUP_TPT470_DOCK_FIX ,ALC298_FIXUP_TPT470_DOCK ,ALC255_FIXUP_DUMMY_LINEOUT_VERB , ALC255_FIXUP_DELL_HEADSET_MIC,
@@ -6994,12 +7003,18 @@ static const struct hda_fixup alc269_fixups[] = { .chained = true, .chain_id =ALC274_FIXUP_DELL_BIND_DACS }, - [ALC298_FIXUP_TPT470_DOCK] = { + [ALC298_FIXUP_TPT470_DOCK_FIX] = { .type = HDA_FIXUP_FUNC, .v.func = alc_fixup_tpt470_dock, .chained = true, .chain_id =ALC293_FIXUP_LENOVO_SPK_NOISE }, + [ALC298_FIXUP_TPT470_DOCK] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc_fixup_tpt470_dacs, + .chained = true, + .chain_id =ALC298_FIXUP_TPT470_DOCK_FIX + }, [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = { .type = HDA_FIXUP_PINS, .v.pins = (const struct hda_pintbl []) {
@@ -7638,6 +7653,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = { {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"}, {.id = ALC292_FIXUP_TPT440, .name = "tpt440"}, {.id = ALC292_FIXUP_TPT460, .name = "tpt460"}, + {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"}, {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"}, {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"}, {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 138/606 ALSA: hda/realtek - Enable headset mic of ASUS GL503VM with ALC295
In reply to Sasha LevinFrom: Chris Chiu <[email protected]>
[ Upstream commit 9e43342b464f1de570a3ad8256ac77645749ef45 ]
The ASUS laptop GL503VM with ALC295 can't detect the headset microphone. The headset microphone does not work until pin 0x19 is enabled for it.
--- sound/pci/hda/patch_realtek.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
sound/pci/hda/patch_realtek.c +18 -0
@@ -6096,6 +6096,7 @@ enum {ALC285_FIXUP_HP_MUTE_LED ,ALC236_FIXUP_HP_MUTE_LED ,ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET , + ALC295_FIXUP_ASUS_MIC_NO_PRESENCE, }; static const struct hda_fixup alc269_fixups[] = {
@@ -7259,6 +7260,15 @@ static const struct hda_fixup alc269_fixups[] = { { } }, }, + [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE ] = { + .type =HDA_FIXUP_PINS , + .v.pins = (const struct hda_pintbl []) { + {0x19 ,0x01a1913c },/* use as headset mic, without its own jack detect */ + { } + }, + .chained = true, + .chain_id =ALC269_FIXUP_HEADSET_MODE + }, };static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -8040,6 +8050,14 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { {0x12, 0x90a60130}, {0x17, 0x90170110}, {0x21, 0x03211020}), +SND_HDA_PIN_QUIRK (0x10ec0295 ,0x1043 ,"ASUS" ,ALC295_FIXUP_ASUS_MIC_NO_PRESENCE , + {0x12, 0x90a60130}, + {0x17, 0x90170110}, + {0x21, 0x03211020}), +SND_HDA_PIN_QUIRK (0x10ec0295 ,0x1043 ,"ASUS" ,ALC295_FIXUP_ASUS_MIC_NO_PRESENCE , + {0x12, 0x90a60130}, + {0x17, 0x90170110}, + {0x21, 0x03211020}),SND_HDA_PIN_QUIRK (0x10ec0295 ,0x1028 ,"Dell" ,ALC269_FIXUP_DELL4_MIC_NO_PRESENCE , {0x14, 0x90170110}, {0x21, 0x04211020}),
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 323/606 ALSA: usb-audio: Quirks for Gigabyte TRX40 Aorus Master onboard audio
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit 7f5ad9c9003425175f46c94df380e8c9e558cfb5 ]
Gigabyte TRX40 Aorus Master is equipped with two USB-audio devices, a Realtek ALC1220-VB codec (USB ID 0414:a001) and an ESS SABRE9218 DAC (USB ID 0414:a000). The latter serves solely for the headphone output on the front panel while the former serves for the rest I/Os (mostly for the I/Os in the rear panel but also including the front mic).
Both chips do work more or less with the unmodified USB-audio driver, but there are a few glitches. The ALC1220-VB returns an error for an inquiry to some jacks, as already seen on other TRX40-based mobos. However this machine has a slightly incompatible configuration, hence the existing mapping cannot be used as is.
Meanwhile the ESS chip seems working without any quirk. But since both audio devices don't provide any specific names, both cards appear as "USB-Audio", and it's quite confusing for users.
This patch is an attempt to overcome those issues:
- The specific mapping table for ALC1220-VB is provided, reducing the non-working nodes and renaming the badly chosen controls. The connector map isn't needed here unlike other TRX40 quirks.
- For both USB IDs (0414:a000 and 0414:a001), provide specific card name strings, so that user-space can identify more easily; and more importantly, UCM profile can be applied to each.
--- sound/usb/mixer_maps.c | 19 +++++++++++++++++++ sound/usb/quirks-table.h | 25 +++++++++++++++++++++++++ 2 files changed, 44 insertions(+)
sound/usb/mixer_maps.c +19 -0
@@ -397,6 +397,21 @@ static const struct usbmix_connector_map trx40_mobo_connector_map[] = { {} }; +/* Rear panel + front mic on Gigabyte TRX40 Aorus Master with ALC1220-VB */ +static const struct usbmix_name_map aorus_master_alc1220vb_map[] = { + {17 ,NULL },/* OT, IEC958?, disabled */ + {19 ,NULL ,12 },/* FU, Input Gain Pad - broken response, disabled */ + {16 ,"Line Out" },/* OT */ + {22 ,"Line Out Playback" },/* FU */ + {7 ,"Line" },/* IT */ + {19 ,"Line Capture" },/* FU */ + {8 ,"Mic" },/* IT */ + {20 ,"Mic Capture" },/* FU */ + {9 ,"Front Mic" },/* IT */ + {21 ,"Front Mic Capture" },/* FU */ + {} +}; +/* * Control map entries */
@@ -526,6 +541,10 @@ static const struct usbmix_ctl_map usbmix_ctl_maps[] = { .id = USB_ID(0x1b1c, 0x0a42), .map = corsair_virtuoso_map, }, + {/* Gigabyte TRX40 Aorus Master (rear panel + front mic) */ + .id = USB_ID(0x0414, 0xa001), + .map = aorus_master_alc1220vb_map, + }, {/* Gigabyte TRX40 Aorus Pro WiFi */ .id = USB_ID(0x0414, 0xa002), .map = trx40_mobo_map,
sound/usb/quirks-table.h +25 -0
@@ -3650,4 +3650,29 @@ ALC1220_VB_DESKTOP(0x0db0, 0x543d), /* MSI TRX40 */ ALC1220_VB_DESKTOP(0x26ce, 0x0a01), /* Asrock TRX40 Creator */#undef ALC1220_VB_DESKTOP +/* Two entries for Gigabyte TRX40 Aorus Master: +* TRX40 Aorus Master has two USB-audio devices, one for the front headphone +* with ESS SABRE9218 DAC chip, while another for the rest I/O (the rear +* panel and the front mic) with Realtek ALC1220-VB. +* Here we provide two distinct names for making UCM profiles easier. +*/ +{ + USB_DEVICE(0x0414, 0xa000), + .driver_info = (unsigned long ) & (const struct snd_usb_audio_quirk ) { + .vendor_name ="Gigabyte" , + .product_name ="Aorus Master Front Headphone" , + .profile_name ="Gigabyte-Aorus-Master-Front-Headphone" , + .ifnum =QUIRK_NO_INTERFACE + } +}, +{ + USB_DEVICE(0x0414, 0xa001), + .driver_info = (unsigned long ) & (const struct snd_usb_audio_quirk ) { + .vendor_name ="Gigabyte" , + .product_name ="Aorus Master Main Audio" , + .profile_name ="Gigabyte-Aorus-Master-Main-Audio" , + .ifnum =QUIRK_NO_INTERFACE + } +}, + #undef USB_DEVICE_VENDOR_SPEC
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 150/606 powerpc/64s: Disable STRICT_KERNEL_RWX
In reply to Sasha LevinFrom: Michael Ellerman <[email protected]>
commit 8659a0e0efdd975c73355dbc033f79ba3b31e82c upstream.
Several strange crashes have been eventually traced back to STRICT_KERNEL_RWX and its interaction with code patching.
Various paths in our ftrace, kprobes and other patching code need to be hardened against patching failures, otherwise we can end up running with partially/incorrectly patched ftrace paths, kprobes or jump labels, which can then cause strange crashes.
Although fixes for those are in development, they're not -rc material.
There also seem to be problems with the underlying strict RWX logic, which needs further debugging.
So for now disable STRICT_KERNEL_RWX on 64-bit to prevent people from enabling the option and tripping over the bugs.
--- arch/powerpc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/Kconfig +1 -1
@@ -129,7 +129,7 @@ config PPC select ARCH_HAS_PTE_SPECIAL select ARCH_HAS_MEMBARRIER_CALLBACKS select ARCH_HAS_SCALED_CPUTIME if VIRT_CPU_ACCOUNTING_NATIVE && PPC_BOOK3S_64 - select ARCH_HAS_STRICT_KERNEL_RWX if ((PPC_BOOK3S_64 || PPC32) && !HIBERNATION) + select ARCH_HAS_STRICT_KERNEL_RWX if (PPC32 && !HIBERNATION) select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST select ARCH_HAS_UACCESS_FLUSHCACHE select ARCH_HAS_UACCESS_MCSAFE if PPC64
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 158/606 dmaengine: dmatest: Restore default for channel
In reply to Sasha LevinFrom: Vladimir Murzin <[email protected]>
commit 6b41030fdc79086db5d673c5ed7169f3ee8c13b9 upstream.
In case of dmatest is built-in and no channel was configured test doesn't run with:
dmatest: Could not start test, no channels configured
Even though description to "channel" parameter claims that default is any.
Add default channel back as it used to be rather than reject test with no channel configuration.
--- drivers/dma/dmatest.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/dma/dmatest.c +5 -4
@@ -1166,10 +1166,11 @@ static int dmatest_run_set(const char *val, const struct kernel_param *kp)mutex_unlock (&info->lock);return ret; }else if (dmatest_run) { -if (is_threaded_test_pending (info)) -start_threaded_tests (info); -else -pr_info ("Could not start test, no channels configured\n" ); +if (!is_threaded_test_pending (info)) { +pr_info ("No channels configured, continue with any\n" ); +add_threaded_test (info); + } +start_threaded_tests (info); }else {stop_threaded_test (info); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 160/606 dmaengine: owl: Use correct lock in owl_dma_get_pchan()
In reply to Sasha LevinFrom: Cristian Ciocaltea <[email protected]>
commit f8f482deb078389b42768b2193e050a81aae137d upstream.
When the kernel is built with lockdep support and the owl-dma driver is used, the following message is shown:
[ 2.496939] INFO: trying to register non-static key. [ 2.501889] the code is fine but needs lockdep annotation. [ 2.507357] turning off the locking correctness validator. [ 2.512834] CPU: 0 PID: 12 Comm: kworker/0:1 Not tainted 5.6.3+ #15 [ 2.519084] Hardware name: Generic DT based system [ 2.523878] Workqueue: events_freezable mmc_rescan [ 2.528681] [<801127f0>] (unwind_backtrace) from [<8010da58>] (show_stack+0x10/0x14) [ 2.536420] [<8010da58>] (show_stack) from [<8080fbe8>] (dump_stack+0xb4/0xe0) [ 2.543645] [<8080fbe8>] (dump_stack) from [<8017efa4>] (register_lock_class+0x6f0/0x718) [ 2.551816] [<8017efa4>] (register_lock_class) from [<8017b7d0>] (__lock_acquire+0x78/0x25f0) [ 2.560330] [<8017b7d0>] (__lock_acquire) from [<8017e5e4>] (lock_acquire+0xd8/0x1f4) [ 2.568159] [<8017e5e4>] (lock_acquire) from [<80831fb0>] (_raw_spin_lock_irqsave+0x3c/0x50) [ 2.576589] [<80831fb0>] (_raw_spin_lock_irqsave) from [<8051b5fc>] (owl_dma_issue_pending+0xbc/0x120) [ 2.585884] [<8051b5fc>] (owl_dma_issue_pending) from [<80668cbc>] (owl_mmc_request+0x1b0/0x390) [ 2.594655] [<80668cbc>] (owl_mmc_request) from [<80650ce0>] (mmc_start_request+0x94/0xbc) [ 2.602906] [<80650ce0>] (mmc_start_request) from [<80650ec0>] (mmc_wait_for_req+0x64/0xd0) [ 2.611245] [<80650ec0>] (mmc_wait_for_req) from [<8065aa10>] (mmc_app_send_scr+0x10c/0x144) [ 2.619669] [<8065aa10>] (mmc_app_send_scr) from [<80659b3c>] (mmc_sd_setup_card+0x4c/0x318) [ 2.628092] [<80659b3c>] (mmc_sd_setup_card) from [<80659f0c>] (mmc_sd_init_card+0x104/0x430) [ 2.636601] [<80659f0c>] (mmc_sd_init_card) from [<8065a3e0>] (mmc_attach_sd+0xcc/0x16c) [ 2.644678] [<8065a3e0>] (mmc_attach_sd) from [<8065301c>] (mmc_rescan+0x3ac/0x40c) [ 2.652332] [<8065301c>] (mmc_rescan) from [<80143244>] (process_one_work+0x2d8/0x780) [ 2.660239] [<80143244>] (process_one_work) from [<80143730>] (worker_thread+0x44/0x598) [ 2.668323] [<80143730>] (worker_thread) from [<8014b5f8>] (kthread+0x148/0x150) [ 2.675708] [<8014b5f8>] (kthread) from [<801010b4>] (ret_from_fork+0x14/0x20) [ 2.682912] Exception stack(0xee8fdfb0 to 0xee8fdff8) [ 2.687954] dfa0: 00000000 00000000 00000000 00000000 [ 2.696118] dfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 2.704277] dfe0: 00000000 00000000 00000000 00000000 00000013 00000000
The obvious fix would be to use 'spin_lock_init()' on 'pchan->lock' before attempting to call 'spin_lock_irqsave()' in 'owl_dma_get_pchan()'.
However, according to Manivannan Sadhasivam, 'pchan->lock' was supposed to only protect 'pchan->vchan' while 'od->lock' does a similar job in 'owl_dma_terminate_pchan()'.
Therefore, this patch substitutes 'pchan->lock' with 'od->lock' and removes the 'lock' attribute in 'owl_dma_pchan' struct.
--- drivers/dma/owl-dma.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/dma/owl-dma.c +3 -5
@@ -175,13 +175,11 @@ struct owl_dma_txd {* @id: physical index to this channel * @base: virtual memory base for the dma channel * @vchan: the virtual channel currently being served by this physical channel -* @lock: a lock to use when altering an instance of this struct */ struct owl_dma_pchan {u32 id;void __iomem *base;struct owl_dma_vchan *vchan; -spinlock_t lock; };/**
@@ -437,14 +435,14 @@ static struct owl_dma_pchan *owl_dma_get_pchan(struct owl_dma *od,for (i =0 ; i < od->nr_pchans; i++) { pchan = &od->pchans[i]; -spin_lock_irqsave (&pchan->lock, flags); +spin_lock_irqsave (&od->lock, flags);if (!pchan->vchan) { pchan->vchan = vchan; -spin_unlock_irqrestore (&pchan->lock, flags); +spin_unlock_irqrestore (&od->lock, flags);break ; } -spin_unlock_irqrestore (&pchan->lock, flags); +spin_unlock_irqrestore (&od->lock, flags); }return pchan;
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 182/606 mei: release me_cl object reference
In reply to Sasha LevinFrom: Alexander Usyskin <[email protected]>
commit fc9c03ce30f79b71807961bfcb42be191af79873 upstream.
Allow me_cl object to be freed by releasing the reference that was acquired by one of the search functions:__mei_me_cl_by_uuid_id() or __mei_me_cl_by_uuid()
--- drivers/misc/mei/client.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/misc/mei/client.c +2 -0
@@ -266,6 +266,7 @@ void mei_me_cl_rm_by_uuid(struct mei_device *dev, const uuid_le *uuid)down_write (&dev->me_clients_rwsem); me_cl =__mei_me_cl_by_uuid (dev, uuid);__mei_me_cl_del (dev, me_cl); +mei_me_cl_put (me_cl);up_write (&dev->me_clients_rwsem); }
@@ -287,6 +288,7 @@ void mei_me_cl_rm_by_uuid_id(struct mei_device *dev, const uuid_le *uuid, u8 id)down_write (&dev->me_clients_rwsem); me_cl =__mei_me_cl_by_uuid_id (dev, uuid, id);__mei_me_cl_del (dev, me_cl); +mei_me_cl_put (me_cl);up_write (&dev->me_clients_rwsem); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 140/606 ALSA: hda/realtek: Enable headset mic of ASUS UX581LV with ALC295
In reply to Sasha LevinFrom: Jian-Hong Pan <[email protected]>
[ Upstream commit 7900e81797613b92f855f9921392a7430cbdf88c ]
The ASUS UX581LV laptop's audio (1043:19e1) with ALC295 can't detect the headset microphone until ALC295_FIXUP_ASUS_MIC_NO_PRESENCE quirk applied.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -7436,6 +7436,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x1043 ,0x18b1 ,"Asus MJ401TA" ,ALC256_FIXUP_ASUS_HEADSET_MIC ),SND_PCI_QUIRK (0x1043 ,0x18f1 ,"Asus FX505DT" ,ALC256_FIXUP_ASUS_HEADSET_MIC ),SND_PCI_QUIRK (0x1043 ,0x19ce ,"ASUS B9450FA" ,ALC294_FIXUP_ASUS_HPE ), +SND_PCI_QUIRK (0x1043 ,0x19e1 ,"ASUS UX581LV" ,ALC295_FIXUP_ASUS_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1043 ,0x1a13 ,"Asus G73Jw" ,ALC269_FIXUP_ASUS_G73JW ),SND_PCI_QUIRK (0x1043 ,0x1a30 ,"ASUS X705UD" ,ALC256_FIXUP_ASUS_MIC ), SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 143/606 ALSA: iec1712: Initialize STDSP24 properly when using the model=staudio option
In reply to Sasha LevinFrom: Scott Bahling <[email protected]>
commit b0cb099062b0c18246c3a20caaab4c0afc303255 upstream.
The ST Audio ADCIII is an STDSP24 card plus extension box. With commit e8a91ae18bdc ("ALSA: ice1712: Add support for STAudio ADCIII") we enabled the ADCIII ports using the model=staudio option but forgot this part to ensure the STDSP24 card is initialized properly.
--- sound/pci/ice1712/ice1712.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/pci/ice1712/ice1712.c +2 -1
@@ -2332,7 +2332,8 @@ static int snd_ice1712_chip_init(struct snd_ice1712 *ice)pci_write_config_byte (ice->pci,0x61 , ice->eeprom.data[ICE_EEP1_ACLINK ]);pci_write_config_byte (ice->pci,0x62 , ice->eeprom.data[ICE_EEP1_I2SID ]);pci_write_config_byte (ice->pci,0x63 , ice->eeprom.data[ICE_EEP1_SPDIF ]); -if (ice->eeprom.subvendor !=ICE1712_SUBDEVICE_STDSP24 ) { +if (ice->eeprom.subvendor !=ICE1712_SUBDEVICE_STDSP24 && + ice->eeprom.subvendor !=ICE1712_SUBDEVICE_STAUDIO_ADCIII ) { ice->gpio.write_mask = ice->eeprom.gpiomask; ice->gpio.direction = ice->eeprom.gpiodir; snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK,
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 220/606 net: qrtr: Fix passing invalid reference to qrtr_local_enqueue()
In reply to Sasha LevinFrom: Manivannan Sadhasivam <[email protected]>
[ Upstream commit d28ea1fbbf437054ef339afec241019f2c4e2bb6 ]
Once the traversal of the list is completed with list_for_each_entry(), the iterator (node) will point to an invalid object. So passing this to qrtr_local_enqueue() which is outside of the iterator block is erroneous eventhough the object is not used.
So fix this by passing NULL to qrtr_local_enqueue().
--- net/qrtr/qrtr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/qrtr/qrtr.c +1 -1
@@ -855,7 +855,7 @@ static int qrtr_bcast_enqueue(struct qrtr_node *node, struct sk_buff *skb, }mutex_unlock (&qrtr_node_lock); -qrtr_local_enqueue (node, skb, type, from, to); +qrtr_local_enqueue (NULL , skb, type, from, to);return 0 ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 229/606 net/mlx5e: kTLS, Destroy key object after destroying the TIS
In reply to Sasha LevinFrom: Tariq Toukan <[email protected]>
[ Upstream commit 16736e11f43b80a38f98f6add54fab3b8c297df3 ]
The TLS TIS object contains the dek/key ID.
By destroying the key first, the TIS would contain an invalid non-existing key ID.
Reverse the destroy order, this also acheives the desired assymetry between the destroy and the create flows.
--- drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c +1 -1
@@ -69,8 +69,8 @@ static void mlx5e_ktls_del(struct net_device *netdev,struct mlx5e_ktls_offload_context_tx *tx_priv =mlx5e_get_ktls_tx_priv_ctx (tls_ctx); -mlx5_ktls_destroy_key (priv->mdev, tx_priv->key_id);mlx5e_destroy_tis (priv->mdev, tx_priv->tisn); +mlx5_ktls_destroy_key (priv->mdev, tx_priv->key_id);kvfree (tx_priv); }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 144/606 ALSA: pcm: fix incorrect hw_base increase
In reply to Sasha LevinFrom: Brent Lu <[email protected]>
commit e7513c5786f8b33f0c107b3759e433bc6cbb2efa upstream.
There is a corner case that ALSA keeps increasing the hw_ptr but DMA already stop working/updating the position for a long time.
In following log we can see the position returned from DMA driver does not move at all but the hw_ptr got increased at some point of time so snd_pcm_avail() will return a large number which seems to be a buffer underrun event from user space program point of view. The program thinks there is space in the buffer and fill more data.
[ 418.510086] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 4096 avail 12368 [ 418.510149] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 6910 avail 9554 ... [ 418.681052] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 15102 avail 1362 [ 418.681130] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 16464 avail 0 [ 418.726515] sound pcmC0D5p: pos 96 hw_ptr 16464 appl_ptr 16464 avail 16368
This is because the hw_base will be increased by runtime->buffer_size frames unconditionally if the hw_ptr is not updated for over half of buffer time. As the hw_base increases, so does the hw_ptr increased by the same number.
The avail value returned from snd_pcm_avail() could exceed the limit (buffer_size) easily becase the hw_ptr itself got increased by same buffer_size samples when the corner case happens. In following log, the buffer_size is 16368 samples but the avail is 21810 samples so CRAS server complains about it.
[ 418.851755] sound pcmC0D5p: pos 96 hw_ptr 16464 appl_ptr 27390 avail 5442 [ 418.926491] sound pcmC0D5p: pos 96 hw_ptr 32832 appl_ptr 27390 avail 21810
cras_server[1907]: pcm_avail returned frames larger than buf_size:
sof-glkda7219max: :0,5: 21810 > 16368
By updating runtime->hw_ptr_jiffies each time the HWSYNC is called, the hw_base will keep the same when buffer stall happens at long as the interval between each HWSYNC call is shorter than half of buffer time.
Following is a log captured by a patched kernel. The hw_base/hw_ptr value is fixed in this corner case and user space program should be aware of the buffer stall and handle it.
[ 293.525543] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 4096 avail 12368 [ 293.525606] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 6880 avail 9584 [ 293.525975] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 10976 avail 5488 [ 293.611178] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 15072 avail 1392 [ 293.696429] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 16464 avail 0 ... [ 381.139517] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 16464 avail 0
--- sound/core/pcm_lib.c | 1 + 1 file changed, 1 insertion(+)
sound/core/pcm_lib.c +1 -0
@@ -433,6 +433,7 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream, no_delta_check:if (runtime->status->hw_ptr == new_hw_ptr) { + runtime->hw_ptr_jiffies = curr_jiffies;update_audio_tstamp (substream, &curr_tstamp, &audio_tstamp);return 0 ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 146/606 ALSA: hda/realtek - Add more fixup entries for Clevo machines
In reply to Sasha LevinFrom: PeiSen Hou <[email protected]>
commit 259eb82475316672a5d682a94dc8bdd53cf8d8c3 upstream.
A few known Clevo machines (PC50, PC70, X170) with ALC1220 codec need the existing quirk for pins for PB51 and co.
--- sound/pci/hda/patch_realtek.c | 3 +++ 1 file changed, 3 insertions(+)
sound/pci/hda/patch_realtek.c +3 -0
@@ -2473,6 +2473,9 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {SND_PCI_QUIRK (0x1558 ,0x97e1 ,"Clevo P970[ER][CDFN]" ,ALC1220_FIXUP_CLEVO_P950 ),SND_PCI_QUIRK (0x1558 ,0x65d1 ,"Clevo PB51[ER][CDF]" ,ALC1220_FIXUP_CLEVO_PB51ED_PINS ),SND_PCI_QUIRK (0x1558 ,0x67d1 ,"Clevo PB71[ER][CDF]" ,ALC1220_FIXUP_CLEVO_PB51ED_PINS ), +SND_PCI_QUIRK (0x1558 ,0x50d3 ,"Clevo PC50[ER][CDF]" ,ALC1220_FIXUP_CLEVO_PB51ED_PINS ), +SND_PCI_QUIRK (0x1558 ,0x70d1 ,"Clevo PC70[ER][CDF]" ,ALC1220_FIXUP_CLEVO_PB51ED_PINS ), +SND_PCI_QUIRK (0x1558 ,0x7714 ,"Clevo X170" ,ALC1220_FIXUP_CLEVO_PB51ED_PINS ),SND_PCI_QUIRK_VENDOR (0x1558 ,"Clevo laptop" ,ALC882_FIXUP_EAPD ),SND_PCI_QUIRK (0x161f ,0x2054 ,"Medion laptop" ,ALC883_FIXUP_EAPD ), SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 258/606 ALSA: usb-audio: add mapping for ASRock TRX40 Creator
In reply to Sasha LevinFrom: Andrew Oakley <[email protected]>
[ Upstream commit da7a8f1a8fc3e14c6dcc52b4098bddb8f20390be ]
This is another TRX40 based motherboard with ALC1220-VB USB-audio that requires a static mapping table.
This motherboard also has a PCI device which advertises no codecs. The PCI ID is 1022:1487 and PCI SSID is 1022:d102. As this is using the AMD vendor ID, don't blacklist for now in case other boards have a working audio device with the same ssid.
alsa-info.sh report for this board:
http://alsa-project.org/db/?f=0a742f89066527497b77ce16bca486daccf8a70c
--- sound/usb/mixer_maps.c | 5 +++++ sound/usb/quirks-table.h | 1 + 2 files changed, 6 insertions(+)
sound/usb/mixer_maps.c +5 -0
@@ -549,6 +549,11 @@ static const struct usbmix_ctl_map usbmix_ctl_maps[] = { .map = trx40_mobo_map, .connector_map = trx40_mobo_connector_map, }, + {/* Asrock TRX40 Creator */ + .id = USB_ID(0x26ce, 0x0a01), + .map = trx40_mobo_map, + .connector_map = trx40_mobo_connector_map, + }, { 0 } /* terminator */ };
sound/usb/quirks-table.h +1 -0
@@ -3647,6 +3647,7 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"),ALC1220_VB_DESKTOP (0x0414 ,0xa002 ),/* Gigabyte TRX40 Aorus Pro WiFi */ ALC1220_VB_DESKTOP (0x0db0 ,0x0d64 ),/* MSI TRX40 Creator */ ALC1220_VB_DESKTOP (0x0db0 ,0x543d ),/* MSI TRX40 */ +ALC1220_VB_DESKTOP (0x26ce ,0x0a01 ),/* Asrock TRX40 Creator */ #undef ALC1220_VB_DESKTOP #undef USB_DEVICE_VENDOR_SPEC
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 145/606 ALSA: hda/realtek - Fix silent output on Gigabyte X570 Aorus Xtreme
In reply to Sasha LevinFrom: Christian Lachner <[email protected]>
commit d9e8fe0cffbfdd18de96fa68ee2a8b667a0b046e upstream.
The Gigabyte X570 Aorus Xtreme motherboard with ALC1220 codec requires a similar workaround for Clevo laptops to enforce the DAC/mixer connection path. Set up a quirk entry for that.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -2457,6 +2457,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {SND_PCI_QUIRK (0x1458 ,0xa002 ,"Gigabyte EP45-DS3/Z87X-UD3H" ,ALC889_FIXUP_FRONT_HP_NO_PRESENCE ),SND_PCI_QUIRK (0x1458 ,0xa0b8 ,"Gigabyte AZ370-Gaming" ,ALC1220_FIXUP_GB_DUAL_CODECS ),SND_PCI_QUIRK (0x1458 ,0xa0cd ,"Gigabyte X570 Aorus Master" ,ALC1220_FIXUP_CLEVO_P950 ), +SND_PCI_QUIRK (0x1458 ,0xa0ce ,"Gigabyte X570 Aorus Xtreme" ,ALC1220_FIXUP_CLEVO_P950 ),SND_PCI_QUIRK (0x1462 ,0x1228 ,"MSI-GP63" ,ALC1220_FIXUP_CLEVO_P950 ),SND_PCI_QUIRK (0x1462 ,0x1275 ,"MSI-GL63" ,ALC1220_FIXUP_CLEVO_P950 ), SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 34/606 ARM: dts: imx6dl-yapp4: Fix Ursa board Ethernet connection
In reply to Sasha LevinFrom: Michal Vokáč <[email protected]>
commit cbe63a8358310244e6007398bd2c7c70c7fd51cd upstream.
The Y Soft yapp4 platform supports up to two Ethernet ports. The Ursa board though has only one Ethernet port populated and that is the port@2. Since the introduction of this platform into mainline a wrong port was deleted and the Ethernet could never work. Fix this by deleting the correct port node.
--- arch/arm/boot/dts/imx6dl-yapp4-ursa.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/imx6dl-yapp4-ursa.dts +1 -1
@@ -38,7 +38,7 @@ ®_usb_h1_vbus { }; &switch_ports { - /delete-node/ port@2; + /delete-node/ port@3; }; &touchscreen {
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 318/606 ALSA: hwdep: fix a left shifting 1 by 31 UB bug
In reply to Sasha LevinFrom: Changming Liu <[email protected]>
[ Upstream commit fb8cd6481ffd126f35e9e146a0dcf0c4e8899f2e ]
The "info.index" variable can be 31 in "1 << info.index". This might trigger an undefined behavior since 1 is signed.
Fix this by casting 1 to 1u just to be sure "1u << 31" is defined.
--- sound/core/hwdep.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/core/hwdep.c +2 -2
@@ -216,12 +216,12 @@ static int snd_hwdep_dsp_load(struct snd_hwdep *hw,if (info.index >=32 )return -EINVAL ;/* check whether the dsp was already loaded */ -if (hw->dsp_loaded & (1 << info.index)) +if (hw->dsp_loaded & (1u << info.index))return -EBUSY ; err = hw->ops.dsp_load (hw, &info);if (err <0 )return err; - hw->dsp_loaded |= (1 << info.index); + hw->dsp_loaded |= (1u << info.index);return 0 ; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 315/606 gpio: pxa: Fix return value of pxa_gpio_probe()
In reply to Sasha LevinFrom: Tiezhu Yang <[email protected]>
[ Upstream commit 558ab2e8155e5f42ca0a6407957cd4173dc166cc ]
When call function devm_platform_ioremap_resource(), we should use IS_ERR() to check the return value and return PTR_ERR() if failed.
--- drivers/gpio/gpio-pxa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpio-pxa.c +2 -2
@@ -663,8 +663,8 @@ static int pxa_gpio_probe(struct platform_device *pdev) pchip->irq1 = irq1; gpio_reg_base =devm_platform_ioremap_resource (pdev,0 ); -if (!gpio_reg_base) -return -EINVAL ; +if (IS_ERR (gpio_reg_base)) +return PTR_ERR (gpio_reg_base); clk =clk_get (&pdev->dev,NULL );if (IS_ERR (clk)) {
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 316/606 gpio: bcm-kona: Fix return value of bcm_kona_gpio_probe()
In reply to Sasha LevinFrom: Tiezhu Yang <[email protected]>
[ Upstream commit 98f7d1b15e87c84488b30ecc4ec753b0690b9dbf ]
Propagate the error code returned by devm_platform_ioremap_resource() out of probe() instead of overwriting it.
--- drivers/gpio/gpio-bcm-kona.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-bcm-kona.c +1 -1
@@ -625,7 +625,7 @@ static int bcm_kona_gpio_probe(struct platform_device *pdev) kona_gpio->reg_base =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (kona_gpio->reg_base)) { - ret = -ENXIO ; + ret =PTR_ERR (kona_gpio->reg_base); goto err_irq_domain; }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 48/606 arm64: dts: meson-g12b-ugoos-am6: fix usb vbus-supply
In reply to Sasha LevinFrom: Neil Armstrong <[email protected]>
commit 4e025fd91ba32a16ed8131158aa63cd37d141cbb upstream.
The USB supply used the wrong property, fixing:meson-g12b-ugoos-am6.dt.yaml: usb@ffe09000: 'vbus-regulator' does not match any of the regexes: '^usb@[0-9a-f]+$', 'pinctrl-[0-9]+'
--- arch/arm64/boot/dts/amlogic/meson-g12b-ugoos-am6.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/amlogic/meson-g12b-ugoos-am6.dts +1 -1
@@ -545,7 +545,7 @@ &uart_AO { &usb { status = "okay"; dr_mode = "host"; - vbus-regulator = <&usb_pwr_en>; + vbus-supply = <&usb_pwr_en>; }; &usb2_phy0 {
Signature · 7 lines
2.25.1 _______________________________________________ linux-amlogic mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-amlogic
Sasha Levin
maintainerPATCH 320/606 ALSA: usb-audio: mixer: volume quirk for ESS Technology Asus USB DAC
In reply to Sasha LevinFrom: Chris Chiu <[email protected]>
[ Upstream commit 4020d1ccbe55bdf67b31d718d2400506eaf4b43f ]
The Asus USB DAC is a USB type-C audio dongle for connecting to the headset and headphone. The volume minimum value -23040 which is 0xa600 in hexadecimal with the resolution value 1 indicates this should be endianness issue caused by the firmware bug. Add a volume quirk to fix the volume control problem.
Also fixes this warning:
Warning! Unlikely big volume range (=23040), cval->res is probably wrong.
[5] FU [Headset Capture Volume] ch = 1, val = -23040/0/1 Warning! Unlikely big volume range (=23040), cval->res is probably wrong.
[7] FU [Headset Playback Volume] ch = 1, val = -23040/0/1
--- sound/usb/mixer.c | 8 ++++++++ 1 file changed, 8 insertions(+)
sound/usb/mixer.c +8 -0
@@ -1171,6 +1171,14 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval, cval->res =384 ; }break ; +case USB_ID (0x0495 ,0x3042 ):/* ESS Technology Asus USB DAC */ +if ((strstr (kctl->id.name,"Playback Volume" ) !=NULL ) || +strstr (kctl->id.name,"Capture Volume" ) !=NULL ) { + cval->min >>=8 ; + cval->max =0 ; + cval->res =1 ; + } +break ; } }
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 57/606 arm64: dts: meson-g12b-khadas-vim3: add missing frddr_a status property
In reply to Sasha LevinFrom: Neil Armstrong <[email protected]>
commit 5ac0869fb39b1c1ba84d4d75c550f82e0bf44c96 upstream.
In the process of moving the VIM3 audio nodes to a G12B specific dtsi for enabling the SM1 based VIM3L, the frddr_a status = "okay" property got dropped.
This re-enables the frddr_a node to fix audio support.
--- arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/amlogic/meson-g12b-khadas-vim3.dtsi +4 -0
@@ -152,6 +152,10 @@ &cpu103 { clock-latency = <50000>; }; +&frddr_a { + status = "okay"; +}; + &frddr_b { status = "okay"; };
Signature · 7 lines
2.25.1 _______________________________________________ linux-amlogic mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-amlogic
Sasha Levin
maintainerPATCH 59/606 arm64: dts: meson-g12-common: fix dwc2 clock names
In reply to Sasha LevinFrom: Neil Armstrong <[email protected]>
commit e4f634d812634067b0c661af2e3cecfd629c89b8 upstream.
Use the correct dwc2 clock name.
--- arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +1 -1
@@ -2204,7 +2204,7 @@ dwc2: usb@ff400000 { reg = <0x0 0xff400000 0x0 0x40000>; interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clkc CLKID_USB1_DDR_BRIDGE>; - clock-names = "ddr"; + clock-names = "otg"; phys = <&usb2_phy1>; phy-names = "usb2-phy"; dr_mode = "peripheral";
Signature · 7 lines
2.25.1 _______________________________________________ linux-amlogic mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-amlogic
Sasha Levin
maintainerPATCH 62/606 arm64: dts: imx8mn: Change SDMA1 ahb clock for imx8mn
In reply to Sasha LevinFrom: Adam Ford <[email protected]>
commit 15ddc3e17aec0de4c69d595b873e184432b9791d upstream.
Using SDMA1 with UART1 is causing a "Timeout waiting for CH0" error. This patch changes to ahb clock from SDMA1_ROOT to AHB which fixes the timeout error.
--- arch/arm64/boot/dts/freescale/imx8mn.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8mn.dtsi +1 -1
@@ -661,7 +661,7 @@ sdma1: dma-controller@30bd0000 { reg = <0x30bd0000 0x10000>; interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clk IMX8MN_CLK_SDMA1_ROOT>, - <&clk IMX8MN_CLK_SDMA1_ROOT>; + <&clk IMX8MN_CLK_AHB>; clock-names = "ipg", "ahb"; #dma-cells = <3>; fsl,sdma-ram-script-name = "imx/sdma/sdma-imx7d.bin";
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 324/606 ALSA: hda/realtek - Add new codec supported for ALC287
In reply to Sasha LevinFrom: Kailang Yang <[email protected]>
[ Upstream commit 630e36126e420e1756378b3427b42711ce0b9ddd ]
Enable new codec supported for ALC287.
--- sound/pci/hda/patch_realtek.c | 3 +++ 1 file changed, 3 insertions(+)
sound/pci/hda/patch_realtek.c +3 -0
@@ -384,6 +384,7 @@ static void alc_fill_eapd_coef(struct hda_codec *codec)case 0x10ec0282 :case 0x10ec0283 :case 0x10ec0286 : +case 0x10ec0287 :case 0x10ec0288 :case 0x10ec0285 :case 0x10ec0298 :
@@ -8292,6 +8293,7 @@ static int patch_alc269(struct hda_codec *codec)case 0x10ec0215 :case 0x10ec0245 :case 0x10ec0285 : +case 0x10ec0287 :case 0x10ec0289 : spec->codec_variant =ALC269_TYPE_ALC215 ; spec->shutup = alc225_shutup;
@@ -9570,6 +9572,7 @@ static const struct hda_device_id snd_hda_id_realtek[] = {HDA_CODEC_ENTRY (0x10ec0284 ,"ALC284" , patch_alc269),HDA_CODEC_ENTRY (0x10ec0285 ,"ALC285" , patch_alc269),HDA_CODEC_ENTRY (0x10ec0286 ,"ALC286" , patch_alc269), +HDA_CODEC_ENTRY (0x10ec0287 ,"ALC287" , patch_alc269),HDA_CODEC_ENTRY (0x10ec0288 ,"ALC288" , patch_alc269),HDA_CODEC_ENTRY (0x10ec0289 ,"ALC289" , patch_alc269), HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 70/606 powerpc/ima: Fix secure boot rules in ima arch policy
In reply to Sasha LevinFrom: Nayna Jain <[email protected]>
commit fa4f3f56ccd28ac031ab275e673ed4098855fed4 upstream.
To prevent verifying the kernel module appended signature twice (finit_module), once by the module_sig_check() and again by IMA, powerpc secure boot rules define an IMA architecture specific policy rule only if CONFIG_MODULE_SIG_FORCE is not enabled. This, unfortunately, does not take into account the ability of enabling "sig_enforce" on the boot command line (module.sig_enforce=1).
Including the IMA module appraise rule results in failing the finit_module syscall, unless the module signing public key is loaded onto the IMA keyring.
This patch fixes secure boot policy rules to be based on CONFIG_MODULE_SIG instead.
--- arch/powerpc/kernel/ima_arch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/powerpc/kernel/ima_arch.c +3 -3
@@ -19,12 +19,12 @@ bool arch_ima_get_secureboot(void)* to be stored as an xattr or as an appended signature. * * To avoid duplicate signature verification as much as possible, the IMA -* policy rule for module appraisal is added only if CONFIG_MODULE_SIG_FORCE +* policy rule for module appraisal is added only if CONFIG_MODULE_SIG * is not enabled. */ static const char *const secure_rules[] = {"appraise func=KEXEC_KERNEL_CHECK appraise_flag=check_blacklist appraise_type=imasig|modsig" , -#ifndef CONFIG_MODULE_SIG_FORCE +#ifndef CONFIG_MODULE_SIG"appraise func=MODULE_CHECK appraise_flag=check_blacklist appraise_type=imasig|modsig" , #endifNULL
@@ -50,7 +50,7 @@ static const char *const secure_and_trusted_rules[] = {"measure func=KEXEC_KERNEL_CHECK template=ima-modsig" ,"measure func=MODULE_CHECK template=ima-modsig" ,"appraise func=KEXEC_KERNEL_CHECK appraise_flag=check_blacklist appraise_type=imasig|modsig" , -#ifndef CONFIG_MODULE_SIG_FORCE +#ifndef CONFIG_MODULE_SIG"appraise func=MODULE_CHECK appraise_flag=check_blacklist appraise_type=imasig|modsig" , #endifNULL
Signature · 1 line
2.25.1
Sasha Levin
maintainerPATCH 73/606 riscv: perf: RISCV_BASE_PMU should be independent
In reply to Sasha LevinFrom: Kefeng Wang <[email protected]>
commit 48084c3595cb7429f6ba734cfea1313573b9a7fa upstream.
Selecting PERF_EVENTS without selecting RISCV_BASE_PMU results in a build error.
--- arch/riscv/include/asm/perf_event.h | 8 ++------ arch/riscv/kernel/Makefile | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-)
arch/riscv/include/asm/perf_event.h +2 -6
@@ -12,19 +12,14 @@#include <linux/ptrace.h> #include <linux/interrupt.h> +#ifdef CONFIG_RISCV_BASE_PMU #define RISCV_BASE_COUNTERS 2/* * The RISCV_MAX_COUNTERS parameter should be specified. */ -#ifdef CONFIG_RISCV_BASE_PMU #define RISCV_MAX_COUNTERS 2 -#endif - -#ifndef RISCV_MAX_COUNTERS -#error "Please provide a valid RISCV_MAX_COUNTERS for the PMU." -#endif /* * These are the indexes of bits in counteren register *minus* 1,
@@ -82,6 +77,7 @@ struct riscv_pmu { int irq; }; +#endif #ifdef CONFIG_PERF_EVENTS #define perf_arch_bpf_user_pt_regs (regs) (struct user_regs_struct *)regs#endif
arch/riscv/kernel/Makefile +1 -1
@@ -38,7 +38,7 @@ obj-$(CONFIG_MODULE_SECTIONS) += module-sections.o obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o obj-$(CONFIG_DYNAMIC_FTRACE) += mcount-dyn.o -obj-$(CONFIG_PERF_EVENTS) += perf_event.o +obj-$(CONFIG_RISCV_BASE_PMU) += perf_event.o obj-$(CONFIG_PERF_EVENTS) += perf_callchain.o obj-$(CONFIG_HAVE_PERF_REGS) += perf_regs.o obj-$(CONFIG_RISCV_SBI) += sbi.o
Signature · 1 line
2.25.1