4.14.45-stable review
Subsystems (8)
Greg Kroah-Hartman
maintainerPATCH 160/496 virtio-gpu: fix ioctl and expose the fixed status to userspace.
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Airlie <[email protected]>
[ Upstream commit 9a191b114906457c4b2494c474f58ae4142d4e67 ]
This exposes to mesa that it can use the fixed ioctl for querying later cap sets, cap set 1 is forever frozen in time.
--- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 17 +++++++++++------ include/uapi/drm/virtgpu_drm.h | 1 + 2 files changed, 12 insertions(+), 6 deletions(-)
drivers/gpu/drm/virtio/virtgpu_ioctl.c +11 -6
@@ -196,6 +196,9 @@ static int virtio_gpu_getparam_ioctl(strcase VIRTGPU_PARAM_3D_FEATURES : value = vgdev->has_virgl_3d == true ?1 :0 ;break ; +case VIRTGPU_PARAM_CAPSET_QUERY_FIX : + value =1 ; +break ;default :return -EINVAL ; }
@@ -471,7 +474,7 @@ static int virtio_gpu_get_caps_ioctl(str {struct virtio_gpu_device *vgdev = dev->dev_private;struct drm_virtgpu_get_caps *args = data; -int size; +unsigned size, host_caps_size;int i;int found_valid =-1 ;int ret;
@@ -480,6 +483,10 @@ static int virtio_gpu_get_caps_ioctl(strif (vgdev->num_capsets ==0 )return -ENOSYS ; +/* don't allow userspace to pass 0 */ +if (args->size ==0 ) +return -EINVAL ; +spin_lock (&vgdev->display_info_lock);for (i =0 ; i < vgdev->num_capsets; i++) {if (vgdev->capsets[i].id == args->cap_set_id) {
@@ -495,11 +502,9 @@ static int virtio_gpu_get_caps_ioctl(strreturn -EINVAL ; } - size = vgdev->capsets[found_valid].max_size; -if (args->size > size) { -spin_unlock (&vgdev->display_info_lock); -return -EINVAL ; - } + host_caps_size = vgdev->capsets[found_valid].max_size; +/* only copy to user the minimum of the host caps size or the guest caps size */ + size =min (args->size, host_caps_size);list_for_each_entry (cache_ent, &vgdev->cap_cache, head) { if (cache_ent->id == args->cap_set_id &&
include/uapi/drm/virtgpu_drm.h +1 -0
@@ -63,6 +63,7 @@ struct drm_virtgpu_execbuffer { };#define VIRTGPU_PARAM_3D_FEATURES 1/* do we have 3D features in the hw */ +#define VIRTGPU_PARAM_CAPSET_QUERY_FIX 2/* do we have the capset fix */ struct drm_virtgpu_getparam {__u64 param;
Greg Kroah-Hartman
maintainerPATCH 161/496 dmaengine: rcar-dmac: fix max_chunk_size for R-Car Gen3
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yoshihiro Shimoda <[email protected]>
[ Upstream commit d716d9b702bb759dd6fb50804f10a174bd156d71 ]
According to R-Car Gen3 Rev.0.80 manual, the DMATCR can be set to 16,777,215 as maximum. So, this patch fixes the max_chunk_size for safety on all of SoCs. Otherwise, a system may hang if the DMATCR is set to 0 on R-Car Gen3.
--- drivers/dma/sh/rcar-dmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/sh/rcar-dmac.c +1 -1
@@ -880,7 +880,7 @@ rcar_dmac_chan_prep_sg(struct rcar_dmac_rcar_dmac_chan_configure_desc (chan, desc); - max_chunk_size = (RCAR_DMATCR_MASK +1 ) << desc->xfer_shift; + max_chunk_size =RCAR_DMATCR_MASK << desc->xfer_shift;/* * Allocate and fill the transfer chunk descriptors. We own the only
Greg Kroah-Hartman
maintainerPATCH 162/496 bcache: fix kcrashes with fio in RAID5 backend dev
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tang Junhui <[email protected]>
[ Upstream commit 60eb34ec5526e264c2bbaea4f7512d714d791caf ]
Kernel crashed when run fio in a RAID5 backend bcache device, the call trace is bellow:
[ 440.012034] kernel BUG at block/blk-ioc.c:146! [ 440.012696] invalid opcode: 0000 [#1] SMP NOPTI [ 440.026537] CPU: 2 PID: 2205 Comm: md127_raid5 Not tainted 4.15.0 #8 [ 440.027441] Hardware name: HP ProLiant MicroServer Gen8, BIOS J06 07/16 /2015 [ 440.028615] RIP: 0010:put_io_context+0x8b/0x90 [ 440.029246] RSP: 0018:ffffa8c882b43af8 EFLAGS: 00010246 [ 440.029990] RAX: 0000000000000000 RBX: ffffa8c88294fca0 RCX: 0000000000 0f4240 [ 440.031006] RDX: 0000000000000004 RSI: 0000000000000286 RDI: ffffa8c882 94fca0 [ 440.032030] RBP: ffffa8c882b43b10 R08: 0000000000000003 R09: ffff949cb8 0c1700 [ 440.033206] R10: 0000000000000104 R11: 000000000000b71c R12: 00000000000 01000 [ 440.034222] R13: 0000000000000000 R14: ffff949cad84db70 R15: ffff949cb11 bd1e0 [ 440.035239] FS: 0000000000000000(0000) GS:ffff949cba280000(0000) knlGS: 0000000000000000 [ 440.060190] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 440.084967] CR2: 00007ff0493ef000 CR3: 00000002f1e0a002 CR4: 00000000001 606e0 [ 440.110498] Call Trace: [ 440.135443] bio_disassociate_task+0x1b/0x60 [ 440.160355] bio_free+0x1b/0x60 [ 440.184666] bio_put+0x23/0x30 [ 440.208272] search_free+0x23/0x40 [bcache] [ 440.231448] cached_dev_write_complete+0x31/0x70 [bcache] [ 440.254468] closure_put+0xb6/0xd0 [bcache] [ 440.277087] request_endio+0x30/0x40 [bcache] [ 440.298703] bio_endio+0xa1/0x120 [ 440.319644] handle_stripe+0x418/0x2270 [raid456] [ 440.340614] ? load_balance+0x17b/0x9c0 [ 440.360506] handle_active_stripes.isra.58+0x387/0x5a0 [raid456] [ 440.380675] ? __release_stripe+0x15/0x20 [raid456] [ 440.400132] raid5d+0x3ed/0x5d0 [raid456] [ 440.419193] ? schedule+0x36/0x80 [ 440.437932] ? schedule_timeout+0x1d2/0x2f0 [ 440.456136] md_thread+0x122/0x150 [ 440.473687] ? wait_woken+0x80/0x80 [ 440.491411] kthread+0x102/0x140 [ 440.508636] ? find_pers+0x70/0x70 [ 440.524927] ? kthread_associate_blkcg+0xa0/0xa0 [ 440.541791] ret_from_fork+0x35/0x40 [ 440.558020] Code: c2 48 00 5b 41 5c 41 5d 5d c3 48 89 c6 4c 89 e7 e8 bb c2 48 00 48 8b 3d bc 36 4b 01 48 89 de e8 7c f7 e0 ff 5b 41 5c 41 5d 5d c3 <0f> 0b 0f 1f 00 0f 1f 44 00 00 55 48 8d 47 b8 48 89 e5 41 57 41 [ 440.610020] RIP: put_io_context+0x8b/0x90 RSP: ffffa8c882b43af8 [ 440.628575] ---[ end trace a1fd79d85643a73e ]--
All the crash issue happened when a bypass IO coming, in such scenario s->iop.bio is pointed to the s->orig_bio. In search_free(), it finishes the s->orig_bio by calling bio_complete(), and after that, s->iop.bio became invalid, then kernel would crash when calling bio_put(). Maybe its upper layer's faulty, since bio should not be freed before we calling bio_put(), but we'd better calling bio_put() first before calling bio_complete() to notify upper layer ending this bio.
This patch moves bio_complete() under bio_put() to avoid kernel crash.
[mlyle: fixed commit subject for character limits]
--- drivers/md/bcache/request.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/bcache/request.c +1 -1
@@ -651,11 +651,11 @@ static void do_bio_hook(struct search *sstatic void search_free (struct closure *cl) { struct search *s = container_of(cl, struct search, cl); -bio_complete (s);if (s->iop.bio)bio_put (s->iop.bio); +bio_complete (s);closure_debug_destroy (cl);mempool_free (s, s->d->c->search); }
Greg Kroah-Hartman
maintainerPATCH 163/496 ip_gre: fix IFLA_MTU ignored on NEWLINK
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xin Long <[email protected]>
[ Upstream commit ffc2b6ee417435605ee8bb1eb4c8f02e9ff4b4a5 ]
It's safe to remove the setting of dev's needed_headroom and mtu in __gre_tunnel_init, as discussed in [1], ip_tunnel_newlink can do it properly.
Now Eric noticed that it could cover the mtu value set in do_setlink when creating a ip_gre dev. It makes IFLA_MTU param not take effect.
So this patch is to remove them to make IFLA_MTU work, as in other ipv4 tunnels.
[1]: https://patchwork.ozlabs.org/patch/823504/
--- net/ipv4/ip_gre.c | 5 ----- 1 file changed, 5 deletions(-)
net/ipv4/ip_gre.c +0 -5
@@ -951,9 +951,6 @@ static void __gre_tunnel_init(struct net t_hlen = tunnel->hlen +sizeof (struct iphdr ); - dev->needed_headroom =LL_MAX_HEADER + t_hlen +4 ; - dev->mtu =ETH_DATA_LEN - t_hlen -4 ; - dev->features |=GRE_FEATURES ; dev->hw_features |=GRE_FEATURES ;
@@ -1253,8 +1250,6 @@ static int erspan_tunnel_init(struct netsizeof (struct erspanhdr ); t_hlen = tunnel->hlen +sizeof (struct iphdr ); - dev->needed_headroom =LL_MAX_HEADER + t_hlen +4 ; - dev->mtu =ETH_DATA_LEN - t_hlen -4 ; dev->features |=GRE_FEATURES ; dev->hw_features |=GRE_FEATURES ; dev->priv_flags |=IFF_LIVE_ADDR_CHANGE ;
Greg Kroah-Hartman
maintainerPATCH 164/496 ip6_tunnel: fix IFLA_MTU ignored on NEWLINK
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xin Long <[email protected]>
[ Upstream commit a6aa80446234ec0ad38eecdb8efc59e91daae565 ]
Commit 128bb975dc3c ("ip6_gre: init dev->mtu and dev->hard_header_len correctly") fixed IFLA_MTU ignored on NEWLINK for ip6_gre. The same mtu fix is also needed for ip6_tunnel.
Note that dev->hard_header_len setting for ip6_tunnel works fine, no need to fix it.
--- net/ipv6/ip6_tunnel.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
net/ipv6/ip6_tunnel.c +8 -4
@@ -1990,14 +1990,14 @@ static int ip6_tnl_newlink(struct net *s {struct net *net =dev_net (dev);struct ip6_tnl_net *ip6n =net_generic (net, ip6_tnl_net_id); -struct ip6_tnl *nt, *t;struct ip_tunnel_encap ipencap; +struct ip6_tnl *nt, *t; +int err; nt =netdev_priv (dev);if (ip6_tnl_netlink_encap_parms (data, &ipencap)) { -int err =ip6_tnl_encap_setup (nt, &ipencap); - + err =ip6_tnl_encap_setup (nt, &ipencap);if (err <0 )return err; }
@@ -2013,7 +2013,11 @@ static int ip6_tnl_newlink(struct net *sreturn -EEXIST ; } -return ip6_tnl_create2 (dev); + err =ip6_tnl_create2 (dev); +if (!err && tb[IFLA_MTU ]) +ip6_tnl_change_mtu (dev,nla_get_u32 (tb[IFLA_MTU ])); + +return err; } static int ip6_tnl_changelink(struct net_device *dev, struct nlattr *tb[],
Greg Kroah-Hartman
maintainerPATCH 165/496 sit: fix IFLA_MTU ignored on NEWLINK
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xin Long <[email protected]>
[ Upstream commit 2b3957c34b6d7f03544b12ebbf875eee430745db ]
Commit 128bb975dc3c ("ip6_gre: init dev->mtu and dev->hard_header_len correctly") fixed IFLA_MTU ignored on NEWLINK for ip6_gre. The same mtu fix is also needed for sit.
Note that dev->hard_header_len setting for sit works fine, no need to fix it. sit is actually ipv4 tunnel, it can't call ip6_tnl_change_mtu to set mtu.
--- net/ipv6/sit.c | 7 +++++++ 1 file changed, 7 insertions(+)
net/ipv6/sit.c +7 -0
@@ -1569,6 +1569,13 @@ static int ipip6_newlink(struct net *srcif (err <0 )return err; +if (tb[IFLA_MTU ]) { +u32 mtu =nla_get_u32 (tb[IFLA_MTU ]); + +if (mtu >=IPV6_MIN_MTU && mtu <=0xFFF8 - dev->hard_header_len) + dev->mtu = mtu; + } +#ifdef CONFIG_IPV6_SIT_6RD if (ipip6_netlink_6rd_parms (data, &ip6rd)) err =ipip6_tunnel_update_6rd (nt, &ip6rd);
Greg Kroah-Hartman
maintainerPATCH 166/496 nbd: fix return value in error handling path
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Gustavo A. R. Silva" <[email protected]>
[ Upstream commit 0979962f5490abe75b3e2befb07a564fa0cf631b ]
It seems that the proper value to return in this particular case is the one contained into variable new_index instead of ret.
Addresses-Coverity-ID: 1465148 ("Copy-paste error")
--- drivers/block/nbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/nbd.c +1 -1
@@ -1591,7 +1591,7 @@ again:if (new_index <0 ) {mutex_unlock (&nbd_index_mutex);printk (KERN_ERR "nbd: failed to add new device\n" ); -return ret; +return new_index; } nbd =idr_find (&nbd_index_idr, new_index); }
Greg Kroah-Hartman
maintainerPATCH 167/496 ARM: dts: NSP: Fix amount of RAM on BCM958625HR
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <[email protected]>
[ Upstream commit 0a5aff64f20d92c5a6e9aeed7b5950b0b817bcd9 ]
Jon attempted to fix the amount of RAM on the BCM958625HR in commit c53beb47f621 ("ARM: dts: NSP: Correct RAM amount for BCM958625HR board") but it seems like we tripped over some poorly documented schematics.
The top-level page of the schematics says the board has 2GB, but when you end-up scrolling to page 6, you see two chips of 4GBit (512MB) but what the bootloader really initializes only 512MB, any attempt to use more than that results in data aborts. Fix this again back to 512MB.
--- arch/arm/boot/dts/bcm958625hr.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/bcm958625hr.dts +1 -1
@@ -49,7 +49,7 @@ memory { device_type = "memory"; - reg = <0x60000000 0x80000000>; + reg = <0x60000000 0x20000000>; }; gpio-restart {
Greg Kroah-Hartman
maintainerPATCH 168/496 ARM: dts: bcm283x: Fix unit address of local_intc
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Wahren <[email protected]>
[ Upstream commit 808b7de86a0c19582a7efce4c80d6b4e1da7f370 ]
This patch fixes the following DTC warning (requires W=1):
Node /soc/local_intc simple-bus unit address format error, expected "40000000"
--- arch/arm/boot/dts/bcm2836.dtsi | 2 +- arch/arm/boot/dts/bcm2837.dtsi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/bcm2836.dtsi +1 -1
@@ -9,7 +9,7 @@ <0x40000000 0x40000000 0x00001000>; dma-ranges = <0xc0000000 0x00000000 0x3f000000>; - local_intc: local_intc { + local_intc: local_intc@40000000 { compatible = "brcm,bcm2836-l1-intc"; reg = <0x40000000 0x100>; interrupt-controller;
arch/arm/boot/dts/bcm2837.dtsi +1 -1
@@ -8,7 +8,7 @@ <0x40000000 0x40000000 0x00001000>; dma-ranges = <0xc0000000 0x00000000 0x3f000000>; - local_intc: local_intc { + local_intc: local_intc@40000000 { compatible = "brcm,bcm2836-l1-intc"; reg = <0x40000000 0x100>; interrupt-controller;
Greg Kroah-Hartman
maintainerPATCH 169/496 powerpc/boot: Fix random libfdt related build errors
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
[ Upstream commit 64c3f648c25d108f346fdc96c15180c6b7d250e9 ]
Once in a while I see build errors similar to the following when building images from a clean tree.
Building powerpc:virtex-ml507:44x/virtex5_defconfig ... failed
------------
Error log:
arch/powerpc/boot/treeboot-akebono.c:37:20: fatal error:
libfdt.h: No such file or directory
Building powerpc:bamboo:smpdev:44x/bamboo_defconfig ... failed
------------
Error log:
arch/powerpc/boot/treeboot-akebono.c:37:20: fatal error:
libfdt.h: No such file or directory
arch/powerpc/boot/treeboot-currituck.c:35:20: fatal error:
libfdt.h: No such file or directory
Rebuilds will succeed.
Turns out that several source files in arch/powerpc/boot/ include libfdt.h, but Makefile dependencies are incomplete. Let's fix that.
--- arch/powerpc/boot/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/boot/Makefile +2 -1
@@ -101,7 +101,8 @@ $(addprefix $(obj)/,$(zlib-y)): \ libfdt := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c libfdtheader := fdt.h libfdt.h libfdt_internal.h -$(addprefix $(obj)/,$(libfdt) libfdt-wrapper.o simpleboot.o epapr.o opal.o): \ +$(addprefix $(obj)/,$(libfdt) libfdt-wrapper.o simpleboot.o epapr.o opal.o \ + treeboot-akebono.o treeboot-currituck.o treeboot-iss4xx.o): \ $(addprefix $(obj)/,$(libfdtheader)) src-wlib-y := string.S crt0.S stdio.c decompress.c main.c \
Greg Kroah-Hartman
maintainerPATCH 170/496 clocksource/drivers/mips-gic-timer: Use correct shift count to extract data
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit 5753405e27f8fe4c42c1537d3ddbd9e058e54cdc ]
__gic_clocksource_init() extracts the GIC_CONFIG_COUNTBITS field from read_gic_config() by right shifting the register value. The shift count is determined by the most significant bit (__fls) of the bitmask which is wrong as it shifts out the complete bitfield.
Use the least significant bit (__ffs) instead to shift the bitfield down to bit 0.
--- drivers/clocksource/mips-gic-timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clocksource/mips-gic-timer.c +1 -1
@@ -164,7 +164,7 @@ static int __init __gic_clocksource_init/* Set clocksource mask. */ count_width =read_gic_config () &GIC_CONFIG_COUNTBITS ; - count_width >>=__fls (GIC_CONFIG_COUNTBITS ); + count_width >>=__ffs (GIC_CONFIG_COUNTBITS ); count_width *=4 ; count_width +=32 ; gic_clocksource.mask =CLOCKSOURCE_MASK (count_width);
Greg Kroah-Hartman
maintainerPATCH 171/496 gianfar: Fix Rx byte accounting for ndev stats
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Claudiu Manoil <[email protected]>
[ Upstream commit 590399ddf9561f2ed0839311c8ae1be21597ba68 ]
Don't include in the Rx bytecount of the packet sent up the stack:
the FCB (frame control block), and the padding bytes inserted by the controller into the frame payload, nor the FCS. All these are being pulled out of the skb by gfar_process_frame().
This issue is old, likely from the driver's beginnings, however it was amplified by recent:
commit d903ec77118c ("gianfar: simplify FCS handling and fix memory leak") which basically added the FCS to the Rx bytecount, and so brought this to my attention.
--- drivers/net/ethernet/freescale/gianfar.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/net/ethernet/freescale/gianfar.c +3 -4
@@ -3072,9 +3072,6 @@ static void gfar_process_frame(struct neif (ndev->features &NETIF_F_RXCSUM )gfar_rx_checksum (skb, fcb); -/* Tell the skb what kind of packet this is */ - skb->protocol =eth_type_trans (skb, ndev); -/* There's need to check for NETIF_F_HW_VLAN_CTAG_RX here. * Even if vlan rx accel is disabled, on some chips * RXFCB_VLN is pseudo randomly set.
@@ -3145,13 +3142,15 @@ int gfar_clean_rx_ring(struct gfar_priv_continue ; } +gfar_process_frame (ndev, skb); +/* Increment the number of packets */ total_pkts++; total_bytes += skb->len;skb_record_rx_queue (skb, rx_queue->qindex); -gfar_process_frame (ndev, skb); + skb->protocol =eth_type_trans (skb, ndev);/* Send the packet up the stack */ napi_gro_receive (&rx_queue->grp->napi_rx, skb);
Greg Kroah-Hartman
maintainerPATCH 172/496 net/tcp/illinois: replace broken algorithm reference link
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joey Pabalinas <[email protected]>
[ Upstream commit ecc832758a654e375924ebf06a4ac971acb5ce60 ]
The link to the pdf containing the algorithm description is now a dead link; it seems http://www.ifp.illinois.edu/~srikant/ has been moved to https://sites.google.com/a/illinois.edu/srikant/ and none of the original papers can be found there...
I have replaced it with the only working copy I was able to find.
n.b. there is also a copy available at:
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.296.6350&rep=rep1&type=pdf
However, this seems to only be a *cached* version, so I am unsure exactly how reliable that link can be expected to remain over time and have decided against using that one.
net/ipv4/tcp_illinois.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
--- net/ipv4/tcp_illinois.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp_illinois.c +1 -1
@@ -6,7 +6,7 @@* The algorithm is described in: * "TCP-Illinois: A Loss and Delay-Based Congestion Control Algorithm * for High-Speed Networks" -* http://www.ifp.illinois.edu/~srikant/Papers/liubassri06perf.pdf +* http://tamerbasar.csl.illinois.edu/LiuBasarSrikantPerfEvalArtJun2008.pdf * * Implemented from description in paper and ns-2 simulation. * Copyright (C) 2007 Stephen Hemminger <[email protected]>
Greg Kroah-Hartman
maintainerPATCH 173/496 nvmet: fix PSDT field check in command format
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Max Gurtovoy <[email protected]>
[ Upstream commit bffd2b61670feef18d2535e9b53364d270a1c991 ]
PSDT field section according to NVM_Express-1.3:
"This field specifies whether PRPs or SGLs are used for any data transfer associated with the command. PRPs shall be used for all Admin commands for NVMe over PCIe. SGLs shall be used for all Admin and I/O commands for NVMe over Fabrics. This field shall be set to 01b for NVMe over Fabrics 1.0 implementations.
--- drivers/nvme/target/core.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/nvme/target/core.c +6 -3
@@ -505,9 +505,12 @@ bool nvmet_req_init(struct nvmet_req *re goto fail; } -/* either variant of SGLs is fine, as we don't support metadata */ -if (unlikely ((flags &NVME_CMD_SGL_ALL ) !=NVME_CMD_SGL_METABUF && - (flags &NVME_CMD_SGL_ALL ) !=NVME_CMD_SGL_METASEG )) { +/* +* For fabrics, PSDT field shall describe metadata pointer (MPTR) that +* contains an address of a single contiguous physical buffer that is +* byte aligned. +*/ +if (unlikely ((flags &NVME_CMD_SGL_ALL ) !=NVME_CMD_SGL_METABUF )) { status =NVME_SC_INVALID_FIELD |NVME_SC_DNR ; goto fail; }
Greg Kroah-Hartman
maintainerPATCH 174/496 net/smc: use link_id of server in confirm link reply
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karsten Graul <[email protected]>
[ Upstream commit 2be922f31606f114119f48de3207d122a90e7357 ]
The CONFIRM LINK reply message must contain the link_id sent by the server. And set the link_id explicitly when initializing the link.
--- net/smc/smc_core.c | 1 + net/smc/smc_llc.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
net/smc/smc_core.c +1 -0
@@ -174,6 +174,7 @@ static int smc_lgr_create(struct smc_soc lnk = &lgr->lnk[SMC_SINGLE_LINK ];/* initialize link */ + lnk->link_id =SMC_SINGLE_LINK ; lnk->smcibdev = smcibdev; lnk->ibport = ibport; lnk->path_mtu = smcibdev->pattr[ibport -1 ].active_mtu;
net/smc/smc_llc.c +1 -1
@@ -92,7 +92,7 @@ int smc_llc_send_confirm_link(struct smcmemcpy (confllc->sender_mac, mac,ETH_ALEN );memcpy (confllc->sender_gid, gid,SMC_GID_SIZE );hton24 (confllc->sender_qp_num, link->roce_qp->qp_num); -/* confllc->link_num = SMC_SINGLE_LINK; already done by memset above */ + confllc->link_num = link->link_id;memcpy (confllc->link_uid, lgr->id,SMC_LGR_ID_SIZE ); confllc->max_links =SMC_LINKS_PER_LGR_MAX ;/* send llc message */
Greg Kroah-Hartman
maintainerPATCH 175/496 mlxsw: core: Fix flex keys scratchpad offset conflict
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Pirko <[email protected]>
[ Upstream commit 2ddc94c76cc4ccaf51b478315912b38dfdde1afc ]
IP_TTL, IP_ECN and IP_DSCP are using the same offset within the scratchpad as L4 ports. Fix this by shifting all up.
--- drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_keys.h | 20 +++++++-------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/core_acl_flex_keys.h +10 -10
@@ -107,20 +107,20 @@ static const struct mlxsw_afk_element_inMLXSW_AFK_ELEMENT_INFO_U32 (VID ,0x10 ,8 ,12 ),MLXSW_AFK_ELEMENT_INFO_U32 (PCP ,0x10 ,20 ,3 ),MLXSW_AFK_ELEMENT_INFO_U32 (TCP_FLAGS ,0x10 ,23 ,9 ), -MLXSW_AFK_ELEMENT_INFO_U32 (IP_TTL_ ,0x14 ,0 ,8 ), -MLXSW_AFK_ELEMENT_INFO_U32 (IP_ECN ,0x14 ,9 ,2 ), -MLXSW_AFK_ELEMENT_INFO_U32 (IP_DSCP ,0x14 ,11 ,6 ), -MLXSW_AFK_ELEMENT_INFO_U32 (SRC_IP4 ,0x18 ,0 ,32 ), -MLXSW_AFK_ELEMENT_INFO_U32 (DST_IP4 ,0x1C ,0 ,32 ), -MLXSW_AFK_ELEMENT_INFO_BUF (SRC_IP6_HI ,0x18 ,8 ), -MLXSW_AFK_ELEMENT_INFO_BUF (SRC_IP6_LO ,0x20 ,8 ), -MLXSW_AFK_ELEMENT_INFO_BUF (DST_IP6_HI ,0x28 ,8 ), -MLXSW_AFK_ELEMENT_INFO_BUF (DST_IP6_LO ,0x30 ,8 ),MLXSW_AFK_ELEMENT_INFO_U32 (DST_L4_PORT ,0x14 ,0 ,16 ),MLXSW_AFK_ELEMENT_INFO_U32 (SRC_L4_PORT ,0x14 ,16 ,16 ), +MLXSW_AFK_ELEMENT_INFO_U32 (IP_TTL_ ,0x18 ,0 ,8 ), +MLXSW_AFK_ELEMENT_INFO_U32 (IP_ECN ,0x18 ,9 ,2 ), +MLXSW_AFK_ELEMENT_INFO_U32 (IP_DSCP ,0x18 ,11 ,6 ), +MLXSW_AFK_ELEMENT_INFO_U32 (SRC_IP4 ,0x20 ,0 ,32 ), +MLXSW_AFK_ELEMENT_INFO_U32 (DST_IP4 ,0x24 ,0 ,32 ), +MLXSW_AFK_ELEMENT_INFO_BUF (SRC_IP6_HI ,0x20 ,8 ), +MLXSW_AFK_ELEMENT_INFO_BUF (SRC_IP6_LO ,0x28 ,8 ), +MLXSW_AFK_ELEMENT_INFO_BUF (DST_IP6_HI ,0x30 ,8 ), + MLXSW_AFK_ELEMENT_INFO_BUF(DST_IP6_LO, 0x38, 8), }; -#define MLXSW_AFK_ELEMENT_STORAGE_SIZE 0x38 +#define MLXSW_AFK_ELEMENT_STORAGE_SIZE 0x40 struct mlxsw_afk_element_inst { /* element instance in actual block */ const struct mlxsw_afk_element_info *info;
Greg Kroah-Hartman
maintainerPATCH 176/496 mlxsw: spectrum: Treat IPv6 unregistered multicast as broadcast
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ido Schimmel <[email protected]>
[ Upstream commit 9d45deb04c59b628b21fc5014aff4f9a1d38f969 ]
When multicast snooping is enabled, the Linux bridge resorts to flooding unregistered multicast packets to all ports only in case it did not detect a querier in the network.
The above condition is not reflected to underlying drivers, which is especially problematic in IPv6 environments, as multicast snooping is enabled by default and since neighbour solicitation packets might be treated as unregistered multicast packets in case there is no corresponding MDB entry.
Until the Linux bridge reflects its querier state to underlying drivers, simply treat unregistered multicast packets as broadcast and allow them to reach their destination.
--- drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_fid.c +1 -1
@@ -112,11 +112,11 @@ static const int mlxsw_sp_sfgc_bc_packet [MLXSW_REG_SFGC_TYPE_UNREGISTERED_MULTICAST_NON_IP] = 1, [MLXSW_REG_SFGC_TYPE_IPV4_LINK_LOCAL] = 1, [MLXSW_REG_SFGC_TYPE_IPV6_ALL_HOST] = 1, + [MLXSW_REG_SFGC_TYPE_UNREGISTERED_MULTICAST_IPV6] = 1, };static const int mlxsw_sp_sfgc_mc_packet_types[MLXSW_REG_SFGC_TYPE_MAX ] = { [MLXSW_REG_SFGC_TYPE_UNREGISTERED_MULTICAST_IPV4 ] =1 , - [MLXSW_REG_SFGC_TYPE_UNREGISTERED_MULTICAST_IPV6 ] =1 , };static const int *mlxsw_sp_packet_type_sfgc_types[] = {
Greg Kroah-Hartman
maintainerPATCH 177/496 spectrum: Reference count VLAN entries
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ido Schimmel <[email protected]>
[ Upstream commit b3529af6bb0d4fe72defdd539712ceffaa054fb3 ]
One of the basic construct in the device is a port-VLAN pair, which can be bound to a FID or a RIF in order to direct packets to the bridge or the router, respectively.
Since not all the netdevs are configured with a VLAN (e.g., sw1p1 vs. sw1p1.10), VID 1 is used to represent these and thus this VID can be used by both upper devices of mlxsw ports and by the driver itself.
However, this VID is not reference counted and therefore might be freed prematurely, which can result in various WARNINGs. For example:
$ ip link add name br0 type bridge vlan_filtering 1
$ teamd -t team0 -d -c '{"runner": {"name": "lacp"}}'
$ ip link set dev team0 master br0
$ ip link set dev enp1s0np1 master team0
$ ip address add 192.0.2.1/24 dev enp1s0np1The enslavement to team0 will fail because team0 already has an upper and thus vlan_vids_del_by_dev() will be executed as part of team's error path which will delete VID 1 from enp1s0np1 (added by br0 as PVID). The WARNING will be generated when the driver will realize it can't find VID 1 on the port and bind it to a RIF.
Fix this by adding a reference count to the VLAN entries on the port, in a similar fashion to the reference counting used by the corresponding 'vlan_vid_info' structure in the 8021q driver.
--- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 8 +++++++- drivers/net/ethernet/mellanox/mlxsw/spectrum.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum.c +7 -1
@@ -1417,6 +1417,7 @@ mlxsw_sp_port_vlan_create(struct mlxsw_s } mlxsw_sp_port_vlan->mlxsw_sp_port = mlxsw_sp_port; + mlxsw_sp_port_vlan->ref_count =1 ; mlxsw_sp_port_vlan->vid = vid;list_add (&mlxsw_sp_port_vlan->list, &mlxsw_sp_port->vlans_list);
@@ -1444,8 +1445,10 @@ mlxsw_sp_port_vlan_get(struct mlxsw_sp_pstruct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan; mlxsw_sp_port_vlan =mlxsw_sp_port_vlan_find_by_vid (mlxsw_sp_port, vid); -if (mlxsw_sp_port_vlan) +if (mlxsw_sp_port_vlan) { + mlxsw_sp_port_vlan->ref_count++;return mlxsw_sp_port_vlan; + }return mlxsw_sp_port_vlan_create (mlxsw_sp_port, vid); }
@@ -1454,6 +1457,9 @@ void mlxsw_sp_port_vlan_put(struct mlxsw {struct mlxsw_sp_fid *fid = mlxsw_sp_port_vlan->fid; +if (--mlxsw_sp_port_vlan->ref_count !=0 ) +return ; +if (mlxsw_sp_port_vlan->bridge_port)mlxsw_sp_port_vlan_bridge_leave (mlxsw_sp_port_vlan);else if (fid)
drivers/net/ethernet/mellanox/mlxsw/spectrum.h +1 -0
@@ -194,6 +194,7 @@ struct mlxsw_sp_port_vlan {struct list_head list;struct mlxsw_sp_port *mlxsw_sp_port;struct mlxsw_sp_fid *fid; +unsigned int ref_count;u16 vid;struct mlxsw_sp_bridge_port *bridge_port;struct list_head bridge_vlan_node;
Greg Kroah-Hartman
maintainerPATCH 178/496 ARC: mcip: halt GFRC counter when ARC cores halt
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eugeniy Paltsev <[email protected]>
[ Upstream commit 07423d00a2b2a71a97e4287d9262cb83c4c4c89f ]
In SMP systems, GFRC is used for clocksource. However by default the counter keeps running even when core is halted (say when debugging via a JTAG debugger). This confuses Linux timekeeping and triggers flase RCU stall splat such as below:
| [ARCLinux]# while true; do ./shm_open_23-1.run-test ; done | Running with 1000 processes for 1000 objects | hrtimer: interrupt took 485060 ns | | create_cnt: 1000 | Running with 1000 processes for 1000 objects | [ARCLinux]# INFO: rcu_preempt self-detected stall on CPU | 2-...: (1 GPs behind) idle=a01/1/0 softirq=135770/135773 fqs=0 | INFO: rcu_preempt detected stalls on CPUs/tasks: | 0-...: (1 GPs behind) idle=71e/0/0 softirq=135264/135264 fqs=0 | 2-...: (1 GPs behind) idle=a01/1/0 softirq=135770/135773 fqs=0 | 3-...: (1 GPs behind) idle=4e0/0/0 softirq=134304/134304 fqs=0 | (detected by 1, t=13648 jiffies, g=31493, c=31492, q=1)
Starting from ARC HS v3.0 it's possible to tie GFRC to state of up-to 4 ARC cores with help of GFRC's CORE register where we set a mask for cores which state we need to rely on.
We update cpu mask every time new cpu came online instead of using hardcoded one or using mask generated from "possible_cpus" as we want it set correctly even if we run kernel on HW which has fewer cores than expected (or we launch kernel via debugger and kick fever cores than HW has)
Note that GFRC halts when all cores have halted and thus relies on programming of Inter-Core-dEbug register to halt all cores when one halts.
--- arch/arc/kernel/mcip.c | 37 +++++++++++++++++++++++++++++++++++++ include/soc/arc/mcip.h | 3 +++ 2 files changed, 40 insertions(+)
arch/arc/kernel/mcip.c +37 -0
@@ -22,10 +22,47 @@ static DEFINE_RAW_SPINLOCK(mcip_lock);static char smp_cpuinfo_buf[128 ]; +/* +* Set mask to halt GFRC if any online core in SMP cluster is halted. +* Only works for ARC HS v3.0+, on earlier versions has no effect. +*/ +static void mcip_update_gfrc_halt_mask (int cpu) +{ +struct bcr_generic gfrc; +unsigned long flags; +u32 gfrc_halt_mask; + +READ_BCR (ARC_REG_GFRC_BUILD , gfrc); + +/* +* CMD_GFRC_SET_CORE and CMD_GFRC_READ_CORE commands were added in +* GFRC 0x3 version. +*/ +if (gfrc.ver <0x3 ) +return ; + +raw_spin_lock_irqsave (&mcip_lock, flags); + +__mcip_cmd (CMD_GFRC_READ_CORE ,0 ); + gfrc_halt_mask =read_aux_reg (ARC_REG_MCIP_READBACK ); + gfrc_halt_mask |=BIT (cpu); +__mcip_cmd_data (CMD_GFRC_SET_CORE ,0 , gfrc_halt_mask); + +raw_spin_unlock_irqrestore (&mcip_lock, flags); +} +static void mcip_setup_per_cpu (int cpu) { +struct mcip_bcr mp; + +READ_BCR (ARC_REG_MCIP_BCR , mp); +smp_ipi_irq_setup (cpu,IPI_IRQ );smp_ipi_irq_setup (cpu,SOFTIRQ_IRQ ); + +/* Update GFRC halt mask as new CPU came online */ +if (mp.gfrc) +mcip_update_gfrc_halt_mask (cpu); }static void mcip_ipi_send (int cpu)
include/soc/arc/mcip.h +3 -0
@@ -15,6 +15,7 @@#define ARC_REG_MCIP_BCR 0x0d0#define ARC_REG_MCIP_IDU_BCR 0x0D5 +#define ARC_REG_GFRC_BUILD 0x0D6#define ARC_REG_MCIP_CMD 0x600#define ARC_REG_MCIP_WDATA 0x601#define ARC_REG_MCIP_READBACK 0x602
@@ -40,6 +41,8 @@ struct mcip_cmd {#define CMD_GFRC_READ_LO 0x42#define CMD_GFRC_READ_HI 0x43 +#define CMD_GFRC_SET_CORE 0x47 +#define CMD_GFRC_READ_CORE 0x48#define CMD_IDU_ENABLE 0x71#define CMD_IDU_DISABLE 0x72
Greg Kroah-Hartman
maintainerPATCH 179/496 ARC: mcip: update MCIP debug mask when the new cpu came online
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eugeniy Paltsev <[email protected]>
[ Upstream commit f3205de98db2fc8083796dd5ad81b191e436fab8 ]
As of today we use hardcoded MCIP debug mask, so if we launch kernel via debugger and kick fever cores than HW has all cpus hang at the momemt of setup MCIP debug mask.
So update MCIP debug mask when the new cpu came online, instead of use hardcoded MCIP debug mask.
--- arch/arc/kernel/mcip.c | 37 ++++++++++++++++++++++++++++++++----- include/soc/arc/mcip.h | 2 ++ 2 files changed, 34 insertions(+), 5 deletions(-)
arch/arc/kernel/mcip.c +32 -5
@@ -51,6 +51,34 @@ static void mcip_update_gfrc_halt_mask(iraw_spin_unlock_irqrestore (&mcip_lock, flags); } +static void mcip_update_debug_halt_mask (int cpu) +{ +u32 mcip_mask =0 ; +unsigned long flags; + +raw_spin_lock_irqsave (&mcip_lock, flags); + +/* +* mcip_mask is same for CMD_DEBUG_SET_SELECT and CMD_DEBUG_SET_MASK +* commands. So read it once instead of reading both CMD_DEBUG_READ_MASK +* and CMD_DEBUG_READ_SELECT. +*/ +__mcip_cmd (CMD_DEBUG_READ_SELECT ,0 ); + mcip_mask =read_aux_reg (ARC_REG_MCIP_READBACK ); + + mcip_mask |=BIT (cpu); + +__mcip_cmd_data (CMD_DEBUG_SET_SELECT ,0 , mcip_mask); +/* +* Parameter specified halt cause: +* STATUS32[H]/actionpoint/breakpoint/self-halt +* We choose all of them (0xF). +*/ +__mcip_cmd_data (CMD_DEBUG_SET_MASK ,0xF , mcip_mask); + +raw_spin_unlock_irqrestore (&mcip_lock, flags); +} +static void mcip_setup_per_cpu (int cpu) {struct mcip_bcr mp;
@@ -63,6 +91,10 @@ static void mcip_setup_per_cpu(int cpu)/* Update GFRC halt mask as new CPU came online */ if (mp.gfrc)mcip_update_gfrc_halt_mask (cpu); + +/* Update MCIP debug mask as new CPU came online */ +if (mp.dbg) +mcip_update_debug_halt_mask (cpu); }static void mcip_ipi_send (int cpu)
@@ -138,11 +170,6 @@ static void mcip_probe_n_setup(void) IS_AVAIL1(mp.gfrc, "GFRC")); cpuinfo_arc700[0 ].extn.gfrc = mp.gfrc; - -if (mp.dbg) { -__mcip_cmd_data (CMD_DEBUG_SET_SELECT ,0 ,0xf ); -__mcip_cmd_data (CMD_DEBUG_SET_MASK ,0xf ,0xf ); - } }struct plat_smp_ops plat_smp_ops = {
include/soc/arc/mcip.h +2 -0
@@ -37,7 +37,9 @@ struct mcip_cmd {#define CMD_SEMA_RELEASE 0x12#define CMD_DEBUG_SET_MASK 0x34 +#define CMD_DEBUG_READ_MASK 0x35#define CMD_DEBUG_SET_SELECT 0x36 +#define CMD_DEBUG_READ_SELECT 0x37#define CMD_GFRC_READ_LO 0x42#define CMD_GFRC_READ_HI 0x43
Greg Kroah-Hartman
maintainerPATCH 180/496 ARC: setup cpu possible mask according to possible-cpus dts property
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eugeniy Paltsev <[email protected]>
[ Upstream commit a29a25275452c97fe35815f1eb9564f2a07a1965 ]
As we have option in u-boot to set CPU mask for running linux, we want to pass information to kernel about CPU cores should be brought up. So we patch kernel dtb in u-boot to set possible-cpus property.
This also allows us to have correctly setuped MCIP debug mask.
--- arch/arc/kernel/smp.c | 50 ++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 10 deletions(-)
arch/arc/kernel/smp.c +40 -10
@@ -24,6 +24,7 @@#include <linux/reboot.h> #include <linux/irqdomain.h> #include <linux/export.h> +#include <linux/of_fdt.h> #include <asm/processor.h> #include <asm/setup.h>
@@ -47,6 +48,42 @@ void __init smp_prepare_boot_cpu(void) { } +static int __init arc_get_cpu_map (const char *name,struct cpumask *cpumask) +{ +unsigned long dt_root =of_get_flat_dt_root (); +const char *buf; + + buf =of_get_flat_dt_prop (dt_root, name,NULL ); +if (!buf) +return -EINVAL ; + +if (cpulist_parse (buf, cpumask)) +return -EINVAL ; + +return 0 ; +} + +/* +* Read from DeviceTree and setup cpu possible mask. If there is no +* "possible-cpus" property in DeviceTree pretend all [0..NR_CPUS-1] exist. +*/ +static void __init arc_init_cpu_possible (void ) +{ +struct cpumask cpumask; + +if (arc_get_cpu_map ("possible-cpus" , &cpumask)) { +pr_warn ("Failed to get possible-cpus from dtb, pretending all %u cpus exist\n" , +NR_CPUS ); + +cpumask_setall (&cpumask); + } + +if (!cpumask_test_cpu (0 , &cpumask)) +panic ("Master cpu (cpu[0]) is missed in cpu possible mask!" ); + +init_cpu_possible (&cpumask); +} +/* * Called from setup_arch() before calling setup_processor() *
@@ -58,10 +95,7 @@ void __init smp_prepare_boot_cpu(void)*/ void __init smp_init_cpus (void ) { -unsigned int i; - -for (i =0 ; i <NR_CPUS ; i++) -set_cpu_possible (i, true); +arc_init_cpu_possible ();if (plat_smp_ops.init_early_smp) plat_smp_ops.init_early_smp ();
@@ -70,16 +104,12 @@ void __init smp_init_cpus(void)/* called from init ( ) => process 1 */ void __init smp_prepare_cpus (unsigned int max_cpus) { -int i; -/* * if platform didn't set the present map already, do it now * boot cpu is set to present already by init/main.c */ -if (num_present_cpus () <=1 ) { -for (i =0 ; i < max_cpus; i++) -set_cpu_present (i, true); - } +if (num_present_cpus () <=1 ) +init_cpu_present (cpu_possible_mask); }void __init smp_cpus_done (unsigned int max_cpus)
Greg Kroah-Hartman
maintainerPATCH 181/496 ipvs: remove IPS_NAT_MASK check to fix passive FTP
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Julian Anastasov <[email protected]>
[ Upstream commit 8a949fff0302b50063f74bb345a66190015528d0 ]
The IPS_NAT_MASK check in 4.12 replaced previous check for nfct_nat() which was needed to fix a crash in 2.6.36-rc, see
commit 7bcbf81a2296 ("ipvs: avoid oops for passive FTP"). But as IPVS does not set the IPS_SRC_NAT and IPS_DST_NAT bits, checking for IPS_NAT_MASK prevents PASV response to be properly mangled and blocks the transfer. Remove the check as it is not needed after 3.12 commit 41d73ec053d2 ("netfilter: nf_conntrack:
make sequence number adjustments usuable without NAT") which changes nfct_nat() with nfct_seqadj() and especially after 3.13 commit b25adce16064 ("ipvs: correct usage/allocation of seqadj ext in ipvs").
Thanks to Li Shuang and Florian Westphal for reporting the problem!
--- net/netfilter/ipvs/ip_vs_ftp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/ipvs/ip_vs_ftp.c +1 -1
@@ -260,7 +260,7 @@ static int ip_vs_ftp_out(struct ip_vs_ap buf_len =strlen (buf); ct =nf_ct_get (skb, &ctinfo); -if (ct && (ct->status &IPS_NAT_MASK )) { +if (ct) {bool mangled;/* If mangling fails this function will return 0
Greg Kroah-Hartman
maintainerPATCH 182/496 IB/mlx: Set slid to zero in Ethernet completion struct
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Moni Shoua <[email protected]>
[ Upstream commit 65389322b28f81cc137b60a41044c2d958a7b950 ]
IB spec says that a lid should be ignored when link layer is Ethernet, for example when building or parsing a CM request message (CA17-34). However, since ib_lid_be16() and ib_lid_cpu16() validates the slid, not only when link layer is IB, we set the slid to zero to prevent false warnings in the kernel log.
--- drivers/infiniband/hw/mlx4/cq.c | 4 +++- drivers/infiniband/hw/mlx5/cq.c | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/infiniband/hw/mlx4/cq.c +3 -1
@@ -597,6 +597,7 @@ static void use_tunnel_data(struct mlx4_ wc->dlid_path_bits =0 ;if (is_eth) { + wc->slid =0 ; wc->vlan_id =be16_to_cpu (hdr->tun.sl_vid);memcpy (&(wc->smac[0 ]), (char *)&hdr->tun.mac_31_0,4 );memcpy (&(wc->smac[4 ]), (char *)&hdr->tun.slid_mac_47_32,2 );
@@ -845,7 +846,6 @@ repoll: } } - wc->slid =be16_to_cpu (cqe->rlid); g_mlpath_rqpn =be32_to_cpu (cqe->g_mlpath_rqpn); wc->src_qp = g_mlpath_rqpn &0xffffff ; wc->dlid_path_bits = (g_mlpath_rqpn >>24 ) &0x7f ;
@@ -854,6 +854,7 @@ repoll: wc->wc_flags |=mlx4_ib_ipoib_csum_ok (cqe->status, cqe->checksum) ?IB_WC_IP_CSUM_OK :0 ;if (is_eth) { + wc->slid =0 ; wc->sl =be16_to_cpu (cqe->sl_vid) >>13 ;if (be32_to_cpu (cqe->vlan_my_qpn) &MLX4_CQE_CVLAN_PRESENT_MASK ) {
@@ -865,6 +866,7 @@ repoll:memcpy (wc->smac, cqe->smac,ETH_ALEN ); wc->wc_flags |= (IB_WC_WITH_VLAN |IB_WC_WITH_SMAC ); }else { + wc->slid =be16_to_cpu (cqe->rlid); wc->sl =be16_to_cpu (cqe->sl_vid) >>12 ; wc->vlan_id =0xffff ; }
drivers/infiniband/hw/mlx5/cq.c +2 -1
@@ -224,7 +224,6 @@ static void handle_responder(struct ib_w wc->ex.invalidate_rkey =be32_to_cpu (cqe->imm_inval_pkey);break ; } - wc->slid =be16_to_cpu (cqe->slid); wc->src_qp =be32_to_cpu (cqe->flags_rqpn) &0xffffff ; wc->dlid_path_bits = cqe->ml_path; g = (be32_to_cpu (cqe->flags_rqpn) >>28 ) &3 ;
@@ -239,10 +238,12 @@ static void handle_responder(struct ib_w }if (ll !=IB_LINK_LAYER_ETHERNET ) { + wc->slid =be16_to_cpu (cqe->slid); wc->sl = (be32_to_cpu (cqe->flags_rqpn) >>24 ) &0xf ;return ; } + wc->slid =0 ; vlan_present = cqe->l4_l3_hdr_type &0x1 ; roce_packet_type = (be32_to_cpu (cqe->flags_rqpn) >>24 ) &0x3 ;if (vlan_present) {
Greg Kroah-Hartman
maintainerPATCH 183/496 RDMA/bnxt_re: Unconditionly fence non wire memory operations
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Devesh Sharma <[email protected]>
[ Upstream commit a45bc17b360d75fac9ced85e99fda14bf38b4dc3 ]
HW requires an unconditonal fence for all non-wire memory operations through SQ. This guarantees the completions of these memory operations.
--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +11 -4
@@ -1963,10 +1963,13 @@ static int bnxt_re_build_inv_wqe(struct wqe->type =BNXT_QPLIB_SWQE_TYPE_LOCAL_INV ; wqe->local_inv.inv_l_key = wr->ex.invalidate_rkey; +/* Need unconditional fence for local invalidate +* opcode to work as expected. +*/ + wqe->flags |=BNXT_QPLIB_SWQE_FLAGS_UC_FENCE ; +if (wr->send_flags &IB_SEND_SIGNALED ) wqe->flags |=BNXT_QPLIB_SWQE_FLAGS_SIGNAL_COMP ; -if (wr->send_flags &IB_SEND_FENCE ) - wqe->flags |=BNXT_QPLIB_SWQE_FLAGS_UC_FENCE ;if (wr->send_flags &IB_SEND_SOLICITED ) wqe->flags |=BNXT_QPLIB_SWQE_FLAGS_SOLICIT_EVENT ;
@@ -1987,8 +1990,12 @@ static int bnxt_re_build_reg_wqe(struct wqe->frmr.levels = qplib_frpl->hwq.level +1 ; wqe->type =BNXT_QPLIB_SWQE_TYPE_REG_MR ; -if (wr->wr.send_flags &IB_SEND_FENCE ) - wqe->flags |=BNXT_QPLIB_SWQE_FLAGS_UC_FENCE ; +/* Need unconditional fence for reg_mr +* opcode to function as expected. +*/ + + wqe->flags |=BNXT_QPLIB_SWQE_FLAGS_UC_FENCE ; +if (wr->wr.send_flags &IB_SEND_SIGNALED ) wqe->flags |=BNXT_QPLIB_SWQE_FLAGS_SIGNAL_COMP ;
Greg Kroah-Hartman
maintainerPATCH 184/496 RDMA/bnxt_re: Fix incorrect DB offset calculation
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Devesh Sharma <[email protected]>
[ Upstream commit c354dff00db8df80f271418d8392065e10ffffb6 ]
To support host systems with non 4K page size, l2_db_size shall be calculated with 4096 instead of PAGE_SIZE. Also, supply the host page size to FW during initialization.
--- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 6 +++++- drivers/infiniband/hw/bnxt_re/qplib_rcfw.h | 1 + drivers/infiniband/hw/bnxt_re/qplib_sp.c | 3 ++- drivers/infiniband/hw/bnxt_re/roce_hsi.h | 25 ++++++++++++++++++++++++- 4 files changed, 32 insertions(+), 3 deletions(-)
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +5 -1
@@ -457,7 +457,11 @@ int bnxt_qplib_init_rcfw(struct bnxt_qplint rc;RCFW_CMD_PREP (req,INITIALIZE_FW , cmd_flags); - +/* Supply (log-base-2-of-host-page-size - base-page-shift) +* to bono to adjust the doorbell page sizes. +*/ + req.log2_dbr_pg_size =cpu_to_le16 (PAGE_SHIFT - +RCFW_DBR_BASE_PAGE_SHIFT );/* * VFs need not setup the HW context area, PF * shall setup this area for VF. Skipping the
drivers/infiniband/hw/bnxt_re/qplib_rcfw.h +1 -0
@@ -49,6 +49,7 @@#define RCFW_COMM_SIZE 0x104#define RCFW_DBR_PCI_BAR_REGION 2 +#define RCFW_DBR_BASE_PAGE_SHIFT 12#define RCFW_CMD_PREP (req,CMD , cmd_flags) \ do { \
drivers/infiniband/hw/bnxt_re/qplib_sp.c +2 -1
@@ -130,7 +130,8 @@ int bnxt_qplib_get_dev_attr(struct bnxt_ attr->max_pkey =le32_to_cpu (sb->max_pkeys); attr->max_inline_data =le32_to_cpu (sb->max_inline_data); - attr->l2_db_size = (sb->l2_db_space_size +1 ) *PAGE_SIZE ; + attr->l2_db_size = (sb->l2_db_space_size +1 ) * + (0x01 <<RCFW_DBR_BASE_PAGE_SHIFT ); attr->max_sgid =le32_to_cpu (sb->max_gid);strlcpy (attr->fw_ver,"20.6.28.0" ,sizeof (attr->fw_ver));
drivers/infiniband/hw/bnxt_re/roce_hsi.h +24 -1
@@ -1734,7 +1734,30 @@ struct cmdq_initialize_fw {#define CMDQ_INITIALIZE_FW_TIM_PG_SIZE_PG_2M (0x3UL << 4)#define CMDQ_INITIALIZE_FW_TIM_PG_SIZE_PG_8M (0x4UL << 4)#define CMDQ_INITIALIZE_FW_TIM_PG_SIZE_PG_1G (0x5UL << 4) -__le16 reserved16; +/* This value is (log-base-2-of-DBR-page-size - 12). +* 0 for 4KB. HW supported values are enumerated below. +*/ +__le16 log2_dbr_pg_size; +#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_MASK 0xfUL +#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_SFT 0 +#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_4K 0x0UL +#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_8K 0x1UL +#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_16K 0x2UL +#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_32K 0x3UL +#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_64K 0x4UL +#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_128K 0x5UL +#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_256K 0x6UL +#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_512K 0x7UL +#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_1M 0x8UL +#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_2M 0x9UL +#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_4M 0xaUL +#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_8M 0xbUL +#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_16M 0xcUL +#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_32M 0xdUL +#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_64M 0xeUL +#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_128M 0xfUL +#define CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_LAST \ + CMDQ_INITIALIZE_FW_LOG2_DBR_PG_SIZE_PG_128M__le64 qpc_page_dir;__le64 mrw_page_dir;__le64 srq_page_dir;
Greg Kroah-Hartman
maintainerPATCH 185/496 RDMA/bnxt_re: Fix the ib_reg failure cleanup
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Selvin Xavier <[email protected]>
[ Upstream commit 497158aa5f520db50452ef928c0f955cb42f2e77 ]
Release the netdev references in the cleanup path. Invokes the cleanup routines if bnxt_re_ib_reg fails.
--- drivers/infiniband/hw/bnxt_re/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/infiniband/hw/bnxt_re/main.c +4 -1
@@ -1240,9 +1240,12 @@ static void bnxt_re_task(struct work_strswitch (re_work->event) {case NETDEV_REGISTER : rc =bnxt_re_ib_reg (rdev); -if (rc) +if (rc) {dev_err (rdev_to_dev (rdev),"Failed to register with IB: %#x" , rc); +bnxt_re_remove_one (rdev); +bnxt_re_dev_unreg (rdev); + }break ;case NETDEV_UP : bnxt_re_dispatch_event(&rdev->ibdev, NULL, 1,
Greg Kroah-Hartman
maintainerPATCH 187/496 drm/amd/amdgpu: Correct VRAM width for APUs with GMC9
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tom St Denis <[email protected]>
[ Upstream commit 585b7f161c85bd5ca675b97580faf21c506541e3 ]
DDR4 has a 64-bit width not 128-bits. It was reporting twice the width. Tested with my Ryzen 2400G.
--- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +4 -1
@@ -456,7 +456,10 @@ static int gmc_v9_0_mc_init(struct amdgp adev->mc.vram_width =amdgpu_atomfirmware_get_vram_width (adev);if (!adev->mc.vram_width) {/* hbm memory channel size */ - chansize =128 ; +if (adev->flags &AMD_IS_APU ) + chansize =64 ; +else + chansize =128 ; tmp =RREG32_SOC15 (DF ,0 , mmDF_CS_AON0_DramBaseAddress0); tmp &= DF_CS_AON0_DramBaseAddress0__IntLvNumChan_MASK;
Greg Kroah-Hartman
maintainerPATCH 188/496 xfrm: Fix ESN sequence number handling for IPsec GSO packets.
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steffen Klassert <[email protected]>
[ Upstream commit b8b549eec8187ac1b12075d69a2d84d89b5e811a ]
When IPsec offloading was introduced, we accidentally incremented the sequence number counter on the xfrm_state by one packet too much in the ESN case. This leads to a sequence number gap of one packet after each GSO packet. Fix this by setting the sequence number to the correct value.
--- net/xfrm/xfrm_replay.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/xfrm/xfrm_replay.c +1 -1
@@ -658,7 +658,7 @@ static int xfrm_replay_overflow_offload_ }else {XFRM_SKB_CB (skb)->seq.output.low = oseq +1 ;XFRM_SKB_CB (skb)->seq.output.hi = oseq_hi; - xo->seq.low = oseq = oseq +1 ; + xo->seq.low = oseq +1 ; xo->seq.hi = oseq_hi; oseq +=skb_shinfo (skb)->gso_segs; }
Greg Kroah-Hartman
maintainerPATCH 189/496 arm64: dts: rockchip: Fix rk3399-gru-* s2r (pinctrl hogs, wifi reset)
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Anderson <[email protected]>
[ Upstream commit 2560da49de5d0cfec22e9564023aebfffa094732 ]
Back in the early days when gru devices were still under development we found an issue where the WiFi reset line needed to be configured as early as possible during the boot process to avoid the WiFi module being in a bad state.
We found that the way to get the kernel to do this in the earliest possible place was to configure this line in the pinctrl hogs, so that's what we did. For some history here you can see
<http://crosreview.com/368770>. After the time that change landed in the kernel, we landed a firmware change to configure this line even earlier. See <http://crosreview.com/399919>. However, even after the firmware change landed we kept the kernel change to deal with the fact that some people working on devices might take a little while to update their firmware.
At this there are definitely zero devices out in the wild that have firmware without the fix in it. Specifically looking in the firmware branch several critically important fixes for memory stability landed after the patch in coreboot and I know we didn't ship without those. Thus, by now, everyone should have the new firmware and it's safe to not have the kernel set this up in a pinctrl hog.
Historically, even though it wasn't needed to have this in a pinctrl hog, we still kept it since it didn't hurt. Pinctrl would apply the default hog at bootup and then would never touch things again. That all changed with commit 981ed1bfbc6c ("pinctrl: Really force states during suspend/resume"). After that commit then we'll re-apply the default hog at resume time and that can screw up the reset state of WiFi. ...and on rk3399 if you touch a device on PCIe in the wrong way then the whole system can go haywire. That's what was happening. Specifically you'd resume a rk3399-gru-* device and it would mostly resume, then would crash with some crazy weird crash.
One could say, perhaps, that the recent pinctrl change was at fault (and should be fixed) since it changed behavior. ...but that's not really true. The device tree for rk3399-gru is really to blame. Specifically since the pinctrl is defined in the hog and not in the "wlan-pd-n" node then the actual user of this pin doesn't have a pinctrl entry for it. That's bad.
Let's fix our problems by just moving the control of "wlan_module_reset_l pinctrl" out of the hog and put them in the proper place.
NOTE: in theory, I think it should actually be possible to have a pin controlled _both_ by the hog and by an actual device. Once the device claims the pin I think the hog is supposed to let go. I'm not 100% sure that this works and in any case this solution would be more complex than is necessary.
--- arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-)
arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi +3 -13
@@ -406,8 +406,9 @@ wlan_pd_n: wlan-pd-n { compatible = "regulator-fixed"; regulator-name = "wlan_pd_n"; + pinctrl-names = "default"; + pinctrl-0 = <&wlan_module_reset_l>; - /* Note the wlan_module_reset_l pinctrl */ enable-active-high; gpio = <&gpio1 11 GPIO_ACTIVE_HIGH>;
@@ -940,12 +941,6 @@ ap_i2c_audio: &i2c8 { pinctrl-0 = < &ap_pwroff /* AP will auto-assert this when in S3 */ &clk_32k /* This pin is always 32k on gru boards */ - - /* - * We want this driven low ASAP; firmware should help us, but - * we can help ourselves too. - */ - &wlan_module_reset_l >; pcfg_output_low: pcfg-output-low {
@@ -1125,12 +1120,7 @@ ap_i2c_audio: &i2c8 { }; wlan_module_reset_l: wlan-module-reset-l { - /* - * We want this driven low ASAP (As {Soon,Strongly} As - * Possible), to avoid leakage through the powered-down - * WiFi. - */ - rockchip,pins = <1 11 RK_FUNC_GPIO &pcfg_output_low>; + rockchip,pins = <1 11 RK_FUNC_GPIO &pcfg_pull_none>; }; bt_host_wake_l: bt-host-wake-l {
Greg Kroah-Hartman
maintainerPATCH 190/496 drm/sun4i: Fix dclk_set_phase
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Giulio Benetti <[email protected]>
[ Upstream commit e64b6afa98f3629d0c0c46233bbdbe8acdb56f06 ]
Phase value is not shifted before writing.
Shift left of 28 bits to fit right bits
--- drivers/gpu/drm/sun4i/sun4i_dotclock.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/sun4i/sun4i_dotclock.c +4 -1
@@ -129,10 +129,13 @@ static int sun4i_dclk_get_phase(struct cstatic int sun4i_dclk_set_phase (struct clk_hw *hw,int degrees) {struct sun4i_dclk *dclk =hw_to_dclk (hw); +u32 val = degrees /120 ; + + val <<=28 ;regmap_update_bits (dclk->regmap,SUN4I_TCON0_IO_POL_REG ,GENMASK (29 ,28 ), - degrees /120 ); + val);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 191/496 btrfs: use kvzalloc to allocate btrfs_fs_info
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Mahoney <[email protected]>
[ Upstream commit a8fd1f71749387c9a1053a83ff1c16287499a4e7 ]
The srcu_struct in btrfs_fs_info scales in size with NR_CPUS. On kernels built with NR_CPUS=8192, this can result in kmalloc failures that prevent mounting.
There is work in progress to try to resolve this for every user of srcu_struct but using kvzalloc will work around the failures until that is complete.
As an example with NR_CPUS=512 on x86_64: the overall size of subvol_srcu is 3460 bytes, fs_info is 6496.
--- fs/btrfs/ctree.h | 2 +- fs/btrfs/super.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
fs/btrfs/ctree.h +1 -1
@@ -2969,7 +2969,7 @@ static inline void free_fs_info(struct bkfree (fs_info->super_copy);kfree (fs_info->super_for_commit);security_free_mnt_opts (&fs_info->security_opts); -kfree (fs_info); +kvfree (fs_info); }/* tree mod log functions from ctree.c */
fs/btrfs/super.c +1 -1
@@ -1581,7 +1581,7 @@ static struct dentry *btrfs_mount(struct* it for searching for existing supers, so this lets us do that and * then open_ctree will properly initialize everything later. */ - fs_info =kzalloc (sizeof (struct btrfs_fs_info ),GFP_KERNEL ); + fs_info =kvzalloc (sizeof (struct btrfs_fs_info ),GFP_KERNEL );if (!fs_info) { error = -ENOMEM ; goto error_sec_opts;
Greg Kroah-Hartman
maintainerPATCH 192/496 Btrfs: send, fix issuing write op when processing hole in no data mode
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
[ Upstream commit d4dfc0f4d39475ccbbac947880b5464a74c30b99 ]
When doing an incremental send of a filesystem with the no-holes feature enabled, we end up issuing a write operation when using the no data mode send flag, instead of issuing an update extent operation. Fix this by issuing the update extent operation instead.
Trivial reproducer:
$ mkfs.btrfs -f -O no-holes /dev/sdc $ mkfs.btrfs -f /dev/sdd $ mount /dev/sdc /mnt/sdc $ mount /dev/sdd /mnt/sdd
$ xfs_io -f -c "pwrite -S 0xab 0 32K" /mnt/sdc/foobar $ btrfs subvolume snapshot -r /mnt/sdc /mnt/sdc/snap1
$ xfs_io -c "fpunch 8K 8K" /mnt/sdc/foobar $ btrfs subvolume snapshot -r /mnt/sdc /mnt/sdc/snap2
$ btrfs send /mnt/sdc/snap1 | btrfs receive /mnt/sdd
$ btrfs send --no-data -p /mnt/sdc/snap1 /mnt/sdc/snap2 \
| btrfs receive -vv /mnt/sddBefore this change the output of the second receive command is:
receiving snapshot snap2 uuid=f6922049-8c22-e544-9ff9-fc6755918447... utimes
write foobar, offset 8192, len 8192
utimes foobar
BTRFS_IOC_SET_RECEIVED_SUBVOL uuid=f6922049-8c22-e544-9ff9-...
After this change it is:
receiving snapshot snap2 uuid=564d36a3-ebc8-7343-aec9-bf6fda278e64... utimes
update_extent foobar: offset=8192, len=8192
utimes foobar
BTRFS_IOC_SET_RECEIVED_SUBVOL uuid=564d36a3-ebc8-7343-aec9-bf6fda278e64...
--- fs/btrfs/send.c | 3 +++ 1 file changed, 3 insertions(+)
fs/btrfs/send.c +3 -0
@@ -5008,6 +5008,9 @@ static int send_hole(struct send_ctx *scu64 len;int ret =0 ; +if (sctx->flags &BTRFS_SEND_FLAG_NO_FILE_DATA ) +return send_update_extent (sctx, offset, end - offset); + p =fs_path_alloc ();if (!p)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 193/496 Btrfs: fix log replay failure after linking special file and fsync
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
[ Upstream commit 9a6509c4daa91400b52a5fd541a5521c649a8fea ]
If in the same transaction we rename a special file (fifo, character/block device or symbolic link), create a hard link for it having its old name then sync the log, we will end up with a log that can not be replayed and at when attempting to replay it, an EEXIST error is returned and mounting the filesystem fails. Example scenario:
$ mkfs.btrfs -f /dev/sdc $ mount /dev/sdc /mnt $ mkdir /mnt/testdir $ mkfifo /mnt/testdir/foo # Make sure everything done so far is durably persisted. $ sync
# Create some unrelated file and fsync it, this is just to create a log
# tree. The file must be in the same directory as our special file. $ touch /mnt/testdir/f1 $ xfs_io -c "fsync" /mnt/testdir/f1
# Rename our special file and then create a hard link with its old name.
$ mv /mnt/testdir/foo /mnt/testdir/bar $ ln /mnt/testdir/bar /mnt/testdir/foo
# Create some other unrelated file and fsync it, this is just to persist
# the log tree which was modified by the previous rename and link # operations. Alternatively we could have modified file f1 and fsync it. $ touch /mnt/f2 $ xfs_io -c "fsync" /mnt/f2
<power failure>
$ mount /dev/sdc /mnt mount: mount /dev/sdc on /mnt failed: File exists
This happens because when both the log tree and the subvolume's tree have an entry in the directory "testdir" with the same name, that is, there is one key (258 INODE_REF 257) in the subvolume tree and another one in the log tree (where 258 is the inode number of our special file and 257 is the inode for directory "testdir"). Only the data of those two keys differs, in the subvolume tree the index field for inode reference has a value of 3 while the log tree it has a value of 5. Because the same key exists in both trees, but have different index, the log replay fails with an -EEXIST error when attempting to replay the inode reference from the log tree.
Fix this by setting the last_unlink_trans field of the inode (our special file) to the current transaction id when a hard link is created, as this forces logging the parent directory inode, solving the conflict at log replay time.
A new generic test case for fstests was also submitted.
--- fs/btrfs/tree-log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/tree-log.c +1 -1
@@ -5888,7 +5888,7 @@ int btrfs_log_new_name(struct btrfs_tran* this will force the logging code to walk the dentry chain * up for the file */ -if (S_ISREG (inode->vfs_inode.i_mode)) +if (!S_ISDIR (inode->vfs_inode.i_mode)) inode->last_unlink_trans = trans->transid;/*
Greg Kroah-Hartman
maintainerPATCH 194/496 ceph: fix potential memory leak in init_caches()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengguang Xu <[email protected]>
[ Upstream commit 1c789249578895bb14ab62b4327306439b754857 ]
There is lack of cache destroy operation for ceph_file_cachep when failing from fscache register.
--- fs/ceph/super.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
fs/ceph/super.c +6 -3
@@ -712,14 +712,17 @@ static int __init init_caches(void) goto bad_dentry; ceph_file_cachep =KMEM_CACHE (ceph_file_info,SLAB_MEM_SPREAD ); -if (!ceph_file_cachep) goto bad_file; -if ((error =ceph_fscache_register ())) - goto bad_file; + error =ceph_fscache_register (); +if (error) + goto bad_fscache;return 0 ; + +bad_fscache: +kmem_cache_destroy (ceph_file_cachep); bad_file:kmem_cache_destroy (ceph_dentry_cachep); bad_dentry:
Greg Kroah-Hartman
maintainerPATCH 195/496 block: display the correct diskname for bio
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiufei Xue <[email protected]>
[ Upstream commit 9c0fb1e313aaf4e8edec22433c8b22dd308e466c ]
bio_devname use __bdevname to display the device name, and can only show the major and minor of the part0,
Fix this by using disk_name to display the correct name.
--- block/partition-generic.c | 6 ++++++ include/linux/bio.h | 4 +--- 2 files changed, 7 insertions(+), 3 deletions(-)
block/partition-generic.c +6 -0
@@ -51,6 +51,12 @@ const char *bdevname(struct block_deviceEXPORT_SYMBOL (bdevname); +const char *bio_devname (struct bio *bio,char *buf) +{ +return disk_name (bio->bi_disk, bio->bi_partno, buf); +} +EXPORT_SYMBOL (bio_devname); +/* * There's very little reason to use this, you should really * have a struct block_device just about everywhere and use
include/linux/bio.h +1 -3
@@ -501,6 +501,7 @@ void zero_fill_bio(struct bio *bio);extern struct bio_vec *bvec_alloc (gfp_t ,int ,unsigned long *,mempool_t *);extern void bvec_free (mempool_t *,struct bio_vec *,unsigned int );extern unsigned int bvec_nr_vecs (unsigned short idx); +extern const char *bio_devname (struct bio *bio,char *buffer);#define bio_set_dev (bio, bdev) \ do { \
@@ -519,9 +520,6 @@ do { \#define bio_dev (bio) \ disk_devt((bio)->bi_disk) -#define bio_devname (bio, buf) \ - __bdevname(bio_dev(bio), (buf)) -#ifdef CONFIG_BLK_CGROUP int bio_associate_blkcg (struct bio *bio,struct cgroup_subsys_state *blkcg_css);int bio_associate_current (struct bio *bio);
Greg Kroah-Hartman
maintainerPATCH 196/496 nvme-pci: Fix EEH failure on ppc
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wen Xiong <[email protected]>
[ Upstream commit 651438bb0af5213f1f70d66e75bf11d08cb5537a ]
Triggering PPC EEH detection and handling requires a memory mapped read failure. The NVMe driver removed the periodic health check MMIO, so there's no early detection mechanism to trigger the recovery. Instead, the detection now happens when the nvme driver handles an IO timeout event. This takes the pci channel offline, so we do not want the driver to proceed with escalating its own recovery efforts that may conflict with the EEH handler.
This patch ensures the driver will observe the channel was set to offline after a failed MMIO read and resets the IO timer so the EEH handler has a chance to recover the device.
--- drivers/nvme/host/pci.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/nvme/host/pci.c +7 -6
@@ -1013,12 +1013,6 @@ static bool nvme_should_reset(struct nvmif (!(csts &NVME_CSTS_CFS ) && !nssro)return false; -/* If PCI error recovery process is happening, we cannot reset or -* the recovery mechanism will surely fail. -*/ -if (pci_channel_offline (to_pci_dev (dev->dev))) -return false; -return true; }
@@ -1049,6 +1043,13 @@ static enum blk_eh_timer_return nvme_timstruct nvme_command cmd;u32 csts =readl (dev->bar +NVME_REG_CSTS ); +/* If PCI error recovery process is happening, we cannot reset or +* the recovery mechanism will surely fail. +*/ +mb (); +if (pci_channel_offline (to_pci_dev (dev->dev))) +return BLK_EH_RESET_TIMER ; +/* * Reset immediately if the controller is failed */
Greg Kroah-Hartman
maintainerPATCH 197/496 nvme: pci: pass max vectors as num_possible_cpus() to pci_alloc_irq_vectors
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Lei <[email protected]>
[ Upstream commit 16ccfff2897613007b5eda9e29d65303c6280026 ]
84676c1f21 ("genirq/affinity: assign vectors to all possible CPUs") has switched to do irq vectors spread among all possible CPUs, so pass num_possible_cpus() as max vecotrs to be assigned.
For example, in a 8 cores system, 0~3 online, 4~8 offline/not present, see 'lscpu':
[ming@box]$lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 1
Core(s) per socket: 2
Socket(s): 2
NUMA node(s): 2
...
NUMA node0 CPU(s): 0-3
NUMA node1 CPU(s):
...
1) before this patch, follows the allocated vectors and their affinity:
irq 47, cpu list 0,4 irq 48, cpu list 1,6 irq 49, cpu list 2,5 irq 50, cpu list 3,7
2) after this patch, follows the allocated vectors and their affinity:
irq 43, cpu list 0
irq 44, cpu list 1
irq 45, cpu list 2
irq 46, cpu list 3
irq 47, cpu list 4
irq 48, cpu list 6
irq 49, cpu list 5
irq 50, cpu list 7
--- drivers/nvme/host/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/pci.c +1 -1
@@ -1770,7 +1770,7 @@ static int nvme_setup_io_queues(struct nint result, nr_io_queues;unsigned long size; - nr_io_queues =num_present_cpus (); + nr_io_queues =num_possible_cpus (); result =nvme_set_queue_count (&dev->ctrl, &nr_io_queues);if (result <0 )return result;
Greg Kroah-Hartman
maintainerPATCH 198/496 selftests/powerpc: Skip the subpage_prot tests if the syscall is unavailable
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
[ Upstream commit cd4a6f3ab4d80cb919d15897eb3cbc85c2009d4b ]
The subpage_prot syscall is only functional when the system is using the Hash MMU. Since commit 5b2b80714796 ("powerpc/mm: Invalidate subpage_prot() system call on radix platforms") it returns ENOENT when the Radix MMU is active. Currently this just makes the test fail.
Additionally the syscall is not available if the kernel is built with 4K pages, or if CONFIG_PPC_SUBPAGE_PROT=n, in which case it returns ENOSYS because the syscall is missing entirely.
So check explicitly for ENOENT and ENOSYS and skip if we see either of those.
--- tools/testing/selftests/powerpc/mm/subpage_prot.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
tools/testing/selftests/powerpc/mm/subpage_prot.c +14 -0
@@ -135,6 +135,16 @@ static int run_test(void *addr, unsignedreturn 0 ; } +static int syscall_available (void ) +{ +int rc; + + errno =0 ; + rc =syscall (__NR_subpage_prot,0 ,0 ,0 ); + +return rc ==0 || (errno !=ENOENT && errno !=ENOSYS ); +} +int test_anon (void ) {unsigned long align;
@@ -145,6 +155,8 @@ int test_anon(void)void *mallocblock;unsigned long mallocsize; +SKIP_IF (!syscall_available ()); +if (getpagesize () !=0x10000 ) {fprintf (stderr,"Kernel page size must be 64K!\n" );return 1 ;
@@ -180,6 +192,8 @@ int test_file(void)off_t filesize;int fd; +SKIP_IF (!syscall_available ()); + fd =open (file_name,O_RDWR );if (fd ==-1 ) {perror ("failed to open file" );
Greg Kroah-Hartman
maintainerPATCH 199/496 scsi: core: return BLK_STS_OK for DID_OK in __scsi_error_from_host_byte()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hannes Reinecke <[email protected]>
[ Upstream commit e39a97353e5378eb46bf01679799c5704d397f32 ]
When converting __scsi_error_from_host_byte() to BLK_STS error codes the case DID_OK was forgotten, resulting in it always returning an error.
--- drivers/scsi/scsi_lib.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/scsi/scsi_lib.c +2 -0
@@ -720,6 +720,8 @@ static blk_status_t __scsi_error_from_ho int result) {switch (host_byte (result)) { +case DID_OK : +return BLK_STS_OK ;case DID_TRANSPORT_FAILFAST :return BLK_STS_TRANSPORT ;case DID_TARGET_FAILURE :
Re: [PATCH 4.14 199/496] scsi: core: return BLK_STS_OK for DID_OK in __scsi_error_from_host_byte()
question:
drop because of upstream's
cbe095e2b584 ("Revert "scsi: core: return BLK_STS_OK for DID_OK in __scsi_error_from_host_byte()"")
__scsi_error_from_host_byte()")
as in stable-queue's
c40541008b93 ("drop a scsi patch from 4.14")
?
Quoted 35 lines · Greg Kroah-Hartman
4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hannes Reinecke <[email protected]>
[ Upstream commit
e39a97353e5378eb46bf01679799c5704d397f32]When converting
__scsi_error_from_host_byte()toBLK_STSerror codes the caseDID_OKwas forgotten, resulting in it always returning an error.Fixes 2a842acab109 ("block: introduce new block status code type")Cc Doug Gilbert <[email protected]>Signed-off-by Hannes Reinecke <[email protected]>Reviewed-by Douglas Gilbert <[email protected]>Signed-off-by Martin K. Petersen <[email protected]>Signed-off-by Sasha Levin <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/scsi/scsi_lib.c | 2 ++ 1 file changed, 2 insertions(+)drivers/scsi/scsi_lib.c +2
-0@@ -720,6 +720,8 @@ static blk_status_t __scsi_error_from_ho int result) {switch (host_byte (result)) { +case DID_OK : +return BLK_STS_OK ;case DID_TRANSPORT_FAILFAST :return BLK_STS_TRANSPORT ;case DID_TARGET_FAILURE :
Signature · 10 lines
Mit freundlichen Gruessen / Kind regards Steffen Maier Linux on IBM Z Development IBM Deutschland Research & Development GmbH Vorsitzende des Aufsichtsrats: Martina Koederitz Geschaeftsfuehrung: Dirk Wittkopp Sitz der Gesellschaft: Boeblingen Registergericht: Amtsgericht Stuttgart, HRB 243294
Greg Kroah-Hartman
maintainerRe: [PATCH 4.14 199/496] scsi: core: return BLK_STS_OK for DID_OK in __scsi_error_from_host_byte()
Quoted 5 lines · Steffen Maier
question:
drop because of upstream's
cbe095e2b584("Revert "scsi: core: returnBLK_STS_OKforDID_OKin__scsi_error_from_host_byte()"")
Quoted 8 lines
Fixes e39a97353e53 ("scsi: core: return BLK_STS_OK for DID_OK in
__scsi_error_from_host_byte()")as in stable-queue's
c40541008b93("drop a scsi patch from 4.14")?
Ugh, you are right, sorry about this, now dropping it again :)
Sasha, any way your scripts can detect that a patch was later reverted so you don't add it to your patch series?
thanks,
greg k-h
Greg Kroah-Hartman
maintainerPATCH 200/496 net: ethtool: dont ignore return from driver get_fecparam method
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edward Cree <[email protected]>
[ Upstream commit a6d50512b4d86ecd9f5952525e454583be1c3b14 ]
If ethtool_ops->get_fecparam returns an error, pass that error on to the
user, rather than ignoring it.
--- net/core/ethtool.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/core/ethtool.c +4 -1
@@ -2505,11 +2505,14 @@ static int set_phy_tunable(struct net_destatic int ethtool_get_fecparam (struct net_device *dev,void __user *useraddr) {struct ethtool_fecparam fecparam = {ETHTOOL_GFECPARAM }; +int rc;if (!dev->ethtool_ops->get_fecparam)return -EOPNOTSUPP ; - dev->ethtool_ops->get_fecparam (dev, &fecparam); + rc = dev->ethtool_ops->get_fecparam (dev, &fecparam); +if (rc) +return rc;if (copy_to_user (useraddr, &fecparam,sizeof (fecparam)))return -EFAULT ;
Greg Kroah-Hartman
maintainerPATCH 201/496 iwlwifi: mvm: fix TX of CCMP 256
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sara Sharon <[email protected]>
[ Upstream commit de04d4fbf87b769ab18c480e4f020c53e74bbdd2 ]
We don't have enough room in the TX command for a CCMP 256 key, and need to use key from table.
--- drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/tx.c +5 -2
@@ -419,11 +419,11 @@ static void iwl_mvm_set_tx_cmd_crypto(st {struct ieee80211_key_conf *keyconf = info->control.hw_key;u8 *crypto_hdr = skb_frag->data + hdrlen; +enum iwl_tx_cmd_sec_ctrl type =TX_CMD_SEC_CCM ;u64 pn;switch (keyconf->cipher) {case WLAN_CIPHER_SUITE_CCMP : -case WLAN_CIPHER_SUITE_CCMP_256 :iwl_mvm_set_tx_cmd_ccmp (info, tx_cmd);iwl_mvm_set_tx_cmd_pn (info, crypto_hdr);break ;
@@ -447,13 +447,16 @@ static void iwl_mvm_set_tx_cmd_crypto(stbreak ;case WLAN_CIPHER_SUITE_GCMP :case WLAN_CIPHER_SUITE_GCMP_256 : + type =TX_CMD_SEC_GCMP ; +/* Fall through */ +case WLAN_CIPHER_SUITE_CCMP_256 :/* TODO: Taking the key from the table might introduce a race * when PTK rekeying is done, having an old packets with a PN * based on the old key but the message encrypted with a new * one. * Need to handle this. */ - tx_cmd->sec_ctl |=TX_CMD_SEC_GCMP |TX_CMD_SEC_KEY_FROM_TABLE ; + tx_cmd->sec_ctl |= type |TX_CMD_SEC_KEY_FROM_TABLE ; tx_cmd->key[0 ] = keyconf->hw_key_idx;iwl_mvm_set_tx_cmd_pn (info, crypto_hdr);break ;
Greg Kroah-Hartman
maintainerPATCH 202/496 iwlwifi: mvm: Fix channel switch for count 0 and 1
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrei Otcheretianski <[email protected]>
[ Upstream commit 40d53f4a60c9eb10d4fa58066c23ba1af8a59e39 ]
It was assumed that apply_time==0 implies immediate scheduling, which is wrong. Instead, the fw expects the START_IMMEDIATELY flag to be set. Otherwise, this resulted in 0x3063 assert.
Fix that.
While at it rename the T2_V2_START_IMMEDIATELY to TE_V2_START_IMMEDIATELY.
--- drivers/net/wireless/intel/iwlwifi/fw/api/time-event.h | 4 ++-- drivers/net/wireless/intel/iwlwifi/mvm/time-event.c | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/api/time-event.h +2 -2
@@ -211,7 +211,7 @@ enum {* @TE_V2_NOTIF_HOST_FRAG_END:request/receive notification on frag end * @TE_V2_NOTIF_INTERNAL_FRAG_START: internal FW use. * @TE_V2_NOTIF_INTERNAL_FRAG_END: internal FW use. -* @T2_V2_START_IMMEDIATELY: start time event immediately +* @TE_V2_START_IMMEDIATELY: start time event immediately * @TE_V2_DEP_OTHER: depends on another time event * @TE_V2_DEP_TSF: depends on a specific time * @TE_V2_EVENT_SOCIOPATHIC: can't co-exist with other events of tha same MAC
@@ -230,7 +230,7 @@ enum iwl_time_event_policy {TE_V2_NOTIF_HOST_FRAG_END =BIT (5 ),TE_V2_NOTIF_INTERNAL_FRAG_START =BIT (6 ),TE_V2_NOTIF_INTERNAL_FRAG_END =BIT (7 ), -T2_V2_START_IMMEDIATELY =BIT (11 ), +TE_V2_START_IMMEDIATELY =BIT (11 ),/* placement characteristics */ TE_V2_DEP_OTHER = BIT(TE_V2_PLACEMENT_POS),
drivers/net/wireless/intel/iwlwifi/mvm/time-event.c +4 -2
@@ -621,7 +621,7 @@ void iwl_mvm_protect_session(struct iwl_ time_cmd.repeat =1 ; time_cmd.policy =cpu_to_le16 (TE_V2_NOTIF_HOST_EVENT_START |TE_V2_NOTIF_HOST_EVENT_END | -T2_V2_START_IMMEDIATELY ); +TE_V2_START_IMMEDIATELY );if (!wait_for_notif) {iwl_mvm_time_event_send_add (mvm, vif, te_data, &time_cmd);
@@ -814,7 +814,7 @@ int iwl_mvm_start_p2p_roc(struct iwl_mvm time_cmd.repeat =1 ; time_cmd.policy =cpu_to_le16 (TE_V2_NOTIF_HOST_EVENT_START |TE_V2_NOTIF_HOST_EVENT_END | -T2_V2_START_IMMEDIATELY ); +TE_V2_START_IMMEDIATELY );return iwl_mvm_time_event_send_add (mvm, vif, te_data, &time_cmd); }
@@ -924,6 +924,8 @@ int iwl_mvm_schedule_csa_period(struct i time_cmd.interval =cpu_to_le32 (1 ); time_cmd.policy =cpu_to_le16 (TE_V2_NOTIF_HOST_EVENT_START |TE_V2_ABSENCE ); +if (!apply_time) + time_cmd.policy |=cpu_to_le16 (TE_V2_START_IMMEDIATELY );return iwl_mvm_time_event_send_add (mvm, vif, te_data, &time_cmd); }
Greg Kroah-Hartman
maintainerPATCH 203/496 iwlwifi: mvm: fix assert 0x2B00 on older FWs
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sara Sharon <[email protected]>
[ Upstream commit 63dd5d022f4766e6b05ee611124afcc7cbfbb953 ]
We should add the multicast station before adding the broadcast station.
However, in older FW, the firmware will start beaconing when we add the multicast station, and since the broadcast station is not added at this point so the transmission of the beacon will fail on assert 0x2b00.
This is fixed in later firmware, so make the order of addition depend on the TLV.
--- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 45 +++++++++++++++++----- 1 file changed, 35 insertions(+), 10 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +35 -10
@@ -8,6 +8,7 @@* Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * Copyright(c) 2016 - 2017 Intel Deutschland GmbH +* Copyright(c) 2018 Intel Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as
@@ -2127,15 +2128,40 @@ static int iwl_mvm_start_ap_ibss(structif (ret) goto out_remove; - ret =iwl_mvm_add_mcast_sta (mvm, vif); -if (ret) - goto out_unbind; - -/* Send the bcast station. At this stage the TBTT and DTIM time events -* are added and applied to the scheduler */ - ret =iwl_mvm_send_add_bcast_sta (mvm, vif); -if (ret) - goto out_rm_mcast; +/* +* This is not very nice, but the simplest: +* For older FWs adding the mcast sta before the bcast station may +* cause assert 0x2b00. +* This is fixed in later FW so make the order of removal depend on +* the TLV +*/ +if (fw_has_api (&mvm->fw->ucode_capa,IWL_UCODE_TLV_API_STA_TYPE )) { + ret =iwl_mvm_add_mcast_sta (mvm, vif); +if (ret) + goto out_unbind; +/* +* Send the bcast station. At this stage the TBTT and DTIM time +* events are added and applied to the scheduler +*/ + ret =iwl_mvm_send_add_bcast_sta (mvm, vif); +if (ret) { +iwl_mvm_rm_mcast_sta (mvm, vif); + goto out_unbind; + } + }else { +/* +* Send the bcast station. At this stage the TBTT and DTIM time +* events are added and applied to the scheduler +*/ +iwl_mvm_send_add_bcast_sta (mvm, vif); +if (ret) + goto out_unbind; +iwl_mvm_add_mcast_sta (mvm, vif); +if (ret) { +iwl_mvm_send_rm_bcast_sta (mvm, vif); + goto out_unbind; + } + }/* must be set before quota calculations */ mvmvif->ap_ibss_active = true;
@@ -2165,7 +2191,6 @@ out_quota_failed:iwl_mvm_power_update_mac (mvm); mvmvif->ap_ibss_active = false;iwl_mvm_send_rm_bcast_sta (mvm, vif); -out_rm_mcast:iwl_mvm_rm_mcast_sta (mvm, vif); out_unbind:iwl_mvm_binding_remove_vif (mvm, vif);
Greg Kroah-Hartman
maintainerPATCH 204/496 iwlwifi: avoid collecting firmware dump if not loaded
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shaul Triebitz <[email protected]>
[ Upstream commit 8745f12a6600dd9d31122588621d4c8ddb332cd7 ]
Trying to collect firmware debug data while firmware is not loaded causes various errors (e.g. failing NIC access). This causes even a bigger issue if at that time the HW radio is off.
In that case, when later turning the radio on, the Driver fails to read the HW (registers contain garbage values). (It may be that the CSR_GP_CNTRL_REG_FLAG_RFKILL_WAKE_L1A_EN bit is cleared on faulty NIC access - since the same behavior was seen in HW RFKILL toggling before setting that bit.)
--- drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 13 +++++++++++-- drivers/net/wireless/intel/iwlwifi/fw/dbg.h | 3 +++ drivers/net/wireless/intel/iwlwifi/fw/runtime.h | 3 +++ drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c | 5 ++--- drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 8 ++++++++ 5 files changed, 27 insertions(+), 5 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/dbg.c +11 -2
@@ -8,6 +8,7 @@* Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * Copyright(c) 2015 - 2017 Intel Deutschland GmbH +* Copyright(c) 2018 Intel Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as
@@ -33,6 +34,7 @@* Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * Copyright(c) 2015 - 2017 Intel Deutschland GmbH +* Copyright(c) 2018 Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without
@@ -928,7 +930,6 @@ dump_trans_data: out:iwl_fw_free_dump_desc (fwrt); - fwrt->dump.trig =NULL ;clear_bit (IWL_FWRT_STATUS_DUMPING , &fwrt->status); }IWL_EXPORT_SYMBOL (iwl_fw_error_dump);
@@ -1084,6 +1085,14 @@ void iwl_fw_error_dump_wk(struct work_st fwrt->ops->dump_start(fwrt->ops_ctx))return ; +if (fwrt->ops && fwrt->ops->fw_running && + !fwrt->ops->fw_running (fwrt->ops_ctx)) { +IWL_ERR (fwrt,"Firmware not running - cannot dump error\n" ); +iwl_fw_free_dump_desc (fwrt); +clear_bit (IWL_FWRT_STATUS_DUMPING , &fwrt->status); + goto out; + } +if (fwrt->trans->cfg->device_family ==IWL_DEVICE_FAMILY_7000 ) {/* stop recording */ iwl_fw_dbg_stop_recording (fwrt);
@@ -1117,7 +1126,7 @@ void iwl_fw_error_dump_wk(struct work_stiwl_write_prph (fwrt->trans,DBGC_OUT_CTRL , out_ctrl); } } - +out:if (fwrt->ops && fwrt->ops->dump_end) fwrt->ops->dump_end (fwrt->ops_ctx); }
drivers/net/wireless/intel/iwlwifi/fw/dbg.h +3 -0
@@ -8,6 +8,7 @@* Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * Copyright(c) 2015 - 2017 Intel Deutschland GmbH +* Copyright(c) 2018 Intel Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as
@@ -33,6 +34,7 @@* Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * Copyright(c) 2015 - 2017 Intel Deutschland GmbH +* Copyright(c) 2018 Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without
@@ -91,6 +93,7 @@ static inline void iwl_fw_free_dump_descif (fwrt->dump.desc != &iwl_dump_desc_assert)kfree (fwrt->dump.desc); fwrt->dump.desc =NULL ; + fwrt->dump.trig =NULL ; }void iwl_fw_error_dump (struct iwl_fw_runtime *fwrt);
drivers/net/wireless/intel/iwlwifi/fw/runtime.h +3 -0
@@ -6,6 +6,7 @@* GPL LICENSE SUMMARY * * Copyright(c) 2017 Intel Deutschland GmbH +* Copyright(c) 2018 Intel Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as
@@ -26,6 +27,7 @@* BSD LICENSE * * Copyright(c) 2017 Intel Deutschland GmbH +* Copyright(c) 2018 Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without
@@ -68,6 +70,7 @@struct iwl_fw_runtime_ops {int (*dump_start)(void *ctx);void (*dump_end)(void *ctx); +bool (*fw_running)(void *ctx); };#define MAX_NUM_LMAC 2
drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c +2 -3
@@ -8,6 +8,7 @@* Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * Copyright(c) 2016 - 2017 Intel Deutschland GmbH +* Copyright(c) 2018 Intel Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as
@@ -35,6 +36,7 @@* Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * Copyright(c) 2016 - 2017 Intel Deutschland GmbH +* Copyright(c) 2018 Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without
@@ -1209,9 +1211,6 @@ static ssize_t iwl_dbgfs_fw_dbg_collect_ {int ret; -if (!iwl_mvm_firmware_running (mvm)) -return -EIO ; - ret =iwl_mvm_ref_sync (mvm,IWL_MVM_REF_PRPH_WRITE );if (ret)return ret;
drivers/net/wireless/intel/iwlwifi/mvm/ops.c +8 -0
@@ -8,6 +8,7 @@* Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * Copyright(c) 2016 - 2017 Intel Deutschland GmbH +* Copyright(c) 2018 Intel Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as
@@ -35,6 +36,7 @@* Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * Copyright(c) 2016 - 2017 Intel Deutschland GmbH +* Copyright(c) 2018 Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without
@@ -553,9 +555,15 @@ static void iwl_mvm_fwrt_dump_end(void *iwl_mvm_unref (mvm,IWL_MVM_REF_FW_DBG_COLLECT ); } +static bool iwl_mvm_fwrt_fw_running (void *ctx) +{ +return iwl_mvm_firmware_running (ctx); +} +static const struct iwl_fw_runtime_ops iwl_mvm_fwrt_ops = { .dump_start = iwl_mvm_fwrt_dump_start, .dump_end = iwl_mvm_fwrt_dump_end, + .fw_running = iwl_mvm_fwrt_fw_running, }; static struct iwl_op_mode *
Greg Kroah-Hartman
maintainerPATCH 205/496 iwlwifi: mvm: fix "failed to remove key" message
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sara Sharon <[email protected]>
[ Upstream commit e4f13ad07823b24a1537518d2163bd164292fb10 ]
When the GTK is installed, we install it to HW with the station ID of the AP.
Mac80211 will try to remove it only after the AP sta is removed, which will result in a failure to remove key since we do not have any station for it.
This is a valid situation, but a previous commit removed the early return and added a return with error value, which resulted in an error message that is confusing to users.
Remove the error return value.
--- drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/sta.c +2 -1
@@ -3119,8 +3119,9 @@ static int __iwl_mvm_remove_sta_key(struint ret, size;u32 status; +/* This is a valid situation for GTK removal */ if (sta_id ==IWL_MVM_INVALID_STA ) -return -EINVAL ; +return 0 ; key_flags =cpu_to_le16 ((keyconf->keyidx <<STA_KEY_FLG_KEYID_POS ) &STA_KEY_FLG_KEYID_MSK );
Greg Kroah-Hartman
maintainerPATCH 206/496 iwlwifi: mvm: Direct multicast frames to the correct station
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilan Peer <[email protected]>
[ Upstream commit 7c305de2b9548ab6b65fce342c78618bbed5db73 ]
Multicast frames for NL80211_IFTYPE_AP and NL80211_IFTYPE_ADHOC were directed to the broadcast station, however, as the broadcast station did not have keys configured, these frames were sent unencrypted.
Fix this by using the multicast station which is the station for which encryption keys are configured.
--- drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/tx.c +5 -1
@@ -648,7 +648,11 @@ int iwl_mvm_tx_skb_non_sta(struct iwl_mvif (info.control.vif->type ==NL80211_IFTYPE_P2P_DEVICE || info.control.vif->type ==NL80211_IFTYPE_AP || info.control.vif->type ==NL80211_IFTYPE_ADHOC ) { - sta_id = mvmvif->bcast_sta.sta_id; +if (info.control.vif->type ==NL80211_IFTYPE_P2P_DEVICE ) + sta_id = mvmvif->bcast_sta.sta_id; +else + sta_id = mvmvif->mcast_sta.sta_id; + queue =iwl_mvm_get_ctrl_vif_queue (mvm, &info, hdr->frame_control);if (queue <0 )
Greg Kroah-Hartman
maintainerPATCH 207/496 iwlwifi: mvm: Correctly set the tid for mcast queue
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilan Peer <[email protected]>
[ Upstream commit 6508de0305d560235b366cc2cc98f7bcfb029e92 ]
In the scheduler config command, the meaning of tid == 0xf was intended to indicate the configuration is for management frames. However, tid == 0xf was also used for the multicast queue that was meant only for multicast data frames, which resulted with the FW not encrypting multicast data frames.
As multicast frames do not have a QoS header, fix this by setting tid == 0, to indicate that this is a data queue and not management one.
--- drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/sta.c +3 -3
@@ -2023,7 +2023,7 @@ int iwl_mvm_add_mcast_sta(struct iwl_mvmstruct iwl_trans_txq_scd_cfg cfg = { .fifo =IWL_MVM_TX_FIFO_MCAST , .sta_id = msta->sta_id, - .tid =IWL_MAX_TID_COUNT , + .tid =0 , .aggregate = false, .frame_limit =IWL_FRAME_LIMIT , };
@@ -2074,7 +2074,7 @@ int iwl_mvm_add_mcast_sta(struct iwl_mvmif (iwl_mvm_has_new_tx_api (mvm)) {int queue =iwl_mvm_tvqm_enable_txq (mvm, vif->cab_queue, msta->sta_id, -IWL_MAX_TID_COUNT , +0 , timeout); mvmvif->cab_queue = queue; } else if (!fw_has_api(&mvm->fw->ucode_capa,
@@ -2099,7 +2099,7 @@ int iwl_mvm_rm_mcast_sta(struct iwl_mvmiwl_mvm_flush_sta (mvm, &mvmvif->mcast_sta, true,0 );iwl_mvm_disable_txq (mvm, mvmvif->cab_queue, vif->cab_queue, -IWL_MAX_TID_COUNT ,0 ); +0 ,0 ); ret =iwl_mvm_rm_sta_common (mvm, mvmvif->mcast_sta.sta_id);if (ret)
Greg Kroah-Hartman
maintainerPATCH 208/496 rds: Incorrect reference counting in TCP socket creation
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ka-Cheong Poon <[email protected]>
[ Upstream commit 84eef2b2187ed73c0e4520cbfeb874e964a0b56a ]
Commit 0933a578cd55 ("rds: tcp: use sock_create_lite() to create the accept socket") has a reference counting issue in TCP socket creation when accepting a new connection. The code uses sock_create_lite() to create a kernel socket. But it does not do __module_get() on the socket owner. When the connection is shutdown and sock_release() is called to free the socket, the owner's reference count is decremented and becomes incorrect. Note that this bug only shows up when the socket owner is configured as a kernel module.
v2: Update comments
--- net/rds/tcp_listen.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
net/rds/tcp_listen.c +11 -3
@@ -1,5 +1,5 @@/* -* Copyright (c) 2006 Oracle. All rights reserved. +* Copyright (c) 2006, 2018 Oracle. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU
@@ -142,12 +142,20 @@ int rds_tcp_accept_one(struct socket *soif (ret) goto out; - new_sock->type = sock->type; - new_sock->ops = sock->ops; ret = sock->ops->accept (sock, new_sock,O_NONBLOCK , true);if (ret <0 ) goto out; +/* sock_create_lite() does not get a hold on the owner module so we +* need to do it here. Note that sock_release() uses sock->ops to +* determine if it needs to decrement the reference count. So set +* sock->ops after calling accept() in case that fails. And there's +* no need to do try_module_get() as the listener should have a hold +* already. +*/ + new_sock->ops = sock->ops; +__module_get (new_sock->ops->owner); + ret =rds_tcp_keepalive (new_sock);if (ret <0 ) goto out;
Greg Kroah-Hartman
maintainerPATCH 209/496 watchdog: f71808e_wdt: Fix magic close handling
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Igor Pylypiv <[email protected]>
[ Upstream commit 7bd3e7b743956afbec30fb525bc3c5e22e3d475c ]
Watchdog close is "expected" when any byte is 'V' not just the last one. Writing "V" to the device fails because the last byte is the end of string.
$ echo V > /dev/watchdog f71808e_wdt: Unexpected close, not stopping watchdog!
--- drivers/watchdog/f71808e_wdt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/watchdog/f71808e_wdt.c +2 -1
@@ -566,7 +566,8 @@ static ssize_t watchdog_write(struct filchar c;if (get_user (c, buf + i))return -EFAULT ; - expect_close = (c =='V' ); +if (c =='V' ) + expect_close = true; }/* Properly order writes across fork()ed processes */
Greg Kroah-Hartman
maintainerPATCH 210/496 watchdog: sbsa: use 32-bit read for WCV
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jayachandran C <[email protected]>
[ Upstream commit 93ac3deb7c220cbcec032a967220a1f109d58431 ]
According to SBSA spec v3.1 section 5.3:
All registers are 32 bits in size and should be accessed using 32-bit reads and writes. If an access size other than 32 bits is used then the results are IMPLEMENTATION DEFINED. [...]
The Generic Watchdog is little-endian
The current code uses readq to read the watchdog compare register which does a 64-bit access. This fails on ThunderX2 which does not implement 64-bit access to this register.
Fix this by using lo_hi_readq() that does two 32-bit reads.
--- drivers/watchdog/sbsa_gwdt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/watchdog/sbsa_gwdt.c +2 -1
@@ -50,6 +50,7 @@*/ #include <linux/io.h> +#include <linux/io-64-nonatomic-lo-hi.h> #include <linux/interrupt.h> #include <linux/module.h> #include <linux/moduleparam.h>
@@ -159,7 +160,7 @@ static unsigned int sbsa_gwdt_get_timele !(readl(gwdt->control_base + SBSA_GWDT_WCS) & SBSA_GWDT_WCS_WS0)) timeleft +=readl (gwdt->control_base +SBSA_GWDT_WOR ); - timeleft +=readq (gwdt->control_base +SBSA_GWDT_WCV ) - + timeleft +=lo_hi_readq (gwdt->control_base +SBSA_GWDT_WCV ) -arch_counter_get_cntvct ();do_div (timeleft, gwdt->clk);
Greg Kroah-Hartman
maintainerPATCH 212/496 hv_netvsc: use napi_schedule_irqoff
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Hemminger <[email protected]>
[ Upstream commit 68633edaef655ce94e51088ecef5dd4e1d2f6f34 ]
Since the netvsc_channel_cb is already called in interrupt context from vmbus, there is no need to do irqsave/restore.
--- drivers/net/hyperv/netvsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/hyperv/netvsc.c +1 -1
@@ -1261,7 +1261,7 @@ void netvsc_channel_cb(void *context)/* disable interupts from host */ hv_begin_read (rbi); -__napi_schedule (&nvchan->napi); +__napi_schedule_irqoff (&nvchan->napi); } }
Greg Kroah-Hartman
maintainerPATCH 213/496 hv_netvsc: filter multicast/broadcast
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Hemminger <[email protected]>
[ Upstream commit 009f766ca2383d8788acd65c2c36c51bbfb19470 ]
The netvsc driver was always enabling all multicast and broadcast even if netdevice flag had not enabled it.
--- drivers/net/hyperv/rndis_filter.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
drivers/net/hyperv/rndis_filter.c +12 -8
@@ -850,15 +850,19 @@ static void rndis_set_multicast(struct w {struct rndis_device *rdev = container_of(w, struct rndis_device, mcast_work); +u32 filter =NDIS_PACKET_TYPE_DIRECTED ; +unsigned int flags = rdev->ndev->flags; -if (rdev->ndev->flags &IFF_PROMISC ) -rndis_filter_set_packet_filter (rdev, -NDIS_PACKET_TYPE_PROMISCUOUS ); -else -rndis_filter_set_packet_filter (rdev, -NDIS_PACKET_TYPE_BROADCAST | -NDIS_PACKET_TYPE_ALL_MULTICAST | -NDIS_PACKET_TYPE_DIRECTED ); +if (flags &IFF_PROMISC ) { + filter =NDIS_PACKET_TYPE_PROMISCUOUS ; + }else { +if (flags &IFF_ALLMULTI ) + flags |=NDIS_PACKET_TYPE_ALL_MULTICAST ; +if (flags &IFF_BROADCAST ) + flags |=NDIS_PACKET_TYPE_BROADCAST ; + } + +rndis_filter_set_packet_filter (rdev, filter); }void rndis_filter_update (struct netvsc_device *nvdev)
Greg Kroah-Hartman
maintainerPATCH 214/496 hv_netvsc: propagate rx filters to VF
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Hemminger <[email protected]>
[ Upstream commit bee9d41b37ea6b1f860e5bc0989cf1cf1d7e6ab3 ]
The netvsc device should propagate filters to the SR-IOV VF device (if present). The flags also need to be propagated to the VF device as well. This only really matters on local Hyper-V since Azure does not support multiple addresses.
--- drivers/net/hyperv/netvsc_drv.c | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-)
drivers/net/hyperv/netvsc_drv.c +36 -4
@@ -66,10 +66,36 @@ static int debug = -1;module_param (debug, int,S_IRUGO );MODULE_PARM_DESC (debug,"Debug level (0=none,...,16=all)" ); -static void netvsc_set_multicast_list (struct net_device *net) +static void netvsc_change_rx_flags (struct net_device *net,int change) { -struct net_device_context *net_device_ctx =netdev_priv (net); -struct netvsc_device *nvdev =rtnl_dereference (net_device_ctx->nvdev); +struct net_device_context *ndev_ctx =netdev_priv (net); +struct net_device *vf_netdev =rtnl_dereference (ndev_ctx->vf_netdev); +int inc; + +if (!vf_netdev) +return ; + +if (change &IFF_PROMISC ) { + inc = (net->flags &IFF_PROMISC ) ?1 :-1 ; +dev_set_promiscuity (vf_netdev, inc); + } + +if (change &IFF_ALLMULTI ) { + inc = (net->flags &IFF_ALLMULTI ) ?1 :-1 ; +dev_set_allmulti (vf_netdev, inc); + } +} + +static void netvsc_set_rx_mode (struct net_device *net) +{ +struct net_device_context *ndev_ctx =netdev_priv (net); +struct net_device *vf_netdev =rtnl_dereference (ndev_ctx->vf_netdev); +struct netvsc_device *nvdev =rtnl_dereference (ndev_ctx->nvdev); + +if (vf_netdev) { +dev_uc_sync (vf_netdev, net); +dev_mc_sync (vf_netdev, net); + }rndis_filter_update (nvdev); }
@@ -1582,7 +1608,8 @@ static const struct net_device_ops devic .ndo_open = netvsc_open, .ndo_stop = netvsc_close, .ndo_start_xmit = netvsc_start_xmit, - .ndo_set_rx_mode = netvsc_set_multicast_list, + .ndo_change_rx_flags = netvsc_change_rx_flags, + .ndo_set_rx_mode = netvsc_set_rx_mode, .ndo_change_mtu = netvsc_change_mtu, .ndo_validate_addr = eth_validate_addr, .ndo_set_mac_address = netvsc_set_mac_addr,
@@ -1814,6 +1841,11 @@ static void __netvsc_vf_setup(struct netnetdev_warn (vf_netdev,"unable to change mtu to %u\n" , ndev->mtu); +/* set multicast etc flags on VF */ +dev_change_flags (vf_netdev, ndev->flags |IFF_SLAVE ); +dev_uc_sync (vf_netdev, ndev); +dev_mc_sync (vf_netdev, ndev); +if (netif_running (ndev)) { ret =dev_open (vf_netdev);if (ret)
Greg Kroah-Hartman
maintainerPATCH 215/496 ARM: dts: rockchip: Add missing #sound-dai-cells on rk3288
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rob Herring <[email protected]>
[ Upstream commit 4e943a890cef42e90f43ce6be64728a290b97c55 ]
dtc now gives the following warning:
arch/arm/boot/dts/rk3288-tinker.dtb: Warning (sound_dai_property): /sound/simple-audio-card,codec: Missing property '#sound-dai-cells' in node /hdmi@ff980000 or bad phandle (referred from sound-dai[0])
Add the missing #sound-dai-cells property.
--- arch/arm/boot/dts/rk3288.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/boot/dts/rk3288.dtsi +2 -0
@@ -927,6 +927,7 @@ i2s: i2s@ff890000 { compatible = "rockchip,rk3288-i2s", "rockchip,rk3066-i2s"; reg = <0x0 0xff890000 0x0 0x10000>; + #sound-dai-cells = <0>; interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>; #address-cells = <1>; #size-cells = <0>;
@@ -1122,6 +1123,7 @@ compatible = "rockchip,rk3288-dw-hdmi"; reg = <0x0 0xff980000 0x0 0x20000>; reg-io-width = <4>; + #sound-dai-cells = <0>; rockchip,grf = <&grf>; interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cru PCLK_HDMI_CTRL>, <&cru SCLK_HDMI_HDCP>;
Greg Kroah-Hartman
maintainerPATCH 216/496 perf record: Fix crash in pipe mode
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Olsa <[email protected]>
[ Upstream commit ad46e48c65fa1f204fa29eaff1b91174d314a94b ]
Currently we can crash perf record when running in pipe mode, like:
$ perf record ls | perf report # To display the perf.data header info, please use --header/--header-only options. # perf: Segmentation fault Error: The - file has no samples!
The callstack of the crash is:
0x0000000000515242 in perf_event__synthesize_event_update_name 3513 ev = event_update_event__new(len + 1, PERF_EVENT_UPDATE__NAME, evsel->id[0]); (gdb) bt #0 0x0000000000515242 in perf_event__synthesize_event_update_name #1 0x00000000005158a4 in perf_event__synthesize_extra_attr #2 0x0000000000443347 in record__synthesize #3 0x00000000004438e3 in __cmd_record #4 0x000000000044514e in cmd_record #5 0x00000000004cbc95 in run_builtin #6 0x00000000004cbf02 in handle_internal_command #7 0x00000000004cc054 in run_argv #8 0x00000000004cc422 in main
The reason of the crash is that the evsel does not have ids array allocated and the pipe's synthesize code tries to access it.
We don't force evsel ids allocation when we have single event, because it's not needed. However we need it when we are in pipe mode even for single event as a key for evsel update event.
Fixing this by forcing evsel ids allocation event for single event, when we are in pipe mode.
--- tools/perf/builtin-record.c | 9 +++++++++ tools/perf/perf.h | 1 + tools/perf/util/record.c | 8 ++++++-- 3 files changed, 16 insertions(+), 2 deletions(-)
tools/perf/builtin-record.c +9 -0
@@ -926,6 +926,15 @@ static int __cmd_record(struct record *r } } +/* +* If we have just single event and are sending data +* through pipe, we need to force the ids allocation, +* because we synthesize event name through the pipe +* and need the id for that. +*/ +if (data->is_pipe && rec->evlist->nr_entries ==1 ) + rec->opts.sample_id = true; +if (record__open (rec) !=0 ) { err =-1 ; goto out_child;
tools/perf/perf.h +1 -0
@@ -61,6 +61,7 @@ struct record_opts {bool tail_synthesize;bool overwrite;bool ignore_missing_thread; +bool sample_id;unsigned int freq;unsigned int mmap_pages;unsigned int auxtrace_mmap_pages;
tools/perf/util/record.c +6 -2
@@ -137,6 +137,7 @@ void perf_evlist__config(struct perf_evlstruct perf_evsel *evsel;bool use_sample_identifier = false;bool use_comm_exec; +bool sample_id = opts->sample_id;/* * Set the evsel leader links before we configure attributes,
@@ -163,8 +164,7 @@ void perf_evlist__config(struct perf_evl* match the id. */ use_sample_identifier =perf_can_sample_identifier (); -evlist__for_each_entry (evlist, evsel) -perf_evsel__set_sample_id (evsel, use_sample_identifier); + sample_id = true; }else if (evlist->nr_entries >1 ) {struct perf_evsel *first =perf_evlist__first (evlist);
@@ -174,6 +174,10 @@ void perf_evlist__config(struct perf_evl use_sample_identifier =perf_can_sample_identifier ();break ; } + sample_id = true; + } + +if (sample_id) {evlist__for_each_entry (evlist, evsel)perf_evsel__set_sample_id (evsel, use_sample_identifier); }
Greg Kroah-Hartman
maintainerPATCH 217/496 e1000e: Fix check_for_link return value with autoneg off
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Poirier <[email protected]>
[ Upstream commit 4e7dc08e57c95673d2edaba8983c3de4dd1f65f5 ]
When autoneg is off, the .check_for_link callback functions clear the get_link_status flag and systematically return a "pseudo-error". This means that the link is not detected as up until the next execution of the e1000_watchdog_task() 2 seconds later.
--- drivers/net/ethernet/intel/e1000e/ich8lan.c | 2 +- drivers/net/ethernet/intel/e1000e/mac.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/e1000e/ich8lan.c +1 -1
@@ -1602,7 +1602,7 @@ static s32 e1000_check_for_copper_link_i* we have already determined whether we have link or not. */ if (!mac->autoneg) -return -E1000_ERR_CONFIG ; +return 1 ;/* Auto-Neg is enabled. Auto Speed Detection takes care * of MAC speed/duplex configuration. So we only need to
drivers/net/ethernet/intel/e1000e/mac.c +1 -1
@@ -450,7 +450,7 @@ s32 e1000e_check_for_copper_link(struct* we have already determined whether we have link or not. */ if (!mac->autoneg) -return -E1000_ERR_CONFIG ; +return 1 ;/* Auto-Neg is enabled. Auto Speed Detection takes care * of MAC speed/duplex configuration. So we only need to
Greg Kroah-Hartman
maintainerPATCH 218/496 e1000e: allocate ring descriptors with dma_zalloc_coherent
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pierre-Yves Kerbrat <[email protected]>
[ Upstream commit aea3fca005fb45f80869f2e8d56fd4e64c1d1fdb ]
Descriptor rings were not initialized at zero when allocated When area contained garbage data, it caused skb_over_panic in e1000_clean_rx_irq (if data had E1000_RXD_STAT_DD bit set)
This patch makes use of dma_zalloc_coherent to make sure the ring is memset at 0 to prevent the area from containing garbage.
Following is the signature of the panic:
[email protected]: skbuff: skb_over_panic: text:80407b20 len:64010 put:64010 head:ab46d800 data:ab46d842 tail:0xab47d24c end:0xab46df40 dev:eth0 [email protected]: BUG: failure at net/core/skbuff.c:105/skb_panic()!
[email protected]: Kernel panic - not syncing: BUG!
[email protected]:
[email protected]: Process swapper/0 (pid: 0, threadinfo=81728000, task=8173cc00 ,cpu: 0)
[email protected]: SP = <815a1c0c>
[email protected]: Stack: 00000001
[email protected]: b2d89800 815e33ac
[email protected]: ea73c040 00000001
[email protected]: 60040003 0000fa0a
[email protected]: 00000002
[email protected]:
[email protected]: 804540c0 815a1c70
[email protected]: b2744000 602ac070
[email protected]: 815a1c44 b2d89800
[email protected]: 8173cc00 815a1c08
[email protected]:
[email protected]: 00000006
[email protected]: 815a1b50 00000000
[email protected]: 80079434 00000001
[email protected]: ab46df40 b2744000
[email protected]: b2d89800
[email protected]:
[email protected]: 0000fa0a 8045745c
[email protected]: 815a1c88 0000fa0a
[email protected]: 80407b20 b2789f80
[email protected]: 00000005 80407b20
[email protected]:
[email protected]:
[email protected]: Call Trace:
[email protected]: [<804540bc>] skb_panic+0xa4/0xa8
[email protected]: [<80079430>] console_unlock+0x2f8/0x6d0
[email protected]: [<80457458>] skb_put+0xa0/0xc0
[email protected]: [<80407b1c>] e1000_clean_rx_irq+0x2dc/0x3e8
[email protected]: [<80407b1c>] e1000_clean_rx_irq+0x2dc/0x3e8
[email protected]: [<804079c8>] e1000_clean_rx_irq+0x188/0x3e8
[email protected]: [<80407b1c>] e1000_clean_rx_irq+0x2dc/0x3e8
[email protected]: [<80468b48>] __dev_kfree_skb_any+0x88/0xa8
[email protected]: [<804101ac>] e1000e_poll+0x94/0x288
[email protected]: [<8046e9d4>] net_rx_action+0x19c/0x4e8
[email protected]: ...
[email protected]: Maximum depth to print reached. Use kstack=<maximum_depth_to_print> To specify a custom value (where 0 means to display the full backtrace) [email protected]: ---[ end Kernel panic - not syncing: BUG!
--- drivers/net/ethernet/intel/e1000e/netdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/e1000e/netdev.c +2 -2
@@ -2329,8 +2329,8 @@ static int e1000_alloc_ring_dma(struct e {struct pci_dev *pdev = adapter->pdev; - ring->desc =dma_alloc_coherent (&pdev->dev, ring->size, &ring->dma, -GFP_KERNEL ); + ring->desc =dma_zalloc_coherent (&pdev->dev, ring->size, &ring->dma, +GFP_KERNEL );if (!ring->desc)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 219/496 ia64/err-inject: Use get_user_pages_fast()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Davidlohr Bueso <[email protected]>
[ Upstream commit 69c907022a7d9325cdc5c9dd064571e445df9a47 ]
At the point of sysfs callback, the call to gup is done without mmap_sem (or any lock for that matter). This is racy. As such, use the get_user_pages_fast() alternative and safely avoid taking the lock, if possible.
--- arch/ia64/kernel/err_inject.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/ia64/kernel/err_inject.c +1 -1
@@ -142,7 +142,7 @@ store_virtual_to_phys(struct device *devu64 virt_addr=simple_strtoull (buf,NULL ,16 );int ret; - ret =get_user_pages (virt_addr,1 ,FOLL_WRITE ,NULL ,NULL ); + ret =get_user_pages_fast (virt_addr,1 ,FOLL_WRITE ,NULL );if (ret<=0 ) {#ifdef ERR_INJ_DEBUG printk ("Virtual address %lx is not existing.\n" ,virt_addr);
Greg Kroah-Hartman
maintainerPATCH 220/496 RDMA/qedr: Fix kernel panic when running fio over NFSoRDMA
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Kalderon, Michal" <[email protected]>
[ Upstream commit e3fd112cbf21d049faf64ba1471d72b93c22109a ]
Race in qedr_poll_cq, lastest_cqe wasn't protected by lock, leading to a case where two context's accessing poll_cq at the same time lead to one of them having a pointer to an old latest_cqe and reading an invalid cqe element
--- drivers/infiniband/hw/qedr/verbs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/hw/qedr/verbs.c +2 -1
@@ -3518,7 +3518,7 @@ int qedr_poll_cq(struct ib_cq *ibcq, int {struct qedr_dev *dev =get_qedr_dev (ibcq->device);struct qedr_cq *cq =get_qedr_cq (ibcq); -union rdma_cqe *cqe = cq->latest_cqe; +union rdma_cqe *cqe;u32 old_cons, new_cons;unsigned long flags;int update =0 ;
@@ -3535,6 +3535,7 @@ int qedr_poll_cq(struct ib_cq *ibcq, intreturn qedr_gsi_poll_cq (ibcq, num_entries, wc);spin_lock_irqsave (&cq->cq_lock, flags); + cqe = cq->latest_cqe; old_cons =qed_chain_get_cons_idx_u32 (&cq->pbl);while (num_entries &&is_valid_cqe (cq, cqe)) {struct qedr_qp *qp;
Greg Kroah-Hartman
maintainerPATCH 221/496 RDMA/qedr: Fix iWARP write and send with immediate
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Kalderon, Michal" <[email protected]>
[ Upstream commit 551e1c67b4207455375a2e7a285dea1c7e8fc361 ]
iWARP does not support RDMA WRITE or SEND with immediate data. Driver should check this before submitting to FW and return an immediate error
--- drivers/infiniband/hw/qedr/verbs.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/infiniband/hw/qedr/verbs.c +10 -0
@@ -2832,6 +2832,11 @@ static int __qedr_post_send(struct ib_qpswitch (wr->opcode) {case IB_WR_SEND_WITH_IMM : +if (unlikely (rdma_protocol_iwarp (&dev->ibdev,1 ))) { + rc = -EINVAL ; + *bad_wr = wr; +break ; + } wqe->req_type =RDMA_SQ_REQ_TYPE_SEND_WITH_IMM ; swqe = (struct rdma_sq_send_wqe_1st *)wqe; swqe->wqe_size =2 ;
@@ -2873,6 +2878,11 @@ static int __qedr_post_send(struct ib_qpbreak ;case IB_WR_RDMA_WRITE_WITH_IMM : +if (unlikely (rdma_protocol_iwarp (&dev->ibdev,1 ))) { + rc = -EINVAL ; + *bad_wr = wr; +break ; + } wqe->req_type =RDMA_SQ_REQ_TYPE_RDMA_WR_WITH_IMM ; rwqe = (struct rdma_sq_rdma_wqe_1st *)wqe;
Greg Kroah-Hartman
maintainerPATCH 222/496 IB/mlx4: Fix corruption of RoCEv2 IPv4 GIDs
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jack Morgenstein <[email protected]>
[ Upstream commit 0077416a3d529baccbe07ab3242e8db541cfadf6 ]
When using IPv4 addresses in RoCEv2, the GID format for the mapped IPv4 address should be: ::ffff:<4-byte IPv4 address>.
In the cited commit, IPv4 mapped IPV6 addresses had the 3 upper dwords zeroed out by memset, which resulted in deleting the ffff field.
However, since procedure ipv6_addr_v4mapped() already verifies that the gid has format ::ffff:<ipv4 address>, no change is needed for the gid, and the memset can simply be removed.
--- drivers/infiniband/hw/mlx4/main.c | 2 -- 1 file changed, 2 deletions(-)
drivers/infiniband/hw/mlx4/main.c +0 -2
@@ -219,8 +219,6 @@ static int mlx4_ib_update_gids_v1_v2(str gid_tbl[i].version =2 ;if (!ipv6_addr_v4mapped ((struct in6_addr *)&gids[i].gid)) gid_tbl[i].type =1 ; -else -memset (&gid_tbl[i].gid,0 ,12 ); } }
Greg Kroah-Hartman
maintainerPATCH 223/496 IB/mlx4: Include GID type when deleting GIDs from HW table under RoCE
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jack M <[email protected]>
[ Upstream commit a18177925c252da7801149abe217c05b80884798 ]
The commit cited below added a gid_type field (RoCEv1 or RoCEv2) to GID properties.
When adding GIDs, this gid_type field was copied over to the hardware gid table. However, when deleting GIDs, the gid_type field was not copied over to the hardware gid table.
As a result, when running RoCEv2, all RoCEv2 gids in the hardware gid table were set to type RoCEv1 when any gid was deleted.
This problem would persist until the next gid was added (which would again restore the gid_type field for all the gids in the hardware gid table).
Fix this by copying over the gid_type field to the hardware gid table when deleting gids, so that the gid_type of all remaining gids is preserved when a gid is deleted.
--- drivers/infiniband/hw/mlx4/main.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/infiniband/hw/mlx4/main.c +7 -2
@@ -364,8 +364,13 @@ static int mlx4_ib_del_gid(struct ib_devif (!gids) { ret = -ENOMEM ; }else { -for (i =0 ; i <MLX4_MAX_PORT_GIDS ; i++) -memcpy (&gids[i].gid, &port_gid_table->gids[i].gid,sizeof (union ib_gid )); +for (i =0 ; i <MLX4_MAX_PORT_GIDS ; i++) { +memcpy (&gids[i].gid, + &port_gid_table->gids[i].gid, +sizeof (union ib_gid )); + gids[i].gid_type = + port_gid_table->gids[i].gid_type; + } } }spin_unlock_bh (&iboe->lock);
Greg Kroah-Hartman
maintainerPATCH 224/496 IB/mlx5: Fix an error code in __mlx5_ib_modify_qp()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 5d414b178e950ce9685c253994cc730893d5d887 ]
"err" is either zero or possibly uninitialized here. It should be -EINVAL.
--- drivers/infiniband/hw/mlx5/qp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/qp.c +3 -1
@@ -2881,8 +2881,10 @@ static int __mlx5_ib_modify_qp(struct ib goto out;if (mlx5_cur >=MLX5_QP_NUM_STATE || mlx5_new >=MLX5_QP_NUM_STATE || - !optab[mlx5_cur][mlx5_new]) + !optab[mlx5_cur][mlx5_new]) { + err = -EINVAL ; goto out; + } op = optab[mlx5_cur][mlx5_new]; optpar =ib_mask_to_mlx5_opt (attr_mask);
Greg Kroah-Hartman
maintainerPATCH 225/496 fbdev: Fixing arbitrary kernel leak in case FBIOGETCMAP_SPARC in sbusfb_ioctl_helper().
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Malone <[email protected]>
[ Upstream commit 250c6c49e3b68756b14983c076183568636e2bde ]
Fixing arbitrary kernel leak in case FBIOGETCMAP_SPARC in sbusfb_ioctl_helper().
'index' is defined as an int in sbusfb_ioctl_helper(). We retrieve this from the user:
if (get_user(index, &c->index) ||
__get_user(count, &c->count) ||
__get_user(ured, &c->red) ||
__get_user(ugreen, &c->green) ||
__get_user(ublue, &c->blue))
return -EFAULT;and then we use 'index' in the following way:
red = cmap->red[index + i] >> 8;
green = cmap->green[index + i] >> 8;
blue = cmap->blue[index + i] >> 8;
This is a classic information leak vulnerability. 'index' should be an unsigned int, given its usage above.
This patch is straight-forward; it changes 'index' to unsigned int in two switch-cases: FBIOGETCMAP_SPARC && FBIOPUTCMAP_SPARC.
This patch fixes CVE-2018-6412.
--- drivers/video/fbdev/sbuslib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/fbdev/sbuslib.c +2 -2
@@ -122,7 +122,7 @@ int sbusfb_ioctl_helper(unsigned long cmunsigned char __user *ured;unsigned char __user *ugreen;unsigned char __user *ublue; -int index, count, i; +unsigned int index, count, i; if (get_user(index, &c->index) || __get_user(count, &c->count) ||
@@ -161,7 +161,7 @@ int sbusfb_ioctl_helper(unsigned long cmunsigned char __user *ugreen;unsigned char __user *ublue;struct fb_cmap *cmap = &info->cmap; -int index, count, i; +unsigned int index, count, i;u8 red, green, blue; if (get_user(index, &c->index) ||
Greg Kroah-Hartman
maintainerPATCH 226/496 fsl/fman: avoid sleeping in atomic context while adding an address
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Denis Kirjanov <[email protected]>
[ Upstream commit 803fafbe0cd522fa6b9e41ca3b96cfb2e2a2222d ]
__dev_mc_add grabs an adress spinlock so use
atomic context in kmalloc.
/ # ifconfig eth0 inet 192.168.0.111
[ 89.331622] BUG: sleeping function called from invalid context at mm/slab.h:420
[ 89.339002] in_atomic(): 1, irqs_disabled(): 0, pid: 1035, name: ifconfig
[ 89.345799] 2 locks held by ifconfig/1035:
[ 89.349908] #0: (rtnl_mutex){+.+.}, at: [<(ptrval)>] devinet_ioctl+0xc0/0x8a0
[ 89.357258] #1: (_xmit_ETHER){+...}, at: [<(ptrval)>] __dev_mc_add+0x28/0x80
[ 89.364520] CPU: 1 PID: 1035 Comm: ifconfig Not tainted 4.16.0-rc3-dirty #8
[ 89.371464] Call Trace:
[ 89.373908] [e959db60] [c066f948] dump_stack+0xa4/0xfc (unreliable)
[ 89.380177] [e959db80] [c00671d8] ___might_sleep+0x248/0x280
[ 89.385833] [e959dba0] [c01aec34] kmem_cache_alloc_trace+0x174/0x320
[ 89.392179] [e959dbd0] [c04ab920] dtsec_add_hash_mac_address+0x130/0x240
[ 89.398874] [e959dc00] [c04a9d74] set_multi+0x174/0x1b0
[ 89.404093] [e959dc30] [c04afb68] dpaa_set_rx_mode+0x68/0xe0
[ 89.409745] [e959dc40] [c057baf8] __dev_mc_add+0x58/0x80
[ 89.415052] [e959dc60] [c060fd64] igmp_group_added+0x164/0x190
[ 89.420878] [e959dca0] [c060ffa8] ip_mc_inc_group+0x218/0x460
[ 89.426617] [e959dce0] [c06120fc] ip_mc_up+0x3c/0x190
[ 89.431662] [e959dd10] [c0607270] inetdev_event+0x250/0x620
[ 89.437227] [e959dd50] [c005f190] notifier_call_chain+0x80/0xf0
[ 89.443138] [e959dd80] [c0573a74] __dev_notify_flags+0x54/0xf0
[ 89.448964] [e959dda0] [c05743f8] dev_change_flags+0x48/0x60
[ 89.454615] [e959ddc0] [c0606744] devinet_ioctl+0x544/0x8a0
[ 89.460180] [e959de10] [c060987c] inet_ioctl+0x9c/0x1f0
[ 89.465400] [e959de80] [c05479a8] sock_ioctl+0x168/0x460
[ 89.470708] [e959ded0] [c01cf3ec] do_vfs_ioctl+0xac/0x8c0
[ 89.476099] [e959df20] [c01cfc40] SyS_ioctl+0x40/0xc0
[ 89.481147] [e959df40] [c0011318] ret_from_syscall+0x0/0x3c
[ 89.486715] --- interrupt: c01 at 0x1006943c
[ 89.486715] LR = 0x100c45ec--- drivers/net/ethernet/freescale/fman/fman_dtsec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/freescale/fman/fman_dtsec.c +1 -1
@@ -1100,7 +1100,7 @@ int dtsec_add_hash_mac_address(struct fmset_bucket (dtsec->regs, bucket, true);/* Create element to be added to the driver hash table */ - hash_entry =kmalloc (sizeof (*hash_entry),GFP_KERNEL ); + hash_entry =kmalloc (sizeof (*hash_entry),GFP_ATOMIC );if (!hash_entry)return -ENOMEM ; hash_entry->addr = addr;
Greg Kroah-Hartman
maintainerPATCH 227/496 qed: Free RoCE ILT Memory on rmmod qedr
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Kalderon <[email protected]>
[ Upstream commit 9de506a547c0d172d13a91d69b1a399e6a2c0efa ]
Rdma requires ILT Memory to be allocated for it's QPs. Each ILT entry points to a page used by several Rdma QPs. To avoid allocating all the memory in advance, the rdma implementation dynamically allocates memory as more QPs are added, however it does not dynamically free the memory. The memory should have been freed on rmmod qedr, but isn't. This patch adds the memory freeing on rmmod qedr (currently it will be freed with qed is removed).
An outcome of this bug, is that if qedr is unloaded and loaded without unloaded qed, there will be no more RoCE traffic.
The reason these are related, is that the logic of detecting the first QP ever opened is by asking whether ILT memory for RoCE has been allocated.
In addition, this patch modifies freeing of the Task context to always use the PROTOCOLID_ROCE and not the protocol passed, this is because task context for iWARP and ROCE both use the ROCE protocol id, as opposed to the connection context.
--- drivers/net/ethernet/qlogic/qed/qed_cxt.c | 5 ++++- drivers/net/ethernet/qlogic/qed/qed_rdma.c | 1 + 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/qlogic/qed/qed_cxt.c +4 -1
@@ -2471,7 +2471,10 @@ int qed_cxt_free_proto_ilt(struct qed_hwif (rc)return rc; -/* Free Task CXT */ +/* Free Task CXT ( Intentionally RoCE as task-id is shared between +* RoCE and iWARP ) +*/ + proto =PROTOCOLID_ROCE ; rc =qed_cxt_free_ilt_range (p_hwfn,QED_ELEM_TASK ,0 ,qed_cxt_get_proto_tid_count (p_hwfn, proto));if (rc)
drivers/net/ethernet/qlogic/qed/qed_rdma.c +1 -0
@@ -360,6 +360,7 @@ static void qed_rdma_free(struct qed_hwfDP_VERBOSE (p_hwfn,QED_MSG_RDMA ,"Freeing RDMA\n" );qed_rdma_resc_free (p_hwfn); +qed_cxt_free_proto_ilt (p_hwfn, p_hwfn->p_rdma_info->proto); }static void qed_rdma_get_guid (struct qed_hwfn *p_hwfn,u8 *guid)
Greg Kroah-Hartman
maintainerPATCH 228/496 net: qcom/emac: Use proper free methods during TX
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hemanth Puranik <[email protected]>
[ Upstream commit cc5db3150e87fe7f7e947bf333b6c1c97f848ecb ]
This patch fixes the warning messages/call traces seen if DMA debug is enabled, In case of fragmented skb's memory was allocated using dma_map_page but freed using dma_unmap_single. This patch modifies buffer allocations in TX path to use dma_map_page in all the places and dma_unmap_page while freeing the buffers.
--- drivers/net/ethernet/qualcomm/emac/emac-mac.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-)
drivers/net/ethernet/qualcomm/emac/emac-mac.c +14 -9
@@ -1204,9 +1204,9 @@ void emac_mac_tx_process(struct emac_adawhile (tx_q->tpd.consume_idx != hw_consume_idx) { tpbuf =GET_TPD_BUFFER (tx_q, tx_q->tpd.consume_idx);if (tpbuf->dma_addr) { -dma_unmap_single (adpt->netdev->dev.parent, - tpbuf->dma_addr, tpbuf->length, -DMA_TO_DEVICE ); +dma_unmap_page (adpt->netdev->dev.parent, + tpbuf->dma_addr, tpbuf->length, +DMA_TO_DEVICE ); tpbuf->dma_addr =0 ; }
@@ -1363,9 +1363,11 @@ static void emac_tx_fill_tpd(struct emac tpbuf =GET_TPD_BUFFER (tx_q, tx_q->tpd.produce_idx); tpbuf->length = mapped_len; - tpbuf->dma_addr =dma_map_single (adpt->netdev->dev.parent, - skb->data, tpbuf->length, -DMA_TO_DEVICE ); + tpbuf->dma_addr =dma_map_page (adpt->netdev->dev.parent, +virt_to_page (skb->data), +offset_in_page (skb->data), + tpbuf->length, +DMA_TO_DEVICE ); ret =dma_mapping_error (adpt->netdev->dev.parent, tpbuf->dma_addr);if (ret)
@@ -1381,9 +1383,12 @@ static void emac_tx_fill_tpd(struct emacif (mapped_len < len) { tpbuf =GET_TPD_BUFFER (tx_q, tx_q->tpd.produce_idx); tpbuf->length = len - mapped_len; - tpbuf->dma_addr =dma_map_single (adpt->netdev->dev.parent, - skb->data + mapped_len, - tpbuf->length,DMA_TO_DEVICE ); + tpbuf->dma_addr =dma_map_page (adpt->netdev->dev.parent, +virt_to_page (skb->data + + mapped_len), +offset_in_page (skb->data + + mapped_len), + tpbuf->length,DMA_TO_DEVICE ); ret =dma_mapping_error (adpt->netdev->dev.parent, tpbuf->dma_addr);if (ret)
Greg Kroah-Hartman
maintainerPATCH 229/496 net: smsc911x: Fix unload crash when link is up
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeremy Linton <[email protected]>
[ Upstream commit e06513d78d54e6c7026c9043a39e2c01ee25bdbe ]
The smsc911x driver will crash if it is rmmod'ed while the netdev is up like:
Call trace: phy_detach+0x94/0x150 phy_disconnect+0x40/0x50 smsc911x_stop+0x104/0x128 [smsc911x] __dev_close_many+0xb4/0x138 dev_close_many+0xbc/0x190 rollback_registered_many+0x140/0x460 rollback_registered+0x68/0xb0 unregister_netdevice_queue+0x100/0x118 unregister_netdev+0x28/0x38 smsc911x_drv_remove+0x58/0x130 [smsc911x] platform_drv_remove+0x30/0x50 device_release_driver_internal+0x15c/0x1f8 driver_detach+0x54/0x98 bus_remove_driver+0x64/0xe8 driver_unregister+0x34/0x60 platform_driver_unregister+0x20/0x30 smsc911x_cleanup_module+0x14/0xbca8 [smsc911x] SyS_delete_module+0x1e8/0x238 __sys_trace_return+0x0/0x4
This is caused by the mdiobus being unregistered/free'd and the code in phy_detach() attempting to manipulate mdio related structures from unregister_netdev() calling close()
To fix this, we delay the mdiobus teardown until after the netdev is deregistered.
--- drivers/net/ethernet/smsc/smsc911x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/smsc/smsc911x.c +2 -2
@@ -2335,14 +2335,14 @@ static int smsc911x_drv_remove(struct pl pdata =netdev_priv (dev);BUG_ON (!pdata);BUG_ON (!pdata->ioaddr); -WARN_ON (dev->phydev);SMSC_TRACE (pdata, ifdown,"Stopping driver" ); +unregister_netdev (dev); +mdiobus_unregister (pdata->mii_bus);mdiobus_free (pdata->mii_bus); -unregister_netdev (dev); res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"smsc911x-memory" );if (!res)
Greg Kroah-Hartman
maintainerPATCH 230/496 IB/core: Fix possible crash to access NULL netdev
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Parav Pandit <[email protected]>
[ Upstream commit bb7f8f199c354c4cf155b1d6d55f86eaaed7fa5a ]
resolved_dev returned might be NULL as ifindex is transient number. Ignoring NULL check of resolved_dev might crash the kernel. Therefore perform NULL check before accessing resolved_dev.
Additionally rdma_resolve_ip_route() invokes addr_resolve() which performs check and address translation for loopback ifindex. Therefore, checking it again in rdma_resolve_ip_route() is not helpful. Therefore, the code is simplified to avoid IFF_LOOPBACK check.
--- drivers/infiniband/core/sa_query.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/infiniband/core/sa_query.c +3 -4
@@ -1291,10 +1291,9 @@ int ib_init_ah_from_path(struct ib_devic resolved_dev =dev_get_by_index (dev_addr.net, dev_addr.bound_dev_if); -if (resolved_dev->flags &IFF_LOOPBACK ) { -dev_put (resolved_dev); - resolved_dev = idev; -dev_hold (resolved_dev); +if (!resolved_dev) { +dev_put (idev); +return -ENODEV ; } ndev =ib_get_ndev_from_path (rec);rcu_read_lock ();
Greg Kroah-Hartman
maintainerPATCH 231/496 cxgb4: do not set needs_free_netdev for mgmt devs
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ganesh Goudar <[email protected]>
[ Upstream commit b06ef18a4c255609388ed6e068a1c69c797545e0 ]
Do not set 'needs_free_netdev' as we do call free_netdev for mgmt net devices, doing both hits BUG_ON.
--- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +0 -1
@@ -4679,7 +4679,6 @@ static void dummy_setup(struct net_devic/* Initialize the device structure. */ dev->netdev_ops = &cxgb4_mgmt_netdev_ops; dev->ethtool_ops = &cxgb4_mgmt_ethtool_ops; - dev->needs_free_netdev = true; }static int config_mgmt_dev (struct pci_dev *pdev)
Greg Kroah-Hartman
maintainerPATCH 232/496 xen-blkfront: move negotiate_mq to cover all cases of new VBDs
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bhavesh Davda <[email protected]>
[ Upstream commit 7ed8ce1c5fc7cf25b3602c73bef897a3466a6645 ]
negotiate_mq should happen in all cases of a new VBD being discovered by xen-blkfront, whether called through _probe() or a hot-attached new VBD from dom-0 via xenstore. Otherwise, hot-attached new VBDs are left configured without multi-queue.
--- drivers/block/xen-blkfront.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/block/xen-blkfront.c +8 -9
@@ -262,6 +262,7 @@ static DEFINE_SPINLOCK(minor_lock);static int blkfront_setup_indirect (struct blkfront_ring_info *rinfo);static void blkfront_gather_backend_features (struct blkfront_info *info); +static int negotiate_mq (struct blkfront_info *info);static int get_id_from_freelist (struct blkfront_ring_info *rinfo) {
@@ -1774,11 +1775,18 @@ static int talk_to_blkback(struct xenbusunsigned int i, max_page_order;unsigned int ring_page_order; +if (!info) +return -ENODEV ; + max_page_order =xenbus_read_unsigned (info->xbdev->otherend,"max-ring-page-order" ,0 ); ring_page_order =min (xen_blkif_max_ring_order, max_page_order); info->nr_ring_pages =1 << ring_page_order; + err =negotiate_mq (info); +if (err) + goto destroy_blkring; +for (i =0 ; i < info->nr_rings; i++) {struct blkfront_ring_info *rinfo = &info->rinfo[i];
@@ -1978,11 +1986,6 @@ static int blkfront_probe(struct xenbus_ } info->xbdev = dev; - err =negotiate_mq (info); -if (err) { -kfree (info); -return err; - }mutex_init (&info->mutex); info->vdevice = vdevice;
@@ -2099,10 +2102,6 @@ static int blkfront_resume(struct xenbusblkif_free (info, info->connected ==BLKIF_STATE_CONNECTED ); - err =negotiate_mq (info); -if (err) -return err; - err =talk_to_blkback (dev, info);if (!err)blk_mq_update_nr_hw_queues (&info->tag_set, info->nr_rings);
Greg Kroah-Hartman
maintainerPATCH 233/496 xen: xenbus: use put_device() instead of kfree()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arvind Yadav <[email protected]>
[ Upstream commit 351b2bccede1cb673ec7957b35ea997ea24c8884 ]
Never directly free @dev after calling device_register(), even if it returned an error! Always use put_device() to give up the reference initialized.
--- drivers/xen/xenbus/xenbus_probe.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/xen/xenbus/xenbus_probe.c +4 -1
@@ -466,8 +466,11 @@ int xenbus_probe_node(struct xen_bus_typ/* Register with generic device framework. */ err =device_register (&xendev->dev); -if (err) +if (err) { +put_device (&xendev->dev); + xendev =NULL ; goto fail; + }return 0 ; fail:
Greg Kroah-Hartman
maintainerPATCH 234/496 hv_netvsc: fix filter flags
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Hemminger <[email protected]>
[ Upstream commit de3d50aadd40bf68614db9fd157b275ce9c2d467 ]
The recent change to not always enable all multicast and broadcast was broken; meant to set filter, not change flags.
--- drivers/net/hyperv/rndis_filter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/hyperv/rndis_filter.c +2 -2
@@ -857,9 +857,9 @@ static void rndis_set_multicast(struct w filter =NDIS_PACKET_TYPE_PROMISCUOUS ; }else {if (flags &IFF_ALLMULTI ) - flags |=NDIS_PACKET_TYPE_ALL_MULTICAST ; + filter |=NDIS_PACKET_TYPE_ALL_MULTICAST ;if (flags &IFF_BROADCAST ) - flags |=NDIS_PACKET_TYPE_BROADCAST ; + filter |=NDIS_PACKET_TYPE_BROADCAST ; }rndis_filter_set_packet_filter (rdev, filter);
Greg Kroah-Hartman
maintainerPATCH 235/496 hv_netvsc: fix locking for rx_mode
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Hemminger <[email protected]>
[ Upstream commit 35a57b7fef136fa3d5b735ba773f191b95110fa0 ]
The rx_mode operation handler is different than other callbacks in that is not always called with rtnl held. Therefore use RCU to ensure that references are valid.
--- drivers/net/hyperv/netvsc_drv.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/net/hyperv/netvsc_drv.c +8 -3
@@ -89,15 +89,20 @@ static void netvsc_change_rx_flags(strucstatic void netvsc_set_rx_mode (struct net_device *net) {struct net_device_context *ndev_ctx =netdev_priv (net); -struct net_device *vf_netdev =rtnl_dereference (ndev_ctx->vf_netdev); -struct netvsc_device *nvdev =rtnl_dereference (ndev_ctx->nvdev); +struct net_device *vf_netdev; +struct netvsc_device *nvdev; +rcu_read_lock (); + vf_netdev =rcu_dereference (ndev_ctx->vf_netdev);if (vf_netdev) {dev_uc_sync (vf_netdev, net);dev_mc_sync (vf_netdev, net); } -rndis_filter_update (nvdev); + nvdev =rcu_dereference (ndev_ctx->nvdev); +if (nvdev) +rndis_filter_update (nvdev); +rcu_read_unlock (); }static int netvsc_open (struct net_device *net)
Greg Kroah-Hartman
maintainerPATCH 236/496 hv_netvsc: fix locking during VF setup
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Hemminger <[email protected]>
[ Upstream commit b0dee7910317f41f398838992516af6a3b981d86 ]
The dev_uc/mc_sync calls need to have the device address list locked. This was spotted by running with lockdep enabled.
--- drivers/net/hyperv/netvsc_drv.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/hyperv/netvsc_drv.c +4 -0
@@ -1848,8 +1848,12 @@ static void __netvsc_vf_setup(struct net/* set multicast etc flags on VF */ dev_change_flags (vf_netdev, ndev->flags |IFF_SLAVE ); + +/* sync address list from ndev to VF */ +netif_addr_lock_bh (ndev);dev_uc_sync (vf_netdev, ndev);dev_mc_sync (vf_netdev, ndev); +netif_addr_unlock_bh (ndev);if (netif_running (ndev)) { ret =dev_open (vf_netdev);
Greg Kroah-Hartman
maintainerPATCH 237/496 ARM: davinci: fix the GPIO lookup for omapl138-hawk
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bartosz Golaszewski <[email protected]>
[ Upstream commit c4dc56be7e26040bfc60ce73425353516a356955 ]
The GPIO chip is called davinci_gpio.0 in legacy mode. Fix it, so that mmc can correctly lookup the wp and cp gpios.
Note that it is the gpio-davinci driver that sets the gpiochip label to davinci_gpio.0.
--- arch/arm/mach-davinci/board-omapl138-hawk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-davinci/board-omapl138-hawk.c +2 -2
@@ -127,8 +127,8 @@ static struct gpiod_lookup_table mmc_gpi .dev_id = "da830-mmc.0", .table = {/* CD: gpio3_12: gpio60: chip 1 contains gpio range 32-63*/ -GPIO_LOOKUP ("davinci_gpio.1" ,28 ,"cd" ,GPIO_ACTIVE_LOW ), - GPIO_LOOKUP("davinci_gpio.1", 29, "wp", GPIO_ACTIVE_LOW), +GPIO_LOOKUP ("davinci_gpio.0" ,28 ,"cd" ,GPIO_ACTIVE_LOW ), + GPIO_LOOKUP("davinci_gpio.0", 29, "wp", GPIO_ACTIVE_LOW), }, };
Greg Kroah-Hartman
maintainerPATCH 238/496 arm64: Relax ARM_SMCCC_ARCH_WORKAROUND_1 discovery
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marc Zyngier <[email protected]>
[ Upstream commit e21da1c992007594d391e7b301779cf30f438691 ]
A recent update to the ARM SMCCC ARCH_WORKAROUND_1 specification allows firmware to return a non zero, positive value to describe that although the mitigation is implemented at the higher exception level, the CPU on which the call is made is not affected.
Let's relax the check on the return value from ARCH_WORKAROUND_1 so that we only error out if the returned value is negative.
--- arch/arm64/kernel/cpu_errata.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/kernel/cpu_errata.c +2 -2
@@ -178,7 +178,7 @@ static int enable_smccc_arch_workaround_case PSCI_CONDUIT_HVC :arm_smccc_1_1_hvc (ARM_SMCCC_ARCH_FEATURES_FUNC_ID ,ARM_SMCCC_ARCH_WORKAROUND_1 , &res); -if (res.a0) +if ((int )res.a0 <0 )return 0 ; cb = call_hvc_arch_workaround_1; smccc_start = __smccc_workaround_1_hvc_start;
@@ -188,7 +188,7 @@ static int enable_smccc_arch_workaround_case PSCI_CONDUIT_SMC :arm_smccc_1_1_smc (ARM_SMCCC_ARCH_FEATURES_FUNC_ID ,ARM_SMCCC_ARCH_WORKAROUND_1 , &res); -if (res.a0) +if ((int )res.a0 <0 )return 0 ; cb = call_smc_arch_workaround_1; smccc_start = __smccc_workaround_1_smc_start;
Greg Kroah-Hartman
maintainerPATCH 239/496 selftests/vm/run_vmtests: adjust hugetlb size according to nr_cpus
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Zhijian <[email protected]>
[ Upstream commit 0627be7d3c871035364923559543c9b2ff5357f2 ]
Fix userfaultfd_hugetlb on hosts which have more than 64 cpus.
---------------------------
running userfaultfd_hugetlb
---------------------------
invalid MiB
Usage: <MiB> <bounces>
[FAIL]
Via userfaultfd.c we can know, hugetlb_size needs to meet hugetlb_size
Quoted 1 line
=
nr_cpus*hugepage_size.hugepage_sizeis often 2M, so when host
cpus > 64, it requires more than 128M.
--- tools/testing/selftests/vm/run_vmtests | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-)
tools/testing/selftests/vm/run_vmtests +17 -8
@@ -2,25 +2,33 @@ # SPDX-License-Identifier: GPL-2.0 #please run as root -#we need 256M, below is the size in kB -needmem=262144 mnt=./huge exitcode=0 -#get pagesize and freepages from /proc/meminfo +#get huge pagesize and freepages from /proc/meminfo while read name size unit; do if [ "$name" = "HugePages_Free:" ]; then freepgs=$size fi if [ "$name" = "Hugepagesize:" ]; then - pgsize=$size + hpgsize_KB=$size fi done < /proc/meminfo +# Simple hugetlbfs tests have a hardcoded minimum requirement of +# huge pages totaling 256MB (262144KB) in size. The userfaultfd +# hugetlb test requires a minimum of 2 * nr_cpus huge pages. Take +# both of these requirements into account and attempt to increase +# number of huge pages available. +nr_cpus=$(nproc) +hpgsize_MB=$((hpgsize_KB / 1024)) +half_ufd_size_MB=$((((nr_cpus * hpgsize_MB + 127) / 128) * 128)) +needmem_KB=$((half_ufd_size_MB * 2 * 1024)) + #set proper nr_hugepages -if [ -n "$freepgs" ] && [ -n "$pgsize" ]; then +if [ -n "$freepgs" ] && [ -n "$hpgsize_KB" ]; then nr_hugepgs=`cat /proc/sys/vm/nr_hugepages` - needpgs=`expr $needmem / $pgsize` + needpgs=$((needmem_KB / hpgsize_KB)) tries=2 while [ $tries -gt 0 ] && [ $freepgs -lt $needpgs ]; do lackpgs=$(( $needpgs - $freepgs ))
@@ -107,8 +115,9 @@ fi echo "---------------------------" echo "running userfaultfd_hugetlb" echo "---------------------------" -# 256MB total huge pages == 128MB src and 128MB dst -./userfaultfd hugetlb 128 32 $mnt/ufd_test_file +# Test requires source and destination huge pages. Size of source +# (half_ufd_size_MB) is passed as argument to test. +./userfaultfd hugetlb $half_ufd_size_MB 32 $mnt/ufd_test_file if [ $? -ne 0 ]; then echo "[FAIL]" exitcode=1
Greg Kroah-Hartman
maintainerPATCH 240/496 lib/test_kmod.c: fix limit check on number of test devices created
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Luis R. Rodriguez" <[email protected]>
[ Upstream commit ac68b1b3b9c73e652dc7ce0585672e23c5a2dca4 ]
As reported by Dan the parentheses is in the wrong place, and since unlikely() call returns either 0 or 1 it's never less than zero. The second issue is that signed integer overflows like "INT_MAX + 1" are undefined behavior.
Since num_test_devs represents the number of devices, we want to stop prior to hitting the max, and not rely on the wrap arround at all. So just cap at num_test_devs + 1, prior to assigning a new device.
--- lib/test_kmod.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/test_kmod.c +1 -1
@@ -1149,7 +1149,7 @@ static struct kmod_test_device *registermutex_lock (®_dev_mutex);/* int should suffice for number of devices, test for wrap */ -if (unlikely (num_test_devs +1 ) <0 ) { +if (num_test_devs +1 ==INT_MAX ) {pr_err ("reached limit of number of test devices\n" ); goto out; }
Greg Kroah-Hartman
maintainerPATCH 241/496 dmaengine: mv_xor_v2: Fix clock resource by adding a register clock
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gregory CLEMENT <[email protected]>
[ Upstream commit 3cd2c313f1d618f92d1294addc6c685c17065761 ]
On the CP110 components which are present on the Armada 7K/8K SoC we need to explicitly enable the clock for the registers. However it is not needed for the AP8xx component, that's why this clock is optional.
With this patch both clock have now a name, but in order to be backward compatible, the name of the first clock is not used. It allows to still use this clock with a device tree using the old binding.
--- Documentation/devicetree/bindings/dma/mv-xor-v2.txt | 6 ++++ drivers/dma/mv_xor_v2.c | 25 ++++++++++++++++---- 2 files changed, 25 insertions(+), 6 deletions(-)
Documentation/devicetree/bindings/dma/mv-xor-v2.txt +5 -1
@@ -11,7 +11,11 @@ Required properties: interrupts. Optional properties: -- clocks: Optional reference to the clock used by the XOR engine. +- clocks: Optional reference to the clocks used by the XOR engine. +- clock-names: mandatory if there is a second clock, in this case the + name must be "core" for the first clock and "reg" for the second + one + Example:
drivers/dma/mv_xor_v2.c +20 -5
@@ -163,6 +163,7 @@ struct mv_xor_v2_device {void __iomem *dma_base;void __iomem *glob_base;struct clk *clk; +struct clk *reg_clk;struct tasklet_struct irq_tasklet;struct list_head free_sw_desc;struct dma_device dmadev;
@@ -749,13 +750,26 @@ static int mv_xor_v2_probe(struct platfoif (ret)return ret; + xor_dev->reg_clk =devm_clk_get (&pdev->dev,"reg" ); +if (PTR_ERR (xor_dev->reg_clk) != -ENOENT ) { +if (!IS_ERR (xor_dev->reg_clk)) { + ret =clk_prepare_enable (xor_dev->reg_clk); +if (ret) +return ret; + }else { +return PTR_ERR (xor_dev->reg_clk); + } + } + xor_dev->clk =devm_clk_get (&pdev->dev,NULL ); -if (IS_ERR (xor_dev->clk) &&PTR_ERR (xor_dev->clk) == -EPROBE_DEFER ) -return -EPROBE_DEFER ; +if (IS_ERR (xor_dev->clk) &&PTR_ERR (xor_dev->clk) == -EPROBE_DEFER ) { + ret =EPROBE_DEFER ; + goto disable_reg_clk; + }if (!IS_ERR (xor_dev->clk)) { ret =clk_prepare_enable (xor_dev->clk);if (ret) -return ret; + goto disable_reg_clk; } ret = platform_msi_domain_alloc_irqs(&pdev->dev, 1,
@@ -866,8 +880,9 @@ free_hw_desq: free_msi_irqs:platform_msi_domain_free_irqs (&pdev->dev); disable_clk: -if (!IS_ERR (xor_dev->clk)) -clk_disable_unprepare (xor_dev->clk); +clk_disable_unprepare (xor_dev->clk); +disable_reg_clk: +clk_disable_unprepare (xor_dev->reg_clk);return ret; }
Greg Kroah-Hartman
maintainerPATCH 242/496 netfilter: ebtables: fix erroneous reject of last rule
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit 932909d9b28d27e807ff8eecb68c7748f6701628 ]
The last rule in the blob has next_entry offset that is same as total size. This made "ebtables32 -A OUTPUT -d de:ad:be:ef:01:02" fail on 64 bit kernel.
--- net/bridge/netfilter/ebtables.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/bridge/netfilter/ebtables.c +5 -1
@@ -2124,8 +2124,12 @@ static int size_entry_mwt(struct ebt_ent* offsets are relative to beginning of struct ebt_entry (i.e., 0). */ for (i =0 ; i <4 ; ++i) { -if (offsets[i] >= *total) +if (offsets[i] > *total)return -EINVAL ; + +if (i <3 && offsets[i] == *total) +return -EINVAL ; +if (i ==0 )continue ;if (offsets[i-1 ] > offsets[i])
Greg Kroah-Hartman
maintainerPATCH 243/496 can: m_can: change comparison to bitshift when dealing with a mask
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
[ Upstream commit b7db978ac283b237835129ac87f26cbac94d04e7 ]
Due to a typo, the mask was destroyed by a comparison instead of a bit shift.
--- drivers/net/can/m_can/m_can.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/m_can/m_can.c +1 -1
@@ -246,7 +246,7 @@ enum m_can_mram_cfg {/* Rx FIFO 0/1 Configuration (RXF0C/RXF1C) */ #define RXFC_FWM_SHIFT 24 -#define RXFC_FWM_MASK (0x7f < RXFC_FWM_SHIFT) +#define RXFC_FWM_MASK (0x7f << RXFC_FWM_SHIFT)#define RXFC_FS_SHIFT 16#define RXFC_FS_MASK (0x7f << RXFC_FS_SHIFT)
Greg Kroah-Hartman
maintainerPATCH 244/496 can: m_can: select pinctrl state in each suspend/resume function
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bich HEMON <[email protected]>
[ Upstream commit c9b3bce18da4a0aebc27853052dea39aa64b7d75 ]
Make sure to apply the correct pin state in suspend/resume callbacks. Putting pins in sleep state saves power.
--- drivers/net/can/m_can/m_can.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/can/m_can/m_can.c +5 -0
@@ -25,6 +25,7 @@#include <linux/platform_device.h> #include <linux/iopoll.h> #include <linux/can/dev.h> +#include <linux/pinctrl/consumer.h> /* napi related */ #define M_CAN_NAPI_WEIGHT 64
@@ -1682,6 +1683,8 @@ static __maybe_unused int m_can_suspend(m_can_clk_stop (priv); } +pinctrl_pm_select_sleep_state (dev); + priv->can.state =CAN_STATE_SLEEPING ;return 0 ;
@@ -1692,6 +1695,8 @@ static __maybe_unused int m_can_resume(sstruct net_device *ndev =dev_get_drvdata (dev);struct m_can_priv *priv =netdev_priv (ndev); +pinctrl_pm_select_default_state (dev); +m_can_init_ram (priv); priv->can.state =CAN_STATE_ERROR_ACTIVE ;
Greg Kroah-Hartman
maintainerPATCH 245/496 bnxt_en: Check valid VNIC ID in bnxt_hwrm_vnic_set_tpa().
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Chan <[email protected]>
[ Upstream commit 3c4fe80b32c685bdc02b280814d0cfe80d441c72 ]
During initialization, if we encounter errors, there is a code path that calls bnxt_hwrm_vnic_set_tpa() with invalid VNIC ID. This may cause a warning in firmware logs.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +3 -0
@@ -3808,6 +3808,9 @@ static int bnxt_hwrm_vnic_set_tpa(structstruct bnxt_vnic_info *vnic = &bp->vnic_info[vnic_id];struct hwrm_vnic_tpa_cfg_input req = {0 }; +if (vnic->fw_vnic_id ==INVALID_HW_RING_ID ) +return 0 ; +bnxt_hwrm_cmd_hdr_init (bp, &req,HWRM_VNIC_TPA_CFG ,-1 ,-1 );if (tpa_flags) {
Greg Kroah-Hartman
maintainerPATCH 246/496 workqueue: use put_device() instead of kfree()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arvind Yadav <[email protected]>
[ Upstream commit 537f4146c53c95aac977852b371bafb9c6755ee1 ]
Never directly free @dev after calling device_register(), even if it returned an error! Always use put_device() to give up the reference initialized in this function instead.
--- kernel/workqueue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/workqueue.c +1 -1
@@ -5350,7 +5350,7 @@ int workqueue_sysfs_register(struct work ret =device_register (&wq_dev->dev);if (ret) { -kfree (wq_dev); +put_device (&wq_dev->dev); wq->wq_dev =NULL ;return ret; }
Greg Kroah-Hartman
maintainerPATCH 247/496 ipv4: lock mtu in fnhe when received PMTU < net.ipv4.route.min_pmtu
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sabrina Dubroca <[email protected]>
[ Upstream commit d52e5a7e7ca49457dd31fc8b42fb7c0d58a31221 ]
Prior to the rework of PMTU information storage in commit 2c8cec5c10bc ("ipv4: Cache learned PMTU information in inetpeer."), when a PMTU event advertising a PMTU smaller than net.ipv4.route.min_pmtu was received, we would disable setting the DF flag on packets by locking the MTU metric, and set the PMTU to net.ipv4.route.min_pmtu.
Since then, we don't disable DF, and set PMTU to net.ipv4.route.min_pmtu, so the intermediate router that has this link with a small MTU will have to drop the packets.
This patch reestablishes pre-2.6.39 behavior by splitting rtable->rt_pmtu into a bitfield with rt_mtu_locked and rt_pmtu. rt_mtu_locked indicates that we shouldn't set the DF bit on that path, and is checked in ip_dont_fragment().
One possible workaround is to set net.ipv4.route.min_pmtu to a value low enough to accommodate the lowest MTU encountered.
--- include/net/ip.h | 11 +++++++++-- include/net/ip_fib.h | 1 + include/net/route.h | 3 ++- net/ipv4/route.c | 26 +++++++++++++++++++------- net/ipv4/xfrm4_policy.c | 1 + 5 files changed, 32 insertions(+), 10 deletions(-)
include/net/ip.h +9 -2
@@ -326,6 +326,13 @@ int ip_decrease_ttl(struct iphdr *iph)return --iph->ttl; } +static inline int ip_mtu_locked (const struct dst_entry *dst) +{ +const struct rtable *rt = (const struct rtable *)dst; + +return rt->rt_mtu_locked ||dst_metric_locked (dst,RTAX_MTU ); +} +static inline int ip_dont_fragment (const struct sock *sk,const struct dst_entry *dst) {
@@ -333,7 +340,7 @@ int ip_dont_fragment(const struct sock *return pmtudisc ==IP_PMTUDISC_DO || (pmtudisc ==IP_PMTUDISC_WANT && - !(dst_metric_locked (dst,RTAX_MTU ))); + !ip_mtu_locked (dst)); }static inline bool ip_sk_accept_pmtu (const struct sock *sk)
@@ -359,7 +366,7 @@ static inline unsigned int ip_dst_mtu_mastruct net *net =dev_net (dst->dev);if (net->ipv4.sysctl_ip_fwd_use_pmtu || -dst_metric_locked (dst,RTAX_MTU ) || +ip_mtu_locked (dst) || !forwarding)return dst_mtu (dst);
include/net/ip_fib.h +1 -0
@@ -59,6 +59,7 @@ struct fib_nh_exception {int fnhe_genid;__be32 fnhe_daddr;u32 fnhe_pmtu; +bool fnhe_mtu_locked;__be32 fnhe_gw;unsigned long fnhe_expires;struct rtable __rcu *fnhe_rth_input;
include/net/route.h +2 -1
@@ -63,7 +63,8 @@ struct rtable {__be32 rt_gateway;/* Miscellaneous cached information */ -u32 rt_pmtu; + u32 rt_mtu_locked:1, + rt_pmtu:31;u32 rt_table_id;
net/ipv4/route.c +19 -7
@@ -639,6 +639,7 @@ static inline u32 fnhe_hashfun(__be32 dastatic void fill_route_from_fnhe (struct rtable *rt,struct fib_nh_exception *fnhe) { rt->rt_pmtu = fnhe->fnhe_pmtu; + rt->rt_mtu_locked = fnhe->fnhe_mtu_locked; rt->dst.expires = fnhe->fnhe_expires;if (fnhe->fnhe_gw) {
@@ -649,7 +650,7 @@ static void fill_route_from_fnhe(struct }static void update_or_create_fnhe (struct fib_nh *nh,__be32 daddr,__be32 gw, -u32 pmtu,unsigned long expires) +u32 pmtu,bool lock,unsigned long expires) {struct fnhe_hash_bucket *hash;struct fib_nh_exception *fnhe;
@@ -686,8 +687,10 @@ static void update_or_create_fnhe(struct fnhe->fnhe_genid = genid;if (gw) fnhe->fnhe_gw = gw; -if (pmtu) +if (pmtu) { fnhe->fnhe_pmtu = pmtu; + fnhe->fnhe_mtu_locked = lock; + } fnhe->fnhe_expires =max (1UL , expires);/* Update all cached dsts too */ rt =rcu_dereference (fnhe->fnhe_rth_input);
@@ -711,6 +714,7 @@ static void update_or_create_fnhe(struct fnhe->fnhe_daddr = daddr; fnhe->fnhe_gw = gw; fnhe->fnhe_pmtu = pmtu; + fnhe->fnhe_mtu_locked = lock; fnhe->fnhe_expires =max (1UL , expires);/* Exception created; mark the cached routes for the nexthop
@@ -792,7 +796,8 @@ static void __ip_do_redirect(struct rtabstruct fib_nh *nh = &FIB_RES_NH (res);update_or_create_fnhe (nh, fl4->daddr, new_gw, -0 , jiffies + ip_rt_gc_timeout); +0 , false, + jiffies + ip_rt_gc_timeout); }if (kill_route) rt->dst.obsolete =DST_OBSOLETE_KILL ;
@@ -1005,15 +1010,18 @@ static void __ip_rt_update_pmtu(struct r {struct dst_entry *dst = &rt->dst;struct fib_result res; +bool lock = false; -if (dst_metric_locked (dst,RTAX_MTU )) +if (ip_mtu_locked (dst))return ;if (ipv4_mtu (dst) < mtu)return ; -if (mtu < ip_rt_min_pmtu) +if (mtu < ip_rt_min_pmtu) { + lock = true; mtu = ip_rt_min_pmtu; + }if (rt->rt_pmtu == mtu &&time_before (jiffies, dst->expires - ip_rt_mtu_expires /2 ))
@@ -1023,7 +1031,7 @@ static void __ip_rt_update_pmtu(struct rif (fib_lookup (dev_net (dst->dev), fl4, &res,0 ) ==0 ) {struct fib_nh *nh = &FIB_RES_NH (res); -update_or_create_fnhe (nh, fl4->daddr,0 , mtu, +update_or_create_fnhe (nh, fl4->daddr,0 , mtu, lock, jiffies + ip_rt_mtu_expires); }rcu_read_unlock ();
@@ -1276,7 +1284,7 @@ static unsigned int ipv4_mtu(const struc mtu =READ_ONCE (dst->dev->mtu); -if (unlikely (dst_metric_locked (dst,RTAX_MTU ))) { +if (unlikely (ip_mtu_locked (dst))) {if (rt->rt_uses_gateway && mtu >576 ) mtu =576 ; }
@@ -1548,6 +1556,7 @@ struct rtable *rt_dst_alloc(struct net_d rt->rt_is_input =0 ; rt->rt_iif =0 ; rt->rt_pmtu =0 ; + rt->rt_mtu_locked =0 ; rt->rt_gateway =0 ; rt->rt_uses_gateway =0 ; rt->rt_table_id =0 ;
@@ -2526,6 +2535,7 @@ struct dst_entry *ipv4_blackhole_route(s rt->rt_is_input = ort->rt_is_input; rt->rt_iif = ort->rt_iif; rt->rt_pmtu = ort->rt_pmtu; + rt->rt_mtu_locked = ort->rt_mtu_locked; rt->rt_genid =rt_genid_ipv4 (net); rt->rt_flags = ort->rt_flags;
@@ -2628,6 +2638,8 @@ static int rt_fill_info(struct net *net,memcpy (metrics,dst_metrics_ptr (&rt->dst),sizeof (metrics));if (rt->rt_pmtu && expires) metrics[RTAX_MTU -1 ] = rt->rt_pmtu; +if (rt->rt_mtu_locked && expires) + metrics[RTAX_LOCK -1 ] |=BIT (RTAX_MTU );if (rtnetlink_put_metrics (skb, metrics) <0 ) goto nla_put_failure;
net/ipv4/xfrm4_policy.c +1 -0
@@ -100,6 +100,7 @@ static int xfrm4_fill_dst(struct xfrm_ds xdst->u.rt.rt_gateway = rt->rt_gateway; xdst->u.rt.rt_uses_gateway = rt->rt_uses_gateway; xdst->u.rt.rt_pmtu = rt->rt_pmtu; + xdst->u.rt.rt_mtu_locked = rt->rt_mtu_locked; xdst->u.rt.rt_table_id = rt->rt_table_id;INIT_LIST_HEAD (&xdst->u.rt.rt_uncached);
Greg Kroah-Hartman
maintainerPATCH 248/496 sunvnet: does not support GSO for sctp
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cathy Zhou <[email protected]>
[ Upstream commit cf55612a945039476abfd73e39064b2e721c3272 ]
The NETIF_F_GSO_SOFTWARE implies support for GSO on SCTP, but the sunvnet driver does not support GSO for sctp. Here we remove the NETIF_F_GSO_SOFTWARE feature flag and only report NETIF_F_ALL_TSO instead.
--- drivers/net/ethernet/sun/sunvnet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/sun/sunvnet.c +1 -1
@@ -311,7 +311,7 @@ static struct vnet *vnet_new(const u64 * dev->ethtool_ops = &vnet_ethtool_ops; dev->watchdog_timeo =VNET_TX_TIMEOUT ; - dev->hw_features =NETIF_F_TSO |NETIF_F_GSO |NETIF_F_GSO_SOFTWARE | + dev->hw_features =NETIF_F_TSO |NETIF_F_GSO |NETIF_F_ALL_TSO |NETIF_F_HW_CSUM |NETIF_F_SG ; dev->features = dev->hw_features;
Greg Kroah-Hartman
maintainerPATCH 249/496 KVM: arm/arm64: vgic: Add missing irq_lock to vgic_mmio_read_pending
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andre Przywara <[email protected]>
[ Upstream commit 62b06f8f429cd233e4e2e7bbd21081ad60c9018f ]
Our irq_is_pending() helper function accesses multiple members of the vgic_irq struct, so we need to hold the lock when calling it. Add that requirement as a comment to the definition and take the lock around the call in vgic_mmio_read_pending(), where we were missing it before.
--- virt/kvm/arm/vgic/vgic-mmio.c | 3 +++ virt/kvm/arm/vgic/vgic.h | 1 + 2 files changed, 4 insertions(+)
virt/kvm/arm/vgic/vgic-mmio.c +3 -0
@@ -110,9 +110,12 @@ unsigned long vgic_mmio_read_pending(str/* Loop over all IRQs affected by this read */ for (i =0 ; i < len *8 ; i++) {struct vgic_irq *irq =vgic_get_irq (vcpu->kvm, vcpu, intid + i); +unsigned long flags; +spin_lock_irqsave (&irq->irq_lock, flags);if (irq_is_pending (irq)) value |= (1U << i); +spin_unlock_irqrestore (&irq->irq_lock, flags);vgic_put_irq (vcpu->kvm, irq); }
virt/kvm/arm/vgic/vgic.h +1 -0
@@ -96,6 +96,7 @@/* we only support 64 kB translation table page size */ #define KVM_ITS_L1E_ADDR_MASK GENMASK_ULL(51, 16) +/* Requires the irq_lock to be held by the caller. */ static inline bool irq_is_pending (struct vgic_irq *irq) {if (irq->config ==VGIC_CONFIG_EDGE )
Greg Kroah-Hartman
maintainerPATCH 250/496 gpu: ipu-v3: prg: avoid possible array underflow
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 746d024c3211813946b319411aeb2b47767f8fb0 ]
gcc-8 reports that we access an array with a negative index in an error case:
drivers/gpu/ipu-v3/ipu-prg.c: In function 'ipu_prg_channel_disable':drivers/gpu/ipu-v3/ipu-prg.c:252:43: error: array subscript -22 is below array bounds of 'struct ipu_prg_channel[3]' [-Werror=array-bounds]
This moves the range check in front of the first time that variable gets used.
--- drivers/gpu/ipu-v3/ipu-prg.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/gpu/ipu-v3/ipu-prg.c +9 -3
@@ -252,10 +252,14 @@ void ipu_prg_channel_disable(struct ipuv {int prg_chan =ipu_prg_ipu_to_prg_chan (ipu_chan->num);struct ipu_prg *prg = ipu_chan->ipu->prg_priv; -struct ipu_prg_channel *chan = &prg->chan[prg_chan]; +struct ipu_prg_channel *chan;u32 val; -if (!chan->enabled || prg_chan <0 ) +if (prg_chan <0 ) +return ; + + chan = &prg->chan[prg_chan]; +if (!chan->enabled)return ;clk_prepare_enable (prg->clk_ipg);
@@ -282,13 +286,15 @@ int ipu_prg_channel_configure(struct ipu {int prg_chan =ipu_prg_ipu_to_prg_chan (ipu_chan->num);struct ipu_prg *prg = ipu_chan->ipu->prg_priv; -struct ipu_prg_channel *chan = &prg->chan[prg_chan]; +struct ipu_prg_channel *chan;u32 val;int ret;if (prg_chan <0 )return prg_chan; + chan = &prg->chan[prg_chan]; +if (chan->enabled) {ipu_pre_update (prg->pres[chan->used_pre], *eba);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 251/496 drm/imx: move arming of the vblank event to atomic_flush
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lucas Stach <[email protected]>
[ Upstream commit 6a055b92de15af987b4027826d43aa103c65a3c4 ]
Right now the vblank event completion is racing with the atomic update, which is especially bad when the PRE is in use, as one of the hardware issue workaround might extend the atomic commit for quite some time.
If the vblank IRQ happens to trigger during that time, we will prematurely signal the atomic commit completion to userspace, which causes tearing when userspace re-uses a framebuffer we haven't managed to flip away from yet.
--- drivers/gpu/drm/imx/ipuv3-crtc.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/imx/ipuv3-crtc.c +5 -0
@@ -225,7 +225,11 @@ static void ipu_crtc_atomic_begin(struct struct drm_crtc_state *old_crtc_state) {drm_crtc_vblank_on (crtc); +} +static void ipu_crtc_atomic_flush (struct drm_crtc *crtc, +struct drm_crtc_state *old_crtc_state) +{spin_lock_irq (&crtc->dev->event_lock);if (crtc->state->event) {WARN_ON (drm_crtc_vblank_get (crtc));
@@ -293,6 +297,7 @@ static const struct drm_crtc_helper_func .mode_set_nofb = ipu_crtc_mode_set_nofb, .atomic_check = ipu_crtc_atomic_check, .atomic_begin = ipu_crtc_atomic_begin, + .atomic_flush = ipu_crtc_atomic_flush, .atomic_disable = ipu_crtc_atomic_disable, .atomic_enable = ipu_crtc_atomic_enable, };
Greg Kroah-Hartman
maintainerPATCH 252/496 drm/nouveau/bl: fix backlight regression
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karol Herbst <[email protected]>
[ Upstream commit 9e75dc61eaa9acd1bff83c3b814ac2af6dc1f64c ]
of output paths")
--- drivers/gpu/drm/nouveau/nouveau_backlight.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/nouveau/nouveau_backlight.c +5 -5
@@ -134,7 +134,7 @@ nv50_get_intensity(struct backlight_devistruct nouveau_encoder *nv_encoder =bl_get_data (bd);struct nouveau_drm *drm =nouveau_drm (nv_encoder->base.base.dev);struct nvif_object *device = &drm->client.device.object; -int or = nv_encoder->or; +int or =ffs (nv_encoder->dcb->or) -1 ;u32 div =1025 ;u32 val;
@@ -149,7 +149,7 @@ nv50_set_intensity(struct backlight_devistruct nouveau_encoder *nv_encoder =bl_get_data (bd);struct nouveau_drm *drm =nouveau_drm (nv_encoder->base.base.dev);struct nvif_object *device = &drm->client.device.object; -int or = nv_encoder->or; +int or =ffs (nv_encoder->dcb->or) -1 ;u32 div =1025 ;u32 val = (bd->props.brightness * div) /100 ;
@@ -170,7 +170,7 @@ nva3_get_intensity(struct backlight_devistruct nouveau_encoder *nv_encoder =bl_get_data (bd);struct nouveau_drm *drm =nouveau_drm (nv_encoder->base.base.dev);struct nvif_object *device = &drm->client.device.object; -int or = nv_encoder->or; +int or =ffs (nv_encoder->dcb->or) -1 ;u32 div, val; div =nvif_rd32 (device,NV50_PDISP_SOR_PWM_DIV (or));
@@ -188,7 +188,7 @@ nva3_set_intensity(struct backlight_devistruct nouveau_encoder *nv_encoder =bl_get_data (bd);struct nouveau_drm *drm =nouveau_drm (nv_encoder->base.base.dev);struct nvif_object *device = &drm->client.device.object; -int or = nv_encoder->or; +int or =ffs (nv_encoder->dcb->or) -1 ;u32 div, val; div =nvif_rd32 (device,NV50_PDISP_SOR_PWM_DIV (or));
@@ -228,7 +228,7 @@ nv50_backlight_init(struct drm_connectorreturn -ENODEV ; } -if (!nvif_rd32 (device,NV50_PDISP_SOR_PWM_CTL (nv_encoder->or))) +if (!nvif_rd32 (device,NV50_PDISP_SOR_PWM_CTL (ffs (nv_encoder->dcb->or) -1 )))return 0 ; if (drm->client.device.info.chipset <= 0xa0 ||
Greg Kroah-Hartman
maintainerPATCH 253/496 xfrm: fix rcu_read_unlock usage in xfrm_local_error
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Taehee Yoo <[email protected]>
[ Upstream commit 46c0ef6e1eb95f619d9f62da4332749153db92f7 ]
In the xfrm_local_error, rcu_read_unlock should be called when afinfo is not NULL. because xfrm_state_get_afinfo calls rcu_read_unlock if afinfo is NULL.
--- net/xfrm/xfrm_output.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/xfrm/xfrm_output.c +3 -2
@@ -285,8 +285,9 @@ void xfrm_local_error(struct sk_buff *skreturn ; afinfo =xfrm_state_get_afinfo (proto); -if (afinfo) +if (afinfo) { afinfo->local_error (skb, mtu); -rcu_read_unlock (); +rcu_read_unlock (); + } }EXPORT_SYMBOL_GPL (xfrm_local_error);
Greg Kroah-Hartman
maintainerPATCH 254/496 iwlwifi: mvm: set the correct tid when we flush the MCAST sta
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
[ Upstream commit 334167decf98f01a66c91ea84180c278bc4ad290 ]
The tid being used for the queue (cab_queue) for the MCAST station has been changed recently to be 0 (for BE). The flush path still flushed only the special tid (15) which means that the firmware wasn't flushing the right queue and we could get a firmware crash upon remove station if we had an MCAST packet on the ring.
The current code that flushes queues for a station only differentiates between internal stations (stations that aren't instantiated in mac80211, like the MCAST station) and the non-internal ones.
Internal stations can be either: BCAST (beacons), MCAST (for cab_queue), GENERAL_PURPOSE (p2p dev, and sniffer injection). The internal stations can use different tids.
To make the code simpler, just flush all the tids always and add the special internal tid (15) for internal stations. The firmware will know how to handle this even if we hadn't any queue mapped that that tid.
--- drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/tx.c +4 -6
@@ -1879,14 +1879,12 @@ int iwl_mvm_flush_sta(struct iwl_mvm *mvstruct iwl_mvm_int_sta *int_sta = sta;struct iwl_mvm_sta *mvm_sta = sta; -if (iwl_mvm_has_new_tx_api (mvm)) { -if (internal) -return iwl_mvm_flush_sta_tids (mvm, int_sta->sta_id, -BIT (IWL_MGMT_TID ), flags); +BUILD_BUG_ON (offsetof(struct iwl_mvm_int_sta , sta_id) != + offsetof(struct iwl_mvm_sta , sta_id)); +if (iwl_mvm_has_new_tx_api (mvm))return iwl_mvm_flush_sta_tids (mvm, mvm_sta->sta_id, -0xFF , flags); - } +0xff |BIT (IWL_MGMT_TID ), flags);if (internal) return iwl_mvm_flush_tx_path(mvm, int_sta->tfd_queue_msk,
Greg Kroah-Hartman
maintainerPATCH 255/496 iwlwifi: mvm: Correctly set IGTK for AP
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Beni Lev <[email protected]>
[ Upstream commit e829b17caf96c2da34620e335fb777592990906c ]
Currently when an IGTK is set for an AP, it is set as a regular key. Since the cipher is set to CMAC, the STA_KEY_FLG_EXT flag is added to the host command, which causes assert 0x253D on NICs that do not support this.
--- drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/sta.c +12 -9
@@ -3182,17 +3182,9 @@ int iwl_mvm_set_sta_key(struct iwl_mvm * } sta_id = mvm_sta->sta_id; -if (keyconf->cipher ==WLAN_CIPHER_SUITE_AES_CMAC || - keyconf->cipher ==WLAN_CIPHER_SUITE_BIP_GMAC_128 || - keyconf->cipher ==WLAN_CIPHER_SUITE_BIP_GMAC_256 ) { - ret =iwl_mvm_send_sta_igtk (mvm, keyconf, sta_id, - false); - goto end; - } -/* * It is possible that the 'sta' parameter is NULL, and thus -* there is a need to retrieve the sta from the local station +* there is a need to retrieve the sta from the local station * table. */ if (!sta) {
@@ -3207,6 +3199,17 @@ int iwl_mvm_set_sta_key(struct iwl_mvm *if (WARN_ON_ONCE (iwl_mvm_sta_from_mac80211 (sta)->vif != vif))return -EINVAL ; + }else { +struct iwl_mvm_vif *mvmvif =iwl_mvm_vif_from_mac80211 (vif); + + sta_id = mvmvif->mcast_sta.sta_id; + } + +if (keyconf->cipher ==WLAN_CIPHER_SUITE_AES_CMAC || + keyconf->cipher ==WLAN_CIPHER_SUITE_BIP_GMAC_128 || + keyconf->cipher ==WLAN_CIPHER_SUITE_BIP_GMAC_256 ) { + ret =iwl_mvm_send_sta_igtk (mvm, keyconf, sta_id, false); + goto end; }/* If the key_offset is not pre-assigned, we need to find a
Greg Kroah-Hartman
maintainerPATCH 256/496 iwlwifi: mvm: fix error checking for multi/broadcast sta
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
[ Upstream commit 75fd4fec3e4c43b131c7c4958adb3ab9f1665513 ]
The earlier patch called the station add functions but didn't assign their return value to the ret variable, so that the checks for it were meaningless. Fix that.
Found by smatch:
.../mac80211.c:2560 iwl_mvm_start_ap_ibss() warn: we tested 'ret' before and it was 'false' .../mac80211.c:2563 iwl_mvm_start_ap_ibss() warn: we tested 'ret' before and it was 'false'
--- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +2 -2
@@ -2153,10 +2153,10 @@ static int iwl_mvm_start_ap_ibss(struct* Send the bcast station. At this stage the TBTT and DTIM time * events are added and applied to the scheduler */ -iwl_mvm_send_add_bcast_sta (mvm, vif); + ret =iwl_mvm_send_add_bcast_sta (mvm, vif);if (ret) goto out_unbind; -iwl_mvm_add_mcast_sta (mvm, vif); + ret =iwl_mvm_add_mcast_sta (mvm, vif);if (ret) {iwl_mvm_send_rm_bcast_sta (mvm, vif); goto out_unbind;
Greg Kroah-Hartman
maintainerPATCH 257/496 microblaze: switch to NO_BOOTMEM
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rob Herring <[email protected]>
[ Upstream commit 101646a24a2f9cdb61d7732459fbf068a7bbb542 ]
Microblaze doesn't set CONFIG_NO_BOOTMEM and so memblock_virt_alloc() doesn't work for CONFIG_HAVE_MEMBLOCK && !CONFIG_NO_BOOTMEM.
Similar change was already done by others architectures "ARM: mm: Remove bootmem code and switch to NO_BOOTMEM" (sha1: 84f452b1e8fc73ac0e31254c66e3e2260ce5263d)
or
"openrisc: Consolidate setup to use memblock instead of bootmem" (sha1: 266c7fad157265bb54d17db1c9545f2aaa488643)
or
"parisc: Drop bootmem and switch to memblock"
(sha1: 4fe9e1d957e45ad8eba9885ee860a0e93d13a7c7)
or
"powerpc: Remove bootmem allocator"
(sha1: 10239733ee8617bac3f1c1769af43a88ed979324)
or
"s390/mm: Convert bootmem to memblock"
(sha1: 50be634507284eea38df78154d22615d21200b42)
or
"sparc64: Convert over to NO_BOOTMEM."
(sha1: 625d693e9784f988371e69c2b41a2172c0be6c11)
or
"xtensa: drop sysmem and switch to memblock"
(sha1: 0e46c1115f5816949220d62dd3ff04aa68e7ac6b)
Issue was introduced by:
"of/fdt: use memblock_virt_alloc for early alloc"
(sha1: 0fa1c579349fdd90173381712ad78aa99c09d38b)
--- arch/microblaze/Kconfig | 1 arch/microblaze/mm/init.c | 56 ++++------------------------------------------ 2 files changed, 7 insertions(+), 50 deletions(-)
arch/microblaze/Kconfig +1 -0
@@ -24,6 +24,7 @@ config MICROBLAZE select HAVE_FTRACE_MCOUNT_RECORD select HAVE_FUNCTION_GRAPH_TRACER select HAVE_FUNCTION_TRACER + select NO_BOOTMEM select HAVE_MEMBLOCK select HAVE_MEMBLOCK_NODE_MAP select HAVE_OPROFILE
arch/microblaze/mm/init.c +6 -50
89 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 258/496 net: Fix vlan untag for bridge and vlan_dev with reorder_hdr off
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Toshiaki Makita <[email protected]>
[ Upstream commit 4bbb3e0e8239f9079bf1fe20b3c0cb598714ae61 ]
When we have a bridge with vlan_filtering on and a vlan device on top of it, packets would be corrupted in skb_vlan_untag() called from br_dev_xmit().
The problem sits in skb_reorder_vlan_header() used in skb_vlan_untag(), which makes use of skb->mac_len. In this function mac_len is meant for handling rx path with vlan devices with reorder_header disabled, but in tx path mac_len is typically 0 and cannot be used, which is the problem in this case.
The current code even does not properly handle rx path (skb_vlan_untag() called from __netif_receive_skb_core()) with reorder_header off actually.
In rx path single tag case, it works as follows:
- Before skb_reorder_vlan_header()
mac_header data
v v
+-------------------+-------------+------+---- | ETH | VLAN | ETH | | ADDRS | TPID | TCI | TYPE | +-------------------+-------------+------+----
<-------- mac_len --------->
<------------->
to be removed
- After skb_reorder_vlan_header()
mac_header data
v v
+-------------------+------+----
| ETH | ETH |
| ADDRS | TYPE |
+-------------------+------+----
<-------- mac_len --------->This is ok, but in rx double tag case, it corrupts packets:
- Before skb_reorder_vlan_header()
mac_header data
v v
+-------------------+-------------+-------------+------+---- | ETH | VLAN | VLAN | ETH | | ADDRS | TPID | TCI | TPID | TCI | TYPE | +-------------------+-------------+-------------+------+----
<--------------- mac_len ---------------->
<------------->
should be removed
<--------------------------->
actually will be removed
- After skb_reorder_vlan_header()
mac_header data
v v
+-------------------+------+----
| ETH | ETH |
| ADDRS | TYPE |
+-------------------+------+----
<--------------- mac_len ---------------->So, two of vlan tags are both removed while only inner one should be removed and mac_header (and mac_len) is broken.
skb_vlan_untag() is meant for removing the vlan header at (skb->data - 2), so use skb->data and skb->mac_header to calculate the right offset.
--- include/uapi/linux/if_ether.h | 1 + net/core/skbuff.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-)
include/uapi/linux/if_ether.h +1 -0
@@ -30,6 +30,7 @@*/ #define ETH_ALEN 6/* Octets in one ethernet addr */ +#define ETH_TLEN 2/* Octets in ethernet type field */ #define ETH_HLEN 14/* Total octets in header. */ #define ETH_ZLEN 60/* Min. octets in frame sans FCS */ #define ETH_DATA_LEN 1500/* Max. octets in payload */
net/core/skbuff.c +5 -2
@@ -4939,13 +4939,16 @@ EXPORT_SYMBOL_GPL(skb_gso_validate_mtu);static struct sk_buff *skb_reorder_vlan_header (struct sk_buff *skb) { +int mac_len; +if (skb_cow (skb,skb_headroom (skb)) <0 ) {kfree_skb (skb);return NULL ; } -memmove (skb->data -ETH_HLEN , skb->data - skb->mac_len -VLAN_HLEN , -2 *ETH_ALEN ); + mac_len = skb->data -skb_mac_header (skb); +memmove (skb_mac_header (skb) +VLAN_HLEN ,skb_mac_header (skb), + mac_len -VLAN_HLEN -ETH_TLEN ); skb->mac_header +=VLAN_HLEN ;return skb; }
Greg Kroah-Hartman
maintainerPATCH 259/496 vlan: Fix out of order vlan headers with reorder header off
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Toshiaki Makita <[email protected]>
[ Upstream commit cbe7128c4b92e2004984f477fd38dfa81662f02e ]
With reorder header off, received packets are untagged in skb_vlan_untag() called from within __netif_receive_skb_core(), and later the tag will be inserted back in vlan_do_receive().
This caused out of order vlan headers when we create a vlan device on top of another vlan device, because vlan_do_receive() inserts a tag as the outermost vlan tag. E.g. the outer tag is first removed in skb_vlan_untag() and inserted back in vlan_do_receive(), then the inner tag is next removed and inserted back as the outermost tag.
This patch fixes the behaviour by inserting the inner tag at the right position.
--- include/linux/if_vlan.h | 66 ++++++++++++++++++++++++++++++++++++++++-------- net/8021q/vlan_core.c | 4 +- 2 files changed, 57 insertions(+), 13 deletions(-)
include/linux/if_vlan.h +55 -11
@@ -300,30 +300,34 @@ static inline bool vlan_hw_offload_capab }/** -* __vlan_insert_tag - regular VLAN tag inserting +* __vlan_insert_inner_tag - inner VLAN tag inserting * @skb: skbuff to tag * @vlan_proto: VLAN encapsulation protocol * @vlan_tci: VLAN TCI to insert +* @mac_len: MAC header length including outer vlan headers * -* Inserts the VLAN tag into @skb as part of the payload +* Inserts the VLAN tag into @skb as part of the payload at offset mac_len * Returns error if skb_cow_head failes. * * Does not change skb->protocol so this function can be used during receive. */ -static inline int __vlan_insert_tag (struct sk_buff *skb, -__be16 vlan_proto,u16 vlan_tci) +static inline int __vlan_insert_inner_tag (struct sk_buff *skb, +__be16 vlan_proto,u16 vlan_tci, +unsigned int mac_len) {struct vlan_ethhdr *veth;if (skb_cow_head (skb,VLAN_HLEN ) <0 )return -ENOMEM ; - veth =skb_push (skb,VLAN_HLEN ); +skb_push (skb,VLAN_HLEN ); -/* Move the mac addresses to the beginning of the new header. */ -memmove (skb->data, skb->data +VLAN_HLEN ,2 *ETH_ALEN ); +/* Move the mac header sans proto to the beginning of the new header. */ +memmove (skb->data, skb->data +VLAN_HLEN , mac_len -ETH_TLEN ); skb->mac_header -=VLAN_HLEN ; + veth = (struct vlan_ethhdr *)(skb->data + mac_len -ETH_HLEN ); +/* first, the ethernet type */ veth->h_vlan_proto = vlan_proto;
@@ -334,12 +338,30 @@ static inline int __vlan_insert_tag(stru }/** -* vlan_insert_tag - regular VLAN tag inserting +* __vlan_insert_tag - regular VLAN tag inserting * @skb: skbuff to tag * @vlan_proto: VLAN encapsulation protocol * @vlan_tci: VLAN TCI to insert * * Inserts the VLAN tag into @skb as part of the payload +* Returns error if skb_cow_head failes. +* +* Does not change skb->protocol so this function can be used during receive. +*/ +static inline int __vlan_insert_tag (struct sk_buff *skb, +__be16 vlan_proto,u16 vlan_tci) +{ +return __vlan_insert_inner_tag (skb, vlan_proto, vlan_tci,ETH_HLEN ); +} + +/** +* vlan_insert_inner_tag - inner VLAN tag inserting +* @skb: skbuff to tag +* @vlan_proto: VLAN encapsulation protocol +* @vlan_tci: VLAN TCI to insert +* @mac_len: MAC header length including outer vlan headers +* +* Inserts the VLAN tag into @skb as part of the payload at offset mac_len * Returns a VLAN tagged skb. If a new skb is created, @skb is freed. * * Following the skb_unshare() example, in case of error, the calling function
@@ -347,12 +369,14 @@ static inline int __vlan_insert_tag(stru* * Does not change skb->protocol so this function can be used during receive. */ -static inline struct sk_buff *vlan_insert_tag (struct sk_buff *skb, -__be16 vlan_proto,u16 vlan_tci) +static inline struct sk_buff *vlan_insert_inner_tag (struct sk_buff *skb, +__be16 vlan_proto, +u16 vlan_tci, +unsigned int mac_len) {int err; - err =__vlan_insert_tag (skb, vlan_proto, vlan_tci); + err =__vlan_insert_inner_tag (skb, vlan_proto, vlan_tci, mac_len);if (err) {dev_kfree_skb_any (skb);return NULL ;
@@ -361,6 +385,26 @@ static inline struct sk_buff *vlan_inser }/** +* vlan_insert_tag - regular VLAN tag inserting +* @skb: skbuff to tag +* @vlan_proto: VLAN encapsulation protocol +* @vlan_tci: VLAN TCI to insert +* +* Inserts the VLAN tag into @skb as part of the payload +* Returns a VLAN tagged skb. If a new skb is created, @skb is freed. +* +* Following the skb_unshare() example, in case of error, the calling function +* doesn't have to worry about freeing the original skb. +* +* Does not change skb->protocol so this function can be used during receive. +*/ +static inline struct sk_buff *vlan_insert_tag (struct sk_buff *skb, +__be16 vlan_proto,u16 vlan_tci) +{ +return vlan_insert_inner_tag (skb, vlan_proto, vlan_tci,ETH_HLEN ); +} + +/** * vlan_insert_tag_set_proto - regular VLAN tag inserting * @skb: skbuff to tag * @vlan_proto: VLAN encapsulation protocol
net/8021q/vlan_core.c +2 -2
@@ -48,8 +48,8 @@ bool vlan_do_receive(struct sk_buff **sk* original position later */ skb_push (skb, offset); - skb = *skbp =vlan_insert_tag (skb, skb->vlan_proto, - skb->vlan_tci); + skb = *skbp =vlan_insert_inner_tag (skb, skb->vlan_proto, + skb->vlan_tci, skb->mac_len);if (!skb)return false;skb_pull (skb, offset +VLAN_HLEN );
Greg Kroah-Hartman
maintainerPATCH 260/496 batman-adv: fix header size check in batadv_dbg_arp()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthias Schiffer <[email protected]>
[ Upstream commit 6f27d2c2a8c236d296201c19abb8533ec20d212b ]
Checking for 0 is insufficient: when an SKB without a batadv header, but with a VLAN header is received, hdr_size will be 4, making the following code interpret the Ethernet header as a batadv header.
--- net/batman-adv/distributed-arp-table.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/batman-adv/distributed-arp-table.c +1 -1
@@ -391,7 +391,7 @@ static void batadv_dbg_arp(struct batadvbatadv_arp_hw_src (skb, hdr_size), &ip_src, batadv_arp_hw_dst(skb, hdr_size), &ip_dst); -if (hdr_size ==0 ) +if (hdr_size <sizeof (struct batadv_unicast_packet ))return ; unicast_4addr_packet = (struct batadv_unicast_4addr_packet *)skb->data;
Greg Kroah-Hartman
maintainerPATCH 261/496 net/sched: fix NULL dereference in the error path of tcf_sample_init()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Davide Caratti <[email protected]>
[ Upstream commit 1f110e7cae09e6c6a144616480d1a9dd99c5208a ]
when the following command
# tc action add action sample rate 100 group 100 index 100
is run for the first time, and psample_group_get(100) fails to create a new group, tcf_sample_cleanup() calls psample_group_put(NULL), thus causing the following error:
BUG: unable to handle kernel NULL pointer dereference at 000000000000001c IP: psample_group_put+0x15/0x71 [psample] PGD 8000000075775067 P4D 8000000075775067 PUD 7453c067 PMD 0 Oops: 0002 [#1] SMP PTI Modules linked in: act_sample(E) psample ip6table_filter ip6_tables iptable_filter binfmt_misc ext4 snd_hda_codec_generic snd_hda_intel snd_hda_codec snd_hda_core mbcache jbd2 crct10dif_pclmul snd_hwdep crc32_pclmul snd_seq ghash_clmulni_intel pcbc snd_seq_device snd_pcm aesni_intel crypto_simd snd_timer glue_helper snd cryptd joydev pcspkr i2c_piix4 soundcore virtio_balloon nfsd auth_rpcgss nfs_acl lockd grace sunrpc ip_tables xfs libcrc32c ata_generic pata_acpi qxl drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops ttm drm virtio_net ata_piix virtio_console virtio_blk libata serio_raw crc32c_intel virtio_pci i2c_core virtio_ring virtio floppy dm_mirror dm_region_hash dm_log dm_mod [last unloaded: act_tunnel_key] CPU: 2 PID: 5740 Comm: tc Tainted: G E 4.16.0-rc4.act_vlan.orig+ #403 Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011 RIP: 0010:psample_group_put+0x15/0x71 [psample] RSP: 0018:ffffb8a80032f7d0 EFLAGS: 00010246 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000024 RDX: 0000000000000001 RSI: 0000000000000000 RDI: ffffffffc06d93c0 RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000044 R10: 00000000bd003000 R11: ffff979fba04aa59 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: ffff979fbba3f22c FS: 00007f7638112740(0000) GS:ffff979fbfd00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000000000000001c CR3: 00000000734ea001 CR4: 00000000001606e0 Call Trace: __tcf_idr_release+0x79/0xf0 tcf_sample_init+0x125/0x1d0 [act_sample] tcf_action_init_1+0x2cc/0x430 tcf_action_init+0xd3/0x1b0 tc_ctl_action+0x18b/0x240 rtnetlink_rcv_msg+0x29c/0x310 ? _cond_resched+0x15/0x30 ? __kmalloc_node_track_caller+0x1b9/0x270 ? rtnl_calcit.isra.28+0x100/0x100 netlink_rcv_skb+0xd2/0x110 netlink_unicast+0x17c/0x230 netlink_sendmsg+0x2cd/0x3c0 sock_sendmsg+0x30/0x40 ___sys_sendmsg+0x27a/0x290 ? filemap_map_pages+0x34a/0x3a0 ? __handle_mm_fault+0xbfd/0xe20 __sys_sendmsg+0x51/0x90 do_syscall_64+0x6e/0x1a0 entry_SYSCALL_64_after_hwframe+0x3d/0xa2 RIP: 0033:0x7f7637523ba0 RSP: 002b:00007fff0473ef58 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007fff0473f080 RCX: 00007f7637523ba0 RDX: 0000000000000000 RSI: 00007fff0473efd0 RDI: 0000000000000003 RBP: 000000005aaaac80 R08: 0000000000000002 R09: 0000000000000000 R10: 00007fff0473e9e0 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fff0473f094 R14: 0000000000000001 R15: 0000000000669f60 Code: be 02 00 00 00 48 89 df e8 a9 fe ff ff e9 7c ff ff ff 0f 1f 40 00 0f 1f 44 00 00 53 48 89 fb 48 c7 c7 c0 93 6d c0 e8 db 20 8c ef <83> 6b 1c 01 74 10 48 c7 c7 c0 93 6d c0 ff 14 25 e8 83 83 b0 5b RIP: psample_group_put+0x15/0x71 [psample] RSP: ffffb8a80032f7d0 CR2: 000000000000001c
Fix it in tcf_sample_cleanup(), ensuring that calls to psample_group_put(p) are done only when p is not NULL.
--- net/sched/act_sample.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/sched/act_sample.c +2 -1
@@ -103,7 +103,8 @@ static void tcf_sample_cleanup_rcu(struc psample_group =rcu_dereference_protected (s->psample_group,1 );RCU_INIT_POINTER (s->psample_group,NULL ); -psample_group_put (psample_group); +if (psample_group) +psample_group_put (psample_group); }static void tcf_sample_cleanup (struct tc_action *a,int bind)
Greg Kroah-Hartman
maintainerPATCH 262/496 batman-adv: Fix skbuff rcsum on packet reroute
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
[ Upstream commit fc04fdb2c8a894283259f5621d31d75610701091 ]
batadv_check_unicast_ttvn may redirect a packet to itself or another originator. This involves rewriting the ttvn and the destination address in the batadv unicast header. These field were not yet pulled (with skb rcsum update) and thus any change to them also requires a change in the receive checksum.
--- net/batman-adv/routing.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
net/batman-adv/routing.c +10 -5
@@ -743,6 +743,7 @@ free_skb:/** * batadv_reroute_unicast_packet - update the unicast header for re-routing * @bat_priv: the bat priv with all the soft interface information +* @skb: unicast packet to process * @unicast_packet: the unicast header to be updated * @dst_addr: the payload destination * @vid: VLAN identifier
@@ -754,7 +755,7 @@ free_skb:* Return: true if the packet header has been updated, false otherwise */ static bool -batadv_reroute_unicast_packet (struct batadv_priv *bat_priv, +batadv_reroute_unicast_packet (struct batadv_priv *bat_priv,struct sk_buff *skb,struct batadv_unicast_packet *unicast_packet,u8 *dst_addr,unsigned short vid) {
@@ -783,8 +784,10 @@ batadv_reroute_unicast_packet(struct bat }/* update the packet header */ +skb_postpull_rcsum (skb, unicast_packet,sizeof (*unicast_packet));ether_addr_copy (unicast_packet->dest, orig_addr); unicast_packet->ttvn = orig_ttvn; +skb_postpush_rcsum (skb, unicast_packet,sizeof (*unicast_packet)); ret = true; out:
@@ -825,7 +828,7 @@ static bool batadv_check_unicast_ttvn(st* the packet to */ if (batadv_tt_local_client_is_roaming (bat_priv, ethhdr->h_dest, vid)) { -if (batadv_reroute_unicast_packet (bat_priv, unicast_packet, +if (batadv_reroute_unicast_packet (bat_priv, skb, unicast_packet, ethhdr->h_dest, vid)) batadv_dbg_ratelimited(BATADV_DBG_TT, bat_priv,
@@ -871,7 +874,7 @@ static bool batadv_check_unicast_ttvn(st* destination can possibly be updated and forwarded towards the new * target host */ -if (batadv_reroute_unicast_packet (bat_priv, unicast_packet, +if (batadv_reroute_unicast_packet (bat_priv, skb, unicast_packet, ethhdr->h_dest, vid)) { batadv_dbg_ratelimited(BATADV_DBG_TT, bat_priv, "Rerouting unicast packet to %pM (dst=%pM): TTVN mismatch old_ttvn=%u new_ttvn=%u\n",
@@ -894,12 +897,14 @@ static bool batadv_check_unicast_ttvn(stif (!primary_if)return false; +/* update the packet header */ +skb_postpull_rcsum (skb, unicast_packet,sizeof (*unicast_packet));ether_addr_copy (unicast_packet->dest, primary_if->net_dev->dev_addr); + unicast_packet->ttvn = curr_ttvn; +skb_postpush_rcsum (skb, unicast_packet,sizeof (*unicast_packet));batadv_hardif_put (primary_if); - unicast_packet->ttvn = curr_ttvn; -return true; }
Greg Kroah-Hartman
maintainerPATCH 263/496 vti4: Dont count header length twice on tunnel setup
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefano Brivio <[email protected]>
[ Upstream commit dd1df24737727e119c263acf1be2a92763938297 ]
This re-introduces the effect of commit a32452366b72 ("vti4:
Don't count header length twice.") which was accidentally reverted by merge commit f895f0cfbb77 ("Merge branch 'master' ofgit://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec").
The commit message from Steffen Klassert said:
We currently count the size of LL_MAX_HEADER and struct iphdr twice for vti4 devices, this leads to a wrong device mtu. The size of LL_MAX_HEADER and struct iphdr is already counted in ip_tunnel_bind_dev(), so don't do it again in vti_tunnel_init().
And this is still the case now: ip_tunnel_bind_dev() already accounts for the header length of the link layer (not necessarily LL_MAX_HEADER, if the output device is found), plus one IP header.
For example, with a vti device on top of veth, with MTU of 1500, the existing implementation would set the initial vti MTU to 1332, accounting once for LL_MAX_HEADER (128, included in hard_header_len by vti) and twice for the same IP header (once from hard_header_len, once from ip_tunnel_bind_dev()).
It should instead be 1480, because ip_tunnel_bind_dev() is able to figure out that the output device is veth, so no additional link layer header is attached, and will properly count one single IP header.
The existing issue had the side effect of avoiding PMTUD for most xfrm policies, by arbitrarily lowering the initial MTU. However, the only way to get a consistent PMTU value is to let the xfrm PMTU discovery do its course, and commit d6af1a31cc72 ("vti: Add pmtu handling to vti_xmit.") now takes care of local delivery cases where the application ignores local socket notifications.
--- net/ipv4/ip_vti.c | 1 - 1 file changed, 1 deletion(-)
net/ipv4/ip_vti.c +0 -1
@@ -396,7 +396,6 @@ static int vti_tunnel_init(struct net_dememcpy (dev->dev_addr, &iph->saddr,4 );memcpy (dev->broadcast, &iph->daddr,4 ); - dev->hard_header_len =LL_MAX_HEADER +sizeof (struct iphdr ); dev->mtu =ETH_DATA_LEN ; dev->flags =IFF_NOARP ; dev->addr_len =4 ;
Greg Kroah-Hartman
maintainerPATCH 264/496 ip_tunnel: Clamp MTU to bounds on new link
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefano Brivio <[email protected]>
[ Upstream commit 24fc79798b8ddfd46f2dd363a8d29072c083b977 ]
Otherwise, it's possible to specify invalid MTU values directly on creation of a link (via 'ip link add'). This is already prevented on subsequent MTU changes by commit b96f9afee4eb ("ipv4/6: use core net MTU range checking").
--- net/ipv4/ip_tunnel.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
net/ipv4/ip_tunnel.c +7 -1
@@ -1103,8 +1103,14 @@ int ip_tunnel_newlink(struct net_deviceeth_hw_addr_random (dev); mtu =ip_tunnel_bind_dev (dev); -if (!tb[IFLA_MTU ]) +if (tb[IFLA_MTU ]) { +unsigned int max =0xfff8 - dev->hard_header_len - nt->hlen; + + dev->mtu =clamp (dev->mtu, (unsigned int )ETH_MIN_MTU , + (unsigned int )(max -sizeof (struct iphdr ))); + }else { dev->mtu = mtu; + }ip_tunnel_add (itn, nt); out:
Greg Kroah-Hartman
maintainerPATCH 265/496 vti4: Dont override MTU passed on link creation via IFLA_MTU
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefano Brivio <[email protected]>
[ Upstream commit 03080e5ec72740c1a62e6730f2a5f3f114f11b19 ]
Don't hardcode a MTU value on vti tunnel initialization, ip_tunnel_newlink() is able to deal with this already. See also commit ffc2b6ee4174 ("ip_gre: fix IFLA_MTU ignored on NEWLINK").
--- net/ipv4/ip_vti.c | 1 - 1 file changed, 1 deletion(-)
net/ipv4/ip_vti.c +0 -1
@@ -396,7 +396,6 @@ static int vti_tunnel_init(struct net_dememcpy (dev->dev_addr, &iph->saddr,4 );memcpy (dev->broadcast, &iph->daddr,4 ); - dev->mtu =ETH_DATA_LEN ; dev->flags =IFF_NOARP ; dev->addr_len =4 ; dev->features |=NETIF_F_LLTX ;
Greg Kroah-Hartman
maintainerPATCH 266/496 vti6: Fix dev->max_mtu setting
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefano Brivio <[email protected]>
[ Upstream commit f8a554b4aa9686bb2c12f6bae516e58783289a03 ]
We shouldn't allow a tunnel to have IP_MAX_MTU as MTU, because another IPv6 header is going on top of our packets. Without this patch, we might end up building packets bigger than IP_MAX_MTU.
--- net/ipv6/ip6_vti.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/ip6_vti.c +1 -1
@@ -852,7 +852,7 @@ static void vti6_dev_setup(struct net_de dev->hard_header_len =LL_MAX_HEADER +sizeof (struct ipv6hdr ); dev->mtu =ETH_DATA_LEN ; dev->min_mtu =IPV6_MIN_MTU ; - dev->max_mtu =IP_MAX_MTU ; + dev->max_mtu =IP_MAX_MTU -sizeof (struct ipv6hdr ); dev->flags |=IFF_NOARP ; dev->addr_len =sizeof (struct in6_addr );netif_keep_dst (dev);
Greg Kroah-Hartman
maintainerPATCH 267/496 iwlwifi: mvm: Increase session protection time after CS
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrei Otcheretianski <[email protected]>
[ Upstream commit 19125cb0591ae63cd4591e3dfe4c22058e748518 ]
After switching to a new channel, driver schedules session protection time event in order to hear the beacon on the new channel. The duration of the protection is two beacon intervals. However, since we start to switch slightly before beacon with count 1, in case we don't hear (or AP doesn't transmit) the very first beacon on the new channel the protection ends without hearing any beacon at all. At this stage the switch is not complete, the queues are closed and the interface doesn't have quota yet or TBTT events. As the result, we are stuck forever waiting for iwl_mvm_post_channel_switch() to be called.
Fix this by increasing the protection time to be 3 beacon intervals and in addition drop the connection if the time event ends before we got any beacon.
--- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 5 ++++- drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 3 +++ drivers/net/wireless/intel/iwlwifi/mvm/time-event.c | 15 ++++++++------- 3 files changed, 15 insertions(+), 8 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +4 -1
@@ -3497,6 +3497,7 @@ static int __iwl_mvm_assign_vif_chanctx( ret =0 ; goto out;case NL80211_IFTYPE_STATION : + mvmvif->csa_bcn_pending = false;break ;case NL80211_IFTYPE_MONITOR :/* always disable PS when a monitor interface is active */
@@ -3540,7 +3541,7 @@ static int __iwl_mvm_assign_vif_chanctx( }if (switching_chanctx && vif->type ==NL80211_IFTYPE_STATION ) { -u32 duration =2 * vif->bss_conf.beacon_int; +u32 duration =3 * vif->bss_conf.beacon_int;/* iwl_mvm_protect_session() reads directly from the * device (the system time), so make sure it is
@@ -3553,6 +3554,7 @@ static int __iwl_mvm_assign_vif_chanctx(/* Protect the session to make sure we hear the first * beacon on the new channel. */ + mvmvif->csa_bcn_pending = true;iwl_mvm_protect_session (mvm, vif, duration, duration, vif->bss_conf.beacon_int /2 , true);
@@ -3996,6 +3998,7 @@ static int iwl_mvm_post_channel_switch(sif (vif->type ==NL80211_IFTYPE_STATION ) {struct iwl_mvm_sta *mvmsta; + mvmvif->csa_bcn_pending = false; mvmsta =iwl_mvm_sta_from_staid_protected (mvm, mvmvif->ap_sta_id);
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +3 -0
@@ -434,6 +434,9 @@ struct iwl_mvm_vif {bool csa_failed;u16 csa_target_freq; +/* Indicates that we are waiting for a beacon on a new channel */ +bool csa_bcn_pending; +/* TCP Checksum Offload */ netdev_features_t features;
drivers/net/wireless/intel/iwlwifi/mvm/time-event.c +8 -7
@@ -8,6 +8,7 @@* Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * Copyright(c) 2017 Intel Deutschland GmbH +* Copyright(c) 2018 Intel Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as
@@ -18,11 +19,6 @@* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, -* USA -* * The full GNU General Public License is included in this distribution * in the file called COPYING. *
@@ -35,6 +31,7 @@* Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * Copyright(c) 2017 Intel Deutschland GmbH +* Copyright(c) 2018 Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without
@@ -203,9 +200,13 @@ static bool iwl_mvm_te_check_disconnect(struct ieee80211_vif *vif, const char *errmsg) { + struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); +if (vif->type !=NL80211_IFTYPE_STATION )return false; -if (vif->bss_conf.assoc && vif->bss_conf.dtim_period) + +if (!mvmvif->csa_bcn_pending && vif->bss_conf.assoc && + vif->bss_conf.dtim_period)return false;if (errmsg)IWL_ERR (mvm,"%s\n" , errmsg);
@@ -349,7 +350,7 @@ static void iwl_mvm_te_handle_notif(stru* and know the dtim period. */ iwl_mvm_te_check_disconnect (mvm, te_data->vif, -"No association and the time event is over already..." ); +"No beacon heard and the time event is over already..." );break ;default :break ;
Greg Kroah-Hartman
maintainerPATCH 268/496 iwlwifi: mvm: clear tx queue id when unreserving aggregation queue
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avraham Stern <[email protected]>
[ Upstream commit 4b387906b1c3692bb790388c335515c0cf098a23 ]
When a queue is reserved for aggregation, the queue id is assigned to the tid_data. This is fine since iwl_mvm_sta_tx_agg_oper() takes care of allocating the queue before actual tx starts. When the reservation is cancelled (e.g. when the AP declined the aggregation request) the tid_data is not cleared. As a result, following tx for this tid was trying to use an unallocated queue.
Fix this by setting the txq_id for the tid to invalid when unreserving the queue.
--- drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/sta.c +8 -4
@@ -2645,8 +2645,10 @@ out:static void iwl_mvm_unreserve_agg_queue (struct iwl_mvm *mvm,struct iwl_mvm_sta *mvmsta, -u16 txq_id) +struct iwl_mvm_tid_data *tid_data) { +u16 txq_id = tid_data->txq_id; +if (iwl_mvm_has_new_tx_api (mvm))return ;
@@ -2658,8 +2660,10 @@ static void iwl_mvm_unreserve_agg_queue(* allocated through iwl_mvm_enable_txq, so we can just mark it back as * free. */ -if (mvm->queue_info[txq_id].status ==IWL_MVM_QUEUE_RESERVED ) +if (mvm->queue_info[txq_id].status ==IWL_MVM_QUEUE_RESERVED ) { mvm->queue_info[txq_id].status =IWL_MVM_QUEUE_FREE ; + tid_data->txq_id =IWL_MVM_INVALID_QUEUE ; + }spin_unlock_bh (&mvm->queue_info_lock); }
@@ -2690,7 +2694,7 @@ int iwl_mvm_sta_tx_agg_stop(struct iwl_m mvmsta->agg_tids &= ~BIT (tid); -iwl_mvm_unreserve_agg_queue (mvm, mvmsta, txq_id); +iwl_mvm_unreserve_agg_queue (mvm, mvmsta, tid_data);switch (tid_data->state) {case IWL_AGG_ON :
@@ -2757,7 +2761,7 @@ int iwl_mvm_sta_tx_agg_flush(struct iwl_ mvmsta->agg_tids &= ~BIT (tid);spin_unlock_bh (&mvmsta->lock); -iwl_mvm_unreserve_agg_queue (mvm, mvmsta, txq_id); +iwl_mvm_unreserve_agg_queue (mvm, mvmsta, tid_data);if (old_state >=IWL_AGG_ON ) {iwl_mvm_drain_sta (mvm, mvmsta, true);
Greg Kroah-Hartman
maintainerPATCH 269/496 iwlwifi: mvm: make sure internal station has a valid id
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avraham Stern <[email protected]>
[ Upstream commit df65c8d1728adee2a52c30287d33da83a8c87480 ]
If the driver failed to resume from D3, it is possible that it has no valid aux station. In such case, fw restart will end up in sending station related commands with an invalid station id, which will result in an assert.
Fix this by allocating a new station id for the aux station if it does not have a valid id even in the case of fw restart.
--- drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/sta.c +2 -1
@@ -1679,7 +1679,8 @@ int iwl_mvm_allocate_int_sta(struct iwl_ u32 qmask, enum nl80211_iftype iftype, enum iwl_sta_type type) { - if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) { + if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) || + sta->sta_id == IWL_MVM_INVALID_STA) { sta->sta_id = iwl_mvm_find_free_sta_id(mvm, iftype);if (WARN_ON_ONCE (sta->sta_id ==IWL_MVM_INVALID_STA ))return -ENOSPC ;
Greg Kroah-Hartman
maintainerPATCH 270/496 iwlwifi: mvm: fix array out of bounds reference
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Avraham Stern <[email protected]>
[ Upstream commit 4a6d2e525b43eba5870ea7e360f59aa65de00705 ]
When starting aggregation, the code checks the status of the queue allocated to the aggregation tid, which might not yet be allocated and thus the queue index may be invalid.
Fix this by reserving a new queue in case the queue id is invalid.
While at it, clean up some unreachable code (a condition that is already handled earlier) and remove all the non-DQA comments since non-DQA mode is no longer supported.
--- drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 38 +++++++-------------------- 1 file changed, 11 insertions(+), 27 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/sta.c +11 -27
@@ -2436,28 +2436,12 @@ int iwl_mvm_sta_tx_agg_start(struct iwl_/* * Note the possible cases: -* 1. In DQA mode with an enabled TXQ - TXQ needs to become agg'ed -* 2. Non-DQA mode: the TXQ hasn't yet been enabled, so find a free -* one and mark it as reserved -* 3. In DQA mode, but no traffic yet on this TID: same treatment as in -* non-DQA mode, since the TXQ hasn't yet been allocated -* Don't support case 3 for new TX path as it is not expected to happen -* and aggregation will be offloaded soon anyway +* 1. An enabled TXQ - TXQ needs to become agg'ed +* 2. The TXQ hasn't yet been enabled, so find a free one and mark +* it as reserved */ txq_id = mvmsta->tid_data[tid].txq_id; -if (iwl_mvm_has_new_tx_api (mvm)) { -if (txq_id ==IWL_MVM_INVALID_QUEUE ) { - ret = -ENXIO ; - goto release_locks; - } - }else if (unlikely (mvm->queue_info[txq_id].status == -IWL_MVM_QUEUE_SHARED )) { - ret = -ENXIO ; -IWL_DEBUG_TX_QUEUES (mvm, -"Can't start tid %d agg on shared queue!\n" , - tid); - goto release_locks; - }else if (mvm->queue_info[txq_id].status !=IWL_MVM_QUEUE_READY ) { +if (txq_id ==IWL_MVM_INVALID_QUEUE ) { txq_id =iwl_mvm_find_free_queue (mvm, mvmsta->sta_id,IWL_MVM_DQA_MIN_DATA_QUEUE ,IWL_MVM_DQA_MAX_DATA_QUEUE );
@@ -2466,16 +2450,16 @@ int iwl_mvm_sta_tx_agg_start(struct iwl_IWL_ERR (mvm,"Failed to allocate agg queue\n" ); goto release_locks; } -/* -* TXQ shouldn't be in inactive mode for non-DQA, so getting -* an inactive queue from iwl_mvm_find_free_queue() is -* certainly a bug -*/ -WARN_ON (mvm->queue_info[txq_id].status == -IWL_MVM_QUEUE_INACTIVE );/* TXQ hasn't yet been enabled, so mark it only as reserved */ mvm->queue_info[txq_id].status =IWL_MVM_QUEUE_RESERVED ; + }else if (unlikely (mvm->queue_info[txq_id].status == +IWL_MVM_QUEUE_SHARED )) { + ret = -ENXIO ; +IWL_DEBUG_TX_QUEUES (mvm, +"Can't start tid %d agg on shared queue!\n" , + tid); + goto release_locks; }spin_unlock (&mvm->queue_info_lock);
Greg Kroah-Hartman
maintainerPATCH 271/496 drm/tegra: Shutdown on driver unbind
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thierry Reding <[email protected]>
[ Upstream commit 192b4af6cd28cdad9b42fd79c21a90a2aeb0bec7 ]
Since commit 846c7dfc1193 ("drm/atomic: Try to preserve the crtc enabled state in drm_atomic_remove_fb, v2."), removing the last framebuffer will no longer disable the corresponding pipeline, which causes the KMS core to complain about leaked connectors on driver unbind.
Fix this by calling drm_atomic_helper_shutdown() on driver unbind, which will cause all display pipelines to be shut down and therefore drop the extra references on the connectors.
--- drivers/gpu/drm/tegra/drm.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/tegra/drm.c +1 -0
@@ -250,6 +250,7 @@ static void tegra_drm_unload(struct drm_drm_kms_helper_poll_fini (drm);tegra_drm_fb_exit (drm); +drm_atomic_helper_shutdown (drm);drm_mode_config_cleanup (drm); err =host1x_device_exit (device);
Greg Kroah-Hartman
maintainerPATCH 272/496 perf/cgroup: Fix child event counting bug
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Song Liu <[email protected]>
[ Upstream commit c917e0f259908e75bd2a65877e25f9d90c22c848 ]
When a perf_event is attached to parent cgroup, it should count events for all children cgroups:
parent_group <---- perf_event
\
- child_group <---- process(es)
However, in our tests, we found this perf_event cannot report reliable results. Here is an example case:
# create cgroups mkdir -p /sys/fs/cgroup/p/c # start perf for parent group perf stat -e instructions -G "p"
# on another console, run test process in child cgroup: stressapptest -s 2 -M 1000 & echo $! > /sys/fs/cgroup/p/c/cgroup.procs
# after the test process is done, stop perf in the first console shows
<not counted> instructions p
The instruction should not be "not counted" as the process runs in the child cgroup.
We found this is because perf_event->cgrp and cpuctx->cgrp are not identical, thus perf_event->cgrp are not updated properly.
This patch fixes this by updating perf_cgroup properly for ancestor cgroup(s).
--- kernel/events/core.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
kernel/events/core.c +16 -5
@@ -642,9 +642,15 @@ static inline void __update_cgrp_time(ststatic inline void update_cgrp_time_from_cpuctx (struct perf_cpu_context *cpuctx) { -struct perf_cgroup *cgrp_out = cpuctx->cgrp; -if (cgrp_out) -__update_cgrp_time (cgrp_out); +struct perf_cgroup *cgrp = cpuctx->cgrp; +struct cgroup_subsys_state *css; + +if (cgrp) { +for (css = &cgrp->css; css; css = css->parent) { + cgrp = container_of(css, struct perf_cgroup, css); +__update_cgrp_time (cgrp); + } + } }static inline void update_cgrp_time_from_event (struct perf_event *event)
@@ -672,6 +678,7 @@ perf_cgroup_set_timestamp(struct task_st {struct perf_cgroup *cgrp;struct perf_cgroup_info *info; +struct cgroup_subsys_state *css;/* * ctx->lock held by caller
@@ -682,8 +689,12 @@ perf_cgroup_set_timestamp(struct task_streturn ; cgrp =perf_cgroup_from_task (task, ctx); - info =this_cpu_ptr (cgrp->info); - info->timestamp = ctx->timestamp; + +for (css = &cgrp->css; css; css = css->parent) { + cgrp = container_of(css, struct perf_cgroup, css); + info =this_cpu_ptr (cgrp->info); + info->timestamp = ctx->timestamp; + } } static DEFINE_PER_CPU(struct list_head, cgrp_cpuctx_list);
Greg Kroah-Hartman
maintainerPATCH 273/496 brcmfmac: Fix check for ISO3166 code
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Wahren <[email protected]>
[ Upstream commit 9b9322db5c5a1917a66c71fe47c3848a9a31227e ]
The commit "regulatory: add NUL to request alpha2" increases the length of alpha2 to 3. This causes a regression on brcmfmac, because brcmf_cfg80211_reg_notifier() expect valid ISO3166 codes in the complete array. So fix this accordingly.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +1 -1
@@ -6916,7 +6916,7 @@ static void brcmf_cfg80211_reg_notifier(return ;/* ignore non-ISO3166 country codes */ -for (i =0 ; i <sizeof (req->alpha2); i++) +for (i =0 ; i <2 ; i++)if (req->alpha2[i] <'A' || req->alpha2[i] >'Z' ) {brcmf_err ("not an ISO3166 code (0x%02x 0x%02x)\n" , req->alpha2[0 ], req->alpha2[1 ]);
Greg Kroah-Hartman
maintainerPATCH 274/496 kbuild: make scripts/adjust_autoksyms.sh robust against timestamp races
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Pitre <[email protected]>
[ Upstream commit 825d487583089f9a33d31650c9c41f6474aab7fc ]
Some filesystems have timestamps with coarse precision that may allow for a recently built object file to have the same timestamp as the updated time on one of its dependency files. When that happens, the object file doesn't get rebuilt as it should.
This is especially the case on filesystems that don't have sub-second time precision, such as ext3 or Ext4 with 128B inodes.
Let's prevent that by making sure updated dependency files have a newer timestamp than the first file we created (i.e. autoksyms.h.tmpnew).
--- scripts/adjust_autoksyms.sh | 7 +++++++ 1 file changed, 7 insertions(+)
scripts/adjust_autoksyms.sh +7 -0
@@ -84,6 +84,13 @@ while read sympath; do depfile="include/config/ksym/${sympath}.h" mkdir -p "$(dirname "$depfile")" touch "$depfile" + # Filesystems with coarse time precision may create timestamps + # equal to the one from a file that was very recently built and that + # needs to be rebuild. Let's guard against that by making sure our + # dep files are always newer than the first file we created here. + while [ ! "$depfile" -nt "$new_ksyms_file" ]; do + touch "$depfile" + done echo $((count += 1)) done | tail -1 ) changed=${changed:-0}
Greg Kroah-Hartman
maintainerPATCH 275/496 RDMA/ucma: Correct option size check using optlen
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chien Tin Tung <[email protected]>
[ Upstream commit 5f3e3b85cc0a5eae1c46d72e47d3de7bf208d9e2 ]
The option size check is using optval instead of optlen causing the set option call to fail. Use the correct field, optlen, for size check.
--- drivers/infiniband/core/ucma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/ucma.c +1 -1
@@ -1315,7 +1315,7 @@ static ssize_t ucma_set_option(struct ucif (IS_ERR (ctx))return PTR_ERR (ctx); -if (unlikely (cmd.optval >KMALLOC_MAX_SIZE )) +if (unlikely (cmd.optlen >KMALLOC_MAX_SIZE ))return -EINVAL ; optval = memdup_user((void __user *) (unsigned long) cmd.optval,
Greg Kroah-Hartman
maintainerPATCH 276/496 RDMA/qedr: fix QPs ack timeout configuration
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Kalderon, Michal" <[email protected]>
[ Upstream commit c3594f22302cca5e924e47ec1cc8edd265708f41 ]
QPs that were configured with ack timeout value lower than 1 msec will not implement re-transmission timeout. This means that if a packet / ACK were dropped, the QP will not retransmit this packet.
This can lead to an application hang.
--- drivers/infiniband/hw/qedr/verbs.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-)
drivers/infiniband/hw/qedr/verbs.c +15 -10
@@ -1903,18 +1903,23 @@ int qedr_modify_qp(struct ib_qp *ibqp, sSET_FIELD (qp_params.modify_flags,QED_ROCE_MODIFY_QP_VALID_ACK_TIMEOUT ,1 ); - qp_params.ack_timeout = attr->timeout; -if (attr->timeout) { -u32 temp; - - temp =4096 * (1UL << attr->timeout) /1000 /1000 ; -/* FW requires [msec] */ - qp_params.ack_timeout = temp; - }else { -/* Infinite */ +/* The received timeout value is an exponent used like this: +* "12.7.34 LOCAL ACK TIMEOUT +* Value representing the transport (ACK) timeout for use by +* the remote, expressed as: 4.096 * 2^timeout [usec]" +* The FW expects timeout in msec so we need to divide the usec +* result by 1000. We'll approximate 1000~2^10, and 4.096 ~ 2^2, +* so we get: 2^2 * 2^timeout / 2^10 = 2^(timeout - 8). +* The value of zero means infinite so we use a 'max_t' to make +* sure that sub 1 msec values will be configured as 1 msec. +*/ +if (attr->timeout) + qp_params.ack_timeout = +1 <<max_t (int, attr->timeout -8 ,0 ); +else qp_params.ack_timeout =0 ; - } } +if (attr_mask &IB_QP_RETRY_CNT ) {SET_FIELD (qp_params.modify_flags,QED_ROCE_MODIFY_QP_VALID_RETRY_CNT ,1 );
Greg Kroah-Hartman
maintainerPATCH 277/496 RDMA/qedr: Fix rc initialization on CNQ allocation failure
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Kalderon, Michal" <[email protected]>
[ Upstream commit b15606f47b89b0b09936d7f45b59ba6275527041 ]
Return code wasn't set properly when CNQ allocation failed. This only affect error message logging, currently user will receive an error message that says the qedr driver load failed with rc '0', instead of ENOMEM
--- drivers/infiniband/hw/qedr/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/hw/qedr/main.c +2 -1
@@ -782,7 +782,8 @@ static struct qedr_dev *qedr_add(struct dev->num_cnq = dev->ops->rdma_get_min_cnq_msix (cdev);if (!dev->num_cnq) { -DP_ERR (dev,"not enough CNQ resources.\n" ); +DP_ERR (dev,"Failed. At least one CNQ is required.\n" ); + rc = -ENOMEM ; goto init_err; }
Greg Kroah-Hartman
maintainerPATCH 278/496 RDMA/qedr: Fix QP state initialization race
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Kalderon, Michal" <[email protected]>
[ Upstream commit caf61b1b8b88ccf1451f7321a176393797e8d292 ]
Once the FW is transitioned to error, FLUSH cqes can be received. We want the driver to be aware of the fact that QP is already in error.
Without this fix, a user may see false error messages in the dmesg log, mentioning that a FLUSH cqe was received while QP is not in error state.
--- drivers/infiniband/hw/qedr/verbs.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
drivers/infiniband/hw/qedr/verbs.c +17 -3
@@ -1663,14 +1663,15 @@ static void qedr_reset_qp_hwq_info(strucstatic int qedr_update_qp_state (struct qedr_dev *dev,struct qedr_qp *qp, +enum qed_roce_qp_state cur_state,enum qed_roce_qp_state new_state) {int status =0 ; -if (new_state == qp->state) +if (new_state == cur_state)return 0 ; -switch (qp->state) { +switch (cur_state) {case QED_ROCE_QP_STATE_RESET :switch (new_state) {case QED_ROCE_QP_STATE_INIT :
@@ -1774,6 +1775,7 @@ int qedr_modify_qp(struct ib_qp *ibqp, sstruct qedr_dev *dev =get_qedr_dev (&qp->dev->ibdev);const struct ib_global_route *grh =rdma_ah_read_grh (&attr->ah_attr);enum ib_qp_state old_qp_state, new_qp_state; +enum qed_roce_qp_state cur_state;int rc =0 ; DP_DEBUG(dev, QEDR_MSG_QP,
@@ -1992,13 +1994,25 @@ int qedr_modify_qp(struct ib_qp *ibqp, s qp->dest_qp_num = attr->dest_qp_num; } + cur_state = qp->state; + +/* Update the QP state before the actual ramrod to prevent a race with +* fast path. Modifying the QP state to error will cause the device to +* flush the CQEs and while polling the flushed CQEs will considered as +* a potential issue if the QP isn't in error state. +*/ +if ((attr_mask &IB_QP_STATE ) && qp->qp_type !=IB_QPT_GSI && + !udata && qp_params.new_state ==QED_ROCE_QP_STATE_ERR ) + qp->state =QED_ROCE_QP_STATE_ERR ; +if (qp->qp_type !=IB_QPT_GSI ) rc = dev->ops->rdma_modify_qp (dev->rdma_ctx, qp->qed_qp, &qp_params);if (attr_mask &IB_QP_STATE ) {if ((qp->qp_type !=IB_QPT_GSI ) && (!udata)) - rc =qedr_update_qp_state (dev, qp, qp_params.new_state); + rc =qedr_update_qp_state (dev, qp, cur_state, + qp_params.new_state); qp->state = qp_params.new_state; }
Greg Kroah-Hartman
maintainerPATCH 279/496 net/sched: fix idr leak on the error path of tcf_bpf_init()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Davide Caratti <[email protected]>
[ Upstream commit bbc09e7842a5023ba5bc0f8d559b9dd464e44006 ]
when the following command sequence is entered
# tc action add action bpf bytecode '4,40 0 0 12,31 0 1 2048,6 0 0 262144,6 0 0 0' index 100 RTNETLINK answers: Invalid argument We have an error talking to the kernel # tc action add action bpf bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0' index 100 RTNETLINK answers: No space left on device We have an error talking to the kernel
act_bpf correctly refuses to install the first TC rule, because 31 is not a valid instruction. However, it refuses to install the second TC rule, even if the BPF code is correct. Furthermore, it's no more possible to install any other rule having the same value of 'index' until act_bpf module is unloaded/inserted again. After the idr has been reserved, call tcf_idr_release() instead of tcf_idr_cleanup(), to fix this issue.
--- net/sched/act_bpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/act_bpf.c +1 -1
@@ -356,7 +356,7 @@ static int tcf_bpf_init(struct net *net,return res; out:if (res ==ACT_P_CREATED ) -tcf_idr_cleanup (*act, est); +tcf_idr_release (*act, bind);return ret; }
Greg Kroah-Hartman
maintainerPATCH 280/496 net/sched: fix idr leak in the error path of tcf_simp_init()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Davide Caratti <[email protected]>
[ Upstream commit 60e10b3adc3bac0f6a894c28e0eb1f2d13607362 ]
if the kernel fails to duplicate 'sdata', creation of a new action fails with -ENOMEM. However, subsequent attempts to install the same action using the same value of 'index' systematically fail with -ENOSPC, and that value of 'index' will no more be usable by act_simple, until rmmod / insmod of act_simple.ko is done:
# tc actions add action simple sdata hello index 100 # tc actions list action simple
action order 0: Simple <hello>
index 100 ref 1 bind 0
# tc actions flush action simple # tc actions add action simple sdata hello index 100 RTNETLINK answers: Cannot allocate memory We have an error talking to the kernel # tc actions flush action simple # tc actions add action simple sdata hello index 100 RTNETLINK answers: No space left on device We have an error talking to the kernel # tc actions add action simple sdata hello index 100 RTNETLINK answers: No space left on device We have an error talking to the kernel ...
Fix this in the error path of tcf_simp_init(), calling tcf_idr_release() in place of tcf_idr_cleanup().
--- net/sched/act_simple.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/act_simple.c +1 -1
@@ -121,7 +121,7 @@ static int tcf_simp_init(struct net *net d =to_defact (*a); ret =alloc_defdata (d, defdata);if (ret <0 ) { -tcf_idr_cleanup (*a, est); +tcf_idr_release (*a, bind);return ret; } d->tcf_action = parm->action;
Greg Kroah-Hartman
maintainerPATCH 281/496 net/sched: fix idr leak in the error path of tcf_act_police_init()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Davide Caratti <[email protected]>
[ Upstream commit 5bf7f8185f7c7112decdfe3d3e5c5d5e67f099a1 ]
tcf_act_police_init() can fail after the idr has been successfully reserved (e.g., qdisc_get_rtab() may return NULL). When this happens, subsequent attempts to configure a police rule using the same idr value systematiclly fail with -ENOSPC:
# tc action add action police rate 1000 burst 1000 drop index 100 RTNETLINK answers: Cannot allocate memory We have an error talking to the kernel # tc action add action police rate 1000 burst 1000 drop index 100 RTNETLINK answers: No space left on device We have an error talking to the kernel # tc action add action police rate 1000 burst 1000 drop index 100 RTNETLINK answers: No space left on device ...
Fix this in the error path of tcf_act_police_init(), calling tcf_idr_release() in place of tcf_idr_cleanup().
--- net/sched/act_police.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/act_police.c +1 -1
@@ -194,7 +194,7 @@ failure:qdisc_put_rtab (P_tab);qdisc_put_rtab (R_tab);if (ret ==ACT_P_CREATED ) -tcf_idr_cleanup (*a, est); +tcf_idr_release (*a, bind);return err; }
Greg Kroah-Hartman
maintainerPATCH 282/496 net/sched: fix idr leak in the error path of tcp_pedit_init()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Davide Caratti <[email protected]>
[ Upstream commit 94fa3f929ec0c048b1f3658cc335b940df4f6d22 ]
tcf_pedit_init() can fail to allocate 'keys' after the idr has been successfully reserved. When this happens, subsequent attempts to configure a pedit rule using the same idr value systematically fail with -ENOSPC:
# tc action add action pedit munge ip ttl set 63 index 100 RTNETLINK answers: Cannot allocate memory We have an error talking to the kernel # tc action add action pedit munge ip ttl set 63 index 100 RTNETLINK answers: No space left on device We have an error talking to the kernel # tc action add action pedit munge ip ttl set 63 index 100 RTNETLINK answers: No space left on device We have an error talking to the kernel ...
Fix this in the error path of tcf_act_pedit_init(), calling tcf_idr_release() in place of tcf_idr_cleanup().
--- net/sched/act_pedit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/act_pedit.c +1 -1
@@ -176,7 +176,7 @@ static int tcf_pedit_init(struct net *ne p =to_pedit (*a); keys =kmalloc (ksize,GFP_KERNEL );if (keys ==NULL ) { -tcf_idr_cleanup (*a, est); +tcf_idr_release (*a, bind);kfree (keys_ex);return -ENOMEM ; }
Greg Kroah-Hartman
maintainerPATCH 283/496 net/sched: fix idr leak in the error path of __tcf_ipt_init()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Davide Caratti <[email protected]>
[ Upstream commit 1e46ef1762bb2e52f0f996131a4d16ed4e9fd065 ]
__tcf_ipt_init() can fail after the idr has been successfully reserved. When this happens, subsequent attempts to configure xt/ipt rules using the same idr value systematically fail with -ENOSPC:
# tc action add action xt -j LOG --log-prefix test1 index 100
tablename: mangle hook: NF_IP_POST_ROUTING
target: LOG level warning prefix "test1" index 100
RTNETLINK answers: Cannot allocate memory
We have an error talking to the kernel
Command "(null)" is unknown, try "tc actions help".
# tc action add action xt -j LOG --log-prefix test1 index 100
tablename: mangle hook: NF_IP_POST_ROUTING
target: LOG level warning prefix "test1" index 100
RTNETLINK answers: No space left on device
We have an error talking to the kernel
Command "(null)" is unknown, try "tc actions help".
# tc action add action xt -j LOG --log-prefix test1 index 100
tablename: mangle hook: NF_IP_POST_ROUTING
target: LOG level warning prefix "test1" index 100
RTNETLINK answers: No space left on device
We have an error talking to the kernel
...Fix this in the error path of __tcf_ipt_init(), calling tcf_idr_release() in place of tcf_idr_cleanup(). Since tcf_ipt_release() can now be called when tcfi_t is NULL, we also need to protect calls to ipt_destroy_target() to avoid NULL pointer dereference.
--- net/sched/act_ipt.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
net/sched/act_ipt.c +6 -3
@@ -80,9 +80,12 @@ static void ipt_destroy_target(struct xtstatic void tcf_ipt_release (struct tc_action *a,int bind) {struct tcf_ipt *ipt =to_ipt (a); -ipt_destroy_target (ipt->tcfi_t); + +if (ipt->tcfi_t) { +ipt_destroy_target (ipt->tcfi_t); +kfree (ipt->tcfi_t); + }kfree (ipt->tcfi_tname); -kfree (ipt->tcfi_t); }static const struct nla_policy ipt_policy[TCA_IPT_MAX +1 ] = {
@@ -187,7 +190,7 @@ err2:kfree (tname); err1:if (ret ==ACT_P_CREATED ) -tcf_idr_cleanup (*a, est); +tcf_idr_release (*a, bind);return err; }
Greg Kroah-Hartman
maintainerPATCH 284/496 net/sched: fix idr leak in the error path of tcf_skbmod_init()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Davide Caratti <[email protected]>
[ Upstream commit f29cdfbe33d6915ba8056179b0041279a67e3647 ]
tcf_skbmod_init() can fail after the idr has been successfully reserved. When this happens, every subsequent attempt to configure skbmod rules using the same idr value will systematically fail with -ENOSPC, unless the first attempt was done using the 'replace' keyword:
# tc action add action skbmod swap mac index 100 RTNETLINK answers: Cannot allocate memory We have an error talking to the kernel # tc action add action skbmod swap mac index 100 RTNETLINK answers: No space left on device We have an error talking to the kernel # tc action add action skbmod swap mac index 100 RTNETLINK answers: No space left on device We have an error talking to the kernel ...
Fix this in tcf_skbmod_init(), ensuring that tcf_idr_release() is called on the error path when the idr has been reserved, but not yet inserted. Also, don't test 'ovr' in the error path, to avoid a 'replace' failure implicitly become a 'delete' that leaks refcount in act_skbmod module:
# rmmod act_skbmod; modprobe act_skbmod # tc action add action skbmod swap mac index 100 # tc action add action skbmod swap mac continue index 100 RTNETLINK answers: File exists We have an error talking to the kernel # tc action replace action skbmod swap mac continue index 100 RTNETLINK answers: Cannot allocate memory We have an error talking to the kernel # tc action list action skbmod # # rmmod act_skbmod rmmod: ERROR: Module act_skbmod is in use
--- net/sched/act_skbmod.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/act_skbmod.c +1 -1
@@ -155,7 +155,7 @@ static int tcf_skbmod_init(struct net *nASSERT_RTNL (); p =kzalloc (sizeof (struct tcf_skbmod_params ),GFP_KERNEL );if (unlikely (!p)) { -if (ovr) +if (ret ==ACT_P_CREATED )tcf_idr_release (*a, bind);return -ENOMEM ; }
Greg Kroah-Hartman
maintainerPATCH 285/496 net: dsa: Fix functional dsa-loop dependency on FIXED_PHY
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <[email protected]>
[ Upstream commit 40013ff20b1beed31184935fc0aea6a859d4d4ef ]
We have a functional dependency on the FIXED_PHY MDIO bus because we register fixed PHY devices "the old way" which only works if the code that does this has had a chance to run before the fixed MDIO bus is probed. Make sure we account for that and have dsa_loop_bdinfo.o be either built-in or modular depending on whether CONFIG_FIXED_PHY reflects that too.
--- drivers/net/dsa/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/dsa/Makefile +4 -1
@@ -1,7 +1,10 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_NET_DSA_BCM_SF2) += bcm-sf2.o bcm-sf2-objs := bcm_sf2.o bcm_sf2_cfp.o -obj-$(CONFIG_NET_DSA_LOOP) += dsa_loop.o dsa_loop_bdinfo.o +obj-$(CONFIG_NET_DSA_LOOP) += dsa_loop.o +ifdef CONFIG_NET_DSA_LOOP +obj-$(CONFIG_FIXED_PHY) += dsa_loop_bdinfo.o +endif obj-$(CONFIG_NET_DSA_MT7530) += mt7530.o obj-$(CONFIG_NET_DSA_MV88E6060) += mv88e6060.o obj-$(CONFIG_NET_DSA_QCA8K) += qca8k.o
Greg Kroah-Hartman
maintainerPATCH 286/496 macsec: missing dev_put() on error in macsec_newlink()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 5dcd8400884cc4a043a6d4617e042489e5d566a9 ]
We moved the dev_hold(real_dev); call earlier in the function but forgot to update the error paths.
--- drivers/net/macsec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/macsec.c +3 -2
@@ -3248,7 +3248,7 @@ static int macsec_newlink(struct net *ne err =netdev_upper_dev_link (real_dev, dev);if (err <0 ) - goto unregister; + goto put_dev;/* need to be already registered so that ->init has run and * the MAC addr is set
@@ -3284,7 +3284,8 @@ del_dev:macsec_del_dev (macsec); unlink:netdev_upper_dev_unlink (real_dev, dev); -unregister: +put_dev: +dev_put (real_dev);unregister_netdevice (dev);return err; }
Re: [PATCH 4.14 286/496] macsec: missing dev_put() on error in macsec_newlink()
Hi Greg,
I'm sorryt. This one was buggy. We did a revert of it in commit bd28899dd34f ("Revert "macsec: missing dev_put() on error in macsec_newlink()"").
You have queued for 4.8 as well.
regards,
dan carpenter
Quoted 42 lines · Greg Kroah-Hartman
4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit
5dcd8400884cc4a043a6d4617e042489e5d566a9]We moved the
dev_hold(real_dev); call earlier in the function but forgot to update the error paths.Fixes 0759e552bce7 ("macsec: fix negative refcnt on parent link")Signed-off-by Dan Carpenter <[email protected]>Signed-off-by David S. Miller <[email protected]>Signed-off-by Sasha Levin <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/net/macsec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/net/macsec.c +3
-2@@ -3248,7 +3248,7 @@ static int macsec_newlink(struct net *ne err =netdev_upper_dev_link (real_dev, dev);if (err <0 ) - goto unregister; + goto put_dev;/* need to be already registered so that ->init has run and * the MAC addr is set @@ -3284,7 +3284,8 @@ del_dev:macsec_del_dev (macsec); unlink:netdev_upper_dev_unlink (real_dev, dev); -unregister: +put_dev: +dev_put (real_dev);unregister_netdevice (dev);return err; }
Greg Kroah-Hartman
maintainerRe: [PATCH 4.14 286/496] macsec: missing dev_put() on error in macsec_newlink()
Quoted 7 lines · Dan Carpenter
Hi Greg,
I'm sorryt. This one was buggy. We did a revert of it in commit
bd28899dd34f("Revert "macsec: missingdev_put()on error inmacsec_newlink()"").You have queued for 4.8 as well.
Not a problem, thanks for letting me know, I've dropped it from both queues now.
greg k-h
Greg Kroah-Hartman
maintainerPATCH 287/496 drm/ast: Fixed 1280x800 Display Issue
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Y.C. Chen" <[email protected]>
[ Upstream commit 5a9f698feb11b198f17b2acebbfe0e2716a3beed ]
The original ast driver cannot display properly if the resolution is 1280x800 and the pixel clock is 83.5MHz. Here is the update to fix it.
--- drivers/gpu/drm/ast/ast_tables.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/ast/ast_tables.h +2 -2
@@ -97,7 +97,7 @@ static const struct ast_vbios_dclk_info {0x67, 0x22, 0x00}, /* 0E: VCLK157_5 */ {0x6A, 0x22, 0x00}, /* 0F: VCLK162 */ {0x4d, 0x4c, 0x80}, /* 10: VCLK154 */ - {0xa7, 0x78, 0x80}, /* 11: VCLK83.5 */ + {0x68, 0x6f, 0x80}, /* 11: VCLK83.5 */ {0x28, 0x49, 0x80}, /* 12: VCLK106.5 */ {0x37, 0x49, 0x80}, /* 13: VCLK146.25 */ {0x1f, 0x45, 0x80}, /* 14: VCLK148.5 */
@@ -127,7 +127,7 @@ static const struct ast_vbios_dclk_info {0x67, 0x22, 0x00}, /* 0E: VCLK157_5 */ {0x6A, 0x22, 0x00}, /* 0F: VCLK162 */ {0x4d, 0x4c, 0x80}, /* 10: VCLK154 */ - {0xa7, 0x78, 0x80}, /* 11: VCLK83.5 */ + {0x68, 0x6f, 0x80}, /* 11: VCLK83.5 */ {0x28, 0x49, 0x80}, /* 12: VCLK106.5 */ {0x37, 0x49, 0x80}, /* 13: VCLK146.25 */ {0x1f, 0x45, 0x80}, /* 14: VCLK148.5 */
Greg Kroah-Hartman
maintainerPATCH 288/496 mm/mempolicy.c: avoid use uninitialized preferred_node
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yisheng Xie <[email protected]>
[ Upstream commit 8970a63e965b43288c4f5f40efbc2bbf80de7f16 ]
Alexander reported a use of uninitialized memory in __mpol_equal(), which is caused by incorrect use of preferred_node.
When mempolicy in mode MPOL_PREFERRED with flags MPOL_F_LOCAL, it uses numa_node_id() instead of preferred_node, however, __mpol_equal() uses preferred_node without checking whether it is MPOL_F_LOCAL or not.
--- mm/mempolicy.c | 3 +++ 1 file changed, 3 insertions(+)
mm/mempolicy.c +3 -0
@@ -2128,6 +2128,9 @@ bool __mpol_equal(struct mempolicy *a, scase MPOL_INTERLEAVE :return !!nodes_equal (a->v.nodes, b->v.nodes);case MPOL_PREFERRED : +/* a's ->flags is the same as b's */ +if (a->flags &MPOL_F_LOCAL ) +return true;return a->v.preferred_node == b->v.preferred_node;default :BUG ();
Greg Kroah-Hartman
maintainerPATCH 289/496 mm, thp: do not cause memcg oom for thp
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Rientjes <[email protected]>
[ Upstream commit 9d3c3354bb85bab4d865fe95039443f09a4c8394 ]
Commit 2516035499b9 ("mm, thp: remove __GFP_NORETRY from khugepaged and madvised allocations") changed the page allocator to no longer detect thp allocations based on __GFP_NORETRY.
It did not, however, modify the mem cgroup try_charge() path to avoid oom kill for either khugepaged collapsing or thp faulting. It is never expected to oom kill a process to allocate a hugepage for thp; reclaim is governed by the thp defrag mode and MADV_HUGEPAGE, but allocations (and charging) should fallback instead of oom killing processes.
--- mm/huge_memory.c | 5 +++-- mm/khugepaged.c | 8 ++++++-- 2 files changed, 9 insertions(+), 4 deletions(-)
mm/huge_memory.c +3 -2
@@ -555,7 +555,8 @@ static int __do_huge_pmd_anonymous_page(VM_BUG_ON_PAGE (!PageCompound (page), page); -if (mem_cgroup_try_charge (page, vma->vm_mm, gfp, &memcg, true)) { +if (mem_cgroup_try_charge (page, vma->vm_mm, gfp | __GFP_NORETRY, &memcg, + true)) {put_page (page);count_vm_event (THP_FAULT_FALLBACK );return VM_FAULT_FALLBACK ;
@@ -1304,7 +1305,7 @@ alloc: }if (unlikely (mem_cgroup_try_charge (new_page, vma->vm_mm, - huge_gfp, &memcg, true))) { + huge_gfp | __GFP_NORETRY, &memcg, true))) {put_page (new_page);split_huge_pmd (vma, vmf->pmd, vmf->address);if (page)
mm/khugepaged.c +6 -2
@@ -965,7 +965,9 @@ static void collapse_huge_page(struct mm goto out_nolock; } -if (unlikely (mem_cgroup_try_charge (new_page, mm, gfp, &memcg, true))) { +/* Do not oom kill for khugepaged charges */ +if (unlikely (mem_cgroup_try_charge (new_page, mm, gfp | __GFP_NORETRY, + &memcg, true))) { result =SCAN_CGROUP_CHARGE_FAIL ; goto out_nolock; }
@@ -1324,7 +1326,9 @@ static void collapse_shmem(struct mm_str goto out; } -if (unlikely (mem_cgroup_try_charge (new_page, mm, gfp, &memcg, true))) { +/* Do not oom kill for khugepaged charges */ +if (unlikely (mem_cgroup_try_charge (new_page, mm, gfp | __GFP_NORETRY, + &memcg, true))) { result =SCAN_CGROUP_CHARGE_FAIL ; goto out; }
Greg Kroah-Hartman
maintainerPATCH 290/496 xfrm: Fix transport mode skb control buffer usage.
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steffen Klassert <[email protected]>
[ Upstream commit 9a3fb9fb84cc30577c1b012a6a3efda944684291 ]
A recent commit introduced a new struct xfrm_trans_cb that is used with the sk_buff control buffer. Unfortunately it placed the structure in front of the control buffer and overlooked that the IPv4/IPv6 control buffer is still needed for some layer 4 protocols. As a result the IPv4/IPv6 control buffer is overwritten with this structure. Fix this by setting a apropriate header in front of the structure.
Fixes acf568ee859f ("xfrm: Reinject transport-mode packets ...")
--- net/xfrm/xfrm_input.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/xfrm/xfrm_input.c +6 -0
@@ -26,6 +26,12 @@ struct xfrm_trans_tasklet { };struct xfrm_trans_cb { +union { +struct inet_skb_parm h4; +#if IS_ENABLED (CONFIG_IPV6 ) +struct inet6_skb_parm h6; +#endif + } header;int (*finish)(struct net *net,struct sock *sk,struct sk_buff *skb); };
Greg Kroah-Hartman
maintainerPATCH 291/496 selftests: ftrace: Add probe event argument syntax testcase
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu <[email protected]>
[ Upstream commit 871bef2000968c312a4000b2f56d370dcedbc93c ]
Add a testcase for probe event argument syntax which ensures the kprobe_events interface correctly parses given event arguments.
--- tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_syntax.tc | 97 ++++++++++ 1 file changed, 97 insertions(+) create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_syntax.tc
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_syntax.tc new file +97 -0
@@ -0,0 +1,97 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# description: Kprobe event argument syntax + +[ -f kprobe_events ] || exit_unsupported # this is configurable + +grep "x8/16/32/64" README > /dev/null || exit_unsupported # version issue + +echo 0 > events/enable +echo > kprobe_events + +PROBEFUNC="vfs_read" +GOODREG= +BADREG= +GOODSYM="_sdata" +if ! grep -qw ${GOODSYM} /proc/kallsyms ; then + GOODSYM=$PROBEFUNC +fi +BADSYM="deaqswdefr" +SYMADDR=0x`grep -w ${GOODSYM} /proc/kallsyms | cut -f 1 -d " "` +GOODTYPE="x16" +BADTYPE="y16" + +case `uname -m` in +x86_64|i[3456]86) + GOODREG=%ax + BADREG=%ex +;; +aarch64) + GOODREG=%x0 + BADREG=%ax +;; +arm*) + GOODREG=%r0 + BADREG=%ax +;; +esac + +test_goodarg() # Good-args +{ + while [ "$1" ]; do + echo "p ${PROBEFUNC} $1" > kprobe_events + shift 1 + done; +} + +test_badarg() # Bad-args +{ + while [ "$1" ]; do + ! echo "p ${PROBEFUNC} $1" > kprobe_events + shift 1 + done; +} + +echo > kprobe_events + +: "Register access" +test_goodarg ${GOODREG} +test_badarg ${BADREG} + +: "Symbol access" +test_goodarg "@${GOODSYM}" "@${SYMADDR}" "@${GOODSYM}+10" "@${GOODSYM}-10" +test_badarg "@" "@${BADSYM}" "@${GOODSYM}*10" "@${GOODSYM}/10" \ + "@${GOODSYM}%10" "@${GOODSYM}&10" "@${GOODSYM}|10" + +: "Stack access" +test_goodarg "\$stack" "\$stack0" "\$stack1" +test_badarg "\$stackp" "\$stack0+10" "\$stack1-10" + +: "Retval access" +echo "r ${PROBEFUNC} \$retval" > kprobe_events +! echo "p ${PROBEFUNC} \$retval" > kprobe_events + +: "Comm access" +test_goodarg "\$comm" + +: "Indirect memory access" +test_goodarg "+0(${GOODREG})" "-0(${GOODREG})" "+10(\$stack)" \ + "+0(\$stack1)" "+10(@${GOODSYM}-10)" "+0(+10(+20(\$stack)))" +test_badarg "+(${GOODREG})" "(${GOODREG}+10)" "-(${GOODREG})" "(${GOODREG})" \ + "+10(\$comm)" "+0(${GOODREG})+10" + +: "Name assignment" +test_goodarg "varname=${GOODREG}" +test_badarg "varname=varname2=${GOODREG}" + +: "Type syntax" +test_goodarg "${GOODREG}:${GOODTYPE}" +test_badarg "${GOODREG}::${GOODTYPE}" "${GOODREG}:${BADTYPE}" \ + "${GOODTYPE}:${GOODREG}" + +: "Combination check" + +test_goodarg "\$comm:string" "+0(\$stack):string" +test_badarg "\$comm:x64" "\$stack:string" "${GOODREG}:string" + +echo > kprobe_events
Greg Kroah-Hartman
maintainerPATCH 292/496 selftests: ftrace: Add a testcase for string type with kprobe_event
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu <[email protected]>
[ Upstream commit 5fbdbed797b6d12d043a5121fdbc8d8b49d10e80 ]
Add a testcase for string type with kprobe event. This tests good/bad syntax combinations and also the traced data is correct in several way.
--- tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc | 46 ++++++++++ 1 file changed, 46 insertions(+) create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc new file +46 -0
@@ -0,0 +1,46 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# description: Kprobe event string type argument + +[ -f kprobe_events ] || exit_unsupported # this is configurable + +echo 0 > events/enable +echo > kprobe_events + +case `uname -m` in +x86_64) + ARG2=%si + OFFS=8 +;; +i[3456]86) + ARG2=%cx + OFFS=4 +;; +aarch64) + ARG2=%x1 + OFFS=8 +;; +arm*) + ARG2=%r1 + OFFS=4 +;; +*) + echo "Please implement other architecture here" + exit_untested +esac + +: "Test get argument (1)" +echo "p:testprobe create_trace_kprobe arg1=+0(+0(${ARG2})):string" > kprobe_events +echo 1 > events/kprobes/testprobe/enable +! echo test >> kprobe_events +tail -n 1 trace | grep -qe "testprobe.* arg1=\"test\"" + +echo 0 > events/kprobes/testprobe/enable +: "Test get argument (2)" +echo "p:testprobe create_trace_kprobe arg1=+0(+0(${ARG2})):string arg2=+0(+${OFFS}(${ARG2})):string" > kprobe_events +echo 1 > events/kprobes/testprobe/enable +! echo test1 test2 >> kprobe_events +tail -n 1 trace | grep -qe "testprobe.* arg1=\"test1\" arg2=\"test2\"" + +echo 0 > events/enable +echo > kprobe_events
Greg Kroah-Hartman
maintainerPATCH 293/496 selftests: ftrace: Add a testcase for probepoint
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu <[email protected]>
[ Upstream commit dfa453bc90eca0febff33c8d292a656e53702158 ]
Add a testcase for probe point definition. This tests symbol, address and symbol+offset syntax. The offset must be positive and smaller than UINT_MAX.
--- tools/testing/selftests/ftrace/test.d/kprobe/probepoint.tc | 43 +++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/probepoint.tc
tools/testing/selftests/ftrace/test.d/kprobe/probepoint.tc new file +43 -0
@@ -0,0 +1,43 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# description: Kprobe events - probe points + +[ -f kprobe_events ] || exit_unsupported # this is configurable + +TARGET_FUNC=create_trace_kprobe + +dec_addr() { # hexaddr + printf "%d" "0x"`echo $1 | tail -c 8` +} + +set_offs() { # prev target next + A1=`dec_addr $1` + A2=`dec_addr $2` + A3=`dec_addr $3` + TARGET="0x$2" # an address + PREV=`expr $A1 - $A2` # offset to previous symbol + NEXT=+`expr $A3 - $A2` # offset to next symbol + OVERFLOW=+`printf "0x%x" ${PREV}` # overflow offset to previous symbol +} + +# We have to decode symbol addresses to get correct offsets. +# If the offset is not an instruction boundary, it cause -EILSEQ. +set_offs `grep -A1 -B1 ${TARGET_FUNC} /proc/kallsyms | cut -f 1 -d " " | xargs` + +UINT_TEST=no +# printf "%x" -1 returns (unsigned long)-1. +if [ `printf "%x" -1 | wc -c` != 9 ]; then + UINT_TEST=yes +fi + +echo 0 > events/enable +echo > kprobe_events +echo "p:testprobe ${TARGET_FUNC}" > kprobe_events +echo "p:testprobe ${TARGET}" > kprobe_events +echo "p:testprobe ${TARGET_FUNC}${NEXT}" > kprobe_events +! echo "p:testprobe ${TARGET_FUNC}${PREV}" > kprobe_events +if [ "${UINT_TEST}" = yes ]; then +! echo "p:testprobe ${TARGET_FUNC}${OVERFLOW}" > kprobe_events +fi +echo > kprobe_events +clear_trace
Greg Kroah-Hartman
maintainerPATCH 294/496 drm/amdkfd: Fix scratch memory with HWS enabled
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Kuehling <[email protected]>
[ Upstream commit c70a36268799cf2f902b5a31e452571fcb96bfe9 ]
Program sh_hidden_private_base_vmid correctly in the map-process PM4 packet.
--- drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c +1 -2
@@ -166,8 +166,7 @@ static int pm_create_map_process(struct packet->sh_mem_ape1_base = qpd->sh_mem_ape1_base; packet->sh_mem_ape1_limit = qpd->sh_mem_ape1_limit; -/* TODO: scratch support */ - packet->sh_hidden_private_base_vmid =0 ; + packet->sh_hidden_private_base_vmid = qpd->sh_hidden_private_base; packet->gds_addr_lo =lower_32_bits (qpd->gds_context_area); packet->gds_addr_hi =upper_32_bits (qpd->gds_context_area);
Greg Kroah-Hartman
maintainerPATCH 297/496 ARM: 8748/1: mm: Define vdso_start, vdso_end as array
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jinbum Park <[email protected]>
[ Upstream commit 73b9160d0dfe44dfdaffd6465dc1224c38a4a73c ]
Define vdso_start, vdso_end as array to avoid compile-time analysis error for the case of built with CONFIG_FORTIFY_SOURCE.
and, since vdso_start, vdso_end are used in vdso.c only, move extern-declaration from vdso.h to vdso.c.
If kernel is built with CONFIG_FORTIFY_SOURCE,
compile-time error happens at this code.
- if (memcmp(&vdso_start, "177ELF", 4))
The size of "&vdso_start" is recognized as 1 byte, but n is 4, So that compile-time error is reported.
--- arch/arm/include/asm/vdso.h | 2 -- arch/arm/kernel/vdso.c | 12 +++++++----- 2 files changed, 7 insertions(+), 7 deletions(-)
arch/arm/include/asm/vdso.h +0 -2
@@ -12,8 +12,6 @@ struct mm_struct;void arm_install_vdso (struct mm_struct *mm,unsigned long addr); -extern char vdso_start, vdso_end; -extern unsigned int vdso_total_pages;#else /* CONFIG_VDSO */
arch/arm/kernel/vdso.c +7 -5
@@ -39,6 +39,8 @@static struct page **vdso_text_pagelist; +extern char vdso_start[], vdso_end[]; +/* Total number of pages needed for the data and text portions of the VDSO. */ unsigned int vdso_total_pages__ro_after_init ;
@@ -197,13 +199,13 @@ static int __init vdso_init(void)unsigned int text_pages;int i; -if (memcmp (&vdso_start,"\177ELF" ,4 )) { +if (memcmp (vdso_start,"\177ELF" ,4 )) {pr_err ("VDSO is not a valid ELF object!\n" );return -ENOEXEC ; } - text_pages = (&vdso_end - &vdso_start) >>PAGE_SHIFT ; -pr_debug ("vdso: %i text pages at base %p\n" , text_pages, &vdso_start); + text_pages = (vdso_end - vdso_start) >>PAGE_SHIFT ; +pr_debug ("vdso: %i text pages at base %p\n" , text_pages, vdso_start);/* Allocate the VDSO text pagelist */ vdso_text_pagelist = kcalloc(text_pages, sizeof(struct page *),
@@ -218,7 +220,7 @@ static int __init vdso_init(void)for (i =0 ; i < text_pages; i++) {struct page *page; - page =virt_to_page (&vdso_start + i *PAGE_SIZE ); + page =virt_to_page (vdso_start + i *PAGE_SIZE ); vdso_text_pagelist[i] = page; }
@@ -229,7 +231,7 @@ static int __init vdso_init(void) cntvct_ok =cntvct_functional (); -patch_vdso (&vdso_start); +patch_vdso (vdso_start);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 298/496 lan78xx: Set ASD in MAC_CR when EEE is enabled.
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Raghuram Chary J <[email protected]>
[ Upstream commit e69647a19c870c2f919e4d5023af8a515e8ef25f ]
Description:
EEE does not work with lan7800 when AutoSpeed is not set. (This can happen when EEPROM is not populated or configured incorrectly)
Root-Cause:
When EEE is enabled, the mac config register ASD is not set i.e. in default state, causing EEE fail.
Fix:
Set the register when eeprom is not present.
--- drivers/net/usb/lan78xx.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/net/usb/lan78xx.c +10 -0
@@ -2352,6 +2352,7 @@ static int lan78xx_reset(struct lan78xx_u32 buf;int ret =0 ;unsigned long timeout; +u8 sig; ret =lan78xx_read_reg (dev,HW_CFG , &buf); buf |=HW_CFG_LRST_ ;
@@ -2451,6 +2452,15 @@ static int lan78xx_reset(struct lan78xx_/* LAN7801 only has RGMII mode */ if (dev->chipid ==ID_REV_CHIP_ID_7801_ ) buf &= ~MAC_CR_GMII_EN_ ; + +if (dev->chipid ==ID_REV_CHIP_ID_7800_ ) { + ret =lan78xx_read_raw_eeprom (dev,0 ,1 , &sig); +if (!ret && sig !=EEPROM_INDICATOR ) { +/* Implies there is no external eeprom. Set mac speed */ +netdev_info (dev->net,"No External EEPROM. Setting MAC Speed\n" ); + buf |=MAC_CR_AUTO_DUPLEX_ |MAC_CR_AUTO_SPEED_ ; + } + } ret =lan78xx_write_reg (dev,MAC_CR , buf); ret =lan78xx_read_reg (dev,MAC_TX , &buf);
Greg Kroah-Hartman
maintainerPATCH 299/496 net: qmi_wwan: add BroadMobi BM806U 2020:2033
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pawel Dembicki <[email protected]>
[ Upstream commit 743989254ea9f132517806d8893ca9b6cf9dc86b ]
BroadMobi BM806U is an Qualcomm MDM9225 based 3G/4G modem. Tested hardware BM806U is mounted on D-Link DWR-921-C3 router. The USB id is added to qmi_wwan.c to allow QMI communication with the BM806U.
Tested on 4.14 kernel and OpenWRT.
--- drivers/net/usb/qmi_wwan.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/usb/qmi_wwan.c +1 -0
@@ -1184,6 +1184,7 @@ static const struct usb_device_id produc {QMI_FIXED_INTF(0x19d2, 0x2002, 4)}, /* ZTE (Vodafone) K3765-Z */ {QMI_FIXED_INTF(0x2001, 0x7e19, 4)}, /* D-Link DWM-221 B1 */ {QMI_FIXED_INTF(0x2001, 0x7e35, 4)}, /* D-Link DWM-222 */ + {QMI_FIXED_INTF(0x2020, 0x2033, 4)}, /* BroadMobi BM806U */ {QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)}, /* Sierra Wireless MC7700 */ {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */ {QMI_FIXED_INTF(0x1199, 0x68a2, 8)}, /* Sierra Wireless MC7710 in QMI mode */
Greg Kroah-Hartman
maintainerPATCH 300/496 bonding: fix the err path for dev hwaddr sync in bond_enslave
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xin Long <[email protected]>
[ Upstream commit 5c78f6bfae2b10ff70e21d343e64584ea6280c26 ]
vlan_vids_add_by_dev is called right after dev hwaddr sync, so on the err path it should unsync dev hwaddr. Otherwise, the slave dev's hwaddr will never be unsync when this err happens.
--- drivers/net/bonding/bond_main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/bonding/bond_main.c +5 -1
@@ -1528,7 +1528,7 @@ int bond_enslave(struct net_device *bondif (res) {netdev_err (bond_dev,"Couldn't add bond vlan ids to %s\n" , slave_dev->name); - goto err_close; + goto err_hwaddr_unsync; } prev_slave =bond_last_slave (bond);
@@ -1769,6 +1769,10 @@ err_detach:synchronize_rcu ();slave_disable_netpoll (new_slave); +err_hwaddr_unsync: +if (!bond_uses_primary (bond)) +bond_hw_addr_flush (bond_dev, slave_dev); + err_close: slave_dev->priv_flags &= ~IFF_BONDING ;dev_close (slave_dev);
Greg Kroah-Hartman
maintainerPATCH 301/496 net: dsa: mt7530: fix module autoloading for OF platform drivers
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Wang <[email protected]>
[ Upstream commit 3c82b372a9f44aa224b8d5106ff6f1ad516fa8a8 ]
It's required to create a modules.alias via MODULE_DEVICE_TABLE helper for the OF platform driver. Otherwise, module autoloading cannot work.
--- drivers/net/dsa/mt7530.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/dsa/mt7530.c +1 -0
@@ -1122,6 +1122,7 @@ static const struct of_device_id mt7530_ { .compatible = "mediatek,mt7530" }, { /* sentinel */ }, }; +MODULE_DEVICE_TABLE (of, mt7530_of_match);static struct mdio_driver mt7530_mdio_driver = { .probe = mt7530_probe,
Greg Kroah-Hartman
maintainerPATCH 302/496 net/mlx5: Make eswitch support to depend on switchdev
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Or Gerlitz <[email protected]>
[ Upstream commit f125376b06bcc57dfb0216ac8d6ec6d5dcf81025 ]
Add dependancy for switchdev to be congfigured as any user-space control plane SW is expected to use the HW switchdev ID to locate the representors related to VFs of a certain PF and apply SW/offloaded switching on them.
--- drivers/net/ethernet/mellanox/mlx5/core/Kconfig | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 4 ++-- drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 2 -- 3 files changed, 3 insertions(+), 5 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/Kconfig +1 -1
@@ -46,7 +46,7 @@ config MLX5_MPFS config MLX5_ESWITCH bool "Mellanox Technologies MLX5 SRIOV E-Switch support" - depends on MLX5_CORE_EN + depends on MLX5_CORE_EN && NET_SWITCHDEV default y ---help--- Mellanox Technologies Ethernet SRIOV E-Switch support in ConnectX NIC.
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +2 -2
@@ -4022,7 +4022,7 @@ static void mlx5e_set_netdev_dev_addr(st } } -#if IS_ENABLED (CONFIG_NET_SWITCHDEV ) &&IS_ENABLED (CONFIG_MLX5_ESWITCH ) +#if IS_ENABLED (CONFIG_MLX5_ESWITCH )static const struct switchdev_ops mlx5e_switchdev_ops = { .switchdev_port_attr_get = mlx5e_attr_get, };
@@ -4126,7 +4126,7 @@ static void mlx5e_build_nic_netdev(strucmlx5e_set_netdev_dev_addr (netdev); -#if IS_ENABLED (CONFIG_NET_SWITCHDEV ) &&IS_ENABLED (CONFIG_MLX5_ESWITCH ) +#if IS_ENABLED (CONFIG_MLX5_ESWITCH )if (MLX5_VPORT_MANAGER (mdev)) netdev->switchdev_ops = &mlx5e_switchdev_ops;#endif
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +0 -2
@@ -825,9 +825,7 @@ static void mlx5e_build_rep_netdev(struc netdev->ethtool_ops = &mlx5e_rep_ethtool_ops; -#ifdef CONFIG_NET_SWITCHDEV netdev->switchdev_ops = &mlx5e_rep_switchdev_ops; -#endif netdev->features |=NETIF_F_VLAN_CHALLENGED |NETIF_F_HW_TC |NETIF_F_NETNS_LOCAL ; netdev->hw_features |=NETIF_F_HW_TC ;
Greg Kroah-Hartman
maintainerPATCH 303/496 perf/x86/intel: Fix linear IP of PEBS real_ip on Haswell and later CPUs
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephane Eranian <[email protected]>
[ Upstream commit 71eb9ee9596d8df3d5723c3cfc18774c6235e8b1 ]
this patch fix a bug in how the pebs->real_ip is handled in the PEBS handler. real_ip only exists in Haswell and later processor. It is actually the eventing IP, i.e., where the event occurred. As opposed to the pebs->ip which is the PEBS interrupt IP which is always off by one.
The problem is that the real_ip just like the IP needs to be fixed up because PEBS does not record all the machine state registers, and in particular the code segement (cs). This is why we have the set_linear_ip() function. The problem was that set_linear_ip() was only used on the pebs->ip and not the pebs->real_ip.
We have profiles which ran into invalid callstacks because of this. Here is an example:
..... 0: ffffffffffffff80 recent entry, marker kernel v ..... 1: 000000000040044d <= user address in kernel space! ..... 2: fffffffffffffe00 marker enter user v ..... 3: 000000000040044d ..... 4: 00000000004004b6 oldest entry
Debugging output in get_perf_callchain():
[ 857.769909] CALLCHAIN: CPU8 ip=40044d regs->cs=10 user_mode(regs)=0
The problem is that the kernel entry in 1: points to a user level address. How can that be?
The reason is that with PEBS sampling the instruction that caused the event to occur and the instruction where the CPU was when the interrupt was posted may be far apart. And sometime during that time window, the privilege level may change. This happens, for instance, when the PEBS sample is taken close to a kernel entry point. Here PEBS, eventing IP (real_ip) captured a user level instruction. But by the time the PMU interrupt fired, the processor had already entered kernel space. This is why the debug output shows a user address with user_mode() false.
The problem comes from PEBS not recording the code segment (cs) register. The register is used in x86_64 to determine if executing in kernel vs user space. This is okay because the kernel has a software workaround called set_linear_ip(). But the issue in setup_pebs_sample_data() is that set_linear_ip() is never called on the real_ip value when it is available (Haswell and later) and precise_ip > 1.
This patch fixes this problem and eliminates the callchain discrepancy.
The patch restructures the code around set_linear_ip() to minimize the number of times the IP has to be set.
--- arch/x86/events/intel/ds.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-)
arch/x86/events/intel/ds.c +17 -8
@@ -1150,6 +1150,7 @@ static void setup_pebs_sample_data(strucif (pebs ==NULL )return ; + regs->flags &= ~PERF_EFLAGS_EXACT ; sample_type = event->attr.sample_type; dsrc = sample_type &PERF_SAMPLE_DATA_SRC ;
@@ -1194,7 +1195,6 @@ static void setup_pebs_sample_data(struc*/ *regs = *iregs; regs->flags = pebs->flags; -set_linear_ip (regs, pebs->ip);if (sample_type &PERF_SAMPLE_REGS_INTR ) { regs->ax = pebs->ax;
@@ -1230,13 +1230,22 @@ static void setup_pebs_sample_data(struc#endif } -if (event->attr.precise_ip >1 && x86_pmu.intel_cap.pebs_format >=2 ) { - regs->ip = pebs->real_ip; - regs->flags |=PERF_EFLAGS_EXACT ; - }else if (event->attr.precise_ip >1 &&intel_pmu_pebs_fixup_ip (regs)) - regs->flags |=PERF_EFLAGS_EXACT ; -else - regs->flags &= ~PERF_EFLAGS_EXACT ; +if (event->attr.precise_ip >1 ) { +/* Haswell and later have the eventing IP, so use it: */ +if (x86_pmu.intel_cap.pebs_format >=2 ) { +set_linear_ip (regs, pebs->real_ip); + regs->flags |=PERF_EFLAGS_EXACT ; + }else { +/* Otherwise use PEBS off-by-1 IP: */ +set_linear_ip (regs, pebs->ip); + +/* ... and try to fix it up using the LBR entries: */ +if (intel_pmu_pebs_fixup_ip (regs)) + regs->flags |=PERF_EFLAGS_EXACT ; + } + }else +set_linear_ip (regs, pebs->ip); +if ((sample_type & (PERF_SAMPLE_ADDR |PERF_SAMPLE_PHYS_ADDR )) && x86_pmu.intel_cap.pebs_format >=1 )
Greg Kroah-Hartman
maintainerPATCH 304/496 x86/alternatives: Fixup alternative_call_2
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Dobriyan <[email protected]>
[ Upstream commit bd6271039ee6f0c9b468148fc2d73e0584af6b4f ]
The following pattern fails to compile while the same pattern with alternative_call() does:
if (...) alternative_call_2(...); else alternative_call_2(...);
as it expands into
if (...)
{
}; <===
else
{
};--- arch/x86/include/asm/alternative.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/x86/include/asm/alternative.h +1 -3
@@ -218,13 +218,11 @@ static inline int alternatives_text_rese*/ #define alternative_call_2 (oldfunc, newfunc1, feature1, newfunc2, feature2, \ output, input...) \ -{ \ asm volatile (ALTERNATIVE_2("call %P[old]", "call %P[new1]", feature1,\ "call %P[new2]", feature2) \ : output, ASM_CALL_CONSTRAINT \ : [old] "i" (oldfunc), [new1] "i" (newfunc1), \ - [new2] "i" (newfunc2), ## input); \ -} + [new2] "i" (newfunc2), ## input)/* * use this macro(s) if you need more than one output parameter
Greg Kroah-Hartman
maintainerPATCH 305/496 llc: properly handle dev_queue_xmit() return value
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cong Wang <[email protected]>
[ Upstream commit b85ab56c3f81c5a24b5a5213374f549df06430da ]
llc_conn_send_pdu() pushes the skb into write queue and calls llc_conn_send_pdus() to flush them out. However, the status of dev_queue_xmit() is not returned to caller, in this case, llc_conn_state_process().
llc_conn_state_process() needs hold the skb no matter success or failure, because it still uses it after that, therefore we should hold skb before dev_queue_xmit() when that skb is the one being processed by llc_conn_state_process().
For other callers, they can just pass NULL and ignore the return value as they are.
--- include/net/llc_conn.h | 2 +- net/llc/llc_c_ac.c | 15 +++++++++------ net/llc/llc_conn.c | 32 +++++++++++++++++++++++--------- 3 files changed, 33 insertions(+), 16 deletions(-)
include/net/llc_conn.h +1 -1
@@ -104,7 +104,7 @@ void llc_sk_reset(struct sock *sk);/* Access to a connection */ int llc_conn_state_process (struct sock *sk,struct sk_buff *skb); -void llc_conn_send_pdu (struct sock *sk,struct sk_buff *skb); +int llc_conn_send_pdu (struct sock *sk,struct sk_buff *skb);void llc_conn_rtn_pdu (struct sock *sk,struct sk_buff *skb);void llc_conn_resend_i_pdu_as_cmd (struct sock *sk,u8 nr,u8 first_p_bit);void llc_conn_resend_i_pdu_as_rsp (struct sock *sk,u8 nr,u8 first_f_bit);
net/llc/llc_c_ac.c +9 -6
@@ -389,7 +389,7 @@ static int llc_conn_ac_send_i_cmd_p_set_llc_pdu_init_as_i_cmd (skb,0 , llc->vS, llc->vR); rc =llc_mac_hdr_init (skb, llc->dev->dev_addr, llc->daddr.mac);if (likely (!rc)) { -llc_conn_send_pdu (sk, skb); + rc =llc_conn_send_pdu (sk, skb);llc_conn_ac_inc_vs_by_1 (sk, skb); }return rc;
@@ -916,7 +916,7 @@ static int llc_conn_ac_send_i_rsp_f_set_llc_pdu_init_as_i_cmd (skb, llc->ack_pf, llc->vS, llc->vR); rc =llc_mac_hdr_init (skb, llc->dev->dev_addr, llc->daddr.mac);if (likely (!rc)) { -llc_conn_send_pdu (sk, skb); + rc =llc_conn_send_pdu (sk, skb);llc_conn_ac_inc_vs_by_1 (sk, skb); }return rc;
@@ -935,14 +935,17 @@ static int llc_conn_ac_send_i_rsp_f_set_int llc_conn_ac_send_i_as_ack (struct sock *sk,struct sk_buff *skb) {struct llc_sock *llc =llc_sk (sk); +int ret;if (llc->ack_must_be_send) { -llc_conn_ac_send_i_rsp_f_set_ackpf (sk, skb); + ret =llc_conn_ac_send_i_rsp_f_set_ackpf (sk, skb); llc->ack_must_be_send =0 ; llc->ack_pf =0 ; - }else -llc_conn_ac_send_i_cmd_p_set_0 (sk, skb); -return 0 ; + }else { + ret =llc_conn_ac_send_i_cmd_p_set_0 (sk, skb); + } + +return ret; }/**
net/llc/llc_conn.c +23 -9
@@ -30,7 +30,7 @@#endif static int llc_find_offset (int state,int ev_type); -static void llc_conn_send_pdus (struct sock *sk); +static int llc_conn_send_pdus (struct sock *sk,struct sk_buff *skb);static int llc_conn_service (struct sock *sk,struct sk_buff *skb); static int llc_exec_conn_trans_actions(struct sock *sk, struct llc_conn_state_trans *trans,
@@ -193,11 +193,11 @@ out_skb_put:return rc; } -void llc_conn_send_pdu (struct sock *sk,struct sk_buff *skb) +int llc_conn_send_pdu (struct sock *sk,struct sk_buff *skb) {/* queue PDU to send to MAC layer */ skb_queue_tail (&sk->sk_write_queue, skb); -llc_conn_send_pdus (sk); +return llc_conn_send_pdus (sk, skb); }/**
@@ -255,7 +255,7 @@ void llc_conn_resend_i_pdu_as_cmd(structif (howmany_resend >0 ) llc->vS = (llc->vS +1 ) %LLC_2_SEQ_NBR_MODULO ;/* any PDUs to re-send are queued up; start sending to MAC */ -llc_conn_send_pdus (sk); +llc_conn_send_pdus (sk,NULL ); out:; }
@@ -296,7 +296,7 @@ void llc_conn_resend_i_pdu_as_rsp(structif (howmany_resend >0 ) llc->vS = (llc->vS +1 ) %LLC_2_SEQ_NBR_MODULO ;/* any PDUs to re-send are queued up; start sending to MAC */ -llc_conn_send_pdus (sk); +llc_conn_send_pdus (sk,NULL ); out:; }
@@ -340,12 +340,16 @@ out:/** * llc_conn_send_pdus - Sends queued PDUs * @sk: active connection +* @hold_skb: the skb held by caller, or NULL if does not care * -* Sends queued pdus to MAC layer for transmission. +* Sends queued pdus to MAC layer for transmission. When @hold_skb is +* NULL, always return 0. Otherwise, return 0 if @hold_skb is sent +* successfully, or 1 for failure. */ -static void llc_conn_send_pdus (struct sock *sk) +static int llc_conn_send_pdus (struct sock *sk,struct sk_buff *hold_skb) {struct sk_buff *skb; +int ret =0 ;while ((skb =skb_dequeue (&sk->sk_write_queue)) !=NULL ) {struct llc_pdu_sn *pdu =llc_pdu_sn_hdr (skb);
@@ -357,10 +361,20 @@ static void llc_conn_send_pdus(struct soskb_queue_tail (&llc_sk (sk)->pdu_unack_q, skb);if (!skb2)break ; - skb = skb2; +dev_queue_xmit (skb2); + }else { +bool is_target = skb == hold_skb; +int rc; + +if (is_target) +skb_get (skb); + rc =dev_queue_xmit (skb); +if (is_target) + ret = rc; } -dev_queue_xmit (skb); } + +return ret; }/**
Greg Kroah-Hartman
maintainerPATCH 306/496 builddeb: Fix header package regarding dtc source links
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kiszka <[email protected]>
[ Upstream commit f8437520704cfd9cc442a99d73ed708a3cdadaf9 ]
Since d5d332d3f7e8, a couple of links in scripts/dtc/include-prefixes are additionally required in order to build device trees with the header package.
--- scripts/package/builddeb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/package/builddeb +1 -1
@@ -313,7 +313,7 @@ fi # Build kernel header package (cd $srctree; find . -name Makefile\* -o -name Kconfig\* -o -name \*.pl) > "$objtree/debian/hdrsrcfiles" -(cd $srctree; find arch/*/include include scripts -type f) >> "$objtree/debian/hdrsrcfiles" +(cd $srctree; find arch/*/include include scripts -type f -o -type l) >> "$objtree/debian/hdrsrcfiles" (cd $srctree; find arch/$SRCARCH -name module.lds -o -name Kbuild.platforms -o -name Platform) >> "$objtree/debian/hdrsrcfiles" (cd $srctree; find $(find arch/$SRCARCH -name include -o -name scripts -type d) -type f) >> "$objtree/debian/hdrsrcfiles" if grep -q '^CONFIG_STACK_VALIDATION=y' $KCONFIG_CONFIG ; then
Greg Kroah-Hartman
maintainerPATCH 307/496 qede: Fix barrier usage after tx doorbell write.
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manish Chopra <[email protected]>
[ Upstream commit b9fc828debc8ac2bb21b5819a44d2aea456f1c95 ]
Since commit c5ad119fb6c09b0297446be05bd66602fa564758 ("net: sched: pfifo_fast use skb_array") driver is exposed to an issue where it is hitting NULL skbs while handling TX completions. Driver uses mmiowb() to flush the writes to the doorbell bar which is a write-combined bar, however on x86 mmiowb() does not flush the write combined buffer.
This patch fixes this problem by replacing mmiowb() with wmb() after the write combined doorbell write so that writes are flushed and synchronized from more than one processor.
V1->V2:
-------
This patch was marked as "superseded" in patchwork. (Not really sure for what reason).Resending it as v2.
--- drivers/net/ethernet/qlogic/qede/qede_fp.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/net/ethernet/qlogic/qede/qede_fp.c +4 -6
@@ -320,13 +320,11 @@ static inline void qede_update_tx_producbarrier ();writel (txq->tx_db.raw, txq->doorbell_addr); -/* mmiowb is needed to synchronize doorbell writes from more than one -* processor. It guarantees that the write arrives to the device before -* the queue lock is released and another start_xmit is called (possibly -* on another CPU). Without this barrier, the next doorbell can bypass -* this doorbell. This is applicable to IA64/Altix systems. +/* Fence required to flush the write combined buffer, since another +* CPU may write to the same doorbell address and data may be lost +* due to relaxed order nature of write combined bar. */ -mmiowb (); +wmb (); } static int qede_xdp_xmit(struct qede_dev *edev, struct qede_fastpath *fp,
Greg Kroah-Hartman
maintainerPATCH 308/496 mm, slab: memcg_link the SLABs kmem_cache
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shakeel Butt <[email protected]>
[ Upstream commit 880cd276dff17ea29e9a8404275c9502b265afa7 ]
All the root caches are linked into slab_root_caches which was introduced by the commit 510ded33e075 ("slab: implement slab_root_caches list") but it missed to add the SLAB's kmem_cache.
While experimenting with opt-in/opt-out kmem accounting, I noticed system crashes due to NULL dereference inside cache_from_memcg_idx() while deferencing kmem_cache.memcg_params.memcg_caches. The upstream clean kernel will not see these crashes but SLAB should be consistent with SLUB which does linked its boot caches (kmem_cache_node and kmem_cache) into slab_root_caches.
--- mm/slab.c | 1 + 1 file changed, 1 insertion(+)
mm/slab.c +1 -0
@@ -1283,6 +1283,7 @@ void __init kmem_cache_init(void) nr_node_ids * sizeof(struct kmem_cache_node *), SLAB_HWCACHE_ALIGN);list_add (&kmem_cache->list, &slab_caches); +memcg_link_cache (kmem_cache); slab_state =PARTIAL ;/*
Greg Kroah-Hartman
maintainerPATCH 309/496 mm/page_owner: fix recursion bug after changing skip entries
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maninder Singh <[email protected]>
[ Upstream commit 299815a4fba9f3c7a81434dba0072148f1690608 ]
This patch fixes commit 5f48f0bd4e36 ("mm, page_owner: skip unnecessary stack_trace entries").
Because if we skip first two entries then logic of checking count value as 2 for recursion is broken and code will go in one depth recursion.
so we need to check only one call of _RET_IP(__set_page_owner) while checking for recursion.
Current Backtrace while checking for recursion:-
(save_stack) from (__set_page_owner) // (But recursion returns true here)
(__set_page_owner) from (get_page_from_freelist)
(get_page_from_freelist) from (__alloc_pages_nodemask) (__alloc_pages_nodemask) from (depot_save_stack)
(depot_save_stack) from (save_stack) // recursion should return true here (save_stack) from (__set_page_owner) (__set_page_owner) from (get_page_from_freelist) (get_page_from_freelist) from (__alloc_pages_nodemask+) (__alloc_pages_nodemask) from (depot_save_stack) (depot_save_stack) from (save_stack) (save_stack) from (__set_page_owner) (__set_page_owner) from (get_page_from_freelist)
Correct Backtrace with fix:
(save_stack) from (__set_page_owner) // recursion returned true here
(__set_page_owner) from (get_page_from_freelist)
(get_page_from_freelist) from (__alloc_pages_nodemask+) (__alloc_pages_nodemask) from (depot_save_stack)
(depot_save_stack) from (save_stack) (save_stack) from (__set_page_owner) (__set_page_owner) from (get_page_from_freelist)
--- mm/page_owner.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
mm/page_owner.c +3 -3
@@ -123,13 +123,13 @@ void __reset_page_owner(struct page *pagstatic inline bool check_recursive_alloc (struct stack_trace *trace,unsigned long ip) { -int i, count; +int i;if (!trace->nr_entries)return false; -for (i =0 , count =0 ; i < trace->nr_entries; i++) { -if (trace->entries[i] == ip && ++count ==2 ) +for (i =0 ; i < trace->nr_entries; i++) { +if (trace->entries[i] == ip)return true; }
Greg Kroah-Hartman
maintainerPATCH 310/496 mm/vmstat.c: fix vmstat_update() preemption BUG
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Steven J. Hill" <[email protected]>
[ Upstream commit c7f26ccfb2c31eb1bf810ba13d044fcf583232db ]
Attempting to hotplug CPUs with CONFIG_VM_EVENT_COUNTERS enabled can cause vmstat_update() to report a BUG due to preemption not being disabled around smp_processor_id().
Discovered on Ubiquiti EdgeRouter Pro with Cavium Octeon II processor.
BUG: using smp_processor_id() in preemptible [00000000] code:
kworker/1:1/269
caller is vmstat_update+0x50/0xa0
CPU: 0 PID: 269 Comm: kworker/1:1 Not tainted
4.16.0-rc4-Cavium-Octeon-00009-gf83bbd5-dirty #1
Workqueue: mm_percpu_wq vmstat_update
Call Trace:
show_stack+0x94/0x128
dump_stack+0xa4/0xe0
check_preemption_disabled+0x118/0x120
vmstat_update+0x50/0xa0
process_one_work+0x144/0x348
worker_thread+0x150/0x4b8
kthread+0x110/0x140
ret_from_kernel_thread+0x14/0x1c--- mm/vmstat.c | 2 ++ 1 file changed, 2 insertions(+)
mm/vmstat.c +2 -0
@@ -1770,9 +1770,11 @@ static void vmstat_update(struct work_st* to occur in the future. Keep on running the * update worker thread. */ +preempt_disable ();queue_delayed_work_on (smp_processor_id (), mm_percpu_wq,this_cpu_ptr (&vmstat_work),round_jiffies_relative (sysctl_stat_interval)); +preempt_enable (); } }
Greg Kroah-Hartman
maintainerPATCH 311/496 mm/kmemleak.c: wait for scan completion before disabling free
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vinayak Menon <[email protected]>
[ Upstream commit 914b6dfff790544d9b77dfd1723adb3745ec9700 ]
A crash is observed when kmemleak_scan accesses the object->pointer, likely due to the following race.
TASK A TASK B TASK C
kmemleak_write
(with "scan" and
NOT "scan=on")
kmemleak_scan()
create_object
kmem_cache_alloc fails
kmemleak_disable
kmemleak_do_cleanup
kmemleak_free_enabled = 0
kfree kmemleak_free bails out
(kmemleak_free_enabled is 0)
slub frees object->pointer
update_checksum
crash - object->pointer
freed (DEBUG_PAGEALLOC)
kmemleak_do_cleanup waits for the scan thread to complete, but not for direct call to kmemleak_scan via kmemleak_write. So add a wait for kmemleak_scan completion before disabling kmemleak_free, and while at it fix the comment on stop_scan_thread.
--- mm/kmemleak.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
mm/kmemleak.c +7 -5
@@ -1658,8 +1658,7 @@ static void start_scan_thread(void) }/* -* Stop the automatic memory scanning thread. This function must be called -* with the scan_mutex held. +* Stop the automatic memory scanning thread. */ static void stop_scan_thread (void ) {
@@ -1922,12 +1921,15 @@ static void kmemleak_do_cleanup(struct w {stop_scan_thread (); +mutex_lock (&scan_mutex);/* -* Once the scan thread has stopped, it is safe to no longer track -* object freeing. Ordering of the scan thread stopping and the memory -* accesses below is guaranteed by the kthread_stop() function. +* Once it is made sure that kmemleak_scan has stopped, it is safe to no +* longer track object freeing. Ordering of the scan thread stopping and +* the memory accesses below is guaranteed by the kthread_stop() +* function. */ kmemleak_free_enabled =0 ; +mutex_unlock (&scan_mutex);if (!kmemleak_found_leaks)__kmemleak_do_cleanup ();
Greg Kroah-Hartman
maintainerPATCH 312/496 hv_netvsc: enable multicast if necessary
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Hemminger <[email protected]>
[ Upstream commit f03dbb06dc380274e351ca4b1ee1587ed4529e62 ]
My recent change to netvsc drive in how receive flags are handled broke multicast. The Hyper-v/Azure virtual interface there is not a multicast filter list, filtering is only all or none. The driver must enable all multicast if any multicast address is present.
--- drivers/net/hyperv/rndis_filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/hyperv/rndis_filter.c +1 -1
@@ -856,7 +856,7 @@ static void rndis_set_multicast(struct wif (flags &IFF_PROMISC ) { filter =NDIS_PACKET_TYPE_PROMISCUOUS ; }else { -if (flags &IFF_ALLMULTI ) +if (!netdev_mc_empty (rdev->ndev) || (flags &IFF_ALLMULTI )) filter |=NDIS_PACKET_TYPE_ALL_MULTICAST ;if (flags &IFF_BROADCAST ) filter |=NDIS_PACKET_TYPE_BROADCAST ;
Greg Kroah-Hartman
maintainerPATCH 313/496 qede: Do not drop rx-checksum invalidated packets.
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manish Chopra <[email protected]>
[ Upstream commit 58f101bf87e32753342a6924772c6ebb0fbde24a ]
Today, driver drops received packets which are indicated as invalid checksum by the device. Instead of dropping such packets, pass them to the stack with CHECKSUM_NONE indication in skb.
--- drivers/net/ethernet/qlogic/qede/qede_fp.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/net/ethernet/qlogic/qede/qede_fp.c +2 -8
@@ -1245,16 +1245,10 @@ static int qede_rx_process_cqe(struct qe csum_flag =qede_check_csum (parse_flag);if (unlikely (csum_flag ==QEDE_CSUM_ERROR )) { -if (qede_pkt_is_ip_fragmented (fp_cqe, parse_flag)) { +if (qede_pkt_is_ip_fragmented (fp_cqe, parse_flag)) rxq->rx_ip_frags++; - }else { -DP_NOTICE (edev, -"CQE has error, flags = %x, dropping incoming packet\n" , - parse_flag); +else rxq->rx_hw_errors++; -qede_recycle_rx_bd_ring (rxq, fp_cqe->bd_num); -return 0 ; - } }/* Basic validation passed; Need to prepare an SKB. This would also
Greg Kroah-Hartman
maintainerPATCH 314/496 net: Fix untag for vlan packets without ethernet header
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Toshiaki Makita <[email protected]>
[ Upstream commit ae4745730cf8e693d354ccd4dbaf59ea440c09a9 ]
In some situation vlan packets do not have ethernet headers. One example is packets from tun devices. Users can specify vlan protocol in tun_pi field instead of IP protocol, and skb_vlan_untag() attempts to untag such packets.
skb_vlan_untag() (more precisely, skb_reorder_vlan_header() called by it) however did not expect packets without ethernet headers, so in such a case size argument for memmove() underflowed and triggered crash.
====
BUG: unable to handle kernel paging request at ffff8801cccb8000 IP: __memmove+0x24/0x1a0 arch/x86/lib/memmove_64.S:43 PGD 9cee067 P4D 9cee067 PUD 1d9401063 PMD 1cccb7063 PTE 2810100028101 Oops: 000b [#1] SMP KASAN Dumping ftrace buffer: (ftrace buffer empty) Modules linked in: CPU: 1 PID: 17663 Comm: syz-executor2 Not tainted 4.16.0-rc7+ #368 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:__memmove+0x24/0x1a0 arch/x86/lib/memmove_64.S:43 RSP: 0018:ffff8801cc046e28 EFLAGS: 00010287 RAX: ffff8801ccc244c4 RBX: fffffffffffffffe RCX: fffffffffff6c4c2 RDX: fffffffffffffffe RSI: ffff8801cccb7ffc RDI: ffff8801cccb8000 RBP: ffff8801cc046e48 R08: ffff8801ccc244be R09: ffffed0039984899 R10: 0000000000000001 R11: ffffed0039984898 R12: ffff8801ccc244c4 R13: ffff8801ccc244c0 R14: ffff8801d96b7c06 R15: ffff8801d96b7b40 FS: 00007febd562d700(0000) GS:ffff8801db300000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffff8801cccb8000 CR3: 00000001ccb2f006 CR4: 00000000001606e0 DR0: 0000000020000000 DR1: 0000000020000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 Call Trace: memmove include/linux/string.h:360 [inline] skb_reorder_vlan_header net/core/skbuff.c:5031 [inline] skb_vlan_untag+0x470/0xc40 net/core/skbuff.c:5061 __netif_receive_skb_core+0x119c/0x3460 net/core/dev.c:4460 __netif_receive_skb+0x2c/0x1b0 net/core/dev.c:4627 netif_receive_skb_internal+0x10b/0x670 net/core/dev.c:4701 netif_receive_skb+0xae/0x390 net/core/dev.c:4725 tun_rx_batched.isra.50+0x5ee/0x870 drivers/net/tun.c:1555 tun_get_user+0x299e/0x3c20 drivers/net/tun.c:1962 tun_chr_write_iter+0xb9/0x160 drivers/net/tun.c:1990 call_write_iter include/linux/fs.h:1782 [inline] new_sync_write fs/read_write.c:469 [inline] __vfs_write+0x684/0x970 fs/read_write.c:482 vfs_write+0x189/0x510 fs/read_write.c:544 SYSC_write fs/read_write.c:589 [inline] SyS_write+0xef/0x220 fs/read_write.c:581 do_syscall_64+0x281/0x940 arch/x86/entry/common.c:287 entry_SYSCALL_64_after_hwframe+0x42/0xb7 RIP: 0033:0x454879 RSP: 002b:00007febd562cc68 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007febd562d6d4 RCX: 0000000000454879 RDX: 0000000000000157 RSI: 0000000020000180 RDI: 0000000000000014 RBP: 000000000072bea0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff R13: 00000000000006b0 R14: 00000000006fc120 R15: 0000000000000000 Code: 90 90 90 90 90 90 90 48 89 f8 48 83 fa 20 0f 82 03 01 00 00 48 39 fe 7d 0f 49 89 f0 49 01 d0 49 39 f8 0f 8f 9f 00 00 00 48 89 d1 <f3> a4 c3 48 81 fa a8 02 00 00 72 05 40 38 fe 74 3b 48 83 ea 20 RIP: __memmove+0x24/0x1a0 arch/x86/lib/memmove_64.S:43 RSP: ffff8801cc046e28
CR2: ffff8801cccb8000
====
We don't need to copy headers for packets which do not have preceding headers of vlan headers, so skip memmove() in that case.
--- net/core/skbuff.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/core/skbuff.c +4 -2
@@ -4947,8 +4947,10 @@ static struct sk_buff *skb_reorder_vlan_ } mac_len = skb->data -skb_mac_header (skb); -memmove (skb_mac_header (skb) +VLAN_HLEN ,skb_mac_header (skb), - mac_len -VLAN_HLEN -ETH_TLEN ); +if (likely (mac_len >VLAN_HLEN +ETH_TLEN )) { +memmove (skb_mac_header (skb) +VLAN_HLEN ,skb_mac_header (skb), + mac_len -VLAN_HLEN -ETH_TLEN ); + } skb->mac_header +=VLAN_HLEN ;return skb; }
Greg Kroah-Hartman
maintainerPATCH 315/496 vlan: Fix vlan insertion for packets without ethernet header
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Toshiaki Makita <[email protected]>
[ Upstream commit c769accdf3d8a103940bea2979b65556718567e9 ]
In some situation vlan packets do not have ethernet headers. One example is packets from tun devices. Users can specify vlan protocol in tun_pi field instead of IP protocol. When we have a vlan device with reorder_hdr disabled on top of the tun device, such packets from tun devices are untagged in skb_vlan_untag() and vlan headers will be inserted back in vlan_insert_inner_tag().
vlan_insert_inner_tag() however did not expect packets without ethernet headers, so in such a case size argument for memmove() underflowed.
We don't need to copy headers for packets which do not have preceding headers of vlan headers, so skip memmove() in that case. Also don't write vlan protocol in skb->data when it does not have enough room for it.
--- include/linux/if_vlan.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
include/linux/if_vlan.h +13 -2
@@ -323,13 +323,24 @@ static inline int __vlan_insert_inner_taskb_push (skb,VLAN_HLEN );/* Move the mac header sans proto to the beginning of the new header. */ -memmove (skb->data, skb->data +VLAN_HLEN , mac_len -ETH_TLEN ); +if (likely (mac_len >ETH_TLEN )) +memmove (skb->data, skb->data +VLAN_HLEN , mac_len -ETH_TLEN ); skb->mac_header -=VLAN_HLEN ; veth = (struct vlan_ethhdr *)(skb->data + mac_len -ETH_HLEN );/* first, the ethernet type */ - veth->h_vlan_proto = vlan_proto; +if (likely (mac_len >=ETH_TLEN )) { +/* h_vlan_encapsulated_proto should already be populated, and +* skb->data has space for h_vlan_proto +*/ + veth->h_vlan_proto = vlan_proto; + }else { +/* h_vlan_encapsulated_proto should not be populated, and +* skb->data has no space for h_vlan_proto +*/ + veth->h_vlan_encapsulated_proto = skb->protocol; + }/* now, the TCI */ veth->h_vlan_TCI =htons (vlan_tci);
Greg Kroah-Hartman
maintainerPATCH 316/496 net: mvneta: fix enable of all initialized RXQs
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yelena Krivosheev <[email protected]>
[ Upstream commit e81b5e01c14add8395dfba7130f8829206bb507d ]
In mvneta_port_up() we enable relevant RX and TX port queues by write queues bit map to an appropriate register.
q_map must be ZERO in the beginning of this process.
--- drivers/net/ethernet/marvell/mvneta.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/marvell/mvneta.c +1 -0
@@ -1112,6 +1112,7 @@ static void mvneta_port_up(struct mvneta }mvreg_write (pp,MVNETA_TXQ_CMD , q_map); + q_map =0 ;/* Enable all initialized RXQs. */ for (queue =0 ; queue < rxq_number; queue++) {struct mvneta_rx_queue *rxq = &pp->rxqs[queue];
Greg Kroah-Hartman
maintainerPATCH 317/496 sh: fix debug trap failure to process signals before return to user
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rich Felker <[email protected]>
[ Upstream commit 96a598996f6ac518ac79839ecbb17c91af91f4f7 ]
When responding to a debug trap (breakpoint) in userspace, the kernel's trap handler raised SIGTRAP but returned from the trap via a code path that ignored pending signals, resulting in an infinite loop re-executing the trapping instruction.
--- arch/sh/kernel/entry-common.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sh/kernel/entry-common.S +1 -1
@@ -255,7 +255,7 @@ debug_trap: mov.l @r8, r8 jsr @r8 nop - bra __restore_all + bra ret_from_exception nop CFI_ENDPROC
Greg Kroah-Hartman
maintainerPATCH 318/496 firmware: dmi_scan: Fix UUID length safety check
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean Delvare <[email protected]>
[ Upstream commit 90fe6f8ff00a07641ca893d64f75ca22ce77cca2 ]
The test which ensures that the DMI type 1 structure is long enough to hold the UUID is off by one. It would fail if the structure is exactly 24 bytes long, while that's sufficient to hold the UUID.
I don't expect this bug to cause problem in practice because all implementations I have seen had length 8, 25 or 27 bytes, in line with the SMBIOS specifications. But let's fix it still.
--- drivers/firmware/dmi_scan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/dmi_scan.c +1 -1
@@ -191,7 +191,7 @@ static void __init dmi_save_uuid(const schar *s;int is_ff =1 , is_00 =1 , i; -if (dmi_ident[slot] || dm->length <= index +16 ) +if (dmi_ident[slot] || dm->length < index +16 )return ; d = (u8 *) dm + index;
Greg Kroah-Hartman
maintainerPATCH 320/496 Btrfs: clean up resources during umount after trans is aborted
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liu Bo <[email protected]>
[ Upstream commit af7227338135d2f1b1552bf9a6d43e02dcba10b9 ]
Currently if some fatal errors occur, like all IO get -EIO, resources would be cleaned up when
a) transaction is being committed or
b) BTRFS_FS_STATE_ERROR is set
However, in some rare cases, resources may be left alone after transaction gets aborted and umount may run into some ASSERT(), e.g. ASSERT(list_empty(&block_group->dirty_list));
For case a), in btrfs_commit_transaciton(), there're several places at the beginning where we just call btrfs_end_transaction() without cleaning up resources. For case b), it is possible that the trans handle doesn't have any dirty stuff, then only trans hanlde is marked as aborted while BTRFS_FS_STATE_ERROR is not set, so resources remain in memory.
This makes btrfs also check BTRFS_FS_STATE_TRANS_ABORTED to make sure that all resources won't stay in memory after umount.
--- fs/btrfs/disk-io.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/disk-io.c +2 -1
@@ -3896,7 +3896,8 @@ void close_ctree(struct btrfs_fs_info *fbtrfs_err (fs_info,"commit super ret %d" , ret); } -if (test_bit (BTRFS_FS_STATE_ERROR , &fs_info->fs_state)) +if (test_bit (BTRFS_FS_STATE_ERROR , &fs_info->fs_state) || +test_bit (BTRFS_FS_STATE_TRANS_ABORTED , &fs_info->fs_state))btrfs_error_commit_super (fs_info);kthread_stop (fs_info->transaction_kthread);
Greg Kroah-Hartman
maintainerPATCH 321/496 Btrfs: fix loss of prealloc extents past i_size after fsync log replay
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
[ Upstream commit 471d557afed155b85da237ec46c549f443eeb5de ]
Currently if we allocate extents beyond an inode's i_size (through the fallocate system call) and then fsync the file, we log the extents but after a power failure we replay them and then immediately drop them. This behaviour happens since about 2009, commit c71bf099abdd ("Btrfs:
Avoid orphan inodes cleanup while replaying log"), because it marks the inode as an orphan instead of dropping any extents beyond i_size before replaying logged extents, so after the log replay, and while the mount operation is still ongoing, we find the inode marked as an orphan and then perform a truncation (drop extents beyond the inode's i_size). Because the processing of orphan inodes is still done right after replaying the log and before the mount operation finishes, the intention of that commit does not make any sense (at least as of today). However reverting that behaviour is not enough, because we can not simply discard all extents beyond i_size and then replay logged extents, because we risk dropping extents beyond i_size created in past transactions, for example:
add prealloc extent beyond i_size
fsync - clears the flag BTRFS_INODE_NEEDS_FULL_SYNC from the inode transaction commit
add another prealloc extent beyond i_size
fsync - triggers the fast fsync path
power failure
In that scenario, we would drop the first extent and then replay the second one. To fix this just make sure that all prealloc extents beyond i_size are logged, and if we find too many (which is far from a common case), fallback to a full transaction commit (like we do when logging regular extents in the fast fsync path).
Trivial reproducer:
$ mkfs.btrfs -f /dev/sdb $ mount /dev/sdb /mnt $ xfs_io -f -c "pwrite -S 0xab 0 256K" /mnt/foo $ sync $ xfs_io -c "falloc -k 256K 1M" /mnt/foo $ xfs_io -c "fsync" /mnt/foo <power failure>
# mount to replay log $ mount /dev/sdb /mnt # at this point the file only has one extent, at offset 0, size 256K
A test case for fstests follows soon, covering multiple scenarios that involve adding prealloc extents with previous shrinking truncates and without such truncates.
--- fs/btrfs/tree-log.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 58 insertions(+), 5 deletions(-)
fs/btrfs/tree-log.c +58 -5
@@ -2377,13 +2377,41 @@ static int replay_one_buffer(struct btrfif (ret)break ; -/* for regular files, make sure corresponding -* orphan item exist. extents past the new EOF -* will be truncated later by orphan cleanup. +/* +* Before replaying extents, truncate the inode to its +* size. We need to do it now and not after log replay +* because before an fsync we can have prealloc extents +* added beyond the inode's i_size. If we did it after, +* through orphan cleanup for example, we would drop +* those prealloc extents just after replaying them. */ if (S_ISREG (mode)) { - ret =insert_orphan_item (wc->trans, root, - key.objectid); +struct inode *inode; +u64 from; + + inode =read_one_inode (root, key.objectid); +if (!inode) { + ret = -EIO ; +break ; + } + from =ALIGN (i_size_read (inode), + root->fs_info->sectorsize); + ret =btrfs_drop_extents (wc->trans, root, inode, + from, (u64)-1 ,1 ); +/* +* If the nlink count is zero here, the iput +* will free the inode. We bump it to make +* sure it doesn't get freed until the link +* count fixup is done. +*/ +if (!ret) { +if (inode->i_nlink ==0 ) +inc_nlink (inode); +/* Update link count and nbytes. */ + ret =btrfs_update_inode (wc->trans, + root, inode); + } +iput (inode);if (ret)break ; }
@@ -4234,6 +4262,31 @@ static int btrfs_log_changed_extents(str num++; } +/* +* Add all prealloc extents beyond the inode's i_size to make sure we +* don't lose them after doing a fast fsync and replaying the log. +*/ +if (inode->flags &BTRFS_INODE_PREALLOC ) { +struct rb_node *node; + +for (node =rb_last (&tree->map); node; node =rb_prev (node)) { + em = rb_entry(node, struct extent_map, rb_node); +if (em->start <i_size_read (&inode->vfs_inode)) +break ; +if (!list_empty (&em->list)) +continue ; +/* Same as above loop. */ +if (++num >32768 ) { +list_del_init (&tree->modified_extents); + ret = -EFBIG ; + goto process; + } +refcount_inc (&em->refs); +set_bit (EXTENT_FLAG_LOGGING , &em->flags); +list_add_tail (&em->list, &extents); + } + } +list_sort (NULL , &extents, extent_cmp);btrfs_get_logged_extents (inode, logged_list, logged_start, logged_end);/*
Greg Kroah-Hartman
maintainerPATCH 322/496 x86/pgtable: Dont set huge PUD/PMD on non-leaf entries
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joerg Roedel <[email protected]>
[ Upstream commit e3e288121408c3abeed5af60b87b95c847143845 ]
The pmd_set_huge() and pud_set_huge() functions are used from the generic ioremap() code to establish large mappings where this is possible.
But the generic ioremap() code does not check whether the PMD/PUD entries are already populated with a non-leaf entry, so that any page-table pages these entries point to will be lost.
Further, on x86-32 with SHARED_KERNEL_PMD=0, this causes a BUG_ON() in vmalloc_sync_one() when PMD entries are synced from swapper_pg_dir to the current page-table. This happens because the PMD entry from swapper_pg_dir was promoted to a huge-page entry while the current PGD still contains the non-leaf entry. Because both entries are present and point to a different page, the BUG_ON() triggers.
This was actually triggered with pti-x32 enabled in a KVM virtual machine by the graphics driver.
A real and better fix for that would be to improve the page-table handling in the generic ioremap() code. But that is out-of-scope for this patch-set and left for later work.
--- arch/x86/mm/pgtable.c | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/x86/mm/pgtable.c +9 -0
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0 #include <linux/mm.h> #include <linux/gfp.h> +#include <linux/hugetlb.h> #include <asm/pgalloc.h> #include <asm/pgtable.h> #include <asm/tlb.h>
@@ -636,6 +637,10 @@ int pud_set_huge(pud_t *pud, phys_addr_t (mtrr != MTRR_TYPE_WRBACK))return 0 ; +/* Bail out if we are we on a populated non-leaf entry: */ +if (pud_present (*pud) && !pud_huge (*pud)) +return 0 ; + prot =pgprot_4k_2_large (prot); set_pte((pte_t *)pud, pfn_pte(
@@ -664,6 +669,10 @@ int pmd_set_huge(pmd_t *pmd, phys_addr_treturn 0 ; } +/* Bail out if we are we on a populated non-leaf entry: */ +if (pmd_present (*pmd) && !pmd_huge (*pmd)) +return 0 ; + prot =pgprot_4k_2_large (prot); set_pte((pte_t *)pmd, pfn_pte(
Greg Kroah-Hartman
maintainerPATCH 323/496 x86/mm: Do not forbid _PAGE_RW before init for __ro_after_init
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Hansen <[email protected]>
[ Upstream commit 639d6aafe437a7464399d2a77d006049053df06f ]
__ro_after_init data gets stuck in the .rodata section. That's normally fine because the kernel itself manages the R/W properties.
But, if we run __change_page_attr() on an area which is __ro_after_init, the .rodata checks will trigger and force the area to be immediately read-only, even if it is early-ish in boot. This caused problems when trying to clear the _PAGE_GLOBAL bit for these area in the PTI code:
it cleared _PAGE_GLOBAL like I asked, but also took it up on itself to clear _PAGE_RW. The kernel then oopses the next time it wrote to a __ro_after_init data structure.
To fix this, add the kernel_set_to_readonly check, just like we have for kernel text, just a few lines below in this function.
--- arch/x86/mm/pageattr.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/x86/mm/pageattr.c +4 -2
@@ -298,9 +298,11 @@ static inline pgprot_t static_protection/* * The .rodata section needs to be read-only. Using the pfn -* catches all aliases. +* catches all aliases. This also includes __ro_after_init, +* so do not enforce until kernel_set_to_readonly is true. */ -if (within (pfn,__pa_symbol (__start_rodata) >>PAGE_SHIFT , +if (kernel_set_to_readonly && +within (pfn,__pa_symbol (__start_rodata) >>PAGE_SHIFT ,__pa_symbol (__end_rodata) >>PAGE_SHIFT ))pgprot_val (forbidden) |= _PAGE_RW;
Greg Kroah-Hartman
maintainerPATCH 324/496 fs/proc/proc_sysctl.c: fix potential page fault while unregistering sysctl table
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Danilo Krummrich <[email protected]>
[ Upstream commit a0b0d1c345d0317efe594df268feb5ccc99f651e ]
proc_sys_link_fill_cache() does not take currently unregistering sysctl tables into account, which might result into a page fault in sysctl_follow_link() - add a check to fix it.
This bug has been present since v3.4.
--- fs/proc/proc_sysctl.c | 3 +++ 1 file changed, 3 insertions(+)
fs/proc/proc_sysctl.c +3 -0
@@ -707,7 +707,10 @@ static bool proc_sys_link_fill_cache(str struct ctl_table *table) {bool ret = true; + head =sysctl_head_grab (head); +if (IS_ERR (head)) +return false;if (S_ISLNK (table->mode)) {/* It is not an error if we can not follow the link ignore it */
Greg Kroah-Hartman
maintainerPATCH 325/496 swap: divide-by-zero when zero length swap file on ssd
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tom Abraham <[email protected]>
[ Upstream commit a06ad633a37c64a0cd4c229fc605cee8725d376e ]
Calling swapon() on a zero length swap file on SSD can lead to a divide-by-zero.
Although creating such files isn't possible with mkswap and they woud be considered invalid, it would be better for the swapon code to be more robust and handle this condition gracefully (return -EINVAL). Especially since the fix is small and straightforward.
To help with wear leveling on SSD, the swapon syscall calculates a random position in the swap file using modulo p->highest_bit, which is set to maxpages - 1 in read_swap_header.
If the swap file is zero length, read_swap_header sets maxpages=1 and last_page=0, resulting in p->highest_bit=0 and we divide-by-zero when we modulo p->highest_bit in swapon syscall.
This can be prevented by having read_swap_header return zero if last_page is zero.
--- mm/swapfile.c | 4 ++++ 1 file changed, 4 insertions(+)
mm/swapfile.c +4 -0
@@ -2954,6 +2954,10 @@ static unsigned long read_swap_header(st maxpages =swp_offset (pte_to_swp_entry (swp_entry_to_pte (swp_entry (0 , ~0UL )))) +1 ; last_page = swap_header->info.last_page; +if (!last_page) { +pr_warn ("Empty swap-file\n" ); +return 0 ; + }if (last_page > maxpages) { pr_warn("Truncating oversized swap area, only using %luk out of %luk\n", maxpages << (PAGE_SHIFT - 10),
Greg Kroah-Hartman
maintainerPATCH 326/496 z3fold: fix memory leak
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xidong Wang <[email protected]>
[ Upstream commit 1ec6995d1290bfb87cc3a51f0836c889e857cef9 ]
In z3fold_create_pool(), the memory allocated by __alloc_percpu() is not released on the error path that pool->compact_wq , which holds the return value of create_singlethread_workqueue(), is NULL. This will result in a memory leak bug.
--- mm/z3fold.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
mm/z3fold.c +7 -2
@@ -469,6 +469,8 @@ static struct z3fold_pool *z3fold_createspin_lock_init (&pool->lock);spin_lock_init (&pool->stale_lock); pool->unbuddied =__alloc_percpu (sizeof (struct list_head )*NCHUNKS ,2 ); +if (!pool->unbuddied) + goto out_pool;for_each_possible_cpu (cpu) {struct list_head *unbuddied =per_cpu_ptr (pool->unbuddied, cpu);
@@ -481,7 +483,7 @@ static struct z3fold_pool *z3fold_create pool->name = name; pool->compact_wq =create_singlethread_workqueue (pool->name);if (!pool->compact_wq) - goto out; + goto out_unbuddied; pool->release_wq =create_singlethread_workqueue (pool->name);if (!pool->release_wq) goto out_wq;
@@ -491,8 +493,11 @@ static struct z3fold_pool *z3fold_create out_wq:destroy_workqueue (pool->compact_wq); -out: +out_unbuddied: +free_percpu (pool->unbuddied); +out_pool:kfree (pool); +out:return NULL ; }
Greg Kroah-Hartman
maintainerPATCH 327/496 sr: get/drop reference to device in revalidate and check_events
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jens Axboe <[email protected]>
[ Upstream commit 2d097c50212e137e7b53ffe3b37561153eeba87d ]
We can't just use scsi_cd() to get the scsi_cd structure, we have to grab a live reference to the device. For both callbacks, we're not inside an open where we already hold a reference to the device.
This fixes device removal/addition under concurrent device access, which otherwise could result in the below oops.
NULL pointer dereference at 0000000000000010
PGD 0 P4D 0
Oops: 0000 [#1] PREEMPT SMP Modules linked in:
sr 12:0:0:0: [sr2] scsi-1 drive
scsi_debug crc_t10dif crct10dif_generic crct10dif_common nvme nvme_core sb_edac xl
sr 12:0:0:0: Attached scsi CD-ROM sr2
sr_mod cdrom btrfs xor zstd_decompress zstd_compress xxhash lzo_compress zlib_defc
sr 12:0:0:0: Attached scsi generic sg7 type 5
igb ahci libahci i2c_algo_bit libata dca [last unloaded: crc_t10dif]
CPU: 43 PID: 4629 Comm: systemd-udevd Not tainted 4.16.0+ #650 Hardware name: Dell Inc. PowerEdge T630/0NT78X, BIOS 2.3.4 11/09/2016 RIP: 0010:sr_block_revalidate_disk+0x23/0x190 [sr_mod] RSP: 0018:ffff883ff357bb58 EFLAGS: 00010292 RAX: ffffffffa00b07d0 RBX: ffff883ff3058000 RCX: ffff883ff357bb66 RDX: 0000000000000003 RSI: 0000000000007530 RDI: ffff881fea631000 RBP: 0000000000000000 R08: ffff881fe4d38400 R09: 0000000000000000 R10: 0000000000000000 R11: 00000000000001b6 R12: 000000000800005d R13: 000000000800005d R14: ffff883ffd9b3790 R15: 0000000000000000 FS: 00007f7dc8e6d8c0(0000) GS:ffff883fff340000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000010 CR3: 0000003ffda98005 CR4: 00000000003606e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: ? __invalidate_device+0x48/0x60 check_disk_change+0x4c/0x60 sr_block_open+0x16/0xd0 [sr_mod] __blkdev_get+0xb9/0x450 ? iget5_locked+0x1c0/0x1e0 blkdev_get+0x11e/0x320 ? bdget+0x11d/0x150 ? _raw_spin_unlock+0xa/0x20 ? bd_acquire+0xc0/0xc0 do_dentry_open+0x1b0/0x320 ? inode_permission+0x24/0xc0 path_openat+0x4e6/0x1420 ? cpumask_any_but+0x1f/0x40 ? flush_tlb_mm_range+0xa0/0x120 do_filp_open+0x8c/0xf0 ? __seccomp_filter+0x28/0x230 ? _raw_spin_unlock+0xa/0x20 ? __handle_mm_fault+0x7d6/0x9b0 ? list_lru_add+0xa8/0xc0 ? _raw_spin_unlock+0xa/0x20 ? __alloc_fd+0xaf/0x160 ? do_sys_open+0x1a6/0x230 do_sys_open+0x1a6/0x230 do_syscall_64+0x5a/0x100 entry_SYSCALL_64_after_hwframe+0x3d/0xa2
--- drivers/scsi/sr.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
drivers/scsi/sr.c +15 -4
@@ -585,18 +585,28 @@ out:static unsigned int sr_block_check_events (struct gendisk *disk,unsigned int clearing) { -struct scsi_cd *cd =scsi_cd (disk); +unsigned int ret =0 ; +struct scsi_cd *cd; -if (atomic_read (&cd->device->disk_events_disable_depth)) + cd =scsi_cd_get (disk); +if (!cd)return 0 ; -return cdrom_check_events (&cd->cdi, clearing); +if (!atomic_read (&cd->device->disk_events_disable_depth)) + ret =cdrom_check_events (&cd->cdi, clearing); + +scsi_cd_put (cd); +return ret; }static int sr_block_revalidate_disk (struct gendisk *disk) { -struct scsi_cd *cd =scsi_cd (disk);struct scsi_sense_hdr sshdr; +struct scsi_cd *cd; + + cd =scsi_cd_get (disk); +if (!cd) +return -ENXIO ;/* if the unit is not ready, nothing more to do */ if (scsi_test_unit_ready (cd->device,SR_TIMEOUT ,MAX_RETRIES , &sshdr))
@@ -605,6 +615,7 @@ static int sr_block_revalidate_disk(strusr_cd_check (&cd->cdi);get_sectorsize (cd); out: +scsi_cd_put (cd);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 328/496 Force log to disk before reading the AGF during a fstrim
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Carlos Maiolino <[email protected]>
[ Upstream commit 8c81dd46ef3c416b3b95e3020fb90dbd44e6140b ]
Forcing the log to disk after reading the agf is wrong, we might be calling xfs_log_force with XFS_LOG_SYNC with a metadata lock held.
This can cause a deadlock when racing a fstrim with a filesystem shutdown.
The deadlock has been identified due a miscalculation bug in device-mapper dm-thin, which returns lack of space to its users earlier than the device itself really runs out of space, changing the device-mapper volume into an error state.
The problem happened while filling the filesystem with a single file, triggering the bug in device-mapper, consequently causing an IO error and shutting down the filesystem.
If such file is removed, and fstrim executed before the XFS finishes the shut down process, the fstrim process will end up holding the buffer lock, and going to sleep on the cil wait queue.
At this point, the shut down process will try to wake up all the threads waiting on the cil wait queue, but for this, it will try to hold the same buffer log already held my the fstrim, locking up the filesystem.
--- fs/xfs/xfs_discard.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
fs/xfs/xfs_discard.c +7 -7
@@ -50,19 +50,19 @@ xfs_trim_extents( pag =xfs_perag_get (mp, agno); - error =xfs_alloc_read_agf (mp,NULL , agno,0 , &agbp); -if (error || !agbp) - goto out_put_perag; - - cur =xfs_allocbt_init_cursor (mp,NULL , agbp, agno,XFS_BTNUM_CNT ); -/* * Force out the log. This means any transactions that might have freed -* space before we took the AGF buffer lock are now on disk, and the +* space before we take the AGF buffer lock are now on disk, and the * volatile disk cache is flushed. */ xfs_log_force (mp,XFS_LOG_SYNC ); + error =xfs_alloc_read_agf (mp,NULL , agno,0 , &agbp); +if (error || !agbp) + goto out_put_perag; + + cur =xfs_allocbt_init_cursor (mp,NULL , agbp, agno,XFS_BTNUM_CNT ); +/* * Look up the longest btree in the AGF and start with it. */
Greg Kroah-Hartman
maintainerPATCH 329/496 cpufreq: CPPC: Initialize shared perf capabilities of CPUs
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shunyong Yang <[email protected]>
[ Upstream commit 8913315e9459b146e5888ab5138e10daa061b885 ]
When multiple CPUs are related in one cpufreq policy, the first online CPU will be chosen by default to handle cpufreq operations. Let's take cpu0 and cpu1 as an example.
When cpu0 is offline, policy->cpu will be shifted to cpu1. cpu1's perf capabilities should be initialized. Otherwise, perf capabilities are 0s and speed change can not take effect.
This patch copies perf capabilities of the first online CPU to other shared CPUs when policy shared type is CPUFREQ_SHARED_TYPE_ANY.
--- drivers/cpufreq/cppc_cpufreq.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/cpufreq/cppc_cpufreq.c +12 -2
@@ -167,9 +167,19 @@ static int cppc_cpufreq_cpu_init(structNSEC_PER_USEC ; policy->shared_type = cpu->shared_type; -if (policy->shared_type ==CPUFREQ_SHARED_TYPE_ANY ) +if (policy->shared_type ==CPUFREQ_SHARED_TYPE_ANY ) { +int i; +cpumask_copy (policy->cpus, cpu->shared_cpu_map); -else if (policy->shared_type ==CPUFREQ_SHARED_TYPE_ALL ) { + +for_each_cpu (i, policy->cpus) { +if (unlikely (i == policy->cpu)) +continue ; + +memcpy (&all_cpu_data[i]->perf_caps, &cpu->perf_caps, +sizeof (cpu->perf_caps)); + } + }else if (policy->shared_type ==CPUFREQ_SHARED_TYPE_ALL ) {/* Support only SW_ANY for now. */ pr_debug ("Unsupported CPU co-ord type\n" );return -EFAULT ;
Greg Kroah-Hartman
maintainerPATCH 330/496 powerpc/fscr: Enable interrupts earlier before calling get_user()
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anshuman Khandual <[email protected]>
[ Upstream commit 709b973c844c0b4d115ac3a227a2e5a68722c912 ]
The function get_user() can sleep while trying to fetch instruction from user address space and causes the following warning from the scheduler.
BUG: sleeping function called from invalid context
Though interrupts get enabled back but it happens bit later after get_user() is called. This change moves enabling these interrupts earlier covering the function get_user(). While at this, lets check for kernel mode and crash as this interrupt should not have been triggered from the kernel context.
--- arch/powerpc/kernel/traps.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-)
arch/powerpc/kernel/traps.c +17 -15
@@ -1379,6 +1379,22 @@ void facility_unavailable_exception(stru value =mfspr (SPRN_FSCR ); status = value >>56 ; +if ((hv || status >=2 ) && + (status <ARRAY_SIZE (facility_strings)) && + facility_strings[status]) + facility = facility_strings[status]; + +/* We should not have taken this interrupt in kernel */ +if (!user_mode (regs)) { +pr_emerg ("Facility '%s' unavailable (%d) exception in kernel mode at %lx\n" , + facility, status, regs->nip); +die ("Unexpected facility unavailable exception" , regs,SIGABRT ); + } + +/* We restore the interrupt state now */ +if (!arch_irq_disabled_regs (regs)) +local_irq_enable (); +if (status ==FSCR_DSCR_LG ) {/* * User is accessing the DSCR register using the problem
@@ -1445,25 +1461,11 @@ void facility_unavailable_exception(stru return; } -if ((hv || status >=2 ) && - (status <ARRAY_SIZE (facility_strings)) && - facility_strings[status]) - facility = facility_strings[status]; - -/* We restore the interrupt state now */ -if (!arch_irq_disabled_regs (regs)) -local_irq_enable (); -pr_err_ratelimited ("%sFacility '%s' unavailable (%d), exception at 0x%lx, MSR=%lx\n" , hv ?"Hypervisor " :"" , facility, status, regs->nip, regs->msr); out: -if (user_mode (regs)) { -_exception (SIGILL , regs,ILL_ILLOPC , regs->nip); -return ; - } - -die ("Unexpected facility unavailable exception" , regs,SIGABRT ); +_exception (SIGILL , regs,ILL_ILLOPC , regs->nip); }#endif
Greg Kroah-Hartman
maintainerPATCH 331/496 perf tools: Fix perf builds with clang support
In reply to Greg Kroah-Hartman4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sandipan Das <[email protected]>
[ Upstream commit c2fb54a183cfe77c6fdc9d71e2d5299c1c302a6e ]
For libclang, some distro packages provide static libraries (.a) while some provide shared libraries (.so). Currently, perf code can only be linked with static libraries. This makes perf build possible for both cases.
--- tools/perf/Makefile.perf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/Makefile.perf +2 -1
@@ -368,7 +368,8 @@ LIBS = -Wl,--whole-archive $(PERFLIBS) $ ifeq ($(USE_CLANG), 1) CLANGLIBS_LIST = AST Basic CodeGen Driver Frontend Lex Tooling Edit Sema Analysis Parse Serialization - LIBCLANG = $(foreach l,$(CLANGLIBS_LIST),$(wildcard $(shell $(LLVM_CONFIG) --libdir)/libclang$(l).a)) + CLANGLIBS_NOEXT_LIST = $(foreach l,$(CLANGLIBS_LIST),$(shell $(LLVM_CONFIG) --libdir)/libclang$(l)) + LIBCLANG = $(foreach l,$(CLANGLIBS_NOEXT_LIST),$(wildcard $(l).a $(l).so)) LIBS += -Wl,--start-group $(LIBCLANG) -Wl,--end-group endif