4.19.83-stable review
Subsystems (2)
Greg Kroah-Hartman
maintainercover 4.19.83-stable review
This is the start of the stable review cycle for the 4.19.83 release. There are 79 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun 10 Nov 2019 05:42:11 PM UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.83-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.19.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.19.83-rc1
Roger Quadros <[email protected]>
usb: gadget: udc: core: Fix segfault if udc_bind_to_driver() for pending driver fails
Suman Anna <[email protected]>
arm64: dts: ti: k3-am65-main: Fix gic-its node unit-address
Peter Ujfalusi <[email protected]>
ASoC: pcm3168a: The codec does not support S32_LE
Desnes A. Nunes do Rosario <[email protected]>
selftests/powerpc: Fix compile error on tlbie_test due to newer gcc
Aneesh Kumar K.V <[email protected]>
selftests/powerpc: Add test case for tlbie vs mtpidr ordering issue
Aneesh Kumar K.V <[email protected]>
powerpc/mm: Fixup tlbie vs mtpidr/mtlpidr ordering issue on POWER9
Jan Kiszka <[email protected]>
platform/x86: pmc_atom: Add Siemens SIMATIC IPC227E to critclk_systems DMI table
Maxim Mikityanskiy <[email protected]>
wireless: Skip directory when generating certificates
Eric Dumazet <[email protected]>
net/flow_dissector: switch to siphash
Kazutoshi Noguchi <[email protected]>
r8152: add device id for Lenovo ThinkPad USB-C Dock Gen 2
Vivien Didelot <[email protected]>
net: dsa: fix switch tree list
Andrew Lunn <[email protected]>
net: usb: lan78xx: Connect PHY before registering MAC
Doug Berger <[email protected]>
net: bcmgenet: reset 40nm EPHY on energy detect
Doug Berger <[email protected]>
net: phy: bcm7xxx: define soft_reset for 40nm EPHY
Doug Berger <[email protected]>
net: bcmgenet: don't set phydev->link from MAC
Florian Fainelli <[email protected]>
net: dsa: b53: Do not clear existing mirrored port mask
Aya Levin <[email protected]>
net/mlx5e: Fix ethtool self test: link speed
Heiner Kallweit <[email protected]>
r8169: fix wrong PHY ID issue with RTL8168dp
Maxim Mikityanskiy <[email protected]>
net/mlx5e: Fix handling of compressed CQEs in case of low NAPI budget
Paolo Abeni <[email protected]>
selftests: fib_tests: add more tests for metric update
Paolo Abeni <[email protected]>
ipv4: fix route update on metric change.
Eric Dumazet <[email protected]>
net: add READ_ONCE() annotation in __skb_wait_for_more_packets()
Eric Dumazet <[email protected]>
net: use skb_queue_empty_lockless() in busy poll contexts
Eric Dumazet <[email protected]>
net: use skb_queue_empty_lockless() in poll() handlers
Eric Dumazet <[email protected]>
udp: use skb_queue_empty_lockless()
Eric Dumazet <[email protected]>
net: add skb_queue_empty_lockless()
Xin Long <[email protected]>
vxlan: check tun_info options_len properly
Eric Dumazet <[email protected]>
udp: fix data-race in udp_set_dev_scratch()
Wei Wang <[email protected]>
selftests: net: reuseport_dualstack: fix uninitalized parameter
zhanglin <[email protected]>
net: Zeroing the structure ethtool_wolinfo in ethtool_get_wol()
Daniel Wagner <[email protected]>
net: usb: lan78xx: Disable interrupts before calling generic_handle_irq()
Guillaume Nault <[email protected]>
netns: fix GFP flags in rtnl_net_notifyid()
Eran Ben Elisha <[email protected]>
net/mlx4_core: Dynamically set guaranteed amount of counters per VF
Jiangfeng Xiao <[email protected]>
net: hisilicon: Fix ping latency when deal with high throughput
Tejun Heo <[email protected]>
net: fix sk_page_frag() recursion from memory reclaim
Benjamin Herrenschmidt <[email protected]>
net: ethernet: ftgmac100: Fix DMA coherency issue with SW checksum
Florian Fainelli <[email protected]>
net: dsa: bcm_sf2: Fix IMP setup for port different than 8
Eric Dumazet <[email protected]>
net: annotate lockless accesses to sk->sk_napi_id
Eric Dumazet <[email protected]>
net: annotate accesses to sk->sk_incoming_cpu
Eric Dumazet <[email protected]>
inet: stop leaking jiffies on the wire
Xin Long <[email protected]>
erspan: fix the tun_info options_len check for erspan
Eric Dumazet <[email protected]>
dccp: do not leak jiffies on the wire
Vishal Kulkarni <[email protected]>
cxgb4: fix panic when attaching to ULD fail
Josef Bacik <[email protected]>
nbd: handle racing with error'ed out commands
Josef Bacik <[email protected]>
nbd: protect cmd->status with cmd->lock
Dave Wysochanski <[email protected]>
cifs: Fix cifsInodeInfo lock_sem deadlock when reconnect occurs
Alain Volmat <[email protected]>
i2c: stm32f7: remove warning when compiling with W=1
Fabrice Gasnier <[email protected]>
i2c: stm32f7: fix a race in slave mode with arbitration loss irq
Fabrice Gasnier <[email protected]>
i2c: stm32f7: fix first byte to send in slave mode
Zenghui Yu <[email protected]>
irqchip/gic-v3-its: Use the exact ITSList for VMOVP
Jonas Gorski <[email protected]>
MIPS: bmips: mark exception vectors as char arrays
Navid Emamdoost <[email protected]>
of: unittest: fix memory leak in unittest_data_add
afzal mohammed <[email protected]>
ARM: 8926/1: v7m: remove register save to stack before svc
Zhengjun Xing <[email protected]>
tracing: Fix "gfp_t" format for synthetic events
Bodo Stroesser <[email protected]>
scsi: target: core: Do not overwrite CDB byte 1
Christian König <[email protected]>
drm/amdgpu: fix potential VM faults
Peter Ujfalusi <[email protected]>
ARM: davinci: dm365: Fix McBSP dma_slave_map entry
Yunfeng Ye <[email protected]>
perf kmem: Fix memory leak in compact_gfp_flags()
Colin Ian King <[email protected]>
8250-men-mcb: fix error checking when get_num_ports returns -ENODEV
Yunfeng Ye <[email protected]>
perf c2c: Fix memory leak in build_cl_output()
Anson Huang <[email protected]>
ARM: dts: imx7s: Correct GPT's ipg clock source
Thomas Bogendoerfer <[email protected]>
scsi: fix kconfig dependency warning related to 53C700_LE_ON_BE
Thomas Bogendoerfer <[email protected]>
scsi: sni_53c710: fix compilation error
Hannes Reinecke <[email protected]>
scsi: scsi_dh_alua: handle RTPG sense code correctly during state transitions
Allen Pais <[email protected]>
scsi: qla2xxx: fix a potential NULL pointer dereference
Russell King <[email protected]>
ARM: mm: fix alignment handler faults under memory pressure
Dan Carpenter <[email protected]>
pinctrl: ns2: Fix off by one bugs in ns2_pinmux_enable()
Adam Ford <[email protected]>
ARM: dts: logicpd-torpedo-som: Remove twl_keypad
Robin Murphy <[email protected]>
ASoc: rockchip: i2s: Fix RPM imbalance
Stuart Henderson <[email protected]>
ASoC: wm_adsp: Don't generate kcontrols without READ flags
Yizhuo <[email protected]>
regulator: pfuze100-regulator: Variable "val" in pfuze100_regulator_probe() could be uninitialized
Jaska Uimonen <[email protected]>
ASoC: rt5682: add NULL handler to set_jack function
Axel Lin <[email protected]>
regulator: ti-abb: Fix timeout in ti_abb_wait_txdone/ti_abb_clear_all_txdone
Rayagonda Kokatanur <[email protected]>
arm64: dts: Fix gpio to pinmux mapping
Jernej Skrabec <[email protected]>
arm64: dts: allwinner: a64: sopine-baseboard: Add PHY regulator delay
Jernej Skrabec <[email protected]>
arm64: dts: allwinner: a64: pine64-plus: Add PHY regulator delay
Sylwester Nawrocki <[email protected]>
ASoC: wm8994: Do not register inapplicable controls for WM1811
Marco Felsch <[email protected]>
regulator: of: fix suspend-min/max-voltage parsing
Seth Forshee <[email protected]>
kbuild: add -fcf-protection=none when using retpoline flags
-------------
Diffstat:
Makefile | 10 +- arch/arm/boot/dts/imx7s.dtsi | 8 +- arch/arm/boot/dts/logicpd-torpedo-som.dtsi | 4 + arch/arm/mach-davinci/dm365.c | 4 +- arch/arm/mm/alignment.c | 44 +- arch/arm/mm/proc-v7m.S | 1 - .../boot/dts/allwinner/sun50i-a64-pine64-plus.dts | 9 + .../dts/allwinner/sun50i-a64-sopine-baseboard.dts | 6 + .../dts/broadcom/stingray/stingray-pinctrl.dtsi | 5 +- .../arm64/boot/dts/broadcom/stingray/stingray.dtsi | 3 +- arch/arm64/boot/dts/ti/k3-am65-main.dtsi | 2 +- arch/mips/bcm63xx/prom.c | 2 +- arch/mips/include/asm/bmips.h | 10 +- arch/mips/kernel/smp-bmips.c | 8 +- arch/powerpc/include/asm/cputable.h | 3 +- arch/powerpc/kernel/dt_cpu_ftrs.c | 2 + arch/powerpc/kvm/book3s_hv_rm_mmu.c | 42 +- arch/powerpc/mm/hash_native_64.c | 29 +- arch/powerpc/mm/tlb-radix.c | 80 ++- drivers/block/nbd.c | 18 +- drivers/crypto/chelsio/chtls/chtls_cm.c | 2 +- drivers/crypto/chelsio/chtls/chtls_io.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 +- drivers/i2c/busses/i2c-stm32f7.c | 21 +- drivers/irqchip/irq-gic-v3-its.c | 21 +- drivers/isdn/capi/capi.c | 2 +- drivers/net/dsa/b53/b53_common.c | 1 - drivers/net/dsa/bcm_sf2.c | 36 +- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 13 +- drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c | 29 +- drivers/net/ethernet/faraday/ftgmac100.c | 25 +- drivers/net/ethernet/hisilicon/hip04_eth.c | 15 +- .../net/ethernet/mellanox/mlx4/resource_tracker.c | 42 +- drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 5 +- .../net/ethernet/mellanox/mlx5/core/en_selftest.c | 15 +- drivers/net/ethernet/realtek/r8169.c | 4 + drivers/net/phy/bcm7xxx.c | 1 + drivers/net/usb/cdc_ether.c | 7 + drivers/net/usb/lan78xx.c | 17 +- drivers/net/usb/r8152.c | 1 + drivers/net/vxlan.c | 6 +- drivers/of/unittest.c | 1 + drivers/pinctrl/bcm/pinctrl-ns2-mux.c | 4 +- drivers/platform/x86/pmc_atom.c | 7 + drivers/regulator/of_regulator.c | 8 +- drivers/regulator/pfuze100-regulator.c | 8 +- drivers/regulator/ti-abb-regulator.c | 26 +- drivers/scsi/Kconfig | 2 +- drivers/scsi/device_handler/scsi_dh_alua.c | 21 +- drivers/scsi/qla2xxx/qla_os.c | 4 + drivers/scsi/sni_53c710.c | 4 +- drivers/target/target_core_device.c | 21 - drivers/tty/serial/8250/8250_men_mcb.c | 8 +- drivers/usb/gadget/udc/core.c | 2 +- fs/cifs/cifsglob.h | 5 + fs/cifs/cifsproto.h | 1 + fs/cifs/file.c | 23 +- fs/cifs/smb2file.c | 2 +- include/linux/gfp.h | 23 + include/linux/skbuff.h | 36 +- include/net/busy_poll.h | 6 +- include/net/flow_dissector.h | 3 +- include/net/fq.h | 2 +- include/net/fq_impl.h | 4 +- include/net/net_namespace.h | 2 +- include/net/sock.h | 15 +- kernel/trace/trace_events_hist.c | 2 + net/atm/common.c | 2 +- net/bluetooth/af_bluetooth.c | 4 +- net/caif/caif_socket.c | 2 +- net/core/datagram.c | 8 +- net/core/dev.c | 2 +- net/core/ethtool.c | 4 +- net/core/flow_dissector.c | 38 +- net/core/net_namespace.c | 17 +- net/core/rtnetlink.c | 14 +- net/core/sock.c | 6 +- net/dccp/ipv4.c | 4 +- net/decnet/af_decnet.c | 2 +- net/dsa/dsa2.c | 2 +- net/ipv4/datagram.c | 2 +- net/ipv4/fib_frontend.c | 2 +- net/ipv4/inet_hashtables.c | 2 +- net/ipv4/ip_gre.c | 4 +- net/ipv4/tcp.c | 4 +- net/ipv4/tcp_ipv4.c | 4 +- net/ipv4/udp.c | 29 +- net/ipv6/inet6_hashtables.c | 2 +- net/ipv6/ip6_gre.c | 4 +- net/ipv6/udp.c | 2 +- net/nfc/llcp_sock.c | 4 +- net/openvswitch/datapath.c | 20 +- net/phonet/socket.c | 4 +- net/sched/sch_hhf.c | 8 +- net/sched/sch_sfb.c | 13 +- net/sched/sch_sfq.c | 14 +- net/sctp/socket.c | 8 +- net/tipc/socket.c | 4 +- net/unix/af_unix.c | 6 +- net/vmw_vsock/af_vsock.c | 2 +- net/wireless/Makefile | 1 + sound/soc/codecs/pcm3168a.c | 3 +- sound/soc/codecs/rt5682.c | 12 +- sound/soc/codecs/wm8994.c | 43 +- sound/soc/codecs/wm_adsp.c | 3 +- sound/soc/rockchip/rockchip_i2s.c | 2 +- tools/perf/builtin-c2c.c | 14 +- tools/perf/builtin-kmem.c | 1 + tools/testing/selftests/net/fib_tests.sh | 21 + tools/testing/selftests/net/reuseport_dualstack.c | 3 +- tools/testing/selftests/powerpc/mm/Makefile | 2 + tools/testing/selftests/powerpc/mm/tlbie_test.c | 734 +++++++++++++++++++++ 112 files changed, 1480 insertions(+), 400 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/79 kbuild: add -fcf-protection=none when using retpoline flags
From: Seth Forshee <[email protected]>
[ Upstream commit 29be86d7f9cb18df4123f309ac7857570513e8bc ]
The gcc -fcf-protection=branch option is not compatible with -mindirect-branch=thunk-extern. The latter is used when CONFIG_RETPOLINE is selected, and this will fail to build with a gcc which has -fcf-protection=branch enabled by default. Adding -fcf-protection=none when building with retpoline enabled prevents such build failures.
--- Makefile | 6 ++++++ 1 file changed, 6 insertions(+)
Makefile +6 -0
@@ -835,6 +835,12 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=designated-init) # change __FILE__ to the relative path from the srctree KBUILD_CFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=) +# ensure -fcf-protection is disabled when using retpoline as it is +# incompatible with -mindirect-branch=thunk-extern +ifdef CONFIG_RETPOLINE +KBUILD_CFLAGS += $(call cc-option,-fcf-protection=none) +endif + # use the deterministic mode of AR if available KBUILD_ARFLAGS := $(call ar-option,D)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 2/79 regulator: of: fix suspend-min/max-voltage parsing
In reply to Greg Kroah-HartmanFrom: Marco Felsch <[email protected]>
[ Upstream commit 131cb1210d4b58acb0695707dad2eb90dcb50a2a ]
Currently the regulator-suspend-min/max-microvolt must be within the root regulator node but the dt-bindings specifies it as subnode properties for the regulator-state-[mem/disk/standby] node. The only DT using this bindings currently is the at91-sama5d2_xplained.dts and this DT uses it correctly. I don't know if it isn't tested but it can't work without this fix.
--- drivers/regulator/of_regulator.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/regulator/of_regulator.c +4 -4
@@ -214,12 +214,12 @@ static void of_get_regulation_constraints(struct device_node *np, "regulator-off-in-suspend")) suspend_state->enabled =DISABLE_IN_SUSPEND ; -if (!of_property_read_u32 (np,"regulator-suspend-min-microvolt" , - &pval)) +if (!of_property_read_u32 (suspend_np, +"regulator-suspend-min-microvolt" , &pval)) suspend_state->min_uV = pval; -if (!of_property_read_u32 (np,"regulator-suspend-max-microvolt" , - &pval)) +if (!of_property_read_u32 (suspend_np, +"regulator-suspend-max-microvolt" , &pval)) suspend_state->max_uV = pval; if (!of_property_read_u32(suspend_np,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 3/79 ASoC: wm8994: Do not register inapplicable controls for WM1811
In reply to Greg Kroah-HartmanFrom: Sylwester Nawrocki <[email protected]>
[ Upstream commit ca2347190adb5e4eece73a2b16e96e651c46246b ]
In case of WM1811 device there are currently being registered controls referring to registers not existing on that device.
It has been noticed when getting values of "AIF1ADC2 Volume", "AIF1DAC2 Volume" controls was failing during ALSA state restoring at boot time:
"amixer: Mixer hw:0 load error: Device or resource busy"
Reading some registers through I2C was failing with EBUSY error and indeed these registers were not available according to the datasheet.
To fix this controls not available on WM1811 are moved to a separate array and registered only for WM8994 and WM8958.
There are some further differences between WM8994 and WM1811, e.g. registers 603h, 604h, 605h, which are not covered in this patch.
--- sound/soc/codecs/wm8994.c | 43 +++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 17 deletions(-)
sound/soc/codecs/wm8994.c +26 -17
@@ -537,13 +537,10 @@ static SOC_ENUM_SINGLE_DECL(dac_osr, static SOC_ENUM_SINGLE_DECL(adc_osr, WM8994_OVERSAMPLING, 1, osr_text); -static const struct snd_kcontrol_new wm8994_snd_controls[] = { +static const struct snd_kcontrol_new wm8994_common_snd_controls[] = {SOC_DOUBLE_R_TLV ("AIF1ADC1 Volume" ,WM8994_AIF1_ADC1_LEFT_VOLUME ,WM8994_AIF1_ADC1_RIGHT_VOLUME ,1 ,119 ,0 , digital_tlv), -SOC_DOUBLE_R_TLV ("AIF1ADC2 Volume" ,WM8994_AIF1_ADC2_LEFT_VOLUME , -WM8994_AIF1_ADC2_RIGHT_VOLUME , -1 ,119 ,0 , digital_tlv),SOC_DOUBLE_R_TLV ("AIF2ADC Volume" ,WM8994_AIF2_ADC_LEFT_VOLUME ,WM8994_AIF2_ADC_RIGHT_VOLUME ,1 ,119 ,0 , digital_tlv),
@@ -560,8 +557,6 @@ SOC_ENUM("AIF2DACR Source", aif2dacr_src),SOC_DOUBLE_R_TLV ("AIF1DAC1 Volume" ,WM8994_AIF1_DAC1_LEFT_VOLUME ,WM8994_AIF1_DAC1_RIGHT_VOLUME ,1 ,96 ,0 , digital_tlv), -SOC_DOUBLE_R_TLV ("AIF1DAC2 Volume" ,WM8994_AIF1_DAC2_LEFT_VOLUME , -WM8994_AIF1_DAC2_RIGHT_VOLUME ,1 ,96 ,0 , digital_tlv),SOC_DOUBLE_R_TLV ("AIF2DAC Volume" ,WM8994_AIF2_DAC_LEFT_VOLUME , WM8994_AIF2_DAC_RIGHT_VOLUME, 1, 96, 0, digital_tlv),
@@ -569,17 +564,12 @@ SOC_SINGLE_TLV("AIF1 Boost Volume", WM8994_AIF1_CONTROL_2, 10, 3, 0, aif_tlv),SOC_SINGLE_TLV ("AIF2 Boost Volume" ,WM8994_AIF2_CONTROL_2 ,10 ,3 ,0 , aif_tlv),SOC_SINGLE ("AIF1DAC1 EQ Switch" ,WM8994_AIF1_DAC1_EQ_GAINS_1 ,0 ,1 ,0 ), -SOC_SINGLE ("AIF1DAC2 EQ Switch" ,WM8994_AIF1_DAC2_EQ_GAINS_1 ,0 ,1 ,0 ),SOC_SINGLE ("AIF2 EQ Switch" ,WM8994_AIF2_EQ_GAINS_1 ,0 ,1 ,0 ),WM8994_DRC_SWITCH ("AIF1DAC1 DRC Switch" ,WM8994_AIF1_DRC1_1 ,2 ),WM8994_DRC_SWITCH ("AIF1ADC1L DRC Switch" ,WM8994_AIF1_DRC1_1 ,1 ),WM8994_DRC_SWITCH ("AIF1ADC1R DRC Switch" ,WM8994_AIF1_DRC1_1 ,0 ), -WM8994_DRC_SWITCH ("AIF1DAC2 DRC Switch" ,WM8994_AIF1_DRC2_1 ,2 ), -WM8994_DRC_SWITCH ("AIF1ADC2L DRC Switch" ,WM8994_AIF1_DRC2_1 ,1 ), -WM8994_DRC_SWITCH ("AIF1ADC2R DRC Switch" ,WM8994_AIF1_DRC2_1 ,0 ), -WM8994_DRC_SWITCH ("AIF2DAC DRC Switch" ,WM8994_AIF2_DRC_1 ,2 ),WM8994_DRC_SWITCH ("AIF2ADCL DRC Switch" ,WM8994_AIF2_DRC_1 ,1 ), WM8994_DRC_SWITCH("AIF2ADCR DRC Switch", WM8994_AIF2_DRC_1, 0),
@@ -598,9 +588,6 @@ SOC_SINGLE("Sidetone HPF Switch", WM8994_SIDETONE, 6, 1, 0),SOC_ENUM ("AIF1ADC1 HPF Mode" , aif1adc1_hpf),SOC_DOUBLE ("AIF1ADC1 HPF Switch" ,WM8994_AIF1_ADC1_FILTERS ,12 ,11 ,1 ,0 ), -SOC_ENUM ("AIF1ADC2 HPF Mode" , aif1adc2_hpf), -SOC_DOUBLE ("AIF1ADC2 HPF Switch" ,WM8994_AIF1_ADC2_FILTERS ,12 ,11 ,1 ,0 ), -SOC_ENUM ("AIF2ADC HPF Mode" , aif2adc_hpf), SOC_DOUBLE("AIF2ADC HPF Switch", WM8994_AIF2_ADC_FILTERS, 12, 11, 1, 0),
@@ -641,6 +628,24 @@ SOC_SINGLE("AIF2DAC 3D Stereo Switch", WM8994_AIF2_DAC_FILTERS_2, 8, 1, 0), }; +/* Controls not available on WM1811 */ +static const struct snd_kcontrol_new wm8994_snd_controls[] = { +SOC_DOUBLE_R_TLV ("AIF1ADC2 Volume" ,WM8994_AIF1_ADC2_LEFT_VOLUME , +WM8994_AIF1_ADC2_RIGHT_VOLUME , +1 ,119 ,0 , digital_tlv), +SOC_DOUBLE_R_TLV ("AIF1DAC2 Volume" ,WM8994_AIF1_DAC2_LEFT_VOLUME , +WM8994_AIF1_DAC2_RIGHT_VOLUME ,1 ,96 ,0 , digital_tlv), + +SOC_SINGLE ("AIF1DAC2 EQ Switch" ,WM8994_AIF1_DAC2_EQ_GAINS_1 ,0 ,1 ,0 ), + +WM8994_DRC_SWITCH ("AIF1DAC2 DRC Switch" ,WM8994_AIF1_DRC2_1 ,2 ), +WM8994_DRC_SWITCH ("AIF1ADC2L DRC Switch" ,WM8994_AIF1_DRC2_1 ,1 ), +WM8994_DRC_SWITCH ("AIF1ADC2R DRC Switch" ,WM8994_AIF1_DRC2_1 ,0 ), + +SOC_ENUM ("AIF1ADC2 HPF Mode" , aif1adc2_hpf), +SOC_DOUBLE ("AIF1ADC2 HPF Switch" ,WM8994_AIF1_ADC2_FILTERS ,12 ,11 ,1 ,0 ), +}; +static const struct snd_kcontrol_new wm8994_eq_controls[] = {SOC_SINGLE_TLV ("AIF1DAC1 EQ1 Volume" ,WM8994_AIF1_DAC1_EQ_GAINS_1 ,11 ,31 ,0 , eq_tlv),
@@ -4262,13 +4267,15 @@ static int wm8994_component_probe(struct snd_soc_component *component)wm8994_handle_pdata (wm8994);wm_hubs_add_analogue_controls (component); -snd_soc_add_component_controls (component, wm8994_snd_controls, -ARRAY_SIZE (wm8994_snd_controls)); +snd_soc_add_component_controls (component, wm8994_common_snd_controls, +ARRAY_SIZE (wm8994_common_snd_controls));snd_soc_dapm_new_controls (dapm, wm8994_dapm_widgets,ARRAY_SIZE (wm8994_dapm_widgets));switch (control->type) {case WM8994 : +snd_soc_add_component_controls (component, wm8994_snd_controls, +ARRAY_SIZE (wm8994_snd_controls));snd_soc_dapm_new_controls (dapm, wm8994_specific_dapm_widgets,ARRAY_SIZE (wm8994_specific_dapm_widgets));if (control->revision <4 ) {
@@ -4288,8 +4295,10 @@ static int wm8994_component_probe(struct snd_soc_component *component) }break ;case WM8958 : +snd_soc_add_component_controls (component, wm8994_snd_controls, +ARRAY_SIZE (wm8994_snd_controls));snd_soc_add_component_controls (component, wm8958_snd_controls, -ARRAY_SIZE (wm8958_snd_controls)); +ARRAY_SIZE (wm8958_snd_controls));snd_soc_dapm_new_controls (dapm, wm8958_dapm_widgets,ARRAY_SIZE (wm8958_dapm_widgets));if (control->revision <1 ) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 4/79 arm64: dts: allwinner: a64: pine64-plus: Add PHY regulator delay
In reply to Greg Kroah-HartmanFrom: Jernej Skrabec <[email protected]>
[ Upstream commit 2511366797fa6ab4a404b4b000ef7cd262aaafe8 ]
Depending on kernel and bootloader configuration, it's possible that Realtek ethernet PHY isn't powered on properly. According to the datasheet, it needs 30ms to power up and then some more time before it can be used.
Fix that by adding 100ms ramp delay to regulator responsible for powering PHY.
--- arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts +9 -0
@@ -63,3 +63,12 @@ reg = <1>; }; }; + +®_dc1sw { + /* + * Ethernet PHY needs 30ms to properly power up and some more + * to initialize. 100ms should be plenty of time to finish + * whole process. + */ + regulator-enable-ramp-delay = <100000>; +};
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 5/79 arm64: dts: allwinner: a64: sopine-baseboard: Add PHY regulator delay
In reply to Greg Kroah-HartmanFrom: Jernej Skrabec <[email protected]>
[ Upstream commit ccdf3aaa27ded6db9a93eed3ca7468bb2353b8fe ]
It turns out that sopine-baseboard needs same fix as pine64-plus for ethernet PHY. Here too Realtek ethernet PHY chip needs additional power on delay to properly initialize. Datasheet mentions that chip needs 30 ms to be properly powered on and that it needs some more time to be initialized.
Fix that by adding 100ms ramp delay to regulator responsible for powering PHY.
Note that issue was found out and fix tested on pine64-lts, but it's basically the same as sopine-baseboard, only layout and connectors differ.
--- .../boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts +6 -0
@@ -113,6 +113,12 @@ }; ®_dc1sw { + /* + * Ethernet PHY needs 30ms to properly power up and some more + * to initialize. 100ms should be plenty of time to finish + * whole process. + */ + regulator-enable-ramp-delay = <100000>; regulator-name = "vcc-phy"; };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 6/79 arm64: dts: Fix gpio to pinmux mapping
In reply to Greg Kroah-HartmanFrom: Rayagonda Kokatanur <[email protected]>
[ Upstream commit 965f6603e3335a953f4f876792074cb36bf65f7f ]
There are total of 151 non-secure gpio (0-150) and four pins of pinmux (91, 92, 93 and 94) are not mapped to any gpio pin, hence update same in DT.
--- arch/arm64/boot/dts/broadcom/stingray/stingray-pinctrl.dtsi | 5 +++-- arch/arm64/boot/dts/broadcom/stingray/stingray.dtsi | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/broadcom/stingray/stingray-pinctrl.dtsi +3 -2
@@ -42,13 +42,14 @@ pinmux: pinmux@14029c { compatible = "pinctrl-single"; - reg = <0x0014029c 0x250>; + reg = <0x0014029c 0x26c>; #address-cells = <1>; #size-cells = <1>; pinctrl-single,register-width = <32>; pinctrl-single,function-mask = <0xf>; pinctrl-single,gpio-range = < - &range 0 154 MODE_GPIO + &range 0 91 MODE_GPIO + &range 95 60 MODE_GPIO >; range: gpio-range { #pinctrl-single,gpio-range-cells = <3>;
arch/arm64/boot/dts/broadcom/stingray/stingray.dtsi +1 -2
@@ -463,8 +463,7 @@ <&pinmux 108 16 27>, <&pinmux 135 77 6>, <&pinmux 141 67 4>, - <&pinmux 145 149 6>, - <&pinmux 151 91 4>; + <&pinmux 145 149 6>; }; i2c1: i2c@e0000 {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 7/79 regulator: ti-abb: Fix timeout in ti_abb_wait_txdone/ti_abb_clear_all_txdone
In reply to Greg Kroah-HartmanFrom: Axel Lin <[email protected]>
[ Upstream commit f64db548799e0330897c3203680c2ee795ade518 ]
ti_abb_wait_txdone() may return -ETIMEDOUT when ti_abb_check_txdone() returns true in the latest iteration of the while loop because the timeout value is abb->settling_time + 1. Similarly, ti_abb_clear_all_txdone() may return -ETIMEDOUT when ti_abb_check_txdone() returns false in the latest iteration of the while loop. Fix it.
--- drivers/regulator/ti-abb-regulator.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-)
drivers/regulator/ti-abb-regulator.c +8 -18
@@ -173,19 +173,14 @@ static int ti_abb_wait_txdone(struct device *dev, struct ti_abb *abb)while (timeout++ <= abb->settling_time) { status =ti_abb_check_txdone (abb);if (status) -break ; +return 0 ;udelay (1 ); } -if (timeout > abb->settling_time) { -dev_warn_ratelimited (dev, -"%s:TRANXDONE timeout(%duS) int=0x%08x\n" , - __func__, timeout,readl (abb->int_base)); -return -ETIMEDOUT ; - } - -return 0 ; +dev_warn_ratelimited (dev,"%s:TRANXDONE timeout(%duS) int=0x%08x\n" , + __func__, timeout,readl (abb->int_base)); +return -ETIMEDOUT ; }/**
@@ -205,19 +200,14 @@ static int ti_abb_clear_all_txdone(struct device *dev, const struct ti_abb *abb) status =ti_abb_check_txdone (abb);if (!status) -break ; +return 0 ;udelay (1 ); } -if (timeout > abb->settling_time) { -dev_warn_ratelimited (dev, -"%s:TRANXDONE timeout(%duS) int=0x%08x\n" , - __func__, timeout,readl (abb->int_base)); -return -ETIMEDOUT ; - } - -return 0 ; +dev_warn_ratelimited (dev,"%s:TRANXDONE timeout(%duS) int=0x%08x\n" , + __func__, timeout,readl (abb->int_base)); +return -ETIMEDOUT ; }/**
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 8/79 ASoC: rt5682: add NULL handler to set_jack function
In reply to Greg Kroah-HartmanFrom: Jaska Uimonen <[email protected]>
[ Upstream commit a315e76fc544f09daf619530a7b2f85865e6b25e ]
Implement NULL handler in set_jack function to disable irq's.
--- sound/soc/codecs/rt5682.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
sound/soc/codecs/rt5682.c +10 -2
@@ -982,6 +982,16 @@ static int rt5682_set_jack_detect(struct snd_soc_component *component, {struct rt5682_priv *rt5682 =snd_soc_component_get_drvdata (component); + rt5682->hs_jack = hs_jack; + +if (!hs_jack) { +regmap_update_bits (rt5682->regmap,RT5682_IRQ_CTRL_2 , +RT5682_JD1_EN_MASK ,RT5682_JD1_DIS ); +regmap_update_bits (rt5682->regmap,RT5682_RC_CLK_CTRL , +RT5682_POW_JDH |RT5682_POW_JDL ,0 ); +return 0 ; + } +switch (rt5682->pdata.jd_src) {case RT5682_JD1 : snd_soc_component_update_bits(component, RT5682_CBJ_CTRL_2,
@@ -1019,8 +1029,6 @@ static int rt5682_set_jack_detect(struct snd_soc_component *component,break ; } - rt5682->hs_jack = hs_jack; -return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 9/79 regulator: pfuze100-regulator: Variable "val" in pfuze100_regulator_probe() could be uninitialized
In reply to Greg Kroah-HartmanFrom: Yizhuo <[email protected]>
[ Upstream commit 1252b283141f03c3dffd139292c862cae10e174d ]
In function pfuze100_regulator_probe(), variable "val" could be initialized if regmap_read() fails. However, "val" is used to decide the control flow later in the if statement, which is potentially unsafe.
--- drivers/regulator/pfuze100-regulator.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/regulator/pfuze100-regulator.c +7 -1
@@ -710,7 +710,13 @@ static int pfuze100_regulator_probe(struct i2c_client *client,/* SW2~SW4 high bit check and modify the voltage value table */ if (i >= sw_check_start && i <= sw_check_end) { -regmap_read (pfuze_chip->regmap, desc->vsel_reg, &val); + ret =regmap_read (pfuze_chip->regmap, + desc->vsel_reg, &val); +if (ret) { +dev_err (&client->dev,"Fails to read from the register.\n" ); +return ret; + } +if (val & sw_hi) {if (pfuze_chip->chip_id ==PFUZE3000 || pfuze_chip->chip_id ==PFUZE3001 ) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 10/79 ASoC: wm_adsp: Dont generate kcontrols without READ flags
In reply to Greg Kroah-HartmanFrom: Stuart Henderson <[email protected]>
[ Upstream commit 3ae7359c0e39f42a96284d6798fc669acff38140 ]
User space always expects to be able to read ALSA controls, so ensure no kcontrols are generated without an appropriate READ flag. In the case of a read of such a control zeros will be returned.
--- sound/soc/codecs/wm_adsp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/codecs/wm_adsp.c +1 -2
@@ -1147,8 +1147,7 @@ static unsigned int wmfw_convert_flags(unsigned int in, unsigned int len) }if (in) { -if (in &WMFW_CTL_FLAG_READABLE ) - out |= rd; + out |= rd;if (in &WMFW_CTL_FLAG_WRITEABLE ) out |= wr;if (in &WMFW_CTL_FLAG_VOLATILE )
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 11/79 ASoc: rockchip: i2s: Fix RPM imbalance
In reply to Greg Kroah-HartmanFrom: Robin Murphy <[email protected]>
[ Upstream commit b1e620e7d32f5aad5353cc3cfc13ed99fea65d3a ]
If rockchip_pcm_platform_register() fails, e.g. upon deferring to wait for an absent DMA channel, we return without disabling RPM, which makes subsequent re-probe attempts scream with errors about the unbalanced enable. Don't do that.
--- sound/soc/rockchip/rockchip_i2s.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/rockchip/rockchip_i2s.c +1 -1
@@ -677,7 +677,7 @@ static int rockchip_i2s_probe(struct platform_device *pdev) ret =rockchip_pcm_platform_register (&pdev->dev);if (ret) {dev_err (&pdev->dev,"Could not register PCM\n" ); -return ret; + goto err_suspend; }return 0 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 12/79 ARM: dts: logicpd-torpedo-som: Remove twl_keypad
In reply to Greg Kroah-HartmanFrom: Adam Ford <[email protected]>
[ Upstream commit 6b512b0ee091edcb8e46218894e4c917d919d3dc ]
The TWL4030 used on the Logit PD Torpedo SOM does not have the keypad pins routed. This patch disables the twl_keypad driver to remove some splat during boot:
twl4030_keypad 48070000.i2c:twl@48:keypad: missing or malformed property linux,keymap: -22 twl4030_keypad 48070000.i2c:twl@48:keypad: Failed to build keymaptwl4030_keypad: probe of 48070000.i2c:twl@48:keypad failed with error -22
--- arch/arm/boot/dts/logicpd-torpedo-som.dtsi | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/boot/dts/logicpd-torpedo-som.dtsi +4 -0
@@ -196,3 +196,7 @@ &twl_gpio { ti,use-leds; }; + +&twl_keypad { + status = "disabled"; +};
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 13/79 pinctrl: ns2: Fix off by one bugs in ns2_pinmux_enable()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 39b65fbb813089e366b376bd8acc300b6fd646dc ]
The pinctrl->functions[] array has pinctrl->num_functions elements and the pinctrl->groups[] array is the same way. These are set in ns2_pinmux_probe(). So the > comparisons should be >= so that we don't read one element beyond the end of the array.
--- drivers/pinctrl/bcm/pinctrl-ns2-mux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pinctrl/bcm/pinctrl-ns2-mux.c +2 -2
@@ -640,8 +640,8 @@ static int ns2_pinmux_enable(struct pinctrl_dev *pctrl_dev,const struct ns2_pin_function *func;const struct ns2_pin_group *grp; -if (grp_select > pinctrl->num_groups || - func_select > pinctrl->num_functions) +if (grp_select >= pinctrl->num_groups || + func_select >= pinctrl->num_functions)return -EINVAL ; func = &pinctrl->functions[func_select];
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 14/79 ARM: mm: fix alignment handler faults under memory pressure
In reply to Greg Kroah-HartmanFrom: Russell King <[email protected]>
[ Upstream commit 67e15fa5b487adb9b78a92789eeff2d6ec8f5cee ]
When the system has high memory pressure, the page containing the instruction may be paged out. Using probe_kernel_address() means that if the page is swapped out, the resulting page fault will not be handled because page faults are disabled by this function.
Use get_user() to read the instruction instead.
--- arch/arm/mm/alignment.c | 44 +++++++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 8 deletions(-)
arch/arm/mm/alignment.c +36 -8
@@ -768,6 +768,36 @@ do_alignment_t32_to_handler(unsigned long *pinstr, struct pt_regs *regs,return NULL ; } +static int alignment_get_arm (struct pt_regs *regs,u32 *ip,unsigned long *inst) +{ +u32 instr =0 ; +int fault; + +if (user_mode (regs)) + fault =get_user (instr, ip); +else + fault =probe_kernel_address (ip, instr); + + *inst =__mem_to_opcode_arm (instr); + +return fault; +} + +static int alignment_get_thumb (struct pt_regs *regs,u16 *ip,u16 *inst) +{ +u16 instr =0 ; +int fault; + +if (user_mode (regs)) + fault =get_user (instr, ip); +else + fault =probe_kernel_address (ip, instr); + + *inst =__mem_to_opcode_thumb16 (instr); + +return fault; +} +static int do_alignment (unsigned long addr,unsigned int fsr,struct pt_regs *regs) {
@@ -775,10 +805,10 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)unsigned long instr =0 , instrptr;int (*handler)(unsigned long addr,unsigned long instr,struct pt_regs *regs);unsigned int type; -unsigned int fault;u16 tinstr =0 ;int isize =4 ;int thumb2_32b =0 ; +int fault;if (interrupts_enabled (regs))local_irq_enable ();
@@ -787,15 +817,14 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)if (thumb_mode (regs)) {u16 *ptr = (u16 *)(instrptr & ~1 ); - fault =probe_kernel_address (ptr, tinstr); - tinstr =__mem_to_opcode_thumb16 (tinstr); + + fault =alignment_get_thumb (regs, ptr, &tinstr);if (!fault) {if (cpu_architecture () >= CPU_ARCH_ARMv7 &&IS_T32 (tinstr)) {/* Thumb-2 32-bit */ -u16 tinst2 =0 ; - fault =probe_kernel_address (ptr +1 , tinst2); - tinst2 =__mem_to_opcode_thumb16 (tinst2); +u16 tinst2; + fault =alignment_get_thumb (regs, ptr +1 , &tinst2); instr =__opcode_thumb32_compose (tinstr, tinst2); thumb2_32b =1 ; }else {
@@ -804,8 +833,7 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs) } } }else { - fault =probe_kernel_address ((void *)instrptr, instr); - instr =__mem_to_opcode_arm (instr); + fault =alignment_get_arm (regs, (void *)instrptr, &instr); }if (fault) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 15/79 scsi: qla2xxx: fix a potential NULL pointer dereference
In reply to Greg Kroah-HartmanFrom: Allen Pais <[email protected]>
[ Upstream commit 35a79a63517981a8aea395497c548776347deda8 ]
alloc_workqueue is not checked for errors and as a result a potential NULL dereference could occur.
--- drivers/scsi/qla2xxx/qla_os.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/scsi/qla2xxx/qla_os.c +4 -0
@@ -3186,6 +3186,10 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) req->req_q_in, req->req_q_out, rsp->rsp_q_in, rsp->rsp_q_out); ha->wq =alloc_workqueue ("qla2xxx_wq" ,0 ,0 ); +if (unlikely (!ha->wq)) { + ret = -ENOMEM ; + goto probe_failed; + }if (ha->isp_ops->initialize_adapter (base_vha)) { ql_log(ql_log_fatal, base_vha, 0x00d6,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 16/79 scsi: scsi_dh_alua: handle RTPG sense code correctly during state transitions
In reply to Greg Kroah-HartmanFrom: Hannes Reinecke <[email protected]>
[ Upstream commit b6ce6fb121a655aefe41dccc077141c102145a37 ]
Some arrays are not capable of returning RTPG data during state transitioning, but rather return an 'LUN not accessible, asymmetric access state transition' sense code. In these cases we can set the state to 'transitioning' directly and don't need to evaluate the RTPG data (which we won't have anyway).
--- drivers/scsi/device_handler/scsi_dh_alua.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
drivers/scsi/device_handler/scsi_dh_alua.c +16 -5
@@ -526,6 +526,7 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg)unsigned int tpg_desc_tbl_off;unsigned char orig_transition_tmo;unsigned long flags; +bool transitioning_sense = false;if (!pg->expiry) {unsigned long transition_tmo =ALUA_FAILOVER_TIMEOUT *HZ ;
@@ -586,13 +587,19 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg) goto retry; }/* -* Retry on ALUA state transition or if any -* UNIT ATTENTION occurred. +* If the array returns with 'ALUA state transition' +* sense code here it cannot return RTPG data during +* transition. So set the state to 'transitioning' directly. */ if (sense_hdr.sense_key ==NOT_READY && - sense_hdr.asc ==0x04 && sense_hdr.ascq ==0x0a ) - err =SCSI_DH_RETRY ; -else if (sense_hdr.sense_key ==UNIT_ATTENTION ) + sense_hdr.asc ==0x04 && sense_hdr.ascq ==0x0a ) { + transitioning_sense = true; + goto skip_rtpg; + } +/* +* Retry on any other UNIT ATTENTION occurred. +*/ +if (sense_hdr.sense_key ==UNIT_ATTENTION ) err =SCSI_DH_RETRY ;if (err ==SCSI_DH_RETRY && pg->expiry !=0 &&time_before (jiffies, pg->expiry)) {
@@ -680,7 +687,11 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg) off =8 + (desc[7 ] *4 ); } + skip_rtpg:spin_lock_irqsave (&pg->lock, flags); +if (transitioning_sense) + pg->state =SCSI_ACCESS_STATE_TRANSITIONING ; + sdev_printk(KERN_INFO, sdev, "%s: port group %02x state %c %s supports %c%c%c%c%c%c%c\n", ALUA_DH_NAME, pg->group_id, print_alua_state(pg->state),
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 17/79 scsi: sni_53c710: fix compilation error
In reply to Greg Kroah-HartmanFrom: Thomas Bogendoerfer <[email protected]>
[ Upstream commit 0ee6211408a8e939428f662833c7301394125b80 ]
Drop out memory dev_printk() with wrong device pointer argument.
[mkp: typo]
--- drivers/scsi/sni_53c710.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/scsi/sni_53c710.c +1 -3
@@ -78,10 +78,8 @@ static int snirm710_probe(struct platform_device *dev) base = res->start; hostdata =kzalloc (sizeof (*hostdata),GFP_KERNEL ); -if (!hostdata) { -dev_printk (KERN_ERR , dev,"Failed to allocate host data\n" ); +if (!hostdata)return -ENOMEM ; - } hostdata->dev = &dev->dev;dma_set_mask (&dev->dev,DMA_BIT_MASK (32 ));
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 18/79 scsi: fix kconfig dependency warning related to 53C700_LE_ON_BE
In reply to Greg Kroah-HartmanFrom: Thomas Bogendoerfer <[email protected]>
[ Upstream commit 8cbf0c173aa096dda526d1ccd66fc751c31da346 ]
When building a kernel with SCSI_SNI_53C710 enabled, Kconfig warns:
WARNING: unmet direct dependencies detected for 53C700_LE_ON_BE
Depends on [n]: SCSI_LOWLEVEL [=y] && SCSI [=y] && SCSI_LASI700 [=n] Selected by [y]:
- SCSI_SNI_53C710 [=y] && SCSI_LOWLEVEL [=y] && SNI_RM [=y] && SCSI [=y]
Add the missing depends SCSI_SNI_53C710 to 53C700_LE_ON_BE to fix it.
--- drivers/scsi/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/Kconfig +1 -1
@@ -862,7 +862,7 @@ config SCSI_SNI_53C710 config 53C700_LE_ON_BE bool - depends on SCSI_LASI700 + depends on SCSI_LASI700 || SCSI_SNI_53C710 default y config SCSI_STEX
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 19/79 ARM: dts: imx7s: Correct GPTs ipg clock source
In reply to Greg Kroah-HartmanFrom: Anson Huang <[email protected]>
[ Upstream commit 252b9e21bcf46b0d16f733f2e42b21fdc60addee ]
i.MX7S/D's GPT ipg clock should be from GPT clock root and controlled by CCM's GPT CCGR, using correct clock source for GPT ipg clock instead of IMX7D_CLK_DUMMY.
--- arch/arm/boot/dts/imx7s.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/boot/dts/imx7s.dtsi +4 -4
@@ -443,7 +443,7 @@ compatible = "fsl,imx7d-gpt", "fsl,imx6sx-gpt"; reg = <0x302d0000 0x10000>; interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&clks IMX7D_CLK_DUMMY>, + clocks = <&clks IMX7D_GPT1_ROOT_CLK>, <&clks IMX7D_GPT1_ROOT_CLK>; clock-names = "ipg", "per"; };
@@ -452,7 +452,7 @@ compatible = "fsl,imx7d-gpt", "fsl,imx6sx-gpt"; reg = <0x302e0000 0x10000>; interrupts = <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&clks IMX7D_CLK_DUMMY>, + clocks = <&clks IMX7D_GPT2_ROOT_CLK>, <&clks IMX7D_GPT2_ROOT_CLK>; clock-names = "ipg", "per"; status = "disabled";
@@ -462,7 +462,7 @@ compatible = "fsl,imx7d-gpt", "fsl,imx6sx-gpt"; reg = <0x302f0000 0x10000>; interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&clks IMX7D_CLK_DUMMY>, + clocks = <&clks IMX7D_GPT3_ROOT_CLK>, <&clks IMX7D_GPT3_ROOT_CLK>; clock-names = "ipg", "per"; status = "disabled";
@@ -472,7 +472,7 @@ compatible = "fsl,imx7d-gpt", "fsl,imx6sx-gpt"; reg = <0x30300000 0x10000>; interrupts = <GIC_SPI 52 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&clks IMX7D_CLK_DUMMY>, + clocks = <&clks IMX7D_GPT4_ROOT_CLK>, <&clks IMX7D_GPT4_ROOT_CLK>; clock-names = "ipg", "per"; status = "disabled";
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 20/79 perf c2c: Fix memory leak in build_cl_output()
In reply to Greg Kroah-HartmanFrom: Yunfeng Ye <[email protected]>
[ Upstream commit ae199c580da1754a2b051321eeb76d6dacd8707b ]
There is a memory leak problem in the failure paths of build_cl_output(), so fix it.
--- tools/perf/builtin-c2c.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
tools/perf/builtin-c2c.c +9 -5
@@ -2626,6 +2626,7 @@ static int build_cl_output(char *cl_sort, bool no_source)bool add_sym = false;bool add_dso = false;bool add_src = false; +int ret =0 ;if (!buf)return -ENOMEM ;
@@ -2644,7 +2645,8 @@ static int build_cl_output(char *cl_sort, bool no_source) add_dso = true; }else if (strcmp (tok,"offset" )) {pr_err ("unrecognized sort token: %s\n" , tok); -return -EINVAL ; + ret = -EINVAL ; + goto err; } }
@@ -2667,13 +2669,15 @@ static int build_cl_output(char *cl_sort, bool no_source) add_sym ? "symbol," : "", add_dso ? "dso," : "", add_src ? "cl_srcline," : "", - "node") < 0) -return -ENOMEM ; + "node") < 0) { + ret = -ENOMEM ; + goto err; + } c2c.show_src = add_src; - +err:free (buf); -return 0 ; +return ret; }static int setup_coalesce (const char *coalesce,bool no_source)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 21/79 8250-men-mcb: fix error checking when get_num_ports returns -ENODEV
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit f50b6805dbb993152025ec04dea094c40cc93a0c ]
The current checking for failure on the number of ports fails when -ENODEV is returned from the call to get_num_ports. Fix this by making num_ports and loop counter i signed rather than unsigned ints. Also add check for num_ports being less than zero to check for -ve error returns.
Addresses-Coverity: ("Unsigned compared against 0")
--- drivers/tty/serial/8250/8250_men_mcb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/tty/serial/8250/8250_men_mcb.c +4 -4
@@ -71,8 +71,8 @@ static int serial_8250_men_mcb_probe(struct mcb_device *mdev, {struct serial_8250_men_mcb_data *data;struct resource *mem; -unsigned int num_ports; -unsigned int i; +int num_ports; +int i;void __iomem *membase; mem =mcb_get_resource (mdev,IORESOURCE_MEM );
@@ -87,7 +87,7 @@ static int serial_8250_men_mcb_probe(struct mcb_device *mdev,dev_dbg (&mdev->dev,"found a 16z%03u with %u ports\n" , mdev->id, num_ports); -if (num_ports ==0 || num_ports >4 ) { +if (num_ports <=0 || num_ports >4 ) {dev_err (&mdev->dev,"unexpected number of ports: %u\n" , num_ports);return -ENODEV ;
@@ -132,7 +132,7 @@ static int serial_8250_men_mcb_probe(struct mcb_device *mdev,static void serial_8250_men_mcb_remove (struct mcb_device *mdev) { -unsigned int num_ports, i; +int num_ports, i;struct serial_8250_men_mcb_data *data =mcb_get_drvdata (mdev);if (!data)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 22/79 perf kmem: Fix memory leak in compact_gfp_flags()
In reply to Greg Kroah-HartmanFrom: Yunfeng Ye <[email protected]>
[ Upstream commit 1abecfcaa7bba21c9985e0136fa49836164dd8fd ]
The memory @orig_flags is allocated by strdup(), it is freed on the normal path, but leak to free on the error path.
Fix this by adding free(orig_flags) on the error path.
--- tools/perf/builtin-kmem.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/builtin-kmem.c +1 -0
@@ -686,6 +686,7 @@ static char *compact_gfp_flags(char *gfp_flags) new =realloc (new_flags, len +strlen (cpt) +2 );if (new ==NULL ) {free (new_flags); +free (orig_flags);return NULL ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 23/79 ARM: davinci: dm365: Fix McBSP dma_slave_map entry
In reply to Greg Kroah-HartmanFrom: Peter Ujfalusi <[email protected]>
[ Upstream commit 564b6bb9d42d31fc80c006658cf38940a9b99616 ]
dm365 have only single McBSP, so the device name is without .0
--- arch/arm/mach-davinci/dm365.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-davinci/dm365.c +2 -2
@@ -458,8 +458,8 @@ static s8 dm365_queue_priority_mapping[][2] = { };static const struct dma_slave_map dm365_edma_map[] = { - {"davinci-mcbsp.0" ,"tx" ,EDMA_FILTER_PARAM (0 ,2 ) }, - {"davinci-mcbsp.0" ,"rx" ,EDMA_FILTER_PARAM (0 ,3 ) }, + {"davinci-mcbsp" ,"tx" ,EDMA_FILTER_PARAM (0 ,2 ) }, + {"davinci-mcbsp" ,"rx" ,EDMA_FILTER_PARAM (0 ,3 ) }, {"davinci_voicecodec" ,"tx" ,EDMA_FILTER_PARAM (0 ,2 ) }, {"davinci_voicecodec" ,"rx" ,EDMA_FILTER_PARAM (0 ,3 ) }, {"spi_davinci.2" ,"tx" ,EDMA_FILTER_PARAM (0 ,10 ) },
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 24/79 drm/amdgpu: fix potential VM faults
In reply to Greg Kroah-HartmanFrom: Christian König <[email protected]>
[ Upstream commit 3122051edc7c27cc08534be730f4c7c180919b8a ]
When we allocate new page tables under memory pressure we should not evict old ones.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2 -1
@@ -428,7 +428,8 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev, .interruptible = (bp->type != ttm_bo_type_kernel), .no_wait_gpu = false, .resv = bp->resv, - .flags = TTM_OPT_FLAG_ALLOW_RES_EVICT + .flags = bp->type != ttm_bo_type_kernel ? +TTM_OPT_FLAG_ALLOW_RES_EVICT :0 };struct amdgpu_bo *bo;unsigned long page_align, size = bp->size;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 25/79 scsi: target: core: Do not overwrite CDB byte 1
In reply to Greg Kroah-HartmanFrom: Bodo Stroesser <[email protected]>
[ Upstream commit 27e84243cb63601a10e366afe3e2d05bb03c1cb5 ]
passthrough_parse_cdb() - used by TCMU and PSCSI - attepts to reset the LUN field of SCSI-2 CDBs (bits 5,6,7 of byte 1). The current code is wrong as for newer commands not having the LUN field it overwrites relevant command bits (e.g. for SECURITY PROTOCOL IN / OUT). We think this code was unnecessary from the beginning or at least it is no longer useful. So we remove it entirely.
--- drivers/target/target_core_device.c | 21 --------------------- 1 file changed, 21 deletions(-)
drivers/target/target_core_device.c +0 -21
@@ -1128,27 +1128,6 @@ passthrough_parse_cdb(struct se_cmd *cmd,struct se_device *dev = cmd->se_dev;unsigned int size; -/* -* Clear a lun set in the cdb if the initiator talking to use spoke -* and old standards version, as we can't assume the underlying device -* won't choke up on it. -*/ -switch (cdb[0 ]) { -case READ_10 :/* SBC - RDProtect */ -case READ_12 :/* SBC - RDProtect */ -case READ_16 :/* SBC - RDProtect */ -case SEND_DIAGNOSTIC :/* SPC - SELF-TEST Code */ -case VERIFY :/* SBC - VRProtect */ -case VERIFY_16 :/* SBC - VRProtect */ -case WRITE_VERIFY :/* SBC - VRProtect */ -case WRITE_VERIFY_12 :/* SBC - VRProtect */ -case MAINTENANCE_IN :/* SPC - Parameter Data Format for SA RTPG */ -break ; -default : - cdb[1 ] &=0x1f ;/* clear logical unit number */ -break ; - } -/* * For REPORT LUNS we always need to emulate the response, for everything * else, pass it up.
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 26/79 tracing: Fix "gfp_t" format for synthetic events
In reply to Greg Kroah-HartmanFrom: Zhengjun Xing <[email protected]>
[ Upstream commit 9fa8c9c647be624e91b09ecffa7cd97ee0600b40 ]
In the format of synthetic events, the "gfp_t" is shown as "signed:1", but in fact the "gfp_t" is "unsigned", should be shown as "signed:0".
The issue can be reproduced by the following commands:
echo 'memlatency u64 lat; unsigned int order; gfp_t gfp_flags; int migratetype' > /sys/kernel/debug/tracing/synthetic_events cat /sys/kernel/debug/tracing/events/synthetic/memlatency/format
name: memlatency
ID: 2233
format:
field:unsigned short common_type; offset:0; size:2; signed:0;
field:unsigned char common_flags; offset:2; size:1; signed:0;
field:unsigned char common_preempt_count; offset:3; size:1; signed:0;
field:int common_pid; offset:4; size:4; signed:1;
field:u64 lat; offset:8; size:8; signed:0;
field:unsigned int order; offset:16; size:4; signed:0;
field:gfp_t gfp_flags; offset:24; size:4; signed:1;
field:int migratetype; offset:32; size:4; signed:1;print fmt: "lat=%llu, order=%u, gfp_flags=%x, migratetype=%d", REC->lat, REC->order, REC->gfp_flags, REC->migratetype
--- kernel/trace/trace_events_hist.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/trace/trace_events_hist.c +2 -0
@@ -448,6 +448,8 @@ static bool synth_field_signed(char *type) {if (strncmp (type,"u" ,1 ) ==0 )return false; +if (strcmp (type,"gfp_t" ) ==0 ) +return false;return true; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 27/79 ARM: 8926/1: v7m: remove register save to stack before svc
In reply to Greg Kroah-HartmanFrom: afzal mohammed <[email protected]>
[ Upstream commit 2ecb287998a47cc0a766f6071f63bc185f338540 ]
r0-r3 & r12 registers are saved & restored, before & after svc respectively. Intention was to preserve those registers across thread to handler mode switch.
On v7-M, hardware saves the register context upon exception in AAPCS complaint way. Restoring r0-r3 & r12 is done from stack location where hardware saves it, not from the location on stack where these registers were saved.
To clarify, on stm32f429 discovery board:
1. before svc, sp - 0x90009ff8
2. r0-r3,r12 saved to 0x90009ff8 - 0x9000a00b
3. upon svc, h/w decrements sp by 32 & pushes registers onto stack
4. after svc, sp - 0x90009fd8
5. r0-r3,r12 restored from 0x90009fd8 - 0x90009feb
Above means r0-r3,r12 is not restored from the location where they are saved, but since hardware pushes the registers onto stack, the registers are restored correctly.
Note that during register saving to stack (step 2), it goes past 0x9000a000. And it seems, based on objdump, there are global symbols residing there, and it perhaps can cause issues on a non-XIP Kernel (on XIP, data section is setup later).
Based on the analysis above, manually saving registers onto stack is at best no-op and at worst can cause data section corruption. Hence remove storing of registers onto stack before svc.
--- arch/arm/mm/proc-v7m.S | 1 - 1 file changed, 1 deletion(-)
arch/arm/mm/proc-v7m.S +0 -1
@@ -135,7 +135,6 @@ __v7m_setup_cont: dsb mov r6, lr @ save LR ldr sp, =init_thread_union + THREAD_START_SP - stmia sp, {r0-r3, r12} cpsie i svc #0 1: cpsid i
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 28/79 of: unittest: fix memory leak in unittest_data_add
In reply to Greg Kroah-HartmanFrom: Navid Emamdoost <[email protected]>
[ Upstream commit e13de8fe0d6a51341671bbe384826d527afe8d44 ]
In unittest_data_add, a copy buffer is created via kmemdup. This buffer is leaked if of_fdt_unflatten_tree fails. The release for the unittest_data buffer is added.
--- drivers/of/unittest.c | 1 + 1 file changed, 1 insertion(+)
drivers/of/unittest.c +1 -0
@@ -1159,6 +1159,7 @@ static int __init unittest_data_add(void)of_fdt_unflatten_tree (unittest_data,NULL , &unittest_data_node);if (!unittest_data_node) {pr_warn ("%s: No tree to attach; not running tests\n" , __func__); +kfree (unittest_data);return -ENODATA ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 29/79 MIPS: bmips: mark exception vectors as char arrays
In reply to Greg Kroah-HartmanFrom: Jonas Gorski <[email protected]>
[ Upstream commit e4f5cb1a9b27c0f94ef4f5a0178a3fde2d3d0e9e ]
The vectors span more than one byte, so mark them as arrays.
Fixes the following build error when building when using GCC 8.3:
In file included from ./include/linux/string.h:19,
from ./include/linux/bitmap.h:9,
from ./include/linux/cpumask.h:12,
from ./arch/mips/include/asm/processor.h:15,
from ./arch/mips/include/asm/thread_info.h:16,
from ./include/linux/thread_info.h:38,
from ./include/asm-generic/preempt.h:5,
from ./arch/mips/include/generated/asm/preempt.h:1,
from ./include/linux/preempt.h:81,
from ./include/linux/spinlock.h:51,
from ./include/linux/mmzone.h:8,
from ./include/linux/bootmem.h:8,
from arch/mips/bcm63xx/prom.c:10:
arch/mips/bcm63xx/prom.c: In function 'prom_init':
./arch/mips/include/asm/string.h:162:11: error: '__builtin_memcpy' forming offset [2, 32] is out of the bounds [0, 1] of object 'bmips_smp_movevec' with type 'char' [-Werror=array-bounds]
__ret = __builtin_memcpy((dst), (src), __len); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~arch/mips/bcm63xx/prom.c:97:3: note: in expansion of macro 'memcpy'
memcpy((void *)0xa0000200, &bmips_smp_movevec, 0x20);
^~~~~~
In file included from arch/mips/bcm63xx/prom.c:14:./arch/mips/include/asm/bmips.h:80:13: note: 'bmips_smp_movevec' declared here
extern char bmips_smp_movevec;
--- arch/mips/bcm63xx/prom.c | 2 +- arch/mips/include/asm/bmips.h | 10 +++++----- arch/mips/kernel/smp-bmips.c | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-)
arch/mips/bcm63xx/prom.c +1 -1
@@ -84,7 +84,7 @@ void __init prom_init(void)* Here we will start up CPU1 in the background and ask it to * reconfigure itself then go back to sleep. */ -memcpy ((void *)0xa0000200 , &bmips_smp_movevec,0x20 ); +memcpy ((void *)0xa0000200 , bmips_smp_movevec,0x20 );__sync ();set_c0_cause (C_SW0 );cpumask_set_cpu (1 , &bmips_booted_mask);
arch/mips/include/asm/bmips.h +5 -5
@@ -75,11 +75,11 @@ static inline int register_bmips_smp_ops(void)#endif } -extern char bmips_reset_nmi_vec; -extern char bmips_reset_nmi_vec_end; -extern char bmips_smp_movevec; -extern char bmips_smp_int_vec; -extern char bmips_smp_int_vec_end; +extern char bmips_reset_nmi_vec[]; +extern char bmips_reset_nmi_vec_end[]; +extern char bmips_smp_movevec[]; +extern char bmips_smp_int_vec[]; +extern char bmips_smp_int_vec_end[];extern int bmips_smp_enabled;extern int bmips_cpu_offset;
arch/mips/kernel/smp-bmips.c +4 -4
@@ -457,10 +457,10 @@ static void bmips_wr_vec(unsigned long dst, char *start, char *end)static inline void bmips_nmi_handler_setup (void ) { -bmips_wr_vec (BMIPS_NMI_RESET_VEC , &bmips_reset_nmi_vec, - &bmips_reset_nmi_vec_end); -bmips_wr_vec (BMIPS_WARM_RESTART_VEC , &bmips_smp_int_vec, - &bmips_smp_int_vec_end); +bmips_wr_vec (BMIPS_NMI_RESET_VEC , bmips_reset_nmi_vec, + bmips_reset_nmi_vec_end); +bmips_wr_vec (BMIPS_WARM_RESTART_VEC , bmips_smp_int_vec, + bmips_smp_int_vec_end); }struct reset_vec_info {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 30/79 irqchip/gic-v3-its: Use the exact ITSList for VMOVP
In reply to Greg Kroah-HartmanFrom: Zenghui Yu <[email protected]>
[ Upstream commit 8424312516e5d9baeeb0a95d0e4523579b7aa395 ]
On a system without Single VMOVP support (say GITS_TYPER.VMOVP == 0), we will map vPEs only on ITSs that will actually control interrupts for the given VM. And when moving a vPE, the VMOVP command will be issued only for those ITSs.
But when issuing VMOVPs we seemed fail to present the exact ITSList to ITSs who are actually included in the synchronization operation. The its_list_map we're currently using includes all ITSs in the system, even though some of them don't have the corresponding vPE mapping at all.
Introduce get_its_list() to get the per-VM its_list_map, to indicate which ITSs have vPE mappings for the given VM, and use this map as the expected ITSList when building VMOVP. This is hopefully a performance gain not to do some synchronization with those unsuspecting ITSs. And initialize the whole command descriptor to zero at beginning, since the seq_num and its_list should be RES0 when GITS_TYPER.VMOVP == 1.
--- drivers/irqchip/irq-gic-v3-its.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
drivers/irqchip/irq-gic-v3-its.c +18 -3
@@ -182,6 +182,22 @@ static DEFINE_IDA(its_vpeid_ida);#define gic_data_rdist_rd_base () (gic_data_rdist()->rd_base)#define gic_data_rdist_vlpi_base () (gic_data_rdist_rd_base() + SZ_128K) +static u16 get_its_list (struct its_vm *vm) +{ +struct its_node *its; +unsigned long its_list =0 ; + +list_for_each_entry (its, &its_nodes, entry) { +if (!its->is_v4) +continue ; + +if (vm->vlpi_count[its->list_nr]) +__set_bit (its->list_nr, &its_list); + } + +return (u16 )its_list; +} +static struct its_collection *dev_event_to_col (struct its_device *its_dev,u32 event) {
@@ -983,17 +999,15 @@ static void its_send_vmapp(struct its_node *its,static void its_send_vmovp (struct its_vpe *vpe) { -struct its_cmd_desc desc; +struct its_cmd_desc desc = {};struct its_node *its;unsigned long flags;int col_id = vpe->col_idx; desc.its_vmovp_cmd.vpe = vpe; - desc.its_vmovp_cmd.its_list = (u16 )its_list_map;if (!its_list_map) { its = list_first_entry(&its_nodes, struct its_node, entry); - desc.its_vmovp_cmd.seq_num =0 ; desc.its_vmovp_cmd.col = &its->collections[col_id];its_send_single_vcommand (its, its_build_vmovp_cmd, &desc);return ;
@@ -1010,6 +1024,7 @@ static void its_send_vmovp(struct its_vpe *vpe)raw_spin_lock_irqsave (&vmovp_lock, flags); desc.its_vmovp_cmd.seq_num = vmovp_seq_num++; + desc.its_vmovp_cmd.its_list =get_its_list (vpe->its_vm);/* Emit VMOVPs */ list_for_each_entry (its, &its_nodes, entry) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 31/79 i2c: stm32f7: fix first byte to send in slave mode
In reply to Greg Kroah-HartmanFrom: Fabrice Gasnier <[email protected]>
[ Upstream commit 02e64276c6dbcc4c5f39844f33d18180832a58f3 ]
The slave-interface documentation [1] states "the bus driver should transmit the first byte" upon I2C_SLAVE_READ_REQUESTED slave event:
- 'val': backend returns first byte to be sent
The driver currently ignores the 1st byte to send on this event.
[1] https://www.kernel.org/doc/Documentation/i2c/slave-interface
--- drivers/i2c/busses/i2c-stm32f7.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/i2c/busses/i2c-stm32f7.c +2 -0
@@ -1177,6 +1177,8 @@ static void stm32f7_i2c_slave_start(struct stm32f7_i2c_dev *i2c_dev)STM32F7_I2C_CR1_TXIE ;stm32f7_i2c_set_bits (base +STM32F7_I2C_CR1 , mask); +/* Write 1st data byte */ +writel_relaxed (value, base +STM32F7_I2C_TXDR ); }else {/* Notify i2c slave that new write transfer is starting */ i2c_slave_event (slave,I2C_SLAVE_WRITE_REQUESTED , &value);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 32/79 i2c: stm32f7: fix a race in slave mode with arbitration loss irq
In reply to Greg Kroah-HartmanFrom: Fabrice Gasnier <[email protected]>
[ Upstream commit 6d6b0d0d5afc8c4c84b08261260ba11dfa5206f2 ]
When in slave mode, an arbitration loss (ARLO) may be detected before the slave had a chance to detect the stop condition (STOPF in ISR). This is seen when two master + slave adapters switch their roles. It provokes the i2c bus to be stuck, busy as SCL line is stretched.
- the I2C_SLAVE_STOP event is never generated due to STOPF flag is set but don't generate an irq (race with ARLO irq, STOPIE is masked). STOPF flag remains set until next master xfer (e.g. when STOPIE irq get unmasked). In this case, completion is generated too early: immediately upon new transfer request (then it doesn't send all data).
- Some data get stuck in TXDR register. As a consequence, the controller stretches the SCL line: the bus gets busy until a future master transfer triggers the bus busy / recovery mechanism (this can take time... and may never happen at all)
So choice is to let the STOPF being detected by the slave isr handler, to properly handle this stop condition. E.g. don't mask IRQs in error handler, when the slave is running.
--- drivers/i2c/busses/i2c-stm32f7.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/i2c/busses/i2c-stm32f7.c +10 -7
@@ -1488,7 +1488,7 @@ static irqreturn_t stm32f7_i2c_isr_error(int irq, void *data)void __iomem *base = i2c_dev->base;struct device *dev = i2c_dev->dev;struct stm32_i2c_dma *dma = i2c_dev->dma; -u32 mask, status; +u32 status; status =readl_relaxed (i2c_dev->base +STM32F7_I2C_ISR );
@@ -1513,12 +1513,15 @@ static irqreturn_t stm32f7_i2c_isr_error(int irq, void *data) f7_msg->result = -EINVAL ; } -/* Disable interrupts */ -if (stm32f7_i2c_is_slave_registered (i2c_dev)) - mask =STM32F7_I2C_XFER_IRQ_MASK ; -else - mask =STM32F7_I2C_ALL_IRQ_MASK ; -stm32f7_i2c_disable_irq (i2c_dev, mask); +if (!i2c_dev->slave_running) { +u32 mask; +/* Disable interrupts */ +if (stm32f7_i2c_is_slave_registered (i2c_dev)) + mask =STM32F7_I2C_XFER_IRQ_MASK ; +else + mask =STM32F7_I2C_ALL_IRQ_MASK ; +stm32f7_i2c_disable_irq (i2c_dev, mask); + }/* Disable dma */ if (i2c_dev->use_dma) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 33/79 i2c: stm32f7: remove warning when compiling with W=1
In reply to Greg Kroah-HartmanFrom: Alain Volmat <[email protected]>
[ Upstream commit 348e46fbb4cdb2aead79aee1fd8bb25ec5fd25db ]
Remove the following warning:
drivers/i2c/busses/i2c-stm32f7.c:315:
warning: cannot understand function prototype:
'struct stm32f7_i2c_spec i2c_specs[] =
Replace a comment starting with /** by simply /* to avoid having it interpreted as a kernel-doc comment.
--- drivers/i2c/busses/i2c-stm32f7.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-stm32f7.c +1 -1
@@ -297,7 +297,7 @@ struct stm32f7_i2c_dev {bool use_dma; }; -/** +/* * All these values are coming from I2C Specification, Version 6.0, 4th of * April 2014. *
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 34/79 cifs: Fix cifsInodeInfo lock_sem deadlock when reconnect occurs
In reply to Greg Kroah-HartmanFrom: Dave Wysochanski <[email protected]>
[ Upstream commit d46b0da7a33dd8c99d969834f682267a45444ab3 ]
There's a deadlock that is possible and can easily be seen with a test where multiple readers open/read/close of the same file and a disruption occurs causing reconnect. The deadlock is due a reader thread inside cifs_strict_readv calling down_read and obtaining lock_sem, and then after reconnect inside cifs_reopen_file calling down_read a second time. If in between the two down_read calls, a down_write comes from another process, deadlock occurs.
CPU0 CPU1
---- ----
cifs_strict_readv()
down_read(&cifsi->lock_sem);
_cifsFileInfo_put
OR
cifs_new_fileinfo
down_write(&cifsi->lock_sem);cifs_reopen_file()
down_read(&cifsi->lock_sem);
Fix the above by changing all down_write(lock_sem) calls to down_write_trylock(lock_sem)/msleep() loop, which in turn makes the second down_read call benign since it will never block behind the writer while holding lock_sem.
--- fs/cifs/cifsglob.h | 5 +++++ fs/cifs/cifsproto.h | 1 + fs/cifs/file.c | 23 +++++++++++++++-------- fs/cifs/smb2file.c | 2 +- 4 files changed, 22 insertions(+), 9 deletions(-)
fs/cifs/cifsglob.h +5 -0
@@ -1286,6 +1286,11 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file);struct cifsInodeInfo {bool can_cache_brlcks;struct list_head llist;/* locks helb by this inode */ +/* +* NOTE: Some code paths call down_read(lock_sem) twice, so +* we must always use use cifs_down_write() instead of down_write() +* for this semaphore to avoid deadlocks. +*/ struct rw_semaphore lock_sem;/* protect the fields above */ /* BB add in lists for dirty pages i.e. write caching info for oplock */ struct list_head openFileList;
fs/cifs/cifsproto.h +1 -0
@@ -159,6 +159,7 @@ extern int cifs_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock, const unsigned int xid);extern int cifs_push_mandatory_locks (struct cifsFileInfo *cfile); +extern void cifs_down_write (struct rw_semaphore *sem); extern struct cifsFileInfo *cifs_new_fileinfo(struct cifs_fid *fid, struct file *file, struct tcon_link *tlink,
fs/cifs/file.c +15 -8
@@ -280,6 +280,13 @@ cifs_has_mand_locks(struct cifsInodeInfo *cinode)return has_locks; } +void +cifs_down_write (struct rw_semaphore *sem) +{ +while (!down_write_trylock (sem)) +msleep (10 ); +} +struct cifsFileInfo *cifs_new_fileinfo (struct cifs_fid *fid,struct file *file,struct tcon_link *tlink,__u32 oplock)
@@ -305,7 +312,7 @@ cifs_new_fileinfo(struct cifs_fid *fid, struct file *file,INIT_LIST_HEAD (&fdlocks->locks); fdlocks->cfile = cfile; cfile->llist = fdlocks; -down_write (&cinode->lock_sem); +cifs_down_write (&cinode->lock_sem);list_add (&fdlocks->llist, &cinode->llist);up_write (&cinode->lock_sem);
@@ -461,7 +468,7 @@ void _cifsFileInfo_put(struct cifsFileInfo *cifs_file, bool wait_oplock_handler)* Delete any outstanding lock records. We'll lose them when the file * is closed anyway. */ -down_write (&cifsi->lock_sem); +cifs_down_write (&cifsi->lock_sem);list_for_each_entry_safe (li, tmp, &cifs_file->llist->locks, llist) {list_del (&li->llist);cifs_del_lock_waiters (li);
@@ -1016,7 +1023,7 @@ static void cifs_lock_add(struct cifsFileInfo *cfile, struct cifsLockInfo *lock) { struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry)); -down_write (&cinode->lock_sem); +cifs_down_write (&cinode->lock_sem);list_add_tail (&lock->llist, &cfile->llist->locks);up_write (&cinode->lock_sem); }
@@ -1038,7 +1045,7 @@ cifs_lock_add_if(struct cifsFileInfo *cfile, struct cifsLockInfo *lock, try_again: exist = false; -down_write (&cinode->lock_sem); +cifs_down_write (&cinode->lock_sem); exist =cifs_find_lock_conflict (cfile, lock->offset, lock->length, lock->type, &conf_lock,CIFS_LOCK_OP );
@@ -1060,7 +1067,7 @@ cifs_lock_add_if(struct cifsFileInfo *cfile, struct cifsLockInfo *lock, (lock->blist.next == &lock->blist));if (!rc) goto try_again; -down_write (&cinode->lock_sem); +cifs_down_write (&cinode->lock_sem);list_del_init (&lock->blist); }
@@ -1113,7 +1120,7 @@ cifs_posix_lock_set(struct file *file, struct file_lock *flock)return rc; try_again: -down_write (&cinode->lock_sem); +cifs_down_write (&cinode->lock_sem);if (!cinode->can_cache_brlcks) {up_write (&cinode->lock_sem);return rc;
@@ -1319,7 +1326,7 @@ cifs_push_locks(struct cifsFileInfo *cfile)int rc =0 ;/* we are going to update can_cache_brlcks here - need a write access */ -down_write (&cinode->lock_sem); +cifs_down_write (&cinode->lock_sem);if (!cinode->can_cache_brlcks) {up_write (&cinode->lock_sem);return rc;
@@ -1510,7 +1517,7 @@ cifs_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock,if (!buf)return -ENOMEM ; -down_write (&cinode->lock_sem); +cifs_down_write (&cinode->lock_sem);for (i =0 ; i <2 ; i++) { cur = buf; num =0 ;
fs/cifs/smb2file.c +1 -1
@@ -137,7 +137,7 @@ smb2_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock, cur = buf; -down_write (&cinode->lock_sem); +cifs_down_write (&cinode->lock_sem); list_for_each_entry_safe(li, tmp, &cfile->llist->locks, llist) { if (flock->fl_start > li->offset || (flock->fl_start + length) <
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 35/79 nbd: protect cmd->status with cmd->lock
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
[ Upstream commit de6346ecbc8f5591ebd6c44ac164e8b8671d71d7 ]
We already do this for the most part, except in timeout and clear_req. For the timeout case we take the lock after we grab a ref on the config, but that isn't really necessary because we're safe to touch the cmd at this point, so just move the order around.
For the clear_req cause this is initiated by the user, so again is safe.
--- drivers/block/nbd.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/block/nbd.c +7 -5
@@ -349,17 +349,16 @@ static enum blk_eh_timer_return nbd_xmit_timeout(struct request *req,struct nbd_device *nbd = cmd->nbd;struct nbd_config *config; +if (!mutex_trylock (&cmd->lock)) +return BLK_EH_RESET_TIMER ; +if (!refcount_inc_not_zero (&nbd->config_refs)) { cmd->status =BLK_STS_TIMEOUT ; +mutex_unlock (&cmd->lock); goto done; } config = nbd->config; -if (!mutex_trylock (&cmd->lock)) { -nbd_config_put (nbd); -return BLK_EH_RESET_TIMER ; - } -if (config->num_connections >1 ) { dev_err_ratelimited(nbd_to_dev(nbd), "Connection timed out, retrying (%d/%d alive)\n",
@@ -745,7 +744,10 @@ static void nbd_clear_req(struct request *req, void *data, bool reserved) {struct nbd_cmd *cmd =blk_mq_rq_to_pdu (req); +mutex_lock (&cmd->lock); cmd->status =BLK_STS_IOERR ; +mutex_unlock (&cmd->lock); +blk_mq_complete_request (req); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 36/79 nbd: handle racing with errored out commands
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
[ Upstream commit 7ce23e8e0a9cd38338fc8316ac5772666b565ca9 ]
We hit the following warning in production
print_req_error: I/O error, dev nbd0, sector 7213934408 flags 80700
------------[ cut here ]------------ refcount_t: underflow; use-after-free. WARNING: CPU: 25 PID: 32407 at lib/refcount.c:190 refcount_sub_and_test_checked+0x53/0x60 Workqueue: knbd-recv recv_work [nbd] RIP: 0010:refcount_sub_and_test_checked+0x53/0x60 Call Trace: blk_mq_free_request+0xb7/0xf0 blk_mq_complete_request+0x62/0xf0 recv_work+0x29/0xa1 [nbd] process_one_work+0x1f5/0x3f0 worker_thread+0x2d/0x3d0 ? rescuer_thread+0x340/0x340 kthread+0x111/0x130 ? kthread_create_on_node+0x60/0x60 ret_from_fork+0x1f/0x30 ---[ end trace b079c3c67f98bb7c ]---
This was preceded by us timing out everything and shutting down the sockets for the device. The problem is we had a request in the queue at the same time, so we completed the request twice. This can actually happen in a lot of cases, we fail to get a ref on our config, we only have one connection and just error out the command, etc.
Fix this by checking cmd->status in nbd_read_stat. We only change this under the cmd->lock, so we are safe to check this here and see if we've already error'ed this command out, which would indicate that we've completed it as well.
--- drivers/block/nbd.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/block/nbd.c +6 -0
@@ -663,6 +663,12 @@ static struct nbd_cmd *nbd_read_stat(struct nbd_device *nbd, int index) ret = -ENOENT ; goto out; } +if (cmd->status !=BLK_STS_OK ) { +dev_err (disk_to_dev (nbd->disk),"Command already handled %p\n" , + req); + ret = -ENOENT ; + goto out; + }if (test_bit (NBD_CMD_REQUEUED , &cmd->flags)) {dev_err (disk_to_dev (nbd->disk),"Raced with timeout on req %p\n" , req);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 37/79 cxgb4: fix panic when attaching to ULD fail
In reply to Greg Kroah-HartmanFrom: Vishal Kulkarni <[email protected]>
[ Upstream commit fc89cc358fb64e2429aeae0f37906126636507ec ]
Release resources when attaching to ULD fail. Otherwise, data mismatch is seen between LLD and ULD later on, which lead to kernel panic when accessing resources that should not even exist in the first place.
--- drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c | 29 ++++++++++++++----------- 1 file changed, 17 insertions(+), 12 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c +17 -12
@@ -673,10 +673,10 @@ static void uld_init(struct adapter *ada lld->write_cmpl_support = adap->params.write_cmpl_support; } -static void uld_attach (struct adapter *adap,unsigned int uld) +static int uld_attach (struct adapter *adap,unsigned int uld) { -void *handle;struct cxgb4_lld_info lli; +void *handle;uld_init (adap, &lli);uld_queue_init (adap, uld, &lli);
@@ -686,7 +686,7 @@ static void uld_attach(struct adapter *adev_warn (adap->pdev_dev,"could not attach to the %s driver, error %ld\n" , adap->uld[uld].name,PTR_ERR (handle)); -return ; +return PTR_ERR (handle); } adap->uld[uld].handle = handle;
@@ -694,23 +694,24 @@ static void uld_attach(struct adapter *aif (adap->flags &FULL_INIT_DONE ) adap->uld[uld].state_change (handle,CXGB4_STATE_UP ); + +return 0 ; } -/** -* cxgb4_register_uld - register an upper-layer driver -* @type: the ULD type -* @p: the ULD methods +/* cxgb4_register_uld - register an upper-layer driver +* @type: the ULD type +* @p: the ULD methods * -* Registers an upper-layer driver with this driver and notifies the ULD -* about any presently available devices that support its type. Returns -* %-EBUSY if a ULD of the same type is already registered. +* Registers an upper-layer driver with this driver and notifies the ULD +* about any presently available devices that support its type. Returns +* %-EBUSY if a ULD of the same type is already registered. */ int cxgb4_register_uld (enum cxgb4_uld type,const struct cxgb4_uld_info *p) { -int ret =0 ;unsigned int adap_idx =0 ;struct adapter *adap; +int ret =0 ;if (type >=CXGB4_ULD_MAX )return -EINVAL ;
@@ -744,12 +745,16 @@ int cxgb4_register_uld(enum cxgb4_uld tyif (ret) goto free_irq; adap->uld[type] = *p; -uld_attach (adap, type); + ret =uld_attach (adap, type); +if (ret) + goto free_txq; adap_idx++; }mutex_unlock (&uld_mutex);return 0 ; +free_txq: +release_sge_txq_uld (adap, type); free_irq:if (adap->flags &FULL_INIT_DONE )quiesce_rx_uld (adap, type);
Greg Kroah-Hartman
maintainerPATCH 38/79 dccp: do not leak jiffies on the wire
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 3d1e5039f5f87a8731202ceca08764ee7cb010d3 ]
For some reason I missed the case of DCCP passive
flows in my previous patch.
--- net/dccp/ipv4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/dccp/ipv4.c +1 -1
@@ -417,7 +417,7 @@ struct sock *dccp_v4_request_recv_sock(cRCU_INIT_POINTER (newinet->inet_opt,rcu_dereference (ireq->ireq_opt)); newinet->mc_index =inet_iif (skb); newinet->mc_ttl =ip_hdr (skb)->ttl; - newinet->inet_id = jiffies; + newinet->inet_id =prandom_u32 ();if (dst ==NULL && (dst =inet_csk_route_child_sock (sk, newsk, req)) ==NULL ) goto put_and_exit;
Greg Kroah-Hartman
maintainerPATCH 39/79 erspan: fix the tun_info options_len check for erspan
In reply to Greg Kroah-HartmanFrom: Xin Long <[email protected]>
[ Upstream commit 2eb8d6d2910cfe3dc67dc056f26f3dd9c63d47cd ]
The check for !md doens't really work for ip_tunnel_info_opts(info) which only does info + 1. Also to avoid out-of-bounds access on info, it should ensure options_len is not less than erspan_metadata in both erspan_xmit() and ip6erspan_tunnel_xmit().
--- net/ipv4/ip_gre.c | 4 ++-- net/ipv6/ip6_gre.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
net/ipv4/ip_gre.c +2 -2
@@ -589,9 +589,9 @@ static void erspan_fb_xmit(struct sk_buf key = &tun_info->key;if (!(tun_info->key.tun_flags &TUNNEL_ERSPAN_OPT )) goto err_free_rt; +if (tun_info->options_len <sizeof (*md)) + goto err_free_rt; md =ip_tunnel_info_opts (tun_info); -if (!md) - goto err_free_rt;/* ERSPAN has fixed 8 byte GRE header */ version = md->version;
net/ipv6/ip6_gre.c +2 -2
@@ -1000,9 +1000,9 @@ static netdev_tx_t ip6erspan_tunnel_xmit dsfield = key->tos;if (!(tun_info->key.tun_flags &TUNNEL_ERSPAN_OPT )) goto tx_err; - md =ip_tunnel_info_opts (tun_info); -if (!md) +if (tun_info->options_len <sizeof (*md)) goto tx_err; + md =ip_tunnel_info_opts (tun_info); tun_id =tunnel_id_to_key32 (key->tun_id);if (md->version ==1 ) {
Greg Kroah-Hartman
maintainerPATCH 40/79 inet: stop leaking jiffies on the wire
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit a904a0693c189691eeee64f6c6b188bd7dc244e9 ]
Historically linux tried to stick to RFC 791, 1122, 2003 for IPv4 ID field generation.
RFC 6864 made clear that no matter how hard we try, we can not ensure unicity of IP ID within maximum lifetime for all datagrams with a given source address/destination address/protocol tuple.
Linux uses a per socket inet generator (inet_id), initialized at connection startup with a XOR of 'jiffies' and other fields that appear clear on the wire.
Thiemo Nagel pointed that this strategy is a privacy concern as this provides 16 bits of entropy to fingerprint devices.
Let's switch to a random starting point, this is just as good as far as RFC 6864 is concerned and does not leak anything critical.
--- drivers/crypto/chelsio/chtls/chtls_cm.c | 2 +- net/dccp/ipv4.c | 2 +- net/ipv4/datagram.c | 2 +- net/ipv4/tcp_ipv4.c | 4 ++-- net/sctp/socket.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-)
drivers/crypto/chelsio/chtls/chtls_cm.c +1 -1
@@ -1276,7 +1276,7 @@ static void make_established(struct sock tp->write_seq = snd_isn; tp->snd_nxt = snd_isn; tp->snd_una = snd_isn; -inet_sk (sk)->inet_id = tp->write_seq ^ jiffies; +inet_sk (sk)->inet_id =prandom_u32 ();assign_rxopt (sk, opt);if (tp->rcv_wnd > (RCV_BUFSIZ_M <<10 ))
net/dccp/ipv4.c +1 -1
@@ -121,7 +121,7 @@ int dccp_v4_connect(struct sock *sk, str inet->inet_daddr, inet->inet_sport, inet->inet_dport); - inet->inet_id = dp->dccps_iss ^ jiffies; + inet->inet_id =prandom_u32 (); err =dccp_connect (sk); rt =NULL ;
net/ipv4/datagram.c +1 -1
@@ -77,7 +77,7 @@ int __ip4_datagram_connect(struct sock *reuseport_has_conns (sk, true); sk->sk_state =TCP_ESTABLISHED ;sk_set_txhash (sk); - inet->inet_id = jiffies; + inet->inet_id =prandom_u32 ();sk_dst_set (sk, &rt->dst); err =0 ;
net/ipv4/tcp_ipv4.c +2 -2
@@ -305,7 +305,7 @@ int tcp_v4_connect(struct sock *sk, stru inet->inet_daddr); } - inet->inet_id = tp->write_seq ^ jiffies; + inet->inet_id =prandom_u32 ();if (tcp_fastopen_defer_connect (sk, &err))return err;
@@ -1436,7 +1436,7 @@ struct sock *tcp_v4_syn_recv_sock(constinet_csk (newsk)->icsk_ext_hdr_len =0 ;if (inet_opt)inet_csk (newsk)->icsk_ext_hdr_len = inet_opt->opt.optlen; - newinet->inet_id = newtp->write_seq ^ jiffies; + newinet->inet_id =prandom_u32 ();if (!dst) { dst =inet_csk_route_child_sock (sk, newsk, req);
net/sctp/socket.c +1 -1
@@ -8777,7 +8777,7 @@ void sctp_copy_sock(struct sock *newsk, newinet->inet_rcv_saddr = inet->inet_rcv_saddr; newinet->inet_dport =htons (asoc->peer.port); newinet->pmtudisc = inet->pmtudisc; - newinet->inet_id = asoc->next_tsn ^ jiffies; + newinet->inet_id =prandom_u32 (); newinet->uc_ttl = inet->uc_ttl; newinet->mc_loop =1 ;
Greg Kroah-Hartman
maintainerPATCH 41/79 net: annotate accesses to sk->sk_incoming_cpu
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 7170a977743b72cf3eb46ef6ef89885dc7ad3621 ]
This socket field can be read and written by concurrent cpus.
Use READ_ONCE() and WRITE_ONCE() annotations to document this, and avoid some compiler 'optimizations'.
KCSAN reported :
BUG: KCSAN: data-race in tcp_v4_rcv / tcp_v4_rcv
write to 0xffff88812220763c of 4 bytes by interrupt on cpu 0:
sk_incoming_cpu_update include/net/sock.h:953 [inline] tcp_v4_rcv+0x1b3c/0x1bb0 net/ipv4/tcp_ipv4.c:1934 ip_protocol_deliver_rcu+0x4d/0x420 net/ipv4/ip_input.c:204 ip_local_deliver_finish+0x110/0x140 net/ipv4/ip_input.c:231 NF_HOOK include/linux/netfilter.h:305 [inline] NF_HOOK include/linux/netfilter.h:299 [inline] ip_local_deliver+0x133/0x210 net/ipv4/ip_input.c:252 dst_input include/net/dst.h:442 [inline] ip_rcv_finish+0x121/0x160 net/ipv4/ip_input.c:413 NF_HOOK include/linux/netfilter.h:305 [inline] NF_HOOK include/linux/netfilter.h:299 [inline] ip_rcv+0x18f/0x1a0 net/ipv4/ip_input.c:523 __netif_receive_skb_one_core+0xa7/0xe0 net/core/dev.c:5010 __netif_receive_skb+0x37/0xf0 net/core/dev.c:5124 process_backlog+0x1d3/0x420 net/core/dev.c:5955 napi_poll net/core/dev.c:6392 [inline] net_rx_action+0x3ae/0xa90 net/core/dev.c:6460 __do_softirq+0x115/0x33f kernel/softirq.c:292 do_softirq_own_stack+0x2a/0x40 arch/x86/entry/entry_64.S:1082 do_softirq.part.0+0x6b/0x80 kernel/softirq.c:337 do_softirq kernel/softirq.c:329 [inline] __local_bh_enable_ip+0x76/0x80 kernel/softirq.c:189
read to 0xffff88812220763c of 4 bytes by interrupt on cpu 1:
sk_incoming_cpu_update include/net/sock.h:952 [inline] tcp_v4_rcv+0x181a/0x1bb0 net/ipv4/tcp_ipv4.c:1934 ip_protocol_deliver_rcu+0x4d/0x420 net/ipv4/ip_input.c:204 ip_local_deliver_finish+0x110/0x140 net/ipv4/ip_input.c:231 NF_HOOK include/linux/netfilter.h:305 [inline] NF_HOOK include/linux/netfilter.h:299 [inline] ip_local_deliver+0x133/0x210 net/ipv4/ip_input.c:252 dst_input include/net/dst.h:442 [inline] ip_rcv_finish+0x121/0x160 net/ipv4/ip_input.c:413 NF_HOOK include/linux/netfilter.h:305 [inline] NF_HOOK include/linux/netfilter.h:299 [inline] ip_rcv+0x18f/0x1a0 net/ipv4/ip_input.c:523 __netif_receive_skb_one_core+0xa7/0xe0 net/core/dev.c:5010 __netif_receive_skb+0x37/0xf0 net/core/dev.c:5124 process_backlog+0x1d3/0x420 net/core/dev.c:5955 napi_poll net/core/dev.c:6392 [inline] net_rx_action+0x3ae/0xa90 net/core/dev.c:6460 __do_softirq+0x115/0x33f kernel/softirq.c:292 run_ksoftirqd+0x46/0x60 kernel/softirq.c:603 smpboot_thread_fn+0x37d/0x4a0 kernel/smpboot.c:165
Reported by Kernel Concurrency Sanitizer on:
CPU: 1 PID: 16 Comm: ksoftirqd/1 Not tainted 5.4.0-rc3+ #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
--- include/net/sock.h | 4 ++-- net/core/sock.c | 4 ++-- net/ipv4/inet_hashtables.c | 2 +- net/ipv4/udp.c | 2 +- net/ipv6/inet6_hashtables.c | 2 +- net/ipv6/udp.c | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-)
include/net/sock.h +2 -2
@@ -945,8 +945,8 @@ static inline void sk_incoming_cpu_updat {int cpu =raw_smp_processor_id (); -if (unlikely (sk->sk_incoming_cpu != cpu)) - sk->sk_incoming_cpu = cpu; +if (unlikely (READ_ONCE (sk->sk_incoming_cpu) != cpu)) +WRITE_ONCE (sk->sk_incoming_cpu, cpu); }static inline void sock_rps_record_flow_hash (__u32 hash)
net/core/sock.c +2 -2
@@ -1005,7 +1005,7 @@ set_rcvbuf:break ;case SO_INCOMING_CPU : - sk->sk_incoming_cpu = val; +WRITE_ONCE (sk->sk_incoming_cpu, val);break ;case SO_CNX_ADVICE :
@@ -1341,7 +1341,7 @@ int sock_getsockopt(struct socket *sock,break ;case SO_INCOMING_CPU : - v.val = sk->sk_incoming_cpu; + v.val =READ_ONCE (sk->sk_incoming_cpu);break ;case SO_MEMINFO :
net/ipv4/inet_hashtables.c +1 -1
@@ -248,7 +248,7 @@ static inline int compute_score(struct sif (sk->sk_bound_dev_if) score +=4 ; } -if (sk->sk_incoming_cpu ==raw_smp_processor_id ()) +if (READ_ONCE (sk->sk_incoming_cpu) ==raw_smp_processor_id ()) score++; }return score;
net/ipv4/udp.c +1 -1
@@ -408,7 +408,7 @@ static int compute_score(struct sock *sk score +=4 ; } -if (sk->sk_incoming_cpu ==raw_smp_processor_id ()) +if (READ_ONCE (sk->sk_incoming_cpu) ==raw_smp_processor_id ()) score++;return score; }
net/ipv6/inet6_hashtables.c +1 -1
@@ -118,7 +118,7 @@ static inline int compute_score(struct sif (sk->sk_bound_dev_if) score++; } -if (sk->sk_incoming_cpu ==raw_smp_processor_id ()) +if (READ_ONCE (sk->sk_incoming_cpu) ==raw_smp_processor_id ()) score++; }return score;
net/ipv6/udp.c +1 -1
@@ -154,7 +154,7 @@ static int compute_score(struct sock *sk score++; } -if (sk->sk_incoming_cpu ==raw_smp_processor_id ()) +if (READ_ONCE (sk->sk_incoming_cpu) ==raw_smp_processor_id ()) score++;return score;
Greg Kroah-Hartman
maintainerPATCH 42/79 net: annotate lockless accesses to sk->sk_napi_id
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit ee8d153d46a3b98c064ee15c0c0a3bbf1450e5a1 ]
We already annotated most accesses to sk->sk_napi_id
We missed sk_mark_napi_id() and sk_mark_napi_id_once() which might be called without socket lock held in UDP stack.
KCSAN reported :
BUG: KCSAN: data-race in udpv6_queue_rcv_one_skb / udpv6_queue_rcv_one_skb
write to 0xffff888121c6d108 of 4 bytes by interrupt on cpu 0:
sk_mark_napi_id include/net/busy_poll.h:125 [inline] __udpv6_queue_rcv_skb net/ipv6/udp.c:571 [inline] udpv6_queue_rcv_one_skb+0x70c/0xb40 net/ipv6/udp.c:672 udpv6_queue_rcv_skb+0xb5/0x400 net/ipv6/udp.c:689 udp6_unicast_rcv_skb.isra.0+0xd7/0x180 net/ipv6/udp.c:832 __udp6_lib_rcv+0x69c/0x1770 net/ipv6/udp.c:913 udpv6_rcv+0x2b/0x40 net/ipv6/udp.c:1015 ip6_protocol_deliver_rcu+0x22a/0xbe0 net/ipv6/ip6_input.c:409 ip6_input_finish+0x30/0x50 net/ipv6/ip6_input.c:450 NF_HOOK include/linux/netfilter.h:305 [inline] NF_HOOK include/linux/netfilter.h:299 [inline] ip6_input+0x177/0x190 net/ipv6/ip6_input.c:459 dst_input include/net/dst.h:442 [inline] ip6_rcv_finish+0x110/0x140 net/ipv6/ip6_input.c:76 NF_HOOK include/linux/netfilter.h:305 [inline] NF_HOOK include/linux/netfilter.h:299 [inline] ipv6_rcv+0x1a1/0x1b0 net/ipv6/ip6_input.c:284 __netif_receive_skb_one_core+0xa7/0xe0 net/core/dev.c:5010 __netif_receive_skb+0x37/0xf0 net/core/dev.c:5124 process_backlog+0x1d3/0x420 net/core/dev.c:5955 napi_poll net/core/dev.c:6392 [inline] net_rx_action+0x3ae/0xa90 net/core/dev.c:6460
write to 0xffff888121c6d108 of 4 bytes by interrupt on cpu 1:
sk_mark_napi_id include/net/busy_poll.h:125 [inline] __udpv6_queue_rcv_skb net/ipv6/udp.c:571 [inline] udpv6_queue_rcv_one_skb+0x70c/0xb40 net/ipv6/udp.c:672 udpv6_queue_rcv_skb+0xb5/0x400 net/ipv6/udp.c:689 udp6_unicast_rcv_skb.isra.0+0xd7/0x180 net/ipv6/udp.c:832 __udp6_lib_rcv+0x69c/0x1770 net/ipv6/udp.c:913 udpv6_rcv+0x2b/0x40 net/ipv6/udp.c:1015 ip6_protocol_deliver_rcu+0x22a/0xbe0 net/ipv6/ip6_input.c:409 ip6_input_finish+0x30/0x50 net/ipv6/ip6_input.c:450 NF_HOOK include/linux/netfilter.h:305 [inline] NF_HOOK include/linux/netfilter.h:299 [inline] ip6_input+0x177/0x190 net/ipv6/ip6_input.c:459 dst_input include/net/dst.h:442 [inline] ip6_rcv_finish+0x110/0x140 net/ipv6/ip6_input.c:76 NF_HOOK include/linux/netfilter.h:305 [inline] NF_HOOK include/linux/netfilter.h:299 [inline] ipv6_rcv+0x1a1/0x1b0 net/ipv6/ip6_input.c:284 __netif_receive_skb_one_core+0xa7/0xe0 net/core/dev.c:5010 __netif_receive_skb+0x37/0xf0 net/core/dev.c:5124 process_backlog+0x1d3/0x420 net/core/dev.c:5955
Reported by Kernel Concurrency Sanitizer on:
CPU: 1 PID: 10890 Comm: syz-executor.0 Not tainted 5.4.0-rc3+ #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
--- include/net/busy_poll.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
include/net/busy_poll.h +3 -3
@@ -134,7 +134,7 @@ static inline void skb_mark_napi_id(strustatic inline void sk_mark_napi_id (struct sock *sk,const struct sk_buff *skb) {#ifdef CONFIG_NET_RX_BUSY_POLL - sk->sk_napi_id = skb->napi_id; +WRITE_ONCE (sk->sk_napi_id, skb->napi_id);#endif sk_rx_queue_set (sk, skb); }
@@ -144,8 +144,8 @@ static inline void sk_mark_napi_id_once( const struct sk_buff *skb) {#ifdef CONFIG_NET_RX_BUSY_POLL -if (!sk->sk_napi_id) - sk->sk_napi_id = skb->napi_id; +if (!READ_ONCE (sk->sk_napi_id)) +WRITE_ONCE (sk->sk_napi_id, skb->napi_id);#endif }
Greg Kroah-Hartman
maintainerPATCH 43/79 net: dsa: bcm_sf2: Fix IMP setup for port different than 8
In reply to Greg Kroah-HartmanFrom: Florian Fainelli <[email protected]>
[ Upstream commit 5fc0f21246e50afdf318b5a3a941f7f4f57b8947 ]
Since it became possible for the DSA core to use a CPU port different than 8, our bcm_sf2_imp_setup() function was broken because it assumes that registers are applicable to port 8. In particular, the port's MAC is going to stay disabled, so make sure we clear the RX_DIS and TX_DIS bits if we are not configured for port 8.
--- drivers/net/dsa/bcm_sf2.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-)
drivers/net/dsa/bcm_sf2.c +21 -15
@@ -41,22 +41,11 @@ static void bcm_sf2_imp_setup(struct dsaunsigned int i;u32 reg, offset; -if (priv->type ==BCM7445_DEVICE_ID ) - offset =CORE_STS_OVERRIDE_IMP ; -else - offset =CORE_STS_OVERRIDE_IMP2 ; -/* Enable the port memories */ reg =core_readl (priv,CORE_MEM_PSM_VDD_CTRL ); reg &= ~P_TXQ_PSM_VDD (port);core_writel (priv, reg,CORE_MEM_PSM_VDD_CTRL ); -/* Enable Broadcast, Multicast, Unicast forwarding to IMP port */ - reg =core_readl (priv,CORE_IMP_CTL ); - reg |= (RX_BCST_EN |RX_MCST_EN |RX_UCST_EN ); - reg &= ~(RX_DIS |TX_DIS ); -core_writel (priv, reg,CORE_IMP_CTL ); -/* Enable forwarding */ core_writel (priv,SW_FWDG_EN ,CORE_SWMODE );
@@ -75,10 +64,27 @@ static void bcm_sf2_imp_setup(struct dsab53_brcm_hdr_setup (ds, port); -/* Force link status for IMP port */ - reg =core_readl (priv, offset); - reg |= (MII_SW_OR |LINK_STS ); -core_writel (priv, reg, offset); +if (port ==8 ) { +if (priv->type ==BCM7445_DEVICE_ID ) + offset =CORE_STS_OVERRIDE_IMP ; +else + offset =CORE_STS_OVERRIDE_IMP2 ; + +/* Force link status for IMP port */ + reg =core_readl (priv, offset); + reg |= (MII_SW_OR |LINK_STS ); +core_writel (priv, reg, offset); + +/* Enable Broadcast, Multicast, Unicast forwarding to IMP port */ + reg =core_readl (priv,CORE_IMP_CTL ); + reg |= (RX_BCST_EN |RX_MCST_EN |RX_UCST_EN ); + reg &= ~(RX_DIS |TX_DIS ); +core_writel (priv, reg,CORE_IMP_CTL ); + }else { + reg =core_readl (priv,CORE_G_PCTL_PORT (port)); + reg &= ~(RX_DIS |TX_DIS ); +core_writel (priv, reg,CORE_G_PCTL_PORT (port)); + } }static void bcm_sf2_gphy_enable_set (struct dsa_switch *ds,bool enable)
Greg Kroah-Hartman
maintainerPATCH 44/79 net: ethernet: ftgmac100: Fix DMA coherency issue with SW checksum
In reply to Greg Kroah-HartmanFrom: Benjamin Herrenschmidt <[email protected]>
[ Upstream commit 88824e3bf29a2fcacfd9ebbfe03063649f0f3254 ]
We are calling the checksum helper after the dma_map_single() call to map the packet. This is incorrect as the checksumming code will touch the packet from the CPU. This means the cache won't be properly flushes (or the bounce buffering will leave us with the unmodified packet to DMA).
This moves the calculation of the checksum & vlan tags to before the DMA mapping.
This also has the side effect of fixing another bug: If the checksum helper fails, we goto "drop" to drop the packet, which will not unmap the DMA mapping.
--- drivers/net/ethernet/faraday/ftgmac100.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-)
drivers/net/ethernet/faraday/ftgmac100.c +12 -13
@@ -739,6 +739,18 @@ static int ftgmac100_hard_start_xmit(str*/ nfrags =skb_shinfo (skb)->nr_frags; +/* Setup HW checksumming */ + csum_vlan =0 ; +if (skb->ip_summed ==CHECKSUM_PARTIAL && + !ftgmac100_prep_tx_csum (skb, &csum_vlan)) + goto drop; + +/* Add VLAN tag */ +if (skb_vlan_tag_present (skb)) { + csum_vlan |=FTGMAC100_TXDES1_INS_VLANTAG ; + csum_vlan |=skb_vlan_tag_get (skb) &0xffff ; + } +/* Get header len */ len =skb_headlen (skb);
@@ -765,19 +777,6 @@ static int ftgmac100_hard_start_xmit(strif (nfrags ==0 ) f_ctl_stat |=FTGMAC100_TXDES0_LTS ; txdes->txdes3 =cpu_to_le32 (map); - -/* Setup HW checksumming */ - csum_vlan =0 ; -if (skb->ip_summed ==CHECKSUM_PARTIAL && - !ftgmac100_prep_tx_csum (skb, &csum_vlan)) - goto drop; - -/* Add VLAN tag */ -if (skb_vlan_tag_present (skb)) { - csum_vlan |=FTGMAC100_TXDES1_INS_VLANTAG ; - csum_vlan |=skb_vlan_tag_get (skb) &0xffff ; - } - txdes->txdes1 =cpu_to_le32 (csum_vlan);/* Next descriptor */
Greg Kroah-Hartman
maintainerPATCH 45/79 net: fix sk_page_frag() recursion from memory reclaim
In reply to Greg Kroah-HartmanFrom: Tejun Heo <[email protected]>
[ Upstream commit 20eb4f29b60286e0d6dc01d9c260b4bd383c58fb ]
sk_page_frag() optimizes skb_frag allocations by using per-task skb_frag cache when it knows it's the only user. The condition is determined by seeing whether the socket allocation mask allows blocking - if the allocation may block, it obviously owns the task's context and ergo exclusively owns current->task_frag.
Unfortunately, this misses recursion through memory reclaim path. Please take a look at the following backtrace.
[2] RIP: 0010:tcp_sendmsg_locked+0xccf/0xe10
...
tcp_sendmsg+0x27/0x40
sock_sendmsg+0x30/0x40
sock_xmit.isra.24+0xa1/0x170 [nbd]
nbd_send_cmd+0x1d2/0x690 [nbd]
nbd_queue_rq+0x1b5/0x3b0 [nbd]
__blk_mq_try_issue_directly+0x108/0x1b0
blk_mq_request_issue_directly+0xbd/0xe0
blk_mq_try_issue_list_directly+0x41/0xb0
blk_mq_sched_insert_requests+0xa2/0xe0
blk_mq_flush_plug_list+0x205/0x2a0
blk_flush_plug_list+0xc3/0xf0
[1] blk_finish_plug+0x21/0x2e
_xfs_buf_ioapply+0x313/0x460
__xfs_buf_submit+0x67/0x220
xfs_buf_read_map+0x113/0x1a0
xfs_trans_read_buf_map+0xbf/0x330
xfs_btree_read_buf_block.constprop.42+0x95/0xd0
xfs_btree_lookup_get_block+0x95/0x170
xfs_btree_lookup+0xcc/0x470
xfs_bmap_del_extent_real+0x254/0x9a0
__xfs_bunmapi+0x45c/0xab0
xfs_bunmapi+0x15/0x30
xfs_itruncate_extents_flags+0xca/0x250
xfs_free_eofblocks+0x181/0x1e0
xfs_fs_destroy_inode+0xa8/0x1b0
destroy_inode+0x38/0x70
dispose_list+0x35/0x50
prune_icache_sb+0x52/0x70
super_cache_scan+0x120/0x1a0
do_shrink_slab+0x120/0x290
shrink_slab+0x216/0x2b0
shrink_node+0x1b6/0x4a0
do_try_to_free_pages+0xc6/0x370
try_to_free_mem_cgroup_pages+0xe3/0x1e0
try_charge+0x29e/0x790
mem_cgroup_charge_skmem+0x6a/0x100
__sk_mem_raise_allocated+0x18e/0x390
__sk_mem_schedule+0x2a/0x40
[0] tcp_sendmsg_locked+0x8eb/0xe10
tcp_sendmsg+0x27/0x40
sock_sendmsg+0x30/0x40
___sys_sendmsg+0x26d/0x2b0
__sys_sendmsg+0x57/0xa0
do_syscall_64+0x42/0x100
entry_SYSCALL_64_after_hwframe+0x44/0xa9In [0], tcp_send_msg_locked() was using current->page_frag when it called sk_wmem_schedule(). It already calculated how many bytes can be fit into current->page_frag. Due to memory pressure, sk_wmem_schedule() called into memory reclaim path which called into xfs and then IO issue path. Because the filesystem in question is backed by nbd, the control goes back into the tcp layer - back into tcp_sendmsg_locked().
nbd sets sk_allocation to (GFP_NOIO | __GFP_MEMALLOC) which makes sense - it's in the process of freeing memory and wants to be able to, e.g., drop clean pages to make forward progress. However, this confused sk_page_frag() called from [2]. Because it only tests whether the allocation allows blocking which it does, it now thinks current->page_frag can be used again although it already was being used in [0].
After [2] used current->page_frag, the offset would be increased by the used amount. When the control returns to [0], current->page_frag's offset is increased and the previously calculated number of bytes now may overrun the end of allocated memory leading to silent memory corruptions.
Fix it by adding gfpflags_normal_context() which tests sleepable && !reclaim and use it to determine whether to use current->task_frag.
v2: Eric didn't like gfp flags being tested twice. Introduce a new
helper gfpflags_normal_context() and combine the two tests.
--- include/linux/gfp.h | 23 +++++++++++++++++++++++ include/net/sock.h | 11 ++++++++--- 2 files changed, 31 insertions(+), 3 deletions(-)
include/linux/gfp.h +23 -0
@@ -325,6 +325,29 @@ static inline bool gfpflags_allow_blockireturn !!(gfp_flags & __GFP_DIRECT_RECLAIM); } +/** +* gfpflags_normal_context - is gfp_flags a normal sleepable context? +* @gfp_flags: gfp_flags to test +* +* Test whether @gfp_flags indicates that the allocation is from the +* %current context and allowed to sleep. +* +* An allocation being allowed to block doesn't mean it owns the %current +* context. When direct reclaim path tries to allocate memory, the +* allocation context is nested inside whatever %current was doing at the +* time of the original allocation. The nested allocation may be allowed +* to block but modifying anything %current owns can corrupt the outer +* context's expectations. +* +* %true result from this function indicates that the allocation context +* can sleep and use anything that's associated with %current. +*/ +static inline bool gfpflags_normal_context (const gfp_t gfp_flags) +{ +return (gfp_flags & (__GFP_DIRECT_RECLAIM | __GFP_MEMALLOC)) == + __GFP_DIRECT_RECLAIM; +} +#ifdef CONFIG_HIGHMEM #define OPT_ZONE_HIGHMEM ZONE_HIGHMEM#else
include/net/sock.h +8 -3
@@ -2216,12 +2216,17 @@ struct sk_buff *sk_stream_alloc_skb(stru* sk_page_frag - return an appropriate page_frag * @sk: socket * -* If socket allocation mode allows current thread to sleep, it means its -* safe to use the per task page_frag instead of the per socket one. +* Use the per task page_frag instead of the per socket one for +* optimization when we know that we're in the normal context and owns +* everything that's associated with %current. +* +* gfpflags_allow_blocking() isn't enough here as direct reclaim may nest +* inside other socket operations and end up recursing into sk_page_frag() +* while it's already in use. */ static inline struct page_frag *sk_page_frag (struct sock *sk) { -if (gfpflags_allow_blocking (sk->sk_allocation)) +if (gfpflags_normal_context (sk->sk_allocation))return ¤t->task_frag;return &sk->sk_frag;
Greg Kroah-Hartman
maintainerPATCH 46/79 net: hisilicon: Fix ping latency when deal with high throughput
In reply to Greg Kroah-HartmanFrom: Jiangfeng Xiao <[email protected]>
[ Upstream commit e56bd641ca61beb92b135298d5046905f920b734 ]
This is due to error in over budget processing.
When dealing with high throughput, the used buffers
that exceeds the budget is not cleaned up. In addition, it takes a lot of cycles to clean up the used buffer,
and then the buffer where the valid data is located can take effect.
--- drivers/net/ethernet/hisilicon/hip04_eth.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/net/ethernet/hisilicon/hip04_eth.c +9 -6
@@ -174,6 +174,7 @@ struct hip04_priv {dma_addr_t rx_phys[RX_DESC_NUM ];unsigned int rx_head;unsigned int rx_buf_size; +unsigned int rx_cnt_remaining;struct device_node *phy_node;struct phy_device *phy;
@@ -487,7 +488,6 @@ static int hip04_rx_poll(struct napi_str struct hip04_priv *priv = container_of(napi, struct hip04_priv, napi);struct net_device *ndev = priv->ndev;struct net_device_stats *stats = &ndev->stats; -unsigned int cnt =hip04_recv_cnt (priv);struct rx_desc *desc;struct sk_buff *skb;unsigned char *buf;
@@ -500,8 +500,8 @@ static int hip04_rx_poll(struct napi_str/* clean up tx descriptors */ tx_remaining =hip04_tx_reclaim (ndev, false); - -while (cnt && !last) { + priv->rx_cnt_remaining +=hip04_recv_cnt (priv); +while (priv->rx_cnt_remaining && !last) { buf = priv->rx_buf[priv->rx_head]; skb =build_skb (buf, priv->rx_buf_size);if (unlikely (!skb)) {
@@ -547,11 +547,13 @@ refill:hip04_set_recv_desc (priv, phys); priv->rx_head =RX_NEXT (priv->rx_head); -if (rx >= budget) +if (rx >= budget) { + --priv->rx_cnt_remaining; goto done; + } -if (--cnt ==0 ) - cnt =hip04_recv_cnt (priv); +if (--priv->rx_cnt_remaining ==0 ) + priv->rx_cnt_remaining +=hip04_recv_cnt (priv); }if (!(priv->reg_inten &RCV_INT )) {
@@ -636,6 +638,7 @@ static int hip04_mac_open(struct net_devint i; priv->rx_head =0 ; + priv->rx_cnt_remaining =0 ; priv->tx_head =0 ; priv->tx_tail =0 ;hip04_reset_ppe (priv);
Greg Kroah-Hartman
maintainerPATCH 47/79 net/mlx4_core: Dynamically set guaranteed amount of counters per VF
In reply to Greg Kroah-HartmanFrom: Eran Ben Elisha <[email protected]>
[ Upstream commit e19868efea0c103f23b4b7e986fd0a703822111f ]
Prior to this patch, the amount of counters guaranteed per VF in the resource tracker was MLX4_VF_COUNTERS_PER_PORT * MLX4_MAX_PORTS. It was set regardless if the VF was single or dual port.
This caused several VFs to have no guaranteed counters although the system could satisfy their request.
The fix is to dynamically guarantee counters, based on each VF specification.
--- drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | 42 +++++++++++------- 1 file changed, 26 insertions(+), 16 deletions(-)
drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +26 -16
@@ -471,12 +471,31 @@ void mlx4_init_quotas(struct mlx4_dev *d priv->mfunc.master.res_tracker.res_alloc[RES_MPT ].quota[pf]; } -static int get_max_gauranteed_vfs_counter (struct mlx4_dev *dev) +static int +mlx4_calc_res_counter_guaranteed (struct mlx4_dev *dev, +struct resource_allocator *res_alloc, +int vf) { -/* reduce the sink counter */ -return (dev->caps.max_counters -1 - - (MLX4_PF_COUNTERS_PER_PORT *MLX4_MAX_PORTS )) - /MLX4_MAX_PORTS ; +struct mlx4_active_ports actv_ports; +int ports, counters_guaranteed; + +/* For master, only allocate according to the number of phys ports */ +if (vf ==mlx4_master_func_num (dev)) +return MLX4_PF_COUNTERS_PER_PORT * dev->caps.num_ports; + +/* calculate real number of ports for the VF */ + actv_ports =mlx4_get_active_ports (dev, vf); + ports =bitmap_weight (actv_ports.ports, dev->caps.num_ports); + counters_guaranteed = ports *MLX4_VF_COUNTERS_PER_PORT ; + +/* If we do not have enough counters for this VF, do not +* allocate any for it. '-1' to reduce the sink counter. +*/ +if ((res_alloc->res_reserved + counters_guaranteed) > + (dev->caps.max_counters -1 )) +return 0 ; + +return counters_guaranteed; }int mlx4_init_resource_tracker (struct mlx4_dev *dev)
@@ -484,7 +503,6 @@ int mlx4_init_resource_tracker(struct mlstruct mlx4_priv *priv =mlx4_priv (dev);int i, j;int t; -int max_vfs_guarantee_counter =get_max_gauranteed_vfs_counter (dev); priv->mfunc.master.res_tracker.slave_list = kcalloc(dev->num_slaves, sizeof(struct slave_list),
@@ -603,16 +621,8 @@ int mlx4_init_resource_tracker(struct mlbreak ;case RES_COUNTER : res_alloc->quota[t] = dev->caps.max_counters; -if (t ==mlx4_master_func_num (dev)) - res_alloc->guaranteed[t] = -MLX4_PF_COUNTERS_PER_PORT * -MLX4_MAX_PORTS ; -else if (t <= max_vfs_guarantee_counter) - res_alloc->guaranteed[t] = -MLX4_VF_COUNTERS_PER_PORT * -MLX4_MAX_PORTS ; -else - res_alloc->guaranteed[t] =0 ; + res_alloc->guaranteed[t] = +mlx4_calc_res_counter_guaranteed (dev, res_alloc, t);break ;default :break ;
Greg Kroah-Hartman
maintainerPATCH 48/79 netns: fix GFP flags in rtnl_net_notifyid()
In reply to Greg Kroah-HartmanFrom: Guillaume Nault <[email protected]>
[ Upstream commit d4e4fdf9e4a27c87edb79b1478955075be141f67 ]
In rtnl_net_notifyid(), we certainly can't pass a null GFP flag to rtnl_notify(). A GFP_KERNEL flag would be fine in most circumstances, but there are a few paths calling rtnl_net_notifyid() from atomic context or from RCU critical sections. The later also precludes the use of gfp_any() as it wouldn't detect the RCU case. Also, the nlmsg_new() call is wrong too, as it uses GFP_KERNEL unconditionally.
Therefore, we need to pass the GFP flags as parameter and propagate it through function calls until the proper flags can be determined.
In most cases, GFP_KERNEL is fine. The exceptions are:
* openvswitch: ovs_vport_cmd_get() and ovs_vport_cmd_dump() indirectly call rtnl_net_notifyid() from RCU critical section,
* rtnetlink: rtmsg_ifinfo_build_skb() already receives GFP flags as parameter.
Also, in ovs_vport_cmd_build_info(), let's change the GFP flags used by nlmsg_new(). The function is allowed to sleep, so better make the flags consistent with the ones used in the following ovs_vport_cmd_fill_info() call.
Found by code inspection.
--- include/net/net_namespace.h | 2 +- net/core/dev.c | 2 +- net/core/net_namespace.c | 17 +++++++++-------- net/core/rtnetlink.c | 14 +++++++------- net/openvswitch/datapath.c | 20 +++++++++++--------- 5 files changed, 29 insertions(+), 26 deletions(-)
include/net/net_namespace.h +1 -1
@@ -322,7 +322,7 @@ static inline struct net *read_pnet(cons#define __net_initconst __initconst#endif -int peernet2id_alloc (struct net *net,struct net *peer); +int peernet2id_alloc (struct net *net,struct net *peer,gfp_t gfp);int peernet2id (struct net *net,struct net *peer);bool peernet_has_id (struct net *net,struct net *peer);struct net *get_net_ns_by_id (struct net *net,int id);
net/core/dev.c +1 -1
@@ -9211,7 +9211,7 @@ int dev_change_net_namespace(struct net_call_netdevice_notifiers (NETDEV_UNREGISTER , dev);rcu_barrier (); - new_nsid =peernet2id_alloc (dev_net (dev), net); + new_nsid =peernet2id_alloc (dev_net (dev), net,GFP_KERNEL );/* If there is an ifindex conflict assign a new one */ if (__dev_get_by_index (net, dev->ifindex)) new_ifindex =dev_new_index (net);
net/core/net_namespace.c +9 -8
@@ -226,11 +226,11 @@ static int __peernet2id(struct net *net,return __peernet2id_alloc (net, peer, &no); } -static void rtnl_net_notifyid (struct net *net,int cmd,int id); +static void rtnl_net_notifyid (struct net *net,int cmd,int id,gfp_t gfp);/* This function returns the id of a peer netns. If no id is assigned, one will * be allocated and returned. */ -int peernet2id_alloc (struct net *net,struct net *peer) +int peernet2id_alloc (struct net *net,struct net *peer,gfp_t gfp) {bool alloc = false, alive = false;int id;
@@ -249,7 +249,7 @@ int peernet2id_alloc(struct net *net, st id =__peernet2id_alloc (net, peer, &alloc);spin_unlock_bh (&net->nsid_lock);if (alloc && id >=0 ) -rtnl_net_notifyid (net,RTM_NEWNSID , id); +rtnl_net_notifyid (net,RTM_NEWNSID , id, gfp);if (alive)put_net (peer);return id;
@@ -495,7 +495,8 @@ static void unhash_nsid(struct net *net,idr_remove (&tmp->netns_ids, id);spin_unlock_bh (&tmp->nsid_lock);if (id >=0 ) -rtnl_net_notifyid (tmp,RTM_DELNSID , id); +rtnl_net_notifyid (tmp,RTM_DELNSID , id, +GFP_KERNEL );if (tmp == last)break ; }
@@ -720,7 +721,7 @@ static int rtnl_net_newid(struct sk_buff err =alloc_netid (net, peer, nsid);spin_unlock_bh (&net->nsid_lock);if (err >=0 ) { -rtnl_net_notifyid (net,RTM_NEWNSID , err); +rtnl_net_notifyid (net,RTM_NEWNSID , err,GFP_KERNEL ); err =0 ; }else if (err == -ENOSPC && nsid >=0 ) { err = -EEXIST ;
@@ -862,12 +863,12 @@ static int rtnl_net_dumpid(struct sk_bufreturn skb->len; } -static void rtnl_net_notifyid (struct net *net,int cmd,int id) +static void rtnl_net_notifyid (struct net *net,int cmd,int id,gfp_t gfp) {struct sk_buff *msg;int err = -ENOMEM ; - msg =nlmsg_new (rtnl_net_get_size (),GFP_KERNEL ); + msg =nlmsg_new (rtnl_net_get_size (), gfp);if (!msg) goto out;
@@ -875,7 +876,7 @@ static void rtnl_net_notifyid(struct netif (err <0 ) goto err_out; -rtnl_notify (msg, net,0 ,RTNLGRP_NSID ,NULL ,0 ); +rtnl_notify (msg, net,0 ,RTNLGRP_NSID ,NULL , gfp);return ; err_out:
net/core/rtnetlink.c +7 -7
@@ -1519,7 +1519,7 @@ static noinline_for_stack int nla_put_ifstatic int rtnl_fill_link_netnsid (struct sk_buff *skb,const struct net_device *dev, -struct net *src_net) +struct net *src_net,gfp_t gfp) {bool put_iflink = false;
@@ -1527,7 +1527,7 @@ static int rtnl_fill_link_netnsid(structstruct net *link_net = dev->rtnl_link_ops->get_link_net (dev);if (!net_eq (dev_net (dev), link_net)) { -int id =peernet2id_alloc (src_net, link_net); +int id =peernet2id_alloc (src_net, link_net, gfp);if (nla_put_s32 (skb,IFLA_LINK_NETNSID , id))return -EMSGSIZE ;
@@ -1585,7 +1585,7 @@ static int rtnl_fill_ifinfo(struct sk_bu int type, u32 pid, u32 seq, u32 change, unsigned int flags, u32 ext_filter_mask, u32 event, int *new_nsid, int new_ifindex, - int tgt_netnsid) + int tgt_netnsid, gfp_t gfp) { struct ifinfomsg *ifm;struct nlmsghdr *nlh;
@@ -1677,7 +1677,7 @@ static int rtnl_fill_ifinfo(struct sk_bu goto nla_put_failure; } -if (rtnl_fill_link_netnsid (skb, dev, src_net)) +if (rtnl_fill_link_netnsid (skb, dev, src_net, gfp)) goto nla_put_failure; if (new_nsid &&
@@ -1933,7 +1933,7 @@ static int rtnl_dump_ifinfo(struct sk_bu cb->nlh->nlmsg_seq,0 , flags, ext_filter_mask,0 ,NULL ,0 , - netnsid); + netnsid, GFP_KERNEL);if (err <0 ) {if (likely (skb->len))
@@ -3215,7 +3215,7 @@ static int rtnl_getlink(struct sk_buff * err =rtnl_fill_ifinfo (nskb, dev, net,RTM_NEWLINK ,NETLINK_CB (skb).portid, nlh->nlmsg_seq,0 ,0 , ext_filter_mask, -0 ,NULL ,0 , netnsid); +0 ,NULL ,0 , netnsid,GFP_KERNEL );if (err <0 ) {/* -EMSGSIZE implies BUG in if_nlmsg_size */ WARN_ON (err == -EMSGSIZE );
@@ -3325,7 +3325,7 @@ struct sk_buff *rtmsg_ifinfo_build_skb(i err =rtnl_fill_ifinfo (skb, dev,dev_net (dev), type,0 ,0 , change,0 ,0 , event, - new_nsid, new_ifindex,-1 ); + new_nsid, new_ifindex,-1 , flags);if (err <0 ) {/* -EMSGSIZE implies BUG in if_nlmsg_size() */ WARN_ON (err == -EMSGSIZE );
net/openvswitch/datapath.c +11 -9
@@ -1843,7 +1843,7 @@ static struct genl_family dp_datapath_ge/* Called with ovs_mutex or RCU read lock. */ static int ovs_vport_cmd_fill_info (struct vport *vport,struct sk_buff *skb,struct net *net,u32 portid,u32 seq, -u32 flags,u8 cmd) +u32 flags,u8 cmd,gfp_t gfp) {struct ovs_header *ovs_header;struct ovs_vport_stats vport_stats;
@@ -1864,7 +1864,7 @@ static int ovs_vport_cmd_fill_info(struc goto nla_put_failure;if (!net_eq (net,dev_net (vport->dev))) { -int id =peernet2id_alloc (net,dev_net (vport->dev)); +int id =peernet2id_alloc (net,dev_net (vport->dev), gfp);if (nla_put_s32 (skb,OVS_VPORT_ATTR_NETNSID , id)) goto nla_put_failure;
@@ -1905,11 +1905,12 @@ struct sk_buff *ovs_vport_cmd_build_infostruct sk_buff *skb;int retval; - skb =nlmsg_new (NLMSG_DEFAULT_SIZE ,GFP_ATOMIC ); + skb =nlmsg_new (NLMSG_DEFAULT_SIZE ,GFP_KERNEL );if (!skb)return ERR_PTR (-ENOMEM ); - retval =ovs_vport_cmd_fill_info (vport, skb, net, portid, seq,0 , cmd); + retval =ovs_vport_cmd_fill_info (vport, skb, net, portid, seq,0 , cmd, +GFP_KERNEL );BUG_ON (retval <0 );return skb;
@@ -2042,7 +2043,7 @@ restart: err =ovs_vport_cmd_fill_info (vport, reply,genl_info_net (info), info->snd_portid, info->snd_seq,0 , -OVS_VPORT_CMD_NEW ); +OVS_VPORT_CMD_NEW ,GFP_KERNEL );if (netdev_get_fwd_headroom (vport->dev) > dp->max_headroom)update_headroom (dp);
@@ -2101,7 +2102,7 @@ static int ovs_vport_cmd_set(struct sk_b err =ovs_vport_cmd_fill_info (vport, reply,genl_info_net (info), info->snd_portid, info->snd_seq,0 , -OVS_VPORT_CMD_NEW ); +OVS_VPORT_CMD_NEW ,GFP_ATOMIC );BUG_ON (err <0 );ovs_unlock ();
@@ -2140,7 +2141,7 @@ static int ovs_vport_cmd_del(struct sk_b err =ovs_vport_cmd_fill_info (vport, reply,genl_info_net (info), info->snd_portid, info->snd_seq,0 , -OVS_VPORT_CMD_DEL ); +OVS_VPORT_CMD_DEL ,GFP_KERNEL );BUG_ON (err <0 );/* the vport deletion may trigger dp headroom update */
@@ -2182,7 +2183,7 @@ static int ovs_vport_cmd_get(struct sk_b goto exit_unlock_free; err =ovs_vport_cmd_fill_info (vport, reply,genl_info_net (info), info->snd_portid, info->snd_seq,0 , -OVS_VPORT_CMD_NEW ); +OVS_VPORT_CMD_NEW ,GFP_ATOMIC );BUG_ON (err <0 );rcu_read_unlock ();
@@ -2218,7 +2219,8 @@ static int ovs_vport_cmd_dump(struct sk_NETLINK_CB (cb->skb).portid, cb->nlh->nlmsg_seq,NLM_F_MULTI , - OVS_VPORT_CMD_NEW) < 0) +OVS_VPORT_CMD_NEW , + GFP_ATOMIC) < 0) goto out; j++;
Greg Kroah-Hartman
maintainerPATCH 49/79 net: usb: lan78xx: Disable interrupts before calling generic_handle_irq()
In reply to Greg Kroah-HartmanFrom: Daniel Wagner <[email protected]>
[ Upstream commit 0a29ac5bd3a988dc151c8d26910dec2557421f64 ]
lan78xx_status() will run with interrupts enabled due to the change in ed194d136769 ("usb: core: remove local_irq_save() around ->complete() handler"). generic_handle_irq() expects to be run with IRQs disabled.
[ 4.886203] 000: irq 79 handler irq_default_primary_handler+0x0/0x8 enabled interrupts [ 4.886243] 000: WARNING: CPU: 0 PID: 0 at kernel/irq/handle.c:152 __handle_irq_event_percpu+0x154/0x168 [ 4.896294] 000: Modules linked in: [ 4.896301] 000: CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.3.6 #39 [ 4.896310] 000: Hardware name: Raspberry Pi 3 Model B+ (DT) [ 4.896315] 000: pstate: 60000005 (nZCv daif -PAN -UAO) [ 4.896321] 000: pc : __handle_irq_event_percpu+0x154/0x168 [ 4.896331] 000: lr : __handle_irq_event_percpu+0x154/0x168 [ 4.896339] 000: sp : ffff000010003cc0 [ 4.896346] 000: x29: ffff000010003cc0 x28: 0000000000000060 [ 4.896355] 000: x27: ffff000011021980 x26: ffff00001189c72b [ 4.896364] 000: x25: ffff000011702bc0 x24: ffff800036d6e400 [ 4.896373] 000: x23: 000000000000004f x22: ffff000010003d64 [ 4.896381] 000: x21: 0000000000000000 x20: 0000000000000002 [ 4.896390] 000: x19: ffff8000371c8480 x18: 0000000000000060 [ 4.896398] 000: x17: 0000000000000000 x16: 00000000000000eb [ 4.896406] 000: x15: ffff000011712d18 x14: 7265746e69206465 [ 4.896414] 000: x13: ffff000010003ba0 x12: ffff000011712df0 [ 4.896422] 000: x11: 0000000000000001 x10: ffff000011712e08 [ 4.896430] 000: x9 : 0000000000000001 x8 : 000000000003c920 [ 4.896437] 000: x7 : ffff0000118cc410 x6 : ffff0000118c7f00 [ 4.896445] 000: x5 : 000000000003c920 x4 : 0000000000004510 [ 4.896453] 000: x3 : ffff000011712dc8 x2 : 0000000000000000 [ 4.896461] 000: x1 : 73a3f67df94c1500 x0 : 0000000000000000 [ 4.896466] 000: Call trace: [ 4.896471] 000: __handle_irq_event_percpu+0x154/0x168 [ 4.896481] 000: handle_irq_event_percpu+0x50/0xb0 [ 4.896489] 000: handle_irq_event+0x40/0x98 [ 4.896497] 000: handle_simple_irq+0xa4/0xf0 [ 4.896505] 000: generic_handle_irq+0x24/0x38 [ 4.896513] 000: intr_complete+0xb0/0xe0 [ 4.896525] 000: __usb_hcd_giveback_urb+0x58/0xd8 [ 4.896533] 000: usb_giveback_urb_bh+0xd0/0x170 [ 4.896539] 000: tasklet_action_common.isra.0+0x9c/0x128 [ 4.896549] 000: tasklet_hi_action+0x24/0x30 [ 4.896556] 000: __do_softirq+0x120/0x23c [ 4.896564] 000: irq_exit+0xb8/0xd8 [ 4.896571] 000: __handle_domain_irq+0x64/0xb8 [ 4.896579] 000: bcm2836_arm_irqchip_handle_irq+0x60/0xc0 [ 4.896586] 000: el1_irq+0xb8/0x140 [ 4.896592] 000: arch_cpu_idle+0x10/0x18 [ 4.896601] 000: do_idle+0x200/0x280 [ 4.896608] 000: cpu_startup_entry+0x20/0x28 [ 4.896615] 000: rest_init+0xb4/0xc0 [ 4.896623] 000: arch_call_rest_init+0xc/0x14 [ 4.896632] 000: start_kernel+0x454/0x480
--- drivers/net/usb/lan78xx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/usb/lan78xx.c +4 -1
@@ -1278,8 +1278,11 @@ static void lan78xx_status(struct lan78xnetif_dbg (dev, link, dev->net,"PHY INTR: 0x%08x\n" , intdata);lan78xx_defer_kevent (dev,EVENT_LINK_RESET ); -if (dev->domain_data.phyirq >0 ) +if (dev->domain_data.phyirq >0 ) { +local_irq_disable ();generic_handle_irq (dev->domain_data.phyirq); +local_irq_enable (); + } }else netdev_warn (dev->net,"unexpected interrupt: 0x%08x\n" , intdata);
Greg Kroah-Hartman
maintainerPATCH 50/79 net: Zeroing the structure ethtool_wolinfo in ethtool_get_wol()
In reply to Greg Kroah-HartmanFrom: zhanglin <[email protected]>
[ Upstream commit 5ff223e86f5addbfae26419cbb5d61d98f6fbf7d ]
memset() the structure ethtool_wolinfo that has padded bytes but the padded bytes have not been zeroed out.
--- net/core/ethtool.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/core/ethtool.c +3 -1
@@ -1482,11 +1482,13 @@ static int ethtool_reset(struct net_devistatic int ethtool_get_wol (struct net_device *dev,char __user *useraddr) { -struct ethtool_wolinfo wol = { .cmd =ETHTOOL_GWOL }; +struct ethtool_wolinfo wol;if (!dev->ethtool_ops->get_wol)return -EOPNOTSUPP ; +memset (&wol,0 ,sizeof (struct ethtool_wolinfo )); + wol.cmd =ETHTOOL_GWOL ; dev->ethtool_ops->get_wol (dev, &wol);if (copy_to_user (useraddr, &wol,sizeof (wol)))
Greg Kroah-Hartman
maintainerPATCH 51/79 selftests: net: reuseport_dualstack: fix uninitalized parameter
In reply to Greg Kroah-HartmanFrom: Wei Wang <[email protected]>
[ Upstream commit d64479a3e3f9924074ca7b50bd72fa5211dca9c1 ]
This test reports EINVAL for getsockopt(SOL_SOCKET, SO_DOMAIN) occasionally due to the uninitialized length parameter. Initialize it to fix this, and also use int for "test_family" to comply with the API standard.
--- tools/testing/selftests/net/reuseport_dualstack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/net/reuseport_dualstack.c +2 -1
@@ -129,7 +129,7 @@ static void test(int *rcv_fds, int count {struct epoll_event ev;int epfd, i, test_fd; -uint16_t test_family; +int test_family;socklen_t len; epfd =epoll_create (1 );
@@ -146,6 +146,7 @@ static void test(int *rcv_fds, int countsend_from_v4 (proto); test_fd =receive_once (epfd, proto); + len =sizeof (test_family);if (getsockopt (test_fd,SOL_SOCKET ,SO_DOMAIN , &test_family, &len))error (1 , errno,"failed to read socket domain" );if (test_family !=AF_INET )
Greg Kroah-Hartman
maintainerPATCH 52/79 udp: fix data-race in udp_set_dev_scratch()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit a793183caa9afae907a0d7ddd2ffd57329369bf5 ]
KCSAN reported a data-race in udp_set_dev_scratch() [1]
The issue here is that we must not write over skb fields if skb is shared. A similar issue has been fixed in commit 89c22d8c3b27 ("net: Fix skb csum races when peeking")
While we are at it, use a helper only dealing with udp_skb_scratch(skb)->csum_unnecessary, as this allows udp_set_dev_scratch() to be called once and thus inlined.
[1]
BUG: KCSAN: data-race in udp_set_dev_scratch / udpv6_recvmsg
write to 0xffff888120278317 of 1 bytes by task 10411 on cpu 1:
udp_set_dev_scratch+0xea/0x200 net/ipv4/udp.c:1308 __first_packet_length+0x147/0x420 net/ipv4/udp.c:1556 first_packet_length+0x68/0x2a0 net/ipv4/udp.c:1579 udp_poll+0xea/0x110 net/ipv4/udp.c:2720 sock_poll+0xed/0x250 net/socket.c:1256 vfs_poll include/linux/poll.h:90 [inline] do_select+0x7d0/0x1020 fs/select.c:534 core_sys_select+0x381/0x550 fs/select.c:677 do_pselect.constprop.0+0x11d/0x160 fs/select.c:759 __do_sys_pselect6 fs/select.c:784 [inline] __se_sys_pselect6 fs/select.c:769 [inline] __x64_sys_pselect6+0x12e/0x170 fs/select.c:769 do_syscall_64+0xcc/0x370 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x44/0xa9
read to 0xffff888120278317 of 1 bytes by task 10413 on cpu 0:
udp_skb_csum_unnecessary include/net/udp.h:358 [inline] udpv6_recvmsg+0x43e/0xe90 net/ipv6/udp.c:310 inet6_recvmsg+0xbb/0x240 net/ipv6/af_inet6.c:592 sock_recvmsg_nosec+0x5c/0x70 net/socket.c:871 ___sys_recvmsg+0x1a0/0x3e0 net/socket.c:2480 do_recvmmsg+0x19a/0x5c0 net/socket.c:2601 __sys_recvmmsg+0x1ef/0x200 net/socket.c:2680 __do_sys_recvmmsg net/socket.c:2703 [inline] __se_sys_recvmmsg net/socket.c:2696 [inline] __x64_sys_recvmmsg+0x89/0xb0 net/socket.c:2696 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: 10413 Comm: syz-executor.0 Not tainted 5.4.0-rc3+ #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
--- net/ipv4/udp.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
net/ipv4/udp.c +15 -4
@@ -1270,6 +1270,20 @@ static void udp_set_dev_scratch(struct s scratch->_tsize_state |=UDP_SKB_IS_STATELESS ; } +static void udp_skb_csum_unnecessary_set (struct sk_buff *skb) +{ +/* We come here after udp_lib_checksum_complete() returned 0. +* This means that __skb_checksum_complete() might have +* set skb->csum_valid to 1. +* On 64bit platforms, we can set csum_unnecessary +* to true, but only if the skb is not shared. +*/ +#if BITS_PER_LONG ==64 +if (!skb_shared (skb)) +udp_skb_scratch (skb)->csum_unnecessary = true; +#endif +} +static int udp_skb_truesize (struct sk_buff *skb) {return udp_skb_scratch (skb)->_tsize_state & ~UDP_SKB_IS_STATELESS ;
@@ -1504,10 +1518,7 @@ static struct sk_buff *__first_packet_le *total += skb->truesize;kfree_skb (skb); }else { -/* the csum related bits could be changed, refresh -* the scratch area -*/ -udp_set_dev_scratch (skb); +udp_skb_csum_unnecessary_set (skb);break ; } }
Greg Kroah-Hartman
maintainerPATCH 53/79 vxlan: check tun_info options_len properly
In reply to Greg Kroah-HartmanFrom: Xin Long <[email protected]>
[ Upstream commit eadf52cf1852196a1363044dcda22fa5d7f296f7 ]
This patch is to improve the tun_info options_len by dropping the skb when TUNNEL_VXLAN_OPT is set but options_len is less than vxlan_metadata. This can void a potential out-of-bounds access on ip_tun_info.
--- drivers/net/vxlan.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/vxlan.c +4 -2
@@ -2174,9 +2174,11 @@ static void vxlan_xmit_one(struct sk_buf vni =tunnel_id_to_key32 (info->key.tun_id); ifindex =0 ; dst_cache = &info->dst_cache; -if (info->options_len && - info->key.tun_flags &TUNNEL_VXLAN_OPT ) +if (info->key.tun_flags &TUNNEL_VXLAN_OPT ) { +if (info->options_len <sizeof (*md)) + goto drop; md =ip_tunnel_info_opts (info); + } ttl = info->key.ttl; tos = info->key.tos; label = info->key.label;
Greg Kroah-Hartman
maintainerPATCH 54/79 net: add skb_queue_empty_lockless()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit d7d16a89350ab263484c0aa2b523dd3a234e4a80 ]
Some paths call skb_queue_empty() without holding the queue lock. We must use a barrier in order to not let the compiler do strange things, and avoid KCSAN splats.
Adding a barrier in skb_queue_empty() might be overkill, I prefer adding a new helper to clearly identify points where the callers might be lockless. This might help us finding real bugs.
The corresponding WRITE_ONCE() should add zero cost for current compilers.
--- include/linux/skbuff.h | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-)
include/linux/skbuff.h +24 -9
@@ -1380,6 +1380,19 @@ static inline int skb_queue_empty(const }/** +* skb_queue_empty_lockless - check if a queue is empty +* @list: queue head +* +* Returns true if the queue is empty, false otherwise. +* This variant can be used in lockless contexts. +*/ +static inline bool skb_queue_empty_lockless (const struct sk_buff_head *list) +{ +return READ_ONCE (list->next) == (const struct sk_buff *) list; +} + + +/** * skb_queue_is_last - check if skb is the last entry in the queue * @list: queue head * @skb: buffer
@@ -1723,9 +1736,11 @@ static inline void __skb_insert(struct s struct sk_buff *prev, struct sk_buff *next, struct sk_buff_head *list) { - newsk->next = next; - newsk->prev = prev; - next->prev = prev->next = newsk; +/* see skb_queue_empty_lockless() for the opposite READ_ONCE() */ + WRITE_ONCE(newsk->next, next); +WRITE_ONCE (newsk->prev, prev); +WRITE_ONCE (next->prev, newsk); +WRITE_ONCE (prev->next, newsk); list->qlen++; }
@@ -1736,11 +1751,11 @@ static inline void __skb_queue_splice(costruct sk_buff *first = list->next;struct sk_buff *last = list->prev; - first->prev = prev; - prev->next = first; +WRITE_ONCE (first->prev, prev); +WRITE_ONCE (prev->next, first); - last->next = next; - next->prev = last; +WRITE_ONCE (last->next, next); +WRITE_ONCE (next->prev, last); }/**
@@ -1881,8 +1896,8 @@ static inline void __skb_unlink(struct s next = skb->next; prev = skb->prev; skb->next = skb->prev =NULL ; - next->prev = prev; - prev->next = next; +WRITE_ONCE (next->prev, prev); +WRITE_ONCE (prev->next, next); }/**
Greg Kroah-Hartman
maintainerPATCH 55/79 udp: use skb_queue_empty_lockless()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 137a0dbe3426fd7bcfe3f8117b36a87b3590e4eb ]
syzbot reported a data-race [1].
We should use skb_queue_empty_lockless() to document that we are not ensuring a mutual exclusion and silence KCSAN.
[1]
BUG: KCSAN: data-race in __skb_recv_udp / __udp_enqueue_schedule_skb
write to 0xffff888122474b50 of 8 bytes by interrupt on cpu 0:
__skb_insert include/linux/skbuff.h:1852 [inline] __skb_queue_before include/linux/skbuff.h:1958 [inline] __skb_queue_tail include/linux/skbuff.h:1991 [inline] __udp_enqueue_schedule_skb+0x2c1/0x410 net/ipv4/udp.c:1470 __udp_queue_rcv_skb net/ipv4/udp.c:1940 [inline] udp_queue_rcv_one_skb+0x7bd/0xc70 net/ipv4/udp.c:2057 udp_queue_rcv_skb+0xb5/0x400 net/ipv4/udp.c:2074 udp_unicast_rcv_skb.isra.0+0x7e/0x1c0 net/ipv4/udp.c:2233 __udp4_lib_rcv+0xa44/0x17c0 net/ipv4/udp.c:2300 udp_rcv+0x2b/0x40 net/ipv4/udp.c:2470 ip_protocol_deliver_rcu+0x4d/0x420 net/ipv4/ip_input.c:204 ip_local_deliver_finish+0x110/0x140 net/ipv4/ip_input.c:231 NF_HOOK include/linux/netfilter.h:305 [inline] NF_HOOK include/linux/netfilter.h:299 [inline] ip_local_deliver+0x133/0x210 net/ipv4/ip_input.c:252 dst_input include/net/dst.h:442 [inline] ip_rcv_finish+0x121/0x160 net/ipv4/ip_input.c:413 NF_HOOK include/linux/netfilter.h:305 [inline] NF_HOOK include/linux/netfilter.h:299 [inline] ip_rcv+0x18f/0x1a0 net/ipv4/ip_input.c:523 __netif_receive_skb_one_core+0xa7/0xe0 net/core/dev.c:5010 __netif_receive_skb+0x37/0xf0 net/core/dev.c:5124 process_backlog+0x1d3/0x420 net/core/dev.c:5955
read to 0xffff888122474b50 of 8 bytes by task 8921 on cpu 1:
skb_queue_empty include/linux/skbuff.h:1494 [inline] __skb_recv_udp+0x18d/0x500 net/ipv4/udp.c:1653 udp_recvmsg+0xe1/0xb10 net/ipv4/udp.c:1712 inet_recvmsg+0xbb/0x250 net/ipv4/af_inet.c:838 sock_recvmsg_nosec+0x5c/0x70 net/socket.c:871 ___sys_recvmsg+0x1a0/0x3e0 net/socket.c:2480 do_recvmmsg+0x19a/0x5c0 net/socket.c:2601 __sys_recvmmsg+0x1ef/0x200 net/socket.c:2680 __do_sys_recvmmsg net/socket.c:2703 [inline] __se_sys_recvmmsg net/socket.c:2696 [inline] __x64_sys_recvmmsg+0x89/0xb0 net/socket.c:2696 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: 1 PID: 8921 Comm: syz-executor.4 Not tainted 5.4.0-rc3+ #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
--- net/ipv4/udp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/ipv4/udp.c +3 -3
@@ -1542,7 +1542,7 @@ static int first_packet_length(struct sospin_lock_bh (&rcvq->lock); skb =__first_packet_length (sk, rcvq, &total); -if (!skb && !skb_queue_empty (sk_queue)) { +if (!skb && !skb_queue_empty_lockless (sk_queue)) {spin_lock (&sk_queue->lock);skb_queue_splice_tail_init (sk_queue, rcvq);spin_unlock (&sk_queue->lock);
@@ -1617,7 +1617,7 @@ struct sk_buff *__skb_recv_udp(struct soreturn skb; } -if (skb_queue_empty (sk_queue)) { +if (skb_queue_empty_lockless (sk_queue)) {spin_unlock_bh (&queue->lock); goto busy_check; }
@@ -1644,7 +1644,7 @@ busy_check:break ;sk_busy_loop (sk, flags &MSG_DONTWAIT ); - }while (!skb_queue_empty (sk_queue)); + }while (!skb_queue_empty_lockless (sk_queue));/* sk_queue is empty, reader_queue may contain peeked packets */ } while (timeo &&
Greg Kroah-Hartman
maintainerPATCH 56/79 net: use skb_queue_empty_lockless() in poll() handlers
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 3ef7cf57c72f32f61e97f8fa401bc39ea1f1a5d4 ]
Many poll() handlers are lockless. Using skb_queue_empty_lockless() instead of skb_queue_empty() is more appropriate.
--- drivers/isdn/capi/capi.c | 2 +- net/atm/common.c | 2 +- net/bluetooth/af_bluetooth.c | 4 ++-- net/caif/caif_socket.c | 2 +- net/core/datagram.c | 4 ++-- net/decnet/af_decnet.c | 2 +- net/ipv4/tcp.c | 2 +- net/ipv4/udp.c | 2 +- net/nfc/llcp_sock.c | 4 ++-- net/phonet/socket.c | 4 ++-- net/sctp/socket.c | 4 ++-- net/tipc/socket.c | 4 ++-- net/unix/af_unix.c | 6 +++--- net/vmw_vsock/af_vsock.c | 2 +- 14 files changed, 22 insertions(+), 22 deletions(-)
drivers/isdn/capi/capi.c +1 -1
@@ -744,7 +744,7 @@ capi_poll(struct file *file, poll_tablepoll_wait (file, &(cdev->recvwait), wait); mask =EPOLLOUT |EPOLLWRNORM ; -if (!skb_queue_empty (&cdev->recvqueue)) +if (!skb_queue_empty_lockless (&cdev->recvqueue)) mask |=EPOLLIN |EPOLLRDNORM ;return mask; }
net/atm/common.c +1 -1
@@ -667,7 +667,7 @@ __poll_t vcc_poll(struct file *file, str mask |=EPOLLHUP ;/* readable? */ -if (!skb_queue_empty (&sk->sk_receive_queue)) +if (!skb_queue_empty_lockless (&sk->sk_receive_queue)) mask |=EPOLLIN |EPOLLRDNORM ;/* writable? */
net/bluetooth/af_bluetooth.c +2 -2
@@ -460,7 +460,7 @@ __poll_t bt_sock_poll(struct file *file,if (sk->sk_state ==BT_LISTEN )return bt_accept_poll (sk); -if (sk->sk_err || !skb_queue_empty (&sk->sk_error_queue)) +if (sk->sk_err || !skb_queue_empty_lockless (&sk->sk_error_queue)) mask |=EPOLLERR | (sock_flag (sk,SOCK_SELECT_ERR_QUEUE ) ?EPOLLPRI :0 );
@@ -470,7 +470,7 @@ __poll_t bt_sock_poll(struct file *file,if (sk->sk_shutdown ==SHUTDOWN_MASK ) mask |=EPOLLHUP ; -if (!skb_queue_empty (&sk->sk_receive_queue)) +if (!skb_queue_empty_lockless (&sk->sk_receive_queue)) mask |=EPOLLIN |EPOLLRDNORM ;if (sk->sk_state ==BT_CLOSED )
net/caif/caif_socket.c +1 -1
@@ -953,7 +953,7 @@ static __poll_t caif_poll(struct file *f mask |=EPOLLRDHUP ;/* readable? */ -if (!skb_queue_empty (&sk->sk_receive_queue) || +if (!skb_queue_empty_lockless (&sk->sk_receive_queue) || (sk->sk_shutdown &RCV_SHUTDOWN )) mask |=EPOLLIN |EPOLLRDNORM ;
net/core/datagram.c +2 -2
@@ -842,7 +842,7 @@ __poll_t datagram_poll(struct file *file mask =0 ;/* exceptional events? */ -if (sk->sk_err || !skb_queue_empty (&sk->sk_error_queue)) +if (sk->sk_err || !skb_queue_empty_lockless (&sk->sk_error_queue)) mask |=EPOLLERR | (sock_flag (sk,SOCK_SELECT_ERR_QUEUE ) ?EPOLLPRI :0 );
@@ -852,7 +852,7 @@ __poll_t datagram_poll(struct file *file mask |=EPOLLHUP ;/* readable? */ -if (!skb_queue_empty (&sk->sk_receive_queue)) +if (!skb_queue_empty_lockless (&sk->sk_receive_queue)) mask |=EPOLLIN |EPOLLRDNORM ;/* Connection-based need to check for termination and startup */
net/decnet/af_decnet.c +1 -1
@@ -1213,7 +1213,7 @@ static __poll_t dn_poll(struct file *filstruct dn_scp *scp =DN_SK (sk);__poll_t mask =datagram_poll (file, sock, wait); -if (!skb_queue_empty (&scp->other_receive_queue)) +if (!skb_queue_empty_lockless (&scp->other_receive_queue)) mask |=EPOLLRDBAND ;return mask;
net/ipv4/tcp.c +1 -1
@@ -595,7 +595,7 @@ __poll_t tcp_poll(struct file *file, str }/* This barrier is coupled with smp_wmb() in tcp_reset() */ smp_rmb (); -if (sk->sk_err || !skb_queue_empty (&sk->sk_error_queue)) +if (sk->sk_err || !skb_queue_empty_lockless (&sk->sk_error_queue)) mask |=EPOLLERR ;return mask;
net/ipv4/udp.c +1 -1
@@ -2651,7 +2651,7 @@ __poll_t udp_poll(struct file *file, str__poll_t mask =datagram_poll (file, sock, wait);struct sock *sk = sock->sk; -if (!skb_queue_empty (&udp_sk (sk)->reader_queue)) +if (!skb_queue_empty_lockless (&udp_sk (sk)->reader_queue)) mask |=EPOLLIN |EPOLLRDNORM ;/* Check for false positives due to checksum errors */
net/nfc/llcp_sock.c +2 -2
@@ -566,11 +566,11 @@ static __poll_t llcp_sock_poll(struct fiif (sk->sk_state ==LLCP_LISTEN )return llcp_accept_poll (sk); -if (sk->sk_err || !skb_queue_empty (&sk->sk_error_queue)) +if (sk->sk_err || !skb_queue_empty_lockless (&sk->sk_error_queue)) mask |=EPOLLERR | (sock_flag (sk,SOCK_SELECT_ERR_QUEUE ) ?EPOLLPRI :0 ); -if (!skb_queue_empty (&sk->sk_receive_queue)) +if (!skb_queue_empty_lockless (&sk->sk_receive_queue)) mask |=EPOLLIN |EPOLLRDNORM ;if (sk->sk_state ==LLCP_CLOSED )
net/phonet/socket.c +2 -2
@@ -351,9 +351,9 @@ static __poll_t pn_socket_poll(struct fiif (sk->sk_state ==TCP_CLOSE )return EPOLLERR ; -if (!skb_queue_empty (&sk->sk_receive_queue)) +if (!skb_queue_empty_lockless (&sk->sk_receive_queue)) mask |=EPOLLIN |EPOLLRDNORM ; -if (!skb_queue_empty (&pn->ctrlreq_queue)) +if (!skb_queue_empty_lockless (&pn->ctrlreq_queue)) mask |=EPOLLPRI ;if (!mask && sk->sk_state ==TCP_CLOSE_WAIT )return EPOLLHUP ;
net/sctp/socket.c +2 -2
@@ -7939,7 +7939,7 @@ __poll_t sctp_poll(struct file *file, st mask =0 ;/* Is there any exceptional events? */ -if (sk->sk_err || !skb_queue_empty (&sk->sk_error_queue)) +if (sk->sk_err || !skb_queue_empty_lockless (&sk->sk_error_queue)) mask |=EPOLLERR | (sock_flag (sk,SOCK_SELECT_ERR_QUEUE ) ?EPOLLPRI :0 );if (sk->sk_shutdown &RCV_SHUTDOWN )
@@ -7948,7 +7948,7 @@ __poll_t sctp_poll(struct file *file, st mask |=EPOLLHUP ;/* Is it readable? Reconsider this code with TCP-style support. */ -if (!skb_queue_empty (&sk->sk_receive_queue)) +if (!skb_queue_empty_lockless (&sk->sk_receive_queue)) mask |=EPOLLIN |EPOLLRDNORM ;/* The association is either gone or not ready. */
net/tipc/socket.c +2 -2
@@ -731,7 +731,7 @@ static __poll_t tipc_poll(struct file *f/* fall thru' */ case TIPC_LISTEN :case TIPC_CONNECTING : -if (!skb_queue_empty (&sk->sk_receive_queue)) +if (!skb_queue_empty_lockless (&sk->sk_receive_queue)) revents |=EPOLLIN |EPOLLRDNORM ;break ;case TIPC_OPEN :
@@ -739,7 +739,7 @@ static __poll_t tipc_poll(struct file *f revents |=EPOLLOUT ;if (!tipc_sk_type_connectionless (sk))break ; -if (skb_queue_empty (&sk->sk_receive_queue)) +if (skb_queue_empty_lockless (&sk->sk_receive_queue))break ; revents |=EPOLLIN |EPOLLRDNORM ;break ;
net/unix/af_unix.c +3 -3
@@ -2661,7 +2661,7 @@ static __poll_t unix_poll(struct file *f mask |=EPOLLRDHUP |EPOLLIN |EPOLLRDNORM ;/* readable? */ -if (!skb_queue_empty (&sk->sk_receive_queue)) +if (!skb_queue_empty_lockless (&sk->sk_receive_queue)) mask |=EPOLLIN |EPOLLRDNORM ;/* Connection-based need to check for termination and startup */
@@ -2690,7 +2690,7 @@ static __poll_t unix_dgram_poll(struct f mask =0 ;/* exceptional events? */ -if (sk->sk_err || !skb_queue_empty (&sk->sk_error_queue)) +if (sk->sk_err || !skb_queue_empty_lockless (&sk->sk_error_queue)) mask |=EPOLLERR | (sock_flag (sk,SOCK_SELECT_ERR_QUEUE ) ?EPOLLPRI :0 );
@@ -2700,7 +2700,7 @@ static __poll_t unix_dgram_poll(struct f mask |=EPOLLHUP ;/* readable? */ -if (!skb_queue_empty (&sk->sk_receive_queue)) +if (!skb_queue_empty_lockless (&sk->sk_receive_queue)) mask |=EPOLLIN |EPOLLRDNORM ;/* Connection-based need to check for termination and startup */
net/vmw_vsock/af_vsock.c +1 -1
@@ -873,7 +873,7 @@ static __poll_t vsock_poll(struct file ** the queue and write as long as the socket isn't shutdown for * sending. */ -if (!skb_queue_empty (&sk->sk_receive_queue) || +if (!skb_queue_empty_lockless (&sk->sk_receive_queue) || (sk->sk_shutdown &RCV_SHUTDOWN )) { mask |=EPOLLIN |EPOLLRDNORM ; }
Greg Kroah-Hartman
maintainerPATCH 57/79 net: use skb_queue_empty_lockless() in busy poll contexts
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 3f926af3f4d688e2e11e7f8ed04e277a14d4d4a4 ]
Busy polling usually runs without locks.
Let's use skb_queue_empty_lockless() instead of skb_queue_empty()
Also uses READ_ONCE() in __skb_try_recv_datagram() to address a similar potential problem.
--- drivers/crypto/chelsio/chtls/chtls_io.c | 2 +- net/core/datagram.c | 2 +- net/core/sock.c | 2 +- net/ipv4/tcp.c | 2 +- net/sctp/socket.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)
drivers/crypto/chelsio/chtls/chtls_io.c +1 -1
@@ -1716,7 +1716,7 @@ int chtls_recvmsg(struct sock *sk, strucreturn peekmsg (sk, msg, len, nonblock, flags);if (sk_can_busy_loop (sk) && -skb_queue_empty (&sk->sk_receive_queue) && +skb_queue_empty_lockless (&sk->sk_receive_queue) && sk->sk_state ==TCP_ESTABLISHED )sk_busy_loop (sk, nonblock);
net/core/datagram.c +1 -1
@@ -279,7 +279,7 @@ struct sk_buff *__skb_try_recv_datagram(break ;sk_busy_loop (sk, flags &MSG_DONTWAIT ); - }while (sk->sk_receive_queue.prev != *last); + }while (READ_ONCE (sk->sk_receive_queue.prev) != *last); error = -EAGAIN ;
net/core/sock.c +1 -1
@@ -3483,7 +3483,7 @@ bool sk_busy_loop_end(void *p, unsigned {struct sock *sk = p; -return !skb_queue_empty (&sk->sk_receive_queue) || +return !skb_queue_empty_lockless (&sk->sk_receive_queue) ||sk_busy_loop_timeout (sk, start_time); }EXPORT_SYMBOL (sk_busy_loop_end);
net/ipv4/tcp.c +1 -1
@@ -1948,7 +1948,7 @@ int tcp_recvmsg(struct sock *sk, structif (unlikely (flags &MSG_ERRQUEUE ))return inet_recv_error (sk, msg, len, addr_len); -if (sk_can_busy_loop (sk) &&skb_queue_empty (&sk->sk_receive_queue) && +if (sk_can_busy_loop (sk) &&skb_queue_empty_lockless (&sk->sk_receive_queue) && (sk->sk_state ==TCP_ESTABLISHED ))sk_busy_loop (sk, nonblock);
net/sctp/socket.c +1 -1
@@ -8334,7 +8334,7 @@ struct sk_buff *sctp_skb_recv_datagram(sif (sk_can_busy_loop (sk)) {sk_busy_loop (sk, noblock); -if (!skb_queue_empty (&sk->sk_receive_queue)) +if (!skb_queue_empty_lockless (&sk->sk_receive_queue))continue ; }
Greg Kroah-Hartman
maintainerPATCH 58/79 net: add READ_ONCE() annotation in __skb_wait_for_more_packets()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 7c422d0ce97552dde4a97e6290de70ec6efb0fc6 ]
__skb_wait_for_more_packets() can be called while other cpus can feed packets to the socket receive queue.
KCSAN reported :
BUG: KCSAN: data-race in __skb_wait_for_more_packets / __udp_enqueue_schedule_skb
write to 0xffff888102e40b58 of 8 bytes by interrupt on cpu 0:
__skb_insert include/linux/skbuff.h:1852 [inline] __skb_queue_before include/linux/skbuff.h:1958 [inline] __skb_queue_tail include/linux/skbuff.h:1991 [inline] __udp_enqueue_schedule_skb+0x2d7/0x410 net/ipv4/udp.c:1470 __udp_queue_rcv_skb net/ipv4/udp.c:1940 [inline] udp_queue_rcv_one_skb+0x7bd/0xc70 net/ipv4/udp.c:2057 udp_queue_rcv_skb+0xb5/0x400 net/ipv4/udp.c:2074 udp_unicast_rcv_skb.isra.0+0x7e/0x1c0 net/ipv4/udp.c:2233 __udp4_lib_rcv+0xa44/0x17c0 net/ipv4/udp.c:2300 udp_rcv+0x2b/0x40 net/ipv4/udp.c:2470 ip_protocol_deliver_rcu+0x4d/0x420 net/ipv4/ip_input.c:204 ip_local_deliver_finish+0x110/0x140 net/ipv4/ip_input.c:231 NF_HOOK include/linux/netfilter.h:305 [inline] NF_HOOK include/linux/netfilter.h:299 [inline] ip_local_deliver+0x133/0x210 net/ipv4/ip_input.c:252 dst_input include/net/dst.h:442 [inline] ip_rcv_finish+0x121/0x160 net/ipv4/ip_input.c:413 NF_HOOK include/linux/netfilter.h:305 [inline] NF_HOOK include/linux/netfilter.h:299 [inline] ip_rcv+0x18f/0x1a0 net/ipv4/ip_input.c:523 __netif_receive_skb_one_core+0xa7/0xe0 net/core/dev.c:5010 __netif_receive_skb+0x37/0xf0 net/core/dev.c:5124 process_backlog+0x1d3/0x420 net/core/dev.c:5955
read to 0xffff888102e40b58 of 8 bytes by task 13035 on cpu 1:
__skb_wait_for_more_packets+0xfa/0x320 net/core/datagram.c:100 __skb_recv_udp+0x374/0x500 net/ipv4/udp.c:1683 udp_recvmsg+0xe1/0xb10 net/ipv4/udp.c:1712 inet_recvmsg+0xbb/0x250 net/ipv4/af_inet.c:838 sock_recvmsg_nosec+0x5c/0x70 net/socket.c:871 ___sys_recvmsg+0x1a0/0x3e0 net/socket.c:2480 do_recvmmsg+0x19a/0x5c0 net/socket.c:2601 __sys_recvmmsg+0x1ef/0x200 net/socket.c:2680 __do_sys_recvmmsg net/socket.c:2703 [inline] __se_sys_recvmmsg net/socket.c:2696 [inline] __x64_sys_recvmmsg+0x89/0xb0 net/socket.c:2696 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: 1 PID: 13035 Comm: syz-executor.3 Not tainted 5.4.0-rc3+ #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
--- net/core/datagram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/datagram.c +1 -1
@@ -95,7 +95,7 @@ int __skb_wait_for_more_packets(struct sif (error) goto out_err; -if (sk->sk_receive_queue.prev != skb) +if (READ_ONCE (sk->sk_receive_queue.prev) != skb) goto out;/* Socket shut down? */
Greg Kroah-Hartman
maintainerPATCH 59/79 ipv4: fix route update on metric change.
In reply to Greg Kroah-HartmanFrom: Paolo Abeni <[email protected]>
[ Upstream commit 0b834ba00ab5337e938c727e216e1f5249794717 ]
Since commit af4d768ad28c ("net/ipv4: Add support for specifying metric of connected routes"), when updating an IP address with a different metric, the associated connected route is updated, too.
Still, the mentioned commit doesn't handle properly some corner cases:
$ ip addr add dev eth0 192.168.1.0/24 $ ip addr add dev eth0 192.168.2.1/32 peer 192.168.2.2 $ ip addr add dev eth0 192.168.3.1/24 $ ip addr change dev eth0 192.168.1.0/24 metric 10 $ ip addr change dev eth0 192.168.2.1/32 peer 192.168.2.2 metric 10 $ ip addr change dev eth0 192.168.3.1/24 metric 10 $ ip -4 route 192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.0 192.168.2.2 dev eth0 proto kernel scope link src 192.168.2.1 192.168.3.0/24 dev eth0 proto kernel scope link src 192.168.2.1 metric 10
Only the last route is correctly updated.
The problem is the current test in fib_modify_prefix_metric():
if (!(dev->flags & IFF_UP) || ifa->ifa_flags & (IFA_F_SECONDARY | IFA_F_NOPREFIXROUTE) || ipv4_is_zeronet(prefix) || prefix == ifa->ifa_local || ifa->ifa_prefixlen == 32)
Which should be the logical 'not' of the pre-existing test in fib_add_ifaddr():
if (!ipv4_is_zeronet(prefix) && !(ifa->ifa_flags & IFA_F_SECONDARY) && (prefix != addr || ifa->ifa_prefixlen < 32))
To properly negate the original expression, we need to change the last logical 'or' to a logical 'and'.
--- net/ipv4/fib_frontend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/fib_frontend.c +1 -1
@@ -946,7 +946,7 @@ void fib_modify_prefix_metric(struct in_if (!(dev->flags &IFF_UP ) || ifa->ifa_flags & (IFA_F_SECONDARY |IFA_F_NOPREFIXROUTE ) ||ipv4_is_zeronet (prefix) || - prefix == ifa->ifa_local || ifa->ifa_prefixlen ==32 ) + (prefix == ifa->ifa_local && ifa->ifa_prefixlen ==32 ))return ;/* add the new */
Greg Kroah-Hartman
maintainerPATCH 60/79 selftests: fib_tests: add more tests for metric update
In reply to Greg Kroah-HartmanFrom: Paolo Abeni <[email protected]>
[ Upstream commit 37de3b354150450ba12275397155e68113e99901 ]
This patch adds two more tests to ipv4_addr_metric_test() to explicitly cover the scenarios fixed by the previous patch.
--- tools/testing/selftests/net/fib_tests.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
tools/testing/selftests/net/fib_tests.sh +21 -0
@@ -1301,6 +1301,27 @@ ipv4_addr_metric_test() fi log_test $rc 0 "Prefix route with metric on link up" + # explicitly check for metric changes on edge scenarios + run_cmd "$IP addr flush dev dummy2" + run_cmd "$IP addr add dev dummy2 172.16.104.0/24 metric 259" + run_cmd "$IP addr change dev dummy2 172.16.104.0/24 metric 260" + rc=$? + if [ $rc -eq 0 ]; then + check_route "172.16.104.0/24 dev dummy2 proto kernel scope link src 172.16.104.0 metric 260" + rc=$? + fi + log_test $rc 0 "Modify metric of .0/24 address" + + run_cmd "$IP addr flush dev dummy2" + run_cmd "$IP addr add dev dummy2 172.16.104.1/32 peer 172.16.104.2 metric 260" + run_cmd "$IP addr change dev dummy2 172.16.104.1/32 peer 172.16.104.2 metric 261" + rc=$? + if [ $rc -eq 0 ]; then + check_route "172.16.104.2 dev dummy2 proto kernel scope link src 172.16.104.1 metric 261" + rc=$? + fi + log_test $rc 0 "Modify metric of address with peer route" + $IP li del dummy1 $IP li del dummy2 cleanup
Greg Kroah-Hartman
maintainerPATCH 61/79 net/mlx5e: Fix handling of compressed CQEs in case of low NAPI budget
In reply to Greg Kroah-HartmanFrom: Maxim Mikityanskiy <[email protected]>
[ Upstream commit 9df86bdb6746d7fcfc2fda715f7a7c3d0ddb2654 ]
When CQE compression is enabled, compressed CQEs use the following
structure: a title is followed by one or many blocks, each containing 8 mini CQEs (except the last, which may contain fewer mini CQEs).
Due to NAPI budget restriction, a complete structure is not always parsed in one NAPI run, and some blocks with mini CQEs may be deferred to the next NAPI poll call - we have the mlx5e_decompress_cqes_cont call in the beginning of mlx5e_poll_rx_cq. However, if the budget is extremely low, some blocks may be left even after that, but the code that follows the mlx5e_decompress_cqes_cont call doesn't check it and assumes that a new CQE begins, which may not be the case. In such cases, random memory corruptions occur.
An extremely low NAPI budget of 8 is used when busy_poll or busy_read is active.
This commit adds a check to make sure that the previous compressed CQE has been completely parsed after mlx5e_decompress_cqes_cont, otherwise it prevents a new CQE from being fetched in the middle of a compressed CQE.
This commit fixes random crashes in __build_skb, __page_pool_put_page and other not-related-directly places, that used to happen when both CQE compression and busy_poll/busy_read were enabled.
--- drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +4 -1
@@ -1267,8 +1267,11 @@ int mlx5e_poll_rx_cq(struct mlx5e_cq *cqif (unlikely (!test_bit (MLX5E_RQ_STATE_ENABLED , &rq->state)))return 0 ; -if (cq->decmprs_left) +if (cq->decmprs_left) { work_done +=mlx5e_decompress_cqes_cont (rq, cq,0 , budget); +if (cq->decmprs_left || work_done >= budget) + goto out; + } cqe =mlx5_cqwq_get_cqe (&cq->wq);if (!cqe) {
Greg Kroah-Hartman
maintainerPATCH 62/79 r8169: fix wrong PHY ID issue with RTL8168dp
In reply to Greg Kroah-HartmanFrom: Heiner Kallweit <[email protected]>
[ Upstream commit 62bdc8fd1c21d4263ebd18bec57f82532d09249f ]
As reported in [0] at least one RTL8168dp version has problems establishing a link. This chip version has an integrated RTL8211b PHY, however the chip seems to report a wrong PHY ID, resulting in a wrong PHY driver (for Generic Realtek PHY) being loaded.
Work around this issue by adding a hook to r8168dp_2_mdio_read() for returning the correct PHY ID.
[0] https://bbs.archlinux.org/viewtopic.php?id=246508
--- drivers/net/ethernet/realtek/r8169.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/realtek/r8169.c +4 -0
@@ -1010,6 +1010,10 @@ static int r8168dp_2_mdio_read(struct rt {int value; +/* Work around issue with chip reporting wrong PHY ID */ +if (reg ==MII_PHYSID2 ) +return 0xc912 ; +r8168dp_2_mdio_start (tp); value =r8169_mdio_read (tp, reg);
Greg Kroah-Hartman
maintainerPATCH 63/79 net/mlx5e: Fix ethtool self test: link speed
In reply to Greg Kroah-HartmanFrom: Aya Levin <[email protected]>
[ Upstream commit 534e7366f41b0c689b01af4375aefcd1462adedf ]
Ethtool self test contains a test for link speed. This test reads the PTYS register and determines whether the current speed is valid or not. Change current implementation to use the function mlx5e_port_linkspeed() that does the same check and fails when speed is invalid. This code redundancy lead to a bug when mlx5e_port_linkspeed() was updated with expended speeds and the self test was not.
--- drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c +3 -12
@@ -35,6 +35,7 @@#include <linux/udp.h> #include <net/udp.h> #include "en.h" +#include "en/port.h" enum {MLX5E_ST_LINK_STATE ,
@@ -80,22 +81,12 @@ static int mlx5e_test_link_state(structstatic int mlx5e_test_link_speed (struct mlx5e_priv *priv) { -u32 out[MLX5_ST_SZ_DW (ptys_reg)]; -u32 eth_proto_oper; -int i; +u32 speed;if (!netif_carrier_ok (priv->netdev))return 1 ; -if (mlx5_query_port_ptys (priv->mdev, out,sizeof (out),MLX5_PTYS_EN ,1 )) -return 1 ; - - eth_proto_oper =MLX5_GET (ptys_reg, out, eth_proto_oper); -for (i =0 ; i <MLX5E_LINK_MODES_NUMBER ; i++) { -if (eth_proto_oper &MLX5E_PROT_MASK (i)) -return 0 ; - } -return 1 ; +return mlx5e_port_linkspeed (priv->mdev, &speed); }struct mlx5ehdr {
Greg Kroah-Hartman
maintainerPATCH 64/79 net: dsa: b53: Do not clear existing mirrored port mask
In reply to Greg Kroah-HartmanFrom: Florian Fainelli <[email protected]>
[ Upstream commit c763ac436b668d7417f0979430ec0312ede4093d ]
Clearing the existing bitmask of mirrored ports essentially prevents us from capturing more than one port at any given time. This is clearly wrong, do not clear the bitmask prior to setting up the new port.
--- drivers/net/dsa/b53/b53_common.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/dsa/b53/b53_common.c +0 -1
@@ -1584,7 +1584,6 @@ int b53_mirror_add(struct dsa_switch *ds loc =B53_EG_MIR_CTL ;b53_read16 (dev,B53_MGMT_PAGE , loc, ®); - reg &= ~MIRROR_MASK ; reg |=BIT (port);b53_write16 (dev,B53_MGMT_PAGE , loc, reg);
Greg Kroah-Hartman
maintainerPATCH 65/79 net: bcmgenet: dont set phydev->link from MAC
In reply to Greg Kroah-HartmanFrom: Doug Berger <[email protected]>
[ Upstream commit 7de48402faa32298c3551ea32c76ccb4f9d3025d ]
When commit 28b2e0d2cd13 ("net: phy: remove parameter new_link from phy_mac_interrupt()") removed the new_link parameter it set the phydev->link state from the MAC before invoking phy_mac_interrupt().
However, once commit 88d6272acaaa ("net: phy: avoid unneeded MDIO reads in genphy_read_status") was added this initialization prevents the proper determination of the connection parameters by the function genphy_read_status().
This commit removes that initialization to restore the proper functionality.
--- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/broadcom/genet/bcmgenet.c +1 -3
@@ -2619,10 +2619,8 @@ static void bcmgenet_irq_task(struct worspin_unlock_irq (&priv->lock);/* Link UP/DOWN event */ -if (status &UMAC_IRQ_LINK_EVENT ) { - priv->dev->phydev->link = !!(status &UMAC_IRQ_LINK_UP ); +if (status &UMAC_IRQ_LINK_EVENT )phy_mac_interrupt (priv->dev->phydev); - } }/* bcmgenet_isr1: handle Rx and Tx priority queues */
Greg Kroah-Hartman
maintainerPATCH 66/79 net: phy: bcm7xxx: define soft_reset for 40nm EPHY
In reply to Greg Kroah-HartmanFrom: Doug Berger <[email protected]>
[ Upstream commit fe586b823372a9f43f90e2c6aa0573992ce7ccb7 ]
The internal 40nm EPHYs use a "Workaround for putting the PHY in IDDQ mode." These PHYs require a soft reset to restore functionality after they are powered back up.
This commit defines the soft_reset function to use genphy_soft_reset during phy_init_hw to accommodate this.
--- drivers/net/phy/bcm7xxx.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/phy/bcm7xxx.c +1 -0
@@ -643,6 +643,7 @@ static int bcm7xxx_28nm_probe(struct phy .name = _name, \ .features = PHY_BASIC_FEATURES, \ .flags = PHY_IS_INTERNAL, \ + .soft_reset = genphy_soft_reset, \ .config_init = bcm7xxx_config_init, \ .suspend = bcm7xxx_suspend, \ .resume = bcm7xxx_config_init, \
Greg Kroah-Hartman
maintainerPATCH 67/79 net: bcmgenet: reset 40nm EPHY on energy detect
In reply to Greg Kroah-HartmanFrom: Doug Berger <[email protected]>
[ Upstream commit 25382b991d252aed961cd434176240f9de6bb15f ]
The EPHY integrated into the 40nm Set-Top Box devices can falsely detect energy when connected to a disabled peer interface. When the peer interface is enabled the EPHY will detect and report the link as active, but on occasion may get into a state where it is not able to exchange data with the connected GENET MAC. This issue has not been observed when the link parameters are auto-negotiated; however, it has been observed with a manually configured link.
It has been empirically determined that issuing a soft reset to the EPHY when energy is detected prevents it from getting into this bad state.
--- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/genet/bcmgenet.c +8 -1
@@ -2020,6 +2020,8 @@ static void bcmgenet_link_intr_enable(st*/ if (priv->internal_phy) { int0_enable |=UMAC_IRQ_LINK_EVENT ; +if (GENET_IS_V1 (priv) ||GENET_IS_V2 (priv) ||GENET_IS_V3 (priv)) + int0_enable |=UMAC_IRQ_PHY_DET_R ; }else if (priv->ext_phy) { int0_enable |=UMAC_IRQ_LINK_EVENT ; }else if (priv->phy_interface ==PHY_INTERFACE_MODE_MOCA ) {
@@ -2618,9 +2620,14 @@ static void bcmgenet_irq_task(struct wor priv->irq0_stat =0 ;spin_unlock_irq (&priv->lock); +if (status &UMAC_IRQ_PHY_DET_R && + priv->dev->phydev->autoneg !=AUTONEG_ENABLE ) +phy_init_hw (priv->dev->phydev); +/* Link UP/DOWN event */ if (status &UMAC_IRQ_LINK_EVENT )phy_mac_interrupt (priv->dev->phydev); + }/* bcmgenet_isr1: handle Rx and Tx priority queues */
@@ -2715,7 +2722,7 @@ static irqreturn_t bcmgenet_isr0(int irq }/* all other interested interrupts handled in bottom half */ - status &=UMAC_IRQ_LINK_EVENT ; + status &= (UMAC_IRQ_LINK_EVENT |UMAC_IRQ_PHY_DET_R );if (status) {/* Save irq status for bottom-half processing. */ spin_lock_irqsave (&priv->lock, flags);
Greg Kroah-Hartman
maintainerPATCH 68/79 net: usb: lan78xx: Connect PHY before registering MAC
In reply to Greg Kroah-HartmanFrom: Andrew Lunn <[email protected]>
[ Upstream commit 38b4fe320119859c11b1dc06f6b4987a16344fa1 ]
As soon as the netdev is registers, the kernel can start using the interface. If the driver connects the MAC to the PHY after the netdev is registered, there is a race condition where the interface can be opened without having the PHY connected.
Change the order to close this race condition.
--- drivers/net/usb/lan78xx.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/usb/lan78xx.c +6 -6
@@ -3799,10 +3799,14 @@ static int lan78xx_probe(struct usb_inte/* driver requires remote-wakeup capability during autosuspend. */ intf->needs_remote_wakeup =1 ; + ret =lan78xx_phy_init (dev); +if (ret <0 ) + goto out4; + ret =register_netdev (netdev);if (ret !=0 ) {netif_err (dev, probe, netdev,"couldn't register the device\n" ); - goto out4; + goto out5; }usb_set_intfdata (intf, dev);
@@ -3815,14 +3819,10 @@ static int lan78xx_probe(struct usb_intepm_runtime_set_autosuspend_delay (&udev->dev,DEFAULT_AUTOSUSPEND_DELAY ); - ret =lan78xx_phy_init (dev); -if (ret <0 ) - goto out5; -return 0 ; out5: -unregister_netdev (netdev); +phy_disconnect (netdev->phydev); out4:usb_free_urb (dev->urb_intr); out3:
Greg Kroah-Hartman
maintainerPATCH 69/79 net: dsa: fix switch tree list
In reply to Greg Kroah-HartmanFrom: Vivien Didelot <[email protected]>
[ Upstream commit 50c7d2ba9de20f60a2d527ad6928209ef67e4cdd ]
If there are multiple switch trees on the device, only the last one will be listed, because the arguments of list_add_tail are swapped.
--- net/dsa/dsa2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/dsa/dsa2.c +1 -1
@@ -49,7 +49,7 @@ static struct dsa_switch_tree *dsa_tree_ dst->index = index;INIT_LIST_HEAD (&dst->list); -list_add_tail (&dsa_tree_list, &dst->list); +list_add_tail (&dst->list, &dsa_tree_list);kref_init (&dst->refcount);
Greg Kroah-Hartman
maintainerPATCH 70/79 r8152: add device id for Lenovo ThinkPad USB-C Dock Gen 2
In reply to Greg Kroah-HartmanFrom: Kazutoshi Noguchi <[email protected]>
[ Upstream commit b3060531979422d5bb18d80226f978910284dc70 ]
This device is sold as 'ThinkPad USB-C Dock Gen 2 (40AS)'. Chipset is RTL8153 and works with r8152.
Without this, the generic cdc_ether grabs the device, and the device jam connected networks up when the machine suspends.
--- drivers/net/usb/cdc_ether.c | 7 +++++++ drivers/net/usb/r8152.c | 1 + 2 files changed, 8 insertions(+)
drivers/net/usb/cdc_ether.c +7 -0
@@ -800,6 +800,13 @@ static const struct usb_device_id produc .driver_info = 0, }, +/* ThinkPad USB-C Dock Gen 2 (based on Realtek RTL8153) */ +{ +USB_DEVICE_AND_INTERFACE_INFO (LENOVO_VENDOR_ID ,0xa387 ,USB_CLASS_COMM , + USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), + .driver_info =0 , +}, + /* NVIDIA Tegra USB 3.0 Ethernet Adapters (based on Realtek RTL8153) */ { USB_DEVICE_AND_INTERFACE_INFO(NVIDIA_VENDOR_ID, 0x09ff, USB_CLASS_COMM,
drivers/net/usb/r8152.c +1 -0
@@ -5339,6 +5339,7 @@ static const struct usb_device_id rtl815 {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x7205)}, {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x720c)}, {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x7214)}, + {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0xa387)}, {REALTEK_USB_DEVICE(VENDOR_ID_LINKSYS, 0x0041)}, {REALTEK_USB_DEVICE(VENDOR_ID_NVIDIA, 0x09ff)}, {REALTEK_USB_DEVICE(VENDOR_ID_TPLINK, 0x0601)},
Greg Kroah-Hartman
maintainerPATCH 71/79 net/flow_dissector: switch to siphash
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 55667441c84fa5e0911a0aac44fb059c15ba6da2 ]
UDP IPv6 packets auto flowlabels are using a 32bit secret (static u32 hashrnd in net/core/flow_dissector.c) and apply jhash() over fields known by the receivers.
Attackers can easily infer the 32bit secret and use this information to identify a device and/or user, since this 32bit secret is only set at boot time.
Really, using jhash() to generate cookies sent on the wire is a serious security concern.
Trying to change the rol32(hash, 16) in ip6_make_flowlabel() would be a dead end. Trying to periodically change the secret (like in sch_sfq.c) could change paths taken in the network for long lived flows.
Let's switch to siphash, as we did in commit df453700e8d8 ("inet: switch IP ID generator to siphash")
Using a cryptographically strong pseudo random function will solve this privacy issue and more generally remove other weak points in the stack.
Packet schedulers using skb_get_hash_perturb() benefit from this change.
--- include/linux/skbuff.h | 3 ++- include/net/flow_dissector.h | 3 ++- include/net/fq.h | 2 +- include/net/fq_impl.h | 4 ++-- net/core/flow_dissector.c | 38 ++++++++++++++++---------------------- net/sched/sch_hhf.c | 8 ++++---- net/sched/sch_sfb.c | 13 +++++++------ net/sched/sch_sfq.c | 14 ++++++++------ 8 files changed, 42 insertions(+), 43 deletions(-)
include/linux/skbuff.h +2 -1
@@ -1251,7 +1251,8 @@ static inline __u32 skb_get_hash_flowi6(return skb->hash; } -__u32 skb_get_hash_perturb (const struct sk_buff *skb,u32 perturb); +__u32 skb_get_hash_perturb (const struct sk_buff *skb, +const siphash_key_t *perturb);static inline __u32 skb_get_hash_raw (const struct sk_buff *skb) {
include/net/flow_dissector.h +2 -1
@@ -4,6 +4,7 @@#include <linux/types.h> #include <linux/in6.h> +#include <linux/siphash.h> #include <uapi/linux/if_ether.h> /**
@@ -252,7 +253,7 @@ struct flow_keys_basic {struct flow_keys {struct flow_dissector_key_control control;#define FLOW_KEYS_HASH_START_FIELD basic -struct flow_dissector_key_basic basic; +struct flow_dissector_key_basic basic__aligned(SIPHASH_ALIGNMENT) ;struct flow_dissector_key_tags tags;struct flow_dissector_key_vlan vlan;struct flow_dissector_key_vlan cvlan;
include/net/fq.h +1 -1
@@ -70,7 +70,7 @@ struct fq {struct list_head backlogs;spinlock_t lock;u32 flows_cnt; -u32 perturbation; +siphash_key_t perturbation;u32 limit;u32 memory_limit;u32 memory_usage;
include/net/fq_impl.h +2 -2
@@ -118,7 +118,7 @@ static struct fq_flow *fq_flow_classify(lockdep_assert_held (&fq->lock); - hash =skb_get_hash_perturb (skb, fq->perturbation); + hash =skb_get_hash_perturb (skb, &fq->perturbation); idx =reciprocal_scale (hash, fq->flows_cnt); flow = &fq->flows[idx];
@@ -307,7 +307,7 @@ static int fq_init(struct fq *fq, int flINIT_LIST_HEAD (&fq->backlogs);spin_lock_init (&fq->lock); fq->flows_cnt =max_t (u32, flows_cnt,1 ); - fq->perturbation =prandom_u32 (); +get_random_bytes (&fq->perturbation,sizeof (fq->perturbation)); fq->quantum =300 ; fq->limit =8192 ; fq->memory_limit =16 <<20 ;/* 16 MBytes */
net/core/flow_dissector.c +16 -22
@@ -1077,30 +1077,21 @@ out_bad: }EXPORT_SYMBOL (__skb_flow_dissect); -static u32 hashrnd__read_mostly ; +static siphash_key_t hashrnd__read_mostly ; static __always_inline void __flow_hash_secret_init(void) {net_get_random_once (&hashrnd,sizeof (hashrnd)); } -static __always_inline u32 __flow_hash_words(const u32 *words, u32 length, -u32 keyval) +static const void *flow_keys_hash_start (const struct flow_keys *flow) { -return jhash2 (words, length, keyval); -} - -static inline const u32 *flow_keys_hash_start (const struct flow_keys *flow) -{ -const void *p = flow; - -BUILD_BUG_ON (FLOW_KEYS_HASH_OFFSET %sizeof (u32)); -return (const u32 *)(p +FLOW_KEYS_HASH_OFFSET ); +BUILD_BUG_ON (FLOW_KEYS_HASH_OFFSET %SIPHASH_ALIGNMENT ); +return &flow->FLOW_KEYS_HASH_START_FIELD; }static inline size_t flow_keys_hash_length (const struct flow_keys *flow) {size_t diff =FLOW_KEYS_HASH_OFFSET +sizeof (flow->addrs); -BUILD_BUG_ON ((sizeof (*flow) -FLOW_KEYS_HASH_OFFSET ) %sizeof (u32)); BUILD_BUG_ON(offsetof(typeof(*flow), addrs) != sizeof(*flow) - sizeof(flow->addrs));
@@ -1115,7 +1106,7 @@ static inline size_t flow_keys_hash_leng diff -=sizeof (flow->addrs.tipckey);break ; } -return (sizeof (*flow) - diff) /sizeof (u32); +return sizeof (*flow) - diff; }__be32 flow_get_u32_src (const struct flow_keys *flow)
@@ -1181,14 +1172,15 @@ static inline void __flow_hash_consisten } } -static inline u32 __flow_hash_from_keys (struct flow_keys *keys,u32 keyval) +static inline u32 __flow_hash_from_keys (struct flow_keys *keys, +const siphash_key_t *keyval) {u32 hash;__flow_hash_consistentify (keys); - hash =__flow_hash_words (flow_keys_hash_start (keys), -flow_keys_hash_length (keys), keyval); + hash =siphash (flow_keys_hash_start (keys), +flow_keys_hash_length (keys), keyval);if (!hash) hash =1 ;
@@ -1198,12 +1190,13 @@ static inline u32 __flow_hash_from_keys(u32 flow_hash_from_keys (struct flow_keys *keys) {__flow_hash_secret_init (); -return __flow_hash_from_keys (keys, hashrnd); +return __flow_hash_from_keys (keys, &hashrnd); }EXPORT_SYMBOL (flow_hash_from_keys);static inline u32 ___skb_get_hash (const struct sk_buff *skb, -struct flow_keys *keys,u32 keyval) +struct flow_keys *keys, +const siphash_key_t *keyval) {skb_flow_dissect_flow_keys (skb, keys,FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL );
@@ -1251,7 +1244,7 @@ u32 __skb_get_hash_symmetric(const strucNULL ,0 ,0 ,0 , FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL); -return __flow_hash_from_keys (&keys, hashrnd); +return __flow_hash_from_keys (&keys, &hashrnd); }EXPORT_SYMBOL_GPL (__skb_get_hash_symmetric);
@@ -1271,13 +1264,14 @@ void __skb_get_hash(struct sk_buff *skb)__flow_hash_secret_init (); - hash =___skb_get_hash (skb, &keys, hashrnd); + hash =___skb_get_hash (skb, &keys, &hashrnd);__skb_set_sw_hash (skb, hash,flow_keys_have_l4 (&keys)); }EXPORT_SYMBOL (__skb_get_hash); -__u32 skb_get_hash_perturb (const struct sk_buff *skb,u32 perturb) +__u32 skb_get_hash_perturb (const struct sk_buff *skb, +const siphash_key_t *perturb) {struct flow_keys keys;
net/sched/sch_hhf.c +4 -4
@@ -4,11 +4,11 @@* Copyright (C) 2013 Nandita Dukkipati <[email protected]> */ -#include <linux/jhash.h> #include <linux/jiffies.h> #include <linux/module.h> #include <linux/skbuff.h> #include <linux/vmalloc.h> +#include <linux/siphash.h> #include <net/pkt_sched.h> #include <net/sock.h>
@@ -125,7 +125,7 @@ struct wdrr_bucket {struct hhf_sched_data {struct wdrr_bucket buckets[WDRR_BUCKET_CNT ]; -u32 perturbation;/* hash perturbation */ +siphash_key_t perturbation;/* hash perturbation */ u32 quantum;/* psched_mtu(qdisc_dev(sch)); */ u32 drop_overlimit;/* number of times max qdisc packet * limit was hit
@@ -263,7 +263,7 @@ static enum wdrr_bucket_idx hhf_classify }/* Get hashed flow-id of the skb. */ - hash =skb_get_hash_perturb (skb, q->perturbation); + hash =skb_get_hash_perturb (skb, &q->perturbation);/* Check if this packet belongs to an already established HH flow. */ flow_pos = hash &HHF_BIT_MASK ;
@@ -580,7 +580,7 @@ static int hhf_init(struct Qdisc *sch, s sch->limit =1000 ; q->quantum =psched_mtu (qdisc_dev (sch)); - q->perturbation =prandom_u32 (); +get_random_bytes (&q->perturbation,sizeof (q->perturbation));INIT_LIST_HEAD (&q->new_buckets);INIT_LIST_HEAD (&q->old_buckets);
net/sched/sch_sfb.c +7 -6
@@ -22,7 +22,7 @@#include <linux/errno.h> #include <linux/skbuff.h> #include <linux/random.h> -#include <linux/jhash.h> +#include <linux/siphash.h> #include <net/ip.h> #include <net/pkt_sched.h> #include <net/pkt_cls.h>
@@ -49,7 +49,7 @@ struct sfb_bucket {* (Section 4.4 of SFB reference : moving hash functions) */ struct sfb_bins { -u32 perturbation;/* jhash perturbation */ +siphash_key_t perturbation;/* siphash key */ struct sfb_bucket bins[SFB_LEVELS ][SFB_NUMBUCKETS ]; };
@@ -221,7 +221,8 @@ static u32 sfb_compute_qlen(u32 *prob_r,static void sfb_init_perturbation (u32 slot,struct sfb_sched_data *q) { - q->bins[slot].perturbation =prandom_u32 (); +get_random_bytes (&q->bins[slot].perturbation, +sizeof (q->bins[slot].perturbation)); }static void sfb_swap_slot (struct sfb_sched_data *q)
@@ -318,9 +319,9 @@ static int sfb_enqueue(struct sk_buff *s/* If using external classifiers, get result and record it. */ if (!sfb_classify (skb, fl, &ret, &salt)) goto other_drop; - sfbhash =jhash_1word (salt, q->bins[slot].perturbation); + sfbhash =siphash_1u32 (salt, &q->bins[slot].perturbation); }else { - sfbhash =skb_get_hash_perturb (skb, q->bins[slot].perturbation); + sfbhash =skb_get_hash_perturb (skb, &q->bins[slot].perturbation); }
@@ -356,7 +357,7 @@ static int sfb_enqueue(struct sk_buff *s/* Inelastic flow */ if (q->double_buffering) { sfbhash =skb_get_hash_perturb (skb, - q->bins[slot].perturbation); + &q->bins[slot].perturbation);if (!sfbhash) sfbhash =1 ;sfb_skb_cb (skb)->hashes[slot] = sfbhash;
net/sched/sch_sfq.c +8 -6
@@ -18,7 +18,7 @@#include <linux/errno.h> #include <linux/init.h> #include <linux/skbuff.h> -#include <linux/jhash.h> +#include <linux/siphash.h> #include <linux/slab.h> #include <linux/vmalloc.h> #include <net/netlink.h>
@@ -121,7 +121,7 @@ struct sfq_sched_data {u8 headdrop;u8 maxdepth;/* limit of packets per flow */ -u32 perturbation; +siphash_key_t perturbation;u8 cur_depth;/* depth of longest slot */ u8 flags;unsigned short scaled_quantum;/* SFQ_ALLOT_SIZE(quantum) */
@@ -161,7 +161,7 @@ static inline struct sfq_head *sfq_dep_hstatic unsigned int sfq_hash (const struct sfq_sched_data *q,const struct sk_buff *skb) { -return skb_get_hash_perturb (skb, q->perturbation) & (q->divisor -1 ); +return skb_get_hash_perturb (skb, &q->perturbation) & (q->divisor -1 ); } static unsigned int sfq_classify(struct sk_buff *skb, struct Qdisc *sch,
@@ -611,9 +611,11 @@ static void sfq_perturbation(struct timestruct sfq_sched_data *q =from_timer (q, t, perturb_timer);struct Qdisc *sch = q->sch;spinlock_t *root_lock =qdisc_lock (qdisc_root_sleeping (sch)); +siphash_key_t nkey; +get_random_bytes (&nkey,sizeof (nkey));spin_lock (root_lock); - q->perturbation =prandom_u32 (); + q->perturbation = nkey;if (!q->filter_list && q->tail)sfq_rehash (sch);spin_unlock (root_lock);
@@ -692,7 +694,7 @@ static int sfq_change(struct Qdisc *sch,del_timer (&q->perturb_timer);if (q->perturb_period) {mod_timer (&q->perturb_timer, jiffies + q->perturb_period); - q->perturbation =prandom_u32 (); +get_random_bytes (&q->perturbation,sizeof (q->perturbation)); }sch_tree_unlock (sch);kfree (p);
@@ -749,7 +751,7 @@ static int sfq_init(struct Qdisc *sch, s q->quantum =psched_mtu (qdisc_dev (sch)); q->scaled_quantum =SFQ_ALLOT_SIZE (q->quantum); q->perturb_period =0 ; - q->perturbation =prandom_u32 (); +get_random_bytes (&q->perturbation,sizeof (q->perturbation));if (opt) {int err =sfq_change (sch, opt);
Greg Kroah-Hartman
maintainerPATCH 72/79 wireless: Skip directory when generating certificates
In reply to Greg Kroah-HartmanFrom: Maxim Mikityanskiy <[email protected]>
[ Upstream commit 32b5a2c9950b9284000059d752f7afa164deb15e ]
Commit 715a12334764 ("wireless: don't write C files on failures") drops the test -f $$f check. The list of targets contains the CONFIG_CFG80211_EXTRA_REGDB_KEYDIR directory itself, and this check used to filter it out. After the check was removed, the extra keydir option no longer works, failing with the following message:
od: 'standard input': read error: Is a directory
This commit restores the check to make extra keydir work again.
--- net/wireless/Makefile | 1 + 1 file changed, 1 insertion(+)
net/wireless/Makefile +1 -0
@@ -38,6 +38,7 @@ $(obj)/extra-certs.c: $(CONFIG_CFG80211_ @(set -e; \ allf=""; \ for f in $^ ; do \ + test -f $$f || continue;\ # similar to hexdump -v -e '1/1 "0x%.2x," "\n"' \ thisf=$$(od -An -v -tx1 < $$f | \ sed -e 's/ /\n/g' | \
Greg Kroah-Hartman
maintainerPATCH 73/79 platform/x86: pmc_atom: Add Siemens SIMATIC IPC227E to critclk_systems DMI table
In reply to Greg Kroah-HartmanFrom: Jan Kiszka <[email protected]>
commit ad0d315b4d4e7138f43acf03308192ec00e9614d upstream.
The SIMATIC IPC227E uses the PMC clock for on-board components and gets stuck during boot if the clock is disabled. Therefore, add this device to the critical systems list.
--- drivers/platform/x86/pmc_atom.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/platform/x86/pmc_atom.c +7 -0
@@ -445,6 +445,13 @@ static const struct dmi_system_id critcl DMI_MATCH(DMI_BOARD_NAME, "CB6363"), }, }, + { + .ident = "SIMATIC IPC227E", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "SIEMENS AG"), + DMI_MATCH(DMI_PRODUCT_VERSION, "6ES7647-8B"), + }, + }, {/*sentinel*/ } };
Greg Kroah-Hartman
maintainerPATCH 74/79 powerpc/mm: Fixup tlbie vs mtpidr/mtlpidr ordering issue on POWER9
In reply to Greg Kroah-HartmanFrom: Aneesh Kumar K.V <[email protected]>
commit 047e6575aec71d75b765c22111820c4776cd1c43 upstream.
On POWER9, under some circumstances, a broadcast TLB invalidation will fail to invalidate the ERAT cache on some threads when there are parallel mtpidr/mtlpidr happening on other threads of the same core. This can cause stores to continue to go to a page after it's unmapped.
The workaround is to force an ERAT flush using PID=0 or LPID=0 tlbie flush. This additional TLB flush will cause the ERAT cache invalidation. Since we are using PID=0 or LPID=0, we don't get filtered out by the TLB snoop filtering logic.
We need to still follow this up with another tlbie to take care of store vs tlbie ordering issue explained in commit:a5d4b5891c2f ("powerpc/mm: Fixup tlbie vs store ordering issue on POWER9"). The presence of ERAT cache implies we can still get new stores and they may miss store queue marking flush.
--- arch/powerpc/include/asm/cputable.h | 3 - arch/powerpc/kernel/dt_cpu_ftrs.c | 2 arch/powerpc/kvm/book3s_hv_rm_mmu.c | 42 ++++++++++++++---- arch/powerpc/mm/hash_native_64.c | 29 +++++++++++-- arch/powerpc/mm/tlb-radix.c | 80 ++++++++++++++++++++++++++++++++---- 5 files changed, 134 insertions(+), 22 deletions(-)
arch/powerpc/include/asm/cputable.h +2 -1
@@ -214,6 +214,7 @@ static inline void cpu_feature_keys_init#define CPU_FTR_P9_TM_XER_SO_BUG LONG_ASM_CONST(0x0000200000000000)#define CPU_FTR_P9_TLBIE_STQ_BUG LONG_ASM_CONST(0x0000400000000000)#define CPU_FTR_P9_TIDR LONG_ASM_CONST(0x0000800000000000) +#define CPU_FTR_P9_TLBIE_ERAT_BUG LONG_ASM_CONST(0x0001000000000000)#ifndef __ASSEMBLY__
@@ -460,7 +461,7 @@ static inline void cpu_feature_keys_init CPU_FTR_CFAR | CPU_FTR_HVMODE | CPU_FTR_VMX_COPY | \ CPU_FTR_DBELL | CPU_FTR_HAS_PPR | CPU_FTR_ARCH_207S | \ CPU_FTR_TM_COMP | CPU_FTR_ARCH_300 | CPU_FTR_PKEY | \ - CPU_FTR_P9_TLBIE_STQ_BUG | CPU_FTR_P9_TIDR) + CPU_FTR_P9_TLBIE_STQ_BUG | CPU_FTR_P9_TLBIE_ERAT_BUG | CPU_FTR_P9_TIDR)#define CPU_FTRS_POWER9_DD2_0 CPU_FTRS_POWER9#define CPU_FTRS_POWER9_DD2_1 (CPU_FTRS_POWER9 | CPU_FTR_POWER9_DD2_1)#define CPU_FTRS_POWER9_DD2_2 (CPU_FTRS_POWER9 | CPU_FTR_POWER9_DD2_1 | \
arch/powerpc/kernel/dt_cpu_ftrs.c +2 -0
@@ -717,6 +717,8 @@ static __init void update_tlbie_feature_WARN_ONCE (1 ,"Unknown PVR" ); cur_cpu_spec->cpu_features |=CPU_FTR_P9_TLBIE_STQ_BUG ; } + + cur_cpu_spec->cpu_features |=CPU_FTR_P9_TLBIE_ERAT_BUG ; } }
arch/powerpc/kvm/book3s_hv_rm_mmu.c +32 -10
54 lines not on this page · raw message
arch/powerpc/mm/hash_native_64.c +26 -3
@@ -201,8 +201,31 @@ static inline unsigned long ___tlbie(unreturn va; } -static inline void fixup_tlbie (unsigned long vpn,int psize,int apsize,int ssize) +static inline void fixup_tlbie_vpn (unsigned long vpn,int psize, +int apsize,int ssize) { +if (cpu_has_feature (CPU_FTR_P9_TLBIE_ERAT_BUG )) { +/* Radix flush for a hash guest */ + +unsigned long rb,rs,prs,r,ric; + + rb =PPC_BIT (52 );/* IS = 2 */ + rs =0 ;/* lpid = 0 */ + prs =0 ;/* partition scoped */ + r =1 ;/* radix format */ + ric =0 ;/* RIC_FLSUH_TLB */ + +/* +* Need the extra ptesync to make sure we don't +* re-order the tlbie +*/ + asmvolatile ("ptesync" : : :"memory" ); + asm volatile(PPC_TLBIE_5(%0, %4, %3, %2, %1) + : : "r"(rb), "i"(r), "i"(prs), + "i"(ric), "r"(rs) : "memory"); + } + +if (cpu_has_feature (CPU_FTR_P9_TLBIE_STQ_BUG )) {/* Need the extra ptesync to ensure we don't reorder tlbie*/ asmvolatile ("ptesync" : : :"memory" );
@@ -287,7 +310,7 @@ static inline void tlbie(unsigned long v asmvolatile ("ptesync" : : :"memory" ); }else {__tlbie (vpn, psize, apsize, ssize); -fixup_tlbie (vpn, psize, apsize, ssize); +fixup_tlbie_vpn (vpn, psize, apsize, ssize); asmvolatile ("eieio; tlbsync; ptesync" : : :"memory" ); }if (lock_tlbie && !use_local)
@@ -860,7 +883,7 @@ static void native_flush_hash_range(unsi/* * Just do one more with the last used values. */ -fixup_tlbie (vpn, psize, psize, ssize); +fixup_tlbie_vpn (vpn, psize, psize, ssize); asmvolatile ("eieio; tlbsync; ptesync" :::"memory" );if (lock_tlbie)
arch/powerpc/mm/tlb-radix.c +72 -8
155 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 75/79 selftests/powerpc: Add test case for tlbie vs mtpidr ordering issue
In reply to Greg Kroah-HartmanFrom: Aneesh Kumar K.V <[email protected]>
commit 93cad5f789951eaa27c3392b15294b4e51253944 upstream.
--- tools/testing/selftests/powerpc/mm/Makefile | 2 tools/testing/selftests/powerpc/mm/tlbie_test.c | 734 ++++++++++++++++++++++++ 2 files changed, 736 insertions(+)
tools/testing/selftests/powerpc/mm/Makefile +2 -0
@@ -3,6 +3,7 @@ noarg: $(MAKE) -C ../ TEST_GEN_PROGS := hugetlb_vs_thp_test subpage_prot prot_sao segv_errors +TEST_GEN_PROGS_EXTENDED := tlbie_test TEST_GEN_FILES := tempfile top_srcdir = ../../../../..
@@ -15,3 +16,4 @@ $(OUTPUT)/prot_sao: ../utils.c $(OUTPUT)/tempfile: dd if=/dev/zero of=$@ bs=64k count=1 +$(OUTPUT)/tlbie_test: LDLIBS += -lpthread
tools/testing/selftests/powerpc/mm/tlbie_test.c new file +734 -0
734 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 76/79 selftests/powerpc: Fix compile error on tlbie_test due to newer gcc
In reply to Greg Kroah-HartmanFrom: Desnes A. Nunes do Rosario <[email protected]>
commit 5b216ea1c40cf06eead15054c70e238c9bd4729e upstream.
Newer versions of GCC (>= 9) demand that the size of the string to be copied must be explicitly smaller than the size of the destination. Thus, the NULL char has to be taken into account on strncpy.
This will avoid the following compiling error:
tlbie_test.c: In function 'main':
tlbie_test.c:639:4: error: 'strncpy' specified bound 100 equals destination size
strncpy(logdir, optarg, LOGDIR_NAME_SIZE);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~cc1: all warnings being treated as errors
--- tools/testing/selftests/powerpc/mm/tlbie_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/powerpc/mm/tlbie_test.c +1 -1
@@ -636,7 +636,7 @@ int main(int argc, char *argv[]) nrthreads =strtoul (optarg,NULL ,10 );break ;case 'l' : -strncpy (logdir, optarg,LOGDIR_NAME_SIZE ); +strncpy (logdir, optarg,LOGDIR_NAME_SIZE -1 );break ;case 't' : run_time =strtoul (optarg,NULL ,10 );
Greg Kroah-Hartman
maintainerPATCH 77/79 ASoC: pcm3168a: The codec does not support S32_LE
In reply to Greg Kroah-HartmanFrom: Peter Ujfalusi <[email protected]>
commit 7b2db65b59c30d58c129d3c8b2101feca686155a upstream.
24 bits is supported in all modes and 16 bit only when the codec is slave and the DAI is set to RIGHT_J.
Remove the unsupported sample format.
--- sound/soc/codecs/pcm3168a.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/codecs/pcm3168a.c +1 -2
@@ -24,8 +24,7 @@#define PCM3168A_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \ SNDRV_PCM_FMTBIT_S24_3LE | \ - SNDRV_PCM_FMTBIT_S24_LE | \ - SNDRV_PCM_FMTBIT_S32_LE) + SNDRV_PCM_FMTBIT_S24_LE)#define PCM3168A_FMT_I2S 0x0#define PCM3168A_FMT_LEFT_J 0x1
Greg Kroah-Hartman
maintainerPATCH 78/79 arm64: dts: ti: k3-am65-main: Fix gic-its node unit-address
In reply to Greg Kroah-HartmanFrom: Suman Anna <[email protected]>
commit 389ce1a7c5279ebfb682fab220b4021b2bd49c8b upstream.
The gic-its node unit-address has an additional zero compared to the actual reg value. Fix it.
--- arch/arm64/boot/dts/ti/k3-am65-main.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/ti/k3-am65-main.dtsi +1 -1
@@ -21,7 +21,7 @@ */ interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH>; - gic_its: gic-its@18200000 { + gic_its: gic-its@1820000 { compatible = "arm,gic-v3-its"; reg = <0x01820000 0x10000>; msi-controller;
Greg Kroah-Hartman
maintainerPATCH 79/79 usb: gadget: udc: core: Fix segfault if udc_bind_to_driver() for pending driver fails
In reply to Greg Kroah-HartmanFrom: Roger Quadros <[email protected]>
commit 163be6ff7739b12ff300d77897d340f661821da2 upstream.
If a gadget driver is in the pending drivers list, a UDC becomes available and udc_bind_to_driver() fails, then it gets deleted from the pending list.
i.e. list_del(&driver->pending) in check_pending_gadget_drivers().
Then if that gadget driver is unregistered, usb_gadget_unregister_driver() does a list_del(&driver->pending) again thus causing a page fault as that list entry has been poisoned by the previous list_del().
Fix this by using list_del_init() instead of list_del() in check_pending_gadget_drivers().
Test case:
- Make sure no UDC is available
- modprobe g_mass_storage file=wrongfile
- Load UDC driver so it becomes available
lun0: unable to open backing file: wrongfile
- modprobe -r g_mass_storage
[ 60.900431] Unable to handle kernel paging request at virtual address dead000000000108 [ 60.908346] Mem abort info: [ 60.911145] ESR = 0x96000044 [ 60.914227] Exception class = DABT (current EL), IL = 32 bits [ 60.920162] SET = 0, FnV = 0 [ 60.923217] EA = 0, S1PTW = 0 [ 60.926354] Data abort info: [ 60.929228] ISV = 0, ISS = 0x00000044 [ 60.933058] CM = 0, WnR = 1 [ 60.936011] [dead000000000108] address between user and kernel address ranges [ 60.943136] Internal error: Oops: 96000044 [#1] PREEMPT SMP [ 60.948691] Modules linked in: g_mass_storage(-) usb_f_mass_storage libcomposite xhci_plat_hcd xhci_hcd usbcore ti_am335x_adc kfifo_buf omap_rng cdns3 rng_core udc_core crc32_ce xfrm_user crct10dif_ce snd_so6 [ 60.993995] Process modprobe (pid: 834, stack limit = 0x00000000c2aebc69) [ 61.000765] CPU: 0 PID: 834 Comm: modprobe Not tainted 4.19.59-01963-g065f42a60499 #92 [ 61.008658] Hardware name: Texas Instruments SoC (DT) [ 61.014472] pstate: 60000005 (nZCv daif -PAN -UAO) [ 61.019253] pc : usb_gadget_unregister_driver+0x7c/0x108 [udc_core] [ 61.025503] lr : usb_gadget_unregister_driver+0x30/0x108 [udc_core] [ 61.031750] sp : ffff00001338fda0 [ 61.035049] x29: ffff00001338fda0 x28: ffff800846d40000 [ 61.040346] x27: 0000000000000000 x26: 0000000000000000 [ 61.045642] x25: 0000000056000000 x24: 0000000000000800 [ 61.050938] x23: ffff000008d7b0d0 x22: ffff0000088b07c8 [ 61.056234] x21: ffff000001100000 x20: ffff000002020260 [ 61.061530] x19: ffff0000010ffd28 x18: 0000000000000000 [ 61.066825] x17: 0000000000000000 x16: 0000000000000000 [ 61.072121] x15: 0000000000000000 x14: 0000000000000000 [ 61.077417] x13: ffff000000000000 x12: ffffffffffffffff [ 61.082712] x11: 0000000000000030 x10: 7f7f7f7f7f7f7f7f [ 61.088008] x9 : fefefefefefefeff x8 : 0000000000000000 [ 61.093304] x7 : ffffffffffffffff x6 : 000000000000ffff [ 61.098599] x5 : 8080000000000000 x4 : 0000000000000000 [ 61.103895] x3 : ffff000001100020 x2 : ffff800846d40000 [ 61.109190] x1 : dead000000000100 x0 : dead000000000200 [ 61.114486] Call trace: [ 61.116922] usb_gadget_unregister_driver+0x7c/0x108 [udc_core] [ 61.122828] usb_composite_unregister+0x10/0x18 [libcomposite] [ 61.128643] msg_cleanup+0x18/0xfce0 [g_mass_storage] [ 61.133682] __arm64_sys_delete_module+0x17c/0x1f0 [ 61.138458] el0_svc_common+0x90/0x158 [ 61.142192] el0_svc_handler+0x2c/0x80 [ 61.145926] el0_svc+0x8/0xc [ 61.148794] Code: eb03003f d10be033 54ffff21 a94d0281 (f9000420) [ 61.154869] ---[ end trace afb22e9b637bd9a7 ]---
Segmentation fault
--- drivers/usb/gadget/udc/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/udc/core.c +1 -1
@@ -1149,7 +1149,7 @@ static int check_pending_gadget_drivers( dev_name(&udc->dev)) == 0) { ret =udc_bind_to_driver (udc, driver);if (ret != -EPROBE_DEFER ) -list_del (&driver->pending); +list_del_init (&driver->pending);break ; }
stable-rc/linux-4.19.y boot: 116 boots: 0 failed, 109 passed with 7 offline (v4.19.82-80-gb56f5a59d51a)
stable-rc/linux-4.19.y boot: 116 boots: 0 failed, 109 passed with 7 offline (v4.19.82-80-gb56f5a59d51a)
Full Boot Summary: https://kernelci.org/boot/all/job/stable-rc/branch/linux-4.19.y/kernel/v4.19.82-80-gb56f5a59d51a/
Full Build Summary: https://kernelci.org/build/stable-rc/branch/linux-4.19.y/kernel/v4.19.82-80-gb56f5a59d51a/
Tree: stable-rc
Branch: linux-4.19.y
Git Describe: v4.19.82-80-gb56f5a59d51a
Git Commit: b56f5a59d51ac99b2c9af3df39a0a7a573053bcc
Git URL: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
Tested: 68 unique boards, 22 SoC families, 14 builds out of 206
Offline Platforms:
arm:
sunxi_defconfig:
gcc-8
sun5i-r8-chip: 1 offline lab
sun7i-a20-bananapi: 1 offline lab
multi_v7_defconfig:
gcc-8
qcom-apq8064-cm-qs600: 1 offline lab
sun5i-r8-chip: 1 offline lab
sun7i-a20-bananapi: 1 offline lab
davinci_all_defconfig:
gcc-8
dm365evm,legacy: 1 offline lab
qcom_defconfig:
gcc-8
qcom-apq8064-cm-qs600: 1 offline lab---
For more info write to <[email protected]>
Hi folks,
what I am really missing in those reports is complete build results. Below it says:
Tested: 68 unique boards, 22 SoC families, 14 builds out of 206
but that is not really correct. On the kernelci web site,
https://kernelci.org/job/stable-rc/branch/linux-4.19.y/ tells me that 206 builds passed, not just 14. Even the referenced
https://kernelci.org/build/stable-rc/branch/linux-4.19.y/kernel/v4.19.82-80-gb56f5a59d51a/
clearly shows that way more than 14 builds passed.
Can we include this information in the report to the community, possibly including build errors if there are any ?
On a side note, I am not sure if the offline information adds ay value in the report to the community. I personally I find it just confusing. Can we possibly drop it ? I mean, really, who cares if there are systems offline, and which systems are offline. I'd rather send such messages to the lab owners, not to everyone in the world.
Thanks,
Guenter
-------- Forwarded Message --------
Subject: Re: [PATCH 4.19 00/79] 4.19.83-stable review
Date: Fri, 08 Nov 2019 15:57:51 -0800 (PST)
From: kernelci.org bot <[email protected]>
To: Greg Kroah-Hartman <[email protected]>, [email protected]
CC: Greg Kroah-Hartman <[email protected]>, [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
stable-rc/linux-4.19.y boot: 116 boots: 0 failed, 109 passed with 7 offline (v4.19.82-80-gb56f5a59d51a)
Full Boot Summary: https://kernelci.org/boot/all/job/stable-rc/branch/linux-4.19.y/kernel/v4.19.82-80-gb56f5a59d51a/
Full Build Summary: https://kernelci.org/build/stable-rc/branch/linux-4.19.y/kernel/v4.19.82-80-gb56f5a59d51a/
Tree: stable-rc
Branch: linux-4.19.y
Git Describe: v4.19.82-80-gb56f5a59d51a
Git Commit: b56f5a59d51ac99b2c9af3df39a0a7a573053bcc
Git URL: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
Tested: 68 unique boards, 22 SoC families, 14 builds out of 206
Offline Platforms:
arm:
sunxi_defconfig:
gcc-8
sun5i-r8-chip: 1 offline lab
sun7i-a20-bananapi: 1 offline lab
multi_v7_defconfig:
gcc-8
qcom-apq8064-cm-qs600: 1 offline lab
sun5i-r8-chip: 1 offline lab
sun7i-a20-bananapi: 1 offline lab
davinci_all_defconfig:
gcc-8
dm365evm,legacy: 1 offline lab
qcom_defconfig:
gcc-8
qcom-apq8064-cm-qs600: 1 offline lab---
For more info write to <[email protected]>
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.83 release. There are 79 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun 10 Nov 2019 05:42:11 PM UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.83-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
Summary
------------------------------------------------------------------------
kernel: 4.19.83-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.19.y
git commit: b56f5a59d51ac99b2c9af3df39a0a7a573053bcc
git describe: v4.19.82-80-gb56f5a59d51a
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-4.19-oe/build/v4.19.82-80-gb56f5a59d51a
No regressions (compared to build v4.19.82-80-g54bd90285427)
No fixes (compared to build v4.19.82-80-g54bd90285427)
Ran 23927 total tests in the following environments and test suites.
Environments
--------------
- dragonboard-410c
- hi6220-hikey
- i386
- juno-r2
- qemu_arm
- qemu_arm64
- qemu_i386
- qemu_x86_64
- x15
- x86
Test Suites
-----------
* build
* install-android-platform-tools-r2600
* kselftest
* libgpiod
* libhugetlbfs
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-containers-tests
* ltp-cpuhotplug-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* perf
* spectre-meltdown-checker-test
* v4l2-compliance
* network-basic-tests
* ltp-open-posix-tests
* kvm-unit-tests
* ssuite
* kselftest-vsyscall-mode-native
* kselftest-vsyscall-mode-none
Signature · 2 lines
Linaro LKFT https://lkft.linaro.org
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.83 release. There are 79 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun 10 Nov 2019 05:42:11 PM UTC. Anything received after that time might be too late.
Build results:
total: 156 pass: 156 fail: 0 Qemu test results: total: 390 pass: 390 fail: 0
Guenter