4.19.99-stable review
Subsystems (10)
Greg Kroah-Hartman
maintainerPATCH 477/639 ARM: stm32: use "depends on" instead of "if" after prompt
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
[ Upstream commit 7e8a0f10899075ac2665c78c4e49dbaf32bf3346 ]
This appeared after the global fixups by commit e32465429490 ("ARM: use "depends on" for SoC configs instead of "if" after prompt"). Fix it now.
--- arch/arm/mach-stm32/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/mach-stm32/Kconfig +2 -1
@@ -1,5 +1,6 @@ menuconfig ARCH_STM32 - bool "STMicroelectronics STM32 family" if ARM_SINGLE_ARMV7M || ARCH_MULTI_V7 + bool "STMicroelectronics STM32 family" + depends on ARM_SINGLE_ARMV7M || ARCH_MULTI_V7 select ARMV7M_SYSTICK if ARM_SINGLE_ARMV7M select HAVE_ARM_ARCH_TIMER if ARCH_MULTI_V7 select ARM_GIC if ARCH_MULTI_V7
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 478/639 scsi: libfc: fix null pointer dereference on a null lport
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 41a6bf6529edd10a6def42e3b2c34a7474bcc2f5 ]
Currently if lport is null then the null lport pointer is dereference when printing out debug via the FC_LPORT_DB macro. Fix this by using the more generic FC_LIBFC_DBG debug macro instead that does not use lport.
Addresses-Coverity: ("Dereference after null check")
--- drivers/scsi/libfc/fc_exch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/libfc/fc_exch.c +1 -1
@@ -2603,7 +2603,7 @@ void fc_exch_recv(struct fc_lport *lport, struct fc_frame *fp)/* lport lock ? */ if (!lport || lport->state ==LPORT_ST_DISABLED ) { -FC_LPORT_DBG (lport,"Receiving frames for an lport that " +FC_LIBFC_DBG ("Receiving frames for an lport that " "has not been initialized correctly\n" );fc_frame_free (fp);return ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 479/639 xfrm interface: ifname may be wrong in logs
In reply to Greg Kroah-HartmanFrom: Nicolas Dichtel <[email protected]>
[ Upstream commit e0aaa332e6a97dae57ad59cdb19e21f83c3d081c ]
The ifname is copied when the interface is created, but is never updated later. In fact, this property is used only in one error message, where the netdevice pointer is available, thus let's use it.
--- include/net/xfrm.h | 1 - net/xfrm/xfrm_interface.c | 10 +--------- 2 files changed, 1 insertion(+), 10 deletions(-)
include/net/xfrm.h +0 -1
@@ -1054,7 +1054,6 @@ static inline void xfrm_dst_destroy(struct xfrm_dst *xdst)void xfrm_dst_ifdown (struct dst_entry *dst,struct net_device *dev);struct xfrm_if_parms { -char name[IFNAMSIZ ];/* name of XFRM device */ int link;/* ifindex of underlying L2 interface */ u32 if_id;/* interface identifyer */ };
net/xfrm/xfrm_interface.c +1 -9
@@ -145,8 +145,6 @@ static int xfrmi_create(struct net_device *dev)if (err <0 ) goto out; -strcpy (xi->p.name, dev->name); -dev_hold (dev);xfrmi_link (xfrmn, xi);
@@ -293,7 +291,7 @@ xfrmi_xmit2(struct sk_buff *skb, struct net_device *dev, struct flowi *fl)if (tdev == dev) { stats->collisions++;net_warn_ratelimited ("%s: Local routing loop detected!\n" , - xi->p.name); + dev->name); goto tx_err_dst_release; }
@@ -648,12 +646,6 @@ static int xfrmi_newlink(struct net *src_net, struct net_device *dev,int err;xfrmi_netlink_parms (data, &p); - -if (!tb[IFLA_IFNAME ]) -return -EINVAL ; - -nla_strlcpy (p.name, tb[IFLA_IFNAME ],IFNAMSIZ ); - xi =xfrmi_locate (net, &p);if (xi)return -EEXIST ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 480/639 drm/panel: make drm_panel.h self-contained
In reply to Greg Kroah-HartmanFrom: Jani Nikula <[email protected]>
[ Upstream commit bf3f5e98559360661a3d2af340d46522512c0b00 ]
Fix build warning if drm_panel.h is built with CONFIG_OF=n or CONFIG_DRM_PANEL=n and included without the prerequisite err.h:
./include/drm/drm_panel.h: In function ‘of_drm_find_panel’:./include/drm/drm_panel.h:203:9: error: implicit declaration of function ‘ERR_PTR’ [-Werror=implicit-function-declaration]
return ERR_PTR(-ENODEV);
^~~~~~~
./include/drm/drm_panel.h:203:9: error: returning ‘int’ from a function with return type ‘struct drm_panel *’ makes pointer from integer without a cast [-Werror=int-conversion]
return ERR_PTR(-ENODEV);
^~~~~~~~~~~~~~~~--- include/drm/drm_panel.h | 1 + 1 file changed, 1 insertion(+)
include/drm/drm_panel.h +1 -0
@@ -24,6 +24,7 @@#ifndef __DRM_PANEL_H__#define __DRM_PANEL_H__ +#include <linux/err.h> #include <linux/errno.h> #include <linux/list.h>
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 481/639 clk: sunxi-ng: v3s: add the missing PLL_DDR1
In reply to Greg Kroah-HartmanFrom: Icenowy Zheng <[email protected]>
[ Upstream commit c5ed9475c22c89d5409402055142372e35d26a3f ]
The user manual of V3/V3s/S3 declares a PLL_DDR1, however it's forgot when developing the V3s CCU driver.
Add back the missing PLL_DDR1.
--- drivers/clk/sunxi-ng/ccu-sun8i-v3s.c | 19 +++++++++++++++---- drivers/clk/sunxi-ng/ccu-sun8i-v3s.h | 6 ++++-- 2 files changed, 19 insertions(+), 6 deletions(-)
drivers/clk/sunxi-ng/ccu-sun8i-v3s.c +15 -4
@@ -84,7 +84,7 @@ static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_ve_clk, "pll-ve",BIT (28 ),/* lock */ 0); -static SUNXI_CCU_NKM_WITH_GATE_LOCK(pll_ddr_clk, "pll-ddr", +static SUNXI_CCU_NKM_WITH_GATE_LOCK(pll_ddr0_clk, "pll-ddr0","osc24M" ,0x020 ,8 ,5 ,/* N */ 4, 2, /* K */
@@ -123,6 +123,14 @@ static SUNXI_CCU_NK_WITH_GATE_LOCK_POSTDIV(pll_periph1_clk, "pll-periph1",2 ,/* post-div */ 0); +static SUNXI_CCU_NM_WITH_GATE_LOCK(pll_ddr1_clk, "pll-ddr1", +"osc24M" ,0x04c , +8 ,7 ,/* N */ +0 ,2 ,/* M */ +BIT (31 ),/* gate */ +BIT (28 ),/* lock */ + 0); +static const char *const cpu_parents[] = {"osc32k" ,"osc24M" ,"pll-cpu" ,"pll-cpu" }; static SUNXI_CCU_MUX(cpu_clk, "cpu", cpu_parents,
@@ -310,7 +318,8 @@ static SUNXI_CCU_GATE(usb_phy0_clk, "usb-phy0", "osc24M", static SUNXI_CCU_GATE(usb_ohci0_clk, "usb-ohci0", "osc24M", 0x0cc, BIT(16), 0); -static const char *const dram_parents[] = {"pll-ddr" ,"pll-periph0-2x" }; +static const char *const dram_parents[] = {"pll-ddr0" ,"pll-ddr1" , +"pll-periph0-2x" }; static SUNXI_CCU_M_WITH_MUX(dram_clk, "dram", dram_parents, 0x0f4, 0, 4, 20, 2, CLK_IS_CRITICAL);
@@ -369,10 +378,11 @@ static struct ccu_common *sun8i_v3s_ccu_clks[] = { &pll_audio_base_clk.common, &pll_video_clk.common, &pll_ve_clk.common, - &pll_ddr_clk.common, + &pll_ddr0_clk.common, &pll_periph0_clk.common, &pll_isp_clk.common, &pll_periph1_clk.common, + &pll_ddr1_clk.common, &cpu_clk.common, &axi_clk.common, &ahb1_clk.common,
@@ -457,11 +467,12 @@ static struct clk_hw_onecell_data sun8i_v3s_hw_clks = { [CLK_PLL_AUDIO_8X] = &pll_audio_8x_clk.hw, [CLK_PLL_VIDEO] = &pll_video_clk.common.hw, [CLK_PLL_VE] = &pll_ve_clk.common.hw, - [CLK_PLL_DDR] = &pll_ddr_clk.common.hw, + [CLK_PLL_DDR0] = &pll_ddr0_clk.common.hw, [CLK_PLL_PERIPH0] = &pll_periph0_clk.common.hw, [CLK_PLL_PERIPH0_2X] = &pll_periph0_2x_clk.hw, [CLK_PLL_ISP] = &pll_isp_clk.common.hw, [CLK_PLL_PERIPH1] = &pll_periph1_clk.common.hw, + [CLK_PLL_DDR1] = &pll_ddr1_clk.common.hw, [CLK_CPU] = &cpu_clk.common.hw, [CLK_AXI] = &axi_clk.common.hw, [CLK_AHB1] = &ahb1_clk.common.hw,
drivers/clk/sunxi-ng/ccu-sun8i-v3s.h +4 -2
@@ -29,7 +29,7 @@#define CLK_PLL_AUDIO_8X 5#define CLK_PLL_VIDEO 6#define CLK_PLL_VE 7 -#define CLK_PLL_DDR 8 +#define CLK_PLL_DDR0 8#define CLK_PLL_PERIPH0 9#define CLK_PLL_PERIPH0_2X 10#define CLK_PLL_ISP 11
@@ -58,6 +58,8 @@/* And the GPU module clock is exported */ -#define CLK_NUMBER (CLK_MIPI_CSI + 1) +#define CLK_PLL_DDR1 74 + +#define CLK_NUMBER (CLK_PLL_DDR1 + 1)#endif /* _CCU_SUN8I_H3_H_ */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 482/639 PM: sleep: Fix possible overflow in pm_system_cancel_wakeup()
In reply to Greg Kroah-HartmanFrom: Rafael J. Wysocki <[email protected]>
[ Upstream commit 2933954b71f10d392764f95eec0f0aa2d103054b ]
It is not actually guaranteed that pm_abort_suspend will be nonzero when pm_system_cancel_wakeup() is called which may lead to subtle issues, so make it use atomic_dec_if_positive() instead of atomic_dec() for the safety sake.
--- drivers/base/power/wakeup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/power/wakeup.c +1 -1
@@ -875,7 +875,7 @@ EXPORT_SYMBOL_GPL(pm_system_wakeup);void pm_system_cancel_wakeup (void ) { -atomic_dec (&pm_abort_suspend); +atomic_dec_if_positive (&pm_abort_suspend); }void pm_wakeup_clear (bool reset)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 483/639 libertas_tf: Use correct channel range in lbtf_geo_init
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit 2ec4ad49b98e4a14147d04f914717135eca7c8b1 ]
It seems we should use 'range' instead of 'priv->range' in lbtf_geo_init(), because 'range' is the corret one related to current regioncode.
--- drivers/net/wireless/marvell/libertas_tf/cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/marvell/libertas_tf/cmd.c +1 -1
@@ -69,7 +69,7 @@ static void lbtf_geo_init(struct lbtf_private *priv)break ; } -for (ch = priv->range.start; ch < priv->range.end; ch++) +for (ch = range->start; ch < range->end; ch++) priv->channels[CHAN_TO_IDX (ch)].flags =0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 484/639 qed: reduce maximum stack frame size
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 7c116e02a4a7575c8c62bfd2106e3e3ec8fb99dc ]
clang warns about an overly large stack frame in one function when it decides to inline all __qed_get_vport_*() functions into __qed_get_vport_stats():
drivers/net/ethernet/qlogic/qed/qed_l2.c:1889:13: error: stack frame size of 1128 bytes in function '_qed_get_vport_stats' [-Werror,-Wframe-larger-than=]
Use a noinline_for_stack annotation to prevent clang from inlining these, which keeps the maximum stack usage at around half of that in the worst case, similar to what we get with gcc.
--- drivers/net/ethernet/qlogic/qed/qed_l2.c | 34 +++++++++++------------- 1 file changed, 15 insertions(+), 19 deletions(-)
drivers/net/ethernet/qlogic/qed/qed_l2.c +15 -19
@@ -1631,10 +1631,9 @@ static void __qed_get_vport_pstats_addrlen(struct qed_hwfn *p_hwfn, } } -static void __qed_get_vport_pstats (struct qed_hwfn *p_hwfn, -struct qed_ptt *p_ptt, -struct qed_eth_stats *p_stats, -u16 statistics_bin) +static noinline_for_stack void +__qed_get_vport_pstats (struct qed_hwfn *p_hwfn,struct qed_ptt *p_ptt, +struct qed_eth_stats *p_stats,u16 statistics_bin) {struct eth_pstorm_per_queue_stat pstats;u32 pstats_addr =0 , pstats_len =0 ;
@@ -1661,10 +1660,9 @@ static void __qed_get_vport_pstats(struct qed_hwfn *p_hwfn,HILO_64_REGPAIR (pstats.error_drop_pkts); } -static void __qed_get_vport_tstats (struct qed_hwfn *p_hwfn, -struct qed_ptt *p_ptt, -struct qed_eth_stats *p_stats, -u16 statistics_bin) +static noinline_for_stack void +__qed_get_vport_tstats (struct qed_hwfn *p_hwfn,struct qed_ptt *p_ptt, +struct qed_eth_stats *p_stats,u16 statistics_bin) {struct tstorm_per_port_stat tstats;u32 tstats_addr, tstats_len;
@@ -1709,10 +1707,9 @@ static void __qed_get_vport_ustats_addrlen(struct qed_hwfn *p_hwfn, } } -static void __qed_get_vport_ustats (struct qed_hwfn *p_hwfn, -struct qed_ptt *p_ptt, -struct qed_eth_stats *p_stats, -u16 statistics_bin) +static noinline_for_stack +void __qed_get_vport_ustats(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt, +struct qed_eth_stats *p_stats,u16 statistics_bin) {struct eth_ustorm_per_queue_stat ustats;u32 ustats_addr =0 , ustats_len =0 ;
@@ -1751,10 +1748,9 @@ static void __qed_get_vport_mstats_addrlen(struct qed_hwfn *p_hwfn, } } -static void __qed_get_vport_mstats (struct qed_hwfn *p_hwfn, -struct qed_ptt *p_ptt, -struct qed_eth_stats *p_stats, -u16 statistics_bin) +static noinline_for_stack void +__qed_get_vport_mstats (struct qed_hwfn *p_hwfn,struct qed_ptt *p_ptt, +struct qed_eth_stats *p_stats,u16 statistics_bin) {struct eth_mstorm_per_queue_stat mstats;u32 mstats_addr =0 , mstats_len =0 ;
@@ -1780,9 +1776,9 @@ static void __qed_get_vport_mstats(struct qed_hwfn *p_hwfn,HILO_64_REGPAIR (mstats.tpa_coalesced_bytes); } -static void __qed_get_vport_port_stats (struct qed_hwfn *p_hwfn, -struct qed_ptt *p_ptt, -struct qed_eth_stats *p_stats) +static noinline_for_stack void +__qed_get_vport_port_stats (struct qed_hwfn *p_hwfn,struct qed_ptt *p_ptt, +struct qed_eth_stats *p_stats) {struct qed_eth_stats_common *p_common = &p_stats->common;struct port_stats port_stats;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 485/639 usb: host: xhci-hub: fix extra endianness conversion
In reply to Greg Kroah-HartmanFrom: Ruslan Bilovol <[email protected]>
[ Upstream commit 6269e4c76eacabaea0d0099200ae1a455768d208 ]
Don't do extra cpu_to_le32 conversion for put_unaligned_le32 because it is already implemented in this function.
Fixes sparse error:
xhci-hub.c:1152:44: warning: incorrect type in argument 1 (different base types)
xhci-hub.c:1152:44: expected unsigned int [usertype] val
xhci-hub.c:1152:44: got restricted __le32 [usertype]
--- drivers/usb/host/xhci-hub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci-hub.c +1 -1
@@ -1104,7 +1104,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, } port_li =readl (ports[wIndex]->addr +PORTLI ); status =xhci_get_ext_port_status (temp, port_li); -put_unaligned_le32 (cpu_to_le32 (status), &buf[4 ]); +put_unaligned_le32 (status, &buf[4 ]); }break ;case SetPortFeature:
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 486/639 media: rcar-vin: Clean up correct notifier in error path
In reply to Greg Kroah-HartmanFrom: Niklas Söderlund <[email protected]>
[ Upstream commit 0bd465765f8d1300040de627f0a0971a8849d654 ]
The parallel input initialization error path cleans up the wrong async notifier, fix this by cleaning up the correct notifier.
--- drivers/media/platform/rcar-vin/rcar-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/rcar-vin/rcar-core.c +1 -1
@@ -631,7 +631,7 @@ static int rvin_parallel_init(struct rvin_dev *vin) ret =v4l2_async_notifier_register (&vin->v4l2_dev, &vin->notifier);if (ret <0 ) {vin_err (vin,"Notifier registration failed\n" ); -v4l2_async_notifier_cleanup (&vin->group->notifier); +v4l2_async_notifier_cleanup (&vin->notifier);return ret; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 487/639 mic: avoid statically declaring a struct device.
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit bc83f79bd2119230888fb8574639d5a51b38f903 ]
Generally, declaring a platform device as a static variable is a bad idea and can cause all kinds of problems, in particular with the DMA configuration and lifetime rules.
A specific problem we hit here is from a bug in clang that warns about certain (otherwise valid) macros when used in static variables:
drivers/misc/mic/card/mic_x100.c:285:27: warning: shift count >= width of type [-Wshift-count-overflow]
static u64 mic_dma_mask = DMA_BIT_MASK(64);
^~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:141:54: note: expanded from macro 'DMA_BIT_MASK'
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
^ ~~~A slightly better way here is to create the platform device dynamically and set the dma mask in the probe function.
This avoids the warning and some other problems, but is still not ideal because the device creation should really be separated from the driver, and the fact that the device has no parent means we have to force the dma mask rather than having it set up from the bus that the device is actually on.
--- drivers/misc/mic/card/mic_x100.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-)
drivers/misc/mic/card/mic_x100.c +12 -16
@@ -249,6 +249,9 @@ static int __init mic_probe(struct platform_device *pdev) mdrv->dev = &pdev->dev;snprintf (mdrv->name,sizeof (mic_driver_name), mic_driver_name); +/* FIXME: use dma_set_mask_and_coherent() and check result */ +dma_coerce_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )); + mdev->mmio.pa =MIC_X100_MMIO_BASE ; mdev->mmio.len =MIC_X100_MMIO_LEN ; mdev->mmio.va = devm_ioremap(&pdev->dev, MIC_X100_MMIO_BASE,
@@ -294,18 +297,6 @@ static void mic_platform_shutdown(struct platform_device *pdev)mic_remove (pdev); } -static u64 mic_dma_mask =DMA_BIT_MASK (64 ); - -static struct platform_device mic_platform_dev = { - .name = mic_driver_name, - .id =0 , - .num_resources =0 , - .dev = { - .dma_mask = &mic_dma_mask, - .coherent_dma_mask =DMA_BIT_MASK (64 ), - }, -}; -static struct platform_driver __refdata mic_platform_driver = { .probe = mic_probe, .remove = mic_remove,
@@ -315,6 +306,8 @@ static struct platform_driver __refdata mic_platform_driver = { }, }; +static struct platform_device *mic_platform_dev; +static int __init mic_init (void ) {int ret;
@@ -328,9 +321,12 @@ static int __init mic_init(void)request_module ("mic_x100_dma" );mic_init_card_debugfs (); - ret =platform_device_register (&mic_platform_dev); + + mic_platform_dev =platform_device_register_simple (mic_driver_name, +0 ,NULL ,0 ); + ret =PTR_ERR_OR_ZERO (mic_platform_dev);if (ret) { -pr_err ("platform_device_register ret %d\n" , ret); +pr_err ("platform_device_register_full ret %d\n" , ret); goto cleanup_debugfs; } ret =platform_driver_register (&mic_platform_driver);
@@ -341,7 +337,7 @@ static int __init mic_init(void)return ret; device_unregister: -platform_device_unregister (&mic_platform_dev); +platform_device_unregister (mic_platform_dev); cleanup_debugfs:mic_exit_card_debugfs (); done:
@@ -351,7 +347,7 @@ done: static void __exit mic_exit(void) {platform_driver_unregister (&mic_platform_driver); -platform_device_unregister (&mic_platform_dev); +platform_device_unregister (mic_platform_dev);mic_exit_card_debugfs (); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 488/639 x86/kgbd: Use NMI_VECTOR not APIC_DM_NMI
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
[ Upstream commit 2591bc4e8d70b4e1330d327fb7e3921f4e070a51 ]
apic->send_IPI_allbutself() takes a vector number as argument.
APIC_DM_NMI is clearly not a vector number. It's defined to 0x400 which is outside the vector space.
Use NMI_VECTOR instead as that's what it is intended to be.
--- arch/x86/kernel/kgdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/kgdb.c +1 -1
@@ -438,7 +438,7 @@ static void kgdb_disable_hw_debug(struct pt_regs *regs)*/ void kgdb_roundup_cpus (unsigned long flags) { - apic->send_IPI_allbutself (APIC_DM_NMI ); + apic->send_IPI_allbutself (NMI_VECTOR ); }#endif
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 489/639 crypto: ccp - Reduce maximum stack usage
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 72c8117adfced37df101c8c0b3f363e0906f83f0 ]
Each of the operations in ccp_run_cmd() needs several hundred bytes of kernel stack. Depending on the inlining, these may need separate stack slots that add up to more than the warning limit, as shown in this clang based build:
drivers/crypto/ccp/ccp-ops.c:871:12: error: stack frame size of 1164 bytes in function 'ccp_run_aes_cmd' [-Werror,-Wframe-larger-than=] static int ccp_run_aes_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd)
The problem may also happen when there is no warning, e.g. in the ccp_run_cmd()->ccp_run_aes_cmd()->ccp_run_aes_gcm_cmd() call chain with over 2000 bytes.
Mark each individual function as 'noinline_for_stack' to prevent this from happening, and move the calls to the two special cases for aes into the top-level function. This will keep the actual combined stack usage to the mimimum: 828 bytes for ccp_run_aes_gcm_cmd() and at most 524 bytes for each of the other cases.
--- drivers/crypto/ccp/ccp-ops.c | 52 +++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 21 deletions(-)
drivers/crypto/ccp/ccp-ops.c +31 -21
@@ -458,8 +458,8 @@ static int ccp_copy_from_sb(struct ccp_cmd_queue *cmd_q,return ccp_copy_to_from_sb (cmd_q, wa, jobid, sb, byte_swap, true); } -static int ccp_run_aes_cmac_cmd (struct ccp_cmd_queue *cmd_q, -struct ccp_cmd *cmd) +static noinline_for_stack int +ccp_run_aes_cmac_cmd (struct ccp_cmd_queue *cmd_q,struct ccp_cmd *cmd) {struct ccp_aes_engine *aes = &cmd->u.aes;struct ccp_dm_workarea key, ctx;
@@ -614,8 +614,8 @@ e_key:return ret; } -static int ccp_run_aes_gcm_cmd (struct ccp_cmd_queue *cmd_q, -struct ccp_cmd *cmd) +static noinline_for_stack int +ccp_run_aes_gcm_cmd (struct ccp_cmd_queue *cmd_q,struct ccp_cmd *cmd) {struct ccp_aes_engine *aes = &cmd->u.aes;struct ccp_dm_workarea key, ctx, final_wa, tag;
@@ -897,7 +897,8 @@ e_key:return ret; } -static int ccp_run_aes_cmd (struct ccp_cmd_queue *cmd_q,struct ccp_cmd *cmd) +static noinline_for_stack int +ccp_run_aes_cmd (struct ccp_cmd_queue *cmd_q,struct ccp_cmd *cmd) {struct ccp_aes_engine *aes = &cmd->u.aes;struct ccp_dm_workarea key, ctx;
@@ -907,12 +908,6 @@ static int ccp_run_aes_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd)bool in_place = false;int ret; -if (aes->mode ==CCP_AES_MODE_CMAC ) -return ccp_run_aes_cmac_cmd (cmd_q, cmd); - -if (aes->mode ==CCP_AES_MODE_GCM ) -return ccp_run_aes_gcm_cmd (cmd_q, cmd); -if (!((aes->key_len ==AES_KEYSIZE_128 ) || (aes->key_len ==AES_KEYSIZE_192 ) || (aes->key_len ==AES_KEYSIZE_256 )))
@@ -1080,8 +1075,8 @@ e_key:return ret; } -static int ccp_run_xts_aes_cmd (struct ccp_cmd_queue *cmd_q, -struct ccp_cmd *cmd) +static noinline_for_stack int +ccp_run_xts_aes_cmd (struct ccp_cmd_queue *cmd_q,struct ccp_cmd *cmd) {struct ccp_xts_aes_engine *xts = &cmd->u.xts;struct ccp_dm_workarea key, ctx;
@@ -1280,7 +1275,8 @@ e_key:return ret; } -static int ccp_run_des3_cmd (struct ccp_cmd_queue *cmd_q,struct ccp_cmd *cmd) +static noinline_for_stack int +ccp_run_des3_cmd (struct ccp_cmd_queue *cmd_q,struct ccp_cmd *cmd) {struct ccp_des3_engine *des3 = &cmd->u.des3;
@@ -1476,7 +1472,8 @@ e_key:return ret; } -static int ccp_run_sha_cmd (struct ccp_cmd_queue *cmd_q,struct ccp_cmd *cmd) +static noinline_for_stack int +ccp_run_sha_cmd (struct ccp_cmd_queue *cmd_q,struct ccp_cmd *cmd) {struct ccp_sha_engine *sha = &cmd->u.sha;struct ccp_dm_workarea ctx;
@@ -1820,7 +1817,8 @@ e_ctx:return ret; } -static int ccp_run_rsa_cmd (struct ccp_cmd_queue *cmd_q,struct ccp_cmd *cmd) +static noinline_for_stack int +ccp_run_rsa_cmd (struct ccp_cmd_queue *cmd_q,struct ccp_cmd *cmd) {struct ccp_rsa_engine *rsa = &cmd->u.rsa;struct ccp_dm_workarea exp, src, dst;
@@ -1951,8 +1949,8 @@ e_sb:return ret; } -static int ccp_run_passthru_cmd (struct ccp_cmd_queue *cmd_q, -struct ccp_cmd *cmd) +static noinline_for_stack int +ccp_run_passthru_cmd (struct ccp_cmd_queue *cmd_q,struct ccp_cmd *cmd) {struct ccp_passthru_engine *pt = &cmd->u.passthru;struct ccp_dm_workarea mask;
@@ -2083,7 +2081,8 @@ e_mask:return ret; } -static int ccp_run_passthru_nomap_cmd (struct ccp_cmd_queue *cmd_q, +static noinline_for_stack int +ccp_run_passthru_nomap_cmd (struct ccp_cmd_queue *cmd_q,struct ccp_cmd *cmd) {struct ccp_passthru_nomap_engine *pt = &cmd->u.passthru_nomap;
@@ -2424,7 +2423,8 @@ e_src:return ret; } -static int ccp_run_ecc_cmd (struct ccp_cmd_queue *cmd_q,struct ccp_cmd *cmd) +static noinline_for_stack int +ccp_run_ecc_cmd (struct ccp_cmd_queue *cmd_q,struct ccp_cmd *cmd) {struct ccp_ecc_engine *ecc = &cmd->u.ecc;
@@ -2461,7 +2461,17 @@ int ccp_run_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd)switch (cmd->engine) {case CCP_ENGINE_AES : - ret =ccp_run_aes_cmd (cmd_q, cmd); +switch (cmd->u.aes.mode) { +case CCP_AES_MODE_CMAC : + ret =ccp_run_aes_cmac_cmd (cmd_q, cmd); +break ; +case CCP_AES_MODE_GCM : + ret =ccp_run_aes_gcm_cmd (cmd_q, cmd); +break ; +default : + ret =ccp_run_aes_cmd (cmd_q, cmd); +break ; + }break ;case CCP_ENGINE_XTS_AES_128 : ret =ccp_run_xts_aes_cmd (cmd_q, cmd);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 490/639 ALSA: aoa: onyx: always initialize register read value
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit f474808acb3c4b30552d9c59b181244e0300d218 ]
A lot of places in the driver use onyx_read_register() without checking the return value, and it's been working OK for ~10 years or so, so probably never fails ... Rather than trying to check the return value everywhere, which would be relatively intrusive, at least make sure we don't use an uninitialized value.
--- sound/aoa/codecs/onyx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/aoa/codecs/onyx.c +3 -1
@@ -74,8 +74,10 @@ static int onyx_read_register(struct onyx *onyx, u8 reg, u8 *value)return 0 ; } v =i2c_smbus_read_byte_data (onyx->i2c, reg); -if (v <0 ) +if (v <0 ) { + *value =0 ;return -1 ; + } *value = (u8 )v; onyx->cache[ONYX_REG_CONTROL -FIRSTREGISTER ] = *value;return 0 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 491/639 arm64: dts: renesas: r8a77995: Fix register range of display node
In reply to Greg Kroah-HartmanFrom: Yoshihiro Kaneko <[email protected]>
[ Upstream commit 56d651e890f3befd616b6962a862f5ffa1a514fa ]
Since the R8A77995 SoC uses DU{0,1}, the range from the base address to the 0x4000 address is used.
This patch fixed it.
--- arch/arm64/boot/dts/renesas/r8a77995.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/renesas/r8a77995.dtsi +1 -1
@@ -938,7 +938,7 @@ du: display@feb00000 { compatible = "renesas,du-r8a77995"; - reg = <0 0xfeb00000 0 0x80000>; + reg = <0 0xfeb00000 0 0x40000>; interrupts = <GIC_SPI 256 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 268 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cpg CPG_MOD 724>,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 492/639 tipc: reduce risk of wakeup queue starvation
In reply to Greg Kroah-HartmanFrom: Jon Maloy <[email protected]>
[ Upstream commit 7c5b42055964f587e55bd87ef334c3a27e95d144 ]
In commit 365ad353c256 ("tipc: reduce risk of user starvation during link congestion") we allowed senders to add exactly one list of extra buffers to the link backlog queues during link congestion (aka "oversubscription"). However, the criteria for when to stop adding wakeup messages to the input queue when the overload abates is inaccurate, and may cause starvation problems during very high load.
Currently, we stop adding wakeup messages after 10 total failed attempts where we find that there is no space left in the backlog queue for a certain importance level. The counter for this is accumulated across all levels, which may lead the algorithm to leave the loop prematurely, although there may still be plenty of space available at some levels. The result is sometimes that messages near the wakeup queue tail are not added to the input queue as they should be.
We now introduce a more exact algorithm, where we keep adding wakeup messages to a level as long as the backlog queue has free slots for the corresponding level, and stop at the moment there are no more such slots or when there are no more wakeup messages to dequeue.
--- net/tipc/link.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-)
net/tipc/link.c +21 -8
@@ -830,18 +830,31 @@ static int link_schedule_user(struct tipc_link *l, struct tipc_msg *hdr)*/ static void link_prepare_wakeup (struct tipc_link *l) { +struct sk_buff_head *wakeupq = &l->wakeupq; +struct sk_buff_head *inputq = l->inputq;struct sk_buff *skb, *tmp; -int imp, i =0 ; +struct sk_buff_head tmpq; +int avail[5 ] = {0 ,}; +int imp =0 ; + +__skb_queue_head_init (&tmpq); - skb_queue_walk_safe(&l->wakeupq, skb, tmp) { +for (; imp <=TIPC_SYSTEM_IMPORTANCE ; imp++) + avail[imp] = l->backlog[imp].limit - l->backlog[imp].len; + + skb_queue_walk_safe(wakeupq, skb, tmp) { imp =TIPC_SKB_CB (skb)->chain_imp; -if (l->backlog[imp].len < l->backlog[imp].limit) { -skb_unlink (skb, &l->wakeupq); -skb_queue_tail (l->inputq, skb); - }else if (i++ >10 ) { -break ; - } +if (avail[imp] <=0 ) +continue ; + avail[imp]--; +__skb_unlink (skb, wakeupq); +__skb_queue_tail (&tmpq, skb); } + +spin_lock_bh (&inputq->lock); +skb_queue_splice_tail (&tmpq, inputq); +spin_unlock_bh (&inputq->lock); + }void tipc_link_reset (struct tipc_link *l)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 493/639 ARM: dts: stm32: add missing vdda-supply to adc on stm32h743i-eval
In reply to Greg Kroah-HartmanFrom: Fabrice Gasnier <[email protected]>
[ Upstream commit 493e84c5dc4d703d976b5875f5db22dae08a0782 ]
Add missing vdda-supply required by STM32 ADC.
board")
--- arch/arm/boot/dts/stm32h743i-eval.dts | 1 + 1 file changed, 1 insertion(+)
arch/arm/boot/dts/stm32h743i-eval.dts +1 -0
@@ -79,6 +79,7 @@ }; &adc_12 { + vdda-supply = <&vdda>; vref-supply = <&vdda>; status = "okay"; adc1: adc@0 {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 494/639 net/mlx5: Fix mlx5_ifc_query_lag_out_bits
In reply to Greg Kroah-HartmanFrom: Mark Zhang <[email protected]>
[ Upstream commit ea77388b02270b0af8dc57f668f311235ea068f0 ]
Remove the "reserved_at_40" field to match the device specification.
--- include/linux/mlx5/mlx5_ifc.h | 2 -- 1 file changed, 2 deletions(-)
include/linux/mlx5/mlx5_ifc.h +0 -2
@@ -9053,8 +9053,6 @@ struct mlx5_ifc_query_lag_out_bits {u8 syndrome[0x20 ]; -u8 reserved_at_40[0x40 ]; -struct mlx5_ifc_lagc_bits ctx; };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 495/639 cifs: fix rmmod regression in cifs.ko caused by force_sig changes
In reply to Greg Kroah-HartmanFrom: Steve French <[email protected]>
[ Upstream commit 247bc9470b1eeefc7b58cdf2c39f2866ba651509 ]
The global change from force_sig caused module unloading of cifs.ko to fail (since the cifsd process could not be killed, "rmmod cifs" now would always fail)
--- fs/cifs/connect.c | 1 + 1 file changed, 1 insertion(+)
fs/cifs/connect.c +1 -0
@@ -970,6 +970,7 @@ cifs_demultiplex_thread(void *p)mempool_resize (cifs_req_poolp, length + cifs_min_rcv);set_freezable (); +allow_signal (SIGKILL );while (server->tcpStatus != CifsExiting) {if (try_to_freeze ())continue ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 496/639 iio: tsl2772: Use devm_add_action_or_reset for tsl2772_chip_off
In reply to Greg Kroah-HartmanFrom: Chuhong Yuan <[email protected]>
[ Upstream commit 338084135aeddb103624a6841972fb8588295cc6 ]
Use devm_add_action_or_reset to call tsl2772_chip_off when the device is removed.
This also fixes the issue that the chip is turned off before the device is unregistered.
Not marked for stable as fairly hard to hit the bug and this is in the middle of a set making other cleanups to the driver. Hence will probably need explicit backporting.
--- drivers/iio/light/tsl2772.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/iio/light/tsl2772.c +13 -3
@@ -716,6 +716,13 @@ static int tsl2772_chip_off(struct iio_dev *indio_dev)return tsl2772_write_control_reg (chip,0x00 ); } +static void tsl2772_chip_off_action (void *data) +{ +struct iio_dev *indio_dev = data; + +tsl2772_chip_off (indio_dev); +} +/** * tsl2772_invoke_change - power cycle the device to implement the user * parameters
@@ -1711,9 +1718,14 @@ static int tsl2772_probe(struct i2c_client *clientp,if (ret <0 )return ret; + ret =devm_add_action_or_reset (&clientp->dev, + tsl2772_chip_off_action, + indio_dev); +if (ret <0 ) +return ret; + ret =iio_device_register (indio_dev);if (ret) { -tsl2772_chip_off (indio_dev);dev_err (&clientp->dev,"%s: iio registration failed\n" , __func__);return ret;
@@ -1740,8 +1752,6 @@ static int tsl2772_remove(struct i2c_client *client) {struct iio_dev *indio_dev =i2c_get_clientdata (client); -tsl2772_chip_off (indio_dev); -iio_device_unregister (indio_dev);return 0 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 497/639 net: fix bpf_xdp_adjust_head regression for generic-XDP
In reply to Greg Kroah-HartmanFrom: Jesper Dangaard Brouer <[email protected]>
[ Upstream commit 065af355470519bd184019a93ac579f22b036045 ]
When generic-XDP was moved to a later processing step by commit 458bf2f224f0 ("net: core: support XDP generic on stacked devices.") a regression was introduced when using bpf_xdp_adjust_head.
The issue is that after this commit the skb->network_header is now changed prior to calling generic XDP and not after. Thus, if the header is changed by XDP (via bpf_xdp_adjust_head), then skb->network_header also need to be updated again. Fix by calling skb_reset_network_header().
--- net/core/dev.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
net/core/dev.c +10 -5
@@ -4349,12 +4349,17 @@ static u32 netif_receive_generic_xdp(struct sk_buff *skb, act =bpf_prog_run_xdp (xdp_prog, xdp); +/* check if bpf_xdp_adjust_head was used */ off = xdp->data - orig_data; -if (off >0 ) -__skb_pull (skb, off); -else if (off <0 ) -__skb_push (skb, -off); - skb->mac_header += off; +if (off) { +if (off >0 ) +__skb_pull (skb, off); +else if (off <0 ) +__skb_push (skb, -off); + + skb->mac_header += off; +skb_reset_network_header (skb); + }/* check if bpf_xdp_adjust_tail was used. it can only "shrink" * pckt.
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 498/639 spi: bcm-qspi: Fix BSPI QUAD and DUAL mode support when using flex mode
In reply to Greg Kroah-HartmanFrom: Rayagonda Kokatanur <[email protected]>
[ Upstream commit 79629d0f7ce5b38515c1716911a0181f01b91102 ]
Fix data transfer width settings based on DT field 'spi-rx-bus-width' to configure BSPI in single, dual or quad mode by using data width and not the command width.
--- drivers/spi/spi-bcm-qspi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi-bcm-qspi.c +2 -2
@@ -354,7 +354,7 @@ static int bcm_qspi_bspi_set_flex_mode(struct bcm_qspi *qspi, {int bpc =0 , bpp =0 ;u8 command = op->cmd.opcode; -int width = op->cmd.buswidth ? op->cmd.buswidth :SPI_NBITS_SINGLE ; +int width = op->data.buswidth ? op->data.buswidth :SPI_NBITS_SINGLE ;int addrlen = op->addr.nbytes;int flex_mode =1 ;
@@ -992,7 +992,7 @@ static int bcm_qspi_exec_mem_op(struct spi_mem *mem,if (mspi_read)return bcm_qspi_mspi_exec_mem_op (spi, op); - ret =bcm_qspi_bspi_set_mode (qspi, op,-1 ); + ret =bcm_qspi_bspi_set_mode (qspi, op,0 );if (!ret) ret =bcm_qspi_bspi_exec_mem_op (spi, op);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 499/639 cxgb4: smt: Add lock for atomic_dec_and_test
In reply to Greg Kroah-HartmanFrom: Chuhong Yuan <[email protected]>
[ Upstream commit 4a8937b83892cb69524291cae6cdabad4a8be033 ]
The atomic_dec_and_test() is not safe because it is outside of locks.
Move the locks of t4_smte_free() to its caller, cxgb4_smt_release() to protect the atomic decrement.
--- drivers/net/ethernet/chelsio/cxgb4/smt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/smt.c +2 -2
@@ -98,11 +98,9 @@ found_reuse:static void t4_smte_free (struct smt_entry *e) { -spin_lock_bh (&e->lock);if (atomic_read (&e->refcnt) ==0 ) {/* hasn't been recycled */ e->state =SMT_STATE_UNUSED ; } -spin_unlock_bh (&e->lock); }/**
@@ -112,8 +110,10 @@ static void t4_smte_free(struct smt_entry *e)*/ void cxgb4_smt_release (struct smt_entry *e) { +spin_lock_bh (&e->lock);if (atomic_dec_and_test (&e->refcnt))t4_smte_free (e); +spin_unlock_bh (&e->lock); }EXPORT_SYMBOL (cxgb4_smt_release);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 500/639 crypto: caam - free resources in case caam_rng registration failed
In reply to Greg Kroah-HartmanFrom: Iuliana Prodan <[email protected]>
[ Upstream commit c59a1d41672a89b5cac49db1a472ff889e35a2d2 ]
Check the return value of the hardware registration for caam_rng and free resources in case of failure.
--- drivers/crypto/caam/caamrng.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/crypto/caam/caamrng.c +4 -1
@@ -353,7 +353,10 @@ static int __init caam_rng_init(void) goto free_rng_ctx;dev_info (dev,"registering rng-caam\n" ); -return hwrng_register (&caam_rng); + + err =hwrng_register (&caam_rng); +if (!err) +return err; free_rng_ctx:kfree (rng_ctx);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 501/639 ext4: set error return correctly when ext4_htree_store_dirent fails
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 7a14826ede1d714f0bb56de8167c0e519041eeda ]
Currently when the call to ext4_htree_store_dirent fails the error return variable 'ret' is is not being set to the error code and variable count is instead, hence the error code is not being returned. Fix this by assigning ret to the error return code.
Addresses-Coverity: ("Unused value")
--- fs/ext4/inline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/inline.c +1 -1
@@ -1419,7 +1419,7 @@ int htree_inlinedir_to_tree(struct file *dir_file, err =ext4_htree_store_dirent (dir_file, hinfo->hash, hinfo->minor_hash, de, &tmp_str);if (err) { - count = err; + ret = err; goto out; } count++;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 502/639 RDMA/hns: Bugfix for slab-out-of-bounds when unloading hip08 driver
In reply to Greg Kroah-HartmanFrom: Xi Wang <[email protected]>
[ Upstream commit 9bba3f0cbfc8abf2e1549ea03c0128186081d7a8 ]
kasan will report a BUG when run command 'rmmod hns_roce_hw_v2', the calltrace is as follows:
==================================================================
BUG: KASAN: slab-out-of-bounds in hns_roce_table_mhop_put+0x584/0x828 [hns_roce] Read of size 8 at addr ffff802185e08300 by task rmmod/270 Call trace: dump_backtrace+0x0/0x1e8 show_stack+0x14/0x20 dump_stack+0xc4/0xfc print_address_description+0x60/0x270 __kasan_report+0x164/0x1b8 kasan_report+0xc/0x18 __asan_load8+0x84/0xa8 hns_roce_table_mhop_put+0x584/0x828 [hns_roce] hns_roce_table_put+0x174/0x1a0 [hns_roce] hns_roce_mr_free+0x124/0x210 [hns_roce] hns_roce_dereg_mr+0x90/0xb8 [hns_roce] ib_dealloc_pd_user+0x60/0xf0 ib_mad_port_close+0x128/0x1d8 ib_mad_remove_device+0x94/0x118 remove_client_context+0xa0/0xe0 disable_device+0xfc/0x1c0 __ib_unregister_device+0x60/0xe0 ib_unregister_device+0x24/0x38 hns_roce_exit+0x3c/0x138 [hns_roce] __hns_roce_hw_v2_uninit_instance.isra.30+0x28/0x50 [hns_roce_hw_v2] hns_roce_hw_v2_uninit_instance+0x44/0x60 [hns_roce_hw_v2] hclge_uninit_client_instance+0x15c/0x238 [hclge] hnae3_uninit_client_instance+0x84/0xa8 [hnae3] hnae3_unregister_client+0x84/0x158 [hnae3] hns_roce_hw_v2_exit+0x14/0x20 [hns_roce_hw_v2] __arm64_sys_delete_module+0x20c/0x308 el0_svc_handler+0xbc/0x210 el0_svc+0x8/0xc Allocated by task 255: __kasan_kmalloc.isra.0+0xd0/0x180 kasan_kmalloc+0xc/0x18 __kmalloc+0x16c/0x328 hns_roce_init_hem_table+0x20c/0x428 [hns_roce] hns_roce_init+0x214/0xfe0 [hns_roce] __hns_roce_hw_v2_init_instance+0x284/0x330 [hns_roce_hw_v2] hns_roce_hw_v2_init_instance+0xd0/0x1b8 [hns_roce_hw_v2] hclge_init_roce_client_instance+0x180/0x310 [hclge] hclge_init_client_instance+0xcc/0x508 [hclge] hnae3_init_client_instance.part.3+0x3c/0x80 [hnae3] hnae3_register_client+0x134/0x1a8 [hnae3] 0xffff200009c00014 do_one_initcall+0x9c/0x3e0 do_init_module+0xd4/0x2d8 load_module+0x3284/0x3690 __se_sys_init_module+0x274/0x308 __arm64_sys_init_module+0x40/0x50 el0_svc_handler+0xbc/0x210 el0_svc+0x8/0xc Freed by task 0:
(stack is not available)
The buggy address belongs to the object at ffff802185e06300 which belongs to the cache kmalloc-8k of size 8192 The buggy address is located 0 bytes to the right of 8192-byte region [ffff802185e06300, ffff802185e08300) The buggy address belongs to the page: page:ffff7fe008617800 refcount:1 mapcount:0 mapping:ffff802340020e00 index:0x0 compound_mapcount: 0 flags: 0x5fffe00000010200(slab|head) raw: 5fffe00000010200 dead000000000100 dead000000000200 ffff802340020e00 raw: 0000000000000000 00000000803e003e 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff802185e08200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff802185e08280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff802185e08300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^ffff802185e08380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fcffff802185e08400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================
Disabling lock debugging due to kernel taint
--- drivers/infiniband/hw/hns/hns_roce_hem.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
drivers/infiniband/hw/hns/hns_roce_hem.c +13 -6
@@ -54,12 +54,13 @@ bool hns_roce_check_whether_mhop(struct hns_roce_dev *hr_dev, u32 type)EXPORT_SYMBOL_GPL (hns_roce_check_whether_mhop);static bool hns_roce_check_hem_null (struct hns_roce_hem **hem,u64 start_idx, -u32 bt_chunk_num) +u32 bt_chunk_num,u64 hem_max_num) { -int i; +u64 check_max_num = start_idx + bt_chunk_num; +u64 i; -for (i =0 ; i < bt_chunk_num; i++) -if (hem[start_idx + i]) +for (i = start_idx; (i < check_max_num) && (i < hem_max_num); i++) +if (hem[i])return false;return true;
@@ -413,6 +414,12 @@ static int hns_roce_table_mhop_get(struct hns_roce_dev *hr_dev,return -EINVAL ; } +if (unlikely (hem_idx >= table->num_hem)) { +dev_err (dev,"Table %d exceed hem limt idx = %llu,max = %lu!\n" , + table->type, hem_idx, table->num_hem); +return -EINVAL ; + } +mutex_lock (&table->mutex);if (table->hem[hem_idx]) {
@@ -649,7 +656,7 @@ static void hns_roce_table_mhop_put(struct hns_roce_dev *hr_dev,if (check_whether_bt_num_2 (table->type, hop_num)) { start_idx = mhop.l0_idx * chunk_ba_num;if (hns_roce_check_hem_null (table->hem, start_idx, - chunk_ba_num)) { + chunk_ba_num, table->num_hem)) {if (table->type <HEM_TYPE_MTT && hr_dev->hw->clear_hem (hr_dev, table, obj,0 ))dev_warn (dev,"Clear HEM base address failed.\n" );
@@ -663,7 +670,7 @@ static void hns_roce_table_mhop_put(struct hns_roce_dev *hr_dev, start_idx = mhop.l0_idx * chunk_ba_num * chunk_ba_num + mhop.l1_idx * chunk_ba_num;if (hns_roce_check_hem_null (table->hem, start_idx, - chunk_ba_num)) { + chunk_ba_num, table->num_hem)) {if (hr_dev->hw->clear_hem (hr_dev, table, obj,1 ))dev_warn (dev,"Clear HEM base address failed.\n" );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 503/639 RDMA/hns: bugfix for slab-out-of-bounds when loading hip08 driver
In reply to Greg Kroah-HartmanFrom: Xi Wang <[email protected]>
[ Upstream commit bf8c02f961c89e5ccae5987b7ab28f5592a35101 ]
kasan will report a BUG when run command 'insmod hns_roce_hw_v2.ko', the calltrace is as follows:
==================================================================
BUG: KASAN: slab-out-of-bounds in hns_roce_v2_init_eq_table+0x1324/0x1948 [hns_roce_hw_v2] Read of size 8 at addr ffff8020e7a10608 by task insmod/256 CPU: 0 PID: 256 Comm: insmod Tainted: G O 5.2.0-rc4 #1 Hardware name: Huawei D06 /D06, BIOS Hisilicon D06 UEFI RC0 Call trace: dump_backtrace+0x0/0x1e8 show_stack+0x14/0x20 dump_stack+0xc4/0xfc print_address_description+0x60/0x270 __kasan_report+0x164/0x1b8 kasan_report+0xc/0x18 __asan_load8+0x84/0xa8 hns_roce_v2_init_eq_table+0x1324/0x1948 [hns_roce_hw_v2] hns_roce_init+0xf8/0xfe0 [hns_roce] __hns_roce_hw_v2_init_instance+0x284/0x330 [hns_roce_hw_v2] hns_roce_hw_v2_init_instance+0xd0/0x1b8 [hns_roce_hw_v2] hclge_init_roce_client_instance+0x180/0x310 [hclge] hclge_init_client_instance+0xcc/0x508 [hclge] hnae3_init_client_instance.part.3+0x3c/0x80 [hnae3] hnae3_register_client+0x134/0x1a8 [hnae3] hns_roce_hw_v2_init+0x14/0x10000 [hns_roce_hw_v2] do_one_initcall+0x9c/0x3e0 do_init_module+0xd4/0x2d8 load_module+0x3284/0x3690 __se_sys_init_module+0x274/0x308 __arm64_sys_init_module+0x40/0x50 el0_svc_handler+0xbc/0x210 el0_svc+0x8/0xc Allocated by task 256: __kasan_kmalloc.isra.0+0xd0/0x180 kasan_kmalloc+0xc/0x18 __kmalloc+0x16c/0x328 hns_roce_v2_init_eq_table+0x764/0x1948 [hns_roce_hw_v2] hns_roce_init+0xf8/0xfe0 [hns_roce] __hns_roce_hw_v2_init_instance+0x284/0x330 [hns_roce_hw_v2] hns_roce_hw_v2_init_instance+0xd0/0x1b8 [hns_roce_hw_v2] hclge_init_roce_client_instance+0x180/0x310 [hclge] hclge_init_client_instance+0xcc/0x508 [hclge] hnae3_init_client_instance.part.3+0x3c/0x80 [hnae3] hnae3_register_client+0x134/0x1a8 [hnae3] hns_roce_hw_v2_init+0x14/0x10000 [hns_roce_hw_v2] do_one_initcall+0x9c/0x3e0 do_init_module+0xd4/0x2d8 load_module+0x3284/0x3690 __se_sys_init_module+0x274/0x308 __arm64_sys_init_module+0x40/0x50 el0_svc_handler+0xbc/0x210 el0_svc+0x8/0xc Freed by task 0:
(stack is not available)
The buggy address belongs to the object at ffff8020e7a10600 which belongs to the cache kmalloc-128 of size 128 The buggy address is located 8 bytes inside of 128-byte region [ffff8020e7a10600, ffff8020e7a10680) The buggy address belongs to the page: page:ffff7fe00839e840 refcount:1 mapcount:0 mapping:ffff802340020200 index:0x0 flags: 0x5fffe00000000200(slab) raw: 5fffe00000000200 dead000000000100 dead000000000200 ffff802340020200 raw: 0000000000000000 0000000081000100 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8020e7a10500: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc ffff8020e7a10580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8020e7a10600: 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^ffff8020e7a10680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fcffff8020e7a10700: 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
Disabling lock debugging due to kernel taint
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +4 -2
@@ -4833,7 +4833,8 @@ static int hns_roce_mhop_alloc_eq(struct hns_roce_dev *hr_dev,break ; } eq->cur_eqe_ba = eq->buf_dma[0 ]; - eq->nxt_eqe_ba = eq->buf_dma[1 ]; +if (ba_num >1 ) + eq->nxt_eqe_ba = eq->buf_dma[1 ]; }else if (mhop_num ==2 ) {/* alloc L1 BT and buf */
@@ -4875,7 +4876,8 @@ static int hns_roce_mhop_alloc_eq(struct hns_roce_dev *hr_dev,break ; } eq->cur_eqe_ba = eq->buf_dma[0 ]; - eq->nxt_eqe_ba = eq->buf_dma[1 ]; +if (ba_num >1 ) + eq->nxt_eqe_ba = eq->buf_dma[1 ]; } eq->l0_last_num = i +1 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 504/639 ASoC: es8328: Fix copy-paste error in es8328_right_line_controls
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit 630742c296341a8cfe00dfd941392025ba8dd4e8 ]
It seems 'es8328_rline_enum' should be used
in es8328_right_line_controls
--- sound/soc/codecs/es8328.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/es8328.c +1 -1
@@ -231,7 +231,7 @@ static const struct soc_enum es8328_rline_enum =ARRAY_SIZE (es8328_line_texts), es8328_line_texts);static const struct snd_kcontrol_new es8328_right_line_controls = -SOC_DAPM_ENUM ("Route" , es8328_lline_enum); +SOC_DAPM_ENUM ("Route" , es8328_rline_enum);/* Left Mixer */ static const struct snd_kcontrol_new es8328_left_mixer_controls[] = {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 505/639 ASoC: cs4349: Use PM ops cs4349_runtime_pm
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit 9b4275c415acca6264a3d7f1182589959c93d530 ]
sound/soc/codecs/cs4349.c:358:32: warning:
cs4349_runtime_pm defined but not used [-Wunused-const-variable=]
cs4349_runtime_pm ops already defined, it seems we should enable it.
--- sound/soc/codecs/cs4349.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/codecs/cs4349.c +1 -0
@@ -381,6 +381,7 @@ static struct i2c_driver cs4349_i2c_driver = { .driver = { .name = "cs4349", .of_match_table = cs4349_of_match, + .pm = &cs4349_runtime_pm, }, .id_table = cs4349_i2c_id, .probe = cs4349_i2c_probe,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 506/639 ASoC: wm8737: Fix copy-paste error in wm8737_snd_controls
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit 554b75bde64bcad9662530726d1483f7ef012069 ]
sound/soc/codecs/wm8737.c:112:29: warning:
high_3d defined but not used [-Wunused-const-variable=]
'high_3d' should be used for 3D High Cut-off.
--- sound/soc/codecs/wm8737.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wm8737.c +1 -1
@@ -170,7 +170,7 @@ SOC_DOUBLE("Polarity Invert Switch", WM8737_ADC_CONTROL, 5, 6, 1, 0),SOC_SINGLE ("3D Switch" ,WM8737_3D_ENHANCE ,0 ,1 ,0 ),SOC_SINGLE ("3D Depth" ,WM8737_3D_ENHANCE ,1 ,15 ,0 ),SOC_ENUM ("3D Low Cut-off" , low_3d), -SOC_ENUM ("3D High Cut-off" , low_3d), +SOC_ENUM ("3D High Cut-off" , high_3d),SOC_SINGLE_TLV ("3D ADC Volume" ,WM8737_3D_ENHANCE ,7 ,1 ,1 , adc_tlv), SOC_SINGLE("Noise Gate Switch", WM8737_NOISE_GATE, 0, 1, 0),
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 507/639 net/rds: Add a few missing rds_stat_names entries
In reply to Greg Kroah-HartmanFrom: Gerd Rausch <[email protected]>
[ Upstream commit 55c70ca00c982fbc0df4c4d3e31747fb73f4ddb5 ]
In a previous commit, fields were added to "struct rds_statistics" but array "rds_stat_names" was not updated accordingly.
Please note the inconsistent naming of the string representations that is done in the name of compatibility
with the Oracle internal code-base.
s_recv_bytes_added_to_socket -> "recv_bytes_added_to_sock"s_recv_bytes_removed_from_socket -> "recv_bytes_freed_fromsock"
--- net/rds/stats.c | 2 ++ 1 file changed, 2 insertions(+)
net/rds/stats.c +2 -0
@@ -76,6 +76,8 @@ static const char *const rds_stat_names[] = {"cong_update_received" ,"cong_send_error" ,"cong_send_blocked" , +"recv_bytes_added_to_sock" , + "recv_bytes_freed_fromsock", }; void rds_stats_info_copy(struct rds_info_iterator *iter,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 508/639 tools: bpftool: fix arguments for p_err() in do_event_pipe()
In reply to Greg Kroah-HartmanFrom: Quentin Monnet <[email protected]>
[ Upstream commit 9def249dc8409ffc1f5a1d7195f1c462f2b49c07 ]
The last argument passed to some calls to the p_err() functions is not correct, it should be "*argv" instead of "**argv". This may lead to a segmentation fault error if CPU IDs or indices from the command line cannot be parsed correctly. Let's fix this.
--- tools/bpf/bpftool/map_perf_ring.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/bpf/bpftool/map_perf_ring.c +2 -2
@@ -205,7 +205,7 @@ int do_event_pipe(int argc, char **argv)NEXT_ARG (); cpu =strtoul (*argv, &endptr,0 );if (*endptr) { -p_err ("can't parse %s as CPU ID" , **argv); +p_err ("can't parse %s as CPU ID" , *argv); goto err_close_map; }
@@ -216,7 +216,7 @@ int do_event_pipe(int argc, char **argv)NEXT_ARG (); index =strtoul (*argv, &endptr,0 );if (*endptr) { -p_err ("can't parse %s as index" , **argv); +p_err ("can't parse %s as index" , *argv); goto err_close_map; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 509/639 tools: bpftool: fix format strings and arguments for jsonw_printf()
In reply to Greg Kroah-HartmanFrom: Quentin Monnet <[email protected]>
[ Upstream commit 22c349e8db89df86804d3ba23cef037ccd44a8bf ]
There are some mismatches between format strings and arguments passed to jsonw_printf() in the BTF dumper for bpftool, which seems harmless but may result in warnings if the "__printf()" attribute is used correctly for jsonw_printf(). Let's fix relevant format strings and type cast.
--- tools/bpf/bpftool/btf_dumper.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tools/bpf/bpftool/btf_dumper.c +4 -4
@@ -26,9 +26,9 @@ static void btf_dumper_ptr(const void *data, json_writer_t *jw, bool is_plain_text) {if (is_plain_text) -jsonw_printf (jw,"%p" , *(unsigned long *)data); +jsonw_printf (jw,"%p" , data);else -jsonw_printf (jw,"%u" , *(unsigned long *)data); +jsonw_printf (jw,"%lu" , *(unsigned long *)data); } static int btf_dumper_modifier(const struct btf_dumper *d, __u32 type_id,
@@ -129,7 +129,7 @@ static int btf_dumper_int(const struct btf_type *t, __u8 bit_offset,switch (BTF_INT_ENCODING (*int_type)) {case 0 :if (BTF_INT_BITS (*int_type) ==64 ) -jsonw_printf (jw,"%lu" , *(__u64 *)data); +jsonw_printf (jw,"%llu" , *(__u64 *)data);else if (BTF_INT_BITS (*int_type) ==32 )jsonw_printf (jw,"%u" , *(__u32 *)data);else if (BTF_INT_BITS (*int_type) ==16 )
@@ -142,7 +142,7 @@ static int btf_dumper_int(const struct btf_type *t, __u8 bit_offset,break ;case BTF_INT_SIGNED :if (BTF_INT_BITS (*int_type) ==64 ) -jsonw_printf (jw,"%ld" , *(long long *)data); +jsonw_printf (jw,"%lld" , *(long long *)data);else if (BTF_INT_BITS (*int_type) ==32 )jsonw_printf (jw,"%d" , *(int *)data);else if (BTF_INT_BITS (*int_type) ==16 )
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 510/639 drm: rcar-du: lvds: Fix bridge_to_rcar_lvds
In reply to Greg Kroah-HartmanFrom: Fabrizio Castro <[email protected]>
[ Upstream commit 0b936e6122738f4cf474d1f3ff636cba0edc8b94 ]
Using name "bridge" for macro bridge_to_rcar_lvds argument doesn't work when the pointer name used by the caller is not "bridge". Rename the argument to "b" to allow for any pointer name.
While at it, fix the connector_to_rcar_lvds macro similarly.
--- drivers/gpu/drm/rcar-du/rcar_lvds.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/rcar-du/rcar_lvds.c +4 -4
@@ -59,11 +59,11 @@ struct rcar_lvds {enum rcar_lvds_mode mode; }; -#define bridge_to_rcar_lvds (bridge) \ - container_of(bridge, struct rcar_lvds, bridge) +#define bridge_to_rcar_lvds (b) \ + container_of(b, struct rcar_lvds, bridge) -#define connector_to_rcar_lvds (connector) \ - container_of(connector, struct rcar_lvds, connector) +#define connector_to_rcar_lvds (c) \ + container_of(c, struct rcar_lvds, connector)static void rcar_lvds_write (struct rcar_lvds *lvds,u32 reg,u32 data) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 511/639 bnxt_en: Fix handling FRAG_ERR when NVM_INSTALL_UPDATE cmd fails
In reply to Greg Kroah-HartmanFrom: Vasundhara Volam <[email protected]>
[ Upstream commit dd2ebf3404c7c295014bc025dea23960960ceb1a ]
If FW returns FRAG_ERR in response error code, driver is resending the command only when HWRM command returns success. Fix the code to resend NVM_INSTALL_UPDATE command with DEFRAG install flags, if FW returns FRAG_ERR in its response error code.
--- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +5 -7
@@ -1778,21 +1778,19 @@ static int bnxt_flash_package_from_file(struct net_device *dev,mutex_lock (&bp->hwrm_cmd_lock); hwrm_err =_hwrm_send_message (bp, &install,sizeof (install),INSTALL_PACKAGE_TIMEOUT ); -if (hwrm_err) - goto flash_pkg_exit; - -if (resp->error_code) { +if (hwrm_err) {u8 error_code = ((struct hwrm_err_output *)resp)->cmd_err; -if (error_code ==NVM_INSTALL_UPDATE_CMD_ERR_CODE_FRAG_ERR ) { +if (resp->error_code && error_code == +NVM_INSTALL_UPDATE_CMD_ERR_CODE_FRAG_ERR ) { install.flags |=cpu_to_le16 (NVM_INSTALL_UPDATE_REQ_FLAGS_ALLOWED_TO_DEFRAG ); hwrm_err =_hwrm_send_message (bp, &install,sizeof (install),INSTALL_PACKAGE_TIMEOUT ); -if (hwrm_err) - goto flash_pkg_exit; } +if (hwrm_err) + goto flash_pkg_exit; }if (resp->result) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 512/639 signal: Allow cifs and drbd to receive their terminating signals
In reply to Greg Kroah-HartmanFrom: Eric W. Biederman <[email protected]>
[ Upstream commit 33da8e7c814f77310250bb54a9db36a44c5de784 ]
My recent to change to only use force_sig for a synchronous events wound up breaking signal reception cifs and drbd. I had overlooked the fact that by default kthreads start out with all signals set to SIG_IGN. So a change I thought was safe turned out to have made it impossible for those kernel thread to catch their signals.
Reverting the work on force_sig is a bad idea because what the code was doing was very much a misuse of force_sig. As the way force_sig ultimately allowed the signal to happen was to change the signal handler to SIG_DFL. Which after the first signal will allow userspace to send signals to these kernel threads. At least for wake_ack_receiver in drbd that does not appear actively wrong.
So correct this problem by adding allow_kernel_signal that will allow signals whose siginfo reports they were sent by the kernel through, but will not allow userspace generated signals, and update cifs and drbd to call allow_kernel_signal in an appropriate place so that their thread can receive this signal.
Fixing things this way ensures that userspace won't be able to send signals and cause problems, that it is clear which signals the threads are expecting to receive, and it guarantees that nothing else in the system will be affected.
This change was partly inspired by similar cifs and drbd patches that added allow_signal.
--- drivers/block/drbd/drbd_main.c | 2 ++ fs/cifs/connect.c | 2 +- include/linux/signal.h | 15 ++++++++++++++- kernel/signal.c | 5 +++++ 4 files changed, 22 insertions(+), 2 deletions(-)
drivers/block/drbd/drbd_main.c +2 -0
@@ -334,6 +334,8 @@ static int drbd_thread_setup(void *arg) thi->name[0 ], resource->name); +allow_kernel_signal (DRBD_SIGKILL ); +allow_kernel_signal (SIGXCPU ); restart: retval = thi->function (thi);
fs/cifs/connect.c +1 -1
@@ -970,7 +970,7 @@ cifs_demultiplex_thread(void *p)mempool_resize (cifs_req_poolp, length + cifs_min_rcv);set_freezable (); -allow_signal (SIGKILL ); +allow_kernel_signal (SIGKILL );while (server->tcpStatus != CifsExiting) {if (try_to_freeze ())continue ;
include/linux/signal.h +14 -1
@@ -272,6 +272,9 @@ extern void signal_setup_done(int failed, struct ksignal *ksig, int stepping);extern void exit_signals (struct task_struct *tsk);extern void kernel_sigaction (int ,__sighandler_t ); +#define SIG_KTHREAD ((__force __sighandler_t)2) +#define SIG_KTHREAD_KERNEL ((__force __sighandler_t)3) +static inline void allow_signal (int sig) {/*
@@ -279,7 +282,17 @@ static inline void allow_signal(int sig)* know it'll be handled, so that they don't get converted to * SIGKILL or just silently dropped. */ -kernel_sigaction (sig, (__force __sighandler_t )2 ); +kernel_sigaction (sig,SIG_KTHREAD ); +} + +static inline void allow_kernel_signal (int sig) +{ +/* +* Kernel threads handle their own signals. Let the signal code +* know signals sent by the kernel will be handled, so that they +* don't get silently dropped. +*/ +kernel_sigaction (sig,SIG_KTHREAD_KERNEL ); }static inline void disallow_signal (int sig)
kernel/signal.c +5 -0
@@ -86,6 +86,11 @@ static bool sig_task_ignored(struct task_struct *t, int sig, bool force) handler == SIG_DFL && !(force && sig_kernel_only(sig)))return true; +/* Only allow kernel generated signals to this kthread */ +if (unlikely ((t->flags &PF_KTHREAD ) && + (handler ==SIG_KTHREAD_KERNEL ) && !force)) +return true; +return sig_handler_ignored (handler, sig); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 513/639 powerpc/64s/radix: Fix memory hot-unplug page table split
In reply to Greg Kroah-HartmanFrom: Nicholas Piggin <[email protected]>
[ Upstream commit 31f210cf42d4b308eacef89b6cb0b1459338b8de ]
create_physical_mapping expects physical addresses, but splitting these mapping on hot unplug is supplying virtual (effective) addresses.
--- arch/powerpc/mm/pgtable-radix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/mm/pgtable-radix.c +2 -2
@@ -717,8 +717,8 @@ static int __meminit stop_machine_change_mapping(void *data)spin_unlock (&init_mm.page_table_lock);pte_clear (&init_mm, params->aligned_start, params->pte); -create_physical_mapping (params->aligned_start, params->start,-1 ); -create_physical_mapping (params->end, params->aligned_end,-1 ); +create_physical_mapping (__pa (params->aligned_start),__pa (params->start),-1 ); +create_physical_mapping (__pa (params->end),__pa (params->aligned_end),-1 );spin_lock (&init_mm.page_table_lock);return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 514/639 ASoC: sun4i-i2s: RX and TX counter registers are swapped
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
[ Upstream commit cf2c0e1ce9544df42170fb921f12da82dc0cc8d6 ]
The RX and TX counters registers offset have been swapped, fix that.
--- sound/soc/sunxi/sun4i-i2s.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/sunxi/sun4i-i2s.c +2 -2
@@ -80,8 +80,8 @@#define SUN4I_I2S_CLK_DIV_MCLK_MASK GENMASK(3, 0)#define SUN4I_I2S_CLK_DIV_MCLK (mclk) ((mclk) << 0) -#define SUN4I_I2S_RX_CNT_REG 0x28 -#define SUN4I_I2S_TX_CNT_REG 0x2c +#define SUN4I_I2S_TX_CNT_REG 0x28 +#define SUN4I_I2S_RX_CNT_REG 0x2c#define SUN4I_I2S_TX_CHAN_SEL_REG 0x30#define SUN4I_I2S_CHAN_SEL (num_chan) (((num_chan) - 1) << 0)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 515/639 dmaengine: dw: platform: Switch to acpi_dma_controller_register()
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit e7b8514e4d68bec21fc6385fa0a66797ddc34ac9 ]
There is a possibility to have registered ACPI DMA controller while it has been gone already.
To avoid the potential crash, move to non-managed acpi_dma_controller_register().
--- drivers/dma/dw/platform.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/dma/dw/platform.c +12 -2
@@ -87,13 +87,20 @@ static void dw_dma_acpi_controller_register(struct dw_dma *dw)dma_cap_set (DMA_SLAVE , info->dma_cap); info->filter_fn = dw_dma_acpi_filter; - ret =devm_acpi_dma_controller_register (dev, acpi_dma_simple_xlate, - info); + ret =acpi_dma_controller_register (dev, acpi_dma_simple_xlate, info);if (ret) dev_err(dev, "could not register acpi_dma_controller\n"); } + +static void dw_dma_acpi_controller_free (struct dw_dma *dw) +{ +struct device *dev = dw->dma.dev; + +acpi_dma_controller_free (dev); +}#else /* !CONFIG_ACPI */ static inline void dw_dma_acpi_controller_register (struct dw_dma *dw) {} +static inline void dw_dma_acpi_controller_free (struct dw_dma *dw) {}#endif /* !CONFIG_ACPI */ #ifdef CONFIG_OF
@@ -249,6 +256,9 @@ static int dw_remove(struct platform_device *pdev) {struct dw_dma_chip *chip =platform_get_drvdata (pdev); +if (ACPI_HANDLE (&pdev->dev)) +dw_dma_acpi_controller_free (chip->dw); +if (pdev->dev.of_node)of_dma_controller_free (pdev->dev.of_node);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 516/639 rtc: rv3029: revert error handling patch to rv3029_eeprom_write()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit a6f26606ddd03c5eab8b2132f1bfaa768c06158f ]
My error handling "cleanup" was totally wrong. Both the "err" and "ret" variables are required. The "err" variable holds the error codes for rv3029_eeprom_enter/exit() and the "ret" variable holds the error codes for if actual write fails. In my patch if the write failed, the function probably still returned success.
--- drivers/rtc/rtc-rv3029c2.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/rtc/rtc-rv3029c2.c +8 -8
@@ -282,13 +282,13 @@ static int rv3029_eeprom_read(struct device *dev, u8 reg,static int rv3029_eeprom_write (struct device *dev,u8 reg,u8 const buf[],size_t len) { -int ret; +int ret, err;size_t i;u8 tmp; - ret =rv3029_eeprom_enter (dev); -if (ret <0 ) -return ret; + err =rv3029_eeprom_enter (dev); +if (err <0 ) +return err;for (i =0 ; i < len; i++, reg++) { ret =rv3029_read_regs (dev, reg, &tmp,1 );
@@ -304,11 +304,11 @@ static int rv3029_eeprom_write(struct device *dev, u8 reg,break ; } - ret =rv3029_eeprom_exit (dev); -if (ret <0 ) -return ret; + err =rv3029_eeprom_exit (dev); +if (err <0 ) +return err; -return 0 ; +return ret; } static int rv3029_eeprom_update_bits(struct device *dev,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 517/639 mac80211: minstrel_ht: fix per-group max throughput rate initialization
In reply to Greg Kroah-HartmanFrom: Felix Fietkau <[email protected]>
[ Upstream commit 56dd918ff06e3ee24d8067e93ed12b2a39e71394 ]
The group number needs to be multiplied by the number of rates per group to get the full rate index
--- net/mac80211/rc80211_minstrel_ht.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/rc80211_minstrel_ht.c +1 -1
@@ -529,7 +529,7 @@ minstrel_ht_update_stats(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)/* (re)Initialize group rate indexes */ for (j =0 ; j <MAX_THR_RATES ; j++) - tmp_group_tp_rate[j] = group; + tmp_group_tp_rate[j] =MCS_GROUP_RATES * group;for (i =0 ; i <MCS_GROUP_RATES ; i++) {if (!(mi->supported[group] &BIT (i)))
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 518/639 i40e: reduce stack usage in i40e_set_fc
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 33b165684ab70867d4545643f550a5d48d3ddc57 ]
The functions i40e_aq_get_phy_abilities_resp() and i40e_set_fc() both have giant structure on the stack, which makes each one use stack frames larger than 500 bytes.
As clang decides one function into the other, we get a warning for exceeding the frame size limit on 32-bit architectures:
drivers/net/ethernet/intel/i40e/i40e_common.c:1654:23: error: stack frame size of 1116 bytes in function 'i40e_set_fc' [-Werror,-Wframe-larger-than=]
When building with gcc, the inlining does not happen, but i40e_set_fc() calls i40e_aq_get_phy_abilities_resp() anyway, so they add up on the kernel stack just as much.
The parts that actually use large stacks don't overlap, so make sure each one is a separate function, and mark them as noinline_for_stack to prevent the compilers from combining them again.
--- drivers/net/ethernet/intel/i40e/i40e_common.c | 91 +++++++++++-------- 1 file changed, 51 insertions(+), 40 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_common.c +51 -40
@@ -1668,25 +1668,15 @@ enum i40e_status_code i40e_aq_set_phy_config(struct i40e_hw *hw,return status; } -/** -* i40e_set_fc -* @hw: pointer to the hw struct -* @aq_failures: buffer to return AdminQ failure information -* @atomic_restart: whether to enable atomic link restart -* -* Set the requested flow control mode using set_phy_config. -**/ -enum i40e_status_code i40e_set_fc (struct i40e_hw *hw,u8 *aq_failures, -bool atomic_restart) +static noinline_for_stack enum i40e_status_code +i40e_set_fc_status (struct i40e_hw *hw, +struct i40e_aq_get_phy_abilities_resp *abilities, +bool atomic_restart) { -enum i40e_fc_mode fc_mode = hw->fc.requested_mode; -struct i40e_aq_get_phy_abilities_resp abilities;struct i40e_aq_set_phy_config config; -enum i40e_status_code status; +enum i40e_fc_mode fc_mode = hw->fc.requested_mode;u8 pause_mask =0x0 ; - *aq_failures =0x0 ; -switch (fc_mode) {case I40E_FC_FULL : pause_mask |=I40E_AQ_PHY_FLAG_PAUSE_TX ;
@@ -1702,6 +1692,48 @@ enum i40e_status_code i40e_set_fc(struct i40e_hw *hw, u8 *aq_failures,break ; } +memset (&config,0 ,sizeof (struct i40e_aq_set_phy_config )); +/* clear the old pause settings */ + config.abilities = abilities->abilities & ~(I40E_AQ_PHY_FLAG_PAUSE_TX ) & + ~(I40E_AQ_PHY_FLAG_PAUSE_RX ); +/* set the new abilities */ + config.abilities |= pause_mask; +/* If the abilities have changed, then set the new config */ +if (config.abilities == abilities->abilities) +return 0 ; + +/* Auto restart link so settings take effect */ +if (atomic_restart) + config.abilities |=I40E_AQ_PHY_ENABLE_ATOMIC_LINK ; +/* Copy over all the old settings */ + config.phy_type = abilities->phy_type; + config.phy_type_ext = abilities->phy_type_ext; + config.link_speed = abilities->link_speed; + config.eee_capability = abilities->eee_capability; + config.eeer = abilities->eeer_val; + config.low_power_ctrl = abilities->d3_lpan; + config.fec_config = abilities->fec_cfg_curr_mod_ext_info & +I40E_AQ_PHY_FEC_CONFIG_MASK ; + +return i40e_aq_set_phy_config (hw, &config,NULL ); +} + +/** +* i40e_set_fc +* @hw: pointer to the hw struct +* @aq_failures: buffer to return AdminQ failure information +* @atomic_restart: whether to enable atomic link restart +* +* Set the requested flow control mode using set_phy_config. +**/ +enum i40e_status_code i40e_set_fc (struct i40e_hw *hw,u8 *aq_failures, +bool atomic_restart) +{ +struct i40e_aq_get_phy_abilities_resp abilities; +enum i40e_status_code status; + + *aq_failures =0x0 ; +/* Get the current phy config */ status =i40e_aq_get_phy_capabilities (hw, false, false, &abilities,NULL );
@@ -1710,31 +1742,10 @@ enum i40e_status_code i40e_set_fc(struct i40e_hw *hw, u8 *aq_failures,return status; } -memset (&config,0 ,sizeof (struct i40e_aq_set_phy_config )); -/* clear the old pause settings */ - config.abilities = abilities.abilities & ~(I40E_AQ_PHY_FLAG_PAUSE_TX ) & - ~(I40E_AQ_PHY_FLAG_PAUSE_RX ); -/* set the new abilities */ - config.abilities |= pause_mask; -/* If the abilities have changed, then set the new config */ -if (config.abilities != abilities.abilities) { -/* Auto restart link so settings take effect */ -if (atomic_restart) - config.abilities |=I40E_AQ_PHY_ENABLE_ATOMIC_LINK ; -/* Copy over all the old settings */ - config.phy_type = abilities.phy_type; - config.phy_type_ext = abilities.phy_type_ext; - config.link_speed = abilities.link_speed; - config.eee_capability = abilities.eee_capability; - config.eeer = abilities.eeer_val; - config.low_power_ctrl = abilities.d3_lpan; - config.fec_config = abilities.fec_cfg_curr_mod_ext_info & -I40E_AQ_PHY_FEC_CONFIG_MASK ; - status =i40e_aq_set_phy_config (hw, &config,NULL ); + status =i40e_set_fc_status (hw, &abilities, atomic_restart); +if (status) + *aq_failures |=I40E_SET_FC_AQ_FAIL_SET ; -if (status) - *aq_failures |=I40E_SET_FC_AQ_FAIL_SET ; - }/* Update the link info */ status =i40e_update_link_info (hw);if (status) {
@@ -2563,7 +2574,7 @@ i40e_status i40e_get_link_status(struct i40e_hw *hw, bool *link_up)* i40e_updatelink_status - update status of the HW network link * @hw: pointer to the hw struct **/ -i40e_status i40e_update_link_info (struct i40e_hw *hw) +noinline_for_stack i40e_status i40e_update_link_info(struct i40e_hw *hw) {struct i40e_aq_get_phy_abilities_resp abilities;i40e_status status =0 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 519/639 media: atmel: atmel-isi: fix timeout value for stop streaming
In reply to Greg Kroah-HartmanFrom: Alexandre Kroupski <[email protected]>
[ Upstream commit 623fd246bb40234fe68dd4e7c1f1f081f9c45a3d ]
In case of sensor malfunction, stop streaming timeout takes much longer than expected. This is due to conversion of time to jiffies: milliseconds multiplied with HZ (ticks/second) gives out a value of jiffies with 10^3 greater. We need to also divide by 10^3 to obtain the right jiffies value. In other words FRAME_INTERVAL_MILLI_SEC must be in seconds in order to multiply by HZ and get the right jiffies value to add to the current jiffies for the timeout expire time.
--- drivers/media/platform/atmel/atmel-isi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/atmel/atmel-isi.c +1 -1
@@ -496,7 +496,7 @@ static void stop_streaming(struct vb2_queue *vq)spin_unlock_irq (&isi->irqlock);if (!isi->enable_preview_path) { - timeout = jiffies +FRAME_INTERVAL_MILLI_SEC *HZ ; + timeout = jiffies + (FRAME_INTERVAL_MILLI_SEC *HZ ) /1000 ;/* Wait until the end of the current frame. */ while ((isi_readl (isi,ISI_STATUS ) &ISI_CTRL_CDC ) &&time_before (jiffies, timeout))
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 520/639 ARM: 8896/1: VDSO: Dont leak kernel addresses
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 3e07590e7248db951fed6a2039403b5a39010be7 ]
Since commit ad67b74d2469d9b8 ("printk: hash addresses printed with %p"), an obfuscated kernel pointer is printed at every boot if debugging is enabled:
vdso: 1 text pages at base (____ptrval____)
Remove the print completely, as it's useless without the address.
Based on commit 0f1bf7e39822476b ("arm64/vdso: don't leak kernel addresses").
--- arch/arm/kernel/vdso.c | 1 - 1 file changed, 1 deletion(-)
arch/arm/kernel/vdso.c +0 -1
@@ -205,7 +205,6 @@ static int __init vdso_init(void) } text_pages = (vdso_end - vdso_start) >>PAGE_SHIFT ; -pr_debug ("vdso: %i text pages at base %p\n" , text_pages, vdso_start);/* Allocate the VDSO text pagelist */ vdso_text_pagelist = kcalloc(text_pages, sizeof(struct page *),
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 521/639 rtc: pcf2127: bugfix: read rtc disables watchdog
In reply to Greg Kroah-HartmanFrom: Bruno Thomsen <[email protected]>
[ Upstream commit 7f43020e3bdb63d65661ed377682702f8b34d3ea ]
The previous fix listed bulk read of registers as root cause of accendential disabling of watchdog, since the watchdog counter register (WD_VAL) was zeroed.
Tested with the same PCF2127 chip as Sean reveled root cause of WD_VAL register value zeroing was caused by reading CTRL2 register which is one of the watchdog feature control registers.
So the solution is to not read the first two control registers (CTRL1 and CTRL2) in pcf2127_rtc_read_time as they are not needed anyway. Size of local buf variable is kept to allow easy usage of register defines to improve readability of code.
Debug trace line was updated after CTRL1 and CTRL2 are no longer read from the chip. Also replaced magic numbers in buf access with register defines.
--- drivers/rtc/rtc-pcf2127.c | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-)
drivers/rtc/rtc-pcf2127.c +12 -20
@@ -57,20 +57,14 @@ static int pcf2127_rtc_read_time(struct device *dev, struct rtc_time *tm)struct pcf2127 *pcf2127 =dev_get_drvdata (dev);unsigned char buf[10 ];int ret; -int i; -for (i =0 ; i <=PCF2127_REG_CTRL3 ; i++) { - ret =regmap_read (pcf2127->regmap,PCF2127_REG_CTRL1 + i, - (unsigned int *)(buf + i)); -if (ret) { -dev_err (dev,"%s: read error\n" , __func__); -return ret; - } - } - - ret =regmap_bulk_read (pcf2127->regmap,PCF2127_REG_SC , - (buf +PCF2127_REG_SC ), -ARRAY_SIZE (buf) -PCF2127_REG_SC ); +/* +* Avoid reading CTRL2 register as it causes WD_VAL register +* value to reset to 0 which means watchdog is stopped. +*/ + ret =regmap_bulk_read (pcf2127->regmap,PCF2127_REG_CTRL3 , + (buf +PCF2127_REG_CTRL3 ), +ARRAY_SIZE (buf) -PCF2127_REG_CTRL3 );if (ret) {dev_err (dev,"%s: read error\n" , __func__);return ret;
@@ -91,14 +85,12 @@ static int pcf2127_rtc_read_time(struct device *dev, struct rtc_time *tm) }dev_dbg (dev, -"%s: raw data is cr1=%02x, cr2=%02x, cr3=%02x, " -"sec=%02x, min=%02x, hr=%02x, " +"%s: raw data is cr3=%02x, sec=%02x, min=%02x, hr=%02x, " "mday=%02x, wday=%02x, mon=%02x, year=%02x\n" , - __func__, - buf[0 ], buf[1 ], buf[2 ], - buf[3 ], buf[4 ], buf[5 ], - buf[6 ], buf[7 ], buf[8 ], buf[9 ]); - + __func__, buf[PCF2127_REG_CTRL3 ], buf[PCF2127_REG_SC ], + buf[PCF2127_REG_MN ], buf[PCF2127_REG_HR ], + buf[PCF2127_REG_DM ], buf[PCF2127_REG_DW ], + buf[PCF2127_REG_MO ], buf[PCF2127_REG_YR ]); tm->tm_sec =bcd2bin (buf[PCF2127_REG_SC ] &0x7F ); tm->tm_min =bcd2bin (buf[PCF2127_REG_MN ] &0x7F );
Signature · 1 line
2.20.1
Re: [PATCH 4.19 521/639] rtc: pcf2127: bugfix: read rtc disables watchdog
Quoted 10 lines · Greg Kroah-Hartman
From: Bruno Thomsen <[email protected]>
[ Upstream commit
7f43020e3bdb63d65661ed377682702f8b34d3ea]The previous fix listed bulk read of registers as root cause of accendential disabling of watchdog, since the watchdog counter register (
WD_VAL) was zeroed.Fixes 3769a375ab83 rtc: pcf2127: bulk read only date and time registers.
Quoted 8 lines
Tested with the same PCF2127 chip as Sean reveled root cause of
WD_VALregister value zeroing was caused by reading CTRL2 register which is one of the watchdog feature control registers.So the solution is to not read the first two control registers (CTRL1 and CTRL2) in
pcf2127_rtc_read_timeas they are not needed anyway. Size of local buf variable is kept to allow easy usage of register defines to improve readability of code.
Should the array be zeroed before or something? This way, one array contains both undefined values and valid data...
Quoted 3 lines
Debug trace line was updated after CTRL1 and CTRL2 are no longer read from the chip. Also replaced magic numbers in buf access with register defines.
That part is not an improvement. Previously the code was formatted so that you could parse what is being printed.
Best regards, Pavel
Quoted 24 lines
drivers/rtc/rtc-pcf2127.c +5
-7@@ -91,14 +85,12 @@ static int pcf2127_rtc_read_time(struct device *dev, struct rtc_time *tm) }dev_dbg (dev, -"%s: raw data is cr1=%02x, cr2=%02x, cr3=%02x, " -"sec=%02x, min=%02x, hr=%02x, " +"%s: raw data is cr3=%02x, sec=%02x, min=%02x, hr=%02x, " "mday=%02x, wday=%02x, mon=%02x, year=%02x\n" , - __func__, - buf[0 ], buf[1 ], buf[2 ], - buf[3 ], buf[4 ], buf[5 ], - buf[6 ], buf[7 ], buf[8 ], buf[9 ]); - + __func__, buf[PCF2127_REG_CTRL3 ], buf[PCF2127_REG_SC ], + buf[PCF2127_REG_MN ], buf[PCF2127_REG_HR ], + buf[PCF2127_REG_DM ], buf[PCF2127_REG_DW ], + buf[PCF2127_REG_MO ], buf[PCF2127_REG_YR ]); tm->tm_sec =bcd2bin (buf[PCF2127_REG_SC ] &0x7F ); tm->tm_min =bcd2bin (buf[PCF2127_REG_MN ] &0x7F );Signature · 1 line
2.20.1
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Greg Kroah-Hartman
maintainerRe: [PATCH 4.19 521/639] rtc: pcf2127: bugfix: read rtc disables watchdog
Quoted 23 lines · Pavel Machek
Quoted 10 lines · Greg Kroah-Hartman
From: Bruno Thomsen <[email protected]>
[ Upstream commit
7f43020e3bdb63d65661ed377682702f8b34d3ea]The previous fix listed bulk read of registers as root cause of accendential disabling of watchdog, since the watchdog counter register (
WD_VAL) was zeroed.Fixes 3769a375ab83 rtc: pcf2127: bulk read only date and time registers.Quoted 8 lines
Tested with the same PCF2127 chip as Sean reveled root cause of
WD_VALregister value zeroing was caused by reading CTRL2 register which is one of the watchdog feature control registers.So the solution is to not read the first two control registers (CTRL1 and CTRL2) in
pcf2127_rtc_read_timeas they are not needed anyway. Size of local buf variable is kept to allow easy usage of register defines to improve readability of code.Should the array be zeroed before or something? This way, one array contains both undefined values and valid data...
Quoted 6 lines
Quoted 3 lines
Debug trace line was updated after CTRL1 and CTRL2 are no longer read from the chip. Also replaced magic numbers in buf access with register defines.
That part is not an improvement. Previously the code was formatted so that you could parse what is being printed.
Meta-comment: Making review comments on patches that are already in Linus's tree, is fine, but making them here seems a bit odd. Please just go find the original patch and respond there, as there's not much you can do here _way_ after the fact, as the change is already committed.
thanks,
greg k-h
Greg Kroah-Hartman
maintainerPATCH 522/639 mips: avoid explicit UB in assignment of mips_io_port_base
In reply to Greg Kroah-HartmanFrom: Nick Desaulniers <[email protected]>
[ Upstream commit 12051b318bc3ce5b42d6d786191008284b067d83 ]
The code in question is modifying a variable declared const through pointer manipulation. Such code is explicitly undefined behavior, and is the lone issue preventing malta_defconfig from booting when built with Clang:
If an attempt is made to modify an object defined with a const-qualified type through use of an lvalue with non-const-qualified type, the behavior is undefined.
LLVM is removing such assignments. A simple fix is to not declare variables const that you plan on modifying. Limiting the scope would be a better method of preventing unwanted writes to such a variable.
Further, the code in question mentions "compiler bugs" without any links to bug reports, so it is difficult to know if the issue is resolved in GCC. The patch was authored in 2006, which would have been GCC 4.0.3 or 4.1.1. The minimal supported version of GCC in the Linux kernel is currently 4.6.
For what its worth, there was UB before the commit in question, it just added a barrier and got lucky IRT codegen. I don't think there's any actual compiler bugs related, just runtime bugs due to UB.
--- arch/mips/include/asm/io.h | 14 ++------------ arch/mips/kernel/setup.c | 2 +- 2 files changed, 3 insertions(+), 13 deletions(-)
arch/mips/include/asm/io.h +2 -12
@@ -62,21 +62,11 @@* instruction, so the lower 16 bits must be zero. Should be true on * on any sane architecture; generic code does not use this assumption. */ -extern const unsigned long mips_io_port_base; +extern unsigned long mips_io_port_base; -/* -* Gcc will generate code to load the value of mips_io_port_base after each -* function call which may be fairly wasteful in some cases. So we don't -* play quite by the book. We tell gcc mips_io_port_base is a long variable -* which solves the code generation issue. Now we need to violate the -* aliasing rules a little to make initialization possible and finally we -* will need the barrier() to fight side effects of the aliasing chat. -* This trickery will eventually collapse under gcc's optimizer. Oh well. -*/ static inline void set_io_port_base (unsigned long base) { - * (unsigned long *) &mips_io_port_base = base; -barrier (); + mips_io_port_base = base; }/*
arch/mips/kernel/setup.c +1 -1
@@ -76,7 +76,7 @@ static char __initdata builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE;* mips_io_port_base is the begin of the address space to which x86 style * I/O ports are mapped. */ -const unsigned long mips_io_port_base =-1 ; +unsigned long mips_io_port_base =-1 ;EXPORT_SYMBOL (mips_io_port_base);static struct resource code_resource = { .name ="Kernel code" , };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 523/639 media: em28xx: Fix exception handling in em28xx_alloc_urbs()
In reply to Greg Kroah-HartmanFrom: Markus Elfring <[email protected]>
[ Upstream commit ecbce48f1ff2442371ebcd12ec0ecddb431fbd72 ]
A null pointer would be passed to a call of the function "kfree" directly after a call of the function "kcalloc" failed at one place. Pass the data structure member "urb" instead for which memory was allocated before (so that this resource will be properly cleaned up).
This issue was detected by using the Coccinelle software.
--- drivers/media/usb/em28xx/em28xx-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/em28xx/em28xx-core.c +1 -1
@@ -930,7 +930,7 @@ int em28xx_alloc_urbs(struct em28xx *dev, enum em28xx_mode mode, int xfer_bulk, usb_bufs->buf =kcalloc (num_bufs,sizeof (void *),GFP_KERNEL );if (!usb_bufs->buf) { -kfree (usb_bufs->buf); +kfree (usb_bufs->urb);return -ENOMEM ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 524/639 iommu/mediatek: Fix iova_to_phys PA start for 4GB mode
In reply to Greg Kroah-HartmanFrom: Yong Wu <[email protected]>
[ Upstream commit 76ce65464fcd2c21db84391572b7938b716aceb0 ]
In M4U 4GB mode, the physical address is remapped as below:
CPU Physical address:
====================
0 1G 2G 3G 4G 5G |---A---|---B---|---C---|---D---|---E---|
+--I/O--+------------Memory-------------+
IOMMU output physical address:
=============================
4G 5G 6G 7G 8G
|---E---|---B---|---C---|---D---|
+------------Memory-------------+The Region 'A'(I/O) can not be mapped by M4U; For Region 'B'/'C'/'D', the bit32 of the CPU physical address always is needed to set, and for Region 'E', the CPU physical address keep as is. something looks like this:
CPU PA -> M4U OUTPUT PA 0x4000_0000 0x1_4000_0000 (Add bit32) 0x8000_0000 0x1_8000_0000 ... 0xc000_0000 0x1_c000_0000 ... 0x1_0000_0000 0x1_0000_0000 (No change)
Additionally, the iommu consumers always use the CPU phyiscal address.
The PA in the iova_to_phys that is got from v7s always is u32, But from the CPU point of view, PA only need add BIT(32) when PA < 0x4000_0000.
for 4GB mode")
--- drivers/iommu/mtk_iommu.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-)
drivers/iommu/mtk_iommu.c +25 -1
@@ -115,6 +115,30 @@ struct mtk_iommu_domain {static struct iommu_ops mtk_iommu_ops; +/* +* In M4U 4GB mode, the physical address is remapped as below: +* +* CPU Physical address: +* ==================== +* +* 0 1G 2G 3G 4G 5G +* |---A---|---B---|---C---|---D---|---E---| +* +--I/O--+------------Memory-------------+ +* +* IOMMU output physical address: +* ============================= +* +* 4G 5G 6G 7G 8G +* |---E---|---B---|---C---|---D---| +* +------------Memory-------------+ +* +* The Region 'A'(I/O) can NOT be mapped by M4U; For Region 'B'/'C'/'D', the +* bit32 of the CPU physical address always is needed to set, and for Region +* 'E', the CPU physical address keep as is. +* Additionally, The iommu consumers always use the CPU phyiscal address. +*/ +#define MTK_IOMMU_4GB_MODE_REMAP_BASE 0x40000000 +static LIST_HEAD (m4ulist);/* List all the M4U HWs */ #define for_each_m4u (data) list_for_each_entry(data, &m4ulist, list)
@@ -409,7 +433,7 @@ static phys_addr_t mtk_iommu_iova_to_phys(struct iommu_domain *domain, pa = dom->iop->iova_to_phys (dom->iop, iova);spin_unlock_irqrestore (&dom->pgtlock, flags); -if (data->enable_4GB) +if (data->enable_4GB && pa <MTK_IOMMU_4GB_MODE_REMAP_BASE ) pa |=BIT_ULL (32 );return pa;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 525/639 ahci: Do not export local variable ahci_em_messages
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 60fc35f327e0a9e60b955c0f3c3ed623608d1baa ]
The commit ed08d40cdec4
("ahci: Changing two module params with static and __read_mostly")
moved ahci_em_messages to be static while missing the fact of exporting it.
WARNING: "ahci_em_messages" [vmlinux] is a static EXPORT_SYMBOL_GPL
Drop export for the local variable ahci_em_messages.
--- drivers/ata/libahci.c | 1 - 1 file changed, 1 deletion(-)
drivers/ata/libahci.c +0 -1
@@ -191,7 +191,6 @@ struct ata_port_operations ahci_pmp_retry_srst_ops = {EXPORT_SYMBOL_GPL (ahci_pmp_retry_srst_ops);static bool ahci_em_messages__read_mostly = true; -EXPORT_SYMBOL_GPL (ahci_em_messages);module_param (ahci_em_messages, bool,0444 );/* add other LED protocol types when they become supported */ MODULE_PARM_DESC(ahci_em_messages,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 526/639 rxrpc: Fix lack of conn cleanup when local endpoint is cleaned up [ver #2]
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit d12040b6933f684a26773afad46dbba9778608d7 ]
When a local endpoint is ceases to be in use, such as when the kafs module is unloaded, the kernel will emit an assertion failure if there are any outstanding client connections:
rxrpc: Assertion failed ------------[ cut here ]------------ kernel BUG at net/rxrpc/local_object.c:433!
and even beyond that, will evince other oopses if there are service connections still present.
Fix this by:
(1) Removing the triggering of connection reaping when an rxrpc socket is released. These don't actually clean up the connections anyway - and further, the local endpoint may still be in use through another socket.
(2) Mark the local endpoint as dead when we start the process of tearing it down.
(3) When destroying a local endpoint, strip all of its client connections from the idle list and discard the ref on each that the list was holding.
(4) When destroying a local endpoint, call the service connection reaper directly (rather than through a workqueue) to immediately kill off all outstanding service connections.
(5) Make the service connection reaper reap connections for which the local endpoint is marked dead.
Only after destroying the connections can we close the socket lest we get an oops in a workqueue that's looking at a connection or a peer.
--- net/rxrpc/af_rxrpc.c | 3 --- net/rxrpc/ar-internal.h | 1 + net/rxrpc/conn_client.c | 44 ++++++++++++++++++++++++++++++++++++++++ net/rxrpc/conn_object.c | 2 +- net/rxrpc/local_object.c | 5 ++++- 5 files changed, 50 insertions(+), 5 deletions(-)
net/rxrpc/af_rxrpc.c +0 -3
@@ -869,7 +869,6 @@ static void rxrpc_sock_destructor(struct sock *sk)static int rxrpc_release_sock (struct sock *sk) {struct rxrpc_sock *rx =rxrpc_sk (sk); -struct rxrpc_net *rxnet =rxrpc_net (sock_net (&rx->sk));_enter ("%p{%d,%d}" , sk, sk->sk_state,refcount_read (&sk->sk_refcnt));
@@ -905,8 +904,6 @@ static int rxrpc_release_sock(struct sock *sk)rxrpc_release_calls_on_socket (rx);flush_workqueue (rxrpc_workqueue);rxrpc_purge_queue (&sk->sk_receive_queue); -rxrpc_queue_work (&rxnet->service_conn_reaper); -rxrpc_queue_work (&rxnet->client_conn_reaper);rxrpc_unuse_local (rx->local); rx->local =NULL ;
net/rxrpc/ar-internal.h +1 -0
@@ -903,6 +903,7 @@ void rxrpc_disconnect_client_call(struct rxrpc_call *);void rxrpc_put_client_conn (struct rxrpc_connection *);void rxrpc_discard_expired_client_conns (struct work_struct *);void rxrpc_destroy_all_client_connections (struct rxrpc_net *); +void rxrpc_clean_up_local_conns (struct rxrpc_local *);/* * conn_event.c
net/rxrpc/conn_client.c +44 -0
47 lines not on this page · raw message
net/rxrpc/conn_object.c +1 -1
@@ -401,7 +401,7 @@ void rxrpc_service_connection_reaper(struct work_struct *work)if (conn->state ==RXRPC_CONN_SERVICE_PREALLOC )continue ; -if (rxnet->live) { +if (rxnet->live && !conn->params.local->dead) { idle_timestamp =READ_ONCE (conn->idle_timestamp); expire_at = idle_timestamp + rxrpc_connection_expiry *HZ ;if (conn->params.local->service_closed)
net/rxrpc/local_object.c +4 -1
@@ -430,11 +430,14 @@ static void rxrpc_local_destroyer(struct rxrpc_local *local)_enter ("%d" , local->debug_id); + local->dead = true; +mutex_lock (&rxnet->local_mutex);list_del_init (&local->link);mutex_unlock (&rxnet->local_mutex); -ASSERT (RB_EMPTY_ROOT (&local->client_conns)); +rxrpc_clean_up_local_conns (local); +rxrpc_service_connection_reaper (&rxnet->service_conn_reaper);ASSERT (!local->service);if (socket) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 527/639 Partially revert "kfifo: fix kfifo_alloc() and kfifo_init()"
In reply to Greg Kroah-HartmanFrom: Linus Torvalds <[email protected]>
[ Upstream commit ab9bb6318b0967671e0c9b6537c1537d51ca4f45 ]
Commit dfe2a77fd243 ("kfifo: fix kfifo_alloc() and kfifo_init()") made the kfifo code round the number of elements up. That was good for __kfifo_alloc(), but it's actually wrong for __kfifo_init().
The difference? __kfifo_alloc() will allocate the rounded-up number of elements, but __kfifo_init() uses an allocation done by the caller. We can't just say "use more elements than the caller allocated", and have to round down.
The good news? All the normal cases will be using power-of-two arrays anyway, and most users of kfifo's don't use kfifo_init() at all, but one of the helper macros to declare a KFIFO that enforce the proper power-of-two behavior. But it looks like at least ibmvscsis might be affected.
The bad news? Will Deacon refers to an old thread and points points out that the memory ordering in kfifo's is questionable. See
https://lore.kernel.org/lkml/[email protected]/
for more.
--- lib/kfifo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
lib/kfifo.c +2 -1
@@ -82,7 +82,8 @@ int __kfifo_init(struct __kfifo *fifo, void *buffer, { size /= esize; - size =roundup_pow_of_two (size); +if (!is_power_of_2 (size)) + size =rounddown_pow_of_two (size); fifo->in =0 ; fifo->out =0 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 528/639 hwmon: (lm75) Fix write operations for negative temperatures
In reply to Greg Kroah-HartmanFrom: Guenter Roeck <[email protected]>
[ Upstream commit 7d82fcc9d9e81241778aaa22fda7be753e237d86 ]
Writes into limit registers fail if the temperature written is negative. The regmap write operation checks the value range, regmap_write accepts an unsigned int as parameter, and the temperature value passed to regmap_write is kept in a variable declared as long. Negative values are converted large unsigned integers, which fails the range check. Fix by type casting the temperature to u16 when calling regmap_write().
--- drivers/hwmon/lm75.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/lm75.c +1 -1
@@ -165,7 +165,7 @@ static int lm75_write(struct device *dev, enum hwmon_sensor_types type, temp =DIV_ROUND_CLOSEST (temp << (resolution -8 ),1000 ) << (16 - resolution); -return regmap_write (data->regmap, reg, temp); +return regmap_write (data->regmap, reg, (u16 )temp); } static umode_t lm75_is_visible(const void *data, enum hwmon_sensor_types type,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 529/639 net/sched: cbs: Set default link speed to 10 Mbps in cbs_set_port_rate
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit 1c6c09a0ae62fa3ea8f8ead2ac3920e6fff2de64 ]
The discussion to be made is absolutely the same as in the case of previous patch ("taprio: Set default link speed to 10 Mbps in taprio_set_picos_per_byte"). Nothing is lost when setting a default.
--- net/sched/sch_cbs.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
net/sched/sch_cbs.c +11 -8
@@ -185,11 +185,6 @@ static struct sk_buff *cbs_dequeue_soft(struct Qdisc *sch)s64 credits;int len; -if (atomic64_read (&q->port_rate) ==-1 ) { -WARN_ONCE (1 ,"cbs: dequeue() called with unknown port rate." ); -return NULL ; - } -if (q->credits <0 ) { credits =timediff_to_credits (now - q->last, q->idleslope);
@@ -307,11 +302,19 @@ static int cbs_enable_offload(struct net_device *dev, struct cbs_sched_data *q,static void cbs_set_port_rate (struct net_device *dev,struct cbs_sched_data *q) {struct ethtool_link_ksettings ecmd; +int speed =SPEED_10 ;int port_rate =-1 ; +int err; + + err =__ethtool_get_link_ksettings (dev, &ecmd); +if (err <0 ) + goto skip; + +if (ecmd.base.speed !=SPEED_UNKNOWN ) + speed = ecmd.base.speed; -if (!__ethtool_get_link_ksettings (dev, &ecmd) && - ecmd.base.speed !=SPEED_UNKNOWN ) - port_rate = ecmd.base.speed *1000 *BYTES_PER_KBIT ; +skip: + port_rate = speed *1000 *BYTES_PER_KBIT ;atomic64_set (&q->port_rate, port_rate); netdev_dbg(dev, "cbs: set %s's port_rate to: %lld, linkspeed: %d\n",
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 530/639 power: supply: Init device wakeup after device_add()
In reply to Greg Kroah-HartmanFrom: Stephen Boyd <[email protected]>
[ Upstream commit 8288022284859acbcc3cf1a073a1e2692d6c2543 ]
We may want to use the device pointer in device_init_wakeup() with functions that expect the device to already be added with device_add(). For example, if we were to link the device initializing wakeup to something in sysfs such as a class for wakeups we'll run into an error. It looks like this code was written with the assumption that the device would be added before initializing wakeup due to the order of operations in power_supply_unregister().
Let's change the order of operations so we don't run into problems here.
--- drivers/power/supply/power_supply_core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/power/supply/power_supply_core.c +5 -5
@@ -902,14 +902,14 @@ __power_supply_register(struct device *parent, }spin_lock_init (&psy->changed_lock); - rc =device_init_wakeup (dev, ws); -if (rc) - goto wakeup_init_failed; - rc =device_add (dev);if (rc) goto device_add_failed; + rc =device_init_wakeup (dev, ws); +if (rc) + goto wakeup_init_failed; + rc =psy_register_thermal (psy);if (rc) goto register_thermal_failed;
@@ -946,8 +946,8 @@ register_cooler_failed:psy_unregister_thermal (psy); register_thermal_failed:device_del (dev); -device_add_failed: wakeup_init_failed: +device_add_failed: check_supplies_failed: dev_set_name_failed:put_device (dev);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 531/639 x86, perf: Fix the dependency of the x86 insn decoder selftest
In reply to Greg Kroah-HartmanFrom: Masami Hiramatsu <[email protected]>
[ Upstream commit 7720804a2ae46c90265a32c81c45fb6f8d2f4e8b ]
Since x86 instruction decoder is not only for kprobes, it should be tested when the insn.c is compiled. (e.g. perf is enabled but kprobes is disabled)
--- arch/x86/Kconfig.debug | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/Kconfig.debug +1 -1
@@ -181,7 +181,7 @@ config HAVE_MMIOTRACE_SUPPORT config X86_DECODER_SELFTEST bool "x86 instruction decoder selftest" - depends on DEBUG_KERNEL && KPROBES + depends on DEBUG_KERNEL && INSTRUCTION_DECODER depends on !COMPILE_TEST ---help--- Perform x86 instruction decoder selftests at build time.
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 532/639 staging: greybus: light: fix a couple double frees
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 329101244f214952606359d254ae883b7109e1a5 ]
The problem is in gb_lights_request_handler(). If we get a request to change the config then we release the light with gb_lights_light_release() and re-allocated it. However, if the allocation fails part way through then we call gb_lights_light_release() again. This can lead to a couple different double frees where we haven't cleared out the original values:
gb_lights_light_v4l2_unregister(light); ... kfree(light->channels); kfree(light->name);
I also made a small change to how we set "light->channels_count = 0;". The original code handled this part fine and did not cause a use after free but it was sort of complicated to read.
--- drivers/staging/greybus/light.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/greybus/light.c +6 -6
@@ -1098,21 +1098,21 @@ static void gb_lights_channel_release(struct gb_channel *channel)static void gb_lights_light_release (struct gb_light *light) {int i; -int count; light->ready = false; - count = light->channels_count; -if (light->has_flash)gb_lights_light_v4l2_unregister (light); + light->has_flash = false; -for (i =0 ; i < count; i++) { +for (i =0 ; i < light->channels_count; i++)gb_lights_channel_release (&light->channels[i]); - light->channels_count--; - } + light->channels_count =0 ; +kfree (light->channels); + light->channels =NULL ;kfree (light->name); + light->name =NULL ; }static void gb_lights_release (struct gb_lights *glights)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 533/639 irqdomain: Add the missing assignment of domain->fwnode for named fwnode
In reply to Greg Kroah-HartmanFrom: Dexuan Cui <[email protected]>
[ Upstream commit 711419e504ebd68c8f03656616829c8ad7829389 ]
Recently device pass-through stops working for Linux VM running on Hyper-V.
git-bisect shows the regression is caused by the recent commit 467a3bb97432 ("PCI: hv: Allocate a named fwnode ..."), but the root cause is that the commit d59f6617eef0 forgets to set the domain->fwnode for IRQCHIP_FWNODE_NAMED*, and as a result:
1. The domain->fwnode remains to be NULL.
2. irq_find_matching_fwspec() returns NULL since "h->fwnode == fwnode" is false, and pci_set_bus_msi_domain() sets the Hyper-V PCI root bus's msi_domain to NULL.
3. When the device is added onto the root bus, the device's dev->msi_domain is set to NULL in pci_set_msi_domain().
4. When a device driver tries to enable MSI-X, pci_msi_setup_msi_irqs() calls arch_setup_msi_irqs(), which uses the native MSI chip (i.e. arch/x86/kernel/apic/msi.c: pci_msi_controller) to set up the irqs, but actually pci_msi_setup_msi_irqs() is supposed to call msi_domain_alloc_irqs() with the hbus->irq_domain, which is created in hv_pcie_init_irq_domain() and is associated with the Hyper-V chip hv_msi_irq_chip. Consequently, the irq line is not properly set up, and the device driver can not receive any interrupt.
--- kernel/irq/irqdomain.c | 1 + 1 file changed, 1 insertion(+)
kernel/irq/irqdomain.c +1 -0
@@ -148,6 +148,7 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size,switch (fwid->type) {case IRQCHIP_FWNODE_NAMED :case IRQCHIP_FWNODE_NAMED_ID : + domain->fwnode = fwnode; domain->name =kstrdup (fwid->name,GFP_KERNEL );if (!domain->name) {kfree (domain);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 534/639 bcma: fix incorrect update of BCMA_CORE_PCI_MDIO_DATA
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 420c20be08a4597404d272ae9793b642401146eb ]
An earlier commit re-worked the setting of the bitmask and is now assigning v with some bit flags rather than bitwise or-ing them into v, consequently the earlier bit-settings of v are being lost. Fix this by replacing an assignment with the bitwise or instead.
Addresses-Coverity: ("Unused value")
--- drivers/bcma/driver_pci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/bcma/driver_pci.c +2 -2
@@ -78,7 +78,7 @@ static u16 bcma_pcie_mdio_read(struct bcma_drv_pci *pc, u16 device, u8 address) v |= (address <<BCMA_CORE_PCI_MDIODATA_REGADDR_SHF_OLD ); } - v =BCMA_CORE_PCI_MDIODATA_START ; + v |=BCMA_CORE_PCI_MDIODATA_START ; v |=BCMA_CORE_PCI_MDIODATA_READ ; v |=BCMA_CORE_PCI_MDIODATA_TA ;
@@ -121,7 +121,7 @@ static void bcma_pcie_mdio_write(struct bcma_drv_pci *pc, u16 device, v |= (address <<BCMA_CORE_PCI_MDIODATA_REGADDR_SHF_OLD ); } - v =BCMA_CORE_PCI_MDIODATA_START ; + v |=BCMA_CORE_PCI_MDIODATA_START ; v |=BCMA_CORE_PCI_MDIODATA_WRITE ; v |=BCMA_CORE_PCI_MDIODATA_TA ; v |= data;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 535/639 usb: typec: tps6598x: Fix build error without CONFIG_REGMAP_I2C
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit 35af2445dc306403254a181507b390ec9eb725d5 ]
If CONFIG_REGMAP_I2C is not set, building fails:
drivers/usb/typec/tps6598x.o: In function `tps6598x_probe':
tps6598x.c:(.text+0x5f0): undefined reference to `__devm_regmap_init_i2c'
Select REGMAP_I2C to fix this.
--- drivers/usb/typec/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/usb/typec/Kconfig +1 -0
@@ -95,6 +95,7 @@ source "drivers/usb/typec/ucsi/Kconfig" config TYPEC_TPS6598X tristate "TI TPS6598x USB Power Delivery controller driver" depends on I2C + select REGMAP_I2C help Say Y or M here if your system has TI TPS65982 or TPS65983 USB Power Delivery controller.
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 536/639 bcache: Fix an error code in bch_dump_read()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit d66c9920c0cf984cf99cab5036fd5f3a1b7fba46 ]
The copy_to_user() function returns the number of bytes remaining to be copied, but the intention here was to return -EFAULT if the copy fails.
--- drivers/md/bcache/debug.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/md/bcache/debug.c +2 -3
@@ -178,10 +178,9 @@ static ssize_t bch_dump_read(struct file *file, char __user *buf,while (size) {struct keybuf_key *w;unsigned int bytes =min (i->bytes, size); -int err =copy_to_user (buf, i->buf, bytes); -if (err) -return err; +if (copy_to_user (buf, i->buf, bytes)) +return -EFAULT ; ret += bytes; buf += bytes;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 537/639 iio: dac: ad5380: fix incorrect assignment to val
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit b1e18768ef1214c0a8048327918a182cabe09f9d ]
Currently the pointer val is being incorrectly incremented instead of the value pointed to by val. Fix this by adding in the missing * indirection operator.
Addresses-Coverity: ("Unused value")
--- drivers/iio/dac/ad5380.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/dac/ad5380.c +1 -1
@@ -221,7 +221,7 @@ static int ad5380_read_raw(struct iio_dev *indio_dev,if (ret)return ret; *val >>= chan->scan_type.shift; - val -= (1 << chan->scan_type.realbits) /2 ; + *val -= (1 << chan->scan_type.realbits) /2 ;return IIO_VAL_INT ;case IIO_CHAN_INFO_SCALE : *val =2 * st->vref;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 538/639 netfilter: ctnetlink: honor IPS_OFFLOAD flag
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit b067fa009c884401d23846251031c1f14d8a9c77 ]
If this flag is set, timeout and state are irrelevant to userspace.
--- net/netfilter/nf_conntrack_netlink.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
net/netfilter/nf_conntrack_netlink.c +5 -2
@@ -555,10 +555,8 @@ ctnetlink_fill_info(struct sk_buff *skb, u32 portid, u32 seq, u32 type, goto nla_put_failure; if (ctnetlink_dump_status(skb, ct) < 0 || - ctnetlink_dump_timeout(skb, ct) < 0 || ctnetlink_dump_acct(skb, ct, type) < 0 || ctnetlink_dump_timestamp(skb, ct) < 0 || - ctnetlink_dump_protoinfo(skb, ct) < 0 || ctnetlink_dump_helpinfo(skb, ct) < 0 || ctnetlink_dump_mark(skb, ct) < 0 || ctnetlink_dump_secctx(skb, ct) < 0 ||
@@ -570,6 +568,11 @@ ctnetlink_fill_info(struct sk_buff *skb, u32 portid, u32 seq, u32 type, ctnetlink_dump_ct_synproxy(skb, ct) < 0) goto nla_put_failure; +if (!test_bit (IPS_OFFLOAD_BIT , &ct->status) && + (ctnetlink_dump_timeout (skb, ct) <0 || +ctnetlink_dump_protoinfo (skb, ct) <0 )) + goto nla_put_failure; +nlmsg_end (skb, nlh);return skb->len;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 539/639 ath9k: dynack: fix possible deadlock in ath_dynack_node_{de}init
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit e1aa1a1db3b01c9890e82cf065cee99962ba1ed9 ]
Fix following lockdep warning disabling bh in
ath_dynack_node_init/ath_dynack_node_deinit
[ 75.955878] --------------------------------
[ 75.955880] inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
[ 75.955884] swapper/0/0 [HC0[0]:SC1[3]:HE1:SE0] takes:
[ 75.955888] 00000000792a7ee0 (&(&da->qlock)->rlock){+.?.}, at: ath_dynack_sample_ack_ts+0x4d/0xa0 [ath9k_hw]
[ 75.955905] {SOFTIRQ-ON-W} state was registered at:
[ 75.955912] lock_acquire+0x9a/0x160
[ 75.955917] _raw_spin_lock+0x2c/0x70
[ 75.955927] ath_dynack_node_init+0x2a/0x60 [ath9k_hw]
[ 75.955934] ath9k_sta_state+0xec/0x160 [ath9k]
[ 75.955976] drv_sta_state+0xb2/0x740 [mac80211]
[ 75.956008] sta_info_insert_finish+0x21a/0x420 [mac80211]
[ 75.956039] sta_info_insert_rcu+0x12b/0x2c0 [mac80211]
[ 75.956069] sta_info_insert+0x7/0x70 [mac80211]
[ 75.956093] ieee80211_prep_connection+0x42e/0x730 [mac80211]
[ 75.956120] ieee80211_mgd_auth.cold+0xb9/0x15c [mac80211]
[ 75.956152] cfg80211_mlme_auth+0x143/0x350 [cfg80211]
[ 75.956169] nl80211_authenticate+0x25e/0x2b0 [cfg80211]
[ 75.956172] genl_family_rcv_msg+0x198/0x400
[ 75.956174] genl_rcv_msg+0x42/0x90
[ 75.956176] netlink_rcv_skb+0x35/0xf0
[ 75.956178] genl_rcv+0x1f/0x30
[ 75.956180] netlink_unicast+0x154/0x200
[ 75.956182] netlink_sendmsg+0x1bf/0x3d0
[ 75.956186] ___sys_sendmsg+0x2c2/0x2f0
[ 75.956187] __sys_sendmsg+0x44/0x80
[ 75.956190] do_syscall_64+0x55/0x1a0
[ 75.956192] entry_SYSCALL_64_after_hwframe+0x49/0xbe
[ 75.956194] irq event stamp: 2357092
[ 75.956196] hardirqs last enabled at (2357092): [<ffffffff818c62de>] _raw_spin_unlock_irqrestore+0x3e/0x50
[ 75.956199] hardirqs last disabled at (2357091): [<ffffffff818c60b1>] _raw_spin_lock_irqsave+0x11/0x80
[ 75.956202] softirqs last enabled at (2357072): [<ffffffff8106dc09>] irq_enter+0x59/0x60
[ 75.956204] softirqs last disabled at (2357073): [<ffffffff8106dcbe>] irq_exit+0xae/0xc0
[ 75.956206]
other info that might help us debug this:
[ 75.956207] Possible unsafe locking scenario:[ 75.956208] CPU0
[ 75.956209] ----
[ 75.956210] lock(&(&da->qlock)->rlock);
[ 75.956213] <Interrupt>
[ 75.956214] lock(&(&da->qlock)->rlock);
[ 75.956216]
*** DEADLOCK ***[ 75.956217] 1 lock held by swapper/0/0:
[ 75.956219] #0: 000000003bb5675c (&(&sc->sc_pcu_lock)->rlock){+.-.}, at: ath9k_tasklet+0x55/0x240 [ath9k]
[ 75.956225]
stack backtrace:
[ 75.956228] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.3.0-rc1-wdn+ #13
[ 75.956229] Hardware name: Dell Inc. Studio XPS 1340/0K183D, BIOS A11 09/08/2009
[ 75.956231] Call Trace:
[ 75.956233] <IRQ>
[ 75.956236] dump_stack+0x67/0x90
[ 75.956239] mark_lock+0x4c1/0x640
[ 75.956242] ? check_usage_backwards+0x130/0x130
[ 75.956245] ? sched_clock_local+0x12/0x80
[ 75.956247] __lock_acquire+0x484/0x7a0
[ 75.956250] ? __lock_acquire+0x3b9/0x7a0
[ 75.956252] lock_acquire+0x9a/0x160
[ 75.956259] ? ath_dynack_sample_ack_ts+0x4d/0xa0 [ath9k_hw]
[ 75.956262] _raw_spin_lock_bh+0x34/0x80
[ 75.956268] ? ath_dynack_sample_ack_ts+0x4d/0xa0 [ath9k_hw]
[ 75.956275] ath_dynack_sample_ack_ts+0x4d/0xa0 [ath9k_hw]
[ 75.956280] ath_rx_tasklet+0xd09/0xe90 [ath9k]
[ 75.956286] ath9k_tasklet+0x102/0x240 [ath9k]
[ 75.956288] tasklet_action_common.isra.0+0x6d/0x170
[ 75.956291] __do_softirq+0xcc/0x425
[ 75.956294] irq_exit+0xae/0xc0
[ 75.956296] do_IRQ+0x8a/0x110
[ 75.956298] common_interrupt+0xf/0xf
[ 75.956300] </IRQ>
[ 75.956303] RIP: 0010:cpuidle_enter_state+0xb2/0x400
[ 75.956308] RSP: 0018:ffffffff82203e70 EFLAGS: 00000202 ORIG_RAX: ffffffffffffffd7
[ 75.956310] RAX: ffffffff82219800 RBX: ffffffff822bd0a0 RCX: 0000000000000000
[ 75.956312] RDX: 0000000000000046 RSI: 0000000000000006 RDI: ffffffff82219800
[ 75.956314] RBP: ffff888155a01c00 R08: 00000011af51aabe R09: 0000000000000000
[ 75.956315] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000002
[ 75.956317] R13: 00000011af51aabe R14: 0000000000000003 R15: ffffffff82219800
[ 75.956321] cpuidle_enter+0x24/0x40
[ 75.956323] do_idle+0x1ac/0x220
[ 75.956326] cpu_startup_entry+0x14/0x20
[ 75.956329] start_kernel+0x482/0x489
[ 75.956332] secondary_startup_64+0xa4/0xb0--- drivers/net/wireless/ath/ath9k/dynack.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath9k/dynack.c +4 -4
@@ -300,9 +300,9 @@ void ath_dynack_node_init(struct ath_hw *ah, struct ath_node *an) an->ackto = ackto; -spin_lock (&da->qlock); +spin_lock_bh (&da->qlock);list_add_tail (&an->list, &da->nodes); -spin_unlock (&da->qlock); +spin_unlock_bh (&da->qlock); }EXPORT_SYMBOL (ath_dynack_node_init);
@@ -316,9 +316,9 @@ void ath_dynack_node_deinit(struct ath_hw *ah, struct ath_node *an) {struct ath_dynack *da = &ah->dynack; -spin_lock (&da->qlock); +spin_lock_bh (&da->qlock);list_del (&an->list); -spin_unlock (&da->qlock); +spin_unlock_bh (&da->qlock); }EXPORT_SYMBOL (ath_dynack_node_deinit);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 540/639 wcn36xx: use dynamic allocation for large variables
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 355cf31912014e6ff1bb1019ae4858cad12c68cf ]
clang triggers a warning about oversized stack frames that gcc does not notice because of slightly different inlining decisions:
ath/wcn36xx/smd.c:1409:5: error: stack frame size of 1040 bytes in function 'wcn36xx_smd_config_bss' [-Werror,-Wframe-larger-than=] ath/wcn36xx/smd.c:640:5: error: stack frame size of 1032 bytes in function 'wcn36xx_smd_start_hw_scan' [-Werror,-Wframe-larger-than=]
Basically the wcn36xx_hal_start_scan_offload_req_msg, wcn36xx_hal_config_bss_req_msg_v1, and wcn36xx_hal_config_bss_req_msg structures are too large to be put on the kernel stack, but small enough that gcc does not warn about them.
Use kzalloc() to allocate them all. There are similar structures in other parts of this driver, but they are all smaller, with the next largest stack frame at 480 bytes for wcn36xx_smd_send_beacon.
--- drivers/net/wireless/ath/wcn36xx/smd.c | 186 ++++++++++++++----------- 1 file changed, 105 insertions(+), 81 deletions(-)
drivers/net/wireless/ath/wcn36xx/smd.c +105 -81
@@ -641,52 +641,58 @@ int wcn36xx_smd_start_hw_scan(struct wcn36xx *wcn, struct ieee80211_vif *vif, struct cfg80211_scan_request *req) {struct wcn36xx_vif *vif_priv =wcn36xx_vif_to_priv (vif); -struct wcn36xx_hal_start_scan_offload_req_msg msg_body; +struct wcn36xx_hal_start_scan_offload_req_msg *msg_body;int ret, i;if (req->ie_len >WCN36XX_MAX_SCAN_IE_LEN )return -EINVAL ;mutex_lock (&wcn->hal_mutex); -INIT_HAL_MSG (msg_body,WCN36XX_HAL_START_SCAN_OFFLOAD_REQ ); + msg_body =kzalloc (sizeof (*msg_body),GFP_KERNEL ); +if (!msg_body) { + ret = -ENOMEM ; + goto out; + } - msg_body.scan_type =WCN36XX_HAL_SCAN_TYPE_ACTIVE ; - msg_body.min_ch_time =30 ; - msg_body.max_ch_time =100 ; - msg_body.scan_hidden =1 ; -memcpy (msg_body.mac, vif->addr,ETH_ALEN ); - msg_body.bss_type = vif_priv->bss_type; - msg_body.p2p_search = vif->p2p; +INIT_HAL_MSG ((*msg_body),WCN36XX_HAL_START_SCAN_OFFLOAD_REQ ); - msg_body.num_ssid =min_t (u8, req->n_ssids,ARRAY_SIZE (msg_body.ssids)); -for (i =0 ; i < msg_body.num_ssid; i++) { - msg_body.ssids[i].length =min_t (u8, req->ssids[i].ssid_len, -sizeof (msg_body.ssids[i].ssid)); -memcpy (msg_body.ssids[i].ssid, req->ssids[i].ssid, - msg_body.ssids[i].length); + msg_body->scan_type =WCN36XX_HAL_SCAN_TYPE_ACTIVE ; + msg_body->min_ch_time =30 ; + msg_body->max_ch_time =100 ; + msg_body->scan_hidden =1 ; +memcpy (msg_body->mac, vif->addr,ETH_ALEN ); + msg_body->bss_type = vif_priv->bss_type; + msg_body->p2p_search = vif->p2p; + + msg_body->num_ssid =min_t (u8, req->n_ssids,ARRAY_SIZE (msg_body->ssids)); +for (i =0 ; i < msg_body->num_ssid; i++) { + msg_body->ssids[i].length =min_t (u8, req->ssids[i].ssid_len, +sizeof (msg_body->ssids[i].ssid)); +memcpy (msg_body->ssids[i].ssid, req->ssids[i].ssid, + msg_body->ssids[i].length); } - msg_body.num_channel =min_t (u8, req->n_channels, -sizeof (msg_body.channels)); -for (i =0 ; i < msg_body.num_channel; i++) - msg_body.channels[i] = req->channels[i]->hw_value; + msg_body->num_channel =min_t (u8, req->n_channels, +sizeof (msg_body->channels)); +for (i =0 ; i < msg_body->num_channel; i++) + msg_body->channels[i] = req->channels[i]->hw_value; - msg_body.header.len -=WCN36XX_MAX_SCAN_IE_LEN ; + msg_body->header.len -=WCN36XX_MAX_SCAN_IE_LEN ;if (req->ie_len >0 ) { - msg_body.ie_len = req->ie_len; - msg_body.header.len += req->ie_len; -memcpy (msg_body.ie, req->ie, req->ie_len); + msg_body->ie_len = req->ie_len; + msg_body->header.len += req->ie_len; +memcpy (msg_body->ie, req->ie, req->ie_len); } -PREPARE_HAL_BUF (wcn->hal_buf, msg_body); +PREPARE_HAL_BUF (wcn->hal_buf, (*msg_body));wcn36xx_dbg (WCN36XX_DBG_HAL ,"hal start hw-scan (channels: %u; ssids: %u; p2p: %s)\n" , - msg_body.num_channel, msg_body.num_ssid, - msg_body.p2p_search ?"yes" :"no" ); + msg_body->num_channel, msg_body->num_ssid, + msg_body->p2p_search ?"yes" :"no" ); - ret =wcn36xx_smd_send_and_wait (wcn, msg_body.header.len); + ret =wcn36xx_smd_send_and_wait (wcn, msg_body->header.len);if (ret) {wcn36xx_err ("Sending hal_start_scan_offload failed\n" ); goto out;
@@ -698,6 +704,7 @@ int wcn36xx_smd_start_hw_scan(struct wcn36xx *wcn, struct ieee80211_vif *vif, goto out; } out: +kfree (msg_body);mutex_unlock (&wcn->hal_mutex);return ret; }
@@ -1257,96 +1264,104 @@ out:static int wcn36xx_smd_config_bss_v1 (struct wcn36xx *wcn,const struct wcn36xx_hal_config_bss_req_msg *orig) { -struct wcn36xx_hal_config_bss_req_msg_v1 msg_body; -struct wcn36xx_hal_config_bss_params_v1 *bss = &msg_body.bss_params; -struct wcn36xx_hal_config_sta_params_v1 *sta = &bss->sta; +struct wcn36xx_hal_config_bss_req_msg_v1 *msg_body; +struct wcn36xx_hal_config_bss_params_v1 *bss; +struct wcn36xx_hal_config_sta_params_v1 *sta; +int ret; + + msg_body =kzalloc (sizeof (*msg_body),GFP_KERNEL ); +if (!msg_body) +return -ENOMEM ; + +INIT_HAL_MSG ((*msg_body),WCN36XX_HAL_CONFIG_BSS_REQ ); -INIT_HAL_MSG (msg_body,WCN36XX_HAL_CONFIG_BSS_REQ ); + bss = &msg_body->bss_params; + sta = &bss->sta;/* convert orig to v1 */ -memcpy (&msg_body.bss_params.bssid, +memcpy (&msg_body->bss_params.bssid, &orig->bss_params.bssid,ETH_ALEN ); -memcpy (&msg_body.bss_params.self_mac_addr, +memcpy (&msg_body->bss_params.self_mac_addr, &orig->bss_params.self_mac_addr,ETH_ALEN ); - msg_body.bss_params.bss_type = orig->bss_params.bss_type; - msg_body.bss_params.oper_mode = orig->bss_params.oper_mode; - msg_body.bss_params.nw_type = orig->bss_params.nw_type; + msg_body->bss_params.bss_type = orig->bss_params.bss_type; + msg_body->bss_params.oper_mode = orig->bss_params.oper_mode; + msg_body->bss_params.nw_type = orig->bss_params.nw_type; - msg_body.bss_params.short_slot_time_supported = + msg_body->bss_params.short_slot_time_supported = orig->bss_params.short_slot_time_supported; - msg_body.bss_params.lla_coexist = orig->bss_params.lla_coexist; - msg_body.bss_params.llb_coexist = orig->bss_params.llb_coexist; - msg_body.bss_params.llg_coexist = orig->bss_params.llg_coexist; - msg_body.bss_params.ht20_coexist = orig->bss_params.ht20_coexist; - msg_body.bss_params.lln_non_gf_coexist = + msg_body->bss_params.lla_coexist = orig->bss_params.lla_coexist; + msg_body->bss_params.llb_coexist = orig->bss_params.llb_coexist; + msg_body->bss_params.llg_coexist = orig->bss_params.llg_coexist; + msg_body->bss_params.ht20_coexist = orig->bss_params.ht20_coexist; + msg_body->bss_params.lln_non_gf_coexist = orig->bss_params.lln_non_gf_coexist; - msg_body.bss_params.lsig_tx_op_protection_full_support = + msg_body->bss_params.lsig_tx_op_protection_full_support = orig->bss_params.lsig_tx_op_protection_full_support; - msg_body.bss_params.rifs_mode = orig->bss_params.rifs_mode; - msg_body.bss_params.beacon_interval = orig->bss_params.beacon_interval; - msg_body.bss_params.dtim_period = orig->bss_params.dtim_period; - msg_body.bss_params.tx_channel_width_set = + msg_body->bss_params.rifs_mode = orig->bss_params.rifs_mode; + msg_body->bss_params.beacon_interval = orig->bss_params.beacon_interval; + msg_body->bss_params.dtim_period = orig->bss_params.dtim_period; + msg_body->bss_params.tx_channel_width_set = orig->bss_params.tx_channel_width_set; - msg_body.bss_params.oper_channel = orig->bss_params.oper_channel; - msg_body.bss_params.ext_channel = orig->bss_params.ext_channel; + msg_body->bss_params.oper_channel = orig->bss_params.oper_channel; + msg_body->bss_params.ext_channel = orig->bss_params.ext_channel; - msg_body.bss_params.reserved = orig->bss_params.reserved; + msg_body->bss_params.reserved = orig->bss_params.reserved; -memcpy (&msg_body.bss_params.ssid, +memcpy (&msg_body->bss_params.ssid, &orig->bss_params.ssid,sizeof (orig->bss_params.ssid)); - msg_body.bss_params.action = orig->bss_params.action; - msg_body.bss_params.rateset = orig->bss_params.rateset; - msg_body.bss_params.ht = orig->bss_params.ht; - msg_body.bss_params.obss_prot_enabled = + msg_body->bss_params.action = orig->bss_params.action; + msg_body->bss_params.rateset = orig->bss_params.rateset; + msg_body->bss_params.ht = orig->bss_params.ht; + msg_body->bss_params.obss_prot_enabled = orig->bss_params.obss_prot_enabled; - msg_body.bss_params.rmf = orig->bss_params.rmf; - msg_body.bss_params.ht_oper_mode = orig->bss_params.ht_oper_mode; - msg_body.bss_params.dual_cts_protection = + msg_body->bss_params.rmf = orig->bss_params.rmf; + msg_body->bss_params.ht_oper_mode = orig->bss_params.ht_oper_mode; + msg_body->bss_params.dual_cts_protection = orig->bss_params.dual_cts_protection; - msg_body.bss_params.max_probe_resp_retry_limit = + msg_body->bss_params.max_probe_resp_retry_limit = orig->bss_params.max_probe_resp_retry_limit; - msg_body.bss_params.hidden_ssid = orig->bss_params.hidden_ssid; - msg_body.bss_params.proxy_probe_resp = + msg_body->bss_params.hidden_ssid = orig->bss_params.hidden_ssid; + msg_body->bss_params.proxy_probe_resp = orig->bss_params.proxy_probe_resp; - msg_body.bss_params.edca_params_valid = + msg_body->bss_params.edca_params_valid = orig->bss_params.edca_params_valid; -memcpy (&msg_body.bss_params.acbe, +memcpy (&msg_body->bss_params.acbe, &orig->bss_params.acbe,sizeof (orig->bss_params.acbe)); -memcpy (&msg_body.bss_params.acbk, +memcpy (&msg_body->bss_params.acbk, &orig->bss_params.acbk,sizeof (orig->bss_params.acbk)); -memcpy (&msg_body.bss_params.acvi, +memcpy (&msg_body->bss_params.acvi, &orig->bss_params.acvi,sizeof (orig->bss_params.acvi)); -memcpy (&msg_body.bss_params.acvo, +memcpy (&msg_body->bss_params.acvo, &orig->bss_params.acvo,sizeof (orig->bss_params.acvo)); - msg_body.bss_params.ext_set_sta_key_param_valid = + msg_body->bss_params.ext_set_sta_key_param_valid = orig->bss_params.ext_set_sta_key_param_valid; -memcpy (&msg_body.bss_params.ext_set_sta_key_param, +memcpy (&msg_body->bss_params.ext_set_sta_key_param, &orig->bss_params.ext_set_sta_key_param,sizeof (orig->bss_params.acvo)); - msg_body.bss_params.wcn36xx_hal_persona = + msg_body->bss_params.wcn36xx_hal_persona = orig->bss_params.wcn36xx_hal_persona; - msg_body.bss_params.spectrum_mgt_enable = + msg_body->bss_params.spectrum_mgt_enable = orig->bss_params.spectrum_mgt_enable; - msg_body.bss_params.tx_mgmt_power = orig->bss_params.tx_mgmt_power; - msg_body.bss_params.max_tx_power = orig->bss_params.max_tx_power; + msg_body->bss_params.tx_mgmt_power = orig->bss_params.tx_mgmt_power; + msg_body->bss_params.max_tx_power = orig->bss_params.max_tx_power;wcn36xx_smd_convert_sta_to_v1 (wcn, &orig->bss_params.sta, - &msg_body.bss_params.sta); + &msg_body->bss_params.sta); -PREPARE_HAL_BUF (wcn->hal_buf, msg_body); +PREPARE_HAL_BUF (wcn->hal_buf, (*msg_body)); wcn36xx_dbg(WCN36XX_DBG_HAL, "hal config bss v1 bssid %pM self_mac_addr %pM bss_type %d oper_mode %d nw_type %d\n",
@@ -1358,7 +1373,10 @@ static int wcn36xx_smd_config_bss_v1(struct wcn36xx *wcn, sta->bssid, sta->action, sta->sta_index, sta->bssid_index, sta->aid, sta->type, sta->mac); -return wcn36xx_smd_send_and_wait (wcn, msg_body.header.len); + ret =wcn36xx_smd_send_and_wait (wcn, msg_body->header.len); +kfree (msg_body); + +return ret; }
@@ -1410,16 +1428,21 @@ int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif, struct ieee80211_sta *sta, const u8 *bssid, bool update) { - struct wcn36xx_hal_config_bss_req_msg msg; + struct wcn36xx_hal_config_bss_req_msg *msg;struct wcn36xx_hal_config_bss_params *bss;struct wcn36xx_hal_config_sta_params *sta_params;struct wcn36xx_vif *vif_priv =wcn36xx_vif_to_priv (vif);int ret;mutex_lock (&wcn->hal_mutex); -INIT_HAL_MSG (msg,WCN36XX_HAL_CONFIG_BSS_REQ ); + msg =kzalloc (sizeof (*msg),GFP_KERNEL ); +if (!msg) { + ret = -ENOMEM ; + goto out; + } +INIT_HAL_MSG ((*msg),WCN36XX_HAL_CONFIG_BSS_REQ ); - bss = &msg.bss_params; + bss = &msg->bss_params; sta_params = &bss->sta;WARN_ON (is_zero_ether_addr (bssid));
@@ -1514,11 +1537,11 @@ int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif, sta_params->mac);if (!wcn36xx_is_fw_version (wcn,1 ,2 ,2 ,24 )) { - ret =wcn36xx_smd_config_bss_v1 (wcn, &msg); + ret =wcn36xx_smd_config_bss_v1 (wcn, msg); }else { -PREPARE_HAL_BUF (wcn->hal_buf, msg); +PREPARE_HAL_BUF (wcn->hal_buf, (*msg)); - ret =wcn36xx_smd_send_and_wait (wcn, msg.header.len); + ret =wcn36xx_smd_send_and_wait (wcn, msg->header.len); }if (ret) {wcn36xx_err ("Sending hal_config_bss failed\n" );
@@ -1534,6 +1557,7 @@ int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif, goto out; } out: +kfree (msg);mutex_unlock (&wcn->hal_mutex);return ret; }
Signature · 1 line
2.20.1
Re: [PATCH 4.19 540/639] wcn36xx: use dynamic allocation for large variables
Hi!
Quoted 21 lines
From: Arnd Bergmann <[email protected]>
[ Upstream commit
355cf31912014e6ff1bb1019ae4858cad12c68cf]clang triggers a warning about oversized stack frames that gcc does not notice because of slightly different inlining decisions:
ath/wcn36xx/smd.c:1409:5: error: stack frame size of 1040 bytes in function 'wcn36xx_smd_config_bss' [-Werror,-Wframe-larger-than=]ath/wcn36xx/smd.c:640:5: error: stack frame size of 1032 bytes in function 'wcn36xx_smd_start_hw_scan' [-Werror,-Wframe-larger-than=]Basically the
wcn36xx_hal_start_scan_offload_req_msg,wcn36xx_hal_config_bss_req_msg_v1, andwcn36xx_hal_config_bss_req_msgstructures are too large to be put on the kernel stack, but small enough that gcc does not warn about them.Use
kzalloc()to allocate them all. There are similar structures in other parts of this driver, but they are all smaller, with the next largest stack frame at 480 bytes forwcn36xx_smd_send_beacon.drivers/net/wireless/ath/wcn36xx/smd.c +0
-0int ret, i;
drivers/net/wireless/ath/wcn36xx/smd.c int wcn36xx_smd_start_hw_scan(struct wcn36xx *wcn, struct ieee80211_vif *vif, · line 655
Quoted 10 lines
drivers/net/wireless/ath/wcn36xx/smd.c +5
-1if (req->ie_len >WCN36XX_MAX_SCAN_IE_LEN )return -EINVAL ;mutex_lock (&wcn->hal_mutex); -INIT_HAL_MSG (msg_body,WCN36XX_HAL_START_SCAN_OFFLOAD_REQ ); + msg_body =kzalloc (sizeof (*msg_body),GFP_KERNEL ); +if (!msg_body) { + ret = -ENOMEM ; + goto out; + }
The allocation can be done outside the lock.
Quoted 9 lines
drivers/net/wireless/ath/wcn36xx/smd.c +1
-1@@ -1410,16 +1428,21 @@ int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif, struct ieee80211_sta *sta, const u8 *bssid, bool update) { - struct wcn36xx_hal_config_bss_req_msg msg; + struct wcn36xx_hal_config_bss_req_msg *msg;struct wcn36xx_hal_config_bss_params *bss;struct wcn36xx_hal_config_sta_params *sta_params;struct wcn36xx_vif *vif_priv =wcn36xx_vif_to_priv (vif);
drivers/net/wireless/ath/wcn36xx/smd.c int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif, · line 1443
Quoted 10 lines
drivers/net/wireless/ath/wcn36xx/smd.c +6
-1int ret;mutex_lock (&wcn->hal_mutex); -INIT_HAL_MSG (msg,WCN36XX_HAL_CONFIG_BSS_REQ ); + msg =kzalloc (sizeof (*msg),GFP_KERNEL ); +if (!msg) { + ret = -ENOMEM ; + goto out; + } +INIT_HAL_MSG ((*msg),WCN36XX_HAL_CONFIG_BSS_REQ );
Same here.
Best regards,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Greg Kroah-Hartman
maintainerPATCH 541/639 tty: serial: fsl_lpuart: Use appropriate lpuart32_* I/O funcs
In reply to Greg Kroah-HartmanFrom: Andrey Smirnov <[email protected]>
[ Upstream commit 1da17d7cf8e2c4b60163d54300f72c02f510327c ]
When dealing with 32-bit variant of LPUART IP block appropriate I/O helpers have to be used to properly deal with endianness differences. Change all of the offending code to do that.
for lpuart32.")
--- drivers/tty/serial/fsl_lpuart.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/tty/serial/fsl_lpuart.c +14 -14
@@ -528,26 +528,26 @@ static int lpuart32_poll_init(struct uart_port *port)spin_lock_irqsave (&sport->port.lock, flags);/* Disable Rx & Tx */ -writel (0 , sport->port.membase +UARTCTRL ); +lpuart32_write (&sport->port,UARTCTRL ,0 ); - temp =readl (sport->port.membase +UARTFIFO ); + temp =lpuart32_read (&sport->port,UARTFIFO );/* Enable Rx and Tx FIFO */ -writel (temp |UARTFIFO_RXFE |UARTFIFO_TXFE , - sport->port.membase +UARTFIFO ); +lpuart32_write (&sport->port,UARTFIFO , + temp |UARTFIFO_RXFE |UARTFIFO_TXFE );/* flush Tx and Rx FIFO */ -writel (UARTFIFO_TXFLUSH |UARTFIFO_RXFLUSH , - sport->port.membase +UARTFIFO ); +lpuart32_write (&sport->port,UARTFIFO , +UARTFIFO_TXFLUSH |UARTFIFO_RXFLUSH );/* explicitly clear RDRF */ -if (readl (sport->port.membase +UARTSTAT ) &UARTSTAT_RDRF ) { -readl (sport->port.membase +UARTDATA ); -writel (UARTFIFO_RXUF , sport->port.membase +UARTFIFO ); +if (lpuart32_read (&sport->port,UARTSTAT ) &UARTSTAT_RDRF ) { +lpuart32_read (&sport->port,UARTDATA ); +lpuart32_write (&sport->port,UARTFIFO ,UARTFIFO_RXUF ); }/* Enable Rx and Tx */ -writel (UARTCTRL_RE |UARTCTRL_TE , sport->port.membase +UARTCTRL ); +lpuart32_write (&sport->port,UARTCTRL ,UARTCTRL_RE |UARTCTRL_TE );spin_unlock_irqrestore (&sport->port.lock, flags);return 0 ;
@@ -555,18 +555,18 @@ static int lpuart32_poll_init(struct uart_port *port)static void lpuart32_poll_put_char (struct uart_port *port,unsigned char c) { -while (!(readl (port->membase +UARTSTAT ) &UARTSTAT_TDRE )) +while (!(lpuart32_read (port,UARTSTAT ) &UARTSTAT_TDRE ))barrier (); -writel (c, port->membase +UARTDATA ); +lpuart32_write (port,UARTDATA , c); }static int lpuart32_poll_get_char (struct uart_port *port) { -if (!(readl (port->membase +UARTSTAT ) &UARTSTAT_RDRF )) +if (!(lpuart32_read (port,UARTSTAT ) &UARTSTAT_RDRF ))return NO_POLL_CHAR ; -return readl (port->membase +UARTDATA ); +return lpuart32_read (port,UARTDATA ); }#endif
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 542/639 ARM: dts: aspeed-g5: Fixe gpio-ranges upper limit
In reply to Greg Kroah-HartmanFrom: Oscar A Perez <[email protected]>
[ Upstream commit 89b97c429e2e77d695b5133572ca12ec256a4ea4 ]
According to the AST2500/AST2520 specs, these SoCs support up to 228 GPIO pins. However, 'gpio-ranges' value in 'aspeed-g5.dtsi' file is currently setting the upper limit to 220 which isn't allowing access to all their GPIOs. The correct upper limit value is 232 (actual number is 228 plus a 4-GPIO hole in GPIOAB). Without this patch, GPIOs AC5 and AC6 do not work correctly on a AST2500 BMC running Linux Kernel v4.19
--- arch/arm/boot/dts/aspeed-g5.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/aspeed-g5.dtsi +1 -1
@@ -247,7 +247,7 @@ compatible = "aspeed,ast2500-gpio"; reg = <0x1e780000 0x1000>; interrupts = <20>; - gpio-ranges = <&pinctrl 0 0 220>; + gpio-ranges = <&pinctrl 0 0 232>; clocks = <&syscon ASPEED_CLK_APB>; interrupt-controller; };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 543/639 xsk: avoid store-tearing when assigning queues
In reply to Greg Kroah-HartmanFrom: Björn Töpel <[email protected]>
[ Upstream commit 94a997637c5b562fa0ca44fca1d2cd02ec08236f ]
Use WRITE_ONCE when doing the store of tx, rx, fq, and cq, to avoid potential store-tearing. These members are read outside of the control mutex in the mmap implementation.
--- net/xdp/xsk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/xdp/xsk.c +1 -1
@@ -320,7 +320,7 @@ static int xsk_init_queue(u32 entries, struct xsk_queue **queue,/* Make sure queue is ready before it can be seen by others */ smp_wmb (); - *queue = q; +WRITE_ONCE (*queue, q);return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 544/639 xsk: avoid store-tearing when assigning umem
In reply to Greg Kroah-HartmanFrom: Björn Töpel <[email protected]>
[ Upstream commit 9764f4b301c3e7eb3b75eec85b73cad449cdbb0d ]
The umem member of struct xdp_sock is read outside of the control mutex, in the mmap implementation, and needs a WRITE_ONCE to avoid potential store-tearing.
--- net/xdp/xsk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/xdp/xsk.c +2 -2
@@ -454,7 +454,7 @@ static int xsk_bind(struct socket *sock, struct sockaddr *addr, int addr_len) }xdp_get_umem (umem_xs->umem); - xs->umem = umem_xs->umem; +WRITE_ONCE (xs->umem, umem_xs->umem);sockfd_put (sock); }else if (!xs->umem || !xdp_umem_validate_queues (xs->umem)) { err = -EINVAL ;
@@ -534,7 +534,7 @@ static int xsk_setsockopt(struct socket *sock, int level, int optname,/* Make sure umem is ready before it can be seen by others */ smp_wmb (); - xs->umem = umem; +WRITE_ONCE (xs->umem, umem);mutex_unlock (&xs->mutex);return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 545/639 led: triggers: Fix dereferencing of null pointer
In reply to Greg Kroah-HartmanFrom: Oleh Kravchenko <[email protected]>
[ Upstream commit 4016ba85880b252365d11bc7dc899450f2c73ad7 ]
Error was detected by PVS-Studio:
V522 Dereferencing of the null pointer 'led_cdev->trigger' might take place.
--- drivers/leds/led-triggers.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/leds/led-triggers.c +2 -2
@@ -171,11 +171,11 @@ err_add_groups: trig->deactivate (led_cdev); err_activate: - led_cdev->trigger =NULL ; - led_cdev->trigger_data =NULL ;write_lock_irqsave (&led_cdev->trigger->leddev_list_lock, flags);list_del (&led_cdev->trig_list);write_unlock_irqrestore (&led_cdev->trigger->leddev_list_lock, flags); + led_cdev->trigger =NULL ; + led_cdev->trigger_data =NULL ;led_set_brightness (led_cdev,LED_OFF );kfree (event);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 546/639 net: sonic: return NETDEV_TX_OK if failed to map buffer
In reply to Greg Kroah-HartmanFrom: Mao Wenan <[email protected]>
[ Upstream commit 6e1cdedcf0362fed3aedfe051d46bd7ee2a85fe1 ]
NETDEV_TX_BUSY really should only be used by drivers that call netif_tx_stop_queue() at the wrong moment. If dma_map_single() is failed to map tx DMA buffer, it might trigger an infinite loop. This patch use NETDEV_TX_OK instead of NETDEV_TX_BUSY, and change printk to pr_err_ratelimited.
--- drivers/net/ethernet/natsemi/sonic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/natsemi/sonic.c +2 -2
@@ -231,9 +231,9 @@ static int sonic_send_packet(struct sk_buff *skb, struct net_device *dev) laddr =dma_map_single (lp->device, skb->data, length,DMA_TO_DEVICE );if (!laddr) { -printk (KERN_ERR "%s: failed to map tx DMA buffer.\n" , dev->name); +pr_err_ratelimited ("%s: failed to map tx DMA buffer.\n" , dev->name);dev_kfree_skb (skb); -return NETDEV_TX_BUSY ; +return NETDEV_TX_OK ; }sonic_tda_put (dev, entry,SONIC_TD_STATUS ,0 );/* clear status */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 547/639 net: hns3: fix error VF index when setting VLAN offload
In reply to Greg Kroah-HartmanFrom: Jian Shen <[email protected]>
[ Upstream commit d9c0f2756a33833b2653f7a3612814fa5f52a568 ]
In original codes, the VF index used incorrectly in function hclge_set_vlan_rx_offload_cfg() and hclge_set_vlan_rx_offload_cfg(). When VF id is greater than 8, for example 9, it will set the same bit with VF id 1.
This patch fixes it by using vport->vport_id % HCLGE_VF_NUM_PER_CMD / HCLGE_VF_NUM_PER_BYTE as the array index, instead of vport->vport_id / HCLGE_VF_NUM_PER_CMD.
--- .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +10 -4
@@ -4833,6 +4833,7 @@ static int hclge_set_vlan_tx_offload_cfg(struct hclge_vport *vport)struct hclge_vport_vtag_tx_cfg_cmd *req;struct hclge_dev *hdev = vport->back;struct hclge_desc desc; +u16 bmap_index;int status;hclge_cmd_setup_basic_desc (&desc,HCLGE_OPC_VLAN_PORT_TX_CFG , false);
@@ -4855,8 +4856,10 @@ static int hclge_set_vlan_tx_offload_cfg(struct hclge_vport *vport)hnae3_set_bit (req->vport_vlan_cfg,HCLGE_CFG_NIC_ROCE_SEL_B ,0 ); req->vf_offset = vport->vport_id /HCLGE_VF_NUM_PER_CMD ; - req->vf_bitmap[req->vf_offset] = -1 << (vport->vport_id %HCLGE_VF_NUM_PER_BYTE ); + bmap_index = vport->vport_id %HCLGE_VF_NUM_PER_CMD / +HCLGE_VF_NUM_PER_BYTE ; + req->vf_bitmap[bmap_index] = +1U << (vport->vport_id %HCLGE_VF_NUM_PER_BYTE ); status =hclge_cmd_send (&hdev->hw, &desc,1 );if (status)
@@ -4873,6 +4876,7 @@ static int hclge_set_vlan_rx_offload_cfg(struct hclge_vport *vport)struct hclge_vport_vtag_rx_cfg_cmd *req;struct hclge_dev *hdev = vport->back;struct hclge_desc desc; +u16 bmap_index;int status;hclge_cmd_setup_basic_desc (&desc,HCLGE_OPC_VLAN_PORT_RX_CFG , false);
@@ -4888,8 +4892,10 @@ static int hclge_set_vlan_rx_offload_cfg(struct hclge_vport *vport) vcfg->vlan2_vlan_prionly ? 1 : 0); req->vf_offset = vport->vport_id /HCLGE_VF_NUM_PER_CMD ; - req->vf_bitmap[req->vf_offset] = -1 << (vport->vport_id %HCLGE_VF_NUM_PER_BYTE ); + bmap_index = vport->vport_id %HCLGE_VF_NUM_PER_CMD / +HCLGE_VF_NUM_PER_BYTE ; + req->vf_bitmap[bmap_index] = +1U << (vport->vport_id %HCLGE_VF_NUM_PER_BYTE ); status =hclge_cmd_send (&hdev->hw, &desc,1 );if (status)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 548/639 rtlwifi: Fix file release memory leak
In reply to Greg Kroah-HartmanFrom: Wei Yongjun <[email protected]>
[ Upstream commit 4c3e48794dec7cb568974ba3bf2ab62b9c45ca3e ]
When using single_open() for opening, single_release() should be used instead of seq_release(), otherwise there is a memory leak.
This is detected by Coccinelle semantic patch.
--- drivers/net/wireless/realtek/rtlwifi/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtlwifi/debug.c +1 -1
@@ -109,7 +109,7 @@ static const struct file_operations file_ops_common = { .open = dl_debug_open_common, .read = seq_read, .llseek = seq_lseek, - .release = seq_release, + .release = single_release, };static int rtl_debug_get_mac_page (struct seq_file *m,void *v)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 549/639 ARM: dts: logicpd-som-lv: Fix i2c2 and i2c3 Pin mux
In reply to Greg Kroah-HartmanFrom: Adam Ford <[email protected]>
[ Upstream commit a932b77b4d1939ad173f18be87da409427fb705c ]
When the pinmux configuration was added, it was accidentally placed into the omap3_pmx_wkup node when it should have been placed into the omap3_pmx_core. This error was accidentally propagated to stable by me when I blindly requested the pull after seeing I2C issues without actually reviewing the content of the pinout. Since the bootloader previously muxed these correctly in the past, was a hidden error.
This patch moves the i2c2_pins and i2c3_pins to the correct node which should eliminate i2c bus errors and timeouts due to the fact the bootloader uses the save device tree that no longer properly assigns these pins.
for LogicPD SOM-LV") #4.9+
--- arch/arm/boot/dts/logicpd-som-lv.dtsi | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-)
arch/arm/boot/dts/logicpd-som-lv.dtsi +14 -12
@@ -232,6 +232,20 @@ >; }; + i2c2_pins: pinmux_i2c2_pins { + pinctrl-single,pins = < + OMAP3_CORE1_IOPAD(0x21be, PIN_INPUT | MUX_MODE0) /* i2c2_scl */ + OMAP3_CORE1_IOPAD(0x21c0, PIN_INPUT | MUX_MODE0) /* i2c2_sda */ + >; + }; + + i2c3_pins: pinmux_i2c3_pins { + pinctrl-single,pins = < + OMAP3_CORE1_IOPAD(0x21c2, PIN_INPUT | MUX_MODE0) /* i2c3_scl */ + OMAP3_CORE1_IOPAD(0x21c4, PIN_INPUT | MUX_MODE0) /* i2c3_sda */ + >; + }; + tsc2004_pins: pinmux_tsc2004_pins { pinctrl-single,pins = < OMAP3_CORE1_IOPAD(0x2186, PIN_INPUT | MUX_MODE4) /* mcbsp4_dr.gpio_153 */
@@ -253,18 +267,6 @@ OMAP3_WKUP_IOPAD(0x2a0c, PIN_OUTPUT | MUX_MODE4) /* sys_boot1.gpio_3 */ >; }; - i2c2_pins: pinmux_i2c2_pins { - pinctrl-single,pins = < - OMAP3_CORE1_IOPAD(0x21be, PIN_INPUT | MUX_MODE0) /* i2c2_scl */ - OMAP3_CORE1_IOPAD(0x21c0, PIN_INPUT | MUX_MODE0) /* i2c2_sda */ - >; - }; - i2c3_pins: pinmux_i2c3_pins { - pinctrl-single,pins = < - OMAP3_CORE1_IOPAD(0x21c2, PIN_INPUT | MUX_MODE0) /* i2c3_scl */ - OMAP3_CORE1_IOPAD(0x21c4, PIN_INPUT | MUX_MODE0) /* i2c3_sda */ - >; - }; }; &omap3_pmx_core2 {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 550/639 f2fs: fix wrong error injection path in inc_valid_block_count()
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
[ Upstream commit 9ea2f0be6ceaebae1518a5f897cff2645830dd95 ]
If FAULT_BLOCK type error injection is on, in inc_valid_block_count() we may decrease sbi->alloc_valid_block_count percpu stat count incorrectly, fix it.
--- fs/f2fs/f2fs.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/f2fs/f2fs.h +2 -1
@@ -1701,7 +1701,7 @@ static inline int inc_valid_block_count(struct f2fs_sb_info *sbi,if (time_to_inject (sbi,FAULT_BLOCK )) {f2fs_show_injection_info (FAULT_BLOCK ); release = *count; - goto enospc; + goto release_quota; }/*
@@ -1741,6 +1741,7 @@ static inline int inc_valid_block_count(struct f2fs_sb_info *sbi, enospc:percpu_counter_sub (&sbi->alloc_valid_block_count, release); +release_quota:dquot_release_reservation_block (inode, release);return -ENOSPC ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 551/639 f2fs: fix error path of f2fs_convert_inline_page()
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
[ Upstream commit e8c82c11c93d586d03d80305959527bcac383555 ]
In error path of f2fs_convert_inline_page(), we missed to truncate newly reserved block in .i_addrs[0] once we failed in get_node_info(), fix it.
--- fs/f2fs/inline.c | 1 + 1 file changed, 1 insertion(+)
fs/f2fs/inline.c +1 -0
@@ -133,6 +133,7 @@ int f2fs_convert_inline_page(struct dnode_of_data *dn, struct page *page) err =f2fs_get_node_info (fio.sbi, dn->nid, &ni);if (err) { +f2fs_truncate_data_blocks_range (dn,1 );f2fs_put_dnode (dn);return err; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 552/639 scsi: fnic: fix msix interrupt allocation
In reply to Greg Kroah-HartmanFrom: Govindarajulu Varadarajan <[email protected]>
[ Upstream commit 3ec24fb4c035e9cbb2f02a48640a09aa913442a2 ]
pci_alloc_irq_vectors() returns number of vectors allocated. Fix the check for error condition.
--- drivers/scsi/fnic/fnic_isr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/fnic/fnic_isr.c +2 -2
@@ -254,7 +254,7 @@ int fnic_set_intr_mode(struct fnic *fnic)int vecs = n + m + o +1 ;if (pci_alloc_irq_vectors (fnic->pdev, vecs, vecs, -PCI_IRQ_MSIX ) <0 ) { +PCI_IRQ_MSIX ) == vecs) { fnic->rq_count = n; fnic->raw_wq_count = m; fnic->wq_copy_count = o;
@@ -280,7 +280,7 @@ int fnic_set_intr_mode(struct fnic *fnic) fnic->wq_copy_count >=1 && fnic->cq_count >=3 && fnic->intr_count >=1 && - pci_alloc_irq_vectors(fnic->pdev, 1, 1, PCI_IRQ_MSI) < 0) { + pci_alloc_irq_vectors(fnic->pdev, 1, 1, PCI_IRQ_MSI) == 1) { fnic->rq_count = 1; fnic->raw_wq_count =1 ; fnic->wq_copy_count =1 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 553/639 Btrfs: fix hang when loading existing inode cache off disk
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
[ Upstream commit 7764d56baa844d7f6206394f21a0e8c1f303c476 ]
If we are able to load an existing inode cache off disk, we set the state of the cache to BTRFS_CACHE_FINISHED, but we don't wake up any one waiting for the cache to be available. This means that anyone waiting for the cache to be available, waiting on the condition that either its state is BTRFS_CACHE_FINISHED or its available free space is greather than zero, can hang forever.
This could be observed running fstests with MOUNT_OPTIONS="-o inode_cache", in particular test case generic/161 triggered it very frequently for me, producing a trace like the following:
[63795.739712] BTRFS info (device sdc): enabling inode map caching [63795.739714] BTRFS info (device sdc): disk space caching is enabled [63795.739716] BTRFS info (device sdc): has skinny extents [64036.653886] INFO: task btrfs-transacti:3917 blocked for more than 120 seconds. [64036.654079] Not tainted 5.2.0-rc4-btrfs-next-50 #1 [64036.654143] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [64036.654232] btrfs-transacti D 0 3917 2 0x80004000 [64036.654239] Call Trace: [64036.654258] ? __schedule+0x3ae/0x7b0 [64036.654271] schedule+0x3a/0xb0 [64036.654325] btrfs_commit_transaction+0x978/0xae0 [btrfs] [64036.654339] ? remove_wait_queue+0x60/0x60 [64036.654395] transaction_kthread+0x146/0x180 [btrfs] [64036.654450] ? btrfs_cleanup_transaction+0x620/0x620 [btrfs] [64036.654456] kthread+0x103/0x140 [64036.654464] ? kthread_create_worker_on_cpu+0x70/0x70 [64036.654476] ret_from_fork+0x3a/0x50 [64036.654504] INFO: task xfs_io:3919 blocked for more than 120 seconds. [64036.654568] Not tainted 5.2.0-rc4-btrfs-next-50 #1 [64036.654617] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [64036.654685] xfs_io D 0 3919 3633 0x00000000 [64036.654691] Call Trace: [64036.654703] ? __schedule+0x3ae/0x7b0 [64036.654716] schedule+0x3a/0xb0 [64036.654756] btrfs_find_free_ino+0xa9/0x120 [btrfs] [64036.654764] ? remove_wait_queue+0x60/0x60 [64036.654809] btrfs_create+0x72/0x1f0 [btrfs] [64036.654822] lookup_open+0x6bc/0x790 [64036.654849] path_openat+0x3bc/0xc00 [64036.654854] ? __lock_acquire+0x331/0x1cb0 [64036.654869] do_filp_open+0x99/0x110 [64036.654884] ? __alloc_fd+0xee/0x200 [64036.654895] ? do_raw_spin_unlock+0x49/0xc0 [64036.654909] ? do_sys_open+0x132/0x220 [64036.654913] do_sys_open+0x132/0x220 [64036.654926] do_syscall_64+0x60/0x1d0 [64036.654933] entry_SYSCALL_64_after_hwframe+0x49/0xbe
Fix this by adding a wake_up() call right after setting the cache state to BTRFS_CACHE_FINISHED, at start_caching(), when we are able to load the cache from disk.
--- fs/btrfs/inode-map.c | 1 + 1 file changed, 1 insertion(+)
fs/btrfs/inode-map.c +1 -0
@@ -145,6 +145,7 @@ static void start_caching(struct btrfs_root *root)spin_lock (&root->ino_cache_lock); root->ino_cache_state =BTRFS_CACHE_FINISHED ;spin_unlock (&root->ino_cache_lock); +wake_up (&root->ino_cache_wait);return ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 554/639 Btrfs: fix inode cache waiters hanging on failure to start caching thread
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
[ Upstream commit a68ebe0790fc88b4314d17984a2cf99ce2361901 ]
If we fail to start the inode caching thread, we print an error message and disable the inode cache, however we never wake up any waiters, so they hang forever waiting for the caching to finish. Fix this by waking them up and have them fallback to a call to btrfs_find_free_objectid().
--- fs/btrfs/inode-map.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-)
fs/btrfs/inode-map.c +18 -5
@@ -12,6 +12,19 @@#include "inode-map.h" #include "transaction.h" +static void fail_caching_thread (struct btrfs_root *root) +{ +struct btrfs_fs_info *fs_info = root->fs_info; + +btrfs_warn (fs_info,"failed to start inode caching task" ); +btrfs_clear_pending_and_info (fs_info,INODE_MAP_CACHE , +"disabling inode map caching" ); +spin_lock (&root->ino_cache_lock); + root->ino_cache_state =BTRFS_CACHE_ERROR ; +spin_unlock (&root->ino_cache_lock); +wake_up (&root->ino_cache_wait); +} +static int caching_kthread (void *data) {struct btrfs_root *root = data;
@@ -164,11 +177,8 @@ static void start_caching(struct btrfs_root *root) tsk =kthread_run (caching_kthread, root,"btrfs-ino-cache-%llu" , root->root_key.objectid); -if (IS_ERR (tsk)) { -btrfs_warn (fs_info,"failed to start inode caching task" ); -btrfs_clear_pending_and_info (fs_info,INODE_MAP_CACHE , -"disabling inode map caching" ); - } +if (IS_ERR (tsk)) +fail_caching_thread (root); }int btrfs_find_free_ino (struct btrfs_root *root,u64 *objectid)
@@ -186,11 +196,14 @@ again:wait_event (root->ino_cache_wait, root->ino_cache_state ==BTRFS_CACHE_FINISHED || + root->ino_cache_state ==BTRFS_CACHE_ERROR || root->free_ino_ctl->free_space >0 );if (root->ino_cache_state ==BTRFS_CACHE_FINISHED && root->free_ino_ctl->free_space ==0 )return -ENOSPC ; +else if (root->ino_cache_state ==BTRFS_CACHE_ERROR ) +return btrfs_find_free_objectid (root, objectid);else goto again; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 555/639 Btrfs: fix inode cache waiters hanging on path allocation failure
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
[ Upstream commit 9d123a35d7e97bb2139747b16127c9b22b6a593e ]
If the caching thread fails to allocate a path, it returns without waking up any cache waiters, leaving them hang forever. Fix this by following the same approach as when we fail to start the caching thread: print an error message, disable inode caching and make the wakers fallback to non-caching mode behaviour (calling btrfs_find_free_objectid()).
--- fs/btrfs/inode-map.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/btrfs/inode-map.c +3 -1
@@ -41,8 +41,10 @@ static int caching_kthread(void *data)return 0 ; path =btrfs_alloc_path (); -if (!path) +if (!path) { +fail_caching_thread (root);return -ENOMEM ; + }/* Since the commit root is read-only, we can safely skip locking. */ path->skip_locking =1 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 556/639 btrfs: use correct count in btrfs_file_write_iter()
In reply to Greg Kroah-HartmanFrom: Omar Sandoval <[email protected]>
[ Upstream commit c09767a8960ca0500fb636bf73686723337debf4 ]
generic_write_checks() may modify iov_iter_count(), so we must get the count after the call, not before. Using the wrong one has a couple of consequences:
1. We check a longer range in check_can_nocow() for nowait than we're actually writing.
2. We create extra hole extent maps in btrfs_cont_expand(). As far as I can tell, this is harmless, but I might be missing something.
These issues are pretty minor, but let's fix it before something more important trips on it.
--- fs/btrfs/file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/file.c +2 -1
@@ -1895,7 +1895,7 @@ static ssize_t btrfs_file_write_iter(struct kiocb *iocb,bool sync = (file->f_flags &O_DSYNC ) ||IS_SYNC (file->f_mapping->host);ssize_t err;loff_t pos; -size_t count =iov_iter_count (from); +size_t count;loff_t oldsize;int clean_page =0 ;
@@ -1917,6 +1917,7 @@ static ssize_t btrfs_file_write_iter(struct kiocb *iocb, } pos = iocb->ki_pos; + count =iov_iter_count (from);if (iocb->ki_flags &IOCB_NOWAIT ) {/* * We will allocate space in case nodatacow is not set,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 557/639 ixgbe: sync the first fragment unconditionally
In reply to Greg Kroah-HartmanFrom: Firo Yang <[email protected]>
[ Upstream commit e7ba676c6188d394a0133fc4b9bcd7ee50d54b7f ]
In Xen environment, if Xen-swiotlb is enabled, ixgbe driver could possibly allocate a page, DMA memory buffer, for the first fragment which is not suitable for Xen-swiotlb to do DMA operations. Xen-swiotlb have to internally allocate another page for doing DMA operations. This mechanism requires syncing the data from the internal page to the page which ixgbe sends to upper network stack. However, since commit f3213d932173 ("ixgbe: Update driver to make use of DMA attributes in Rx path"), the unmap operation is performed with DMA_ATTR_SKIP_CPU_SYNC. As a result, the sync is not performed. Since the sync isn't performed, the upper network stack could receive a incomplete network packet. By incomplete, it means the linear data on the first fragment(between skb->head and skb->end) is invalid. So we have to copy the data from the internal xen-swiotlb page to the page which ixgbe sends to upper network stack through the sync operation.
More details from Alexander Duyck:
Specifically since we are mapping the frame with DMA_ATTR_SKIP_CPU_SYNC we have to unmap with that as well. As a result a sync is not performed on an unmap and must be done manually as we skipped it for the first frag. As such we need to always sync before possibly performing a page unmap operation.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +9 -7
@@ -1822,13 +1822,7 @@ static void ixgbe_pull_tail(struct ixgbe_ring *rx_ring,static void ixgbe_dma_sync_frag (struct ixgbe_ring *rx_ring,struct sk_buff *skb) { -/* if the page was released unmap it, else just sync our portion */ -if (unlikely (IXGBE_CB (skb)->page_released)) { -dma_unmap_page_attrs (rx_ring->dev,IXGBE_CB (skb)->dma, -ixgbe_rx_pg_size (rx_ring), -DMA_FROM_DEVICE , -IXGBE_RX_DMA_ATTR ); - }else if (ring_uses_build_skb (rx_ring)) { +if (ring_uses_build_skb (rx_ring)) {unsigned long offset = (unsigned long )(skb->data) & ~PAGE_MASK ; dma_sync_single_range_for_cpu(rx_ring->dev,
@@ -1845,6 +1839,14 @@ static void ixgbe_dma_sync_frag(struct ixgbe_ring *rx_ring,skb_frag_size (frag), DMA_FROM_DEVICE); } + +/* If the page was released, just unmap it. */ +if (unlikely (IXGBE_CB (skb)->page_released)) { +dma_unmap_page_attrs (rx_ring->dev,IXGBE_CB (skb)->dma, +ixgbe_rx_pg_size (rx_ring), +DMA_FROM_DEVICE , +IXGBE_RX_DMA_ATTR ); + } }/**
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 558/639 hwmon: (shtc1) fix shtc1 and shtw1 id mask
In reply to Greg Kroah-HartmanFrom: Dan Robertson <[email protected]>
[ Upstream commit fdc7d8e829ec755c5cfb2f5a8d8c0cdfb664f895 ]
Fix an error in the bitmaskfor the shtc1 and shtw1 bitmask used to retrieve the chip ID from the ID register. See section 5.7 of the shtw1 or shtc1 datasheet for details.
--- drivers/hwmon/shtc1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/shtc1.c +1 -1
@@ -38,7 +38,7 @@ static const unsigned char shtc1_cmd_read_id_reg[] = { 0xef, 0xc8 };/* constants for reading the ID register */ #define SHTC1_ID 0x07 -#define SHTC1_ID_REG_MASK 0x1f +#define SHTC1_ID_REG_MASK 0x3f/* delays for non-blocking i2c commands, both in us */ #define SHTC1_NONBLOCKING_WAIT_TIME_HPM 14400
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 559/639 net: sonic: replace dev_kfree_skb in sonic_send_packet
In reply to Greg Kroah-HartmanFrom: Mao Wenan <[email protected]>
[ Upstream commit 49f6c90bf6805948b597eabb499e500a47cf24be ]
sonic_send_packet will be processed in irq or non-irq context, so it would better use dev_kfree_skb_any instead of dev_kfree_skb.
--- drivers/net/ethernet/natsemi/sonic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/natsemi/sonic.c +1 -1
@@ -232,7 +232,7 @@ static int sonic_send_packet(struct sk_buff *skb, struct net_device *dev) laddr =dma_map_single (lp->device, skb->data, length,DMA_TO_DEVICE );if (!laddr) {pr_err_ratelimited ("%s: failed to map tx DMA buffer.\n" , dev->name); -dev_kfree_skb (skb); +dev_kfree_skb_any (skb);return NETDEV_TX_OK ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 560/639 pinctrl: iproc-gpio: Fix incorrect pinconf configurations
In reply to Greg Kroah-HartmanFrom: Li Jin <[email protected]>
[ Upstream commit 398a1f50e3c731586182fd52b834103b0aa2f826 ]
Fix drive strength for AON/CRMU controller; fix pull-up/down setting for CCM/CDRU controller.
--- drivers/pinctrl/bcm/pinctrl-iproc-gpio.c | 96 +++++++++++++++++++----- 1 file changed, 77 insertions(+), 19 deletions(-)
drivers/pinctrl/bcm/pinctrl-iproc-gpio.c +77 -19
@@ -54,8 +54,12 @@/* drive strength control for ASIU GPIO */ #define IPROC_GPIO_ASIU_DRV0_CTRL_OFFSET 0x58 -/* drive strength control for CCM/CRMU (AON) GPIO */ -#define IPROC_GPIO_DRV0_CTRL_OFFSET 0x00 +/* pinconf for CCM GPIO */ +#define IPROC_GPIO_PULL_DN_OFFSET 0x10 +#define IPROC_GPIO_PULL_UP_OFFSET 0x14 + +/* pinconf for CRMU(aon) GPIO and CCM GPIO*/ +#define IPROC_GPIO_DRV_CTRL_OFFSET 0x00#define GPIO_BANK_SIZE 0x200#define NGPIOS_PER_BANK 32
@@ -76,6 +80,12 @@ enum iproc_pinconf_param { IPROC_PINCON_MAX, }; +enum iproc_pinconf_ctrl_type { +IOCTRL_TYPE_AON =1 , +IOCTRL_TYPE_CDRU , +IOCTRL_TYPE_INVALID , +}; +/* * Iproc GPIO core *
@@ -100,6 +110,7 @@ struct iproc_gpio {void __iomem *base;void __iomem *io_ctrl; +enum iproc_pinconf_ctrl_type io_ctrl_type;raw_spinlock_t lock;
@@ -461,20 +472,44 @@ static const struct pinctrl_ops iproc_pctrl_ops = {static int iproc_gpio_set_pull (struct iproc_gpio *chip,unsigned gpio,bool disable,bool pull_up) { +void __iomem *base;unsigned long flags; +unsigned int shift; +u32 val_1, val_2;raw_spin_lock_irqsave (&chip->lock, flags); - -if (disable) { -iproc_set_bit (chip,IPROC_GPIO_RES_EN_OFFSET , gpio, false); +if (chip->io_ctrl_type ==IOCTRL_TYPE_CDRU ) { + base = chip->io_ctrl; + shift =IPROC_GPIO_SHIFT (gpio); + + val_1 =readl (base +IPROC_GPIO_PULL_UP_OFFSET ); + val_2 =readl (base +IPROC_GPIO_PULL_DN_OFFSET ); +if (disable) { +/* no pull-up or pull-down */ + val_1 &= ~BIT (shift); + val_2 &= ~BIT (shift); + }else if (pull_up) { + val_1 |=BIT (shift); + val_2 &= ~BIT (shift); + }else { + val_1 &= ~BIT (shift); + val_2 |=BIT (shift); + } +writel (val_1, base +IPROC_GPIO_PULL_UP_OFFSET ); +writel (val_2, base +IPROC_GPIO_PULL_DN_OFFSET ); }else { -iproc_set_bit (chip,IPROC_GPIO_PAD_RES_OFFSET , gpio, - pull_up); -iproc_set_bit (chip,IPROC_GPIO_RES_EN_OFFSET , gpio, true); +if (disable) { +iproc_set_bit (chip,IPROC_GPIO_RES_EN_OFFSET , gpio, + false); + }else { +iproc_set_bit (chip,IPROC_GPIO_PAD_RES_OFFSET , gpio, + pull_up); +iproc_set_bit (chip,IPROC_GPIO_RES_EN_OFFSET , gpio, + true); + } }raw_spin_unlock_irqrestore (&chip->lock, flags); -dev_dbg (chip->dev,"gpio:%u set pullup:%d\n" , gpio, pull_up);return 0 ;
@@ -483,14 +518,35 @@ static int iproc_gpio_set_pull(struct iproc_gpio *chip, unsigned gpio,static void iproc_gpio_get_pull (struct iproc_gpio *chip,unsigned gpio,bool *disable,bool *pull_up) { +void __iomem *base;unsigned long flags; +unsigned int shift; +u32 val_1, val_2;raw_spin_lock_irqsave (&chip->lock, flags); - *disable = !iproc_get_bit (chip,IPROC_GPIO_RES_EN_OFFSET , gpio); - *pull_up =iproc_get_bit (chip,IPROC_GPIO_PAD_RES_OFFSET , gpio); +if (chip->io_ctrl_type ==IOCTRL_TYPE_CDRU ) { + base = chip->io_ctrl; + shift =IPROC_GPIO_SHIFT (gpio); + + val_1 =readl (base +IPROC_GPIO_PULL_UP_OFFSET ) &BIT (shift); + val_2 =readl (base +IPROC_GPIO_PULL_DN_OFFSET ) &BIT (shift); + + *pull_up = val_1 ? true : false; + *disable = (val_1 | val_2) ? false : true; + + }else { + *disable = !iproc_get_bit (chip,IPROC_GPIO_RES_EN_OFFSET , gpio); + *pull_up =iproc_get_bit (chip,IPROC_GPIO_PAD_RES_OFFSET , gpio); + }raw_spin_unlock_irqrestore (&chip->lock, flags); } +#define DRV_STRENGTH_OFFSET (gpio, bit, type) ((type) == IOCTRL_TYPE_AON ? \ + ((2 - (bit)) * 4 + IPROC_GPIO_DRV_CTRL_OFFSET) : \ + ((type) == IOCTRL_TYPE_CDRU) ? \ + ((bit) * 4 + IPROC_GPIO_DRV_CTRL_OFFSET) : \ + ((bit) * 4 + IPROC_GPIO_REG(gpio, IPROC_GPIO_ASIU_DRV0_CTRL_OFFSET))) +static int iproc_gpio_set_strength (struct iproc_gpio *chip,unsigned gpio,unsigned strength) {
@@ -505,11 +561,8 @@ static int iproc_gpio_set_strength(struct iproc_gpio *chip, unsigned gpio,if (chip->io_ctrl) { base = chip->io_ctrl; - offset =IPROC_GPIO_DRV0_CTRL_OFFSET ; }else { base = chip->base; - offset =IPROC_GPIO_REG (gpio, -IPROC_GPIO_ASIU_DRV0_CTRL_OFFSET ); } shift =IPROC_GPIO_SHIFT (gpio);
@@ -520,11 +573,11 @@ static int iproc_gpio_set_strength(struct iproc_gpio *chip, unsigned gpio,raw_spin_lock_irqsave (&chip->lock, flags); strength = (strength /2 ) -1 ;for (i =0 ; i <GPIO_DRV_STRENGTH_BITS ; i++) { + offset =DRV_STRENGTH_OFFSET (gpio, i, chip->io_ctrl_type); val =readl (base + offset); val &= ~BIT (shift); val |= ((strength >> i) &0x1 ) << shift;writel (val, base + offset); - offset +=4 ; }raw_spin_unlock_irqrestore (&chip->lock, flags);
@@ -541,11 +594,8 @@ static int iproc_gpio_get_strength(struct iproc_gpio *chip, unsigned gpio,if (chip->io_ctrl) { base = chip->io_ctrl; - offset =IPROC_GPIO_DRV0_CTRL_OFFSET ; }else { base = chip->base; - offset =IPROC_GPIO_REG (gpio, -IPROC_GPIO_ASIU_DRV0_CTRL_OFFSET ); } shift =IPROC_GPIO_SHIFT (gpio);
@@ -553,10 +603,10 @@ static int iproc_gpio_get_strength(struct iproc_gpio *chip, unsigned gpio,raw_spin_lock_irqsave (&chip->lock, flags); *strength =0 ;for (i =0 ; i <GPIO_DRV_STRENGTH_BITS ; i++) { + offset =DRV_STRENGTH_OFFSET (gpio, i, chip->io_ctrl_type); val =readl (base + offset) &BIT (shift); val >>= shift; *strength += (val << i); - offset +=4 ; }/* convert to mA */
@@ -734,6 +784,7 @@ static int iproc_gpio_probe(struct platform_device *pdev)u32 ngpios, pinconf_disable_mask =0 ;int irq, ret;bool no_pinconf = false; +enum iproc_pinconf_ctrl_type io_ctrl_type =IOCTRL_TYPE_INVALID ;/* NSP does not support drive strength config */ if (of_device_is_compatible (dev->of_node,"brcm,iproc-nsp-gpio" ))
@@ -764,8 +815,15 @@ static int iproc_gpio_probe(struct platform_device *pdev)dev_err (dev,"unable to map I/O memory\n" );return PTR_ERR (chip->io_ctrl); } +if (of_device_is_compatible (dev->of_node, +"brcm,cygnus-ccm-gpio" )) + io_ctrl_type =IOCTRL_TYPE_CDRU ; +else + io_ctrl_type =IOCTRL_TYPE_AON ; } + chip->io_ctrl_type = io_ctrl_type; +if (of_property_read_u32 (dev->of_node,"ngpios" , &ngpios)) {dev_err (&pdev->dev,"missing ngpios DT property\n" );return -ENODEV ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 561/639 gpio/aspeed: Fix incorrect number of banks
In reply to Greg Kroah-HartmanFrom: Rashmica Gupta <[email protected]>
[ Upstream commit 3c4710ae6f883f9c6e3df5e27e274702a1221c57 ]
The current calculation for the number of GPIO banks is only correct if the number of GPIOs is a multiple of 32 (if there were 31 GPIOs we would currently say there are 0 banks, which is incorrect).
--- drivers/gpio/gpio-aspeed.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-aspeed.c +1 -1
@@ -1199,7 +1199,7 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev) gpio->chip.irq.need_valid_mask = true;/* Allocate a cache of the output registers */ - banks = gpio->config->nr_gpios >>5 ; + banks =DIV_ROUND_UP (gpio->config->nr_gpios,32 ); gpio->dcache =devm_kcalloc (&pdev->dev, banks,sizeof (u32),GFP_KERNEL );if (!gpio->dcache)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 562/639 ath10k: adjust skb length in ath10k_sdio_mbox_rx_packet
In reply to Greg Kroah-HartmanFrom: Nicolas Boichat <[email protected]>
[ Upstream commit b7139960832eb56fa15d390a4b5c8c5739bd0d1a ]
When the FW bundles multiple packets, pkt->act_len may be incorrect as it refers to the first packet only (however, the FW will only bundle packets that fit into the same pkt->alloc_len).
Before this patch, the skb length would be set (incorrectly) to pkt->act_len in ath10k_sdio_mbox_rx_packet, and then later manually adjusted in ath10k_sdio_mbox_rx_process_packet.
The first problem is that ath10k_sdio_mbox_rx_process_packet does not use proper skb_put commands to adjust the length (it directly changes skb->len), so we end up with a mismatch between skb->head + skb->tail and skb->data + skb->len. This is quite serious, and causes corruptions in the TCP stack, as the stack tries to coalesce packets, and relies on skb->tail being correct (that is, skb_tail_pointer must point to the first byte_after_ the data).
Instead of re-adjusting the size in ath10k_sdio_mbox_rx_process_packet, this moves the code to ath10k_sdio_mbox_rx_packet, and also add a bounds check, as skb_put would crash the kernel if not enough space is available.
Tested with QCA6174 SDIO with firmware
WLAN.RMH.4.4.1-00007-QCARMSWP-1.
--- drivers/net/wireless/ath/ath10k/sdio.c | 29 +++++++++++++++++++------- 1 file changed, 21 insertions(+), 8 deletions(-)
drivers/net/wireless/ath/ath10k/sdio.c +21 -8
@@ -392,16 +392,11 @@ static int ath10k_sdio_mbox_rx_process_packet(struct ath10k *ar,struct ath10k_htc_hdr *htc_hdr = (struct ath10k_htc_hdr *)skb->data;bool trailer_present = htc_hdr->flags &ATH10K_HTC_FLAG_TRAILER_PRESENT ;enum ath10k_htc_ep_id eid; -u16 payload_len;u8 *trailer;int ret; - payload_len =le16_to_cpu (htc_hdr->len); - skb->len = payload_len +sizeof (struct ath10k_htc_hdr ); -if (trailer_present) { - trailer = skb->data +sizeof (*htc_hdr) + - payload_len - htc_hdr->trailer_len; + trailer = skb->data + skb->len - htc_hdr->trailer_len; eid =pipe_id_to_eid (htc_hdr->eid);
@@ -638,13 +633,31 @@ static int ath10k_sdio_mbox_rx_packet(struct ath10k *ar, {struct ath10k_sdio *ar_sdio =ath10k_sdio_priv (ar);struct sk_buff *skb = pkt->skb; +struct ath10k_htc_hdr *htc_hdr;int ret; ret =ath10k_sdio_readsb (ar, ar_sdio->mbox_info.htc_addr, skb->data, pkt->alloc_len); +if (ret) + goto out; + +/* Update actual length. The original length may be incorrect, +* as the FW will bundle multiple packets as long as their sizes +* fit within the same aligned length (pkt->alloc_len). +*/ + htc_hdr = (struct ath10k_htc_hdr *)skb->data; + pkt->act_len =le16_to_cpu (htc_hdr->len) +sizeof (*htc_hdr); +if (pkt->act_len > pkt->alloc_len) { +ath10k_warn (ar,"rx packet too large (%zu > %zu)\n" , + pkt->act_len, pkt->alloc_len); + ret = -EMSGSIZE ; + goto out; + } + +skb_put (skb, pkt->act_len); + +out: pkt->status = ret; -if (!ret) -skb_put (skb, pkt->act_len);return ret; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 563/639 RDMA/cma: Fix false error message
In reply to Greg Kroah-HartmanFrom: Håkon Bugge <[email protected]>
[ Upstream commit a6e4d254c19b541a58caced322111084b27a7788 ]
In addr_handler(), assuming status == 0 and the device already has been acquired (id_priv->cma_dev != NULL), we get the following incorrect "error" message:
RDMA CM: ADDR_ERROR: failed to resolve IP. status 0
--- drivers/infiniband/core/cma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/cma.c +1 -1
@@ -2889,7 +2889,7 @@ static void addr_handler(int status, struct sockaddr *src_addr,if (status)pr_debug_ratelimited ("RDMA CM: ADDR_ERROR: failed to acquire device. status %d\n" , status); - }else { + }else if (status) {pr_debug_ratelimited ("RDMA CM: ADDR_ERROR: failed to resolve IP. status %d\n" , status); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 564/639 net/rds: Fix ib_evt_handler_call element in rds_ib_stat_names
In reply to Greg Kroah-HartmanFrom: Gerd Rausch <[email protected]>
[ Upstream commit 05a82481a3024b94db00b8c816bb3d526b5209e0 ]
All entries in 'rds_ib_stat_names' are stringified versions of the corresponding "struct rds_ib_statistics" element without the "s_"-prefix.
Fix entry 'ib_evt_handler_call' to do the same.
--- net/rds/ib_stats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/rds/ib_stats.c +1 -1
@@ -42,7 +42,7 @@ DEFINE_PER_CPU_SHARED_ALIGNED(struct rds_ib_statistics, rds_ib_stats);static const char *const rds_ib_stat_names[] = {"ib_connect_raced" ,"ib_listen_closed_stale" , -"s_ib_evt_handler_call" , +"ib_evt_handler_call" ,"ib_tasklet_call" ,"ib_tx_cq_event" ,"ib_tx_ring_full" ,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 565/639 um: Fix off by one error in IRQ enumeration
In reply to Greg Kroah-HartmanFrom: Anton Ivanov <[email protected]>
[ Upstream commit 09ccf0364ca3e94aba4093707ef433ea8014e2a4 ]
Fix an off-by-one in IRQ enumeration
Reported by: Dana Johnson <[email protected]>
--- arch/um/include/asm/irq.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/um/include/asm/irq.h +1 -1
@@ -23,7 +23,7 @@#define VECTOR_BASE_IRQ 15#define VECTOR_IRQ_SPACE 8 -#define LAST_IRQ (VECTOR_IRQ_SPACE + VECTOR_BASE_IRQ) +#define LAST_IRQ (VECTOR_IRQ_SPACE + VECTOR_BASE_IRQ - 1)#else
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 566/639 bnxt_en: Increase timeout for HWRM_DBG_COREDUMP_XX commands
In reply to Greg Kroah-HartmanFrom: Vasundhara Volam <[email protected]>
[ Upstream commit 57a8730b1f7a0be7bf8a0a0bb665329074ba764f ]
Firmware coredump messages take much longer than standard messages, so increase the timeout accordingly.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1 + drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.h +1 -0
@@ -527,6 +527,7 @@ struct rx_tpa_end_cmp_ext {#define DFLT_HWRM_CMD_TIMEOUT 500#define HWRM_CMD_TIMEOUT (bp->hwrm_cmd_timeout)#define HWRM_RESET_TIMEOUT ((HWRM_CMD_TIMEOUT) * 4) +#define HWRM_COREDUMP_TIMEOUT ((HWRM_CMD_TIMEOUT) * 12)#define HWRM_RESP_ERR_CODE_MASK 0xffff#define HWRM_RESP_LEN_OFFSET 4#define HWRM_RESP_LEN_MASK 0xffff0000
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +1 -1
@@ -2833,7 +2833,7 @@ static int bnxt_hwrm_dbg_coredump_initiate(struct bnxt *bp, u16 component_id, req.component_id =cpu_to_le16 (component_id); req.segment_id =cpu_to_le16 (segment_id); -return hwrm_send_message (bp, &req,sizeof (req),HWRM_CMD_TIMEOUT ); +return hwrm_send_message (bp, &req,sizeof (req),HWRM_COREDUMP_TIMEOUT ); } static int bnxt_hwrm_dbg_coredump_retrieve(struct bnxt *bp, u16 component_id,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 567/639 f2fs: fix to avoid accessing uninitialized field of inode page in is_alive()
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
[ Upstream commit 98194030554cd9b10568a9b58f5a135c7e7cba85 ]
If inode is newly created, inode page may not synchronize with inode cache, so fields like .i_inline or .i_extra_isize could be wrong, in below call path, we may access such wrong fields, result in failing to migrate valid target block.
Thread A Thread B
- f2fs_create
- f2fs_add_link
- f2fs_add_dentry
- f2fs_init_inode_metadata
- f2fs_add_inline_entry
- f2fs_new_inode_page
- f2fs_put_page
: inode page wasn't updated with inode cache
- gc_data_segment
- is_alive
- f2fs_get_node_page
- datablock_addr
- offset_in_addr : access uninitialized fields
--- fs/f2fs/dir.c | 5 +++++ fs/f2fs/inline.c | 5 +++++ 2 files changed, 10 insertions(+)
fs/f2fs/dir.c +5 -0
@@ -572,6 +572,11 @@ add_dentry:if (inode) {f2fs_i_pino_write (inode, dir->i_ino); + +/* synchronize inode page's data from inode cache */ +if (is_inode_flag_set (inode,FI_NEW_INODE )) +f2fs_update_inode (inode, page); +f2fs_put_page (page,1 ); }
fs/f2fs/inline.c +5 -0
@@ -578,6 +578,11 @@ int f2fs_add_inline_entry(struct inode *dir, const struct qstr *new_name,/* we don't need to mark_inode_dirty now */ if (inode) {f2fs_i_pino_write (inode, dir->i_ino); + +/* synchronize inode page's data from inode cache */ +if (is_inode_flag_set (inode,FI_NEW_INODE )) +f2fs_update_inode (inode, page); +f2fs_put_page (page,1 ); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 568/639 mailbox: qcom-apcs: fix max_register value
In reply to Greg Kroah-HartmanFrom: Jorge Ramirez-Ortiz <[email protected]>
[ Upstream commit 556a0964e28c4441dcdd50fb07596fd042246bd5 ]
The mailbox length is 0x1000 hence the max_register value is 0xFFC.
regmap")
--- drivers/mailbox/qcom-apcs-ipc-mailbox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mailbox/qcom-apcs-ipc-mailbox.c +1 -1
@@ -36,7 +36,7 @@ static const struct regmap_config apcs_regmap_config = { .reg_bits = 32, .reg_stride = 4, .val_bits = 32, - .max_register = 0x1000, + .max_register = 0xFFC, .fast_io = true, };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 569/639 clk: actions: Fix factor clk struct member access
In reply to Greg Kroah-HartmanFrom: Manivannan Sadhasivam <[email protected]>
[ Upstream commit ed309bfb4812e8b31a3eb877e157b8028a49e50c ]
Since the helper "owl_factor_helper_round_rate" is shared between factor and composite clocks, using the factor clk specific helper function like "hw_to_owl_factor" to access its members will create issues when called from composite clk specific code. Hence, pass the "factor_hw" struct pointer directly instead of fetching it using factor clk specific helpers.
This issue has been observed when a composite clock like "sd0_clk" tried to call "owl_factor_helper_round_rate" resulting in pointer dereferencing error.
While we are at it, let's rename the "clk_val_best" function to "owl_clk_val_best" since this is an owl SoCs specific helper.
--- drivers/clk/actions/owl-factor.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/clk/actions/owl-factor.c +3 -4
@@ -64,11 +64,10 @@ static unsigned int _get_table_val(const struct clk_factor_table *table,return val; } -static int clk_val_best (struct clk_hw *hw,unsigned long rate, +static int owl_clk_val_best (const struct owl_factor_hw *factor_hw, +struct clk_hw *hw,unsigned long rate,unsigned long *best_parent_rate) { -struct owl_factor *factor =hw_to_owl_factor (hw); -struct owl_factor_hw *factor_hw = &factor->factor_hw;const struct clk_factor_table *clkt = factor_hw->table;unsigned long parent_rate, try_parent_rate, best =0 , cur_rate;unsigned long parent_rate_saved = *best_parent_rate;
@@ -126,7 +125,7 @@ long owl_factor_helper_round_rate(struct owl_clk_common *common,const struct clk_factor_table *clkt = factor_hw->table;unsigned int val, mul =0 , div =1 ; - val =clk_val_best (&common->hw, rate, parent_rate); + val =owl_clk_val_best (factor_hw, &common->hw, rate, parent_rate);_get_table_div_mul (clkt, val, &mul, &div);return *parent_rate * mul / div;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 570/639 powerpc/mm/mce: Keep irqs disabled during lockless page table walk
In reply to Greg Kroah-HartmanFrom: Aneesh Kumar K.V <[email protected]>
[ Upstream commit d9101bfa6adc831bda8836c4d774820553c14942 ]
__find_linux_mm_pte() returns a page table entry pointer after walking the page table without holding locks. To make it safe against a THP split and/or collapse, we disable interrupts around the lockless page table walk. However we need to keep interrupts disabled as long as we use the page table entry pointer that is returned.
Fix addr_to_pfn() to do that.
--- arch/powerpc/kernel/mce_power.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
arch/powerpc/kernel/mce_power.c +12 -8
@@ -40,7 +40,7 @@ static unsigned long addr_to_pfn(struct pt_regs *regs, unsigned long addr) {pte_t *ptep;unsigned int shift; -unsigned long flags; +unsigned long pfn, flags;struct mm_struct *mm;if (user_mode (regs))
@@ -50,18 +50,22 @@ static unsigned long addr_to_pfn(struct pt_regs *regs, unsigned long addr)local_irq_save (flags); ptep =__find_linux_pte (mm->pgd, addr,NULL , &shift); -local_irq_restore (flags); -if (!ptep ||pte_special (*ptep)) -return ULONG_MAX ; +if (!ptep ||pte_special (*ptep)) { + pfn =ULONG_MAX ; + goto out; + } -if (shift >PAGE_SHIFT ) { +if (shift <=PAGE_SHIFT ) + pfn =pte_pfn (*ptep); +else {unsigned long rpnmask = (1ul << shift) -PAGE_SIZE ; - -return pte_pfn (__pte (pte_val (*ptep) | (addr & rpnmask))); + pfn =pte_pfn (__pte (pte_val (*ptep) | (addr & rpnmask))); } -return pte_pfn (*ptep); +out: +local_irq_restore (flags); +return pfn; }/* flush SLBs and reload */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 571/639 bpf: fix BTF limits
In reply to Greg Kroah-HartmanFrom: Alexei Starovoitov <[email protected]>
[ Upstream commit a0791f0df7d212c245761538b17a9ea93607b667 ]
vmlinux BTF has more than 64k types.
Its string section is also at the offset larger than 64k.
Adjust both limits to make in-kernel BTF verifier successfully parse in-kernel BTF.
--- include/uapi/linux/btf.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/uapi/linux/btf.h +2 -2
@@ -22,9 +22,9 @@ struct btf_header { };/* Max # of type identifier */ -#define BTF_MAX_TYPE 0x0000ffff +#define BTF_MAX_TYPE 0x000fffff/* Max offset into the string section */ -#define BTF_MAX_NAME_OFFSET 0x0000ffff +#define BTF_MAX_NAME_OFFSET 0x00ffffff/* Max # of struct/union/enum members or func args */ #define BTF_MAX_VLEN 0xffff
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 572/639 crypto: hisilicon - Matching the dma address for dma_pool_free()
In reply to Greg Kroah-HartmanFrom: Yunfeng Ye <[email protected]>
[ Upstream commit e00371af1d4ce73d527d8ee69fda2febaf5a42c2 ]
When dma_pool_zalloc() fail in sec_alloc_and_fill_hw_sgl(), dma_pool_free() is invoked, but the parameters that sgl_current and sgl_current->next_sgl is not match.
Using sec_free_hw_sgl() instead of the original free routine.
--- drivers/crypto/hisilicon/sec/sec_algs.c | 44 +++++++++++-------------- 1 file changed, 19 insertions(+), 25 deletions(-)
drivers/crypto/hisilicon/sec/sec_algs.c +19 -25
@@ -153,6 +153,24 @@ static void sec_alg_skcipher_init_context(struct crypto_skcipher *atfm, ctx->cipher_alg); } +static void sec_free_hw_sgl (struct sec_hw_sgl *hw_sgl, +dma_addr_t psec_sgl,struct sec_dev_info *info) +{ +struct sec_hw_sgl *sgl_current, *sgl_next; +dma_addr_t sgl_next_dma; + + sgl_current = hw_sgl; +while (sgl_current) { + sgl_next = sgl_current->next; + sgl_next_dma = sgl_current->next_sgl; + +dma_pool_free (info->hw_sgl_pool, sgl_current, psec_sgl); + + sgl_current = sgl_next; + psec_sgl = sgl_next_dma; + } +} + static int sec_alloc_and_fill_hw_sgl(struct sec_hw_sgl **sec_sgl, dma_addr_t *psec_sgl, struct scatterlist *sgl,
@@ -199,36 +217,12 @@ static int sec_alloc_and_fill_hw_sgl(struct sec_hw_sgl **sec_sgl,return 0 ; err_free_hw_sgls: - sgl_current = *sec_sgl; -while (sgl_current) { - sgl_next = sgl_current->next; -dma_pool_free (info->hw_sgl_pool, sgl_current, - sgl_current->next_sgl); - sgl_current = sgl_next; - } +sec_free_hw_sgl (*sec_sgl, *psec_sgl, info); *psec_sgl =0 ;return ret; } -static void sec_free_hw_sgl (struct sec_hw_sgl *hw_sgl, -dma_addr_t psec_sgl,struct sec_dev_info *info) -{ -struct sec_hw_sgl *sgl_current, *sgl_next; -dma_addr_t sgl_next_dma; - - sgl_current = hw_sgl; -while (sgl_current) { - sgl_next = sgl_current->next; - sgl_next_dma = sgl_current->next_sgl; - -dma_pool_free (info->hw_sgl_pool, sgl_current, psec_sgl); - - sgl_current = sgl_next; - psec_sgl = sgl_next_dma; - } -} -static int sec_alg_skcipher_setkey (struct crypto_skcipher *tfm,const u8 *key,unsigned int keylen,enum sec_cipher_alg alg)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 573/639 iommu/amd: Wait for completion of IOTLB flush in attach_device
In reply to Greg Kroah-HartmanFrom: Filippo Sironi <[email protected]>
[ Upstream commit 0b15e02f0cc4fb34a9160de7ba6db3a4013dc1b7 ]
To make sure the domain tlb flush completes before the function returns, explicitly wait for its completion.
--- drivers/iommu/amd_iommu.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/iommu/amd_iommu.c +2 -0
@@ -2153,6 +2153,8 @@ skip_ats_check:*/ domain_flush_tlb_pde (domain); +domain_flush_complete (domain); +return ret; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 574/639 net: aquantia: Fix aq_vec_isr_legacy() return value
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 31aefe14bc9f56566041303d733fda511d3a1c3e ]
The irqreturn_t type is an enum or an unsigned int in GCC. That creates to problems because it can't detect if the self->aq_hw_ops->hw_irq_read() call fails and at the end the function always returns IRQ_HANDLED.
drivers/net/ethernet/aquantia/atlantic/aq_vec.c:316 aq_vec_isr_legacy() warn: unsigned 'err' is never less than zero. drivers/net/ethernet/aquantia/atlantic/aq_vec.c:329 aq_vec_isr_legacy() warn: always true condition '(err >= 0) => (0-u32max >= 0)'
--- drivers/net/ethernet/aquantia/atlantic/aq_vec.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_vec.c +6 -9
@@ -309,15 +309,13 @@ irqreturn_t aq_vec_isr_legacy(int irq, void *private) {struct aq_vec_s *self = private;u64 irq_mask =0U ; -irqreturn_t err =0 ; +int err; -if (!self) { - err = -EINVAL ; - goto err_exit; - } +if (!self) +return IRQ_NONE ; err = self->aq_hw_ops->hw_irq_read (self->aq_hw, &irq_mask);if (err <0 ) - goto err_exit; +return IRQ_NONE ;if (irq_mask) { self->aq_hw_ops->hw_irq_disable(self->aq_hw,
@@ -325,11 +323,10 @@ irqreturn_t aq_vec_isr_legacy(int irq, void *private)napi_schedule (&self->napi); }else { self->aq_hw_ops->hw_irq_enable (self->aq_hw,1U ); - err =IRQ_NONE ; +return IRQ_NONE ; } -err_exit: -return err >=0 ?IRQ_HANDLED :IRQ_NONE ; +return IRQ_HANDLED ; }cpumask_t *aq_vec_get_affinity_mask (struct aq_vec_s *self)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 575/639 cxgb4: Signedness bug in init_one()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 286183147666fb76c057836c57d86e9e6f508bca ]
The "chip" variable is an enum, and it's treated as unsigned int by GCC in this context so the error handling isn't triggered.
--- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +1 -1
@@ -5452,7 +5452,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) whoami =t4_read_reg (adapter,PL_WHOAMI_A );pci_read_config_word (pdev,PCI_DEVICE_ID , &device_id); chip =t4_get_chip_type (adapter,CHELSIO_PCI_ID_VER (device_id)); -if (chip <0 ) { +if ((int )chip <0 ) {dev_err (&pdev->dev,"Device %d is not supported\n" , device_id); err = chip; goto out_free_adapter;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 576/639 net: hisilicon: Fix signedness bug in hix5hd2_dev_probe()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 002dfe8085255b7bf1e0758c3d195c5412d35be9 ]
The "priv->phy_mode" variable is an enum and in this context GCC will treat it as unsigned to the error handling will never trigger.
--- drivers/net/ethernet/hisilicon/hix5hd2_gmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hix5hd2_gmac.c +1 -1
@@ -1201,7 +1201,7 @@ static int hix5hd2_dev_probe(struct platform_device *pdev) goto err_free_mdio; priv->phy_mode =of_get_phy_mode (node); -if (priv->phy_mode <0 ) { +if ((int )priv->phy_mode <0 ) {netdev_err (ndev,"not find phy-mode\n" ); ret = -EINVAL ; goto err_mdiobus;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 577/639 net: broadcom/bcmsysport: Fix signedness in bcm_sysport_probe()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 25a584955f020d6ec499c513923fb220f3112d2b ]
The "priv->phy_interface" variable is an enum and in this context GCC will treat it as unsigned so the error handling will never be triggered.
--- drivers/net/ethernet/broadcom/bcmsysport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bcmsysport.c +1 -1
@@ -2470,7 +2470,7 @@ static int bcm_sysport_probe(struct platform_device *pdev) priv->phy_interface =of_get_phy_mode (dn);/* Default to GMII interface mode */ -if (priv->phy_interface <0 ) +if ((int )priv->phy_interface <0 ) priv->phy_interface =PHY_INTERFACE_MODE_GMII ;/* In the case of a fixed PHY, the DT node associated
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 578/639 net: netsec: Fix signedness bug in netsec_probe()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit bd55f8ddbc437c225391ca8f487e7ec10243c4cc ]
The "priv->phy_interface" variable is an enum and in this context GCC will treat it as an unsigned int so the error handling is never triggered.
--- drivers/net/ethernet/socionext/netsec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/socionext/netsec.c +1 -1
@@ -1604,7 +1604,7 @@ static int netsec_probe(struct platform_device *pdev)NETIF_MSG_LINK |NETIF_MSG_PROBE ; priv->phy_interface =device_get_phy_mode (&pdev->dev); -if (priv->phy_interface <0 ) { +if ((int )priv->phy_interface <0 ) {dev_err (&pdev->dev,"missing required property 'phy-mode'\n" ); ret = -ENODEV ; goto free_ndev;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 579/639 net: socionext: Fix a signedness bug in ave_probe()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 7f9e88e6ef8c971f2c638b5ff7044c59b5d0f58d ]
The "phy_mode" variable is an enum and in this context GCC treats it as an unsigned int so the error handling is never triggered.
--- drivers/net/ethernet/socionext/sni_ave.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/socionext/sni_ave.c +1 -1
@@ -1575,7 +1575,7 @@ static int ave_probe(struct platform_device *pdev) np = dev->of_node; phy_mode =of_get_phy_mode (np); -if (phy_mode <0 ) { +if ((int )phy_mode <0 ) {dev_err (dev,"phy-mode not found\n" );return -EINVAL ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 580/639 net: stmmac: dwmac-meson8b: Fix signedness bug in probe
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit f10210517a2f37feea2edf85eb34c98977265c16 ]
The "dwmac->phy_mode" is an enum and in this context GCC treats it as an unsigned int so the error handling is never triggered.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +1 -1
@@ -355,7 +355,7 @@ static int meson8b_dwmac_probe(struct platform_device *pdev) dwmac->dev = &pdev->dev; dwmac->phy_mode =of_get_phy_mode (pdev->dev.of_node); -if (dwmac->phy_mode <0 ) { +if ((int )dwmac->phy_mode <0 ) {dev_err (&pdev->dev,"missing phy-mode property\n" ); ret = -EINVAL ; goto err_remove_config_dt;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 581/639 net: axienet: fix a signedness bug in probe
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 73e211e11be86715d66bd3c9d38b3c34b05fca9a ]
The "lp->phy_mode" is an enum but in this context GCC treats it as an unsigned int so the error handling is never triggered.
--- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +1 -1
@@ -1573,7 +1573,7 @@ static int axienet_probe(struct platform_device *pdev) } }else { lp->phy_mode =of_get_phy_mode (pdev->dev.of_node); -if (lp->phy_mode <0 ) { +if ((int )lp->phy_mode <0 ) { ret = -EINVAL ; goto free_netdev; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 582/639 of: mdio: Fix a signedness bug in of_phy_get_and_connect()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit d7eb651212fdbafa82d485d8e76095ac3b14c193 ]
The "iface" variable is an enum and in this context GCC treats it as an unsigned int so the error handling is never triggered.
--- drivers/of/of_mdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/of/of_mdio.c +1 -1
@@ -370,7 +370,7 @@ struct phy_device *of_phy_get_and_connect(struct net_device *dev,int ret; iface =of_get_phy_mode (np); -if (iface <0 ) +if ((int )iface <0 )return NULL ;if (of_phy_is_fixed_link (np)) { ret =of_phy_register_fixed_link (np);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 583/639 net: nixge: Fix a signedness bug in nixge_probe()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 1a4b62a0b8a3b81eca24366f63e214a7144b9f02 ]
The "priv->phy_mode" is an enum and in this context GCC will treat it as an unsigned int so it can never be less than zero.
--- drivers/net/ethernet/ni/nixge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/ni/nixge.c +1 -1
@@ -1233,7 +1233,7 @@ static int nixge_probe(struct platform_device *pdev) } priv->phy_mode =of_get_phy_mode (pdev->dev.of_node); -if (priv->phy_mode <0 ) { +if ((int )priv->phy_mode <0 ) {netdev_err (ndev,"not find \"phy-mode\" property\n" ); err = -EINVAL ; goto unregister_mdio;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 584/639 net: ethernet: stmmac: Fix signedness bug in ipq806x_gmac_of_parse()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 231042181dc9d6122c6faba64e99ccb25f13cc6c ]
The "gmac->phy_mode" variable is an enum and in this context GCC will treat it as an unsigned int so the error handling will never be triggered.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c +1 -1
@@ -191,7 +191,7 @@ static int ipq806x_gmac_of_parse(struct ipq806x_gmac *gmac)struct device *dev = &gmac->pdev->dev; gmac->phy_mode =of_get_phy_mode (dev->of_node); -if (gmac->phy_mode <0 ) { +if ((int )gmac->phy_mode <0 ) {dev_err (dev,"missing phy mode property\n" );return -EINVAL ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 585/639 net: sched: cbs: Avoid division by zero when calculating the port rate
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit 83c8c3cf45163f0c823db37be6ab04dfcf8ac751 ]
As explained in the "net: sched: taprio: Avoid division by zero on invalid link speed" commit, it is legal for the ethtool API to return zero as a link speed. So guard against it to ensure we don't perform a division by zero in kernel.
--- net/sched/sch_cbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/sch_cbs.c +1 -1
@@ -310,7 +310,7 @@ static void cbs_set_port_rate(struct net_device *dev, struct cbs_sched_data *q)if (err <0 ) goto skip; -if (ecmd.base.speed !=SPEED_UNKNOWN ) +if (ecmd.base.speed && ecmd.base.speed !=SPEED_UNKNOWN ) speed = ecmd.base.speed; skip:
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 586/639 nvme: retain split access workaround for capability reads
In reply to Greg Kroah-HartmanFrom: Ard Biesheuvel <[email protected]>
[ Upstream commit 3a8ecc935efabdad106b5e06d07b150c394b4465 ]
Commit 7fd8930f26be4
"nvme: add a common helper to read Identify Controller data"
has re-introduced an issue that we have attempted to work around in the past, in commit a310acd7a7ea ("NVMe: use split lo_hi_{read,write}q").
The problem is that some PCIe NVMe controllers do not implement 64-bit outbound accesses correctly, which is why the commit above switched to using lo_hi_[read|write]q for all 64-bit BAR accesses occuring in the code.
In the mean time, the NVMe subsystem has been refactored, and now calls into the PCIe support layer for NVMe via a .reg_read64() method, which fails to use lo_hi_readq(), and thus reintroduces the problem that the workaround above aimed to address.
Given that, at the moment, .reg_read64() is only used to read the capability register [which is known to tolerate split reads], let's switch .reg_read64() to lo_hi_readq() as well.
This fixes a boot issue on some ARM boxes with NVMe behind a Synopsys DesignWare PCIe host controller.
--- drivers/nvme/host/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/pci.c +1 -1
@@ -2396,7 +2396,7 @@ static int nvme_pci_reg_write32(struct nvme_ctrl *ctrl, u32 off, u32 val)static int nvme_pci_reg_read64 (struct nvme_ctrl *ctrl,u32 off,u64 *val) { - *val =readq (to_nvme_dev (ctrl)->bar + off); + *val =lo_hi_readq (to_nvme_dev (ctrl)->bar + off);return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 587/639 net: stmmac: gmac4+: Not all Unicast addresses may be available
In reply to Greg Kroah-HartmanFrom: Jose Abreu <[email protected]>
[ Upstream commit 25683bab09a70542b9f8e3e28f79b3369e56701f ]
Some setups may not have all Unicast addresses filters available. Check the number of available filters before trying to setup it.
--- drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +1 -1
@@ -443,7 +443,7 @@ static void dwmac4_set_filter(struct mac_device_info *hw, }/* Handle multiple unicast addresses */ -if (netdev_uc_count (dev) >GMAC_MAX_PERFECT_ADDRESSES ) { +if (netdev_uc_count (dev) > hw->unicast_filter_entries) {/* Switch to promiscuous mode if more than 128 addrs * are required */
Signature · 1 line
2.20.1
Re: [PATCH 4.19 587/639] net: stmmac: gmac4+: Not all Unicast addresses may be available
Hi!
Quoted 2 lines
Some setups may not have all Unicast addresses filters available. Check the number of available filters before trying to setup it.
...
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c static void dwmac4_set_filter(struct mac_device_info *hw, · line 449
Quoted 9 lines
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +1
-1@@ -443,7 +443,7 @@ static void dwmac4_set_filter(struct mac_device_info *hw, }/* Handle multiple unicast addresses */ -if (netdev_uc_count (dev) >GMAC_MAX_PERFECT_ADDRESSES ) { +if (netdev_uc_count (dev) > hw->unicast_filter_entries) {/* Switch to promiscuous mode if more than 128 addrs * are required */
Do I understand correctly that 128 in the comment is no longer accurate?
Best regards,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Greg Kroah-Hartman
maintainerPATCH 588/639 rxrpc: Fix trace-after-put looking at the put connection record
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit 4c1295dccc0afe0905b6ca4c62ade7f2406f2cfb ]
rxrpc_put_*conn() calls trace_rxrpc_conn() after they have done the decrement of the refcount - which looks at the debug_id in the connection record. But unless the refcount was reduced to zero, we no longer have the right to look in the record and, indeed, it may be deleted by some other thread.
Fix this by getting the debug_id out before decrementing the refcount and then passing that into the tracepoint.
--- include/trace/events/rxrpc.h | 6 +++--- net/rxrpc/call_accept.c | 2 +- net/rxrpc/conn_client.c | 6 ++++-- net/rxrpc/conn_object.c | 13 +++++++------ net/rxrpc/conn_service.c | 2 +- 5 files changed, 16 insertions(+), 13 deletions(-)
include/trace/events/rxrpc.h +3 -3
@@ -554,10 +554,10 @@ TRACE_EVENT(rxrpc_peer, ); TRACE_EVENT(rxrpc_conn, - TP_PROTO(struct rxrpc_connection *conn, enum rxrpc_conn_trace op, + TP_PROTO(unsigned int conn_debug_id, enum rxrpc_conn_trace op, int usage, const void *where), - TP_ARGS(conn, op, usage, where), + TP_ARGS(conn_debug_id, op, usage, where), TP_STRUCT__entry( __field(unsigned int, conn )
@@ -567,7 +567,7 @@ TRACE_EVENT(rxrpc_conn, ), TP_fast_assign( - __entry->conn = conn->debug_id; + __entry->conn = conn_debug_id; __entry->op = op; __entry->usage = usage; __entry->where = where;
net/rxrpc/call_accept.c +1 -1
@@ -88,7 +88,7 @@ static int rxrpc_service_prealloc_one(struct rxrpc_sock *rx,smp_store_release (&b->conn_backlog_head, (head +1 ) & (size -1 )); -trace_rxrpc_conn (conn, rxrpc_conn_new_service, +trace_rxrpc_conn (conn->debug_id, rxrpc_conn_new_service,atomic_read (&conn->usage), here); }
net/rxrpc/conn_client.c +4 -2
@@ -217,7 +217,8 @@ rxrpc_alloc_client_connection(struct rxrpc_conn_parameters *cp, gfp_t gfp)rxrpc_get_local (conn->params.local);key_get (conn->params.key); -trace_rxrpc_conn (conn, rxrpc_conn_new_client,atomic_read (&conn->usage), +trace_rxrpc_conn (conn->debug_id, rxrpc_conn_new_client, +atomic_read (&conn->usage),__builtin_return_address (0 ));trace_rxrpc_client (conn,-1 , rxrpc_client_alloc);_leave (" = %p" , conn);
@@ -989,11 +990,12 @@ rxrpc_put_one_client_conn(struct rxrpc_connection *conn)void rxrpc_put_client_conn (struct rxrpc_connection *conn) {const void *here =__builtin_return_address (0 ); +unsigned int debug_id = conn->debug_id;int n; do { n = atomic_dec_return(&conn->usage); - trace_rxrpc_conn(conn, rxrpc_conn_put_client, n, here); + trace_rxrpc_conn(debug_id, rxrpc_conn_put_client, n, here); if (n > 0) return; ASSERTCMP(n, >=, 0);
net/rxrpc/conn_object.c +7 -6
@@ -272,7 +272,7 @@ bool rxrpc_queue_conn(struct rxrpc_connection *conn)if (n ==0 )return false;if (rxrpc_queue_work (&conn->processor)) -trace_rxrpc_conn (conn, rxrpc_conn_queued, n +1 , here); +trace_rxrpc_conn (conn->debug_id, rxrpc_conn_queued, n +1 , here);else rxrpc_put_connection (conn);return true;
@@ -287,7 +287,7 @@ void rxrpc_see_connection(struct rxrpc_connection *conn)if (conn) {int n =atomic_read (&conn->usage); -trace_rxrpc_conn (conn, rxrpc_conn_seen, n, here); +trace_rxrpc_conn (conn->debug_id, rxrpc_conn_seen, n, here); } }
@@ -299,7 +299,7 @@ void rxrpc_get_connection(struct rxrpc_connection *conn)const void *here =__builtin_return_address (0 );int n =atomic_inc_return (&conn->usage); -trace_rxrpc_conn (conn, rxrpc_conn_got, n, here); +trace_rxrpc_conn (conn->debug_id, rxrpc_conn_got, n, here); }/*
@@ -313,7 +313,7 @@ rxrpc_get_connection_maybe(struct rxrpc_connection *conn)if (conn) {int n =atomic_fetch_add_unless (&conn->usage,1 ,0 );if (n >0 ) -trace_rxrpc_conn (conn, rxrpc_conn_got, n +1 , here); +trace_rxrpc_conn (conn->debug_id, rxrpc_conn_got, n +1 , here);else conn =NULL ; }
@@ -336,10 +336,11 @@ static void rxrpc_set_service_reap_timer(struct rxrpc_net *rxnet,void rxrpc_put_service_conn (struct rxrpc_connection *conn) {const void *here =__builtin_return_address (0 ); +unsigned int debug_id = conn->debug_id;int n; n =atomic_dec_return (&conn->usage); -trace_rxrpc_conn (conn, rxrpc_conn_put_service, n, here); +trace_rxrpc_conn (debug_id, rxrpc_conn_put_service, n, here); ASSERTCMP(n, >=, 0);if (n ==1 ) rxrpc_set_service_reap_timer(conn->params.local->rxnet,
@@ -423,7 +424,7 @@ void rxrpc_service_connection_reaper(struct work_struct *work)*/ if (atomic_cmpxchg (&conn->usage,1 ,0 ) !=1 )continue ; -trace_rxrpc_conn (conn, rxrpc_conn_reap_service,0 ,NULL ); +trace_rxrpc_conn (conn->debug_id, rxrpc_conn_reap_service,0 ,NULL );if (rxrpc_conn_is_client (conn))BUG ();
net/rxrpc/conn_service.c +1 -1
@@ -138,7 +138,7 @@ struct rxrpc_connection *rxrpc_prealloc_service_connection(struct rxrpc_net *rxnlist_add_tail (&conn->proc_link, &rxnet->conn_proc_list);write_unlock (&rxnet->conn_lock); -trace_rxrpc_conn (conn, rxrpc_conn_new_service, +trace_rxrpc_conn (conn->debug_id, rxrpc_conn_new_service,atomic_read (&conn->usage),__builtin_return_address (0 )); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 589/639 mac80211: accept deauth frames in IBSS mode
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit 95697f9907bfe3eab0ef20265a766b22e27dde64 ]
We can process deauth frames and all, but we drop them very early in the RX path today - this could never have worked.
--- net/mac80211/rx.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
net/mac80211/rx.c +10 -1
@@ -3391,9 +3391,18 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_data *rx)case cpu_to_le16 (IEEE80211_STYPE_PROBE_RESP ):/* process for all: mesh, mlme, ibss */ break ; +case cpu_to_le16 (IEEE80211_STYPE_DEAUTH ): +if (is_multicast_ether_addr (mgmt->da) && + !is_broadcast_ether_addr (mgmt->da)) +return RX_DROP_MONITOR ; + +/* process only for station/IBSS */ +if (sdata->vif.type !=NL80211_IFTYPE_STATION && + sdata->vif.type !=NL80211_IFTYPE_ADHOC ) +return RX_DROP_MONITOR ; +break ;case cpu_to_le16 (IEEE80211_STYPE_ASSOC_RESP ):case cpu_to_le16 (IEEE80211_STYPE_REASSOC_RESP ): -case cpu_to_le16 (IEEE80211_STYPE_DEAUTH ):case cpu_to_le16 (IEEE80211_STYPE_DISASSOC ):if (is_multicast_ether_addr (mgmt->da) && !is_broadcast_ether_addr (mgmt->da))
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 590/639 llc: fix another potential sk_buff leak in llc_ui_sendmsg()
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
[ Upstream commit fc8d5db10cbe1338a52ebc74e7feab9276721774 ]
All callers of llc_conn_state_process() except llc_build_and_send_pkt() (via llc_ui_sendmsg() -> llc_ui_send_data()) assume that it always consumes a reference to the skb. Fix this caller to do the same.
--- net/llc/af_llc.c | 34 ++++++++++++++++++++-------------- net/llc/llc_conn.c | 2 ++ net/llc/llc_if.c | 12 ++++++++---- 3 files changed, 30 insertions(+), 18 deletions(-)
net/llc/af_llc.c +20 -14
@@ -113,22 +113,26 @@ static inline u8 llc_ui_header_len(struct sock *sk, struct sockaddr_llc *addr)* * Send data via reliable llc2 connection. * Returns 0 upon success, non-zero if action did not succeed. +* +* This function always consumes a reference to the skb. */ static int llc_ui_send_data (struct sock * sk,struct sk_buff *skb,int noblock) {struct llc_sock * llc =llc_sk (sk); -int rc =0 ;if (unlikely (llc_data_accept_state (llc->state) || llc->remote_busy_flag || llc->p_flag)) {long timeout =sock_sndtimeo (sk, noblock); +int rc; rc =llc_ui_wait_for_busy_core (sk, timeout); +if (rc) { +kfree_skb (skb); +return rc; + } } -if (unlikely (!rc)) - rc =llc_build_and_send_pkt (sk, skb); -return rc; +return llc_build_and_send_pkt (sk, skb); }static void llc_ui_sk_init (struct socket *sock,struct sock *sk)
@@ -900,7 +904,7 @@ static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) DECLARE_SOCKADDR(struct sockaddr_llc *, addr, msg->msg_name);int flags = msg->msg_flags;int noblock = flags &MSG_DONTWAIT ; -struct sk_buff *skb; +struct sk_buff *skb =NULL ;size_t size =0 ;int rc = -EINVAL , copied =0 , hdrlen;
@@ -909,10 +913,10 @@ static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)lock_sock (sk);if (addr) {if (msg->msg_namelen <sizeof (*addr)) - goto release; + goto out; }else {if (llc_ui_addr_null (&llc->addr)) - goto release; + goto out; addr = &llc->addr; }/* must bind connection to sap if user hasn't done it. */
@@ -920,7 +924,7 @@ static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)/* bind to sap with null dev, exclusive. */ rc =llc_ui_autobind (sock, addr);if (rc) - goto release; + goto out; } hdrlen = llc->dev->hard_header_len +llc_ui_header_len (sk, addr); size = hdrlen + len;
@@ -929,12 +933,12 @@ static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) copied = size - hdrlen; rc = -EINVAL ;if (copied <0 ) - goto release; + goto out;release_sock (sk); skb =sock_alloc_send_skb (sk, size, noblock, &rc);lock_sock (sk);if (!skb) - goto release; + goto out; skb->dev = llc->dev; skb->protocol =llc_proto_type (addr->sllc_arphrd);skb_reserve (skb, hdrlen);
@@ -944,29 +948,31 @@ static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)if (sk->sk_type ==SOCK_DGRAM || addr->sllc_ua) {llc_build_and_send_ui_pkt (llc->sap, skb, addr->sllc_mac, addr->sllc_sap); + skb =NULL ; goto out; }if (addr->sllc_test) {llc_build_and_send_test_pkt (llc->sap, skb, addr->sllc_mac, addr->sllc_sap); + skb =NULL ; goto out; }if (addr->sllc_xid) {llc_build_and_send_xid_pkt (llc->sap, skb, addr->sllc_mac, addr->sllc_sap); + skb =NULL ; goto out; } rc = -ENOPROTOOPT ;if (!(sk->sk_type ==SOCK_STREAM && !addr->sllc_ua)) goto out; rc =llc_ui_send_data (sk, skb, noblock); + skb =NULL ; out: -if (rc) { -kfree_skb (skb); -release: +kfree_skb (skb); +if (rc)dprintk ("%s: failed sending from %02X to %02X: %d\n" , __func__, llc->laddr.lsap, llc->daddr.lsap, rc); - }release_sock (sk);return rc ? : copied; }
net/llc/llc_conn.c +2 -0
@@ -55,6 +55,8 @@ int sysctl_llc2_busy_timeout = LLC2_BUSY_TIME * HZ;* (executing it's actions and changing state), upper layer will be * indicated or confirmed, if needed. Returns 0 for success, 1 for * failure. The socket lock has to be held before calling this function. +* +* This function always consumes a reference to the skb. */ int llc_conn_state_process (struct sock *sk,struct sk_buff *skb) {
net/llc/llc_if.c +8 -4
@@ -38,6 +38,8 @@* closed and -EBUSY when sending data is not permitted in this state or * LLC has send an I pdu with p bit set to 1 and is waiting for it's * response. +* +* This function always consumes a reference to the skb. */ int llc_build_and_send_pkt (struct sock *sk,struct sk_buff *skb) {
@@ -46,20 +48,22 @@ int llc_build_and_send_pkt(struct sock *sk, struct sk_buff *skb)struct llc_sock *llc =llc_sk (sk);if (unlikely (llc->state ==LLC_CONN_STATE_ADM )) - goto out; + goto out_free; rc = -EBUSY ;if (unlikely (llc_data_accept_state (llc->state) ||/* data_conn_refuse */ llc->p_flag)) { llc->failed_data_req =1 ; - goto out; + goto out_free; } ev =llc_conn_ev (skb); ev->type =LLC_CONN_EV_TYPE_PRIM ; ev->prim =LLC_DATA_PRIM ; ev->prim_type =LLC_PRIM_TYPE_REQ ; skb->dev = llc->dev; - rc =llc_conn_state_process (sk, skb); -out: +return llc_conn_state_process (sk, skb); + +out_free: +kfree_skb (skb);return rc; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 591/639 llc: fix sk_buff refcounting in llc_conn_state_process()
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
[ Upstream commit 36453c852816f19947ca482a595dffdd2efa4965 ]
If llc_conn_state_process() sees that llc_conn_service() put the skb on a list, it will drop one fewer references to it. This is wrong because the current behavior is that llc_conn_service() never consumes a reference to the skb.
The code also makes the number of skb references being dropped conditional on which of ind_prim and cfm_prim are nonzero, yet neither of these affects how many references are *acquired*. So there is extra code that tries to fix this up by sometimes taking another reference.
Remove the unnecessary/broken refcounting logic and instead just add an skb_get() before the only two places where an extra reference is actually consumed.
--- net/llc/llc_conn.c | 33 ++++++--------------------------- 1 file changed, 6 insertions(+), 27 deletions(-)
net/llc/llc_conn.c +6 -27
@@ -64,12 +64,6 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb)struct llc_sock *llc =llc_sk (skb->sk);struct llc_conn_state_ev *ev =llc_conn_ev (skb); -/* -* We have to hold the skb, because llc_conn_service will kfree it in -* the sending path and we need to look at the skb->cb, where we encode -* llc_conn_state_ev. -*/ -skb_get (skb); ev->ind_prim = ev->cfm_prim =0 ;/* * Send event to state machine
@@ -77,21 +71,12 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb) rc =llc_conn_service (skb->sk, skb);if (unlikely (rc !=0 )) {printk (KERN_ERR "%s: llc_conn_service failed\n" , __func__); - goto out_kfree_skb; - } - -if (unlikely (!ev->ind_prim && !ev->cfm_prim)) { -/* indicate or confirm not required */ -if (!skb->next) - goto out_kfree_skb; goto out_skb_put; } -if (unlikely (ev->ind_prim && ev->cfm_prim))/* Paranoia */ -skb_get (skb); -switch (ev->ind_prim) {case LLC_DATA_PRIM : +skb_get (skb);llc_save_primitive (sk, skb,LLC_DATA_PRIM );if (unlikely (sock_queue_rcv_skb (sk, skb))) {/*
@@ -108,6 +93,7 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb)* skb->sk pointing to the newly created struct sock in * llc_conn_handler. -acme */ +skb_get (skb);skb_queue_tail (&sk->sk_receive_queue, skb); sk->sk_state_change (sk);break ;
@@ -123,7 +109,6 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb) sk->sk_state_change (sk); } } -kfree_skb (skb);sock_put (sk);break ;case LLC_RESET_PRIM :
@@ -132,14 +117,11 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb)* RESET is not being notified to upper layers for now */ printk (KERN_INFO "%s: received a reset ind!\n" , __func__); -kfree_skb (skb);break ;default : -if (ev->ind_prim) { +if (ev->ind_prim)printk (KERN_INFO "%s: received unknown %d prim!\n" , __func__, ev->ind_prim); -kfree_skb (skb); - }/* No indication */ break ; }
@@ -181,15 +163,12 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb)printk (KERN_INFO "%s: received a reset conf!\n" , __func__);break ;default : -if (ev->cfm_prim) { +if (ev->cfm_prim)printk (KERN_INFO "%s: received unknown %d prim!\n" , __func__, ev->cfm_prim); -break ; - } - goto out_skb_put;/* No confirmation */ +/* No confirmation */ +break ; } -out_kfree_skb: -kfree_skb (skb); out_skb_put:kfree_skb (skb);return rc;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 592/639 ip6erspan: remove the incorrect mtu limit for ip6erspan
In reply to Greg Kroah-HartmanFrom: Haishuang Yan <[email protected]>
[ Upstream commit 4123f637a5129470ff9d3cb00a5a4e213f2e15cc ]
ip6erspan driver calls ether_setup(), after commit 61e84623ace3 ("net: centralize net_device min/max MTU checking"), the range of mtu is [min_mtu, max_mtu], which is [68, 1500] by default.
It causes the dev mtu of the erspan device to not be greater than 1500, this limit value is not correct for ip6erspan tap device.
--- net/ipv6/ip6_gre.c | 1 + 1 file changed, 1 insertion(+)
net/ipv6/ip6_gre.c +1 -0
@@ -2218,6 +2218,7 @@ static void ip6erspan_tap_setup(struct net_device *dev) {ether_setup (dev); + dev->max_mtu =0 ; dev->netdev_ops = &ip6erspan_netdev_ops; dev->needs_free_netdev = true; dev->priv_destructor = ip6gre_dev_free;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 593/639 net: stmmac: fix length of PTP clocks name string
In reply to Greg Kroah-HartmanFrom: Antonio Borneo <[email protected]>
[ Upstream commit 5da202c88f8c355ad79bc2e8eb582e6d433060e7 ]
The field "name" in struct ptp_clock_info has a fixed size of 16 chars and is used as zero terminated string by clock_name_show() in drivers/ptp/ptp_sysfs.c
The current initialization value requires 17 chars to fit also the null termination, and this causes overflow to the next bytes in the struct when the string is read as null terminated:
hexdump -C /sys/class/ptp/ptp0/clock_name 00000000 73 74 6d 6d 61 63 5f 70 74 70 5f 63 6c 6f 63 6b |stmmac_ptp_clock| 00000010 a0 ac b9 03 0a |.....|
where the extra 4 bytes (excluding the newline) after the string represent the integer 0x03b9aca0 = 62500000 assigned to the field "max_adj" that follows "name" in the same struct.
There is no strict requirement for the "name" content and in the comment in ptp_clock_kernel.h it's reported it should just be 'A short "friendly name" to identify the clock'.
Replace it with "stmmac ptp".
--- drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c +1 -1
@@ -174,7 +174,7 @@ static int stmmac_enable(struct ptp_clock_info *ptp,/* structure describing a PTP hardware clock */ static struct ptp_clock_info stmmac_ptp_clock_ops = { .owner =THIS_MODULE , - .name ="stmmac_ptp_clock" , + .name ="stmmac ptp" , .max_adj =62500000 , .n_alarm =0 , .n_ext_ts =0 ,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 594/639 net: stmmac: fix disabling flexible PPS output
In reply to Greg Kroah-HartmanFrom: Antonio Borneo <[email protected]>
[ Upstream commit 520cf6002147281d1e7b522bb338416b623dcb93 ]
Accordingly to Synopsys documentation [1] and [2], when bit PPSEN0 in register MAC_PPS_CONTROL is set it selects the functionality command in the same register, otherwise selects the functionality control.
Command functionality is required to either enable (command 0x2) and disable (command 0x5) the flexible PPS output, but the bit PPSEN0 is currently set only for enabling.
Set the bit PPSEN0 to properly disable flexible PPS output.
Tested on STM32MP15x, based on dwmac 4.10a.
[1] DWC Ethernet QoS Databook 4.10a October 2014
[2] DWC Ethernet QoS Databook 5.00a September 2017
--- drivers/net/ethernet/stmicro/stmmac/dwmac5.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/stmicro/stmmac/dwmac5.c +1 -0
@@ -515,6 +515,7 @@ int dwmac5_flex_pps_config(void __iomem *ioaddr, int index,if (!enable) { val |=PPSCMDx (index,0x5 ); + val |=PPSEN0 ;writel (val, ioaddr +MAC_PPS_CONTROL );return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 595/639 sctp: add chunks to sk_backlog when the newsk sk_socket is not set
In reply to Greg Kroah-HartmanFrom: Xin Long <[email protected]>
[ Upstream commit 819be8108fded0b9e710bbbf81193e52f7bab2f7 ]
This patch is to fix a NULL-ptr deref in selinux_socket_connect_helper:
[...] kasan: GPF could be caused by NULL-ptr deref or user memory access [...] RIP: 0010:selinux_socket_connect_helper+0x94/0x460 [...] Call Trace:
[...] selinux_sctp_bind_connect+0x16a/0x1d0 [...] security_sctp_bind_connect+0x58/0x90 [...] sctp_process_asconf+0xa52/0xfd0 [sctp] [...] sctp_sf_do_asconf+0x785/0x980 [sctp] [...] sctp_do_sm+0x175/0x5a0 [sctp] [...] sctp_assoc_bh_rcv+0x285/0x5b0 [sctp] [...] sctp_backlog_rcv+0x482/0x910 [sctp] [...] __release_sock+0x11e/0x310 [...] release_sock+0x4f/0x180 [...] sctp_accept+0x3f9/0x5a0 [sctp] [...] inet_accept+0xe7/0x720
It was caused by that the 'newsk' sk_socket was not set before going to security sctp hook when processing asconf chunk with SCTP_PARAM_ADD_IP or SCTP_PARAM_SET_PRIMARY:
inet_accept()->
sctp_accept():
lock_sock():
lock listening 'sk'
do_softirq():
sctp_rcv(): <-- [1]
asconf chunk arrives and
enqueued in 'sk' backlog
sctp_sock_migrate():
set asoc's sk to 'newsk'
release_sock():
sctp_backlog_rcv():
lock 'newsk'
sctp_process_asconf() <-- [2]
unlock 'newsk'
sock_graft():
set sk_socket <-- [3]As it shows, at [1] the asconf chunk would be put into the listening 'sk' backlog, as accept() was holding its sock lock. Then at [2] asconf would get processed with 'newsk' as asoc's sk had been set to 'newsk'. However, 'newsk' sk_socket is not set until [3], while selinux_sctp_bind_connect() would deref it, then kernel crashed.
Here to fix it by adding the chunk to sk_backlog until newsk sk_socket is set when .accept() is done.
Note that sk->sk_socket can be NULL when the sock is closed, so SOCK_DEAD flag is also needed to check in sctp_newsk_ready().
Thanks to Ondrej for reviewing the code.
--- include/net/sctp/sctp.h | 5 +++++ net/sctp/input.c | 12 +++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-)
include/net/sctp/sctp.h +5 -0
@@ -625,4 +625,9 @@ static inline __u32 sctp_min_frag_point(struct sctp_sock *sp, __u16 datasize) return sctp_mtu_payload(sp, SCTP_DEFAULT_MINSEGMENT, datasize); } +static inline bool sctp_newsk_ready (const struct sock *sk) +{ +return sock_flag (sk,SOCK_DEAD ) || sk->sk_socket; +} +#endif /* __net_sctp_h__ */
net/sctp/input.c +9 -3
@@ -255,7 +255,7 @@ int sctp_rcv(struct sk_buff *skb)bh_lock_sock (sk); } -if (sock_owned_by_user (sk)) { +if (sock_owned_by_user (sk) || !sctp_newsk_ready (sk)) {if (sctp_add_backlog (sk, skb)) {bh_unlock_sock (sk);sctp_chunk_free (chunk);
@@ -333,7 +333,7 @@ int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb)local_bh_disable ();bh_lock_sock (sk); -if (sock_owned_by_user (sk)) { +if (sock_owned_by_user (sk) || !sctp_newsk_ready (sk)) {if (sk_add_backlog (sk, skb, sk->sk_rcvbuf))sctp_chunk_free (chunk);else
@@ -348,7 +348,13 @@ int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb)if (backloged)return 0 ; }else { -sctp_inq_push (inqueue, chunk); +if (!sctp_newsk_ready (sk)) { +if (!sk_add_backlog (sk, skb, sk->sk_rcvbuf)) +return 0 ; +sctp_chunk_free (chunk); + }else { +sctp_inq_push (inqueue, chunk); + } } done:
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 596/639 s390/qeth: Fix error handling during VNICC initialization
In reply to Greg Kroah-HartmanFrom: Alexandra Winter <[email protected]>
[ Upstream commit b528965bcc827dad32a8d21745feaacfc76c9703 ]
Smatch discovered the use of uninitialized variable sup_cmds in error paths.
--- drivers/s390/net/qeth_l2_main.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/s390/net/qeth_l2_main.c +7 -4
@@ -2330,10 +2330,10 @@ static bool qeth_l2_vnicc_recover_char(struct qeth_card *card, u32 vnicc,static void qeth_l2_vnicc_init (struct qeth_card *card) {u32 *timeout = &card->options.vnicc.learning_timeout; +bool enable, error = false;unsigned int chars_len, i;unsigned long chars_tmp;u32 sup_cmds, vnicc; -bool enable, error;QETH_CARD_TEXT (card,2 ,"vniccini" );/* reset rx_bcast */
@@ -2354,7 +2354,10 @@ static void qeth_l2_vnicc_init(struct qeth_card *card) chars_len =sizeof (card->options.vnicc.sup_chars) *BITS_PER_BYTE ;for_each_set_bit (i, &chars_tmp, chars_len) { vnicc =BIT (i); -qeth_l2_vnicc_query_cmds (card, vnicc, &sup_cmds); +if (qeth_l2_vnicc_query_cmds (card, vnicc, &sup_cmds)) { + sup_cmds =0 ; + error = true; + }if (!(sup_cmds &IPA_VNICC_SET_TIMEOUT ) || !(sup_cmds &IPA_VNICC_GET_TIMEOUT )) card->options.vnicc.getset_timeout_sup &= ~vnicc;
@@ -2363,8 +2366,8 @@ static void qeth_l2_vnicc_init(struct qeth_card *card) card->options.vnicc.set_char_sup &= ~vnicc; }/* enforce assumed default values and recover settings, if changed */ - error =qeth_l2_vnicc_recover_timeout (card,QETH_VNICC_LEARNING , - timeout); + error |=qeth_l2_vnicc_recover_timeout (card,QETH_VNICC_LEARNING , + timeout); chars_tmp = card->options.vnicc.wanted_chars ^QETH_VNICC_DEFAULT ; chars_len =sizeof (card->options.vnicc.wanted_chars) *BITS_PER_BYTE ;for_each_set_bit (i, &chars_tmp, chars_len) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 597/639 s390/qeth: Fix initialization of vnicc cmd masks during set online
In reply to Greg Kroah-HartmanFrom: Alexandra Winter <[email protected]>
[ Upstream commit be40a86c319706f90caca144343c64743c32b953 ]
Without this patch, a command bit in the supported commands mask is only ever set to unsupported during set online. If a command is ever marked as unsupported (e.g. because of error during qeth_l2_vnicc_query_cmds), subsequent successful initialization (offline/online) would not bring it back.
--- drivers/s390/net/qeth_l2_main.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/s390/net/qeth_l2_main.c +8 -4
@@ -2358,11 +2358,15 @@ static void qeth_l2_vnicc_init(struct qeth_card *card) sup_cmds =0 ; error = true; } -if (!(sup_cmds &IPA_VNICC_SET_TIMEOUT ) || - !(sup_cmds &IPA_VNICC_GET_TIMEOUT )) +if ((sup_cmds &IPA_VNICC_SET_TIMEOUT ) && + (sup_cmds &IPA_VNICC_GET_TIMEOUT )) + card->options.vnicc.getset_timeout_sup |= vnicc; +else card->options.vnicc.getset_timeout_sup &= ~vnicc; -if (!(sup_cmds &IPA_VNICC_ENABLE ) || - !(sup_cmds &IPA_VNICC_DISABLE )) +if ((sup_cmds &IPA_VNICC_ENABLE ) && + (sup_cmds &IPA_VNICC_DISABLE )) + card->options.vnicc.set_char_sup |= vnicc; +else card->options.vnicc.set_char_sup &= ~vnicc; }/* enforce assumed default values and recover settings, if changed */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 598/639 act_mirred: Fix mirred_init_module error handling
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit 11c9a7d38af524217efb7a176ad322b97ac2f163 ]
If tcf_register_action failed, mirred_device_notifier should be unregistered.
--- net/sched/act_mirred.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/sched/act_mirred.c +5 -1
@@ -445,7 +445,11 @@ static int __init mirred_init_module(void)return err;pr_info ("Mirror/redirect action on\n" ); -return tcf_register_action (&act_mirred_ops, &mirred_net_ops); + err =tcf_register_action (&act_mirred_ops, &mirred_net_ops); +if (err) +unregister_netdevice_notifier (&mirred_device_notifier); + +return err; } static void __exit mirred_cleanup_module(void)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 599/639 net: avoid possible false sharing in sk_leave_memory_pressure()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 503978aca46124cd714703e180b9c8292ba50ba7 ]
As mentioned in https://github.com/google/ktsan/wiki/READ_ONCE-and-WRITE_ONCE#it-may-improve-performance
a C compiler can legally transform :
if (memory_pressure && *memory_pressure)
*memory_pressure = 0;
to :
if (memory_pressure)
*memory_pressure = 0;
--- net/core/sock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/core/sock.c +2 -2
@@ -2179,8 +2179,8 @@ static void sk_leave_memory_pressure(struct sock *sk) }else {unsigned long *memory_pressure = sk->sk_prot->memory_pressure; -if (memory_pressure && *memory_pressure) - *memory_pressure =0 ; +if (memory_pressure &&READ_ONCE (*memory_pressure)) +WRITE_ONCE (*memory_pressure,0 ); } }
Signature · 1 line
2.20.1
Re: [PATCH 4.19 599/639] net: avoid possible false sharing in sk_leave_memory_pressure()
Quoted 7 lines · Greg Kroah-Hartman
From: Eric Dumazet <[email protected]>
[ Upstream commit
503978aca46124cd714703e180b9c8292ba50ba7]As mentioned in https://github.com/google/ktsan/wiki/READ_ONCE-and-WRITE_ONCE#it-may-improve-performance
a C compiler can legally transform :
Quoted 7 lines
if (
memory_pressure&&*memory_pressure)*memory_pressure = 0;to :
if (
memory_pressure)*memory_pressure = 0;
Well, C compiler can do a lot of stuff, and we rely on C compiler being "sane" -- that is gcc.
Even if compiler did the transformation, that will only result in slightly slower performance, right?
Is there any evidence this is problem in practice? Should this be in stable?
Best regards,
Pavel
Quoted 11 lines
+++
b/net/core/sock.cnet/core/sock.c +2
-2@@ -2179,8 +2179,8 @@ static void sk_leave_memory_pressure(struct sock *sk) }else {unsigned long *memory_pressure = sk->sk_prot->memory_pressure; -if (memory_pressure && *memory_pressure) - *memory_pressure =0 ; +if (memory_pressure &&READ_ONCE (*memory_pressure)) +WRITE_ONCE (*memory_pressure,0 ); } }
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: [PATCH 4.19 599/639] net: avoid possible false sharing in sk_leave_memory_pressure()
Quoted 17 lines · Pavel Machek
Quoted 7 lines · Greg Kroah-Hartman
From: Eric Dumazet <[email protected]>
[ Upstream commit
503978aca46124cd714703e180b9c8292ba50ba7]As mentioned in https://github.com/google/ktsan/wiki/READ_ONCE-and-WRITE_ONCE#it-may-improve-performance
a C compiler can legally transform :Quoted 7 lines
if (
memory_pressure&&*memory_pressure)*memory_pressure = 0;to :
if (
memory_pressure)*memory_pressure = 0;
Quoted 8 lines
Well, C compiler can do a lot of stuff, and we rely on C compiler being "sane" -- that is gcc.
Even if compiler did the transformation, that will only result in slightly slower performance, right?
Is there any evidence this is problem in practice? Should this be in stable?
There is evidence of this problem in practice yes.
Should it be in stable I do not know.
Should stable kernels only be compiled by old compilers, I do not know.
Greg Kroah-Hartman
maintainerPATCH 600/639 net: add {READ|WRITE}_ONCE() annotations on ->rskq_accept_head
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 60b173ca3d1cd1782bd0096dc17298ec242f6fb1 ]
reqsk_queue_empty() is called from inet_csk_listen_poll() while other cpus might write ->rskq_accept_head value.
Use {READ|WRITE}_ONCE() to avoid compiler tricks
and potential KCSAN splats.
--- drivers/xen/pvcalls-back.c | 2 +- include/net/request_sock.h | 4 ++-- net/ipv4/inet_connection_sock.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/xen/pvcalls-back.c +1 -1
@@ -784,7 +784,7 @@ static int pvcalls_back_poll(struct xenbus_device *dev, mappass->reqcopy = *req; icsk =inet_csk (mappass->sock->sk); queue = &icsk->icsk_accept_queue; - data = queue->rskq_accept_head !=NULL ; + data =READ_ONCE (queue->rskq_accept_head) !=NULL ;if (data) { mappass->reqcopy.cmd =0 ; ret =0 ;
include/net/request_sock.h +2 -2
@@ -183,7 +183,7 @@ void reqsk_fastopen_remove(struct sock *sk, struct request_sock *req,static inline bool reqsk_queue_empty (const struct request_sock_queue *queue) { -return queue->rskq_accept_head ==NULL ; +return READ_ONCE (queue->rskq_accept_head) ==NULL ; } static inline struct request_sock *reqsk_queue_remove(struct request_sock_queue *queue,
@@ -195,7 +195,7 @@ static inline struct request_sock *reqsk_queue_remove(struct request_sock_queue req = queue->rskq_accept_head;if (req) {sk_acceptq_removed (parent); - queue->rskq_accept_head = req->dl_next; +WRITE_ONCE (queue->rskq_accept_head, req->dl_next);if (queue->rskq_accept_head ==NULL ) queue->rskq_accept_tail =NULL ; }
net/ipv4/inet_connection_sock.c +1 -1
@@ -937,7 +937,7 @@ struct sock *inet_csk_reqsk_queue_add(struct sock *sk, req->sk = child; req->dl_next =NULL ;if (queue->rskq_accept_head ==NULL ) - queue->rskq_accept_head = req; +WRITE_ONCE (queue->rskq_accept_head, req);else queue->rskq_accept_tail->dl_next = req; queue->rskq_accept_tail = req;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 601/639 tcp: annotate lockless access to tcp_memory_pressure
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 1f142c17d19a5618d5a633195a46f2c8be9bf232 ]
tcp_memory_pressure is read without holding any lock, and its value could be changed on other cpus.
Use READ_ONCE() to annotate these lockless reads.
The write side is already using atomic ops.
--- include/net/tcp.h | 2 +- net/ipv4/tcp.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
include/net/tcp.h +1 -1
@@ -261,7 +261,7 @@ static inline bool tcp_under_memory_pressure(const struct sock *sk) mem_cgroup_under_socket_pressure(sk->sk_memcg))return true; -return tcp_memory_pressure; +return READ_ONCE (tcp_memory_pressure); }/* * The next routines deal with comparing 32 bit unsigned ints
net/ipv4/tcp.c +2 -2
@@ -325,7 +325,7 @@ void tcp_enter_memory_pressure(struct sock *sk) {unsigned long val; -if (tcp_memory_pressure) +if (READ_ONCE (tcp_memory_pressure))return ; val = jiffies;
@@ -340,7 +340,7 @@ void tcp_leave_memory_pressure(struct sock *sk) {unsigned long val; -if (!tcp_memory_pressure) +if (!READ_ONCE (tcp_memory_pressure))return ; val =xchg (&tcp_memory_pressure,0 );if (val)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 602/639 net/smc: receive returns without data
In reply to Greg Kroah-HartmanFrom: Karsten Graul <[email protected]>
[ Upstream commit 882dcfe5a1785c20f45820cbe6fec4b8b647c946 ]
smc_cdc_rxed_any_close_or_senddone() is used as an end condition for the receive loop. This conflicts with smc_cdc_msg_recv_action() which could run in parallel and set the bits checked by smc_cdc_rxed_any_close_or_senddone() before the receive is processed. In that case we could return from receive with no data, although data is available. The same applies to smc_rx_wait().
Fix this by checking for RCV_SHUTDOWN only, which is set in smc_cdc_msg_recv_action() after the receive was actually processed.
--- net/smc/smc_rx.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
net/smc/smc_rx.c +1 -3
@@ -212,8 +212,7 @@ int smc_rx_wait(struct smc_sock *smc, long *timeo, rc =sk_wait_event (sk, timeo, sk->sk_err || sk->sk_shutdown &RCV_SHUTDOWN || -fcrit (conn) || -smc_cdc_rxed_any_close_or_senddone (conn), +fcrit (conn), &wait);remove_wait_queue (sk_sleep (sk), &wait);sk_clear_bit (SOCKWQ_ASYNC_WAITDATA , sk);
@@ -311,7 +310,6 @@ int smc_rx_recvmsg(struct smc_sock *smc, struct msghdr *msg,smc_rx_update_cons (smc,0 );if (sk->sk_shutdown &RCV_SHUTDOWN || -smc_cdc_rxed_any_close_or_senddone (conn) || conn->local_tx_ctrl.conn_state_flags.peer_conn_abort)break ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 603/639 net/smc: receive pending data after RCV_SHUTDOWN
In reply to Greg Kroah-HartmanFrom: Karsten Graul <[email protected]>
[ Upstream commit 107529e31a87acd475ff6a0f82745821b8f70fec ]
smc_rx_recvmsg() first checks if data is available, and then if RCV_SHUTDOWN is set. There is a race when smc_cdc_msg_recv_action() runs in between these 2 checks, receives data and sets RCV_SHUTDOWN. In that case smc_rx_recvmsg() would return from receive without to process the available data.
Fix that with a final check for data available if RCV_SHUTDOWN is set. Move the check for data into a function and call it twice. And use the existing helper smc_rx_data_available().
--- net/smc/smc_rx.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)
net/smc/smc_rx.c +20 -5
@@ -262,6 +262,18 @@ static int smc_rx_recv_urg(struct smc_sock *smc, struct msghdr *msg, int len,return -EAGAIN ; } +static bool smc_rx_recvmsg_data_available (struct smc_sock *smc) +{ +struct smc_connection *conn = &smc->conn; + +if (smc_rx_data_available (conn)) +return true; +else if (conn->urg_state ==SMC_URG_VALID ) +/* we received a single urgent Byte - skip */ +smc_rx_update_cons (smc,0 ); +return false; +} +/* smc_rx_recvmsg - receive data from RMBE * @msg: copy data to receive buffer * @pipe: copy data to pipe if set - indicates splice() call
@@ -303,15 +315,18 @@ int smc_rx_recvmsg(struct smc_sock *smc, struct msghdr *msg,if (read_done >= target || (pipe && read_done))break ; -if (atomic_read (&conn->bytes_to_rcv)) +if (smc_rx_recvmsg_data_available (smc)) goto copy; -else if (conn->urg_state ==SMC_URG_VALID ) -/* we received a single urgent Byte - skip */ -smc_rx_update_cons (smc,0 );if (sk->sk_shutdown &RCV_SHUTDOWN || - conn->local_tx_ctrl.conn_state_flags.peer_conn_abort) + conn->local_tx_ctrl.conn_state_flags.peer_conn_abort) { +/* smc_cdc_msg_recv_action() could have run after +* above smc_rx_recvmsg_data_available() +*/ +if (smc_rx_recvmsg_data_available (smc)) + goto copy;break ; + }if (read_done) { if (sk->sk_err ||
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 604/639 drm/msm/dsi: Implement reset correctly
In reply to Greg Kroah-HartmanFrom: Jeffrey Hugo <[email protected]>
[ Upstream commit 78e31c42261779a01bc73472d0f65f15378e9de3 ]
On msm8998, vblank timeouts are observed because the DSI controller is not reset properly, which ends up stalling the MDP. This is because the reset logic is not correct per the hardware documentation.
The documentation states that after asserting reset, software should wait some time (no indication of how long), or poll the status register until it returns 0 before deasserting reset.
wmb() is insufficient for this purpose since it just ensures ordering, not timing between writes. Since asserting and deasserting reset occurs on the same register, ordering is already guaranteed by the architecture, making the wmb extraneous.
Since we would define a timeout for polling the status register to avoid a possible infinite loop, lets just use a static delay of 20 ms, since 16.666 ms is the time available to process one frame at 60 fps.
--- drivers/gpu/drm/msm/dsi/dsi_host.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +4 -2
@@ -34,6 +34,8 @@#include "dsi_cfg.h" #include "msm_kms.h" +#define DSI_RESET_TOGGLE_DELAY_MS 20 +static int dsi_get_version (const void __iomem *base,u32 *major,u32 *minor) {u32 ver;
@@ -994,7 +996,7 @@ static void dsi_sw_reset(struct msm_dsi_host *msm_host)wmb ();/* clocks need to be enabled before reset */ dsi_write (msm_host,REG_DSI_RESET ,1 ); -wmb ();/* make sure reset happen */ +msleep (DSI_RESET_TOGGLE_DELAY_MS );/* make sure reset happen */ dsi_write (msm_host,REG_DSI_RESET ,0 ); }
@@ -1402,7 +1404,7 @@ static void dsi_sw_reset_restore(struct msm_dsi_host *msm_host)/* dsi controller can only be reset while clocks are running */ dsi_write (msm_host,REG_DSI_RESET ,1 ); -wmb ();/* make sure reset happen */ +msleep (DSI_RESET_TOGGLE_DELAY_MS );/* make sure reset happen */ dsi_write (msm_host,REG_DSI_RESET ,0 );wmb ();/* controller out of reset */ dsi_write (msm_host,REG_DSI_CTRL , data0);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 605/639 vhost/test: stop device before reset
In reply to Greg Kroah-HartmanFrom: Michael S. Tsirkin <[email protected]>
[ Upstream commit 245cdd9fbd396483d501db83047116e2530f245f ]
When device stop was moved out of reset, test device wasn't updated to stop before reset, this resulted in a use after free. Fix by invoking stop appropriately.
--- drivers/vhost/test.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/vhost/test.c +2 -0
@@ -162,6 +162,7 @@ static int vhost_test_release(struct inode *inode, struct file *f)vhost_test_stop (n, &private);vhost_test_flush (n); +vhost_dev_stop (&n->dev);vhost_dev_cleanup (&n->dev);/* We do an extra flush before freeing memory, * since jobs can re-queue themselves. */
@@ -238,6 +239,7 @@ static long vhost_test_reset_owner(struct vhost_test *n) }vhost_test_stop (n, &priv);vhost_test_flush (n); +vhost_dev_stop (&n->dev);vhost_dev_reset_owner (&n->dev, umem); done:mutex_unlock (&n->dev.mutex);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 606/639 dmaengine: imx-sdma: fix size check for sdma script_number
In reply to Greg Kroah-HartmanFrom: Robin Gong <[email protected]>
[ Upstream commit bd73dfabdda280fc5f05bdec79b6721b4b2f035f ]
Illegal memory will be touch if SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V3
(41) exceed the size of structure sdma_script_start_addrs(40), thus cause memory corrupt such as slob block header so that kernel trap into while() loop forever in slob_free(). Please refer to below code piece in imx-sdma.c:
for (i = 0; i < sdma->script_number; i++)
if (addr_arr[i] > 0) saddr_arr[i] = addr_arr[i]; /* memory corrupt here */
That issue was brought by commit a572460be9cf ("dmaengine: imx-sdma: Add support for version 3 firmware") because SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V3 (38->41 3 scripts added) not align with script number added in sdma_script_start_addrs(2 scripts).
--- drivers/dma/imx-sdma.c | 8 ++++++++ include/linux/platform_data/dma-imx-sdma.h | 3 +++ 2 files changed, 11 insertions(+)
drivers/dma/imx-sdma.c +8 -0
@@ -1662,6 +1662,14 @@ static void sdma_add_scripts(struct sdma_engine *sdma,if (!sdma->script_number) sdma->script_number =SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V1 ; +if (sdma->script_number >sizeof (struct sdma_script_start_addrs ) + /sizeof (s32)) { +dev_err (sdma->dev, +"SDMA script number %d not match with firmware.\n" , + sdma->script_number); +return ; + } +for (i =0 ; i < sdma->script_number; i++)if (addr_arr[i] >0 ) saddr_arr[i] = addr_arr[i];
include/linux/platform_data/dma-imx-sdma.h +3 -0
@@ -51,7 +51,10 @@ struct sdma_script_start_addrs {/* End of v2 array */ s32 zcanfd_2_mcu_addr;s32 zqspi_2_mcu_addr; +s32 mcu_2_ecspi_addr;/* End of v3 array */ +s32 mcu_2_zqspi_addr; +/* End of v4 array */ };/**
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 607/639 firmware: dmi: Fix unlikely out-of-bounds read in save_mem_devices
In reply to Greg Kroah-HartmanFrom: Jean Delvare <[email protected]>
[ Upstream commit 81dde26de9c08bb04c4962a15608778aaffb3cf9 ]
Before reading the Extended Size field, we should ensure it fits in the DMI record. There is already a record length check but it does not cover that field.
It would take a seriously corrupted DMI table to hit that bug, so no need to worry, but we should still fix it.
--- drivers/firmware/dmi_scan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/dmi_scan.c +1 -1
@@ -407,7 +407,7 @@ static void __init save_mem_devices(const struct dmi_header *dm, void *v) bytes = ~0ull ; else if (size & 0x8000) bytes = (u64)(size &0x7fff ) <<10 ; - else if (size != 0x7fff) + else if (size != 0x7fff || dm->length < 0x20) bytes = (u64 )size <<20 ; else bytes = (u64 )get_unaligned ((u32 *)&d[0x1C ]) <<20 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 608/639 arm64: hibernate: check pgd table allocation
In reply to Greg Kroah-HartmanFrom: Pavel Tatashin <[email protected]>
[ Upstream commit 8c551f919a73c1dfa690a70a691be1da394145e8 ]
There is a bug in create_safe_exec_page(), when page table is allocated it is not checked that table is allocated successfully:
But it is dereferenced in: pgd_none(READ_ONCE(*pgdp)). Check that allocation was successful.
--- arch/arm64/kernel/hibernate.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
arch/arm64/kernel/hibernate.c +8 -1
@@ -202,6 +202,7 @@ static int create_safe_exec_page(void *src_start, size_t length, gfp_t mask) {int rc =0 ; +pgd_t *trans_pgd;pgd_t *pgdp;pud_t *pudp;pmd_t *pmdp;
@@ -216,7 +217,13 @@ static int create_safe_exec_page(void *src_start, size_t length,memcpy ((void *)dst, src_start, length);__flush_icache_range (dst, dst + length); - pgdp =pgd_offset_raw (allocator (mask), dst_addr); + trans_pgd =allocator (mask); +if (!trans_pgd) { + rc = -ENOMEM ; + goto out; + } + + pgdp =pgd_offset_raw (trans_pgd, dst_addr);if (pgd_none (READ_ONCE (*pgdp))) { pudp =allocator (mask);if (!pudp) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 609/639 net: netem: fix error path for corrupted GSO frames
In reply to Greg Kroah-HartmanFrom: Jakub Kicinski <[email protected]>
[ Upstream commit a7fa12d15855904aff1716e1fc723c03ba38c5cc ]
To corrupt a GSO frame we first perform segmentation. We then proceed using the first segment instead of the full GSO skb and requeue the rest of the segments as separate packets.
If there are any issues with processing the first segment we still want to process the rest, therefore we jump to the finish_segs label.
Commit 177b8007463c ("net: netem: fix backlog accounting for corrupted GSO frames") started using the pointer to the first segment in the "rest of segments processing", but as mentioned above the first segment may had already been freed at this point.
Backlog corrections for parent qdiscs have to be adjusted.
--- net/sched/sch_netem.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
net/sched/sch_netem.c +6 -3
@@ -509,6 +509,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch,if (skb->ip_summed ==CHECKSUM_PARTIAL &&skb_checksum_help (skb)) {qdisc_drop (skb, sch, to_free); + skb =NULL ; goto finish_segs; }
@@ -584,9 +585,10 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch, finish_segs:if (segs) {unsigned int len, last_len; -int nb =0 ; +int nb; - len = skb->len; + len = skb ? skb->len :0 ; + nb = skb ?1 :0 ;while (segs) { skb2 = segs->next;
@@ -603,7 +605,8 @@ finish_segs: } segs = skb2; } -qdisc_tree_reduce_backlog (sch, -nb, prev_len - len); +/* Parent qdiscs accounted for 1 skb of size @prev_len */ +qdisc_tree_reduce_backlog (sch, -(nb -1 ), -(len - prev_len)); }return NET_XMIT_SUCCESS ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 610/639 net: netem: correct the parents backlog when corrupted packet was dropped
In reply to Greg Kroah-HartmanFrom: Jakub Kicinski <[email protected]>
[ Upstream commit e0ad032e144731a5928f2d75e91c2064ba1a764c ]
If packet corruption failed we jump to finish_segs and return NET_XMIT_SUCCESS. Seeing success will make the parent qdisc increment its backlog, that's incorrect - we need to return NET_XMIT_DROP.
--- net/sched/sch_netem.c | 2 ++ 1 file changed, 2 insertions(+)
net/sched/sch_netem.c +2 -0
@@ -607,6 +607,8 @@ finish_segs: }/* Parent qdiscs accounted for 1 skb of size @prev_len */ qdisc_tree_reduce_backlog (sch, -(nb -1 ), -(len - prev_len)); + }else if (!skb) { +return NET_XMIT_DROP ; }return NET_XMIT_SUCCESS ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 611/639 xsk: Fix registration of Rx-only sockets
In reply to Greg Kroah-HartmanFrom: Magnus Karlsson <[email protected]>
[ Upstream commit 2afd23f78f39da84937006ecd24aa664a4ab052b ]
Having Rx-only AF_XDP sockets can potentially lead to a crash in the system by a NULL pointer dereference in xsk_umem_consume_tx(). This function iterates through a list of all sockets tied to a umem and checks if there are any packets to send on the Tx ring. Rx-only sockets do not have a Tx ring, so this will cause a NULL pointer dereference. This will happen if you have registered one or more Rx-only sockets to a umem and the driver is checking the Tx ring even on Rx, or if the XDP_SHARED_UMEM mode is used and there is a mix of Rx-only and other sockets tied to the same umem.
Fixed by only putting sockets with a Tx component on the list that xsk_umem_consume_tx() iterates over.
--- net/xdp/xdp_umem.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/xdp/xdp_umem.c +6 -0
@@ -23,6 +23,9 @@ void xdp_add_sk_umem(struct xdp_umem *umem, struct xdp_sock *xs) {unsigned long flags; +if (!xs->tx) +return ; +spin_lock_irqsave (&umem->xsk_list_lock, flags);list_add_rcu (&xs->list, &umem->xsk_list);spin_unlock_irqrestore (&umem->xsk_list_lock, flags);
@@ -32,6 +35,9 @@ void xdp_del_sk_umem(struct xdp_umem *umem, struct xdp_sock *xs) {unsigned long flags; +if (!xs->tx) +return ; +spin_lock_irqsave (&umem->xsk_list_lock, flags);list_del_rcu (&xs->list);spin_unlock_irqrestore (&umem->xsk_list_lock, flags);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 612/639 bpf, offload: Unlock on error in bpf_offload_dev_create()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit d0fbb51dfaa612f960519b798387be436e8f83c5 ]
We need to drop the bpf_devs_lock on error before returning.
--- kernel/bpf/offload.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/bpf/offload.c +3 -1
@@ -645,8 +645,10 @@ struct bpf_offload_dev *bpf_offload_dev_create(void)down_write (&bpf_devs_lock);if (!offdevs_inited) { err =rhashtable_init (&offdevs, &offdevs_params); -if (err) +if (err) { +up_write (&bpf_devs_lock);return ERR_PTR (err); + } offdevs_inited = true; }up_write (&bpf_devs_lock);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 613/639 afs: Fix missing timeout reset
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit c74386d50fbaf4a54fd3fe560f1abc709c0cff4b ]
In afs_wait_for_call_to_complete(), rather than immediately aborting an operation if a signal occurs, the code attempts to wait for it to complete, using a schedule timeout of 2*RTT (or min 2 jiffies) and a check that we're still receiving relevant packets from the server before we consider aborting the call. We may even ping the server to check on the status of the call.
However, there's a missing timeout reset in the event that we do actually get a packet to process, such that if we then get a couple of short stalls, we then time out when progress is actually being made.
Fix this by resetting the timeout any time we get something to process. If it's the failure of the call then the call state will get changed and we'll exit the loop shortly thereafter.
A symptom of this is data fetches and stores failing with EINTR when they really shouldn't.
--- fs/afs/rxrpc.c | 1 + 1 file changed, 1 insertion(+)
fs/afs/rxrpc.c +1 -0
@@ -573,6 +573,7 @@ static long afs_wait_for_call_to_complete(struct afs_call *call, call->need_attention = false;__set_current_state (TASK_RUNNING );afs_deliver_to_call (call); + timeout = rtt2;continue ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 614/639 net: qca_spi: Move reset_count to struct qcaspi
In reply to Greg Kroah-HartmanFrom: Stefan Wahren <[email protected]>
[ Upstream commit bc19c32904e36548335b35fdce6ce734e20afc0a ]
The reset counter is specific for every QCA700x chip. So move this into the private driver struct. Otherwise we get unpredictable reset behavior in setups with multiple QCA700x chips.
--- drivers/net/ethernet/qualcomm/qca_spi.c | 9 ++++----- drivers/net/ethernet/qualcomm/qca_spi.h | 1 + 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/ethernet/qualcomm/qca_spi.c +4 -5
@@ -475,7 +475,6 @@ qcaspi_qca7k_sync(struct qcaspi *qca, int event)u16 signature =0 ;u16 spi_config;u16 wrbuf_space =0 ; -static u16 reset_count;if (event ==QCASPI_EVENT_CPUON ) {/* Read signature twice, if not valid
@@ -528,13 +527,13 @@ qcaspi_qca7k_sync(struct qcaspi *qca, int event) qca->sync =QCASPI_SYNC_RESET ; qca->stats.trig_reset++; - reset_count =0 ; + qca->reset_count =0 ;break ;case QCASPI_SYNC_RESET : - reset_count++; + qca->reset_count++;netdev_dbg (qca->net_dev,"sync: waiting for CPU on, count %u.\n" , - reset_count); -if (reset_count >=QCASPI_RESET_TIMEOUT ) { + qca->reset_count); +if (qca->reset_count >=QCASPI_RESET_TIMEOUT ) {/* reset did not seem to take place, try again */ qca->sync =QCASPI_SYNC_UNKNOWN ; qca->stats.reset_timeout++;
drivers/net/ethernet/qualcomm/qca_spi.h +1 -0
@@ -92,6 +92,7 @@ struct qcaspi {unsigned int intr_req;unsigned int intr_svc; +u16 reset_count;#ifdef CONFIG_DEBUG_FS struct dentry *device_root;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 615/639 hv_netvsc: Fix offset usage in netvsc_send_table()
In reply to Greg Kroah-HartmanFrom: Haiyang Zhang <[email protected]>
[ Upstream commit 71f21959dd5516031db4f011e15e9a9508b93a7d ]
To reach the data region, the existing code adds offset in struct nvsp_5_send_indirect_table on the beginning of this struct. But the offset should be based on the beginning of its container, struct nvsp_message. This bug causes the first table entry missing, and adds an extra zero from the zero pad after the data region. This can put extra burden on the channel 0.
So, correct the offset usage. Also add a boundary check to ensure not reading beyond data region.
--- drivers/net/hyperv/hyperv_net.h | 3 ++- drivers/net/hyperv/netvsc.c | 26 ++++++++++++++++++-------- 2 files changed, 20 insertions(+), 9 deletions(-)
drivers/net/hyperv/hyperv_net.h +2 -1
@@ -616,7 +616,8 @@ struct nvsp_5_send_indirect_table {/* The number of entries in the send indirection table */ u32 count; -/* The offset of the send indirection table from top of this struct. +/* The offset of the send indirection table from the beginning of +* struct nvsp_message. * The send indirection table tells which channel to put the send * traffic on. Each entry is a channel number. */
drivers/net/hyperv/netvsc.c +18 -8
@@ -1182,20 +1182,28 @@ static int netvsc_receive(struct net_device *ndev, }static void netvsc_send_table (struct net_device *ndev, -const struct nvsp_message *nvmsg) +const struct nvsp_message *nvmsg, +u32 msglen) {struct net_device_context *net_device_ctx =netdev_priv (ndev); -u32 count, *tab; +u32 count, offset, *tab;int i; count = nvmsg->msg.v5_msg.send_table.count; + offset = nvmsg->msg.v5_msg.send_table.offset; +if (count !=VRSS_SEND_TAB_SIZE ) {netdev_err (ndev,"Received wrong send-table size:%u\n" , count);return ; } - tab = (u32 *)((unsigned long )&nvmsg->msg.v5_msg.send_table + - nvmsg->msg.v5_msg.send_table.offset); +if (offset > msglen - count *sizeof (u32)) { +netdev_err (ndev,"Received send-table offset too big:%u\n" , + offset); +return ; + } + + tab = (void *)nvmsg + offset;for (i =0 ; i < count; i++) net_device_ctx->tx_table[i] = tab[i];
@@ -1213,12 +1221,13 @@ static void netvsc_send_vf(struct net_device *ndev, net_device_ctx->vf_alloc ? "added" : "removed"); } -static void netvsc_receive_inband (struct net_device *ndev, -const struct nvsp_message *nvmsg) +static void netvsc_receive_inband (struct net_device *ndev, +const struct nvsp_message *nvmsg, +u32 msglen) {switch (nvmsg->hdr.msg_type) {case NVSP_MSG5_TYPE_SEND_INDIRECTION_TABLE : -netvsc_send_table (ndev, nvmsg); +netvsc_send_table (ndev, nvmsg, msglen);break ;case NVSP_MSG4_TYPE_SEND_VF_ASSOCIATION :
@@ -1235,6 +1244,7 @@ static int netvsc_process_raw_pkt(struct hv_device *device, int budget) {const struct nvsp_message *nvmsg =hv_pkt_data (desc); +u32 msglen =hv_pkt_datalen (desc);trace_nvsp_recv (ndev, channel, nvmsg);
@@ -1250,7 +1260,7 @@ static int netvsc_process_raw_pkt(struct hv_device *device,break ;case VM_PKT_DATA_INBAND : -netvsc_receive_inband (ndev, nvmsg); +netvsc_receive_inband (ndev, nvmsg, msglen);break ;default :
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 616/639 hv_netvsc: Fix send_table offset in case of a host bug
In reply to Greg Kroah-HartmanFrom: Haiyang Zhang <[email protected]>
[ Upstream commit 171c1fd98df3d5948d9a9eb755274850fa5e59c6 ]
If negotiated NVSP version <= NVSP_PROTOCOL_VERSION_6, the offset may be wrong (too small) due to a host bug. This can cause missing the end of the send indirection table, and add multiple zero entries from leading zeros before the data region. This bug adds extra burden on channel 0.
So fix the offset by computing it from the data structure sizes. This will ensure netvsc driver runs normally on unfixed hosts, and future fixed hosts.
--- drivers/net/hyperv/netvsc.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/net/hyperv/netvsc.c +14 -2
@@ -1182,6 +1182,7 @@ static int netvsc_receive(struct net_device *ndev, }static void netvsc_send_table (struct net_device *ndev, +struct netvsc_device *nvscdev,const struct nvsp_message *nvmsg,u32 msglen) {
@@ -1197,6 +1198,16 @@ static void netvsc_send_table(struct net_device *ndev,return ; } +/* If negotiated version <= NVSP_PROTOCOL_VERSION_6, the offset may be +* wrong due to a host bug. So fix the offset here. +*/ +if (nvscdev->nvsp_version <=NVSP_PROTOCOL_VERSION_6 && + msglen >=sizeof (struct nvsp_message_header ) + +sizeof (union nvsp_6_message_uber ) + count *sizeof (u32)) + offset =sizeof (struct nvsp_message_header ) + +sizeof (union nvsp_6_message_uber ); + +/* Boundary check for all versions */ if (offset > msglen - count *sizeof (u32)) {netdev_err (ndev,"Received send-table offset too big:%u\n" , offset);
@@ -1222,12 +1233,13 @@ static void netvsc_send_vf(struct net_device *ndev, }static void netvsc_receive_inband (struct net_device *ndev, +struct netvsc_device *nvscdev,const struct nvsp_message *nvmsg,u32 msglen) {switch (nvmsg->hdr.msg_type) {case NVSP_MSG5_TYPE_SEND_INDIRECTION_TABLE : -netvsc_send_table (ndev, nvmsg, msglen); +netvsc_send_table (ndev, nvscdev, nvmsg, msglen);break ;case NVSP_MSG4_TYPE_SEND_VF_ASSOCIATION :
@@ -1260,7 +1272,7 @@ static int netvsc_process_raw_pkt(struct hv_device *device,break ;case VM_PKT_DATA_INBAND : -netvsc_receive_inband (ndev, nvmsg, msglen); +netvsc_receive_inband (ndev, net_device, nvmsg, msglen);break ;default :
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 617/639 afs: Fix large file support
In reply to Greg Kroah-HartmanFrom: Marc Dionne <[email protected]>
[ Upstream commit b485275f1aca8a9da37fd35e4fad673935e827da ]
By default s_maxbytes is set to MAX_NON_LFS, which limits the usable file size to 2GB, enforced by the vfs.
Commit b9b1f8d5930a ("AFS: write support fixes") added support for the 64-bit fetch and store server operations, but did not change this value. As a result, attempts to write past the 2G mark result in EFBIG errors:
$ dd if=/dev/zero of=foo bs=1M count=1 seek=2048 dd: error writing 'foo': File too large
Set s_maxbytes to MAX_LFS_FILESIZE.
--- fs/afs/super.c | 1 + 1 file changed, 1 insertion(+)
fs/afs/super.c +1 -0
@@ -393,6 +393,7 @@ static int afs_fill_super(struct super_block *sb,/* fill in the superblock */ sb->s_blocksize =PAGE_SIZE ; sb->s_blocksize_bits =PAGE_SHIFT ; + sb->s_maxbytes =MAX_LFS_FILESIZE ; sb->s_magic =AFS_FS_MAGIC ; sb->s_op = &afs_super_ops;if (!as->dyn_root)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 618/639 drm: panel-lvds: Potential Oops in probe error handling
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit fb2ee9bf084bcaeff1e5be100decc0eacb4af2d5 ]
The "lvds->backlight" pointer could be NULL in situations where of_parse_phandle() returns NULL. This code is cleaner if we use the managed devm_of_find_backlight() so the clean up is automatic.
--- drivers/gpu/drm/panel/panel-lvds.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-)
drivers/gpu/drm/panel/panel-lvds.c +4 -17
@@ -199,7 +199,6 @@ static int panel_lvds_parse_dt(struct panel_lvds *lvds)static int panel_lvds_probe (struct platform_device *pdev) {struct panel_lvds *lvds; -struct device_node *np;int ret; lvds =devm_kzalloc (&pdev->dev,sizeof (*lvds),GFP_KERNEL );
@@ -245,14 +244,9 @@ static int panel_lvds_probe(struct platform_device *pdev)return ret; } - np =of_parse_phandle (lvds->dev->of_node,"backlight" ,0 ); -if (np) { - lvds->backlight =of_find_backlight_by_node (np); -of_node_put (np); - -if (!lvds->backlight) -return -EPROBE_DEFER ; - } + lvds->backlight =devm_of_find_backlight (lvds->dev); +if (IS_ERR (lvds->backlight)) +return PTR_ERR (lvds->backlight);/* * TODO: Handle all power supplies specified in the DT node in a generic
@@ -268,14 +262,10 @@ static int panel_lvds_probe(struct platform_device *pdev) ret =drm_panel_add (&lvds->panel);if (ret <0 ) - goto error; +return ret;dev_set_drvdata (lvds->dev, lvds);return 0 ; - -error: -put_device (&lvds->backlight->dev); -return ret; }static int panel_lvds_remove (struct platform_device *pdev)
@@ -286,9 +276,6 @@ static int panel_lvds_remove(struct platform_device *pdev)panel_lvds_disable (&lvds->panel); -if (lvds->backlight) -put_device (&lvds->backlight->dev); -return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 619/639 hwrng: omap3-rom - Fix missing clock by probing with device tree
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
[ Upstream commit 0c0ef9ea6f3f0d5979dc7b094b0a184c1a94716b ]
Commit 0ed266d7ae5e ("clk: ti: omap3: cleanup unnecessary clock aliases") removed old omap3 clock framework aliases but caused omap3-rom-rng to stop working with clock not found error.
Based on discussions on the mailing list it was requested by Tero Kristo that it would be best to fix this issue by probing omap3-rom-rng using device tree to provide a proper clk property. The other option would be to add back the missing clock alias, but that does not help moving things forward with removing old legacy platform_data.
Let's also add a proper device tree binding and keep it together with the fix.
--- .../devicetree/bindings/rng/omap3_rom_rng.txt | 27 +++++++++++++++++++ arch/arm/boot/dts/omap3-n900.dts | 6 +++++ arch/arm/mach-omap2/pdata-quirks.c | 12 +-------- drivers/char/hw_random/omap3-rom-rng.c | 17 ++++++++++-- 4 files changed, 49 insertions(+), 13 deletions(-) create mode 100644 Documentation/devicetree/bindings/rng/omap3_rom_rng.txt
Documentation/devicetree/bindings/rng/omap3_rom_rng.txt new file +27 -0
@@ -0,0 +1,27 @@ +OMAP ROM RNG driver binding + +Secure SoCs may provide RNG via secure ROM calls like Nokia N900 does. The +implementation can depend on the SoC secure ROM used. + +- compatible: + Usage: required + Value type: <string> + Definition: must be "nokia,n900-rom-rng" + +- clocks: + Usage: required + Value type: <prop-encoded-array> + Definition: reference to the the RNG interface clock + +- clock-names: + Usage: required + Value type: <stringlist> + Definition: must be "ick" + +Example: + + rom_rng: rng { + compatible = "nokia,n900-rom-rng"; + clocks = <&rng_ick>; + clock-names = "ick"; + };
arch/arm/boot/dts/omap3-n900.dts +6 -0
@@ -158,6 +158,12 @@ pwms = <&pwm9 0 26316 0>; /* 38000 Hz */ }; + rom_rng: rng { + compatible = "nokia,n900-rom-rng"; + clocks = <&rng_ick>; + clock-names = "ick"; + }; + /* controlled (enabled/disabled) directly by bcm2048 and wl1251 */ vctcxo: vctcxo { compatible = "fixed-clock";
arch/arm/mach-omap2/pdata-quirks.c +1 -11
@@ -263,14 +263,6 @@ static void __init am3517_evm_legacy_init(void)am35xx_emac_reset (); } -static struct platform_device omap3_rom_rng_device = { - .name ="omap3-rom-rng" , - .id =-1 , - .dev = { - .platform_data = rx51_secure_rng_call, - }, -}; -static void __init nokia_n900_legacy_init (void ) {hsmmc2_internal_input_clk ();
@@ -286,9 +278,6 @@ static void __init nokia_n900_legacy_init(void)pr_warn ("RX-51: Not enabling ARM errata 430973 workaround\n" );pr_warn ("Thumb binaries may crash randomly without this workaround\n" ); } - -pr_info ("RX-51: Registering OMAP3 HWRNG device\n" ); -platform_device_register (&omap3_rom_rng_device); } }
@@ -466,6 +455,7 @@ static struct of_dev_auxdata omap_auxdata_lookup[] = {OF_DEV_AUXDATA ("ti,davinci_mdio" ,0x5c030000 ,"davinci_mdio.0" ,NULL ),OF_DEV_AUXDATA ("ti,am3517-emac" ,0x5c000000 ,"davinci_emac.0" , &am35xx_emac_pdata), +OF_DEV_AUXDATA ("nokia,n900-rom-rng" ,0 ,NULL , rx51_secure_rng_call),/* McBSP modules with sidetone core */ #if IS_ENABLED(CONFIG_SND_OMAP_SOC_MCBSP) OF_DEV_AUXDATA("ti,omap3-mcbsp", 0x49022000, "49022000.mcbsp", &mcbsp_pdata),
drivers/char/hw_random/omap3-rom-rng.c +15 -2
@@ -20,6 +20,8 @@#include <linux/workqueue.h> #include <linux/clk.h> #include <linux/err.h> +#include <linux/of.h> +#include <linux/of_device.h> #include <linux/platform_device.h> #define RNG_RESET 0x01
@@ -86,14 +88,18 @@ static int omap3_rom_rng_read(struct hwrng *rng, void *data, size_t max, bool w)static struct hwrng omap3_rom_rng_ops = { .name ="omap3-rom" , - .read = omap3_rom_rng_read, };static int omap3_rom_rng_probe (struct platform_device *pdev) {int ret =0 ; -pr_info ("initializing\n" ); + omap3_rom_rng_ops.read =of_device_get_match_data (&pdev->dev); +if (!omap3_rom_rng_ops.read) { +dev_err (&pdev->dev,"missing rom code handler\n" ); + +return -ENODEV ; + } omap3_rom_rng_call = pdev->dev.platform_data;if (!omap3_rom_rng_call) {
@@ -126,9 +132,16 @@ static int omap3_rom_rng_remove(struct platform_device *pdev)return 0 ; } +static const struct of_device_id omap_rom_rng_match[] = { + { .compatible ="nokia,n900-rom-rng" , .data = omap3_rom_rng_read, }, + {/* sentinel */ }, +}; +MODULE_DEVICE_TABLE (of, omap_rom_rng_match); +static struct platform_driver omap3_rom_rng_driver = { .driver = { .name ="omap3-rom-rng" , + .of_match_table = omap_rom_rng_match, }, .probe = omap3_rom_rng_probe, .remove = omap3_rom_rng_remove,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 620/639 dpaa_eth: perform DMA unmapping before read
In reply to Greg Kroah-HartmanFrom: Madalin Bucur <[email protected]>
[ Upstream commit c70fd3182caef014e6c628b412f81aa57a3ef9e4 ]
DMA unmapping is required before accessing the HW provided timestamping information.
--- .../net/ethernet/freescale/dpaa/dpaa_eth.c | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-)
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +17 -15
@@ -1620,18 +1620,6 @@ static struct sk_buff *dpaa_cleanup_tx_fd(const struct dpaa_priv *priv, skbh = (struct sk_buff **)phys_to_virt (addr); skb = *skbh; -if (priv->tx_tstamp &&skb_shinfo (skb)->tx_flags &SKBTX_HW_TSTAMP ) { -memset (&shhwtstamps,0 ,sizeof (shhwtstamps)); - -if (!fman_port_get_tstamp (priv->mac_dev->port[TX ], (void *)skbh, - &ns)) { - shhwtstamps.hwtstamp =ns_to_ktime (ns); -skb_tstamp_tx (skb, &shhwtstamps); - }else { -dev_warn (dev,"fman_port_get_tstamp failed!\n" ); - } - } -if (unlikely (qm_fd_get_format (fd) == qm_fd_sg)) { nr_frags =skb_shinfo (skb)->nr_frags; dma_unmap_single(dev, addr,
@@ -1654,14 +1642,28 @@ static struct sk_buff *dpaa_cleanup_tx_fd(const struct dpaa_priv *priv,dma_unmap_page (dev,qm_sg_addr (&sgt[i]),qm_sg_entry_get_len (&sgt[i]), dma_dir); } - -/* Free the page frag that we allocated on Tx */ -skb_free_frag (phys_to_virt (addr)); }else {dma_unmap_single (dev, addr,skb_tail_pointer (skb) - (u8 *)skbh, dma_dir); } +/* DMA unmapping is required before accessing the HW provided info */ +if (priv->tx_tstamp &&skb_shinfo (skb)->tx_flags &SKBTX_HW_TSTAMP ) { +memset (&shhwtstamps,0 ,sizeof (shhwtstamps)); + +if (!fman_port_get_tstamp (priv->mac_dev->port[TX ], (void *)skbh, + &ns)) { + shhwtstamps.hwtstamp =ns_to_ktime (ns); +skb_tstamp_tx (skb, &shhwtstamps); + }else { +dev_warn (dev,"fman_port_get_tstamp failed!\n" ); + } + } + +if (qm_fd_get_format (fd) == qm_fd_sg) +/* Free the page frag that we allocated on Tx */ +skb_free_frag (phys_to_virt (addr)); +return skb; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 621/639 dpaa_eth: avoid timestamp read on error paths
In reply to Greg Kroah-HartmanFrom: Madalin Bucur <[email protected]>
[ Upstream commit 9a4f4f3a894ff4487f5597b7aabba9432b238292 ]
The dpaa_cleanup_tx_fd() function is called by the frame transmit confirmation callback but also on several error paths. This function is reading the transmit timestamp value. Avoid reading an invalid timestamp value on the error paths.
--- drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +10 -7
@@ -1600,13 +1600,15 @@ static int dpaa_eth_refill_bpools(struct dpaa_priv *priv)* Skb freeing is not handled here. * * This function may be called on error paths in the Tx function, so guard -* against cases when not all fd relevant fields were filled in. +* against cases when not all fd relevant fields were filled in. To avoid +* reading the invalid transmission timestamp for the error paths set ts to +* false. * * Return the skb backpointer, since for S/G frames the buffer containing it * gets freed here. */ static struct sk_buff *dpaa_cleanup_tx_fd (const struct dpaa_priv *priv, -const struct qm_fd *fd) +const struct qm_fd *fd,bool ts) {const enum dma_data_direction dma_dir =DMA_TO_DEVICE ;struct device *dev = priv->net_dev->dev.parent;
@@ -1648,7 +1650,8 @@ static struct sk_buff *dpaa_cleanup_tx_fd(const struct dpaa_priv *priv, }/* DMA unmapping is required before accessing the HW provided info */ - if (priv->tx_tstamp && skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) { + if (ts && priv->tx_tstamp && + skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) { memset(&shhwtstamps, 0, sizeof(shhwtstamps)); if (!fman_port_get_tstamp(priv->mac_dev->port[TX], (void *)skbh,
@@ -2118,7 +2121,7 @@ dpaa_start_xmit(struct sk_buff *skb, struct net_device *net_dev)if (likely (dpaa_xmit (priv, percpu_stats, queue_mapping, &fd) ==0 ))return NETDEV_TX_OK ; -dpaa_cleanup_tx_fd (priv, &fd); +dpaa_cleanup_tx_fd (priv, &fd, false); skb_to_fd_failed: enomem: percpu_stats->tx_errors++;
@@ -2164,7 +2167,7 @@ static void dpaa_tx_error(struct net_device *net_dev, percpu_priv->stats.tx_errors++; - skb =dpaa_cleanup_tx_fd (priv, fd); + skb =dpaa_cleanup_tx_fd (priv, fd, false);dev_kfree_skb (skb); }
@@ -2205,7 +2208,7 @@ static void dpaa_tx_conf(struct net_device *net_dev, percpu_priv->tx_confirm++; - skb =dpaa_cleanup_tx_fd (priv, fd); + skb =dpaa_cleanup_tx_fd (priv, fd, true);consume_skb (skb); }
@@ -2435,7 +2438,7 @@ static void egress_ern(struct qman_portal *portal, percpu_priv->stats.tx_fifo_errors++;count_ern (percpu_priv, msg); - skb =dpaa_cleanup_tx_fd (priv, fd); + skb =dpaa_cleanup_tx_fd (priv, fd, false);dev_kfree_skb_any (skb); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 622/639 MIPS: Loongson: Fix return value of loongson_hwmon_init
In reply to Greg Kroah-HartmanFrom: Tiezhu Yang <[email protected]>
[ Upstream commit dece3c2a320b0a6d891da6ff774ab763969b6860 ]
When call function hwmon_device_register failed, use the actual return value instead of always -ENOMEM.
--- drivers/platform/mips/cpu_hwmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/mips/cpu_hwmon.c +1 -1
@@ -159,7 +159,7 @@ static int __init loongson_hwmon_init(void) cpu_hwmon_dev =hwmon_device_register (NULL );if (IS_ERR (cpu_hwmon_dev)) { - ret = -ENOMEM ; + ret =PTR_ERR (cpu_hwmon_dev);pr_err ("hwmon_device_register fail!\n" ); goto fail_hwmon_device_register; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 623/639 hv_netvsc: flag software created hash value
In reply to Greg Kroah-HartmanFrom: Stephen Hemminger <[email protected]>
[ Upstream commit df9f540ca74297a84bafacfa197e9347b20beea5 ]
When the driver needs to create a hash value because it was not done at higher level, then the hash should be marked as a software not hardware hash.
--- drivers/net/hyperv/netvsc_drv.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/net/hyperv/netvsc_drv.c +3 -4
@@ -295,9 +295,9 @@ static inline u32 netvsc_get_hash(else if (flow.basic.n_proto ==htons (ETH_P_IPV6 )) hash =jhash2 ((u32 *)&flow.addrs.v6addrs,8 , hashrnd);else - hash =0 ; +return 0 ; -skb_set_hash (skb, hash,PKT_HASH_TYPE_L3 ); +__skb_set_sw_hash (skb, hash, false); }return hash;
@@ -804,8 +804,7 @@ static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net, skb->protocol == htons(ETH_P_IP))netvsc_comp_ipcsum (skb); -/* Do L4 checksum offload if enabled and present. -*/ +/* Do L4 checksum offload if enabled and present. */ if (csum_info && (net->features &NETIF_F_RXCSUM )) {if (csum_info->receive.tcp_checksum_succeeded || csum_info->receive.udp_checksum_succeeded)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 624/639 net: neigh: use long type to store jiffies delta
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 9d027e3a83f39b819e908e4e09084277a2e45e95 ]
A difference of two unsigned long needs long storage.
--- net/core/neighbour.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/core/neighbour.c +2 -2
@@ -1885,8 +1885,8 @@ static int neightbl_fill_info(struct sk_buff *skb, struct neigh_table *tbl, goto nla_put_failure; {unsigned long now = jiffies; -unsigned int flush_delta = now - tbl->last_flush; -unsigned int rand_delta = now - tbl->last_rand; +long flush_delta = now - tbl->last_flush; +long rand_delta = now - tbl->last_rand;struct neigh_hash_table *nht;struct ndt_config ndc = { .ndtc_key_len = tbl->key_len,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 625/639 packet: fix data-race in fanout_flow_is_huge()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit b756ad928d98e5ef0b74af7546a6a31a8dadde00 ]
KCSAN reported the following data-race [1]
Adding a couple of READ_ONCE()/WRITE_ONCE() should silence it.
Since the report hinted about multiple cpus using the history concurrently, I added a test avoiding writing on it if the victim slot already contains the desired value.
[1]
BUG: KCSAN: data-race in fanout_demux_rollover / fanout_demux_rollover
read to 0xffff8880b01786cc of 4 bytes by task 18921 on cpu 1:
fanout_flow_is_huge net/packet/af_packet.c:1303 [inline] fanout_demux_rollover+0x33e/0x3f0 net/packet/af_packet.c:1353 packet_rcv_fanout+0x34e/0x490 net/packet/af_packet.c:1453 deliver_skb net/core/dev.c:1888 [inline] dev_queue_xmit_nit+0x15b/0x540 net/core/dev.c:1958 xmit_one net/core/dev.c:3195 [inline] dev_hard_start_xmit+0x3f5/0x430 net/core/dev.c:3215 __dev_queue_xmit+0x14ab/0x1b40 net/core/dev.c:3792 dev_queue_xmit+0x21/0x30 net/core/dev.c:3825 neigh_direct_output+0x1f/0x30 net/core/neighbour.c:1530 neigh_output include/net/neighbour.h:511 [inline] ip6_finish_output2+0x7a2/0xec0 net/ipv6/ip6_output.c:116 __ip6_finish_output net/ipv6/ip6_output.c:142 [inline] __ip6_finish_output+0x2d7/0x330 net/ipv6/ip6_output.c:127 ip6_finish_output+0x41/0x160 net/ipv6/ip6_output.c:152 NF_HOOK_COND include/linux/netfilter.h:294 [inline] ip6_output+0xf2/0x280 net/ipv6/ip6_output.c:175 dst_output include/net/dst.h:436 [inline] ip6_local_out+0x74/0x90 net/ipv6/output_core.c:179 ip6_send_skb+0x53/0x110 net/ipv6/ip6_output.c:1795 udp_v6_send_skb.isra.0+0x3ec/0xa70 net/ipv6/udp.c:1173 udpv6_sendmsg+0x1906/0x1c20 net/ipv6/udp.c:1471 inet6_sendmsg+0x6d/0x90 net/ipv6/af_inet6.c:576 sock_sendmsg_nosec net/socket.c:637 [inline] sock_sendmsg+0x9f/0xc0 net/socket.c:657 ___sys_sendmsg+0x2b7/0x5d0 net/socket.c:2311 __sys_sendmmsg+0x123/0x350 net/socket.c:2413 __do_sys_sendmmsg net/socket.c:2442 [inline] __se_sys_sendmmsg net/socket.c:2439 [inline] __x64_sys_sendmmsg+0x64/0x80 net/socket.c:2439 do_syscall_64+0xcc/0x370 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x44/0xa9
write to 0xffff8880b01786cc of 4 bytes by task 18922 on cpu 0:
fanout_flow_is_huge net/packet/af_packet.c:1306 [inline] fanout_demux_rollover+0x3a4/0x3f0 net/packet/af_packet.c:1353 packet_rcv_fanout+0x34e/0x490 net/packet/af_packet.c:1453 deliver_skb net/core/dev.c:1888 [inline] dev_queue_xmit_nit+0x15b/0x540 net/core/dev.c:1958 xmit_one net/core/dev.c:3195 [inline] dev_hard_start_xmit+0x3f5/0x430 net/core/dev.c:3215 __dev_queue_xmit+0x14ab/0x1b40 net/core/dev.c:3792 dev_queue_xmit+0x21/0x30 net/core/dev.c:3825 neigh_direct_output+0x1f/0x30 net/core/neighbour.c:1530 neigh_output include/net/neighbour.h:511 [inline] ip6_finish_output2+0x7a2/0xec0 net/ipv6/ip6_output.c:116 __ip6_finish_output net/ipv6/ip6_output.c:142 [inline] __ip6_finish_output+0x2d7/0x330 net/ipv6/ip6_output.c:127 ip6_finish_output+0x41/0x160 net/ipv6/ip6_output.c:152 NF_HOOK_COND include/linux/netfilter.h:294 [inline] ip6_output+0xf2/0x280 net/ipv6/ip6_output.c:175 dst_output include/net/dst.h:436 [inline] ip6_local_out+0x74/0x90 net/ipv6/output_core.c:179 ip6_send_skb+0x53/0x110 net/ipv6/ip6_output.c:1795 udp_v6_send_skb.isra.0+0x3ec/0xa70 net/ipv6/udp.c:1173 udpv6_sendmsg+0x1906/0x1c20 net/ipv6/udp.c:1471 inet6_sendmsg+0x6d/0x90 net/ipv6/af_inet6.c:576 sock_sendmsg_nosec net/socket.c:637 [inline] sock_sendmsg+0x9f/0xc0 net/socket.c:657 ___sys_sendmsg+0x2b7/0x5d0 net/socket.c:2311 __sys_sendmmsg+0x123/0x350 net/socket.c:2413 __do_sys_sendmmsg net/socket.c:2442 [inline] __se_sys_sendmmsg net/socket.c:2439 [inline] __x64_sys_sendmmsg+0x64/0x80 net/socket.c:2439 do_syscall_64+0xcc/0x370 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x44/0xa9
Reported by Kernel Concurrency Sanitizer on:
CPU: 0 PID: 18922 Comm: syz-executor.3 Not tainted 5.4.0-rc6+ #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
--- net/packet/af_packet.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
net/packet/af_packet.c +9 -3
@@ -1297,15 +1297,21 @@ static void packet_sock_destruct(struct sock *sk)static bool fanout_flow_is_huge (struct packet_sock *po,struct sk_buff *skb) { -u32 rxhash; +u32 *history = po->rollover->history; +u32 victim, rxhash;int i, count =0 ; rxhash =skb_get_hash (skb);for (i =0 ; i <ROLLOVER_HLEN ; i++) -if (po->rollover->history[i] == rxhash) +if (READ_ONCE (history[i]) == rxhash) count++; - po->rollover->history[prandom_u32 () %ROLLOVER_HLEN ] = rxhash; + victim =prandom_u32 () %ROLLOVER_HLEN ; + +/* Avoid dirtying the cache line if possible */ +if (READ_ONCE (history[victim]) != rxhash) +WRITE_ONCE (history[victim], rxhash); +return count > (ROLLOVER_HLEN >>1 ); }
Signature · 1 line
2.20.1
Re: [PATCH 4.19 625/639] packet: fix data-race in fanout_flow_is_huge()
Hi!
Quoted 22 lines
From: Eric Dumazet <[email protected]>
[ Upstream commit
b756ad928d98e5ef0b74af7546a6a31a8dadde00]KCSAN reported the following data-race [1]
Adding a couple of READ_ONCE()/WRITE_ONCE() should silence it.
Since the report hinted about multiple cpus using the history concurrently, I added a test avoiding writing on it if the victim slot already contains the desired value.
static bool
fanout_flow_is_huge(struct packet_sock *po, struct sk_buff *skb){net/packet/af_packet.c +2
-2-u32 rxhash; +u32 *history = po->rollover->history; +u32 victim, rxhash;int i, count =0 ; rxhash =skb_get_hash (skb);for (i =0 ; i <ROLLOVER_HLEN ; i++) -if (po->rollover->history[i] == rxhash)
net/packet/af_packet.c static void packet_sock_destruct(struct sock *sk) · line 1314
Quoted 10 lines
net/packet/af_packet.c +7
-1+if (READ_ONCE (history[i]) == rxhash) count++; - po->rollover->history[prandom_u32 () %ROLLOVER_HLEN ] = rxhash; + victim =prandom_u32 () %ROLLOVER_HLEN ; + +/* Avoid dirtying the cache line if possible */ +if (READ_ONCE (history[victim]) != rxhash) +WRITE_ONCE (history[victim], rxhash); +
Replacing simple asignment with if() is ... not nice and with all the "volatile" magic in _ONCE macros may not be win for everyone. [Actually, I don't think this is win here. This is not exactly hot path, is it? Is it likely that array aready contains required value?]
If this is going to get more common, should we get WRITE_ONCE_NONDIRTY() macro hiding the uglyness?
Best regards,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: [PATCH 4.19 625/639] packet: fix data-race in fanout_flow_is_huge()
Quoted 14 lines · Pavel Machek
net/packet/af_packet.c static void packet_sock_destruct(struct sock *sk) · line 1314
Quoted 9 lines
net/packet/af_packet.c +6
-1- po->rollover->history[prandom_u32 () %ROLLOVER_HLEN ] = rxhash; + victim =prandom_u32 () %ROLLOVER_HLEN ; + +/* Avoid dirtying the cache line if possible */ +if (READ_ONCE (history[victim]) != rxhash) +WRITE_ONCE (history[victim], rxhash); +Replacing simple asignment with
if()is ... not nice and with all the "volatile" magic in_ONCEmacros may not be win for everyone. [Actually, I don't think this is win here. This is not exactly hot path, is it?
This is a critical hot path, eg under DDOS attack.
Quoted 4 lines
If this is going to get more common, should we get
WRITE_ONCE_NONDIRTY()macro hiding the uglyness?
Sure, but we do not add macros for stable patches, usually.
Honestly, WRITE_ONCE_NONDIRTY() looks ugly to me.
Note that the KCSAN race might be solved in another way when data_race() is available.
Greg Kroah-Hartman
maintainerPATCH 626/639 i2c: stm32f7: report dma error during probe
In reply to Greg Kroah-HartmanFrom: Alain Volmat <[email protected]>
[ Upstream commit d77eceb2de99f5d7e0c645bad15511fe1af59e09 ]
Distinguish between the case where dma information is not provided within the DT and the case of an error during the dma init. Exit the probe with error in case of an error during dma init.
--- drivers/i2c/busses/i2c-stm32.c | 16 ++++++++-------- drivers/i2c/busses/i2c-stm32f7.c | 9 +++++++++ 2 files changed, 17 insertions(+), 8 deletions(-)
drivers/i2c/busses/i2c-stm32.c +8 -8
@@ -21,13 +21,13 @@ struct stm32_i2c_dma *stm32_i2c_dma_request(struct device *dev, dma =devm_kzalloc (dev,sizeof (*dma),GFP_KERNEL );if (!dma) -return NULL ; +return ERR_PTR (-ENOMEM );/* Request and configure I2C TX dma channel */ - dma->chan_tx =dma_request_slave_channel (dev,"tx" ); -if (!dma->chan_tx) { + dma->chan_tx =dma_request_chan (dev,"tx" ); +if (IS_ERR (dma->chan_tx)) {dev_dbg (dev,"can't request DMA tx channel\n" ); - ret = -EINVAL ; + ret =PTR_ERR (dma->chan_tx); goto fail_al; }
@@ -43,10 +43,10 @@ struct stm32_i2c_dma *stm32_i2c_dma_request(struct device *dev, }/* Request and configure I2C RX dma channel */ - dma->chan_rx =dma_request_slave_channel (dev,"rx" ); -if (!dma->chan_rx) { + dma->chan_rx =dma_request_chan (dev,"rx" ); +if (IS_ERR (dma->chan_rx)) {dev_err (dev,"can't request DMA rx channel\n" ); - ret = -EINVAL ; + ret =PTR_ERR (dma->chan_rx); goto fail_tx; }
@@ -76,7 +76,7 @@ fail_al:devm_kfree (dev, dma);dev_info (dev,"can't use DMA\n" ); -return NULL ; +return ERR_PTR (ret); }void stm32_i2c_dma_free (struct stm32_i2c_dma *dma)
drivers/i2c/busses/i2c-stm32f7.c +9 -0
@@ -1914,6 +1914,15 @@ static int stm32f7_i2c_probe(struct platform_device *pdev) i2c_dev->dma =stm32_i2c_dma_request (i2c_dev->dev, phy_addr,STM32F7_I2C_TXDR ,STM32F7_I2C_RXDR ); +if (PTR_ERR (i2c_dev->dma) == -ENODEV ) + i2c_dev->dma =NULL ; +else if (IS_ERR (i2c_dev->dma)) { + ret =PTR_ERR (i2c_dev->dma); +if (ret != -EPROBE_DEFER ) +dev_err (&pdev->dev, +"Failed to request dma error %i\n" , ret); + goto clk_free; + } ret =i2c_add_adapter (adap);if (ret)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 627/639 mmc: sdio: fix wl1251 vendor id
In reply to Greg Kroah-HartmanFrom: H. Nikolaus Schaller <[email protected]>
[ Upstream commit e5db673e7fe2f971ec82039a28dc0811c2100e87 ]
v4.11-rc1 did introduce a patch series that rearranged the sdio quirks into a header file. Unfortunately this did forget to handle SDIO_VENDOR_ID_TI differently between wl1251 and wl1271 with the result that although the wl1251 was found on the sdio bus, the firmware did not load any more and there was no interface registration.
This patch defines separate constants to be used by sdio quirks and drivers.
--- include/linux/mmc/sdio_ids.h | 2 ++ 1 file changed, 2 insertions(+)
include/linux/mmc/sdio_ids.h +2 -0
@@ -68,6 +68,8 @@#define SDIO_VENDOR_ID_TI 0x0097#define SDIO_DEVICE_ID_TI_WL1271 0x4076 +#define SDIO_VENDOR_ID_TI_WL1251 0x104c +#define SDIO_DEVICE_ID_TI_WL1251 0x9066#define SDIO_VENDOR_ID_STE 0x0020#define SDIO_DEVICE_ID_STE_CW1200 0x2280
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 628/639 mmc: core: fix wl1251 sdio quirks
In reply to Greg Kroah-HartmanFrom: H. Nikolaus Schaller <[email protected]>
[ Upstream commit 16568b4a4f0c34bd35cfadac63303c7af7812764 ]
wl1251 and wl1271 have different vendor id and device id. So we need to handle both with sdio quirks.
--- drivers/mmc/core/quirks.h | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/mmc/core/quirks.h +7 -0
@@ -119,7 +119,14 @@ static const struct mmc_fixup mmc_ext_csd_fixups[] = {END_FIXUP }; +static const struct mmc_fixup sdio_fixup_methods[] = { +SDIO_FIXUP (SDIO_VENDOR_ID_TI_WL1251 ,SDIO_DEVICE_ID_TI_WL1251 , + add_quirk,MMC_QUIRK_NONSTD_FUNC_IF ), + +SDIO_FIXUP (SDIO_VENDOR_ID_TI_WL1251 ,SDIO_DEVICE_ID_TI_WL1251 , + add_quirk,MMC_QUIRK_DISABLE_CD ), +SDIO_FIXUP (SDIO_VENDOR_ID_TI ,SDIO_DEVICE_ID_TI_WL1271 , add_quirk,MMC_QUIRK_NONSTD_FUNC_IF ),
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 629/639 affs: fix a memory leak in affs_remount
In reply to Greg Kroah-HartmanFrom: Navid Emamdoost <[email protected]>
[ Upstream commit 450c3d4166837c496ebce03650c08800991f2150 ]
In affs_remount if data is provided it is duplicated into new_opts. The allocated memory for new_opts is only released if parse_options fails.
There's a bit of history behind new_options, originally there was save/replace options on the VFS layer so the 'data' passed must not change (thus strdup), this got cleaned up in later patches. But not completely.
There's no reason to do the strdup in cases where the filesystem does not need to reuse the 'data' again, because strsep would modify it directly.
--- fs/affs/super.c | 6 ------ 1 file changed, 6 deletions(-)
fs/affs/super.c +0 -6
@@ -561,14 +561,9 @@ affs_remount(struct super_block *sb, int *flags, char *data)int root_block;unsigned long mount_flags;int res =0 ; -char *new_opts;char volume[32 ];char *prefix =NULL ; - new_opts =kstrdup (data,GFP_KERNEL ); -if (data && !new_opts) -return -ENOMEM ; -pr_debug ("%s(flags=0x%x,opts=\"%s\")\n" , __func__, *flags, data);sync_filesystem (sb);
@@ -579,7 +574,6 @@ affs_remount(struct super_block *sb, int *flags, char *data) &blocksize, &prefix, volume, &mount_flags)) {kfree (prefix); -kfree (new_opts);return -EINVAL ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 630/639 afs: Remove set but not used variables before, after
In reply to Greg Kroah-HartmanFrom: zhengbin <[email protected]>
[ Upstream commit 51590df4f3306cb1f43dca54e3ccdd121ab89594 ]
Fixes gcc '-Wunused-but-set-variable' warning:
fs/afs/dir_edit.c: In function afs_set_contig_bits:fs/afs/dir_edit.c:75:20: warning: variable after set but not used [-Wunused-but-set-variable] fs/afs/dir_edit.c: In function afs_set_contig_bits:fs/afs/dir_edit.c:75:12: warning: variable before set but not used [-Wunused-but-set-variable] fs/afs/dir_edit.c: In function afs_clear_contig_bits:fs/afs/dir_edit.c:100:20: warning: variable after set but not used [-Wunused-but-set-variable] fs/afs/dir_edit.c: In function afs_clear_contig_bits:fs/afs/dir_edit.c:100:12: warning: variable before set but not used [-Wunused-but-set-variable]
They are never used since commit 63a4681ff39c.
--- fs/afs/dir_edit.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
fs/afs/dir_edit.c +2 -10
@@ -72,13 +72,11 @@ static int afs_find_contig_bits(union afs_xdr_dir_block *block, unsigned int nr_static void afs_set_contig_bits (union afs_xdr_dir_block *block,int bit,unsigned int nr_slots) { -u64 mask, before, after; +u64 mask; mask = (1 << nr_slots) -1 ; mask <<= bit; - before = *(u64 *)block->hdr.bitmap; - block->hdr.bitmap[0 ] |= (u8)(mask >>0 *8 ); block->hdr.bitmap[1 ] |= (u8)(mask >>1 *8 ); block->hdr.bitmap[2 ] |= (u8)(mask >>2 *8 );
@@ -87,8 +85,6 @@ static void afs_set_contig_bits(union afs_xdr_dir_block *block, block->hdr.bitmap[5 ] |= (u8)(mask >>5 *8 ); block->hdr.bitmap[6 ] |= (u8)(mask >>6 *8 ); block->hdr.bitmap[7 ] |= (u8)(mask >>7 *8 ); - - after = *(u64 *)block->hdr.bitmap; }/*
@@ -97,13 +93,11 @@ static void afs_set_contig_bits(union afs_xdr_dir_block *block,static void afs_clear_contig_bits (union afs_xdr_dir_block *block,int bit,unsigned int nr_slots) { -u64 mask, before, after; +u64 mask; mask = (1 << nr_slots) -1 ; mask <<= bit; - before = *(u64 *)block->hdr.bitmap; - block->hdr.bitmap[0 ] &= ~(u8)(mask >>0 *8 ); block->hdr.bitmap[1 ] &= ~(u8)(mask >>1 *8 ); block->hdr.bitmap[2 ] &= ~(u8)(mask >>2 *8 );
@@ -112,8 +106,6 @@ static void afs_clear_contig_bits(union afs_xdr_dir_block *block, block->hdr.bitmap[5 ] &= ~(u8)(mask >>5 *8 ); block->hdr.bitmap[6 ] &= ~(u8)(mask >>6 *8 ); block->hdr.bitmap[7 ] &= ~(u8)(mask >>7 *8 ); - - after = *(u64 *)block->hdr.bitmap; }/*
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 631/639 dmaengine: ti: edma: fix missed failure handling
In reply to Greg Kroah-HartmanFrom: Chuhong Yuan <[email protected]>
[ Upstream commit 340049d453682a9fe8d91fe794dd091730f4bb25 ]
When devm_kcalloc fails, it forgets to call edma_free_slot. Replace direct return with failure handler to fix it.
--- drivers/dma/ti/edma.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/dma/ti/edma.c +4 -2
@@ -2345,8 +2345,10 @@ static int edma_probe(struct platform_device *pdev) ecc->tc_list =devm_kcalloc (dev, ecc->num_tc,sizeof (*ecc->tc_list),GFP_KERNEL ); -if (!ecc->tc_list) -return -ENOMEM ; +if (!ecc->tc_list) { + ret = -ENOMEM ; + goto err_reg1; + }for (i =0 ;; i++) { ret = of_parse_phandle_with_fixed_args(node, "ti,tptcs",
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 632/639 drm/radeon: fix bad DMA from INTERRUPT_CNTL2
In reply to Greg Kroah-HartmanFrom: Sam Bobroff <[email protected]>
[ Upstream commit 62d91dd2851e8ae2ca552f1b090a3575a4edf759 ]
The INTERRUPT_CNTL2 register expects a valid DMA address, but is currently set with a GPU MC address. This can cause problems on systems that detect the resulting DMA read from an invalid address (found on a Power8 guest).
Instead, use the DMA address of the dummy page because it will always be safe.
--- drivers/gpu/drm/radeon/cik.c | 4 ++-- drivers/gpu/drm/radeon/r600.c | 4 ++-- drivers/gpu/drm/radeon/si.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/radeon/cik.c +2 -2
@@ -6965,8 +6965,8 @@ static int cik_irq_init(struct radeon_device *rdev) }/* setup interrupt control */ -/* XXX this should actually be a bus address, not an MC address. same on older asics */ -WREG32 (INTERRUPT_CNTL2 , rdev->ih.gpu_addr >>8 ); +/* set dummy read address to dummy page address */ +WREG32 (INTERRUPT_CNTL2 , rdev->dummy_page.addr >>8 ); interrupt_cntl =RREG32 (INTERRUPT_CNTL );/* IH_DUMMY_RD_OVERRIDE=0 - dummy read disabled with msi, enabled without msi * IH_DUMMY_RD_OVERRIDE=1 - dummy read controlled by IH_DUMMY_RD_EN
drivers/gpu/drm/radeon/r600.c +2 -2
@@ -3690,8 +3690,8 @@ int r600_irq_init(struct radeon_device *rdev) }/* setup interrupt control */ -/* set dummy read address to ring address */ -WREG32 (INTERRUPT_CNTL2 , rdev->ih.gpu_addr >>8 ); +/* set dummy read address to dummy page address */ +WREG32 (INTERRUPT_CNTL2 , rdev->dummy_page.addr >>8 ); interrupt_cntl =RREG32 (INTERRUPT_CNTL );/* IH_DUMMY_RD_OVERRIDE=0 - dummy read disabled with msi, enabled without msi * IH_DUMMY_RD_OVERRIDE=1 - dummy read controlled by IH_DUMMY_RD_EN
drivers/gpu/drm/radeon/si.c +2 -2
@@ -5993,8 +5993,8 @@ static int si_irq_init(struct radeon_device *rdev) }/* setup interrupt control */ -/* set dummy read address to ring address */ -WREG32 (INTERRUPT_CNTL2 , rdev->ih.gpu_addr >>8 ); +/* set dummy read address to dummy page address */ +WREG32 (INTERRUPT_CNTL2 , rdev->dummy_page.addr >>8 ); interrupt_cntl =RREG32 (INTERRUPT_CNTL );/* IH_DUMMY_RD_OVERRIDE=0 - dummy read disabled with msi, enabled without msi * IH_DUMMY_RD_OVERRIDE=1 - dummy read controlled by IH_DUMMY_RD_EN
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 633/639 arm64: dts: juno: Fix UART frequency
In reply to Greg Kroah-HartmanFrom: Andre Przywara <[email protected]>
[ Upstream commit 39a1a8941b27c37f79508426e27a2ec29829d66c ]
Older versions of the Juno *SoC* TRM [1] recommended that the UART clock source should be 7.2738 MHz, whereas the *system* TRM [2] stated a more correct value of 7.3728 MHz. Somehow the wrong value managed to end up in our DT.
Doing a prime factorisation, a modulo divide by 115200 and trying to buy a 7.2738 MHz crystal at your favourite electronics dealer suggest that the old value was actually a typo. The actual UART clock is driven by a PLL, configured via a parameter in some board.txt file in the firmware, which reads 7.37 MHz (sic!).
Fix this to correct the baud rate divisor calculation on the Juno board.
[1] http://infocenter.arm.com/help/topic/com.arm.doc.ddi0515b.b/DDI0515B_b_juno_arm_development_platform_soc_trm.pdf
[2] http://infocenter.arm.com/help/topic/com.arm.doc.100113_0000_07_en/arm_versatile_express_juno_development_platform_(v2m_juno)_technical_reference_manual_100113_0000_07_en.pdf
--- arch/arm64/boot/dts/arm/juno-clocks.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/arm/juno-clocks.dtsi +2 -2
@@ -8,10 +8,10 @@ */ / { /* SoC fixed clocks */ - soc_uartclk: refclk7273800hz { + soc_uartclk: refclk7372800hz { compatible = "fixed-clock"; #clock-cells = <0>; - clock-frequency = <7273800>; + clock-frequency = <7372800>; clock-output-names = "juno:uartclk"; };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 634/639 samples/bpf: Fix broken xdp_rxq_info due to map order assumptions
In reply to Greg Kroah-HartmanFrom: Jesper Dangaard Brouer <[email protected]>
[ Upstream commit edbca120a8cdfa5a5793707e33497aa5185875ca ]
In the days of using bpf_load.c the order in which the 'maps' sections were defines in BPF side (*_kern.c) file, were used by userspace side to identify the map via using the map order as an index. In effect the order-index is created based on the order the maps sections are stored in the ELF-object file, by the LLVM compiler.
This have also carried over in libbpf via API bpf_map__next(NULL, obj) to extract maps in the order libbpf parsed the ELF-object file.
When BTF based maps were introduced a new section type ".maps" were created. I found that the LLVM compiler doesn't create the ".maps" sections in the order they are defined in the C-file. The order in the ELF file is based on the order the map pointer is referenced in the code.
This combination of changes lead to xdp_rxq_info mixing up the map file-descriptors in userspace, resulting in very broken behaviour, but without warning the user.
This patch fix issue by instead using bpf_object__find_map_by_name() to find maps via their names. (Note, this is the ELF name, which can be longer than the name the kernel retains).
--- samples/bpf/xdp_rxq_info_user.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
samples/bpf/xdp_rxq_info_user.c +3 -3
@@ -472,9 +472,9 @@ int main(int argc, char **argv)if (bpf_prog_load_xattr (&prog_load_attr, &obj, &prog_fd))return EXIT_FAIL ; - map =bpf_map__next (NULL , obj); - stats_global_map =bpf_map__next (map, obj); - rx_queue_index_map =bpf_map__next (stats_global_map, obj); + map =bpf_object__find_map_by_name (obj,"config_map" ); + stats_global_map =bpf_object__find_map_by_name (obj,"stats_global_map" ); + rx_queue_index_map =bpf_object__find_map_by_name (obj,"rx_queue_index_map" );if (!map || !stats_global_map || !rx_queue_index_map) {printf ("finding a map in obj file failed\n" );return EXIT_FAIL ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 635/639 usb: dwc3: Allow building USB_DWC3_QCOM without EXTCON
In reply to Greg Kroah-HartmanFrom: Marc Gonzalez <[email protected]>
[ Upstream commit 77a4946516fe488b6a33390de6d749f934a243ba ]
Keep EXTCON support optional, as some platforms do not need it.
Do the same for USB_DWC3_OMAP while we're at it.
--- drivers/usb/dwc3/Kconfig | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/usb/dwc3/Kconfig +4 -2
@@ -52,7 +52,8 @@ comment "Platform Glue Driver Support" config USB_DWC3_OMAP tristate "Texas Instruments OMAP5 and similar Platforms" - depends on EXTCON && (ARCH_OMAP2PLUS || COMPILE_TEST) + depends on ARCH_OMAP2PLUS || COMPILE_TEST + depends on EXTCON || !EXTCON depends on OF default USB_DWC3 help
@@ -113,7 +114,8 @@ config USB_DWC3_ST config USB_DWC3_QCOM tristate "Qualcomm Platform" - depends on EXTCON && (ARCH_QCOM || COMPILE_TEST) + depends on ARCH_QCOM || COMPILE_TEST + depends on EXTCON || !EXTCON depends on OF default USB_DWC3 help
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 636/639 IB/iser: Fix dma_nents type definition
In reply to Greg Kroah-HartmanFrom: Max Gurtovoy <[email protected]>
[ Upstream commit c1545f1a200f4adc4ef8dd534bf33e2f1aa22c2f ]
The retured value from ib_dma_map_sg saved in dma_nents variable. To avoid future mismatch between types, define dma_nents as an integer instead of unsigned.
--- drivers/infiniband/ulp/iser/iscsi_iser.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/ulp/iser/iscsi_iser.h +1 -1
@@ -197,7 +197,7 @@ struct iser_data_buf {struct scatterlist *sg;int size;unsigned long data_len; -unsigned int dma_nents; +int dma_nents; };/* fwd declarations */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 637/639 serial: stm32: fix clearing interrupt error flags
In reply to Greg Kroah-HartmanFrom: Fabrice Gasnier <[email protected]>
[ Upstream commit 1250ed7114a977cdc2a67a0c09d6cdda63970eb9 ]
The interrupt clear flag register is a "write 1 to clear" register. So, only writing ones allows to clear flags:
- Replace buggy stm32_clr_bits() by a simple write to clear error flags
- Replace useless read/modify/write stm32_set_bits() routine by a simple write to clear TC (transfer complete) flag.
--- drivers/tty/serial/stm32-usart.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/tty/serial/stm32-usart.c +3 -3
@@ -239,8 +239,8 @@ static void stm32_receive_chars(struct uart_port *port, bool threaded)* cleared by the sequence [read SR - read DR]. */ if ((sr &USART_SR_ERR_MASK ) && ofs->icr !=UNDEF_REG ) -stm32_clr_bits (port, ofs->icr,USART_ICR_ORECF | -USART_ICR_PECF |USART_ICR_FECF ); +writel_relaxed (sr &USART_SR_ERR_MASK , + port->membase + ofs->icr); c =stm32_get_char (port, &sr, &stm32_port->last_res); port->icount.rx++;
@@ -409,7 +409,7 @@ static void stm32_transmit_chars(struct uart_port *port)if (ofs->icr ==UNDEF_REG )stm32_clr_bits (port, ofs->isr,USART_SR_TC );else -stm32_set_bits (port, ofs->icr,USART_ICR_TCCF ); +writel_relaxed (USART_ICR_TCCF , port->membase + ofs->icr);if (stm32_port->tx_ch)stm32_transmit_chars_dma (port);
Signature · 1 line
2.20.1