4.10.5-stable review
Subsystems (6)
Greg Kroah-Hartman
maintainercover 4.10.5-stable review
This is the start of the stable review cycle for the 4.10.5 release. There are 63 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 Wed Mar 22 17:47:25 UTC 2017. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.10.5-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.10.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.10.5-rc1
Krzysztof Kozlowski <[email protected]>
crypto: s5p-sss - Fix spinlock recursion on LRW(AES)
Daniel Axtens <[email protected]>
crypto: powerpc - Fix initialisation of crc32c context
Niklas Cassel <[email protected]>
locking/rwsem: Fix down_write_killable() for CONFIG_RWSEM_GENERIC_SPINLOCK=y
Peter Zijlstra <[email protected]>
futex: Add missing error handling to FUTEX_REQUEUE_PI
Peter Zijlstra <[email protected]>
futex: Fix potential use-after-free in FUTEX_REQUEUE_PI
Andy Lutomirski <[email protected]>
x86/perf: Fix CR4.PCE propagation to use active_mm instead of mm
Jiri Olsa <[email protected]>
x86/intel_rdt: Put group node in rdtgroup_kn_unlock
Andrey Ryabinin <[email protected]>
x86/kasan: Fix boot with KASAN=y and PROFILE_ANNOTATED_BRANCHES=y
Peter Zijlstra <[email protected]>
x86/tsc: Fix ART for TSC_KNOWN_FREQ
Josh Poimboeuf <[email protected]>
x86/unwind: Fix last frame check for aligned function stacks
Imre Deak <[email protected]>
drm/i915/lspcon: Fix resume time initialization due to unasserted HPD
Imre Deak <[email protected]>
drm/i915/gen9+: Enable hotplug detection early
Imre Deak <[email protected]>
drm/i915/lspcon: Enable AUX interrupts for resume time initialization
Shanker Donthineni <[email protected]>
irqchip/gicv3-its: Add workaround for QDF2400 ITS erratum 0065
Marc Zyngier <[email protected]>
arm64: KVM: VHE: Clear HCR_TGE when invalidating guest TLBs
Hannes Frederic Sowa <[email protected]>
dccp: fix memory leak during tear-down of unsuccessful connection request
Hannes Frederic Sowa <[email protected]>
tun: fix premature POLLOUT notification on tun devices
Jon Maxwell <[email protected]>
dccp/tcp: fix routing redirect race
Andrey Vagin <[email protected]>
net: use net->count to check whether a netns is alive or not
Florian Westphal <[email protected]>
bridge: drop netfilter fake rtable unconditionally
Florian Westphal <[email protected]>
ipv6: avoid write to a possibly cloned skb
Sabrina Dubroca <[email protected]>
ipv6: make ECMP route replacement less greedy
David Ahern <[email protected]>
mpls: Do not decrement alive counter for unregister events
David Ahern <[email protected]>
mpls: Send route delete notifications when router module is unloaded
Etienne Noss <[email protected]>
act_connmark: avoid crashing on malformed nlattrs with null parms
Lendacky, Thomas <[email protected]>
amd-xgbe: Enable IRQs only if napi_complete_done() is true
Dmitry V. Levin <[email protected]>
uapi: fix linux/packet_diag.h userspace compilation error
Paolo Abeni <[email protected]>
net/tunnel: set inner protocol in network gro hooks
David Ahern <[email protected]>
vrf: Fix use-after-free in vrf_xmit
Jarod Wilson <[email protected]>
team: use ETH_MAX_MTU as max mtu
Eric Dumazet <[email protected]>
dccp: fix use-after-free in dccp_feat_activate_values
Alexey Khoroshilov <[email protected]>
net/sched: act_skbmod: remove unneeded rcu_read_unlock in tcf_skbmod_dump
Eric Dumazet <[email protected]>
net: fix socket refcounting in skb_complete_tx_timestamp()
Eric Dumazet <[email protected]>
net: fix socket refcounting in skb_complete_wifi_ack()
Eric Dumazet <[email protected]>
tcp: fix various issues for sockets morphing to listen state
WANG Cong <[email protected]>
strparser: destroy workqueue on module exit
WANG Cong <[email protected]>
bonding: use ETH_MAX_MTU as max mtu
Lendacky, Thomas <[email protected]>
amd-xgbe: Don't overwrite SFP PHY mod_absent settings
Lendacky, Thomas <[email protected]>
amd-xgbe: Be sure to set MDIO modes on device (re)start
Lendacky, Thomas <[email protected]>
amd-xgbe: Stop the PHY before releasing interrupts
Arnaldo Carvalho de Melo <[email protected]>
dccp: Unlock sock before calling sk_free()
Eric Dumazet <[email protected]>
ipv6: orphan skbs in reassembly unit
Eric Dumazet <[email protected]>
net: net_enable_timestamp() can be called from irq contexts
Alexander Potapenko <[email protected]>
net: don't call strlen() on the user buffer in packet_bind_spkt()
Mike Manning <[email protected]>
net: bridge: allow IPv6 when multicast flood is disabled
Eric Dumazet <[email protected]>
tcp/dccp: block BH for SYN processing
Ido Schimmel <[email protected]>
mlxsw: spectrum_router: Avoid potential packets loss
Jakub Kicinski <[email protected]>
geneve: lock RCU on TX path
Jakub Kicinski <[email protected]>
vxlan: lock RCU on TX path
Paul Hüber <[email protected]>
l2tp: avoid use-after-free caused by l2tp_ip_backlog_recv
Roman Mashak <[email protected]>
net sched actions: decrement module reference count after table flush.
Xin Long <[email protected]>
sctp: set sin_port for addr param when checking duplicate address
Julian Anastasov <[email protected]>
ipv4: mask tos for input route
Julian Anastasov <[email protected]>
ipv4: add missing initialization for flowi4_uid
Brian Russell <[email protected]>
vxlan: don't allow overwrite of config src addr
David Forster <[email protected]>
vti6: return GRE_KEY for vti6
Matthias Schiffer <[email protected]>
vxlan: correctly validate VXLAN ID against VXLAN_N_VID
Marcelo Ricardo Leitner <[email protected]>
sctp: deny peeloff operation on asocs with threads sleeping on it
Tariq Toukan <[email protected]>
net/mlx5e: Fix wrong CQE decompression
Saeed Mahameed <[email protected]>
net/mlx5e: Update MPWQE stride size when modifying CQE compress state
Tariq Toukan <[email protected]>
net/mlx5e: Fix broken CQE compression initialization
Tariq Toukan <[email protected]>
net/mlx5e: Do not reduce LRO WQE size when not using build_skb
Saeed Mahameed <[email protected]>
net/mlx5e: Register/unregister vport representors on interface attach/detach
-------------
Diffstat:
Documentation/arm64/silicon-errata.txt | 44 +++---- Makefile | 4 +- arch/arm64/Kconfig | 10 ++ arch/arm64/kvm/hyp/tlb.c | 64 +++++++++-- arch/powerpc/crypto/crc32c-vpmsum_glue.c | 2 +- arch/x86/events/core.c | 4 +- arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 2 +- arch/x86/kernel/head64.c | 1 + arch/x86/kernel/tsc.c | 2 + arch/x86/kernel/unwind_frame.c | 36 +++++- arch/x86/mm/kasan_init_64.c | 1 + drivers/crypto/s5p-sss.c | 127 +++++++++++++-------- drivers/gpu/drm/i915/i915_drv.c | 5 +- drivers/gpu/drm/i915/i915_irq.c | 69 ++++++++--- drivers/gpu/drm/i915/intel_dp.c | 4 +- drivers/gpu/drm/i915/intel_drv.h | 2 + drivers/gpu/drm/i915/intel_lspcon.c | 5 +- drivers/irqchip/irq-gic-v3-its.c | 16 +++ drivers/net/bonding/bond_main.c | 1 + drivers/net/ethernet/amd/xgbe/xgbe-dev.c | 2 +- drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 14 +-- drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 24 ++++ drivers/net/ethernet/mellanox/mlx5/core/en.h | 1 + .../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 1 + drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 40 ++++--- drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 14 +-- .../net/ethernet/mellanox/mlxsw/spectrum_router.c | 30 +++-- drivers/net/geneve.c | 2 + drivers/net/team/team.c | 1 + drivers/net/tun.c | 18 ++- drivers/net/vrf.c | 3 +- drivers/net/vxlan.c | 22 ++-- include/linux/dccp.h | 1 + include/uapi/linux/packet_diag.h | 2 +- kernel/futex.c | 22 ++-- kernel/locking/rwsem-spinlock.c | 15 ++- net/bridge/br_forward.c | 3 +- net/bridge/br_input.c | 1 + net/bridge/br_netfilter_hooks.c | 21 ---- net/core/dev.c | 35 +++++- net/core/net-sysfs.c | 6 +- net/core/skbuff.c | 30 ++--- net/dccp/ccids/ccid2.c | 1 + net/dccp/input.c | 10 +- net/dccp/ipv4.c | 3 +- net/dccp/ipv6.c | 8 +- net/dccp/minisocks.c | 25 ++-- net/ipv4/af_inet.c | 4 +- net/ipv4/fib_frontend.c | 6 +- net/ipv4/route.c | 2 + net/ipv4/tcp_input.c | 10 +- net/ipv4/tcp_ipv4.c | 10 +- net/ipv4/tcp_timer.c | 6 +- net/ipv6/ip6_fib.c | 2 + net/ipv6/ip6_offload.c | 4 +- net/ipv6/ip6_output.c | 7 +- net/ipv6/ip6_vti.c | 4 + net/ipv6/netfilter/nf_conntrack_reasm.c | 1 + net/ipv6/tcp_ipv6.c | 8 +- net/l2tp/l2tp_ip.c | 2 +- net/mpls/af_mpls.c | 4 +- net/openvswitch/conntrack.c | 1 - net/packet/af_packet.c | 8 +- net/sched/act_api.c | 5 +- net/sched/act_connmark.c | 3 + net/sched/act_skbmod.c | 1 - net/sctp/protocol.c | 6 +- net/sctp/socket.c | 8 +- net/strparser/strparser.c | 1 + 69 files changed, 588 insertions(+), 269 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/63 net/mlx5e: Register/unregister vport representors on interface attach/detach
4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Saeed Mahameed <[email protected]>
[ Upstream commit 6f08a22c5fb2b9aefb8ecd8496758e7a677c1fde ]
Currently vport representors are added only on driver load and removed on driver unload. Apparently we forgot to handle them when we added the seamless reset flow feature. This caused to leave the representors netdevs alive and active with open HW resources on pci shutdown and on error reset flows.
To overcome this we move their handling to interface attach/detach, so they would be cleaned up on shutdown and recreated on reset flows.
--- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 23 ++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +15 -8
@@ -3940,6 +3940,19 @@ static void mlx5e_register_vport_rep(str } } +static void mlx5e_unregister_vport_rep (struct mlx5_core_dev *mdev) +{ +struct mlx5_eswitch *esw = mdev->priv.eswitch; +int total_vfs =MLX5_TOTAL_VPORTS (mdev); +int vport; + +if (!MLX5_CAP_GEN (mdev, vport_group_manager)) +return ; + +for (vport =1 ; vport < total_vfs; vport++) +mlx5_eswitch_unregister_vport_rep (esw, vport); +} +void mlx5e_detach_netdev (struct mlx5_core_dev *mdev,struct net_device *netdev) {struct mlx5e_priv *priv =netdev_priv (netdev);
@@ -3986,6 +3999,7 @@ static int mlx5e_attach(struct mlx5_corereturn err; } +mlx5e_register_vport_rep (mdev);return 0 ; }
@@ -3997,6 +4011,7 @@ static void mlx5e_detach(struct mlx5_corif (!netif_device_present (netdev))return ; +mlx5e_unregister_vport_rep (mdev);mlx5e_detach_netdev (mdev, netdev);mlx5e_destroy_mdev_resources (mdev); }
@@ -4015,8 +4030,6 @@ static void *mlx5e_add(struct mlx5_core_if (err)return NULL ; -mlx5e_register_vport_rep (mdev); -if (MLX5_CAP_GEN (mdev, vport_group_manager)) ppriv = &esw->offloads.vport_reps[0 ];
@@ -4068,13 +4081,7 @@ void mlx5e_destroy_netdev(struct mlx5_costatic void mlx5e_remove (struct mlx5_core_dev *mdev,void *vpriv) { -struct mlx5_eswitch *esw = mdev->priv.eswitch; -int total_vfs =MLX5_TOTAL_VPORTS (mdev);struct mlx5e_priv *priv = vpriv; -int vport; - -for (vport =1 ; vport < total_vfs; vport++) -mlx5_eswitch_unregister_vport_rep (esw, vport);unregister_netdev (priv->netdev);mlx5e_detach (mdev, vpriv);
Greg Kroah-Hartman
maintainerPATCH 2/63 net/mlx5e: Do not reduce LRO WQE size when not using build_skb
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tariq Toukan <[email protected]>
[ Upstream commit 4078e637c12f1e0a74293f1ec9563f42bff14a03 ]
When rq_type is Striding RQ, no room of SKB_RESERVE is needed as SKB allocation is not done via build_skb.
--- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +5 -6
@@ -81,6 +81,7 @@ static bool mlx5e_check_fragmented_stridstatic void mlx5e_set_rq_type_params (struct mlx5e_priv *priv,u8 rq_type) { priv->params.rq_wq_type = rq_type; + priv->params.lro_wqe_sz =MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ ;switch (priv->params.rq_wq_type) {case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ : priv->params.log_rq_size =MLX5E_PARAMS_DEFAULT_LOG_RQ_SIZE_MPW ;
@@ -93,6 +94,10 @@ static void mlx5e_set_rq_type_params(strbreak ;default :/* MLX5_WQ_TYPE_LINKED_LIST */ priv->params.log_rq_size =MLX5E_PARAMS_DEFAULT_LOG_RQ_SIZE ; + +/* Extra room needed for build_skb */ + priv->params.lro_wqe_sz -=MLX5_RX_HEADROOM + +SKB_DATA_ALIGN (sizeof (struct skb_shared_info )); } priv->params.min_rx_wqes =mlx5_min_rx_wqes (priv->params.rq_wq_type,BIT (priv->params.log_rq_size));
@@ -3517,12 +3522,6 @@ static void mlx5e_build_nic_netdev_priv(mlx5e_build_default_indir_rqt (mdev, priv->params.indirection_rqt,MLX5E_INDIR_RQT_SIZE , profile->max_nch (mdev)); - priv->params.lro_wqe_sz = -MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ - -/* Extra room needed for build_skb */ -MLX5_RX_HEADROOM - -SKB_DATA_ALIGN (sizeof (struct skb_shared_info )); -/* Initialize pflags */ MLX5E_SET_PFLAG (priv,MLX5E_PFLAG_RX_CQE_BASED_MODER , priv->params.rx_cq_period_mode ==MLX5_CQ_PERIOD_MODE_START_FROM_CQE );
Greg Kroah-Hartman
maintainerPATCH 3/63 net/mlx5e: Fix broken CQE compression initialization
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tariq Toukan <[email protected]>
[ Upstream commit b0d4660b4cc52e6477ca3a43435351d565dfcedc ]
Some of RQ type parameters are derived from CQE compression state flag, CQE compression flag was initialized only after RQ type parameters setup. This leads to load RQ with stride size smaller than what we want for when CQE compression is on.
This bug introduces no functional damage, it only makes CQE compression occur less often, since in ConnectX4-LX CQE compression is performed only on packets smaller than stride size.
Fix this by marking default status of CQE compression in PFLAG prior to calling mlx5e_set_rq_priv_params(), as it inits some fields based on it.
Tested:
load driver on systems where rx CQE compress will be on (MH) pktgen with 64 < pkt size < 256 and netperf TCP_STREAM (IPv4/IPv6) verify ethtool -S ethxx | grep compress are advancing more often (rapidly)
--- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +3 -1
@@ -3500,6 +3500,9 @@ static void mlx5e_build_nic_netdev_priv(cqe_compress_heuristic (link_speed, pci_bw); } +MLX5E_SET_PFLAG (priv,MLX5E_PFLAG_RX_CQE_COMPRESS , + priv->params.rx_cqe_compress_def); +mlx5e_set_rq_priv_params (priv);if (priv->params.rq_wq_type ==MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ ) priv->params.lro_en = true;
@@ -3525,7 +3528,6 @@ static void mlx5e_build_nic_netdev_priv(/* Initialize pflags */ MLX5E_SET_PFLAG (priv,MLX5E_PFLAG_RX_CQE_BASED_MODER , priv->params.rx_cq_period_mode ==MLX5_CQ_PERIOD_MODE_START_FROM_CQE ); -MLX5E_SET_PFLAG (priv,MLX5E_PFLAG_RX_CQE_COMPRESS , priv->params.rx_cqe_compress_def);mutex_init (&priv->state_lock);
Greg Kroah-Hartman
maintainerPATCH 4/63 net/mlx5e: Update MPWQE stride size when modifying CQE compress state
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Saeed Mahameed <[email protected]>
[ Upstream commit 6dc4b54e77282caf17f0ff72aa32dd296037fbc0 ]
When the admin enables/disables cqe compression, updating mpwqe stride size is required:
CQE compress ON ==> stride size = 256B
CQE compress OFF ==> stride size = 64BThis is already done on driver load via mlx5e_set_rq_type_params, all we need is just to call it on arbitrary admin changes of cqe compression state via priv flags or when changing timestamping state
(as it is mutually exclusive with cqe compression).
This bug introduces no functional damage, it only makes cqe compression occur less often, since in ConnectX4-LX CQE compression is performed only on packets smaller than stride size.
Tested:
ethtool --set-priv-flags ethxx rx_cqe_compress on
pktgen with 64 < pkt size < 256 and netperf TCP_STREAM (IPv4/IPv6) verify ethtool -S ethxx | grep compress are advancing more often (rapidly)
--- drivers/net/ethernet/mellanox/mlx5/core/en.h | 1 + drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 1 + drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 1 + 4 files changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en.h +1 -0
@@ -803,6 +803,7 @@ int mlx5e_get_max_linkspeed(struct mlx5_void mlx5e_set_rx_cq_mode_params (struct mlx5e_params *params,u8 cq_period_mode); +void mlx5e_set_rq_type_params (struct mlx5e_priv *priv,u8 rq_type);static inline void mlx5e_tx_notify_hw (struct mlx5e_sq *sq,struct mlx5_wqe_ctrl_seg *ctrl,int bf_sz)
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +1 -0
@@ -1477,6 +1477,7 @@ static int set_pflag_rx_cqe_compress(strMLX5E_SET_PFLAG (priv,MLX5E_PFLAG_RX_CQE_COMPRESS , enable); priv->params.rx_cqe_compress_def = enable; +mlx5e_set_rq_type_params (priv, priv->params.rq_wq_type);if (reset) err =mlx5e_open_locked (netdev);
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +1 -1
@@ -78,7 +78,7 @@ static bool mlx5e_check_fragmented_stridMLX5_CAP_ETH (mdev, reg_umr_sq); } -static void mlx5e_set_rq_type_params (struct mlx5e_priv *priv,u8 rq_type) +void mlx5e_set_rq_type_params (struct mlx5e_priv *priv,u8 rq_type) { priv->params.rq_wq_type = rq_type; priv->params.lro_wqe_sz =MLX5E_PARAMS_DEFAULT_LRO_WQE_SZ ;
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +1 -0
@@ -172,6 +172,7 @@ void mlx5e_modify_rx_cqe_compression(strmlx5e_close_locked (priv->netdev);MLX5E_SET_PFLAG (priv,MLX5E_PFLAG_RX_CQE_COMPRESS , val); +mlx5e_set_rq_type_params (priv, priv->params.rq_wq_type);if (was_opened)mlx5e_open_locked (priv->netdev);
Greg Kroah-Hartman
maintainerPATCH 5/63 net/mlx5e: Fix wrong CQE decompression
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tariq Toukan <[email protected]>
[ Upstream commit 36154be40a28e4afaa0416da2681d80b7e2ca319 ]
In cqe compression with striding RQ, the decompression of the CQE field wqe_counter was done with a wrong wraparound value.
This caused handling cqes with a wrong pointer to wqe (rx descriptor) and creating SKBs with wrong data, pointing to wrong (and already consumed) strides/pages.
The meaning of the CQE field wqe_counter in striding RQ holds the stride index instead of the WQE index. Hence, when decompressing a CQE, wqe_counter should have wrapped-around the number of strides in a single multi-packet WQE.
We dropped this wrap-around mask at all in CQE decompression of striding RQ. It is not needed as in such cases the CQE compression session would break because of different value of wqe_id field, starting a new compression session.
Tested:
ethtool -K ethxx lro off/on
ethtool --set-priv-flags ethxx rx_cqe_compress on super_netperf 16 {ipv4,ipv6} -t TCP_STREAM -m 50 -D verified no csum errors and no page refcount issues.
--- drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +6 -7
@@ -92,19 +92,18 @@ static inline void mlx5e_cqes_update_ownstatic inline void mlx5e_decompress_cqe (struct mlx5e_rq *rq,struct mlx5e_cq *cq,u32 cqcc) { -u16 wqe_cnt_step; - cq->title.byte_cnt = cq->mini_arr[cq->mini_arr_idx].byte_cnt; cq->title.check_sum = cq->mini_arr[cq->mini_arr_idx].checksum; cq->title.op_own &=0xf0 ; cq->title.op_own |=0x01 & (cqcc >> cq->wq.log_sz); cq->title.wqe_counter =cpu_to_be16 (cq->decmprs_wqe_counter); - wqe_cnt_step = - rq->wq_type ==MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ ? -mpwrq_get_cqe_consumed_strides (&cq->title) :1 ; - cq->decmprs_wqe_counter = - (cq->decmprs_wqe_counter + wqe_cnt_step) & rq->wq.sz_m1; +if (rq->wq_type ==MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ ) + cq->decmprs_wqe_counter += +mpwrq_get_cqe_consumed_strides (&cq->title); +else + cq->decmprs_wqe_counter = + (cq->decmprs_wqe_counter +1 ) & rq->wq.sz_m1; } static inline void mlx5e_decompress_cqe_no_hash(struct mlx5e_rq *rq,
Greg Kroah-Hartman
maintainerPATCH 6/63 sctp: deny peeloff operation on asocs with threads sleeping on it
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marcelo Ricardo Leitner <[email protected]>
[ Upstream commit dfcb9f4f99f1e9a49e43398a7bfbf56927544af1 ]
commit 2dcab5984841 ("sctp: avoid BUG_ON on sctp_wait_for_sndbuf") attempted to avoid a BUG_ON call when the association being used for a sendmsg() is blocked waiting for more sndbuf and another thread did a peeloff operation on such asoc, moving it to another socket.
As Ben Hutchings noticed, then in such case it would return without locking back the socket and would cause two unlocks in a row.
Further analysis also revealed that it could allow a double free if the application managed to peeloff the asoc that is created during the sendmsg call, because then sctp_sendmsg() would try to free the asoc that was created only for that call.
This patch takes another approach. It will deny the peeloff operation if there is a thread sleeping on the asoc, so this situation doesn't exist anymore. This avoids the issues described above and also honors the syscalls that are already being handled (it can be multiple sendmsg calls).
Joint work with Xin Long.
--- net/sctp/socket.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/sctp/socket.c +6 -2
@@ -4734,6 +4734,12 @@ int sctp_do_peeloff(struct sock *sk, sctif (!asoc)return -EINVAL ; +/* If there is a thread waiting on more sndbuf space for +* sending on this asoc, it cannot be peeled. +*/ +if (waitqueue_active (&asoc->wait)) +return -EBUSY ; +/* An association cannot be branched off from an already peeled-off * socket, nor is this supported for tcp style sockets. */
@@ -7426,8 +7432,6 @@ static int sctp_wait_for_sndbuf(struct s*/ release_sock (sk); current_timeo =schedule_timeout (current_timeo); -if (sk != asoc->base.sk) - goto do_error;lock_sock (sk); *timeo_p = current_timeo;
Greg Kroah-Hartman
maintainerPATCH 7/63 vxlan: correctly validate VXLAN ID against VXLAN_N_VID
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthias Schiffer <[email protected]>
[ Upstream commit 4e37d6911f36545b286d15073f6f2222f840e81c ]
The incorrect check caused an off-by-one error: the maximum VID 0xffffff was unusable.
--- drivers/net/vxlan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/vxlan.c +1 -1
@@ -2626,7 +2626,7 @@ static int vxlan_validate(struct nlattrif (data[IFLA_VXLAN_ID ]) {__u32 id =nla_get_u32 (data[IFLA_VXLAN_ID ]); -if (id >=VXLAN_VID_MASK ) +if (id >=VXLAN_N_VID )return -ERANGE ; }
Greg Kroah-Hartman
maintainerPATCH 8/63 vti6: return GRE_KEY for vti6
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Forster <[email protected]>
[ Upstream commit 7dcdf941cdc96692ab99fd790c8cc68945514851 ]
Align vti6 with vti by returning GRE_KEY flag. This enables iproute2 to display tunnel keys on "ip -6 tunnel show"
--- net/ipv6/ip6_vti.c | 4 ++++ 1 file changed, 4 insertions(+)
net/ipv6/ip6_vti.c +4 -0
@@ -692,6 +692,10 @@ vti6_parm_to_user(struct ip6_tnl_parm2 * u->link = p->link; u->i_key = p->i_key; u->o_key = p->o_key; +if (u->i_key) + u->i_flags |=GRE_KEY ; +if (u->o_key) + u->o_flags |=GRE_KEY ; u->proto = p->proto;memcpy (u->name, p->name,sizeof (u->name));
Greg Kroah-Hartman
maintainerPATCH 9/63 vxlan: dont allow overwrite of config src addr
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brian Russell <[email protected]>
[ Upstream commit 1158632b5a2dcce0786c1b1b99654e81cc867981 ]
When using IPv6 transport and a default dst, a pointer to the configured source address is passed into the route lookup. If no source address is configured, then the value is overwritten.
IPv6 route lookup ignores egress ifindex match if the source address is set, so if egress ifindex match is desired, the source address must be passed as any. The overwrite breaks this for subsequent lookups.
Avoid this by copying the configured address to an existing stack variable and pass a pointer to that instead.
--- drivers/net/vxlan.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/net/vxlan.c +5 -7
@@ -1992,7 +1992,6 @@ static void vxlan_xmit_one(struct sk_bufconst struct iphdr *old_iph =ip_hdr (skb);union vxlan_addr *dst;union vxlan_addr remote_ip, local_ip; -union vxlan_addr *src;struct vxlan_metadata _md;struct vxlan_metadata *md = &_md;__be16 src_port =0 , dst_port;
@@ -2019,7 +2018,7 @@ static void vxlan_xmit_one(struct sk_buf dst_port = rdst->remote_port ? rdst->remote_port : vxlan->cfg.dst_port; vni = rdst->remote_vni; - src = &vxlan->cfg.saddr; + local_ip = vxlan->cfg.saddr; dst_cache = &rdst->dst_cache; md->gbp = skb->mark; ttl = vxlan->cfg.ttl;
@@ -2052,7 +2051,6 @@ static void vxlan_xmit_one(struct sk_buf dst = &remote_ip; dst_port = info->key.tp_dst ? : vxlan->cfg.dst_port; vni =tunnel_id_to_key32 (info->key.tun_id); - src = &local_ip; dst_cache = &info->dst_cache;if (info->options_len) md =ip_tunnel_info_opts (info);
@@ -2072,7 +2070,7 @@ static void vxlan_xmit_one(struct sk_buf rt =vxlan_get_route (vxlan, dev, sock4, skb, rdst ? rdst->remote_ifindex :0 , tos, dst->sin.sin_addr.s_addr, - &src->sin.sin_addr.s_addr, + &local_ip.sin.sin_addr.s_addr, dst_port, src_port, dst_cache, info);if (IS_ERR (rt)) {
@@ -2099,7 +2097,7 @@ static void vxlan_xmit_one(struct sk_bufif (err <0 ) goto tx_error; -udp_tunnel_xmit_skb (rt, sock4->sock->sk, skb, src->sin.sin_addr.s_addr, +udp_tunnel_xmit_skb (rt, sock4->sock->sk, skb, local_ip.sin.sin_addr.s_addr, dst->sin.sin_addr.s_addr, tos, ttl, df, src_port, dst_port, xnet, !udp_sum);#if IS_ENABLED (CONFIG_IPV6 )
@@ -2109,7 +2107,7 @@ static void vxlan_xmit_one(struct sk_buf ndst =vxlan6_get_route (vxlan, dev, sock6, skb, rdst ? rdst->remote_ifindex :0 , tos, label, &dst->sin6.sin6_addr, - &src->sin6.sin6_addr, + &local_ip.sin6.sin6_addr, dst_port, src_port, dst_cache, info);if (IS_ERR (ndst)) {
@@ -2137,7 +2135,7 @@ static void vxlan_xmit_one(struct sk_buf goto tx_error;udp_tunnel6_xmit_skb (ndst, sock6->sock->sk, skb, dev, - &src->sin6.sin6_addr, + &local_ip.sin6.sin6_addr, &dst->sin6.sin6_addr, tos, ttl, label, src_port, dst_port, !udp_sum);#endif
Greg Kroah-Hartman
maintainerPATCH 10/63 ipv4: add missing initialization for flowi4_uid
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Julian Anastasov <[email protected]>
[ Upstream commit 8bcfd0925ef15f072ba1e7bee2c25e9e1b5fd6ca ]
Avoid matching of random stack value for uid when rules are looked up on input route or when RP filter is used. Problem should affect only setups that use ip rules with uid range.
--- net/ipv4/fib_frontend.c | 6 +++--- net/ipv4/route.c | 1 + 2 files changed, 4 insertions(+), 3 deletions(-)
net/ipv4/fib_frontend.c +3 -3
@@ -319,7 +319,7 @@ static int __fib_validate_source(structint ret, no_addr;struct fib_result res;struct flowi4 fl4; -struct net *net; +struct net *net =dev_net (dev);bool dev_match; fl4.flowi4_oif =0 ;
@@ -332,6 +332,7 @@ static int __fib_validate_source(struct fl4.flowi4_scope =RT_SCOPE_UNIVERSE ; fl4.flowi4_tun_key.tun_id =0 ; fl4.flowi4_flags =0 ; + fl4.flowi4_uid =sock_net_uid (net,NULL ); no_addr = idev->ifa_list ==NULL ;
@@ -339,13 +340,12 @@ static int __fib_validate_source(structtrace_fib_validate_source (dev, &fl4); - net =dev_net (dev);if (fib_lookup (net, &fl4, &res,0 )) goto last_resort;if (res.type !=RTN_UNICAST && (res.type !=RTN_LOCAL || !IN_DEV_ACCEPT_LOCAL (idev))) goto e_inval; -if (!rpf && !fib_num_tclassid_users (dev_net (dev)) && +if (!rpf && !fib_num_tclassid_users (net) && (dev->ifindex != oif || !IN_DEV_TX_REDIRECTS (idev))) goto last_resort;fib_combine_itag (itag, &res);
net/ipv4/route.c +1 -0
@@ -1858,6 +1858,7 @@ static int ip_route_input_slow(struct sk fl4.flowi4_flags =0 ; fl4.daddr = daddr; fl4.saddr = saddr; + fl4.flowi4_uid =sock_net_uid (net,NULL ); err =fib_lookup (net, &fl4, &res,0 );if (err !=0 ) {if (!IN_DEV_FORWARD (in_dev))
Greg Kroah-Hartman
maintainerPATCH 11/63 ipv4: mask tos for input route
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Julian Anastasov <[email protected]>
[ Upstream commit 6e28099d38c0e50d62c1afc054e37e573adf3d21 ]
Restore the lost masking of TOS in input route code to allow ip rules to match it properly.
Problem [1] noticed by Shmulik Ladkani <[email protected]>
[1] http://marc.info/?t=137331755300040&r=1&w=2
--- net/ipv4/route.c | 1 + 1 file changed, 1 insertion(+)
net/ipv4/route.c +1 -0
@@ -1991,6 +1991,7 @@ int ip_route_input_noref(struct sk_buff {int res; + tos &=IPTOS_RT_MASK ;rcu_read_lock ();/* Multicast recognition logic is moved from route cache to here.
Greg Kroah-Hartman
maintainerPATCH 12/63 sctp: set sin_port for addr param when checking duplicate address
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xin Long <[email protected]>
[ Upstream commit 2e3ce5bc2aa938653c3866aa7f4901a1f199b1c8 ]
Commit b8607805dd15 ("sctp: not copying duplicate addrs to the assoc's bind address list") tried to check for duplicate address before copying to asoc's bind_addr list from global addr list.
But all the addrs' sin_ports in global addr list are 0 while the addrs' sin_ports are bp->port in asoc's bind_addr list. It means even if it's a duplicate address, af->cmp_addr will still return 0 as the their sin_ports are different.
This patch is to fix it by setting the sin_port for addr param with bp->port before comparing the addrs.
--- net/sctp/protocol.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/sctp/protocol.c +5 -1
@@ -199,6 +199,7 @@ int sctp_copy_local_addr_list(struct net sctp_scope_t scope, gfp_t gfp, int copy_flags) { struct sctp_sockaddr_entry *addr; +union sctp_addr laddr;int error =0 ;rcu_read_lock ();
@@ -220,7 +221,10 @@ int sctp_copy_local_addr_list(struct net !(copy_flags & SCTP_ADDR6_PEERSUPP)))continue ; -if (sctp_bind_addr_state (bp, &addr->a) !=-1 ) + laddr = addr->a; +/* also works for setting ipv6 address port */ + laddr.v4.sin_port =htons (bp->port); +if (sctp_bind_addr_state (bp, &laddr) !=-1 )continue ; error = sctp_add_bind_addr(bp, &addr->a, sizeof(addr->a),
Greg Kroah-Hartman
maintainerPATCH 13/63 net sched actions: decrement module reference count after table flush.
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roman Mashak <[email protected]>
[ Upstream commit edb9d1bff4bbe19b8ae0e71b1f38732591a9eeb2 ]
When tc actions are loaded as a module and no actions have been installed, flushing them would result in actions removed from the memory, but modules reference count not being decremented, so that the modules would not be unloaded.
Following is example with GACT action:
% sudo modprobe act_gact
% lsmod
Module Size Used byact_gact 16384 0
%
% sudo tc actions ls action gact
%
% sudo tc actions flush action gact
% lsmod
Module Size Used byact_gact 16384 1
% sudo tc actions flush action gact
% lsmod
Module Size Used byact_gact 16384 2
% sudo rmmod act_gact
rmmod: ERROR: Module act_gact is in use
....
After the fix:
% lsmod
Module Size Used byact_gact 16384 0
%
% sudo tc actions add action pass index 1
% sudo tc actions add action pass index 2
% sudo tc actions add action pass index 3
% lsmod
Module Size Used byact_gact 16384 3
%
% sudo tc actions flush action gact
% lsmod
Module Size Used byact_gact 16384 0
%
% sudo tc actions flush action gact
% lsmod
Module Size Used byact_gact 16384 0
% sudo rmmod act_gact
% lsmod
Module Size Used by
%
--- net/sched/act_api.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
net/sched/act_api.c +1 -4
@@ -817,10 +817,8 @@ static int tca_action_flush(struct net * goto out_module_put; err = ops->walk (net, skb, &dcb,RTM_DELACTION , ops); -if (err <0 ) +if (err <=0 ) goto out_module_put; -if (err ==0 ) - goto noflush_out;nla_nest_end (skb, nest);
@@ -837,7 +835,6 @@ static int tca_action_flush(struct net * out_module_put:module_put (ops->owner); err_out: -noflush_out:kfree_skb (skb);return err; }
Greg Kroah-Hartman
maintainerPATCH 15/63 vxlan: lock RCU on TX path
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit 56de859e9967c070464a9a9f4f18d73f9447298e ]
There is no guarantees that callers of the TX path will hold the RCU lock. Grab it explicitly.
--- drivers/net/vxlan.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/vxlan.c +6 -2
@@ -2062,6 +2062,7 @@ static void vxlan_xmit_one(struct sk_buf src_port =udp_flow_src_port (dev_net (dev), skb, vxlan->cfg.port_min, vxlan->cfg.port_max, true); +rcu_read_lock ();if (dst->sa.sa_family ==AF_INET ) {struct vxlan_sock *sock4 =rcu_dereference (vxlan->vn4_sock);struct rtable *rt;
@@ -2084,7 +2085,7 @@ static void vxlan_xmit_one(struct sk_buf dst_port, vni, &rt->dst, rt->rt_flags);if (err) -return ; + goto out_unlock; }else if (info->key.tun_flags &TUNNEL_DONT_FRAGMENT ) { df =htons (IP_DF ); }
@@ -2123,7 +2124,7 @@ static void vxlan_xmit_one(struct sk_buf dst_port, vni, ndst, rt6i_flags);if (err) -return ; + goto out_unlock; } tos =ip_tunnel_ecn_encap (tos, old_iph, skb);
@@ -2140,6 +2141,8 @@ static void vxlan_xmit_one(struct sk_buf label, src_port, dst_port, !udp_sum);#endif } +out_unlock: +rcu_read_unlock ();return ; drop:
@@ -2148,6 +2151,7 @@ drop:return ; tx_error: +rcu_read_unlock ();if (err == -ELOOP ) dev->stats.collisions++;else if (err == -ENETUNREACH )
Greg Kroah-Hartman
maintainerPATCH 16/63 geneve: lock RCU on TX path
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit a717e3f740803cc88bd5c9a70c93504f6a368663 ]
There is no guarantees that callers of the TX path will hold the RCU lock. Grab it explicitly.
--- drivers/net/geneve.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/geneve.c +2 -0
@@ -881,12 +881,14 @@ static netdev_tx_t geneve_xmit(struct sk info = &geneve->info; } +rcu_read_lock ();#if IS_ENABLED (CONFIG_IPV6 )if (info->mode &IP_TUNNEL_INFO_IPV6 ) err =geneve6_xmit_skb (skb, dev, geneve, info); else#endif err =geneve_xmit_skb (skb, dev, geneve, info); +rcu_read_unlock ();if (likely (!err))return NETDEV_TX_OK ;
Greg Kroah-Hartman
maintainerPATCH 17/63 mlxsw: spectrum_router: Avoid potential packets loss
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ido Schimmel <[email protected]>
[ Upstream commit f7df4923fa986247e93ec2cdff5ca168fff14dcf ]
When the structure of the LPM tree changes (f.e., due to the addition of a new prefix), we unbind the old tree and then bind the new one. This may result in temporary packet loss.
Instead, overwrite the old binding with the new one.
--- drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 30 ++++++++++++------ 1 file changed, 20 insertions(+), 10 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +20 -10
@@ -496,30 +496,40 @@ static int mlxsw_sp_vr_lpm_tree_check(struct mlxsw_sp *mlxsw_sp, struct mlxsw_sp_vr *vr, struct mlxsw_sp_prefix_usage *req_prefix_usage) { - struct mlxsw_sp_lpm_tree *lpm_tree; + struct mlxsw_sp_lpm_tree *lpm_tree = vr->lpm_tree; +struct mlxsw_sp_lpm_tree *new_tree; +int err; -if (mlxsw_sp_prefix_usage_eq (req_prefix_usage, - &vr->lpm_tree->prefix_usage)) +if (mlxsw_sp_prefix_usage_eq (req_prefix_usage, &lpm_tree->prefix_usage))return 0 ; - lpm_tree =mlxsw_sp_lpm_tree_get (mlxsw_sp, req_prefix_usage, + new_tree =mlxsw_sp_lpm_tree_get (mlxsw_sp, req_prefix_usage, vr->proto, false); -if (IS_ERR (lpm_tree)) { +if (IS_ERR (new_tree)) {/* We failed to get a tree according to the required * prefix usage. However, the current tree might be still good * for us if our requirement is subset of the prefixes used * in the tree. */ if (mlxsw_sp_prefix_usage_subset (req_prefix_usage, - &vr->lpm_tree->prefix_usage)) + &lpm_tree->prefix_usage))return 0 ; -return PTR_ERR (lpm_tree); +return PTR_ERR (new_tree); } -mlxsw_sp_vr_lpm_tree_unbind (mlxsw_sp, vr); -mlxsw_sp_lpm_tree_put (mlxsw_sp, vr->lpm_tree); +/* Prevent packet loss by overwriting existing binding */ + vr->lpm_tree = new_tree; + err =mlxsw_sp_vr_lpm_tree_bind (mlxsw_sp, vr); +if (err) + goto err_tree_bind; +mlxsw_sp_lpm_tree_put (mlxsw_sp, lpm_tree); + +return 0 ; + +err_tree_bind: vr->lpm_tree = lpm_tree; -return mlxsw_sp_vr_lpm_tree_bind (mlxsw_sp, vr); +mlxsw_sp_lpm_tree_put (mlxsw_sp, new_tree); +return err; } static struct mlxsw_sp_vr *mlxsw_sp_vr_get(struct mlxsw_sp *mlxsw_sp,
Greg Kroah-Hartman
maintainerPATCH 18/63 tcp/dccp: block BH for SYN processing
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 449809a66c1d0b1563dee84493e14bf3104d2d7e ]
SYN processing really was meant to be handled from BH.
When I got rid of BH blocking while processing socket backlog in commit 5413d1babe8f ("net: do not block BH while processing socket backlog"), I forgot that a malicious user could transition to TCP_LISTEN from a state that allowed (SYN) packets to be parked in the socket backlog while socket is owned by the thread doing the listen() call.
Sure enough syzkaller found this and reported the bug ;)
=================================
[ INFO: inconsistent lock state ]
4.10.0+ #60 Not tainted
---------------------------------
inconsistent {IN-SOFTIRQ-W} -> {SOFTIRQ-ON-W} usage. syz-executor0/5090 [HC0[0]:SC0[0]:HE1:SE1] takes:
(&(&hashinfo->ehash_locks[i])->rlock){+.?...}, at:
[<ffffffff83a6a370>] spin_lock include/linux/spinlock.h:299 [inline]
(&(&hashinfo->ehash_locks[i])->rlock){+.?...}, at:
[<ffffffff83a6a370>] inet_ehash_insert+0x240/0xad0
net/ipv4/inet_hashtables.c:407
{IN-SOFTIRQ-W} state was registered at:
mark_irqflags kernel/locking/lockdep.c:2923 [inline]
__lock_acquire+0xbcf/0x3270 kernel/locking/lockdep.c:3295
lock_acquire+0x241/0x580 kernel/locking/lockdep.c:3753
__raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline]
_raw_spin_lock+0x33/0x50 kernel/locking/spinlock.c:151
spin_lock include/linux/spinlock.h:299 [inline]
inet_ehash_insert+0x240/0xad0 net/ipv4/inet_hashtables.c:407
reqsk_queue_hash_req net/ipv4/inet_connection_sock.c:753 [inline]
inet_csk_reqsk_queue_hash_add+0x1b7/0x2a0 net/ipv4/inet_connection_sock.c:764
tcp_conn_request+0x25cc/0x3310 net/ipv4/tcp_input.c:6399
tcp_v4_conn_request+0x157/0x220 net/ipv4/tcp_ipv4.c:1262
tcp_rcv_state_process+0x802/0x4130 net/ipv4/tcp_input.c:5889
tcp_v4_do_rcv+0x56b/0x940 net/ipv4/tcp_ipv4.c:1433
tcp_v4_rcv+0x2e12/0x3210 net/ipv4/tcp_ipv4.c:1711
ip_local_deliver_finish+0x4ce/0xc40 net/ipv4/ip_input.c:216
NF_HOOK include/linux/netfilter.h:257 [inline]
ip_local_deliver+0x1ce/0x710 net/ipv4/ip_input.c:257
dst_input include/net/dst.h:492 [inline]
ip_rcv_finish+0xb1d/0x2110 net/ipv4/ip_input.c:396
NF_HOOK include/linux/netfilter.h:257 [inline]
ip_rcv+0xd90/0x19c0 net/ipv4/ip_input.c:487
__netif_receive_skb_core+0x1ad1/0x3400 net/core/dev.c:4179
__netif_receive_skb+0x2a/0x170 net/core/dev.c:4217
netif_receive_skb_internal+0x1d6/0x430 net/core/dev.c:4245
napi_skb_finish net/core/dev.c:4602 [inline]
napi_gro_receive+0x4e6/0x680 net/core/dev.c:4636
e1000_receive_skb drivers/net/ethernet/intel/e1000/e1000_main.c:4033 [inline]
e1000_clean_rx_irq+0x5e0/0x1490
drivers/net/ethernet/intel/e1000/e1000_main.c:4489
e1000_clean+0xb9a/0x2910 drivers/net/ethernet/intel/e1000/e1000_main.c:3834
napi_poll net/core/dev.c:5171 [inline]
net_rx_action+0xe70/0x1900 net/core/dev.c:5236
__do_softirq+0x2fb/0xb7d kernel/softirq.c:284
invoke_softirq kernel/softirq.c:364 [inline]
irq_exit+0x19e/0x1d0 kernel/softirq.c:405
exiting_irq arch/x86/include/asm/apic.h:658 [inline]
do_IRQ+0x81/0x1a0 arch/x86/kernel/irq.c:250
ret_from_intr+0x0/0x20
native_safe_halt+0x6/0x10 arch/x86/include/asm/irqflags.h:53
arch_safe_halt arch/x86/include/asm/paravirt.h:98 [inline]
default_idle+0x8f/0x410 arch/x86/kernel/process.c:271
arch_cpu_idle+0xa/0x10 arch/x86/kernel/process.c:262
default_idle_call+0x36/0x60 kernel/sched/idle.c:96
cpuidle_idle_call kernel/sched/idle.c:154 [inline]
do_idle+0x348/0x440 kernel/sched/idle.c:243
cpu_startup_entry+0x18/0x20 kernel/sched/idle.c:345
start_secondary+0x344/0x440 arch/x86/kernel/smpboot.c:272
verify_cpu+0x0/0xfc
irq event stamp: 1741
hardirqs last enabled at (1741): [<ffffffff84d49d77>]
__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:160
[inline]
hardirqs last enabled at (1741): [<ffffffff84d49d77>]
_raw_spin_unlock_irqrestore+0xf7/0x1a0 kernel/locking/spinlock.c:191
hardirqs last disabled at (1740): [<ffffffff84d4a732>]
__raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:108 [inline]
hardirqs last disabled at (1740): [<ffffffff84d4a732>]
_raw_spin_lock_irqsave+0xa2/0x110 kernel/locking/spinlock.c:159
softirqs last enabled at (1738): [<ffffffff84d4deff>]
__do_softirq+0x7cf/0xb7d kernel/softirq.c:310
softirqs last disabled at (1571): [<ffffffff84d4b92c>]
do_softirq_own_stack+0x1c/0x30 arch/x86/entry/entry_64.S:902other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
----
lock(&(&hashinfo->ehash_locks[i])->rlock);
<Interrupt>
lock(&(&hashinfo->ehash_locks[i])->rlock);*** DEADLOCK ***
1 lock held by syz-executor0/5090:
#0: (sk_lock-AF_INET6){+.+.+.}, at: [<ffffffff83406b43>] lock_sockinclude/net/sock.h:1460 [inline]
#0: (sk_lock-AF_INET6){+.+.+.}, at: [<ffffffff83406b43>]
sock_setsockopt+0x233/0x1e40 net/core/sock.c:683 stack backtrace: CPU: 1 PID: 5090 Comm: syz-executor0 Not tainted 4.10.0+ #60 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:15 [inline] dump_stack+0x292/0x398 lib/dump_stack.c:51 print_usage_bug+0x3ef/0x450 kernel/locking/lockdep.c:2387 valid_state kernel/locking/lockdep.c:2400 [inline] mark_lock_irq kernel/locking/lockdep.c:2602 [inline] mark_lock+0xf30/0x1410 kernel/locking/lockdep.c:3065 mark_irqflags kernel/locking/lockdep.c:2941 [inline] __lock_acquire+0x6dc/0x3270 kernel/locking/lockdep.c:3295 lock_acquire+0x241/0x580 kernel/locking/lockdep.c:3753 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x33/0x50 kernel/locking/spinlock.c:151 spin_lock include/linux/spinlock.h:299 [inline] inet_ehash_insert+0x240/0xad0 net/ipv4/inet_hashtables.c:407 reqsk_queue_hash_req net/ipv4/inet_connection_sock.c:753 [inline] inet_csk_reqsk_queue_hash_add+0x1b7/0x2a0 net/ipv4/inet_connection_sock.c:764 dccp_v6_conn_request+0xada/0x11b0 net/dccp/ipv6.c:380 dccp_rcv_state_process+0x51e/0x1660 net/dccp/input.c:606 dccp_v6_do_rcv+0x213/0x350 net/dccp/ipv6.c:632 sk_backlog_rcv include/net/sock.h:896 [inline] __release_sock+0x127/0x3a0 net/core/sock.c:2052 release_sock+0xa5/0x2b0 net/core/sock.c:2539 sock_setsockopt+0x60f/0x1e40 net/core/sock.c:1016 SYSC_setsockopt net/socket.c:1782 [inline] SyS_setsockopt+0x2fb/0x3a0 net/socket.c:1765 entry_SYSCALL_64_fastpath+0x1f/0xc2 RIP: 0033:0x4458b9 RSP: 002b:00007fe8b26c2b58 EFLAGS: 00000292 ORIG_RAX: 0000000000000036 RAX: ffffffffffffffda RBX: 0000000000000006 RCX: 00000000004458b9 RDX: 000000000000001a RSI: 0000000000000001 RDI: 0000000000000006 RBP: 00000000006e2110 R08: 0000000000000010 R09: 0000000000000000 R10: 00000000208c3000 R11: 0000000000000292 R12: 0000000000708000 R13: 0000000020000000 R14: 0000000000001000 R15: 0000000000000000
--- net/dccp/input.c | 10 ++++++++-- net/ipv4/tcp_input.c | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-)
net/dccp/input.c +8 -2
@@ -577,6 +577,7 @@ int dccp_rcv_state_process(struct sock *struct dccp_sock *dp =dccp_sk (sk);struct dccp_skb_cb *dcb =DCCP_SKB_CB (skb);const int old_state = sk->sk_state; +bool acceptable;int queued =0 ;/*
@@ -603,8 +604,13 @@ int dccp_rcv_state_process(struct sock **/ if (sk->sk_state ==DCCP_LISTEN ) {if (dh->dccph_type ==DCCP_PKT_REQUEST ) { -if (inet_csk (sk)->icsk_af_ops->conn_request (sk, - skb) <0 ) +/* It is possible that we process SYN packets from backlog, +* so we need to make sure to disable BH right there. +*/ +local_bh_disable (); + acceptable =inet_csk (sk)->icsk_af_ops->conn_request (sk, skb) >=0 ; +local_bh_enable (); +if (!acceptable)return 1 ;consume_skb (skb);return 0 ;
net/ipv4/tcp_input.c +8 -2
@@ -5916,9 +5916,15 @@ int tcp_rcv_state_process(struct sock *sif (th->syn) {if (th->fin) goto discard; -if (icsk->icsk_af_ops->conn_request (sk, skb) <0 ) -return 1 ; +/* It is possible that we process SYN packets from backlog, +* so we need to make sure to disable BH right there. +*/ +local_bh_disable (); + acceptable = icsk->icsk_af_ops->conn_request (sk, skb) >=0 ; +local_bh_enable (); +if (!acceptable) +return 1 ;consume_skb (skb);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 19/63 net: bridge: allow IPv6 when multicast flood is disabled
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Manning <[email protected]>
[ Upstream commit 8953de2f02ad7b15e4964c82f9afd60f128e4e98 ]
Even with multicast flooding turned off, IPv6 ND should still work so that IPv6 connectivity is provided. Allow this by continuing to flood multicast traffic originated by us.
--- net/bridge/br_forward.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/bridge/br_forward.c +2 -1
@@ -186,8 +186,9 @@ void br_flood(struct net_bridge *br, str/* Do not flood unicast traffic to ports that turn it off */ if (pkt_type ==BR_PKT_UNICAST && !(p->flags &BR_FLOOD ))continue ; +/* Do not flood if mc off, except for traffic we originate */ if (pkt_type ==BR_PKT_MULTICAST && - !(p->flags &BR_MCAST_FLOOD )) + !(p->flags &BR_MCAST_FLOOD ) && skb->dev != br->dev)continue ;/* Do not flood to ports that enable proxy ARP */
Greg Kroah-Hartman
maintainerPATCH 20/63 net: dont call strlen() on the user buffer in packet_bind_spkt()
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Potapenko <[email protected]>
[ Upstream commit 540e2894f7905538740aaf122bd8e0548e1c34a4 ]
KMSAN (KernelMemorySanitizer, a new error detection tool) reports use of uninitialized memory in packet_bind_spkt():
==================================================================
BUG: KMSAN: use of unitialized memory CPU: 0 PID: 1074 Comm: packet Not tainted 4.8.0-rc6+ #1891 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs
01/01/2011
0000000000000000 ffff88006b6dfc08 ffffffff82559ae8 ffff88006b6dfb48 ffffffff818a7c91 ffffffff85b9c870 0000000000000092 ffffffff85b9c550 0000000000000000 0000000000000092 00000000ec400911 0000000000000002
Call Trace: [< inline >] __dump_stack lib/dump_stack.c:15 [<ffffffff82559ae8>] dump_stack+0x238/0x290 lib/dump_stack.c:51 [<ffffffff818a6626>] kmsan_report+0x276/0x2e0 mm/kmsan/kmsan.c:1003 [<ffffffff818a783b>] __msan_warning+0x5b/0xb0 mm/kmsan/kmsan_instr.c:424 [< inline >] strlen lib/string.c:484 [<ffffffff8259b58d>] strlcpy+0x9d/0x200 lib/string.c:144 [<ffffffff84b2eca4>] packet_bind_spkt+0x144/0x230 net/packet/af_packet.c:3132 [<ffffffff84242e4d>] SYSC_bind+0x40d/0x5f0 net/socket.c:1370 [<ffffffff84242a22>] SyS_bind+0x82/0xa0 net/socket.c:1356 [<ffffffff8515991b>] entry_SYSCALL_64_fastpath+0x13/0x8f
arch/x86/entry/entry_64.o:?
chained origin: 00000000eba00911
[<ffffffff810bb787>] save_stack_trace+0x27/0x50arch/x86/kernel/stacktrace.c:67
[< inline >] kmsan_save_stack_with_flags mm/kmsan/kmsan.c:322 [< inline >] kmsan_save_stack mm/kmsan/kmsan.c:334 [<ffffffff818a59f8>] kmsan_internal_chain_origin+0x118/0x1e0 mm/kmsan/kmsan.c:527 [<ffffffff818a7773>] __msan_set_alloca_origin4+0xc3/0x130 mm/kmsan/kmsan_instr.c:380 [<ffffffff84242b69>] SYSC_bind+0x129/0x5f0 net/socket.c:1356 [<ffffffff84242a22>] SyS_bind+0x82/0xa0 net/socket.c:1356 [<ffffffff8515991b>] entry_SYSCALL_64_fastpath+0x13/0x8f
arch/x86/entry/entry_64.o:?
origin description: ----address@SYSC_bind (origin=00000000eb400911)
==================================================================
(the line numbers are relative to 4.8-rc6, but the bug persists upstream)
, when I run the following program as root:
=====================================
#include <string.h>
#include <sys/socket.h>
#include <netpacket/packet.h>
#include <net/ethernet.h>
int main() {
struct sockaddr addr;
memset(&addr, 0xff, sizeof(addr)); addr.sa_family = AF_PACKET;
int fd = socket(PF_PACKET, SOCK_PACKET, htons(ETH_P_ALL)); bind(fd, &addr, sizeof(addr));
return 0;
}
=====================================
This happens because addr.sa_data copied from the userspace is not zero-terminated, and copying it with strlcpy() in packet_bind_spkt() results in calling strlen() on the kernel copy of that non-terminated buffer.
--- net/packet/af_packet.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/packet/af_packet.c +6 -2
@@ -3082,7 +3082,7 @@ static int packet_bind_spkt(struct socke int addr_len) {struct sock *sk = sock->sk; -char name[15 ]; +char name[sizeof (uaddr->sa_data) +1 ];/* * Check legality
@@ -3090,7 +3090,11 @@ static int packet_bind_spkt(struct sockeif (addr_len !=sizeof (struct sockaddr ))return -EINVAL ; -strlcpy (name, uaddr->sa_data,sizeof (name)); +/* uaddr->sa_data comes from the userspace, it's not guaranteed to be +* zero-terminated. +*/ +memcpy (name, uaddr->sa_data,sizeof (uaddr->sa_data)); + name[sizeof (uaddr->sa_data)] =0 ;return packet_do_bind (sk, name,0 ,pkt_sk (sk)->num); }
Greg Kroah-Hartman
maintainerPATCH 21/63 net: net_enable_timestamp() can be called from irq contexts
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 13baa00ad01bb3a9f893e3a08cbc2d072fc0c15d ]
It is now very clear that silly TCP listeners might play with enabling/disabling timestamping while new children are added to their accept queue.
Meaning net_enable_timestamp() can be called from BH context while current state of the static key is not enabled.
Lets play safe and allow all contexts.
The work queue is scheduled only under the problematic cases, which are the static key enable/disable transition, to not slow down critical paths.
This extends and improves what we did in commit 5fa8bbda38c6 ("net: use a work queue to defer net_disable_timestamp() work")
--- net/core/dev.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-)
net/core/dev.c +31 -4
@@ -1696,27 +1696,54 @@ EXPORT_SYMBOL_GPL(net_dec_egress_queue);static struct static_key netstamp_needed__read_mostly ;#ifdef HAVE_JUMP_LABEL static atomic_t netstamp_needed_deferred; +static atomic_t netstamp_wanted;static void netstamp_clear (struct work_struct *work) {int deferred =atomic_xchg (&netstamp_needed_deferred,0 ); +int wanted; -while (deferred--) -static_key_slow_dec (&netstamp_needed); + wanted =atomic_add_return (deferred, &netstamp_wanted); +if (wanted >0 ) +static_key_enable (&netstamp_needed); +else +static_key_disable (&netstamp_needed); } static DECLARE_WORK(netstamp_work, netstamp_clear);#endif void net_enable_timestamp (void ) { +#ifdef HAVE_JUMP_LABEL +int wanted; + +while (1 ) { + wanted =atomic_read (&netstamp_wanted); +if (wanted <=0 ) +break ; +if (atomic_cmpxchg (&netstamp_wanted, wanted, wanted +1 ) == wanted) +return ; + } +atomic_inc (&netstamp_needed_deferred); +schedule_work (&netstamp_work); +#else static_key_slow_inc (&netstamp_needed); +#endif }EXPORT_SYMBOL (net_enable_timestamp);void net_disable_timestamp (void ) {#ifdef HAVE_JUMP_LABEL -/* net_disable_timestamp() can be called from non process context */ -atomic_inc (&netstamp_needed_deferred); +int wanted; + +while (1 ) { + wanted =atomic_read (&netstamp_wanted); +if (wanted <=1 ) +break ; +if (atomic_cmpxchg (&netstamp_wanted, wanted, wanted -1 ) == wanted) +return ; + } +atomic_dec (&netstamp_needed_deferred);schedule_work (&netstamp_work);#else static_key_slow_dec (&netstamp_needed);
Greg Kroah-Hartman
maintainerPATCH 22/63 ipv6: orphan skbs in reassembly unit
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 48cac18ecf1de82f76259a54402c3adb7839ad01 ]
Andrey reported a use-after-free in IPv6 stack.
Issue here is that we free the socket while it still has skb in TX path and in some queues.
It happens here because IPv6 reassembly unit messes skb->truesize, breaking skb_set_owner_w() badly.
We fixed a similar issue for IPV4 in commit 8282f27449bf ("inet: frag:
Always orphan skbs inside ip_defrag()")
==================================================================
BUG: KASAN: use-after-free in sock_wfree+0x118/0x120 Read of size 8 at addr ffff880062da0060 by task a.out/4140
page:ffffea00018b6800 count:1 mapcount:0 mapping: (null)
index:0x0 compound_mapcount: 0
flags: 0x100000000008100(slab|head)
raw: 0100000000008100 0000000000000000 0000000000000000 0000000180130013 raw: dead000000000100 dead000000000200 ffff88006741f140 0000000000000000 page dumped because: kasan: bad access detected CPU: 0 PID: 4140 Comm: a.out Not tainted 4.10.0-rc3+ #59 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:15 dump_stack+0x292/0x398 lib/dump_stack.c:51 describe_address mm/kasan/report.c:262 kasan_report_error+0x121/0x560 mm/kasan/report.c:370 kasan_report mm/kasan/report.c:392 __asan_report_load8_noabort+0x3e/0x40 mm/kasan/report.c:413 sock_flag ./arch/x86/include/asm/bitops.h:324 sock_wfree+0x118/0x120 net/core/sock.c:1631 skb_release_head_state+0xfc/0x250 net/core/skbuff.c:655 skb_release_all+0x15/0x60 net/core/skbuff.c:668 __kfree_skb+0x15/0x20 net/core/skbuff.c:684 kfree_skb+0x16e/0x4e0 net/core/skbuff.c:705 inet_frag_destroy+0x121/0x290 net/ipv4/inet_fragment.c:304 inet_frag_put ./include/net/inet_frag.h:133 nf_ct_frag6_gather+0x1125/0x38b0 net/ipv6/netfilter/nf_conntrack_reasm.c:617 ipv6_defrag+0x21b/0x350 net/ipv6/netfilter/nf_defrag_ipv6_hooks.c:68 nf_hook_entry_hookfn ./include/linux/netfilter.h:102 nf_hook_slow+0xc3/0x290 net/netfilter/core.c:310 nf_hook ./include/linux/netfilter.h:212 __ip6_local_out+0x52c/0xaf0 net/ipv6/output_core.c:160 ip6_local_out+0x2d/0x170 net/ipv6/output_core.c:170 ip6_send_skb+0xa1/0x340 net/ipv6/ip6_output.c:1722 ip6_push_pending_frames+0xb3/0xe0 net/ipv6/ip6_output.c:1742 rawv6_push_pending_frames net/ipv6/raw.c:613 rawv6_sendmsg+0x2cff/0x4130 net/ipv6/raw.c:927 inet_sendmsg+0x164/0x5b0 net/ipv4/af_inet.c:744 sock_sendmsg_nosec net/socket.c:635 sock_sendmsg+0xca/0x110 net/socket.c:645 sock_write_iter+0x326/0x620 net/socket.c:848 new_sync_write fs/read_write.c:499 __vfs_write+0x483/0x760 fs/read_write.c:512 vfs_write+0x187/0x530 fs/read_write.c:560 SYSC_write fs/read_write.c:607 SyS_write+0xfb/0x230 fs/read_write.c:599 entry_SYSCALL_64_fastpath+0x1f/0xc2 arch/x86/entry/entry_64.S:203 RIP: 0033:0x7ff26e6f5b79 RSP: 002b:00007ff268e0ed98 EFLAGS: 00000206 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007ff268e0f9c0 RCX: 00007ff26e6f5b79 RDX: 0000000000000010 RSI: 0000000020f50fe1 RDI: 0000000000000003 RBP: 00007ff26ebc1220 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000206 R12: 0000000000000000 R13: 00007ff268e0f9c0 R14: 00007ff26efec040 R15: 0000000000000003 The buggy address belongs to the object at ffff880062da0000 which belongs to the cache RAWv6 of size 1504
The buggy address ffff880062da0060 is located 96 bytes inside
of 1504-byte region [ffff880062da0000, ffff880062da05e0)
Freed by task 4113:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
save_stack+0x43/0xd0 mm/kasan/kasan.c:502
set_track mm/kasan/kasan.c:514
kasan_slab_free+0x73/0xc0 mm/kasan/kasan.c:578
slab_free_hook mm/slub.c:1352
slab_free_freelist_hook mm/slub.c:1374
slab_free mm/slub.c:2951
kmem_cache_free+0xb2/0x2c0 mm/slub.c:2973
sk_prot_free net/core/sock.c:1377
__sk_destruct+0x49c/0x6e0 net/core/sock.c:1452
sk_destruct+0x47/0x80 net/core/sock.c:1460
__sk_free+0x57/0x230 net/core/sock.c:1468
sk_free+0x23/0x30 net/core/sock.c:1479
sock_put ./include/net/sock.h:1638
sk_common_release+0x31e/0x4e0 net/core/sock.c:2782
rawv6_close+0x54/0x80 net/ipv6/raw.c:1214
inet_release+0xed/0x1c0 net/ipv4/af_inet.c:425
inet6_release+0x50/0x70 net/ipv6/af_inet6.c:431
sock_release+0x8d/0x1e0 net/socket.c:599
sock_close+0x16/0x20 net/socket.c:1063
__fput+0x332/0x7f0 fs/file_table.c:208
____fput+0x15/0x20 fs/file_table.c:244
task_work_run+0x19b/0x270 kernel/task_work.c:116
exit_task_work ./include/linux/task_work.h:21
do_exit+0x186b/0x2800 kernel/exit.c:839
do_group_exit+0x149/0x420 kernel/exit.c:943
SYSC_exit_group kernel/exit.c:954
SyS_exit_group+0x1d/0x20 kernel/exit.c:952
entry_SYSCALL_64_fastpath+0x1f/0xc2 arch/x86/entry/entry_64.S:203
Allocated by task 4115:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
save_stack+0x43/0xd0 mm/kasan/kasan.c:502
set_track mm/kasan/kasan.c:514
kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:605
kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:544
slab_post_alloc_hook mm/slab.h:432
slab_alloc_node mm/slub.c:2708
slab_alloc mm/slub.c:2716
kmem_cache_alloc+0x1af/0x250 mm/slub.c:2721
sk_prot_alloc+0x65/0x2a0 net/core/sock.c:1334
sk_alloc+0x105/0x1010 net/core/sock.c:1396
inet6_create+0x44d/0x1150 net/ipv6/af_inet6.c:183
__sock_create+0x4f6/0x880 net/socket.c:1199
sock_create net/socket.c:1239
SYSC_socket net/socket.c:1269
SyS_socket+0xf9/0x230 net/socket.c:1249
entry_SYSCALL_64_fastpath+0x1f/0xc2 arch/x86/entry/entry_64.S:203
Memory state around the buggy address:
ffff880062d9ff00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff880062d9ff80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff880062da0000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff880062da0080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff880062da0100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================--- net/ipv6/netfilter/nf_conntrack_reasm.c | 1 + net/openvswitch/conntrack.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-)
net/ipv6/netfilter/nf_conntrack_reasm.c +1 -0
@@ -589,6 +589,7 @@ int nf_ct_frag6_gather(struct net *net, hdr =ipv6_hdr (skb); fhdr = (struct frag_hdr *)skb_transport_header (skb); +skb_orphan (skb); fq =fq_find (net, fhdr->identification, user, &hdr->saddr, &hdr->daddr, skb->dev ? skb->dev->ifindex :0 ,ip6_frag_ecn (hdr));if (fq ==NULL ) {
net/openvswitch/conntrack.c +0 -1
@@ -367,7 +367,6 @@ static int handle_fragments(struct net * }else if (key->eth.type ==htons (ETH_P_IPV6 )) {enum ip6_defrag_users user =IP6_DEFRAG_CONNTRACK_IN + zone; -skb_orphan (skb);memset (IP6CB (skb),0 ,sizeof (struct inet6_skb_parm )); err =nf_ct_frag6_gather (net, skb, user);if (err) {
Greg Kroah-Hartman
maintainerPATCH 23/63 dccp: Unlock sock before calling sk_free()
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit d5afb6f9b6bb2c57bd0c05e76e12489dc0d037d9 ]
The code where sk_clone() came from created a new socket and locked it, but then, on the error path didn't unlock it.
This problem stayed there for a long while, till b0691c8ee7c2 ("net:
Unlock sock before calling sk_free()") fixed it, but unfortunately the callers of sk_clone() (now sk_clone_locked()) were not audited and the one in dccp_create_openreq_child() remained.
Now in the age of the syskaller fuzzer, this was finally uncovered, as reported by Dmitry:
---- 8< ----
I've got the following report while running syzkaller fuzzer on 86292b33d4b7 ("Merge branch 'akpm' (patches from Andrew)")
[ BUG: held lock freed! ]
4.10.0+ #234 Not tainted
-------------------------
syz-executor6/6898 is freeing memory ffff88006286cac0-ffff88006286d3b7, with a lock still held there!
(slock-AF_INET6){+.-...}, at: [<ffffffff8362c2c9>] spin_lock
include/linux/spinlock.h:299 [inline]
(slock-AF_INET6){+.-...}, at: [<ffffffff8362c2c9>]
sk_clone_lock+0x3d9/0x12c0 net/core/sock.c:1504
5 locks held by syz-executor6/6898:
#0: (sk_lock-AF_INET6){+.+.+.}, at: [<ffffffff839a34b4>] lock_sock
include/net/sock.h:1460 [inline]
#0: (sk_lock-AF_INET6){+.+.+.}, at: [<ffffffff839a34b4>]
inet_stream_connect+0x44/0xa0 net/ipv4/af_inet.c:681
#1: (rcu_read_lock){......}, at: [<ffffffff83bc1c2a>]
inet6_csk_xmit+0x12a/0x5d0 net/ipv6/inet6_connection_sock.c:126
#2: (rcu_read_lock){......}, at: [<ffffffff8369b424>] __skb_unlink
include/linux/skbuff.h:1767 [inline]
#2: (rcu_read_lock){......}, at: [<ffffffff8369b424>] __skb_dequeue
include/linux/skbuff.h:1783 [inline]
#2: (rcu_read_lock){......}, at: [<ffffffff8369b424>]
process_backlog+0x264/0x730 net/core/dev.c:4835
#3: (rcu_read_lock){......}, at: [<ffffffff83aeb5c0>]
ip6_input_finish+0x0/0x1700 net/ipv6/ip6_input.c:59
#4: (slock-AF_INET6){+.-...}, at: [<ffffffff8362c2c9>] spin_lock
include/linux/spinlock.h:299 [inline]
#4: (slock-AF_INET6){+.-...}, at: [<ffffffff8362c2c9>]
sk_clone_lock+0x3d9/0x12c0 net/core/sock.c:1504Fix it just like was done by b0691c8ee7c2 ("net: Unlock sock before calling sk_free()").
--- net/dccp/minisocks.c | 1 + 1 file changed, 1 insertion(+)
net/dccp/minisocks.c +1 -0
@@ -122,6 +122,7 @@ struct sock *dccp_create_openreq_child(c/* It is still raw copy of parent, so invalidate * destructor and make plain sk_free() */ newsk->sk_destruct =NULL ; +bh_unlock_sock (newsk);sk_free (newsk);return NULL ; }
Greg Kroah-Hartman
maintainerPATCH 24/63 amd-xgbe: Stop the PHY before releasing interrupts
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Lendacky, Thomas" <[email protected]>
[ Upstream commit 402168b4c2dc0734b8fbd282eff77da0275c5129 ]
Some configurations require the use of the hardware's MDIO support to communicate with external PHYs. The MDIO commands indicate completion through the device interrupt. When bringing down the device the interrupts were released before stopping the external PHY, resulting in MDIO command timeouts. Move the stopping of the PHY to before the releasing of the interrupts.
--- drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/amd/xgbe/xgbe-drv.c +2 -2
@@ -1131,12 +1131,12 @@ static void xgbe_stop(struct xgbe_prv_da hw_if->disable_tx (pdata); hw_if->disable_rx (pdata); + phy_if->phy_stop (pdata); +xgbe_free_irqs (pdata);xgbe_napi_disable (pdata,1 ); - phy_if->phy_stop (pdata); - hw_if->exit (pdata); channel = pdata->channel;
Greg Kroah-Hartman
maintainerPATCH 25/63 amd-xgbe: Be sure to set MDIO modes on device (re)start
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Lendacky, Thomas" <[email protected]>
[ Upstream commit b42c6761fd1651f564491b53016046c9ebf0b2a9 ]
The MDIO register mode is set when the device is probed. But when the device is brought down and then back up, the MDIO register mode has been reset. Be sure to reset the mode during device startup and only change the mode of the address specified.
--- drivers/net/ethernet/amd/xgbe/xgbe-dev.c | 2 +- drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-)
drivers/net/ethernet/amd/xgbe/xgbe-dev.c +1 -1
@@ -1323,7 +1323,7 @@ static int xgbe_read_ext_mii_regs(structstatic int xgbe_set_ext_mii_mode (struct xgbe_prv_data *pdata,unsigned int port,enum xgbe_mdio_mode mode) { -unsigned int reg_val =0 ; +unsigned int reg_val =XGMAC_IOREAD (pdata,MAC_MDIOCL22R );switch (mode) {case XGBE_MDIO_MODE_CL22 :
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +22 -0
@@ -875,6 +875,16 @@ static int xgbe_phy_find_phy_device(stru !phy_data->sfp_phy_avail)return 0 ; +/* Set the proper MDIO mode for the PHY */ + ret = pdata->hw_if.set_ext_mii_mode (pdata, phy_data->mdio_addr, + phy_data->phydev_mode); +if (ret) { +netdev_err (pdata->netdev, +"mdio port/clause not compatible (%u/%u)\n" , + phy_data->mdio_addr, phy_data->phydev_mode); +return ret; + } +/* Create and connect to the PHY device */ phydev =get_phy_device (phy_data->mii, phy_data->mdio_addr, (phy_data->phydev_mode ==XGBE_MDIO_MODE_CL45 ));
@@ -2722,6 +2732,18 @@ static int xgbe_phy_start(struct xgbe_prif (ret)return ret; +/* Set the proper MDIO mode for the re-driver */ +if (phy_data->redrv && !phy_data->redrv_if) { + ret = pdata->hw_if.set_ext_mii_mode (pdata, phy_data->redrv_addr, +XGBE_MDIO_MODE_CL22 ); +if (ret) { +netdev_err (pdata->netdev, +"redriver mdio port not compatible (%u)\n" , + phy_data->redrv_addr); +return ret; + } + } +/* Start in highest supported mode */ xgbe_phy_set_mode (pdata, phy_data->start_mode);
Greg Kroah-Hartman
maintainerPATCH 26/63 amd-xgbe: Dont overwrite SFP PHY mod_absent settings
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Lendacky, Thomas" <[email protected]>
[ Upstream commit 2697ea5a859b83ca49511dcfd98daf42584eb3cf ]
If an SFP module is not present, xgbe_phy_sfp_phy_settings() should return after applying the default settings. Currently there is no return statement and the default settings are overwritten.
--- drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +2 -0
@@ -716,6 +716,8 @@ static void xgbe_phy_sfp_phy_settings(st pdata->phy.duplex =DUPLEX_UNKNOWN ; pdata->phy.autoneg =AUTONEG_ENABLE ; pdata->phy.advertising = pdata->phy.supported; + +return ; } pdata->phy.advertising &= ~ADVERTISED_Autoneg;
Greg Kroah-Hartman
maintainerPATCH 27/63 bonding: use ETH_MAX_MTU as max mtu
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: WANG Cong <[email protected]>
[ Upstream commit 31c05415f5b471fd333fe42629788364faea8e0d ]
This restores the ability of setting bond device's mtu to 9000.
--- drivers/net/bonding/bond_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/bonding/bond_main.c +1 -0
@@ -4185,6 +4185,7 @@ void bond_setup(struct net_device *bond_/* Initialize the device entry points */ ether_setup (bond_dev); + bond_dev->max_mtu =ETH_MAX_MTU ; bond_dev->netdev_ops = &bond_netdev_ops; bond_dev->ethtool_ops = &bond_ethtool_ops;
Greg Kroah-Hartman
maintainerPATCH 28/63 strparser: destroy workqueue on module exit
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: WANG Cong <[email protected]>
[ Upstream commit f78ef7cd9a0686b979679d0de061c6dbfd8d649e ]
--- net/strparser/strparser.c | 1 + 1 file changed, 1 insertion(+)
net/strparser/strparser.c +1 -0
@@ -504,6 +504,7 @@ static int __init strp_mod_init(void) static void __exit strp_mod_exit(void) { +destroy_workqueue (strp_wq); }module_init (strp_mod_init);module_exit (strp_mod_exit);
Greg Kroah-Hartman
maintainerPATCH 29/63 tcp: fix various issues for sockets morphing to listen state
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 02b2faaf0af1d85585f6d6980e286d53612acfc2 ]
Dmitry Vyukov reported a divide by 0 triggered by syzkaller, exploiting tcp_disconnect() path that was never really considered and/or used before syzkaller ;)
I was not able to reproduce the bug, but it seems issues here are the three possible actions that assumed they would never trigger on a listener.
1) tcp_write_timer_handler
2) tcp_delack_timer_handler
3) MTU reduction
Only IPv6 MTU reduction was properly testing TCP_CLOSE and TCP_LISTEN
states from tcp_v6_mtu_reduced()
--- net/ipv4/tcp_ipv4.c | 7 +++++-- net/ipv4/tcp_timer.c | 6 ++++-- 2 files changed, 9 insertions(+), 4 deletions(-)
net/ipv4/tcp_ipv4.c +5 -2
@@ -269,10 +269,13 @@ EXPORT_SYMBOL(tcp_v4_connect);*/ void tcp_v4_mtu_reduced (struct sock *sk) { -struct dst_entry *dst;struct inet_sock *inet =inet_sk (sk); -u32 mtu =tcp_sk (sk)->mtu_info; +struct dst_entry *dst; +u32 mtu; +if ((1 << sk->sk_state) & (TCPF_LISTEN |TCPF_CLOSE )) +return ; + mtu =tcp_sk (sk)->mtu_info; dst =inet_csk_update_pmtu (sk, mtu);if (!dst)return ;
net/ipv4/tcp_timer.c +4 -2
@@ -249,7 +249,8 @@ void tcp_delack_timer_handler(struct socsk_mem_reclaim_partial (sk); -if (sk->sk_state ==TCP_CLOSE || !(icsk->icsk_ack.pending &ICSK_ACK_TIMER )) +if (((1 << sk->sk_state) & (TCPF_CLOSE |TCPF_LISTEN )) || + !(icsk->icsk_ack.pending &ICSK_ACK_TIMER )) goto out;if (time_after (icsk->icsk_ack.timeout, jiffies)) {
@@ -552,7 +553,8 @@ void tcp_write_timer_handler(struct sockstruct inet_connection_sock *icsk =inet_csk (sk);int event; -if (sk->sk_state ==TCP_CLOSE || !icsk->icsk_pending) +if (((1 << sk->sk_state) & (TCPF_CLOSE |TCPF_LISTEN )) || + !icsk->icsk_pending) goto out;if (time_after (icsk->icsk_timeout, jiffies)) {
Greg Kroah-Hartman
maintainerPATCH 30/63 net: fix socket refcounting in skb_complete_wifi_ack()
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit dd4f10722aeb10f4f582948839f066bebe44e5fb ]
TX skbs do not necessarily hold a reference on skb->sk->sk_refcnt By the time TX completion happens, sk_refcnt might be already 0.
sock_hold()/sock_put() would then corrupt critical state, like sk_wmem_alloc.
--- net/core/skbuff.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
net/core/skbuff.c +8 -7
@@ -3889,7 +3889,7 @@ void skb_complete_wifi_ack(struct sk_buf {struct sock *sk = skb->sk;struct sock_exterr_skb *serr; -int err; +int err =1 ; skb->wifi_acked_valid =1 ; skb->wifi_acked = acked;
@@ -3899,14 +3899,15 @@ void skb_complete_wifi_ack(struct sk_buf serr->ee.ee_errno =ENOMSG ; serr->ee.ee_origin =SO_EE_ORIGIN_TXSTATUS ; -/* take a reference to prevent skb_orphan() from freeing the socket */ -sock_hold (sk); - - err =sock_queue_err_skb (sk, skb); +/* Take a reference to prevent skb_orphan() from freeing the socket, +* but only if the socket refcount is not zero. +*/ +if (likely (atomic_inc_not_zero (&sk->sk_refcnt))) { + err =sock_queue_err_skb (sk, skb); +sock_put (sk); + }if (err)kfree_skb (skb); - -sock_put (sk); }EXPORT_SYMBOL_GPL (skb_complete_wifi_ack);
Greg Kroah-Hartman
maintainerPATCH 31/63 net: fix socket refcounting in skb_complete_tx_timestamp()
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 9ac25fc063751379cb77434fef9f3b088cd3e2f7 ]
TX skbs do not necessarily hold a reference on skb->sk->sk_refcnt By the time TX completion happens, sk_refcnt might be already 0.
sock_hold()/sock_put() would then corrupt critical state, like sk_wmem_alloc and lead to leaks or use after free.
--- net/core/skbuff.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
net/core/skbuff.c +8 -7
@@ -3824,13 +3824,14 @@ void skb_complete_tx_timestamp(struct skif (!skb_may_tx_timestamp (sk, false))return ; -/* take a reference to prevent skb_orphan() from freeing the socket */ -sock_hold (sk); - - *skb_hwtstamps (skb) = *hwtstamps; -__skb_complete_tx_timestamp (skb, sk,SCM_TSTAMP_SND ); - -sock_put (sk); +/* Take a reference to prevent skb_orphan() from freeing the socket, +* but only if the socket refcount is not zero. +*/ +if (likely (atomic_inc_not_zero (&sk->sk_refcnt))) { + *skb_hwtstamps (skb) = *hwtstamps; +__skb_complete_tx_timestamp (skb, sk,SCM_TSTAMP_SND ); +sock_put (sk); + } }EXPORT_SYMBOL_GPL (skb_complete_tx_timestamp);
Greg Kroah-Hartman
maintainerPATCH 32/63 net/sched: act_skbmod: remove unneeded rcu_read_unlock in tcf_skbmod_dump
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Khoroshilov <[email protected]>
[ Upstream commit 6c4dc75c251721f517e9daeb5370ea606b5b35ce ]
Found by Linux Driver Verification project (linuxtesting.org).
--- net/sched/act_skbmod.c | 1 - 1 file changed, 1 deletion(-)
net/sched/act_skbmod.c +0 -1
@@ -228,7 +228,6 @@ static int tcf_skbmod_dump(struct sk_bufreturn skb->len; nla_put_failure: -rcu_read_unlock ();nlmsg_trim (skb, b);return -1 ; }
Greg Kroah-Hartman
maintainerPATCH 33/63 dccp: fix use-after-free in dccp_feat_activate_values
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 62f8f4d9066c1c6f2474845d1ca7e2891f2ae3fd ]
Dmitry reported crashes in DCCP stack [1]
Problem here is that when I got rid of listener spinlock, I missed the fact that DCCP stores a complex state in struct dccp_request_sock, while TCP does not.
Since multiple cpus could access it at the same time, we need to add protection.
[1]
BUG: KASAN: use-after-free in dccp_feat_activate_values+0x967/0xab0
net/dccp/feat.c:1541 at addr ffff88003713be68
Read of size 8 by task syz-executor2/8457
CPU: 2 PID: 8457 Comm: syz-executor2 Not tainted 4.10.0-rc7+ #127
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
Call Trace:
<IRQ>
__dump_stack lib/dump_stack.c:15 [inline]
dump_stack+0x292/0x398 lib/dump_stack.c:51
kasan_object_err+0x1c/0x70 mm/kasan/report.c:162
print_address_description mm/kasan/report.c:200 [inline]
kasan_report_error mm/kasan/report.c:289 [inline]
kasan_report.part.1+0x20e/0x4e0 mm/kasan/report.c:311
kasan_report mm/kasan/report.c:332 [inline]
__asan_report_load8_noabort+0x29/0x30 mm/kasan/report.c:332
dccp_feat_activate_values+0x967/0xab0 net/dccp/feat.c:1541
dccp_create_openreq_child+0x464/0x610 net/dccp/minisocks.c:121
dccp_v6_request_recv_sock+0x1f6/0x1960 net/dccp/ipv6.c:457
dccp_check_req+0x335/0x5a0 net/dccp/minisocks.c:186
dccp_v6_rcv+0x69e/0x1d00 net/dccp/ipv6.c:711
ip6_input_finish+0x46d/0x17a0 net/ipv6/ip6_input.c:279
NF_HOOK include/linux/netfilter.h:257 [inline]
ip6_input+0xdb/0x590 net/ipv6/ip6_input.c:322
dst_input include/net/dst.h:507 [inline]
ip6_rcv_finish+0x289/0x890 net/ipv6/ip6_input.c:69
NF_HOOK include/linux/netfilter.h:257 [inline]
ipv6_rcv+0x12ec/0x23d0 net/ipv6/ip6_input.c:203
__netif_receive_skb_core+0x1ae5/0x3400 net/core/dev.c:4190
__netif_receive_skb+0x2a/0x170 net/core/dev.c:4228
process_backlog+0xe5/0x6c0 net/core/dev.c:4839
napi_poll net/core/dev.c:5202 [inline]
net_rx_action+0xe70/0x1900 net/core/dev.c:5267
__do_softirq+0x2fb/0xb7d kernel/softirq.c:284
do_softirq_own_stack+0x1c/0x30 arch/x86/entry/entry_64.S:902
</IRQ>
do_softirq.part.17+0x1e8/0x230 kernel/softirq.c:328
do_softirq kernel/softirq.c:176 [inline]
__local_bh_enable_ip+0x1f2/0x200 kernel/softirq.c:181
local_bh_enable include/linux/bottom_half.h:31 [inline]
rcu_read_unlock_bh include/linux/rcupdate.h:971 [inline]
ip6_finish_output2+0xbb0/0x23d0 net/ipv6/ip6_output.c:123
ip6_finish_output+0x302/0x960 net/ipv6/ip6_output.c:148
NF_HOOK_COND include/linux/netfilter.h:246 [inline]
ip6_output+0x1cb/0x8d0 net/ipv6/ip6_output.c:162
ip6_xmit+0xcdf/0x20d0 include/net/dst.h:501
inet6_csk_xmit+0x320/0x5f0 net/ipv6/inet6_connection_sock.c:179
dccp_transmit_skb+0xb09/0x1120 net/dccp/output.c:141
dccp_xmit_packet+0x215/0x760 net/dccp/output.c:280
dccp_write_xmit+0x168/0x1d0 net/dccp/output.c:362
dccp_sendmsg+0x79c/0xb10 net/dccp/proto.c:796
inet_sendmsg+0x164/0x5b0 net/ipv4/af_inet.c:744
sock_sendmsg_nosec net/socket.c:635 [inline]
sock_sendmsg+0xca/0x110 net/socket.c:645
SYSC_sendto+0x660/0x810 net/socket.c:1687
SyS_sendto+0x40/0x50 net/socket.c:1655
entry_SYSCALL_64_fastpath+0x1f/0xc2
RIP: 0033:0x4458b9
RSP: 002b:00007f8ceb77bb58 EFLAGS: 00000282 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 0000000000000017 RCX: 00000000004458b9
RDX: 0000000000000023 RSI: 0000000020e60000 RDI: 0000000000000017
RBP: 00000000006e1b90 R08: 00000000200f9fe1 R09: 0000000000000020
R10: 0000000000008010 R11: 0000000000000282 R12: 00000000007080a8
R13: 0000000000000000 R14: 00007f8ceb77c9c0 R15: 00007f8ceb77c700
Object at ffff88003713be50, in cache kmalloc-64 size: 64
Allocated:
PID = 8446
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
save_stack+0x43/0xd0 mm/kasan/kasan.c:502
set_track mm/kasan/kasan.c:514 [inline]
kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:605
kmem_cache_alloc_trace+0x82/0x270 mm/slub.c:2738
kmalloc include/linux/slab.h:490 [inline]
dccp_feat_entry_new+0x214/0x410 net/dccp/feat.c:467
dccp_feat_push_change+0x38/0x220 net/dccp/feat.c:487
__feat_register_sp+0x223/0x2f0 net/dccp/feat.c:741
dccp_feat_propagate_ccid+0x22b/0x2b0 net/dccp/feat.c:949
dccp_feat_server_ccid_dependencies+0x1b3/0x250 net/dccp/feat.c:1012
dccp_make_response+0x1f1/0xc90 net/dccp/output.c:423
dccp_v6_send_response+0x4ec/0xc20 net/dccp/ipv6.c:217
dccp_v6_conn_request+0xaba/0x11b0 net/dccp/ipv6.c:377
dccp_rcv_state_process+0x51e/0x1650 net/dccp/input.c:606
dccp_v6_do_rcv+0x213/0x350 net/dccp/ipv6.c:632
sk_backlog_rcv include/net/sock.h:893 [inline]
__sk_receive_skb+0x36f/0xcc0 net/core/sock.c:479
dccp_v6_rcv+0xba5/0x1d00 net/dccp/ipv6.c:742
ip6_input_finish+0x46d/0x17a0 net/ipv6/ip6_input.c:279
NF_HOOK include/linux/netfilter.h:257 [inline]
ip6_input+0xdb/0x590 net/ipv6/ip6_input.c:322
dst_input include/net/dst.h:507 [inline]
ip6_rcv_finish+0x289/0x890 net/ipv6/ip6_input.c:69
NF_HOOK include/linux/netfilter.h:257 [inline]
ipv6_rcv+0x12ec/0x23d0 net/ipv6/ip6_input.c:203
__netif_receive_skb_core+0x1ae5/0x3400 net/core/dev.c:4190
__netif_receive_skb+0x2a/0x170 net/core/dev.c:4228
process_backlog+0xe5/0x6c0 net/core/dev.c:4839
napi_poll net/core/dev.c:5202 [inline]
net_rx_action+0xe70/0x1900 net/core/dev.c:5267
__do_softirq+0x2fb/0xb7d kernel/softirq.c:284
Freed:
PID = 15
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
save_stack+0x43/0xd0 mm/kasan/kasan.c:502
set_track mm/kasan/kasan.c:514 [inline]
kasan_slab_free+0x73/0xc0 mm/kasan/kasan.c:578
slab_free_hook mm/slub.c:1355 [inline]
slab_free_freelist_hook mm/slub.c:1377 [inline]
slab_free mm/slub.c:2954 [inline]
kfree+0xe8/0x2b0 mm/slub.c:3874
dccp_feat_entry_destructor.part.4+0x48/0x60 net/dccp/feat.c:418
dccp_feat_entry_destructor net/dccp/feat.c:416 [inline]
dccp_feat_list_pop net/dccp/feat.c:541 [inline]
dccp_feat_activate_values+0x57f/0xab0 net/dccp/feat.c:1543
dccp_create_openreq_child+0x464/0x610 net/dccp/minisocks.c:121
dccp_v6_request_recv_sock+0x1f6/0x1960 net/dccp/ipv6.c:457
dccp_check_req+0x335/0x5a0 net/dccp/minisocks.c:186
dccp_v6_rcv+0x69e/0x1d00 net/dccp/ipv6.c:711
ip6_input_finish+0x46d/0x17a0 net/ipv6/ip6_input.c:279
NF_HOOK include/linux/netfilter.h:257 [inline]
ip6_input+0xdb/0x590 net/ipv6/ip6_input.c:322
dst_input include/net/dst.h:507 [inline]
ip6_rcv_finish+0x289/0x890 net/ipv6/ip6_input.c:69
NF_HOOK include/linux/netfilter.h:257 [inline]
ipv6_rcv+0x12ec/0x23d0 net/ipv6/ip6_input.c:203
__netif_receive_skb_core+0x1ae5/0x3400 net/core/dev.c:4190
__netif_receive_skb+0x2a/0x170 net/core/dev.c:4228
process_backlog+0xe5/0x6c0 net/core/dev.c:4839
napi_poll net/core/dev.c:5202 [inline]
net_rx_action+0xe70/0x1900 net/core/dev.c:5267
__do_softirq+0x2fb/0xb7d kernel/softirq.c:284
Memory state around the buggy address:
ffff88003713bd00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88003713bd80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88003713be00: fc fc fc fc fc fc fc fc fc fc fb fb fb fb fb fb
^--- include/linux/dccp.h | 1 + net/dccp/minisocks.c | 24 ++++++++++++++++-------- 2 files changed, 17 insertions(+), 8 deletions(-)
include/linux/dccp.h +1 -0
@@ -163,6 +163,7 @@ struct dccp_request_sock {__u64 dreq_isr;__u64 dreq_gsr;__be32 dreq_service; +spinlock_t dreq_lock;struct list_head dreq_featneg;__u32 dreq_timestamp_echo;__u32 dreq_timestamp_time;
net/dccp/minisocks.c +16 -8
@@ -146,6 +146,13 @@ struct sock *dccp_check_req(struct sockstruct dccp_request_sock *dreq =dccp_rsk (req);bool own_req; +/* TCP/DCCP listeners became lockless. +* DCCP stores complex state in its request_sock, so we need +* a protection for them, now this code runs without being protected +* by the parent (listener) lock. +*/ +spin_lock_bh (&dreq->dreq_lock); +/* Check for retransmitted REQUEST */ if (dccp_hdr (skb)->dccph_type ==DCCP_PKT_REQUEST ) {
@@ -160,7 +167,7 @@ struct sock *dccp_check_req(struct sockinet_rtx_syn_ack (sk, req); }/* Network Duplicate, discard packet */ -return NULL ; + goto out; }DCCP_SKB_CB (skb)->dccpd_reset_code =DCCP_RESET_CODE_PACKET_ERROR ;
@@ -186,20 +193,20 @@ struct sock *dccp_check_req(struct sock child =inet_csk (sk)->icsk_af_ops->syn_recv_sock (sk, skb, req,NULL , req, &own_req); -if (!child) - goto listen_overflow; - -return inet_csk_complete_hashdance (sk, child, req, own_req); +if (child) { + child =inet_csk_complete_hashdance (sk, child, req, own_req); + goto out; + } -listen_overflow: -dccp_pr_debug ("listen_overflow!\n" );DCCP_SKB_CB (skb)->dccpd_reset_code =DCCP_RESET_CODE_TOO_BUSY ; drop:if (dccp_hdr (skb)->dccph_type !=DCCP_PKT_RESET ) req->rsk_ops->send_reset (sk, skb);inet_csk_reqsk_queue_drop (sk, req); -return NULL ; +out: +spin_unlock_bh (&dreq->dreq_lock); +return child; }EXPORT_SYMBOL_GPL (dccp_check_req);
@@ -250,6 +257,7 @@ int dccp_reqsk_init(struct request_sock {struct dccp_request_sock *dreq =dccp_rsk (req); +spin_lock_init (&dreq->dreq_lock);inet_rsk (req)->ir_rmt_port =dccp_hdr (skb)->dccph_sport;inet_rsk (req)->ir_num =ntohs (dccp_hdr (skb)->dccph_dport);inet_rsk (req)->acked =0 ;
Greg Kroah-Hartman
maintainerPATCH 34/63 team: use ETH_MAX_MTU as max mtu
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jarod Wilson <[email protected]>
[ Upstream commit 3331aa378e9bcbd0d16de9034b0c20f4050e26b4 ]
This restores the ability to set a team device's mtu to anything higher than 1500. Similar to the reported issue with bonding, the team driver calls ether_setup(), which sets an initial max_mtu of 1500, while the underlying hardware can handle something much larger. Just set it to ETH_MAX_MTU to support all possible values, and the limitations of the underlying devices will prevent setting anything too large.
--- drivers/net/team/team.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/team/team.c +1 -0
@@ -2075,6 +2075,7 @@ static int team_dev_type_check_change(ststatic void team_setup (struct net_device *dev) {ether_setup (dev); + dev->max_mtu =ETH_MAX_MTU ; dev->netdev_ops = &team_netdev_ops; dev->ethtool_ops = &team_ethtool_ops;
Greg Kroah-Hartman
maintainerPATCH 35/63 vrf: Fix use-after-free in vrf_xmit
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Ahern <[email protected]>
[ Upstream commit f7887d40e541f74402df0684a1463c0a0bb68c68 ]
KASAN detected a use-after-free:
[ 269.467067] BUG: KASAN: use-after-free in vrf_xmit+0x7f1/0x827 [vrf] at addr ffff8800350a21c0 [ 269.467067] Read of size 4 by task ssh/1879 [ 269.467067] CPU: 1 PID: 1879 Comm: ssh Not tainted 4.10.0+ #249 [ 269.467067] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140531_083030-gandalf 04/01/2014 [ 269.467067] Call Trace: [ 269.467067] dump_stack+0x81/0xb6 [ 269.467067] kasan_object_err+0x21/0x78 [ 269.467067] kasan_report+0x2f7/0x450 [ 269.467067] ? vrf_xmit+0x7f1/0x827 [vrf] [ 269.467067] ? ip_output+0xa4/0xdb [ 269.467067] __asan_load4+0x6b/0x6d [ 269.467067] vrf_xmit+0x7f1/0x827 [vrf]
...
Which corresponds to the skb access after xmit handling. Fix by saving skb->len and using the saved value to update stats.
--- drivers/net/vrf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/vrf.c +2 -1
@@ -341,6 +341,7 @@ static netdev_tx_t is_ip_tx_frame(structstatic netdev_tx_t vrf_xmit (struct sk_buff *skb,struct net_device *dev) { +int len = skb->len;netdev_tx_t ret =is_ip_tx_frame (skb, dev);if (likely (ret ==NET_XMIT_SUCCESS || ret ==NET_XMIT_CN )) {
@@ -348,7 +349,7 @@ static netdev_tx_t vrf_xmit(struct sk_buu64_stats_update_begin (&dstats->syncp); dstats->tx_pkts++; - dstats->tx_bytes += skb->len; + dstats->tx_bytes += len;u64_stats_update_end (&dstats->syncp); }else {this_cpu_inc (dev->dstats->tx_drps);
Greg Kroah-Hartman
maintainerPATCH 36/63 net/tunnel: set inner protocol in network gro hooks
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
[ Upstream commit 294acf1c01bace5cea5d30b510504238bf5f7c25 ]
The gso code of several tunnels type (gre and udp tunnels) takes for granted that the skb->inner_protocol is properly initialized and drops the packet elsewhere.
On the forwarding path no one is initializing such field, so gro encapsulated packets are dropped on forward.
Since commit 38720352412a ("gre: Use inner_proto to obtain inner header protocol"), this can be reproduced when the encapsulated packets use gre as the tunneling protocol.
The issue happens also with vxlan and geneve tunnels since commit 8bce6d7d0d1e ("udp: Generalize skb_udp_segment"), if the forwarding host's ingress nic has h/w offload for such tunnel and a vxlan/geneve device is configured on top of it, regardless of the configured peer address and vni.
To address the issue, this change initialize the inner_protocol field for encapsulated packets in both ipv4 and ipv6 gro complete callbacks.
--- net/ipv4/af_inet.c | 4 +++- net/ipv6/ip6_offload.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-)
net/ipv4/af_inet.c +3 -1
@@ -1470,8 +1470,10 @@ int inet_gro_complete(struct sk_buff *skint proto = iph->protocol;int err = -ENOSYS ; -if (skb->encapsulation) +if (skb->encapsulation) { +skb_set_inner_protocol (skb,cpu_to_be16 (ETH_P_IP ));skb_set_inner_network_header (skb, nhoff); + }csum_replace2 (&iph->check, iph->tot_len, newlen); iph->tot_len = newlen;
net/ipv6/ip6_offload.c +3 -1
@@ -294,8 +294,10 @@ static int ipv6_gro_complete(struct sk_bstruct ipv6hdr *iph = (struct ipv6hdr *)(skb->data + nhoff);int err = -ENOSYS ; -if (skb->encapsulation) +if (skb->encapsulation) { +skb_set_inner_protocol (skb,cpu_to_be16 (ETH_P_IPV6 ));skb_set_inner_network_header (skb, nhoff); + } iph->payload_len =htons (skb->len - nhoff -sizeof (*iph));
Greg Kroah-Hartman
maintainerPATCH 37/63 uapi: fix linux/packet_diag.h userspace compilation error
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Dmitry V. Levin" <[email protected]>
[ Upstream commit 745cb7f8a5de0805cade3de3991b7a95317c7c73 ]
Replace MAX_ADDR_LEN with its numeric value to fix the following linux/packet_diag.h userspace compilation error:
/usr/include/linux/packet_diag.h:67:17: error: 'MAX_ADDR_LEN' undeclared here (not in a function)
__u8 pdmc_addr[MAX_ADDR_LEN];
This is not the first case in the UAPI where the numeric value of MAX_ADDR_LEN is used instead of symbolic one, uapi/linux/if_link.h already does the same:
$ grep MAX_ADDR_LEN include/uapi/linux/if_link.h __u8 mac[32]; /* MAX_ADDR_LEN */
There are no UAPI headers besides these two that use MAX_ADDR_LEN.
--- include/uapi/linux/packet_diag.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/packet_diag.h +1 -1
@@ -64,7 +64,7 @@ struct packet_diag_mclist {__u32 pdmc_count;__u16 pdmc_type;__u16 pdmc_alen; -__u8 pdmc_addr[MAX_ADDR_LEN ]; +__u8 pdmc_addr[32 ];/* MAX_ADDR_LEN */ };struct packet_diag_ring {
Greg Kroah-Hartman
maintainerPATCH 38/63 amd-xgbe: Enable IRQs only if napi_complete_done() is true
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Lendacky, Thomas" <[email protected]>
[ Upstream commit d7aba644ffdebf756e51e26a2229055211838e89 ]
Depending on the hardware, the amd-xgbe driver may use disable_irq_nosync() and enable_irq() when an interrupt is received to process Rx packets. If the napi_complete_done() return value isn't checked an unbalanced enable for the IRQ could result, generating a warning stack trace.
Update the driver to only enable interrupts if napi_complete_done() returns true.
--- drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/net/ethernet/amd/xgbe/xgbe-drv.c +2 -8
@@ -2274,10 +2274,7 @@ static int xgbe_one_poll(struct napi_str processed =xgbe_rx_poll (channel, budget);/* If we processed everything, we are done */ -if (processed < budget) { -/* Turn off polling */ -napi_complete_done (napi, processed); - +if ((processed < budget) &&napi_complete_done (napi, processed)) {/* Enable Tx and Rx interrupts */ if (pdata->channel_irq_mode)xgbe_enable_rx_tx_int (pdata, channel);
@@ -2319,10 +2316,7 @@ static int xgbe_all_poll(struct napi_str }while ((processed < budget) && (processed != last_processed));/* If we processed everything, we are done */ -if (processed < budget) { -/* Turn off polling */ -napi_complete_done (napi, processed); - +if ((processed < budget) &&napi_complete_done (napi, processed)) {/* Enable Tx and Rx interrupts */ xgbe_enable_rx_tx_ints (pdata); }
Greg Kroah-Hartman
maintainerPATCH 40/63 mpls: Send route delete notifications when router module is unloaded
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Ahern <[email protected]>
[ Upstream commit e37791ec1ad785b59022ae211f63a16189bacebf ]
When the mpls_router module is unloaded, mpls routes are deleted but notifications are not sent to userspace leaving userspace caches out of sync. Add the call to mpls_notify_route in mpls_net_exit as routes are freed.
--- net/mpls/af_mpls.c | 1 + 1 file changed, 1 insertion(+)
net/mpls/af_mpls.c +1 -0
@@ -1696,6 +1696,7 @@ static void mpls_net_exit(struct net *nefor (index =0 ; index < platform_labels; index++) {struct mpls_route *rt =rtnl_dereference (platform_label[index]);RCU_INIT_POINTER (platform_label[index],NULL ); +mpls_notify_route (net, index, rt,NULL ,NULL );mpls_rt_free (rt); }rtnl_unlock ();
Greg Kroah-Hartman
maintainerPATCH 41/63 mpls: Do not decrement alive counter for unregister events
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Ahern <[email protected]>
[ Upstream commit 79099aab38c8f5c746748b066ae74ba984fe2cc8 ]
Multipath routes can be rendered usesless when a device in one of the paths is deleted. For example:
$ ip -f mpls ro ls 100 nexthop as to 200 via inet 172.16.2.2 dev virt12 nexthop as to 300 via inet 172.16.3.2 dev br0 101 nexthop as to 201 via inet6 2000:2::2 dev virt12 nexthop as to 301 via inet6 2000:3::2 dev br0
$ ip li del br0
When br0 is deleted the other hop is not considered in mpls_select_multipath because of the alive check -- rt_nhn_alive is 0.
rt_nhn_alive is decremented once in mpls_ifdown when the device is taken down (NETDEV_DOWN) and again when it is deleted (NETDEV_UNREGISTER). For a 2 hop route, deleting one device drops the alive count to 0. Since devices are taken down before unregistering, the decrement on NETDEV_UNREGISTER is redundant.
--- net/mpls/af_mpls.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/mpls/af_mpls.c +2 -1
@@ -956,7 +956,8 @@ static void mpls_ifdown(struct net_devic/* fall through */ case NETDEV_CHANGE : nh->nh_flags |=RTNH_F_LINKDOWN ; -ACCESS_ONCE (rt->rt_nhn_alive) = rt->rt_nhn_alive -1 ; +if (event !=NETDEV_UNREGISTER ) +ACCESS_ONCE (rt->rt_nhn_alive) = rt->rt_nhn_alive -1 ;break ; }if (event ==NETDEV_UNREGISTER )
Greg Kroah-Hartman
maintainerPATCH 42/63 ipv6: make ECMP route replacement less greedy
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sabrina Dubroca <[email protected]>
[ Upstream commit 67e194007be08d071294456274dd53e0a04fdf90 ]
Commit 27596472473a ("ipv6: fix ECMP route replacement") introduced a loop that removes all siblings of an ECMP route that is being replaced. However, this loop doesn't stop when it has replaced siblings, and keeps removing other routes with a higher metric. We also end up triggering the WARN_ON after the loop, because after this nsiblings < 0.
Instead, stop the loop when we have taken care of all routes with the same metric as the route being replaced.
Reproducer:
===========
#!/bin/sh
ip netns add ns1
ip netns add ns2
ip -net ns1 link set lo up
for x in 0 1 2 ; do
ip link add veth$x netns ns2 type veth peer name eth$x netns ns1 ip -net ns1 link set eth$x up
ip -net ns2 link set veth$x up
done
ip -net ns1 -6 r a 2000::/64 nexthop via fe80::0 dev eth0 \
nexthop via fe80::1 dev eth1 nexthop via fe80::2 dev eth2
ip -net ns1 -6 r a 2000::/64 via fe80::42 dev eth0 metric 256 ip -net ns1 -6 r a 2000::/64 via fe80::43 dev eth0 metric 2048
echo "before replace, 3 routes"
ip -net ns1 -6 r | grep -v '^fe80\|^ff00'
echo
ip -net ns1 -6 r c 2000::/64 nexthop via fe80::4 dev eth0 \
nexthop via fe80::5 dev eth1 nexthop via fe80::6 dev eth2
echo "after replace, only 2 routes, metric 2048 is gone" ip -net ns1 -6 r | grep -v '^fe80\|^ff00'
--- net/ipv6/ip6_fib.c | 2 ++ 1 file changed, 2 insertions(+)
net/ipv6/ip6_fib.c +2 -0
@@ -908,6 +908,8 @@ add: ins = &rt->dst.rt6_next; iter = *ins;while (iter) { +if (iter->rt6i_metric > rt->rt6i_metric) +break ;if (rt6_qualify_for_ecmp (iter)) { *ins = iter->dst.rt6_next;fib6_purge_rt (iter, fn, info->nl_net);
Greg Kroah-Hartman
maintainerPATCH 43/63 ipv6: avoid write to a possibly cloned skb
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit 79e49503efe53a8c51d8b695bedc8a346c5e4a87 ]
ip6_fragment, in case skb has a fraglist, checks if the
skb is cloned. If it is, it will move to the 'slow path' and allocates new skbs for each fragment.
However, right before entering the slowpath loop, it updates the nexthdr value of the last ipv6 extension header to NEXTHDR_FRAGMENT, to account for the fragment header that will be inserted in the new ipv6-fragment skbs.
In case original skb is cloned this munges nexthdr value of another skb. Avoid this by doing the nexthdr update for each of the new fragment skbs separately.
This was observed with tcpdump on a bridge device where netfilter ipv6 reassembly is active: tcpdump shows malformed fragment headers as the l4 header (icmpv6, tcp, etc). is decoded as a fragment header.
--- net/ipv6/ip6_output.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
net/ipv6/ip6_output.c +6 -1
@@ -767,13 +767,14 @@ slow_path:* Fragment the datagram. */ - *prevhdr =NEXTHDR_FRAGMENT ; troom = rt->dst.dev->needed_tailroom;/* * Keep copying data until we run out. */ while (left >0 ) { +u8 *fragnexthdr_offset; + len = left;/* IF: it doesn't fit, use 'mtu' - the data space left */ if (len > mtu)
@@ -818,6 +819,10 @@ slow_path:*/ skb_copy_from_linear_data (skb,skb_network_header (frag), hlen); + fragnexthdr_offset =skb_network_header (frag); + fragnexthdr_offset += prevhdr -skb_network_header (skb); + *fragnexthdr_offset =NEXTHDR_FRAGMENT ; +/* * Build fragment header. */
Greg Kroah-Hartman
maintainerPATCH 44/63 bridge: drop netfilter fake rtable unconditionally
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit a13b2082ece95247779b9995c4e91b4246bed023 ]
Andreas reports kernel oops during rmmod of the br_netfilter module. Hannes debugged the oops down to a NULL rt6info->rt6i_indev.
Problem is that br_netfilter has the nasty concept of adding a fake rtable to skb->dst; this happens in a br_netfilter prerouting hook.
A second hook (in bridge LOCAL_IN) is supposed to remove these again before the skb is handed up the stack.
However, on module unload hooks get unregistered which means an skb could traverse the prerouting hook that attaches the fake_rtable, while the 'fake rtable remove' hook gets removed from the hooklist immediately after.
--- net/bridge/br_input.c | 1 + net/bridge/br_netfilter_hooks.c | 21 --------------------- 2 files changed, 1 insertion(+), 21 deletions(-)
net/bridge/br_input.c +1 -0
@@ -29,6 +29,7 @@ EXPORT_SYMBOL(br_should_route_hook);static int br_netif_receive_skb (struct net *net,struct sock *sk,struct sk_buff *skb) { +br_drop_fake_rtable (skb);return netif_receive_skb (skb); }
net/bridge/br_netfilter_hooks.c +0 -21
@@ -521,21 +521,6 @@ static unsigned int br_nf_pre_routing(vo } -/* PF_BRIDGE/LOCAL_IN ************************************************/ -/* The packet is locally destined, which requires a real -* dst_entry, so detach the fake one. On the way up, the -* packet would pass through PRE_ROUTING again (which already -* took place when the packet entered the bridge), but we -* register an IPv4 PRE_ROUTING 'sabotage' hook that will -* prevent this from happening. */ -static unsigned int br_nf_local_in (void *priv, -struct sk_buff *skb, -const struct nf_hook_state *state) -{ -br_drop_fake_rtable (skb); -return NF_ACCEPT ; -} -/* PF_BRIDGE/FORWARD *************************************************/ static int br_nf_forward_finish (struct net *net,struct sock *sk,struct sk_buff *skb) {
@@ -908,12 +893,6 @@ static struct nf_hook_ops br_nf_ops[] __ .priority = NF_BR_PRI_BRNF, }, { - .hook = br_nf_local_in, - .pf = NFPROTO_BRIDGE, - .hooknum = NF_BR_LOCAL_IN, - .priority = NF_BR_PRI_BRNF, - }, - { .hook = br_nf_forward_ip, .pf = NFPROTO_BRIDGE, .hooknum = NF_BR_FORWARD,
Greg Kroah-Hartman
maintainerPATCH 48/63 dccp: fix memory leak during tear-down of unsuccessful connection request
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hannes Frederic Sowa <[email protected]>
[ Upstream commit 72ef9c4125c7b257e3a714d62d778ab46583d6a3 ]
This patch fixes a memory leak, which happens if the connection request is not fulfilled between parsing the DCCP options and handling the SYN (because e.g. the backlog is full), because we forgot to free the list of ack vectors.
--- net/dccp/ccids/ccid2.c | 1 + 1 file changed, 1 insertion(+)
net/dccp/ccids/ccid2.c +1 -0
@@ -749,6 +749,7 @@ static void ccid2_hc_tx_exit(struct sockfor (i =0 ; i < hc->tx_seqbufc; i++)kfree (hc->tx_seqbuf[i]); hc->tx_seqbufc =0 ; +dccp_ackvec_parsed_cleanup (&hc->tx_av_chunks); }static void ccid2_hc_rx_packet_recv (struct sock *sk,struct sk_buff *skb)
Greg Kroah-Hartman
maintainerPATCH 49/63 arm64: KVM: VHE: Clear HCR_TGE when invalidating guest TLBs
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marc Zyngier <[email protected]>
commit 68925176296a8b995e503349200e256674bfe5ac upstream.
When invalidating guest TLBs, special care must be taken to actually shoot the guest TLBs and not the host ones if we're running on a VHE system. This is controlled by the HCR_EL2.TGE bit, which we forget to clear before invalidating TLBs.
Address the issue by introducing two wrappers (__tlb_switch_to_guest and __tlb_switch_to_host) that take care of both the VTTBR_EL2 and HCR_EL2.TGE switching.
--- arch/arm64/kvm/hyp/tlb.c | 64 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 55 insertions(+), 9 deletions(-)
arch/arm64/kvm/hyp/tlb.c +55 -9
@@ -17,14 +17,62 @@#include <asm/kvm_hyp.h> +static void __hyp_text __tlb_switch_to_guest_vhe(struct kvm *kvm) +{ +u64 val; + +/* +* With VHE enabled, we have HCR_EL2.{E2H,TGE} = {1,1}, and +* most TLB operations target EL2/EL0. In order to affect the +* guest TLBs (EL1/EL0), we need to change one of these two +* bits. Changing E2H is impossible (goodbye TTBR1_EL2), so +* let's flip TGE before executing the TLB operation. +*/ +write_sysreg (kvm->arch.vttbr, vttbr_el2); + val =read_sysreg (hcr_el2); + val &= ~HCR_TGE ; +write_sysreg (val, hcr_el2); +isb (); +} + +static void __hyp_text __tlb_switch_to_guest_nvhe(struct kvm *kvm) +{ +write_sysreg (kvm->arch.vttbr, vttbr_el2); +isb (); +} + +static hyp_alternate_select(__tlb_switch_to_guest, + __tlb_switch_to_guest_nvhe, + __tlb_switch_to_guest_vhe, + ARM64_HAS_VIRT_HOST_EXTN); + +static void __hyp_text __tlb_switch_to_host_vhe(struct kvm *kvm) +{ +/* +* We're done with the TLB operation, let's restore the host's +* view of HCR_EL2. +*/ +write_sysreg (0 , vttbr_el2); +write_sysreg (HCR_HOST_VHE_FLAGS , hcr_el2); +} + +static void __hyp_text __tlb_switch_to_host_nvhe(struct kvm *kvm) +{ +write_sysreg (0 , vttbr_el2); +} + +static hyp_alternate_select(__tlb_switch_to_host, + __tlb_switch_to_host_nvhe, + __tlb_switch_to_host_vhe, + ARM64_HAS_VIRT_HOST_EXTN); + void __hyp_text __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa) {dsb (ishst);/* Switch to requested VMID */ kvm =kern_hyp_va (kvm); -write_sysreg (kvm->arch.vttbr, vttbr_el2); -isb (); +__tlb_switch_to_guest ()(kvm);/* * We could do so much better if we had the VA as well.
@@ -45,7 +93,7 @@ void __hyp_text __kvm_tlb_flush_vmid_ipadsb (ish);isb (); -write_sysreg (0 , vttbr_el2); +__tlb_switch_to_host ()(kvm); } void __hyp_text __kvm_tlb_flush_vmid(struct kvm *kvm)
@@ -54,14 +102,13 @@ void __hyp_text __kvm_tlb_flush_vmid(str/* Switch to requested VMID */ kvm =kern_hyp_va (kvm); -write_sysreg (kvm->arch.vttbr, vttbr_el2); -isb (); +__tlb_switch_to_guest ()(kvm); asmvolatile ("tlbi vmalls12e1is" : : );dsb (ish);isb (); -write_sysreg (0 , vttbr_el2); +__tlb_switch_to_host ()(kvm); } void __hyp_text __kvm_tlb_flush_local_vmid(struct kvm_vcpu *vcpu)
@@ -69,14 +116,13 @@ void __hyp_text __kvm_tlb_flush_local_vmstruct kvm *kvm =kern_hyp_va (kern_hyp_va (vcpu)->kvm);/* Switch to requested VMID */ -write_sysreg (kvm->arch.vttbr, vttbr_el2); -isb (); +__tlb_switch_to_guest ()(kvm); asmvolatile ("tlbi vmalle1" : : );dsb (nsh);isb (); -write_sysreg (0 , vttbr_el2); +__tlb_switch_to_host ()(kvm); } void __hyp_text __kvm_flush_vm_context(void)
Greg Kroah-Hartman
maintainerPATCH 50/63 irqchip/gicv3-its: Add workaround for QDF2400 ITS erratum 0065
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shanker Donthineni <[email protected]>
commit 90922a2d03d84de36bf8a9979d62580102f31a92 upstream.
On Qualcomm Datacenter Technologies QDF2400 SoCs, the ITS hardware implementation uses 16Bytes for Interrupt Translation Entry (ITE), but reports an incorrect value of 8Bytes in GITS_TYPER.ITTE_size.
It might cause kernel memory corruption depending on the number of MSI(x) that are configured and the amount of memory that has been allocated for ITEs in its_create_device().
This patch fixes the potential memory corruption by setting the correct ITE size to 16Bytes.
--- Documentation/arm64/silicon-errata.txt | 44 +++++++++++++++++---------------- arch/arm64/Kconfig | 10 +++++++ drivers/irqchip/irq-gic-v3-its.c | 16 ++++++++++++ 3 files changed, 49 insertions(+), 21 deletions(-)
Documentation/arm64/silicon-errata.txt +23 -21
@@ -42,24 +42,26 @@ file acts as a registry of software work will be updated when new workarounds are committed and backported to stable kernels. -| Implementor | Component | Erratum ID | Kconfig | -+----------------+-----------------+-----------------+-------------------------+ -| ARM | Cortex-A53 | #826319 | ARM64_ERRATUM_826319 | -| ARM | Cortex-A53 | #827319 | ARM64_ERRATUM_827319 | -| ARM | Cortex-A53 | #824069 | ARM64_ERRATUM_824069 | -| ARM | Cortex-A53 | #819472 | ARM64_ERRATUM_819472 | -| ARM | Cortex-A53 | #845719 | ARM64_ERRATUM_845719 | -| ARM | Cortex-A53 | #843419 | ARM64_ERRATUM_843419 | -| ARM | Cortex-A57 | #832075 | ARM64_ERRATUM_832075 | -| ARM | Cortex-A57 | #852523 | N/A | -| ARM | Cortex-A57 | #834220 | ARM64_ERRATUM_834220 | -| ARM | Cortex-A72 | #853709 | N/A | -| ARM | MMU-500 | #841119,#826419 | N/A | -| | | | | -| Cavium | ThunderX ITS | #22375, #24313 | CAVIUM_ERRATUM_22375 | -| Cavium | ThunderX ITS | #23144 | CAVIUM_ERRATUM_23144 | -| Cavium | ThunderX GICv3 | #23154 | CAVIUM_ERRATUM_23154 | -| Cavium | ThunderX Core | #27456 | CAVIUM_ERRATUM_27456 | -| Cavium | ThunderX SMMUv2 | #27704 | N/A | -| | | | | -| Freescale/NXP | LS2080A/LS1043A | A-008585 | FSL_ERRATUM_A008585 | +| Implementor | Component | Erratum ID | Kconfig | ++----------------+-----------------+-----------------+-----------------------------+ +| ARM | Cortex-A53 | #826319 | ARM64_ERRATUM_826319 | +| ARM | Cortex-A53 | #827319 | ARM64_ERRATUM_827319 | +| ARM | Cortex-A53 | #824069 | ARM64_ERRATUM_824069 | +| ARM | Cortex-A53 | #819472 | ARM64_ERRATUM_819472 | +| ARM | Cortex-A53 | #845719 | ARM64_ERRATUM_845719 | +| ARM | Cortex-A53 | #843419 | ARM64_ERRATUM_843419 | +| ARM | Cortex-A57 | #832075 | ARM64_ERRATUM_832075 | +| ARM | Cortex-A57 | #852523 | N/A | +| ARM | Cortex-A57 | #834220 | ARM64_ERRATUM_834220 | +| ARM | Cortex-A72 | #853709 | N/A | +| ARM | MMU-500 | #841119,#826419 | N/A | +| | | | | +| Cavium | ThunderX ITS | #22375, #24313 | CAVIUM_ERRATUM_22375 | +| Cavium | ThunderX ITS | #23144 | CAVIUM_ERRATUM_23144 | +| Cavium | ThunderX GICv3 | #23154 | CAVIUM_ERRATUM_23154 | +| Cavium | ThunderX Core | #27456 | CAVIUM_ERRATUM_27456 | +| Cavium | ThunderX SMMUv2 | #27704 | N/A | +| | | | | +| Freescale/NXP | LS2080A/LS1043A | A-008585 | FSL_ERRATUM_A008585 | +| | | | | +| Qualcomm Tech. | QDF2400 ITS | E0065 | QCOM_QDF2400_ERRATUM_0065 |
arch/arm64/Kconfig +10 -0
@@ -479,6 +479,16 @@ config CAVIUM_ERRATUM_27456 If unsure, say Y. +config QCOM_QDF2400_ERRATUM_0065 + bool "QDF2400 E0065: Incorrect GITS_TYPER.ITT_Entry_size" + default y + help + On Qualcomm Datacenter Technologies QDF2400 SoC, ITS hardware reports + ITE size incorrectly. The GITS_TYPER.ITT_Entry_size field should have + been indicated as 16Bytes (0xf), not 8Bytes (0x7). + + If unsure, say Y. + endmenu
drivers/irqchip/irq-gic-v3-its.c +16 -0
@@ -1597,6 +1597,14 @@ static void __maybe_unused its_enable_qu its->flags |=ITS_FLAGS_WORKAROUND_CAVIUM_23144 ; } +static void __maybe_unused its_enable_quirk_qdf2400_e0065 (void *data) +{ +struct its_node *its = data; + +/* On QDF2400, the size of the ITE is 16Bytes */ + its->ite_size =16 ; +} + static const struct gic_quirk its_quirks[] = { #ifdef CONFIG_CAVIUM_ERRATUM_22375 {
@@ -1614,6 +1622,14 @@ static const struct gic_quirk its_quirks .init = its_enable_quirk_cavium_23144, },#endif +#ifdef CONFIG_QCOM_QDF2400_ERRATUM_0065 + { + .desc = "ITS: QDF2400 erratum 0065", + .iidr = 0x00001070, /* QDF2400 ITS rev 1.x */ + .mask = 0xffffffff, + .init = its_enable_quirk_qdf2400_e0065, + }, +#endif { } };
Greg Kroah-Hartman
maintainerPATCH 54/63 x86/unwind: Fix last frame check for aligned function stacks
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Poimboeuf <[email protected]>
commit 87a6b2975f0d340c75b7488d22d61d2f98fb8abf upstream.
Pavel Machek reported the following warning on x86-32:
WARNING: kernel stack frame pointer at f50cdf98 in swapper/2:0 has bad value (null)
The warning is caused by the unwinder not realizing that it reached the end of the stack, due to an unusual prologue which gcc sometimes generates for aligned stacks. The prologue is based on a gcc feature called the Dynamic Realign Argument Pointer (DRAP). It's almost always enabled for aligned stacks when -maccumulate-outgoing-args isn't set.
This issue is similar to the one fixed by the following commit:
8023e0e2a48d ("x86/unwind: Adjust last frame check for aligned function stacks")
... but that fix was specific to x86-64.
Make the fix more generic to cover x86-32 as well, and also ensure that the return address referred to by the frame pointer is a copy of the original return address.
--- arch/x86/kernel/unwind_frame.c | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-)
arch/x86/kernel/unwind_frame.c +30 -6
@@ -80,19 +80,43 @@ static size_t regs_size(struct pt_regs *return sizeof (*regs); } +#ifdef CONFIG_X86_32 +#define GCC_REALIGN_WORDS 3 +#else +#define GCC_REALIGN_WORDS 1 +#endif +static bool is_last_task_frame (struct unwind_state *state) { -unsigned long bp = (unsigned long )state->bp; -unsigned long regs = (unsigned long )task_pt_regs (state->task); +unsigned long *last_bp = (unsigned long *)task_pt_regs (state->task) -2 ; +unsigned long *aligned_bp = last_bp -GCC_REALIGN_WORDS ;/* * We have to check for the last task frame at two different locations * because gcc can occasionally decide to realign the stack pointer and -* change the offset of the stack frame by a word in the prologue of a -* function called by head/entry code. +* change the offset of the stack frame in the prologue of a function +* called by head/entry code. Examples: +* +* <start_secondary>: +* push %edi +* lea 0x8(%esp),%edi +* and $0xfffffff8,%esp +* pushl -0x4(%edi) +* push %ebp +* mov %esp,%ebp +* +* <x86_64_start_kernel>: +* lea 0x8(%rsp),%r10 +* and $0xfffffffffffffff0,%rsp +* pushq -0x8(%r10) +* push %rbp +* mov %rsp,%rbp +* +* Note that after aligning the stack, it pushes a duplicate copy of +* the return address before pushing the frame pointer. */ -return bp == regs -FRAME_HEADER_SIZE || - bp == regs -FRAME_HEADER_SIZE -sizeof (long ); +return (state->bp == last_bp || + (state->bp == aligned_bp && *(aligned_bp+1 ) == *(last_bp+1 ))); }/*
Greg Kroah-Hartman
maintainerPATCH 55/63 x86/tsc: Fix ART for TSC_KNOWN_FREQ
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
commit 44fee88cea43d3c2cac962e0439cb10a3cabff6d upstream.
Subhransu reported that convert_art_to_tsc() isn't working for him.
The ART to TSC relation is only set up for systems which use the refined TSC calibration. Systems with known TSC frequency (available via CPUID 15) are not using the refined calibration and therefor the ART to TSC relation is never established.
Add the setup to the known frequency init path which skips ART calibration. The init code needs to be duplicated as for systems which use refined calibration the ART setup must be delayed until calibration has been done.
The problem has been there since the ART support was introdduced, but only detected now because Subhransu tested the first time on hardware which has TSC frequency enumerated via CPUID 15.
Note for stable: The conditional has changed from TSC_RELIABLE to
TSC_KNOWN_FREQUENCY.
[ tglx: Rewrote changelog and identified the proper 'Fixes' commit ]
--- arch/x86/kernel/tsc.c | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/kernel/tsc.c +2 -0
@@ -1310,6 +1310,8 @@ static int __init init_tsc_clocksource(v* the refined calibration and directly register it as a clocksource. */ if (boot_cpu_has (X86_FEATURE_TSC_KNOWN_FREQ )) { +if (boot_cpu_has (X86_FEATURE_ART )) + art_related_clocksource = &clocksource_tsc;clocksource_register_khz (&clocksource_tsc, tsc_khz);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 56/63 x86/kasan: Fix boot with KASAN=y and PROFILE_ANNOTATED_BRANCHES=y
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrey Ryabinin <[email protected]>
commit be3606ff739d1c1be36389f8737c577ad87e1f57 upstream.
The kernel doesn't boot with both PROFILE_ANNOTATED_BRANCHES=y and KASAN=y options selected. With branch profiling enabled we end up calling ftrace_likely_update() before kasan_early_init(). ftrace_likely_update() is built with KASAN instrumentation, so calling it before kasan has been initialized leads to crash.
Use DISABLE_BRANCH_PROFILING define to make sure that we don't call ftrace_likely_update() from early code before kasan_early_init().
--- arch/x86/kernel/head64.c | 1 + arch/x86/mm/kasan_init_64.c | 1 + 2 files changed, 2 insertions(+)
arch/x86/kernel/head64.c +1 -0
@@ -4,6 +4,7 @@* Copyright (C) 2000 Andrea Arcangeli <[email protected]> SuSE */ +#define DISABLE_BRANCH_PROFILING #include <linux/init.h> #include <linux/linkage.h> #include <linux/types.h>
arch/x86/mm/kasan_init_64.c +1 -0
@@ -1,3 +1,4 @@ +#define DISABLE_BRANCH_PROFILING #define pr_fmt (fmt) "kasan: " fmt#include <linux/bootmem.h> #include <linux/kasan.h>
Greg Kroah-Hartman
maintainerPATCH 57/63 x86/intel_rdt: Put group node in rdtgroup_kn_unlock
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Olsa <[email protected]>
commit 49ec8f5b6ae3ab60385492cad900ffc8a523c895 upstream.
The rdtgroup_kn_unlock waits for the last user to release and put its node. But it's calling kernfs_put on the node which calls the rdtgroup_kn_unlock, which might not be the group's directory node, but another group's file node.
This race could be easily reproduced by running 2 instances of following script:
mount -t resctrl resctrl /sys/fs/resctrl/
pushd /sys/fs/resctrl/
mkdir krava
echo "krava" > krava/schemata
rmdir krava
popd
umount /sys/fs/resctrl
It triggers the slub debug error message with following command line config: slub_debug=,kernfs_node_cache.
Call kernfs_put on the group's node to fix it.
--- arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/intel_rdt_rdtgroup.c +1 -1
@@ -727,7 +727,7 @@ void rdtgroup_kn_unlock(struct kernfs_noif (atomic_dec_and_test (&rdtgrp->waitcount) && (rdtgrp->flags &RDT_DELETED )) {kernfs_unbreak_active_protection (kn); -kernfs_put (kn); +kernfs_put (rdtgrp->kn);kfree (rdtgrp); }else {kernfs_unbreak_active_protection (kn);
Greg Kroah-Hartman
maintainerPATCH 58/63 x86/perf: Fix CR4.PCE propagation to use active_mm instead of mm
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit 5dc855d44c2ad960a86f593c60461f1ae1566b6d upstream.
If one thread mmaps a perf event while another thread in the same mm is in some context where active_mm != mm (which can happen in the scheduler, for example), refresh_pce() would write the wrong value to CR4.PCE. This broke some PAPI tests.
--- arch/x86/events/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/events/core.c +2 -2
@@ -2100,8 +2100,8 @@ static int x86_pmu_event_init(struct perstatic void refresh_pce (void *ignored) { -if (current->mm) -load_mm_cr4 (current->mm); +if (current->active_mm) +load_mm_cr4 (current->active_mm); }static void x86_pmu_event_mapped (struct perf_event *event)
Greg Kroah-Hartman
maintainerPATCH 59/63 futex: Fix potential use-after-free in FUTEX_REQUEUE_PI
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
commit c236c8e95a3d395b0494e7108f0d41cf36ec107c upstream.
While working on the futex code, I stumbled over this potential use-after-free scenario. Dmitry triggered it later with syzkaller.
pi_mutex is a pointer into pi_state, which we drop the reference on in unqueue_me_pi(). So any access to that pointer after that is bad.
Since other sites already do rt_mutex_unlock() with hb->lock held, see for example futex_lock_pi(), simply move the unlock before unqueue_me_pi().
--- kernel/futex.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
kernel/futex.c +11 -9
@@ -2813,7 +2813,6 @@ static int futex_wait_requeue_pi(u32 __u {struct hrtimer_sleeper timeout, *to =NULL ;struct rt_mutex_waiter rt_waiter; -struct rt_mutex *pi_mutex =NULL ;struct futex_hash_bucket *hb;union futex_key key2 =FUTEX_KEY_INIT ;struct futex_q q = futex_q_init;
@@ -2905,6 +2904,8 @@ static int futex_wait_requeue_pi(u32 __uspin_unlock (q.lock_ptr); } }else { +struct rt_mutex *pi_mutex; +/* * We have been woken up by futex_unlock_pi(), a timeout, or a * signal. futex_unlock_pi() will not destroy the lock_ptr nor
@@ -2928,18 +2929,19 @@ static int futex_wait_requeue_pi(u32 __uif (res) ret = (res <0 ) ? res :0 ; +/* +* If fixup_pi_state_owner() faulted and was unable to handle +* the fault, unlock the rt_mutex and return the fault to +* userspace. +*/ +if (ret &&rt_mutex_owner (pi_mutex) == current) +rt_mutex_unlock (pi_mutex); +/* Unqueue and drop the lock. */ unqueue_me_pi (&q); } -/* -* If fixup_pi_state_owner() faulted and was unable to handle the -* fault, unlock the rt_mutex and return the fault to userspace. -*/ -if (ret == -EFAULT ) { -if (pi_mutex &&rt_mutex_owner (pi_mutex) == current) -rt_mutex_unlock (pi_mutex); - }else if (ret == -EINTR ) { +if (ret == -EINTR ) {/* * We've already been requeued, but cannot restart by calling * futex_lock_pi() directly. We could restart this syscall, but
Greg Kroah-Hartman
maintainerPATCH 60/63 futex: Add missing error handling to FUTEX_REQUEUE_PI
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
commit 9bbb25afeb182502ca4f2c4f3f88af0681b34cae upstream.
Thomas spotted that fixup_pi_state_owner() can return errors and we fail to unlock the rt_mutex in that case.
--- kernel/futex.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/futex.c +2 -0
@@ -2896,6 +2896,8 @@ static int futex_wait_requeue_pi(u32 __uif (q.pi_state && (q.pi_state->owner != current)) {spin_lock (q.lock_ptr); ret =fixup_pi_state_owner (uaddr2, &q, current); +if (ret &&rt_mutex_owner (&q.pi_state->pi_mutex) == current) +rt_mutex_unlock (&q.pi_state->pi_mutex);/* * Drop the reference to the pi state which * the requeue_pi() code acquired for us.
Greg Kroah-Hartman
maintainerPATCH 61/63 locking/rwsem: Fix down_write_killable() for CONFIG_RWSEM_GENERIC_SPINLOCK=y
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <[email protected]>
commit 17fcbd590d0c3e35bd9646e2215f86586378bc42 upstream.
We hang if SIGKILL has been sent, but the task is stuck in down_read() (after do_exit()), even though no task is doing down_write() on the rwsem in question:
INFO: task libupnp:21868 blocked for more than 120 seconds. libupnp D 0 21868 1 0x08100008 ... Call Trace: __schedule() schedule() __down_read() do_exit() do_group_exit() __wake_up_parent()
This bug has already been fixed for CONFIG_RWSEM_XCHGADD_ALGORITHM=y in the following commit:
04cafed7fc19 ("locking/rwsem: Fix down_write_killable()")
... however, this bug also exists for CONFIG_RWSEM_GENERIC_SPINLOCK=y.
--- kernel/locking/rwsem-spinlock.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
kernel/locking/rwsem-spinlock.c +10 -5
@@ -216,10 +216,8 @@ int __sched __down_write_common(struct r*/ if (sem->count ==0 )break ; -if (signal_pending_state (state, current)) { - ret = -EINTR ; - goto out; - } +if (signal_pending_state (state, current)) + goto out_nolock;set_task_state (tsk, state);raw_spin_unlock_irqrestore (&sem->wait_lock, flags);schedule ();
@@ -227,12 +225,19 @@ int __sched __down_write_common(struct r }/* got the lock */ sem->count =-1 ; -out:list_del (&waiter.list);raw_spin_unlock_irqrestore (&sem->wait_lock, flags);return ret; + +out_nolock: +list_del (&waiter.list); +if (!list_empty (&sem->wait_list)) +__rwsem_do_wake (sem,1 ); +raw_spin_unlock_irqrestore (&sem->wait_lock, flags); + +return -EINTR ; } void __sched __down_write(struct rw_semaphore *sem)
Greg Kroah-Hartman
maintainerPATCH 62/63 crypto: powerpc - Fix initialisation of crc32c context
In reply to Greg Kroah-Hartman4.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Axtens <[email protected]>
commit aa2be9b3d6d2d699e9ca7cbfc00867c80e5da213 upstream.
Turning on crypto self-tests on a POWER8 shows:
alg: hash: Test 1 failed for crc32c-vpmsum
00000000: ff ff ff ff
Comparing the code with the Intel CRC32c implementation on which ours is based shows that we are doing an init with 0, not ~0 as CRC32c requires.
This probably wasn't caught because btrfs does its own weird open-coded initialisation.
Initialise our internal context to ~0 on init.
This makes the self-tests pass, and btrfs continues to work.
--- arch/powerpc/crypto/crc32c-vpmsum_glue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/crypto/crc32c-vpmsum_glue.c +1 -1
@@ -52,7 +52,7 @@ static int crc32c_vpmsum_cra_init(struct {u32 *key =crypto_tfm_ctx (tfm); - *key =0 ; + *key = ~0 ;return 0 ; }
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.10.5 release. There are 63 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 Wed Mar 22 17:47:25 UTC 2017. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.10.5-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.10.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Greg Kroah-Hartman
maintainerQuoted 15 lines · Shuah Khan
Quoted 14 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.10.5 release. There are 63 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 Wed Mar 22 17:47:25 UTC 2017. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.10.5-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.10.y
and the diffstat can be found below.
Quoted 6 lines
Quoted 4 lines
thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
Thanks for testing all of these and letting me know.
greg k-h
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.10.5 release. There are 63 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 Wed Mar 22 17:47:25 UTC 2017. Anything received after that time might be too late.
Build results:
total: 149 pass: 149 fail: 0 Qemu test results: total: 122 pass: 122 fail: 0
Details are available at http://kerneltests.org/builders.
Guenter
Greg Kroah-Hartman
maintainerQuoted 10 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.10.5 release. There are 63 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 Wed Mar 22 17:47:25 UTC 2017. Anything received after that time might be too late.
Quoted 6 lines
Build results:
total: 149 pass: 149 fail: 0 Qemu test results: total: 122 pass: 122 fail: 0Details are available at http://kerneltests.org/builders.
Thanks for testing all of these and letting me know.
greg k-h