4.9.104-stable review
Subsystems (6)
Greg Kroah-Hartman
maintainerPATCH 150/329 batman-adv: Ignore invalid batadv_v_gw during netlink send
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
[ Upstream commit 011c935fceae5252619ef730baa610c655281dda ]
The function batadv_v_gw_dump stops the processing loop when batadv_v_gw_dump_entry returns a non-0 return code. This should only happen when the buffer is full. Otherwise, an empty message may be returned by batadv_gw_dump. This empty message will then stop the netlink dumping of gateway entries. At worst, not a single entry is returned to userspace even when plenty of possible gateways exist.
--- net/batman-adv/bat_v.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/batman-adv/bat_v.c +1 -1
@@ -920,7 +920,7 @@ static int batadv_v_gw_dump_entry(structstruct batadv_neigh_ifinfo *router_ifinfo =NULL ;struct batadv_neigh_node *router;struct batadv_gw_node *curr_gw; -int ret = -EINVAL ; +int ret =0 ;void *hdr; router =batadv_orig_router_get (gw_node->orig_node,BATADV_IF_DEFAULT );
Greg Kroah-Hartman
maintainerPATCH 153/329 nvme-pci: Fix nvme queue cleanup if IRQ setup fails
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jianchao Wang <[email protected]>
[ Upstream commit f25a2dfc20e3a3ed8fe6618c331799dd7bd01190 ]
This patch fixes nvme queue cleanup if requesting an IRQ handler for the queue's vector fails. It does this by resetting the cq_vector to the uninitialized value of -1 so it is ignored for a controller reset.
--- drivers/nvme/host/pci.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/nvme/host/pci.c +4 -1
@@ -1120,7 +1120,7 @@ static int nvme_create_queue(struct nvme nvmeq->cq_vector = qid -1 ; result =adapter_alloc_cq (dev, qid, nvmeq);if (result <0 ) -return result; + goto release_vector; result =adapter_alloc_sq (dev, qid, nvmeq);if (result <0 )
@@ -1134,9 +1134,12 @@ static int nvme_create_queue(struct nvmereturn result; release_sq: + dev->online_queues--;adapter_delete_sq (dev, qid); release_cq:adapter_delete_cq (dev, qid); + release_vector: + nvmeq->cq_vector =-1 ;return result; }
Greg Kroah-Hartman
maintainerPATCH 154/329 clocksource/drivers/fsl_ftm_timer: Fix error return checking
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
[ Upstream commit f287eb9013ccf199cbfa4eabd80c36fedfc15a73 ]
The error checks on freq for a negative error return always fails because freq is unsigned and can never be negative. Fix this by making freq a signed long.
Detected with Coccinelle:
drivers/clocksource/fsl_ftm_timer.c:287:5-9: WARNING: Unsigned expression compared with zero: freq <= 0 drivers/clocksource/fsl_ftm_timer.c:291:5-9: WARNING: Unsigned expression compared with zero: freq <= 0
--- drivers/clocksource/fsl_ftm_timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clocksource/fsl_ftm_timer.c +1 -1
@@ -281,7 +281,7 @@ static int __init __ftm_clk_init(structstatic unsigned long __init ftm_clk_init (struct device_node *np) { -unsigned long freq; +long freq; freq =__ftm_clk_init (np,"ftm-evt-counter-en" ,"ftm-evt" );if (freq <=0 )
Greg Kroah-Hartman
maintainerPATCH 155/329 ceph: fix dentry leak when failing to init debugfs
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengguang Xu <[email protected]>
[ Upstream commit 18106734b512664a8541026519ce4b862498b6c3 ]
When failing from ceph_fs_debugfs_init() in ceph_real_mount(), there is lack of dput of root_dentry and it causes slab errors, so change the calling order of ceph_fs_debugfs_init() and open_root_dentry() and do some cleanups to avoid this issue.
--- fs/ceph/super.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-)
fs/ceph/super.c +5 -11
@@ -816,7 +816,6 @@ static struct dentry *ceph_real_mount(stint err;unsigned long started = jiffies;/* note the start time */ struct dentry *root; -int first =0 ;/* first vfsmount for this super_block */ dout ("mount start %p\n" , fsc);mutex_lock (&fsc->client->mount_mutex);
@@ -834,17 +833,17 @@ static struct dentry *ceph_real_mount(st path = fsc->mount_options->server_path +1 ;dout ("mount opening path %s\n" , path); } + + err =ceph_fs_debugfs_init (fsc); +if (err <0 ) + goto out; + root =open_root_dentry (fsc, path, started);if (IS_ERR (root)) { err =PTR_ERR (root); goto out; } fsc->sb->s_root =dget (root); - first =1 ; - - err =ceph_fs_debugfs_init (fsc); -if (err <0 ) - goto fail; }else { root =dget (fsc->sb->s_root); }
@@ -854,11 +853,6 @@ static struct dentry *ceph_real_mount(stmutex_unlock (&fsc->client->mount_mutex);return root; -fail: -if (first) { -dput (fsc->sb->s_root); - fsc->sb->s_root =NULL ; - } out:mutex_unlock (&fsc->client->mount_mutex);return ERR_PTR (err);
Greg Kroah-Hartman
maintainerPATCH 156/329 ARM: orion5x: Revert commit 4904dbda41c8.
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: "David S. Miller" <[email protected]>
[ Upstream commit 13a55372b64e00e564a08d785ca87bd9d454ba30 ]
It is not valid for orion5x to use mac_pton().
First of all, the orion5x buffer is not NULL terminated. mac_pton() has no business operating on non-NULL terminated buffers because only the caller can know that this is valid and in what manner it is ok to parse this NULL'less buffer.
Second of all, orion5x operates on an __iomem pointer, which cannot be dereferenced using normal C pointer operations. Accesses to such areas much be performed with the proper iomem accessors.
--- arch/arm/mach-orion5x/Kconfig | 3 - arch/arm/mach-orion5x/dns323-setup.c | 53 +++++++++++++++++++++++++++++++++-- arch/arm/mach-orion5x/tsx09-common.c | 49 +++++++++++++++++++++++++++++--- 3 files changed, 95 insertions(+), 10 deletions(-)
arch/arm/mach-orion5x/Kconfig +0 -3
@@ -57,7 +57,6 @@ config MACH_KUROBOX_PRO config MACH_DNS323 bool "D-Link DNS-323" - select GENERIC_NET_UTILS select I2C_BOARDINFO if I2C help Say 'Y' here if you want your kernel to support the
@@ -65,7 +64,6 @@ config MACH_DNS323 config MACH_TS209 bool "QNAP TS-109/TS-209" - select GENERIC_NET_UTILS help Say 'Y' here if you want your kernel to support the QNAP TS-109/TS-209 platform.
@@ -107,7 +105,6 @@ config MACH_LINKSTATION_LS_HGL config MACH_TS409 bool "QNAP TS-409" - select GENERIC_NET_UTILS help Say 'Y' here if you want your kernel to support the QNAP TS-409 platform.
arch/arm/mach-orion5x/dns323-setup.c +50 -3
68 lines not on this page · raw message
arch/arm/mach-orion5x/tsx09-common.c +45 -4
69 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 157/329 qrtr: add MODULE_ALIAS macro to smd
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ramon Fried <[email protected]>
[ Upstream commit c77f5fbbefc04612755117775e8555c2a7006cac ]
Added MODULE_ALIAS("rpmsg:IPCRTR") to ensure qrtr-smd and qrtr will load when IPCRTR channel is detected.
--- net/qrtr/smd.c | 1 + 1 file changed, 1 insertion(+)
net/qrtr/smd.c +1 -0
@@ -116,5 +116,6 @@ static struct qcom_smd_driver qcom_smd_qmodule_qcom_smd_driver (qcom_smd_qrtr_driver); +MODULE_ALIAS ("rpmsg:IPCRTR" );MODULE_DESCRIPTION ("Qualcomm IPC-Router SMD interface driver" );MODULE_LICENSE ("GPL v2" );
Greg Kroah-Hartman
maintainerPATCH 158/329 r8152: fix tx packets accounting
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 4c27bf3c5b7434ccb9ab962301da661c26b467a4 ]
r8152 driver handles TSO packets (limited to ~16KB) quite well, but pretends each TSO logical packet is a single packet on the wire.
There is also some error since headers are accounted once, but error rate is small enough that we do not care.
--- drivers/net/usb/r8152.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/usb/r8152.c +1 -1
@@ -1693,7 +1693,7 @@ static int r8152_tx_agg_fill(struct r815 tx_data += len; agg->skb_len += len; - agg->skb_num++; + agg->skb_num +=skb_shinfo (skb)->gso_segs ?:1 ;dev_kfree_skb_any (skb);
Greg Kroah-Hartman
maintainerPATCH 159/329 virtio-gpu: fix ioctl and expose the fixed status to userspace.
In reply to Greg Kroah-Hartman4.9-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
@@ -194,6 +194,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 ; }
@@ -469,7 +472,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;
@@ -478,6 +481,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) {
@@ -493,11 +500,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 160/329 dmaengine: rcar-dmac: fix max_chunk_size for R-Car Gen3
In reply to Greg Kroah-Hartman4.9-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
@@ -870,7 +870,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 161/329 bcache: fix kcrashes with fio in RAID5 backend dev
In reply to Greg Kroah-Hartman4.9-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
@@ -633,11 +633,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 162/329 ip6_tunnel: fix IFLA_MTU ignored on NEWLINK
In reply to Greg Kroah-Hartman4.9-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
@@ -1972,14 +1972,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; }
@@ -1995,7 +1995,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 163/329 sit: fix IFLA_MTU ignored on NEWLINK
In reply to Greg Kroah-Hartman4.9-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
@@ -1572,6 +1572,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 164/329 ARM: dts: NSP: Fix amount of RAM on BCM958625HR
In reply to Greg Kroah-Hartman4.9-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 165/329 powerpc/boot: Fix random libfdt related build errors
In reply to Greg Kroah-Hartman4.9-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
@@ -92,7 +92,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 crtsavres.S stdio.c decompress.c main.c \
Greg Kroah-Hartman
maintainerPATCH 166/329 gianfar: Fix Rx byte accounting for ndev stats
In reply to Greg Kroah-Hartman4.9-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
@@ -3075,9 +3075,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.
@@ -3148,13 +3145,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 167/329 net/tcp/illinois: replace broken algorithm reference link
In reply to Greg Kroah-Hartman4.9-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 168/329 nvmet: fix PSDT field check in command format
In reply to Greg Kroah-Hartman4.9-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
@@ -491,9 +491,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 170/329 drm/sun4i: Fix dclk_set_phase
In reply to Greg Kroah-Hartman4.9-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 171/329 Btrfs: send, fix issuing write op when processing hole in no data mode
In reply to Greg Kroah-Hartman4.9-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
@@ -4822,6 +4822,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 172/329 selftests/powerpc: Skip the subpage_prot tests if the syscall is unavailable
In reply to Greg Kroah-Hartman4.9-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 173/329 KVM: PPC: Book3S HV: Fix VRMA initialization with 2MB or 1GB memory backing
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Mackerras <[email protected]>
[ Upstream commit debd574f4195e205ba505b25e19b2b797f4bcd94 ]
The current code for initializing the VRMA (virtual real memory area) for HPT guests requires the page size of the backing memory to be one of 4kB, 64kB or 16MB. With a radix host we have the possibility that the backing memory page size can be 2MB or 1GB. In these cases, if the guest switches to HPT mode, KVM will not initialize the VRMA and the guest will fail to run.
In fact it is not necessary that the VRMA page size is the same as the backing memory page size; any VRMA page size less than or equal to the backing memory page size is acceptable. Therefore we now choose the largest page size out of the set {4k, 64k, 16M} which is not larger than the backing memory page size.
--- arch/powerpc/kvm/book3s_hv.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
arch/powerpc/kvm/book3s_hv.c +7 -5
@@ -3107,15 +3107,17 @@ static int kvmppc_hv_setup_htab_rma(stru goto up_out; psize =vma_kernel_pagesize (vma); - porder =__ilog2 (psize);up_read (¤t->mm->mmap_sem);/* We can handle 4k, 64k or 16M pages in the VRMA */ - err = -EINVAL ; -if (!(psize ==0x1000 || psize ==0x10000 || - psize ==0x1000000 )) - goto out_srcu; +if (psize >=0x1000000 ) + psize =0x1000000 ; +else if (psize >=0x10000 ) + psize =0x10000 ; +else + psize =0x1000 ; + porder =__ilog2 (psize);/* Update VRMASD field in the LPCR */ senc =slb_pgsize_encoding (psize);
Greg Kroah-Hartman
maintainerPATCH 174/329 iwlwifi: mvm: fix TX of CCMP 256
In reply to Greg Kroah-Hartman4.9-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
@@ -406,11 +406,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 ;
@@ -434,13 +434,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 175/329 watchdog: f71808e_wdt: Fix magic close handling
In reply to Greg Kroah-Hartman4.9-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 176/329 watchdog: sbsa: use 32-bit read for WCV
In reply to Greg Kroah-Hartman4.9-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 178/329 e1000e: Fix check_for_link return value with autoneg off
In reply to Greg Kroah-Hartman4.9-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
@@ -1600,7 +1600,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 179/329 e1000e: allocate ring descriptors with dma_zalloc_coherent
In reply to Greg Kroah-Hartman4.9-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
@@ -2331,8 +2331,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 180/329 ia64/err-inject: Use get_user_pages_fast()
In reply to Greg Kroah-Hartman4.9-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 181/329 RDMA/qedr: Fix kernel panic when running fio over NFSoRDMA
In reply to Greg Kroah-Hartman4.9-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
@@ -3467,7 +3467,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 ;
@@ -3477,6 +3477,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 182/329 RDMA/qedr: Fix iWARP write and send with immediate
In reply to Greg Kroah-Hartman4.9-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
@@ -2807,6 +2807,11 @@ int __qedr_post_send(struct ib_qp *ibqp,switch (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 ;
@@ -2848,6 +2853,11 @@ int __qedr_post_send(struct ib_qp *ibqp,break ;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 183/329 IB/mlx4: Fix corruption of RoCEv2 IPv4 GIDs
In reply to Greg Kroah-Hartman4.9-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
@@ -216,8 +216,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 184/329 IB/mlx4: Include GID type when deleting GIDs from HW table under RoCE
In reply to Greg Kroah-Hartman4.9-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
@@ -361,8 +361,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 185/329 IB/mlx5: Fix an error code in __mlx5_ib_modify_qp()
In reply to Greg Kroah-Hartman4.9-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
@@ -2809,8 +2809,10 @@ static int __mlx5_ib_modify_qp(struct ibmlx5_ib_qp_disable_pagefaults (qp);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 186/329 fbdev: Fixing arbitrary kernel leak in case FBIOGETCMAP_SPARC in sbusfb_ioctl_helper().
In reply to Greg Kroah-Hartman4.9-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
@@ -121,7 +121,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) ||
@@ -160,7 +160,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 187/329 fsl/fman: avoid sleeping in atomic context while adding an address
In reply to Greg Kroah-Hartman4.9-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
@@ -1036,7 +1036,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 188/329 net: qcom/emac: Use proper free methods during TX
In reply to Greg Kroah-Hartman4.9-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
@@ -1250,9 +1250,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 ; }
@@ -1409,9 +1409,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)
@@ -1427,9 +1429,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 189/329 net: smsc911x: Fix unload crash when link is up
In reply to Greg Kroah-Hartman4.9-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
@@ -2330,14 +2330,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 190/329 IB/core: Fix possible crash to access NULL netdev
In reply to Greg Kroah-Hartman4.9-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
@@ -1137,10 +1137,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 191/329 xen: xenbus: use put_device() instead of kfree()
In reply to Greg Kroah-Hartman4.9-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
@@ -470,8 +470,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 192/329 arm64: Relax ARM_SMCCC_ARCH_WORKAROUND_1 discovery
In reply to Greg Kroah-Hartman4.9-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
@@ -160,7 +160,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;
@@ -170,7 +170,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 193/329 dmaengine: mv_xor_v2: Fix clock resource by adding a register clock
In reply to Greg Kroah-Hartman4.9-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
@@ -152,6 +152,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;
@@ -697,13 +698,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,
@@ -812,8 +826,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 194/329 netfilter: ebtables: fix erroneous reject of last rule
In reply to Greg Kroah-Hartman4.9-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
@@ -2097,8 +2097,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 195/329 bnxt_en: Check valid VNIC ID in bnxt_hwrm_vnic_set_tpa().
In reply to Greg Kroah-Hartman4.9-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
@@ -3401,6 +3401,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 196/329 workqueue: use put_device() instead of kfree()
In reply to Greg Kroah-Hartman4.9-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
@@ -5272,7 +5272,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 197/329 ipv4: lock mtu in fnhe when received PMTU < net.ipv4.route.min_pmtu
In reply to Greg Kroah-Hartman4.9-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
@@ -304,6 +304,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) {
@@ -311,7 +318,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)
@@ -337,7 +344,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
@@ -57,6 +57,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
@@ -618,6 +618,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) {
@@ -628,7 +629,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;
@@ -665,8 +666,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);
@@ -690,6 +693,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 = expires;/* Exception created; mark the cached routes for the nexthop
@@ -771,7 +775,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 ;
@@ -983,15 +988,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 ))
@@ -1001,7 +1009,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 ();
@@ -1256,7 +1264,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 ; }
@@ -1481,6 +1489,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 ;
@@ -2403,6 +2412,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;
@@ -2505,6 +2515,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
@@ -97,6 +97,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 198/329 sunvnet: does not support GSO for sctp
In reply to Greg Kroah-Hartman4.9-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
@@ -198,7 +198,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 199/329 drm/imx: move arming of the vblank event to atomic_flush
In reply to Greg Kroah-Hartman4.9-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
@@ -189,7 +189,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));
@@ -257,6 +261,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, .enable = ipu_crtc_enable, };
Greg Kroah-Hartman
maintainerPATCH 200/329 microblaze: switch to NO_BOOTMEM
In reply to Greg Kroah-Hartman4.9-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
@@ -23,6 +23,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 201/329 net: Fix vlan untag for bridge and vlan_dev with reorder_hdr off
In reply to Greg Kroah-Hartman4.9-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
@@ -29,6 +29,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
@@ -4475,13 +4475,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 202/329 batman-adv: fix header size check in batadv_dbg_arp()
In reply to Greg Kroah-Hartman4.9-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 203/329 batman-adv: Fix skbuff rcsum on packet reroute
In reply to Greg Kroah-Hartman4.9-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
@@ -724,6 +724,7 @@ out:/** * 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
@@ -735,7 +736,7 @@ out:* 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) {
@@ -764,8 +765,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:
@@ -806,7 +809,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,
@@ -852,7 +855,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",
@@ -875,12 +878,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 204/329 vti4: Dont count header length twice on tunnel setup
In reply to Greg Kroah-Hartman4.9-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 205/329 vti4: Dont override MTU passed on link creation via IFLA_MTU
In reply to Greg Kroah-Hartman4.9-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 206/329 perf/cgroup: Fix child event counting bug
In reply to Greg Kroah-Hartman4.9-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
@@ -634,9 +634,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)
@@ -664,6 +670,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
@@ -674,8 +681,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; + } }#define PERF_CGROUP_SWOUT 0x1/* cgroup switch out every event */
Greg Kroah-Hartman
maintainerPATCH 207/329 brcmfmac: Fix check for ISO3166 code
In reply to Greg Kroah-Hartman4.9-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
@@ -6789,7 +6789,7 @@ static void brcmf_cfg80211_reg_notifier(int i;/* 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 a ISO3166 code (0x%02x 0x%02x)\n" , req->alpha2[0 ], req->alpha2[1 ]);
Greg Kroah-Hartman
maintainerPATCH 208/329 kbuild: make scripts/adjust_autoksyms.sh robust against timestamp races
In reply to Greg Kroah-Hartman4.9-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
@@ -83,6 +83,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 209/329 RDMA/ucma: Correct option size check using optlen
In reply to Greg Kroah-Hartman4.9-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
@@ -1296,7 +1296,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 210/329 RDMA/qedr: fix QPs ack timeout configuration
In reply to Greg Kroah-Hartman4.9-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
@@ -1888,18 +1888,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 211/329 RDMA/qedr: Fix rc initialization on CNQ allocation failure
In reply to Greg Kroah-Hartman4.9-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
@@ -762,7 +762,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 212/329 macsec: missing dev_put() on error in macsec_newlink()
In reply to Greg Kroah-Hartman4.9-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
@@ -3244,7 +3244,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
@@ -3280,7 +3280,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
maintainerPATCH 213/329 mm/mempolicy.c: avoid use uninitialized preferred_node
In reply to Greg Kroah-Hartman4.9-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
@@ -2159,6 +2159,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 214/329 mm, thp: do not cause memcg oom for thp
In reply to Greg Kroah-Hartman4.9-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
@@ -542,7 +542,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 ;
@@ -1060,7 +1061,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, fe->pmd, fe->address);if (page)
mm/khugepaged.c +6 -2
@@ -963,7 +963,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; }
@@ -1323,7 +1325,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 215/329 selftests: ftrace: Add probe event argument syntax testcase
In reply to Greg Kroah-Hartman4.9-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 216/329 selftests: ftrace: Add a testcase for string type with kprobe_event
In reply to Greg Kroah-Hartman4.9-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 217/329 selftests: ftrace: Add a testcase for probepoint
In reply to Greg Kroah-Hartman4.9-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 220/329 ARM: 8748/1: mm: Define vdso_start, vdso_end as array
In reply to Greg Kroah-Hartman4.9-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
@@ -11,8 +11,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 ;
@@ -179,13 +181,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 *),
@@ -200,7 +202,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; }
@@ -211,7 +213,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 221/329 net: qmi_wwan: add BroadMobi BM806U 2020:2033
In reply to Greg Kroah-Hartman4.9-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
@@ -889,6 +889,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 222/329 perf/x86/intel: Fix linear IP of PEBS real_ip on Haswell and later CPUs
In reply to Greg Kroah-Hartman4.9-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
@@ -1110,6 +1110,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 ;
@@ -1154,7 +1155,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;
@@ -1190,13 +1190,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 ) && x86_pmu.intel_cap.pebs_format >=1 )
Greg Kroah-Hartman
maintainerPATCH 223/329 llc: properly handle dev_queue_xmit() return value
In reply to Greg Kroah-Hartman4.9-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 224/329 builddeb: Fix header package regarding dtc source links
In reply to Greg Kroah-Hartman4.9-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
@@ -325,7 +325,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 225/329 mm/kmemleak.c: wait for scan completion before disabling free
In reply to Greg Kroah-Hartman4.9-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
@@ -1577,8 +1577,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 ) {
@@ -1841,12 +1840,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 226/329 net: Fix untag for vlan packets without ethernet header
In reply to Greg Kroah-Hartman4.9-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
@@ -4483,8 +4483,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 227/329 net: mvneta: fix enable of all initialized RXQs
In reply to Greg Kroah-Hartman4.9-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
@@ -1080,6 +1080,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 228/329 sh: fix debug trap failure to process signals before return to user
In reply to Greg Kroah-Hartman4.9-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 230/329 x86/pgtable: Dont set huge PUD/PMD on non-leaf entries
In reply to Greg Kroah-Hartman4.9-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,5 +1,6 @@#include <linux/mm.h> #include <linux/gfp.h> +#include <linux/hugetlb.h> #include <asm/pgalloc.h> #include <asm/pgtable.h> #include <asm/tlb.h>
@@ -577,6 +578,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(
@@ -605,6 +610,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 231/329 x86/mm: Do not forbid _PAGE_RW before init for __ro_after_init
In reply to Greg Kroah-Hartman4.9-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
@@ -279,9 +279,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 232/329 fs/proc/proc_sysctl.c: fix potential page fault while unregistering sysctl table
In reply to Greg Kroah-Hartman4.9-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
@@ -660,7 +660,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 233/329 swap: divide-by-zero when zero length swap file on ssd
In reply to Greg Kroah-Hartman4.9-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
@@ -2271,6 +2271,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 234/329 sr: get/drop reference to device in revalidate and check_events
In reply to Greg Kroah-Hartman4.9-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
@@ -582,18 +582,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))
@@ -602,6 +612,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 235/329 Force log to disk before reading the AGF during a fstrim
In reply to Greg Kroah-Hartman4.9-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 236/329 cpufreq: CPPC: Initialize shared perf capabilities of CPUs
In reply to Greg Kroah-Hartman4.9-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
@@ -151,9 +151,19 @@ static int cppc_cpufreq_cpu_init(struct policy->cpuinfo.transition_latency =cppc_get_transition_latency (cpu_num); 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 237/329 dp83640: Ensure against premature access to PHY registers after reset
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Esben Haabendal <[email protected]>
[ Upstream commit 76327a35caabd1a932e83d6a42b967aa08584e5d ]
The datasheet specifies a 3uS pause after performing a software reset. The default implementation of genphy_soft_reset() does not provide this, so implement soft_reset with the needed pause.
--- drivers/net/phy/dp83640.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/net/phy/dp83640.c +18 -0
@@ -1205,6 +1205,23 @@ static void dp83640_remove(struct phy_dekfree (dp83640); } +static int dp83640_soft_reset (struct phy_device *phydev) +{ +int ret; + + ret =genphy_soft_reset (phydev); +if (ret <0 ) +return ret; + +/* From DP83640 datasheet: "Software driver code must wait 3 us +* following a software reset before allowing further serial MII +* operations with the DP83640." +*/ +udelay (10 );/* Taking udelay inaccuracy into account */ + +return 0 ; +} +static int dp83640_config_init (struct phy_device *phydev) {struct dp83640_private *dp83640 = phydev->priv;
@@ -1498,6 +1515,7 @@ static struct phy_driver dp83640_driver .flags = PHY_HAS_INTERRUPT, .probe = dp83640_probe, .remove = dp83640_remove, + .soft_reset = dp83640_soft_reset, .config_init = dp83640_config_init, .config_aneg = genphy_config_aneg, .read_status = genphy_read_status,
Greg Kroah-Hartman
maintainerPATCH 238/329 mm/ksm: fix interaction with THP
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Claudio Imbrenda <[email protected]>
[ Upstream commit 77da2ba0648a4fd52e5ff97b8b2b8dd312aec4b0 ]
This patch fixes a corner case for KSM. When two pages belong or belonged to the same transparent hugepage, and they should be merged, KSM fails to split the page, and therefore no merging happens.
This bug can be reproduced by:
* making sure ksm is running (in case disabling ksmtuned)
* enabling transparent hugepages
* allocating a THP-aligned 1-THP-sized buffer e.g. on amd64: posix_memalign(&p, 1<<21, 1<<21)
* filling it with the same values
e.g. memset(p, 42, 1<<21)
* performing madvise to make it mergeable
e.g. madvise(p, 1<<21, MADV_MERGEABLE)
* waiting for KSM to perform a few scans
The expected outcome is that the all the pages get merged (1 shared and the rest sharing); the actual outcome is that no pages get merged (1 unshared and the rest volatile)
The reason of this behaviour is that we increase the reference count once for both pages we want to merge, but if they belong to the same hugepage (or compound page), the reference counter used in both cases is the one of the head of the compound page. This means that split_huge_page will find a value of the reference counter too high and will fail.
This patch solves this problem by testing if the two pages to merge belong to the same hugepage when attempting to merge them. If so, the hugepage is split safely. This means that the hugepage is not split if not necessary.
--- mm/ksm.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
mm/ksm.c +28 -0
@@ -1469,8 +1469,22 @@ static void cmp_and_merge_page(struct pa tree_rmap_item =unstable_tree_search_insert (rmap_item, page, &tree_page);if (tree_rmap_item) { +bool split; + kpage =try_to_merge_two_pages (rmap_item, page, tree_rmap_item, tree_page); +/* +* If both pages we tried to merge belong to the same compound +* page, then we actually ended up increasing the reference +* count of the same compound page twice, and split_huge_page +* failed. +* Here we set a flag if that happened, and we use it later to +* try split_huge_page again. Since we call put_page right +* afterwards, the reference count will be correct and +* split_huge_page should succeed. +*/ + split =PageTransCompound (page) + &&compound_head (page) ==compound_head (tree_page);put_page (tree_page);if (kpage) {/*
@@ -1495,6 +1509,20 @@ static void cmp_and_merge_page(struct pabreak_cow (tree_rmap_item);break_cow (rmap_item); } + }else if (split) { +/* +* We are here if we tried to merge two pages and +* failed because they both belonged to the same +* compound page. We will split the page now, but no +* merging will take place. +* We do not want to add the cost of a full lock; if +* the page is locked, it is better to skip it and +* perhaps try again later. +*/ +if (!trylock_page (page)) +return ; +split_huge_page (page); +unlock_page (page); } } }
Greg Kroah-Hartman
maintainerPATCH 239/329 mm: fix races between address_space dereference and free in page_evicatable
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huang Ying <[email protected]>
[ Upstream commit e92bb4dd9673945179b1fc738c9817dd91bfb629 ]
When page_mapping() is called and the mapping is dereferenced in page_evicatable() through shrink_active_list(), it is possible for the inode to be truncated and the embedded address space to be freed at the same time. This may lead to the following race.
CPU1 CPU2
truncate(inode) shrink_active_list()
... page_evictable(page)
truncate_inode_page(mapping, page);
delete_from_page_cache(page)
spin_lock_irqsave(&mapping->tree_lock, flags);
__delete_from_page_cache(page, NULL)
page_cache_tree_delete(..)
... mapping = page_mapping(page);
page->mapping = NULL;
...
spin_unlock_irqrestore(&mapping->tree_lock, flags);
page_cache_free_page(mapping, page)
put_page(page)
if (put_page_testzero(page)) -> false- inode now has no pages and can be freed including embedded address_space
mapping_unevictable(mapping) test_bit(AS_UNEVICTABLE, &mapping->flags);
- we've dereferenced mapping which is potentially already free.
Similar race exists between swap cache freeing and page_evicatable() too.
The address_space in inode and swap cache will be freed after a RCU grace period. So the races are fixed via enclosing the page_mapping() and address_space usage in rcu_read_lock/unlock(). Some comments are added in code to make it clear what is protected by the RCU read lock.
--- mm/vmscan.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
mm/vmscan.c +7 -1
@@ -3857,7 +3857,13 @@ int node_reclaim(struct pglist_data *pgd*/ int page_evictable (struct page *page) { -return !mapping_unevictable (page_mapping (page)) && !PageMlocked (page); +int ret; + +/* Prevent address_space of inode and swap cache from being freed */ +rcu_read_lock (); + ret = !mapping_unevictable (page_mapping (page)) && !PageMlocked (page); +rcu_read_unlock (); +return ret; }#ifdef CONFIG_SHMEM
Greg Kroah-Hartman
maintainerPATCH 240/329 Btrfs: bail out on error during replay_dir_deletes
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liu Bo <[email protected]>
[ Upstream commit b98def7ca6e152ee55e36863dddf6f41f12d1dc6 ]
If errors were returned by btrfs_next_leaf(), replay_dir_deletes needs to bail out, otherwise @ret would be forced to be 0 after 'break;' and the caller won't be aware of it.
--- fs/btrfs/tree-log.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/btrfs/tree-log.c +3 -1
@@ -2241,8 +2241,10 @@ again: nritems =btrfs_header_nritems (path->nodes[0 ]);if (path->slots[0 ] >= nritems) { ret =btrfs_next_leaf (root, path); -if (ret) +if (ret ==1 )break ; +else if (ret <0 ) + goto out; }btrfs_item_key_to_cpu (path->nodes[0 ], &found_key, path->slots[0 ]);
Greg Kroah-Hartman
maintainerPATCH 241/329 Btrfs: fix NULL pointer dereference in log_dir_items
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liu Bo <[email protected]>
[ Upstream commit 80c0b4210a963e31529e15bf90519708ec947596 ]
0, 1 and <0 can be returned by btrfs_next_leaf(), and when <0 is returned, path->nodes[0] could be NULL, log_dir_items lacks such a check for <0 and we may run into a null pointer dereference panic.
--- fs/btrfs/tree-log.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
fs/btrfs/tree-log.c +5 -2
@@ -3399,8 +3399,11 @@ static noinline int log_dir_items(struct* from this directory and from this transaction */ ret =btrfs_next_leaf (root, path); -if (ret ==1 ) { - last_offset = (u64)-1 ; +if (ret) { +if (ret ==1 ) + last_offset = (u64)-1 ; +else + err = ret; goto done; }btrfs_item_key_to_cpu (path->nodes[0 ], &tmp, path->slots[0 ]);
Greg Kroah-Hartman
maintainerPATCH 242/329 btrfs: Fix possible softlock on single core machines
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Borisov <[email protected]>
[ Upstream commit 1e1c50a929bc9e49bc3f9935b92450d9e69f8158 ]
do_chunk_alloc implements a loop checking whether there is a pending chunk allocation and if so causes the caller do loop. Generally this loop is executed only once, however testing with btrfs/072 on a single core vm machines uncovered an extreme case where the system could loop indefinitely. This is due to a missing cond_resched when loop which doesn't give a chance to the previous chunk allocator finish its job.
The fix is to simply add the missing cond_resched.
--- fs/btrfs/extent-tree.c | 1 + 1 file changed, 1 insertion(+)
fs/btrfs/extent-tree.c +1 -0
@@ -4527,6 +4527,7 @@ again:if (wait_for_alloc) {mutex_unlock (&fs_info->chunk_mutex); wait_for_alloc =0 ; +cond_resched (); goto again; }
Greg Kroah-Hartman
maintainerPATCH 243/329 ocfs2/dlm: dont handle migrate lockres if already in shutdown
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jun Piao <[email protected]>
[ Upstream commit bb34f24c7d2c98d0c81838a7700e6068325b17a0 ]
We should not handle migrate lockres if we are already in 'DLM_CTXT_IN_SHUTDOWN', as that will cause lockres remains after leaving dlm domain. At last other nodes will get stuck into infinite loop when requsting lock from us.
The problem is caused by concurrency umount between nodes. Before receiveing N1's DLM_BEGIN_EXIT_DOMAIN_MSG, N2 has picked up N1 as the migrate target. So N2 will continue sending lockres to N1 even though N1 has left domain.
N1 N2 (owner)
touch file
access the file,
and get pr lock
begin leave domain and pick up N1 as new owner
begin leave domain and
migrate all lockres done
begin migrate lockres to N1
end leave domain, but
the lockres left
unexpectedly, because
migrate task has passed
--- fs/ocfs2/dlm/dlmdomain.c | 14 -------------- fs/ocfs2/dlm/dlmdomain.h | 25 ++++++++++++++++++++++++- fs/ocfs2/dlm/dlmrecovery.c | 9 +++++++++ 3 files changed, 33 insertions(+), 15 deletions(-)
fs/ocfs2/dlm/dlmdomain.c +0 -14
@@ -675,20 +675,6 @@ static void dlm_leave_domain(struct dlm_spin_unlock (&dlm->spinlock); } -int dlm_shutting_down (struct dlm_ctxt *dlm) -{ -int ret =0 ; - -spin_lock (&dlm_domain_lock); - -if (dlm->dlm_state ==DLM_CTXT_IN_SHUTDOWN ) - ret =1 ; - -spin_unlock (&dlm_domain_lock); - -return ret; -} -void dlm_unregister_domain (struct dlm_ctxt *dlm) {int leave =0 ;
fs/ocfs2/dlm/dlmdomain.h +24 -1
@@ -28,7 +28,30 @@extern spinlock_t dlm_domain_lock;extern struct list_head dlm_domains; -int dlm_shutting_down (struct dlm_ctxt *dlm); +static inline int dlm_joined (struct dlm_ctxt *dlm) +{ +int ret =0 ; + +spin_lock (&dlm_domain_lock); +if (dlm->dlm_state ==DLM_CTXT_JOINED ) + ret =1 ; +spin_unlock (&dlm_domain_lock); + +return ret; +} + +static inline int dlm_shutting_down (struct dlm_ctxt *dlm) +{ +int ret =0 ; + +spin_lock (&dlm_domain_lock); +if (dlm->dlm_state ==DLM_CTXT_IN_SHUTDOWN ) + ret =1 ; +spin_unlock (&dlm_domain_lock); + +return ret; +} +void dlm_fire_domain_eviction_callbacks (struct dlm_ctxt *dlm,int node_num);
fs/ocfs2/dlm/dlmrecovery.c +9 -0
@@ -1378,6 +1378,15 @@ int dlm_mig_lockres_handler(struct o2netif (!dlm_grab (dlm))return -EINVAL ; +if (!dlm_joined (dlm)) { +mlog (ML_ERROR ,"Domain %s not joined! " +"lockres %.*s, master %u\n" , + dlm->name, mres->lockname_len, + mres->lockname, mres->master); +dlm_put (dlm); +return -EINVAL ; + } +BUG_ON (!(mres->flags & (DLM_MRES_RECOVERY |DLM_MRES_MIGRATION ))); real_master = mres->master;
Greg Kroah-Hartman
maintainerPATCH 244/329 sched/rt: Fix rq->clock_update_flags < RQCF_ACT_SKIP warning
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Davidlohr Bueso <[email protected]>
[ Upstream commit d29a20645d5e929aa7e8616f28e5d8e1c49263ec ]
While running rt-tests' pi_stress program I got the following splat:
rq->clock_update_flags < RQCF_ACT_SKIP
WARNING: CPU: 27 PID: 0 at kernel/sched/sched.h:960 assert_clock_updated.isra.38.part.39+0x13/0x20
[...]
<IRQ> enqueue_top_rt_rq+0xf4/0x150 ? cpufreq_dbs_governor_start+0x170/0x170 sched_rt_rq_enqueue+0x65/0x80 sched_rt_period_timer+0x156/0x360 ? sched_rt_rq_enqueue+0x80/0x80 __hrtimer_run_queues+0xfa/0x260 hrtimer_interrupt+0xcb/0x220 smp_apic_timer_interrupt+0x62/0x120 apic_timer_interrupt+0xf/0x20 </IRQ>
[...]
do_idle+0x183/0x1e0 cpu_startup_entry+0x5f/0x70 start_secondary+0x192/0x1d0 secondary_startup_64+0xa5/0xb0
We can get rid of it be the "traditional" means of adding an update_rq_clock() call after acquiring the rq->lock in do_sched_rt_period_timer().
The case for the RT task throttling (which this workload also hits) can be ignored in that the skip_update call is actually bogus and quite the contrary (the request bits are removed/reverted).
By setting RQCF_UPDATED we really don't care if the skip is happening or not and will therefore make the assert_clock_updated() check happy.
--- kernel/sched/rt.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/sched/rt.c +2 -0
@@ -830,6 +830,8 @@ static int do_sched_rt_period_timer(strustruct rq *rq =rq_of_rt_rq (rt_rq);raw_spin_lock (&rq->lock); +update_rq_clock (rq); +if (rt_rq->rt_time) {u64 runtime;
Greg Kroah-Hartman
maintainerPATCH 246/329 fscache: Fix hanging wait on page discarded by writeback
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit 2c98425720233ae3e135add0c7e869b32913502f ]
If the fscache asynchronous write operation elects to discard a page that's pending storage to the cache because the page would be over the store limit then it needs to wake the page as someone may be waiting on completion of the write.
The problem is that the store limit may be updated by a different asynchronous operation - and so may miss the write - and that the store limit may not even get updated until later by the netfs.
Fix the kernel hang by making fscache_write_op() mark as written any pages that are over the limit.
--- fs/fscache/page.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
fs/fscache/page.c +9 -4
@@ -776,6 +776,7 @@ static void fscache_write_op(struct fsca_enter ("{OP%x,%d}" , op->op.debug_id,atomic_read (&op->op.usage)); +again:spin_lock (&object->lock); cookie = object->cookie;
@@ -816,10 +817,6 @@ static void fscache_write_op(struct fsca goto superseded; page = results[0 ];_debug ("gang %d [%lx]" , n, page->index); -if (page->index >= op->store_limit) { -fscache_stat (&fscache_n_store_pages_over_limit); - goto superseded; - }radix_tree_tag_set (&cookie->stores, page->index,FSCACHE_COOKIE_STORING_TAG );
@@ -829,6 +826,9 @@ static void fscache_write_op(struct fscaspin_unlock (&cookie->stores_lock);spin_unlock (&object->lock); +if (page->index >= op->store_limit) + goto discard_page; +fscache_stat (&fscache_n_store_pages);fscache_stat (&fscache_n_cop_write_page); ret = object->cache->ops->write_page (op, page);
@@ -844,6 +844,11 @@ static void fscache_write_op(struct fsca_leave ("" );return ; +discard_page: +fscache_stat (&fscache_n_store_pages_over_limit); +fscache_end_page_write (object, page); + goto again; + superseded:/* this writer is going away and there aren't any more things to * write */
Greg Kroah-Hartman
maintainerPATCH 248/329 net: bgmac: Fix endian access in bgmac_dma_tx_ring_free()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <[email protected]>
[ Upstream commit 60d6e6f0b9e422dd01aeda39257ee0428e5e2a3f ]
bgmac_dma_tx_ring_free() assigns the ctl1 word which is a litle endian 32-bit word without using proper accessors, fix this, and because a length cannot be negative, use unsigned int while at it.
--- drivers/net/ethernet/broadcom/bgmac.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bgmac.c +2 -1
@@ -529,7 +529,8 @@ static void bgmac_dma_tx_ring_free(strucint i;for (i =0 ; i <BGMAC_TX_RING_SLOTS ; i++) { -int len = dma_desc[i].ctl1 &BGMAC_DESC_CTL1_LEN ; +u32 ctl1 =le32_to_cpu (dma_desc[i].ctl1); +unsigned int len = ctl1 &BGMAC_DESC_CTL1_LEN ; slot = &ring->slots[i];dev_kfree_skb (slot->skb);
Greg Kroah-Hartman
maintainerPATCH 249/329 btrfs: tests/qgroup: Fix wrong tree backref level
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qu Wenruo <[email protected]>
[ Upstream commit 3c0efdf03b2d127f0e40e30db4e7aa0429b1b79a ]
The extent tree of the test fs is like the following:
BTRFS info (device (null)): leaf 16327509003777336587 total ptrs 1 free space 3919
item 0 key (4096 168 4096) itemoff 3944 itemsize 51
extent refs 1 gen 1 flags 2
tree block key (68719476736 0 0) level 1
^^^^^^^
ref#0: tree block backref root 5
And it's using an empty tree for fs tree, so there is no way that its level can be 1.
For REAL (created by mkfs) fs tree backref with no skinny metadata, the result should look like:
item 3 key (30408704 EXTENT_ITEM 4096) itemoff 3845 itemsize 51
refs 1 gen 4 flags TREE_BLOCK
tree block key (256 INODE_ITEM 0) level 0
^^^^^^^
tree block backref root 5
Fix the level to 0, so it won't break later tree level checker.
--- fs/btrfs/tests/qgroup-tests.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/tests/qgroup-tests.c +1 -1
@@ -63,7 +63,7 @@ static int insert_normal_tree_ref(structbtrfs_set_extent_generation (leaf, item,1 );btrfs_set_extent_flags (leaf, item,BTRFS_EXTENT_FLAG_TREE_BLOCK ); block_info = (struct btrfs_tree_block_info *)(item +1 ); -btrfs_set_tree_block_level (leaf, block_info,1 ); +btrfs_set_tree_block_level (leaf, block_info,0 ); iref = (struct btrfs_extent_inline_ref *)(block_info +1 );if (parent >0 ) { btrfs_set_extent_inline_ref_type(leaf, iref,
Greg Kroah-Hartman
maintainerPATCH 250/329 Btrfs: fix copy_items() return value when logging an inode
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
[ Upstream commit 8434ec46c6e3232cebc25a910363b29f5c617820 ]
When logging an inode, at tree-log.c:copy_items(), if we call btrfs_next_leaf() at the loop which checks for the need to log holes, we need to make sure copy_items() returns the value 1 to its caller and not 0 (on success). This is because the path the caller passed was released and is now different from what is was before, and the caller expects a return value of 0 to mean both success and that the path has not changed, while a return value of 1 means both success and signals the caller that it can not reuse the path, it has to perform another tree search.
Even though this is a case that should not be triggered on normal circumstances or very rare at least, its consequences can be very unpredictable (especially when replaying a log tree).
--- fs/btrfs/tree-log.c | 1 + 1 file changed, 1 insertion(+)
fs/btrfs/tree-log.c +1 -0
@@ -3854,6 +3854,7 @@ fill_holes:ASSERT (ret ==0 ); src = src_path->nodes[0 ]; i =0 ; + need_find_last_extent = true; }btrfs_item_key_to_cpu (src, &key, i);
Greg Kroah-Hartman
maintainerPATCH 251/329 btrfs: fix lockdep splat in btrfs_alloc_subvolume_writers
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Mahoney <[email protected]>
[ Upstream commit 8a5a916d9a35e13576d79cc16e24611821b13e34 ]
While running btrfs/011, I hit the following lockdep splat.
This is the important bit:
pcpu_alloc+0x1ac/0x5e0 __percpu_counter_init+0x4e/0xb0 btrfs_init_fs_root+0x99/0x1c0 [btrfs] btrfs_get_fs_root.part.54+0x5b/0x150 [btrfs] resolve_indirect_refs+0x130/0x830 [btrfs] find_parent_nodes+0x69e/0xff0 [btrfs] btrfs_find_all_roots_safe+0xa0/0x110 [btrfs] btrfs_find_all_roots+0x50/0x70 [btrfs] btrfs_qgroup_prepare_account_extents+0x53/0x90 [btrfs] btrfs_commit_transaction+0x3ce/0x9b0 [btrfs]
The percpu_counter_init call in btrfs_alloc_subvolume_writers uses GFP_KERNEL, which we can't do during transaction commit.
This switches it to GFP_NOFS.
========================================================
WARNING: possible irq lock inversion dependency detected
4.12.14-kvmsmall #8 Tainted: G W
--------------------------------------------------------
kswapd0/50 just changed the state of lock:
(&delayed_node->mutex){+.+.-.}, at: [<ffffffffc06994fa>] __btrfs_release_delayed_node+0x3a/0x1f0 [btrfs]
but this lock took another, RECLAIM_FS-unsafe lock in the past:
(pcpu_alloc_mutex){+.+.+.}
and interrupts could create inverse lock ordering between them.
other info that might help us debug this:
Chain exists of: &delayed_node->mutex --> &found->groups_sem --> pcpu_alloc_mutex
Possible interrupt unsafe locking scenario:
CPU0 CPU1
---- ----
lock(pcpu_alloc_mutex);
local_irq_disable();
lock(&delayed_node->mutex);
lock(&found->groups_sem);
<Interrupt>
lock(&delayed_node->mutex);*** DEADLOCK ***
2 locks held by kswapd0/50:
#0: (shrinker_rwsem){++++..}, at: [<ffffffff811dc11f>] shrink_slab+0x7f/0x5b0 #1: (&type->s_umount_key#30){+++++.}, at: [<ffffffff8126dec6>] trylock_super+0x16/0x50
the shortest dependencies between 2nd lock and 1st lock:
-> (pcpu_alloc_mutex){+.+.+.} ops: 4904 {
HARDIRQ-ON-W at:
__mutex_lock+0x4e/0x8c0
pcpu_alloc+0x1ac/0x5e0
alloc_kmem_cache_cpus.isra.70+0x25/0xa0
__do_tune_cpucache+0x2c/0x220
do_tune_cpucache+0x26/0xc0
enable_cpucache+0x6d/0xf0
kmem_cache_init_late+0x42/0x75
start_kernel+0x343/0x4cb
x86_64_start_kernel+0x127/0x134
secondary_startup_64+0xa5/0xb0
SOFTIRQ-ON-W at:
__mutex_lock+0x4e/0x8c0
pcpu_alloc+0x1ac/0x5e0
alloc_kmem_cache_cpus.isra.70+0x25/0xa0
__do_tune_cpucache+0x2c/0x220
do_tune_cpucache+0x26/0xc0
enable_cpucache+0x6d/0xf0
kmem_cache_init_late+0x42/0x75
start_kernel+0x343/0x4cb
x86_64_start_kernel+0x127/0x134
secondary_startup_64+0xa5/0xb0
RECLAIM_FS-ON-W at:
__kmalloc+0x47/0x310
pcpu_extend_area_map+0x2b/0xc0
pcpu_alloc+0x3ec/0x5e0
alloc_kmem_cache_cpus.isra.70+0x25/0xa0
__do_tune_cpucache+0x2c/0x220
do_tune_cpucache+0x26/0xc0
enable_cpucache+0x6d/0xf0
__kmem_cache_create+0x1bf/0x390
create_cache+0xba/0x1b0
kmem_cache_create+0x1f8/0x2b0
ksm_init+0x6f/0x19d
do_one_initcall+0x50/0x1b0
kernel_init_freeable+0x201/0x289
kernel_init+0xa/0x100
ret_from_fork+0x3a/0x50
INITIAL USE at:
__mutex_lock+0x4e/0x8c0
pcpu_alloc+0x1ac/0x5e0
alloc_kmem_cache_cpus.isra.70+0x25/0xa0
setup_cpu_cache+0x2f/0x1f0
__kmem_cache_create+0x1bf/0x390
create_boot_cache+0x8b/0xb1
kmem_cache_init+0xa1/0x19e
start_kernel+0x270/0x4cb
x86_64_start_kernel+0x127/0x134
secondary_startup_64+0xa5/0xb0
}
... key at: [<ffffffff821d8e70>] pcpu_alloc_mutex+0x70/0xa0
... acquired at:
pcpu_alloc+0x1ac/0x5e0
__percpu_counter_init+0x4e/0xb0
btrfs_init_fs_root+0x99/0x1c0 [btrfs]
btrfs_get_fs_root.part.54+0x5b/0x150 [btrfs]
resolve_indirect_refs+0x130/0x830 [btrfs]
find_parent_nodes+0x69e/0xff0 [btrfs]
btrfs_find_all_roots_safe+0xa0/0x110 [btrfs]
btrfs_find_all_roots+0x50/0x70 [btrfs]
btrfs_qgroup_prepare_account_extents+0x53/0x90 [btrfs]
btrfs_commit_transaction+0x3ce/0x9b0 [btrfs]
transaction_kthread+0x176/0x1b0 [btrfs]
kthread+0x102/0x140
ret_from_fork+0x3a/0x50 -> (&fs_info->commit_root_sem){++++..} ops: 1566382 {
HARDIRQ-ON-W at:
down_write+0x3e/0xa0
cache_block_group+0x287/0x420 [btrfs]
find_free_extent+0x106c/0x12d0 [btrfs]
btrfs_reserve_extent+0xd8/0x170 [btrfs]
cow_file_range.isra.66+0x133/0x470 [btrfs]
run_delalloc_range+0x121/0x410 [btrfs]
writepage_delalloc.isra.50+0xfe/0x180 [btrfs]
__extent_writepage+0x19a/0x360 [btrfs]
extent_write_cache_pages.constprop.56+0x249/0x3e0 [btrfs]
extent_writepages+0x4d/0x60 [btrfs]
do_writepages+0x1a/0x70
__filemap_fdatawrite_range+0xa7/0xe0
btrfs_rename+0x5ee/0xdb0 [btrfs]
vfs_rename+0x52a/0x7e0
SyS_rename+0x351/0x3b0
do_syscall_64+0x79/0x1e0
entry_SYSCALL_64_after_hwframe+0x42/0xb7
HARDIRQ-ON-R at:
down_read+0x35/0x90
caching_thread+0x57/0x560 [btrfs]
normal_work_helper+0x1c0/0x5e0 [btrfs]
process_one_work+0x1e0/0x5c0
worker_thread+0x44/0x390
kthread+0x102/0x140
ret_from_fork+0x3a/0x50
SOFTIRQ-ON-W at:
down_write+0x3e/0xa0
cache_block_group+0x287/0x420 [btrfs]
find_free_extent+0x106c/0x12d0 [btrfs]
btrfs_reserve_extent+0xd8/0x170 [btrfs]
cow_file_range.isra.66+0x133/0x470 [btrfs]
run_delalloc_range+0x121/0x410 [btrfs]
writepage_delalloc.isra.50+0xfe/0x180 [btrfs]
__extent_writepage+0x19a/0x360 [btrfs]
extent_write_cache_pages.constprop.56+0x249/0x3e0 [btrfs]
extent_writepages+0x4d/0x60 [btrfs]
do_writepages+0x1a/0x70
__filemap_fdatawrite_range+0xa7/0xe0
btrfs_rename+0x5ee/0xdb0 [btrfs]
vfs_rename+0x52a/0x7e0
SyS_rename+0x351/0x3b0
do_syscall_64+0x79/0x1e0
entry_SYSCALL_64_after_hwframe+0x42/0xb7
SOFTIRQ-ON-R at:
down_read+0x35/0x90
caching_thread+0x57/0x560 [btrfs]
normal_work_helper+0x1c0/0x5e0 [btrfs]
process_one_work+0x1e0/0x5c0
worker_thread+0x44/0x390
kthread+0x102/0x140
ret_from_fork+0x3a/0x50
INITIAL USE at:
down_write+0x3e/0xa0
cache_block_group+0x287/0x420 [btrfs]
find_free_extent+0x106c/0x12d0 [btrfs]
btrfs_reserve_extent+0xd8/0x170 [btrfs]
cow_file_range.isra.66+0x133/0x470 [btrfs]
run_delalloc_range+0x121/0x410 [btrfs]
writepage_delalloc.isra.50+0xfe/0x180 [btrfs]
__extent_writepage+0x19a/0x360 [btrfs]
extent_write_cache_pages.constprop.56+0x249/0x3e0 [btrfs]
extent_writepages+0x4d/0x60 [btrfs]
do_writepages+0x1a/0x70
__filemap_fdatawrite_range+0xa7/0xe0
btrfs_rename+0x5ee/0xdb0 [btrfs]
vfs_rename+0x52a/0x7e0
SyS_rename+0x351/0x3b0
do_syscall_64+0x79/0x1e0
entry_SYSCALL_64_after_hwframe+0x42/0xb7
}
... key at: [<ffffffffc0729578>] __key.61970+0x0/0xfffffffffff9aa88 [btrfs]
... acquired at:
cache_block_group+0x287/0x420 [btrfs]
find_free_extent+0x106c/0x12d0 [btrfs]
btrfs_reserve_extent+0xd8/0x170 [btrfs]
btrfs_alloc_tree_block+0x12f/0x4c0 [btrfs]
btrfs_create_tree+0xbb/0x2a0 [btrfs]
btrfs_create_uuid_tree+0x37/0x140 [btrfs]
open_ctree+0x23c0/0x2660 [btrfs]
btrfs_mount+0xd36/0xf90 [btrfs]
mount_fs+0x3a/0x160
vfs_kern_mount+0x66/0x150
btrfs_mount+0x18c/0xf90 [btrfs]
mount_fs+0x3a/0x160
vfs_kern_mount+0x66/0x150
do_mount+0x1c1/0xcc0
SyS_mount+0x7e/0xd0
do_syscall_64+0x79/0x1e0
entry_SYSCALL_64_after_hwframe+0x42/0xb7 -> (&found->groups_sem){++++..} ops: 2134587 {
HARDIRQ-ON-W at:
down_write+0x3e/0xa0
__link_block_group+0x34/0x130 [btrfs]
btrfs_read_block_groups+0x33d/0x7b0 [btrfs]
open_ctree+0x2054/0x2660 [btrfs]
btrfs_mount+0xd36/0xf90 [btrfs]
mount_fs+0x3a/0x160
vfs_kern_mount+0x66/0x150
btrfs_mount+0x18c/0xf90 [btrfs]
mount_fs+0x3a/0x160
vfs_kern_mount+0x66/0x150
do_mount+0x1c1/0xcc0
SyS_mount+0x7e/0xd0
do_syscall_64+0x79/0x1e0
entry_SYSCALL_64_after_hwframe+0x42/0xb7
HARDIRQ-ON-R at:
down_read+0x35/0x90
btrfs_calc_num_tolerated_disk_barrier_failures+0x113/0x1f0 [btrfs]
open_ctree+0x207b/0x2660 [btrfs]
btrfs_mount+0xd36/0xf90 [btrfs]
mount_fs+0x3a/0x160
vfs_kern_mount+0x66/0x150
btrfs_mount+0x18c/0xf90 [btrfs]
mount_fs+0x3a/0x160
vfs_kern_mount+0x66/0x150
do_mount+0x1c1/0xcc0
SyS_mount+0x7e/0xd0
do_syscall_64+0x79/0x1e0
entry_SYSCALL_64_after_hwframe+0x42/0xb7
SOFTIRQ-ON-W at:
down_write+0x3e/0xa0
__link_block_group+0x34/0x130 [btrfs]
btrfs_read_block_groups+0x33d/0x7b0 [btrfs]
open_ctree+0x2054/0x2660 [btrfs]
btrfs_mount+0xd36/0xf90 [btrfs]
mount_fs+0x3a/0x160
vfs_kern_mount+0x66/0x150
btrfs_mount+0x18c/0xf90 [btrfs]
mount_fs+0x3a/0x160
vfs_kern_mount+0x66/0x150
do_mount+0x1c1/0xcc0
SyS_mount+0x7e/0xd0
do_syscall_64+0x79/0x1e0
entry_SYSCALL_64_after_hwframe+0x42/0xb7
SOFTIRQ-ON-R at:
down_read+0x35/0x90
btrfs_calc_num_tolerated_disk_barrier_failures+0x113/0x1f0 [btrfs]
open_ctree+0x207b/0x2660 [btrfs]
btrfs_mount+0xd36/0xf90 [btrfs]
mount_fs+0x3a/0x160
vfs_kern_mount+0x66/0x150
btrfs_mount+0x18c/0xf90 [btrfs]
mount_fs+0x3a/0x160
vfs_kern_mount+0x66/0x150
do_mount+0x1c1/0xcc0
SyS_mount+0x7e/0xd0
do_syscall_64+0x79/0x1e0
entry_SYSCALL_64_after_hwframe+0x42/0xb7
INITIAL USE at:
down_write+0x3e/0xa0
__link_block_group+0x34/0x130 [btrfs]
btrfs_read_block_groups+0x33d/0x7b0 [btrfs]
open_ctree+0x2054/0x2660 [btrfs]
btrfs_mount+0xd36/0xf90 [btrfs]
mount_fs+0x3a/0x160
vfs_kern_mount+0x66/0x150
btrfs_mount+0x18c/0xf90 [btrfs]
mount_fs+0x3a/0x160
vfs_kern_mount+0x66/0x150
do_mount+0x1c1/0xcc0
SyS_mount+0x7e/0xd0
do_syscall_64+0x79/0x1e0
entry_SYSCALL_64_after_hwframe+0x42/0xb7
}
... key at: [<ffffffffc0729488>] __key.59101+0x0/0xfffffffffff9ab78 [btrfs]
... acquired at:
find_free_extent+0xcb4/0x12d0 [btrfs]
btrfs_reserve_extent+0xd8/0x170 [btrfs]
btrfs_alloc_tree_block+0x12f/0x4c0 [btrfs]
__btrfs_cow_block+0x110/0x5b0 [btrfs]
btrfs_cow_block+0xd7/0x290 [btrfs]
btrfs_search_slot+0x1f6/0x960 [btrfs]
btrfs_lookup_inode+0x2a/0x90 [btrfs]
__btrfs_update_delayed_inode+0x65/0x210 [btrfs]
btrfs_commit_inode_delayed_inode+0x121/0x130 [btrfs]
btrfs_evict_inode+0x3fe/0x6a0 [btrfs]
evict+0xc4/0x190
__dentry_kill+0xbf/0x170
dput+0x2ae/0x2f0
SyS_rename+0x2a6/0x3b0
do_syscall_64+0x79/0x1e0
entry_SYSCALL_64_after_hwframe+0x42/0xb7-> (&delayed_node->mutex){+.+.-.} ops: 5580204 {
HARDIRQ-ON-W at:
__mutex_lock+0x4e/0x8c0
btrfs_delayed_update_inode+0x46/0x6e0 [btrfs]
btrfs_update_inode+0x83/0x110 [btrfs]
btrfs_dirty_inode+0x62/0xe0 [btrfs]
touch_atime+0x8c/0xb0
do_generic_file_read+0x818/0xb10
__vfs_read+0xdc/0x150
vfs_read+0x8a/0x130
SyS_read+0x45/0xa0
do_syscall_64+0x79/0x1e0
entry_SYSCALL_64_after_hwframe+0x42/0xb7
SOFTIRQ-ON-W at:
__mutex_lock+0x4e/0x8c0
btrfs_delayed_update_inode+0x46/0x6e0 [btrfs]
btrfs_update_inode+0x83/0x110 [btrfs]
btrfs_dirty_inode+0x62/0xe0 [btrfs]
touch_atime+0x8c/0xb0
do_generic_file_read+0x818/0xb10
__vfs_read+0xdc/0x150
vfs_read+0x8a/0x130
SyS_read+0x45/0xa0
do_syscall_64+0x79/0x1e0
entry_SYSCALL_64_after_hwframe+0x42/0xb7
IN-RECLAIM_FS-W at:
__mutex_lock+0x4e/0x8c0
__btrfs_release_delayed_node+0x3a/0x1f0 [btrfs]
btrfs_evict_inode+0x22c/0x6a0 [btrfs]
evict+0xc4/0x190
dispose_list+0x35/0x50
prune_icache_sb+0x42/0x50
super_cache_scan+0x139/0x190
shrink_slab+0x262/0x5b0
shrink_node+0x2eb/0x2f0
kswapd+0x2eb/0x890
kthread+0x102/0x140
ret_from_fork+0x3a/0x50
INITIAL USE at:
__mutex_lock+0x4e/0x8c0
btrfs_delayed_update_inode+0x46/0x6e0 [btrfs]
btrfs_update_inode+0x83/0x110 [btrfs]
btrfs_dirty_inode+0x62/0xe0 [btrfs]
touch_atime+0x8c/0xb0
do_generic_file_read+0x818/0xb10
__vfs_read+0xdc/0x150
vfs_read+0x8a/0x130
SyS_read+0x45/0xa0
do_syscall_64+0x79/0x1e0
entry_SYSCALL_64_after_hwframe+0x42/0xb7
}
... key at: [<ffffffffc072d488>] __key.56935+0x0/0xfffffffffff96b78 [btrfs]
... acquired at:
__lock_acquire+0x264/0x11c0
lock_acquire+0xbd/0x1e0
__mutex_lock+0x4e/0x8c0
__btrfs_release_delayed_node+0x3a/0x1f0 [btrfs]
btrfs_evict_inode+0x22c/0x6a0 [btrfs]
evict+0xc4/0x190
dispose_list+0x35/0x50
prune_icache_sb+0x42/0x50
super_cache_scan+0x139/0x190
shrink_slab+0x262/0x5b0
shrink_node+0x2eb/0x2f0
kswapd+0x2eb/0x890
kthread+0x102/0x140
ret_from_fork+0x3a/0x50
stack backtrace:
CPU: 1 PID: 50 Comm: kswapd0 Tainted: G W 4.12.14-kvmsmall #8 SLE15 (unreleased)
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.0.0-prebuilt.qemu-project.org 04/01/2014
Call Trace:
dump_stack+0x78/0xb7
print_irq_inversion_bug.part.38+0x19f/0x1aa
check_usage_forwards+0x102/0x120
? ret_from_fork+0x3a/0x50
? check_usage_backwards+0x110/0x110
mark_lock+0x16c/0x270
__lock_acquire+0x264/0x11c0
? pagevec_lookup_entries+0x1a/0x30
? truncate_inode_pages_range+0x2b3/0x7f0
lock_acquire+0xbd/0x1e0
? __btrfs_release_delayed_node+0x3a/0x1f0 [btrfs]
__mutex_lock+0x4e/0x8c0
? __btrfs_release_delayed_node+0x3a/0x1f0 [btrfs]
? __btrfs_release_delayed_node+0x3a/0x1f0 [btrfs]
? btrfs_evict_inode+0x1f6/0x6a0 [btrfs]
__btrfs_release_delayed_node+0x3a/0x1f0 [btrfs]
btrfs_evict_inode+0x22c/0x6a0 [btrfs]
evict+0xc4/0x190
dispose_list+0x35/0x50
prune_icache_sb+0x42/0x50
super_cache_scan+0x139/0x190
shrink_slab+0x262/0x5b0
shrink_node+0x2eb/0x2f0
kswapd+0x2eb/0x890
kthread+0x102/0x140
? mem_cgroup_shrink_node+0x2c0/0x2c0
? kthread_create_on_node+0x40/0x40
ret_from_fork+0x3a/0x50--- fs/btrfs/disk-io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/disk-io.c +1 -1
@@ -1281,7 +1281,7 @@ static struct btrfs_subvolume_writers *bif (!writers)return ERR_PTR (-ENOMEM ); - ret =percpu_counter_init (&writers->counter,0 ,GFP_KERNEL ); + ret =percpu_counter_init (&writers->counter,0 ,GFP_NOFS );if (ret <0 ) {kfree (writers);return ERR_PTR (ret);
Greg Kroah-Hartman
maintainerPATCH 252/329 rxrpc: Fix Tx ring annotation after initial Tx failure
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit 03877bf6a30cca7d4bc3ffabd3c3e9464a7a1a19 ]
rxrpc calls have a ring of packets that are awaiting ACK or retransmission and a parallel ring of annotations that tracks the state of those packets. If the initial transmission of a packet on the underlying UDP socket fails then the packet annotation is marked for resend - but the setting of this mark accidentally erases the last-packet mark also stored in the same annotation slot. If this happens, a call won't switch out of the Tx phase when all the packets have been transmitted.
Fix this by retaining the last-packet mark and only altering the packet state.
--- net/rxrpc/sendmsg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/rxrpc/sendmsg.c +3 -1
@@ -78,7 +78,9 @@ static inline void rxrpc_instant_resend(spin_lock_bh (&call->lock);if (call->state <RXRPC_CALL_COMPLETE ) { - call->rxtx_annotations[ix] =RXRPC_TX_ANNO_RETRANS ; + call->rxtx_annotations[ix] = + (call->rxtx_annotations[ix] &RXRPC_TX_ANNO_LAST ) | +RXRPC_TX_ANNO_RETRANS ;if (!test_and_set_bit (RXRPC_CALL_EV_RESEND , &call->events))rxrpc_queue_call (call); }
Greg Kroah-Hartman
maintainerPATCH 253/329 rxrpc: Dont treat call aborts as conn aborts
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit 57b0c9d49b94bbeb53649b7fbd264603c1ebd585 ]
If a call-level abort is received for the previous call to complete on a connection channel, then that abort is queued for the connection processor to handle. Unfortunately, the connection processor then assumes without checking that the abort is connection-level (ie. callNumber is 0) and distributes it over all active calls on that connection, thereby incorrectly aborting them.
Fix this by discarding aborts aimed at a completed call.
Further, discard all packets aimed at a call that's complete if there's currently an active call on a channel, since the DATA packets associated with the new call automatically terminate the old call.
--- net/rxrpc/input.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
net/rxrpc/input.c +9 -6
@@ -1166,16 +1166,19 @@ void rxrpc_data_ready(struct sock *udp_s goto discard_unlock;if (sp->hdr.callNumber == chan->last_call) { -/* For the previous service call, if completed successfully, we -* discard all further packets. +if (chan->call || + sp->hdr.type ==RXRPC_PACKET_TYPE_ABORT ) + goto discard_unlock; + +/* For the previous service call, if completed +* successfully, we discard all further packets. */ if (rxrpc_conn_is_service (conn) && - (chan->last_type ==RXRPC_PACKET_TYPE_ACK || - sp->hdr.type ==RXRPC_PACKET_TYPE_ABORT )) + chan->last_type ==RXRPC_PACKET_TYPE_ACK ) goto discard_unlock; -/* But otherwise we need to retransmit the final packet from -* data cached in the connection record. +/* But otherwise we need to retransmit the final packet +* from data cached in the connection record. */ rxrpc_post_packet_to_conn (conn, skb); goto out_unlock;
Greg Kroah-Hartman
maintainerPATCH 254/329 xen/acpi: off by one in read_acpi_id()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit c37a3c94775855567b90f91775b9691e10bd2806 ]
If acpi_id is == nr_acpi_bits, then we access one element beyond the end of the acpi_psd[] array or we set one bit beyond the end of the bit map when we do __set_bit(acpi_id, acpi_id_present);
--- drivers/xen/xen-acpi-processor.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/xen/xen-acpi-processor.c +3 -3
@@ -362,9 +362,9 @@ read_acpi_id(acpi_handle handle, u32 lvl }/* There are more ACPI Processor objects than in x2APIC or MADT. * This can happen with incorrect ACPI SSDT declerations. */ -if (acpi_id > nr_acpi_bits) { -pr_debug ("We only have %u, trying to set %u\n" , - nr_acpi_bits, acpi_id); +if (acpi_id >= nr_acpi_bits) { +pr_debug ("max acpi id %u, trying to set %u\n" , + nr_acpi_bits -1 , acpi_id);return AE_OK ; }/* OK, There is a ACPI Processor object */
Greg Kroah-Hartman
maintainerPATCH 255/329 drivers: macintosh: rack-meter: really fix bogus memsets
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaro Koskinen <[email protected]>
[ Upstream commit e283655b5abe26462d53d5196f186c5e8863af3b ]
We should zero an array using sizeof instead of number of elements.
Fixes the following compiler (GCC 7.3.0) warnings:
drivers/macintosh/rack-meter.c: In function 'rackmeter_do_pause':drivers/macintosh/rack-meter.c:157:2: warning: 'memset' used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size] drivers/macintosh/rack-meter.c:158:2: warning: 'memset' used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
--- drivers/macintosh/rack-meter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/macintosh/rack-meter.c +2 -2
@@ -154,8 +154,8 @@ static void rackmeter_do_pause(struct raDBDMA_DO_STOP (rm->dma_regs);return ; } -memset (rdma->buf1,0 ,ARRAY_SIZE (rdma->buf1)); -memset (rdma->buf2,0 ,ARRAY_SIZE (rdma->buf2)); +memset (rdma->buf1,0 ,sizeof (rdma->buf1)); +memset (rdma->buf2,0 ,sizeof (rdma->buf2)); rm->dma_buf_v->mark =0 ;
Greg Kroah-Hartman
maintainerPATCH 256/329 ACPI: acpi_pad: Fix memory leak in power saving threads
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lenny Szubowicz <[email protected]>
[ Upstream commit 8b29d29abc484d638213dd79a18a95ae7e5bb402 ]
Fix once per second (round_robin_time) memory leak of about 1 KB in each acpi_pad kernel idling thread that is activated.
Found by testing with kmemleak.
--- drivers/acpi/acpi_pad.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/acpi/acpi_pad.c +3 -0
@@ -109,6 +109,7 @@ static void round_robin_cpu(unsigned intcpumask_andnot (tmp, cpu_online_mask, pad_busy_cpus);if (cpumask_empty (tmp)) {mutex_unlock (&round_robin_lock); +free_cpumask_var (tmp);return ; }for_each_cpu (cpu, tmp) {
@@ -126,6 +127,8 @@ static void round_robin_cpu(unsigned intmutex_unlock (&round_robin_lock);set_cpus_allowed_ptr (current,cpumask_of (preferred_cpu)); + +free_cpumask_var (tmp); }static void exit_round_robin (unsigned int tsk_index)
Greg Kroah-Hartman
maintainerPATCH 257/329 powerpc/mpic: Check if cpu_possible() in mpic_physmask()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
[ Upstream commit 0834d627fbea00c1444075eb3e448e1974da452d ]
In mpic_physmask() we loop over all CPUs up to 32, then get the hard SMP processor id of that CPU.
Currently that's possibly walking off the end of the paca array, but in a future patch we will change the paca array to be an array of pointers, and in that case we will get a NULL for missing CPUs and oops. eg:
Unable to handle kernel paging request for data at address 0x88888888888888b8 Faulting instruction address: 0xc00000000004e380 Oops: Kernel access of bad area, sig: 11 [#1] ... NIP .mpic_set_affinity+0x60/0x1a0 LR .irq_do_set_affinity+0x48/0x100
Fix it by checking the CPU is possible, this also fixes the code if there are gaps in the CPU numbering which probably never happens on mpic systems but who knows.
--- arch/powerpc/sysdev/mpic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/sysdev/mpic.c +1 -1
@@ -626,7 +626,7 @@ static inline u32 mpic_physmask(u32 cpumint i;u32 mask =0 ; -for (i =0 ; i <min (32 ,NR_CPUS ); ++i, cpumask >>=1 ) +for (i =0 ; i <min (32 ,NR_CPUS ) &&cpu_possible (i); ++i, cpumask >>=1 ) mask |= (cpumask &1 ) <<get_hard_smp_processor_id (i);return mask; }
Greg Kroah-Hartman
maintainerPATCH 258/329 m68k: set dma and coherent masks for platform FEC ethernets
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Ungerer <[email protected]>
[ Upstream commit f61e64310b75733d782e930d1fb404b84699eed6 ]
As of commit 205e1b7f51e4 ("dma-mapping: warn when there is no coherent_dma_mask") the Freescale FEC driver is issuing the following warning on driver initialization on ColdFire systems:
WARNING: CPU: 0 PID: 1 at ./include/linux/dma-mapping.h:516 0x40159e20
Modules linked in:
CPU: 0 PID: 1 Comm: swapper Not tainted 4.16.0-rc7-dirty #4
Stack from 41833dd8:
41833dd8 40259c53 40025534 40279e26 00000003 00000000 4004e514 41827000
400255de 40244e42 00000204 40159e20 00000009 00000000 00000000 4024531d
40159e20 40244e42 00000204 00000000 00000000 00000000 00000007 00000000
00000000 40279e26 4028d040 40226576 4003ae88 40279e26 418273f6 41833ef8
7fffffff 418273f2 41867028 4003c9a2 4180ac6c 00000004 41833f8c 4013e71c
40279e1c 40279e26 40226c16 4013ced2 40279e26 40279e58 4028d040 00000000
Call Trace:
[<40025534>] 0x40025534
[<4004e514>] 0x4004e514
[<400255de>] 0x400255de
[<40159e20>] 0x40159e20
[<40159e20>] 0x40159e20It is not fatal, the driver and the system continue to function normally.
As per the warning the coherent_dma_mask is not set on this device. There is nothing special about the DMA memory coherency on this hardware so we can just set the mask to 32bits in the platform data for the FEC ethernet devices.
--- arch/m68k/coldfire/device.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
arch/m68k/coldfire/device.c +10 -2
@@ -135,7 +135,11 @@ static struct platform_device mcf_fec0 = .id = 0, .num_resources = ARRAY_SIZE(mcf_fec0_resources), .resource = mcf_fec0_resources, - .dev.platform_data = FEC_PDATA, + .dev = { + .dma_mask = &mcf_fec0.dev.coherent_dma_mask, + .coherent_dma_mask = DMA_BIT_MASK(32), + .platform_data = FEC_PDATA, + } };#ifdef MCFFEC_BASE1
@@ -167,7 +171,11 @@ static struct platform_device mcf_fec1 = .id = 1, .num_resources = ARRAY_SIZE(mcf_fec1_resources), .resource = mcf_fec1_resources, - .dev.platform_data = FEC_PDATA, + .dev = { + .dma_mask = &mcf_fec1.dev.coherent_dma_mask, + .coherent_dma_mask = DMA_BIT_MASK(32), + .platform_data = FEC_PDATA, + } };#endif /* MCFFEC_BASE1 */ #endif /* CONFIG_FEC */
Greg Kroah-Hartman
maintainerPATCH 259/329 parisc/pci: Switch LBA PCI bus from Hard Fail to Soft Fail mode
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <[email protected]>
[ Upstream commit b845f66f78bf42a4ce98e5cfe0e94fab41dd0742 ]
Carlo Pisani noticed that his C3600 workstation behaved unstable during heavy I/O on the PCI bus with a VIA VT6421 IDE/SATA PCI card.
To avoid such instability, this patch switches the LBA PCI bus from Hard Fail mode into Soft Fail mode. In this mode the bus will return -1UL for timed out MMIO transactions, which is exactly how the x86 (and most other architectures) PCI busses behave.
This patch is based on a proposal by Grant Grundler and Kyle McMartin 10 years ago:
https://www.spinics.net/lists/linux-parisc/msg01027.html
--- drivers/parisc/lba_pci.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
drivers/parisc/lba_pci.c +19 -1
@@ -1367,9 +1367,27 @@ lba_hw_init(struct lba_device *d)WRITE_REG32 (stat, d->hba.base_addr +LBA_ERROR_CONFIG ); } -/* Set HF mode as the default (vs. -1 mode). */ + +/* +* Hard Fail vs. Soft Fail on PCI "Master Abort". +* +* "Master Abort" means the MMIO transaction timed out - usually due to +* the device not responding to an MMIO read. We would like HF to be +* enabled to find driver problems, though it means the system will +* crash with a HPMC. +* +* In SoftFail mode "~0L" is returned as a result of a timeout on the +* pci bus. This is like how PCI busses on x86 and most other +* architectures behave. In order to increase compatibility with +* existing (x86) PCI hardware and existing Linux drivers we enable +* Soft Faul mode on PA-RISC now too. +*/ stat =READ_REG32 (d->hba.base_addr +LBA_STAT_CTL ); +#if defined(ENABLE_HARDFAIL )WRITE_REG32 (stat |HF_ENABLE , d->hba.base_addr +LBA_STAT_CTL ); +#else +WRITE_REG32 (stat & ~HF_ENABLE , d->hba.base_addr +LBA_STAT_CTL ); +#endif /* ** Writing a zero to STAT_CTL.rf (bit 0) will clear reset signal
Greg Kroah-Hartman
maintainerPATCH 260/329 hwmon: (nct6775) Fix writing pwmX_mode
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
[ Upstream commit 415eb2a1aaa4881cf85bd86c683356fdd8094a23 ]
pwmX_mode is defined in the ABI as 0=DC mode, 1=pwm mode. The chip register bit is set to 1 for DC mode. This got mixed up, and writing 1 into pwmX_mode resulted in DC mode enabled. Fix it up by using the ABI definition throughout the driver for consistency.
--- drivers/hwmon/nct6775.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/hwmon/nct6775.c +5 -5
@@ -1393,7 +1393,7 @@ static void nct6775_update_pwm(struct de duty_is_dc = data->REG_PWM_MODE[i] && (nct6775_read_value (data, data->REG_PWM_MODE[i]) & data->PWM_MODE_MASK[i]); - data->pwm_mode[i] = duty_is_dc; + data->pwm_mode[i] = !duty_is_dc; fanmodecfg =nct6775_read_value (data, data->REG_FAN_MODE[i]);for (j =0 ; j <ARRAY_SIZE (data->REG_PWM); j++) {
@@ -2270,7 +2270,7 @@ show_pwm_mode(struct device *dev, structstruct nct6775_data *data =nct6775_update_device (dev);struct sensor_device_attribute *sattr =to_sensor_dev_attr (attr); -return sprintf (buf,"%d\n" , !data->pwm_mode[sattr->index]); +return sprintf (buf,"%d\n" , data->pwm_mode[sattr->index]); } static ssize_t
@@ -2291,9 +2291,9 @@ store_pwm_mode(struct device *dev, strucif (val >1 )return -EINVAL ; -/* Setting DC mode is not supported for all chips/channels */ +/* Setting DC mode (0) is not supported for all chips/channels */ if (data->REG_PWM_MODE[nr] ==0 ) { -if (val) +if (!val)return -EINVAL ;return count; }
@@ -2302,7 +2302,7 @@ store_pwm_mode(struct device *dev, struc data->pwm_mode[nr] = val; reg =nct6775_read_value (data, data->REG_PWM_MODE[nr]); reg &= ~data->PWM_MODE_MASK[nr]; -if (val) +if (!val) reg |= data->PWM_MODE_MASK[nr];nct6775_write_value (data, data->REG_PWM_MODE[nr], reg);mutex_unlock (&data->update_lock);
Greg Kroah-Hartman
maintainerPATCH 261/329 powerpc/perf: Prevent kernel address leak to userspace via BHRB buffer
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Madhavan Srinivasan <[email protected]>
[ Upstream commit bb19af816025d495376bd76bf6fbcf4244f9a06d ]
The current Branch History Rolling Buffer (BHRB) code does not check for any privilege levels before updating the data from BHRB. This could leak kernel addresses to userspace even when profiling only with userspace privileges. Add proper checks to prevent it.
--- arch/powerpc/perf/core-book3s.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/powerpc/perf/core-book3s.c +10 -0
@@ -448,6 +448,16 @@ static void power_pmu_bhrb_read(struct c/* invalid entry */ continue ; +/* +* BHRB rolling buffer could very much contain the kernel +* addresses at this point. Check the privileges before +* exporting it to userspace (avoid exposure of regions +* where we could have speculative execution) +*/ +if (perf_paranoid_kernel () && !capable (CAP_SYS_ADMIN ) && +is_kernel_addr (addr)) +continue ; +/* Branches are read most recent first (ie. mfbhrb 0 is * the most recent branch). * There are two types of valid entries:
Greg Kroah-Hartman
maintainerPATCH 262/329 powerpc/perf: Fix kernel address leak via sampling registers
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
[ Upstream commit e1ebd0e5b9d0a10ba65e63a3514b6da8c6a5a819 ]
Current code in power_pmu_disable() does not clear the sampling registers like Sampling Instruction Address Register (SIAR) and Sampling Data Address Register (SDAR) after disabling the PMU. Since these are userspace readable and could contain kernel addresses, add code to explicitly clear the content of these registers.
Also add a "context synchronizing instruction" to enforce no further updates to these registers as suggested by Power ISA v3.0B. From section 9.4, on page 1108:
"If an mtspr instruction is executed that changes the value of a Performance Monitor register other than SIAR, SDAR, and SIER, the change is not guaranteed to have taken effect until after a subsequent context synchronizing instruction has been executed (see Chapter 11. "Synchronization Requirements for Context Alterations" on page 1133)."
--- arch/powerpc/perf/core-book3s.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
arch/powerpc/perf/core-book3s.c +15 -0
@@ -1198,6 +1198,7 @@ static void power_pmu_disable(struct pmu*/ write_mmcr0 (cpuhw, val);mb (); +isync ();/* * Disable instruction sampling if it was enabled
@@ -1206,12 +1207,26 @@ static void power_pmu_disable(struct pmumtspr (SPRN_MMCRA , cpuhw->mmcr[2 ] & ~MMCRA_SAMPLE_ENABLE );mb (); +isync (); } cpuhw->disabled =1 ; cpuhw->n_added =0 ;ebb_switch_out (mmcr0); + +#ifdef CONFIG_PPC64 +/* +* These are readable by userspace, may contain kernel +* addresses and are not switched by context switch, so clear +* them now to avoid leaking anything to userspace in general +* including to another process. +*/ +if (ppmu->flags &PPMU_ARCH_207S ) { +mtspr (SPRN_SDAR ,0 ); +mtspr (SPRN_SIAR ,0 ); + } +#endif }local_irq_restore (flags);
Greg Kroah-Hartman
maintainerPATCH 263/329 tools/thermal: tmon: fix for segfault
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank Asseg <[email protected]>
[ Upstream commit 6c59f64b7ecf2bccbe73931d7d573d66ed13b537 ]
Fixes a segfault occurring when e.g. <TAB> is pressed multiple times in the ncurses tmon application. The segfault is caused by incrementing cur_thermal_record in the main function without checking if it's value reached NR_THERMAL_RECORD immediately. Since the boundary check only occurred in update_thermal_data a race condition existed, which lead to an attempted read beyond the last element of the trec array.
The fix was implemented by moving the cur_thermal_record incrementation to the update_thermal_data function using a temporary variable on which the boundary condition is checked before updating cur_thread_record, so that the variable is never incremented beyond the trec array's boundary.
It seems the segfault does not occur on every machine: On a HP EliteBook G4 the segfault happens, while it does not happen on a Thinkpad T540p.
--- tools/thermal/tmon/sysfs.c | 12 +++++++----- tools/thermal/tmon/tmon.c | 1 - 2 files changed, 7 insertions(+), 6 deletions(-)
tools/thermal/tmon/sysfs.c +7 -5
@@ -486,6 +486,7 @@ int zone_instance_to_index(int zone_instint update_thermal_data () {int i; +int next_thermal_record = cur_thermal_record +1 ;char tz_name[256 ];static unsigned long samples;
@@ -495,9 +496,9 @@ int update_thermal_data() }/* circular buffer for keeping historic data */ -if (cur_thermal_record >=NR_THERMAL_RECORDS ) - cur_thermal_record =0 ; -gettimeofday (&trec[cur_thermal_record].tv,NULL ); +if (next_thermal_record >=NR_THERMAL_RECORDS ) + next_thermal_record =0 ; +gettimeofday (&trec[next_thermal_record].tv,NULL );if (tmon_log) {fprintf (tmon_log,"%lu " , ++samples);fprintf (tmon_log,"%3.1f " , p_param.t_target);
@@ -507,11 +508,12 @@ int update_thermal_data()snprintf (tz_name,256 ,"%s/%s%d" ,THERMAL_SYSFS ,TZONE , ptdata.tzi[i].instance);sysfs_get_ulong (tz_name,"temp" , - &trec[cur_thermal_record].temp[i]); + &trec[next_thermal_record].temp[i]);if (tmon_log)fprintf (tmon_log,"%lu " , - trec[cur_thermal_record].temp[i]/1000 ); + trec[next_thermal_record].temp[i] /1000 ); } + cur_thermal_record = next_thermal_record;for (i =0 ; i < ptdata.nr_cooling_dev; i++) {char cdev_name[256 ];unsigned long val;
tools/thermal/tmon/tmon.c +0 -1
@@ -336,7 +336,6 @@ int main(int argc, char **argv)show_data_w ();show_cooling_device (); } - cur_thermal_record++; time_elapsed += ticktime;controller_handler (trec[0 ].temp[target_tz_index] /1000 , &yk);
Greg Kroah-Hartman
maintainerPATCH 264/329 selftests: Print the test were running to /dev/kmsg
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
[ Upstream commit 88893cf787d3062c631cc20b875068eb11756e03 ]
Some tests cause the kernel to print things to the kernel log buffer (ie. printk), in particular oops and warnings etc. However when running all the tests in succession it's not always obvious which test(s) caused the kernel to print something.
We can narrow it down by printing which test directory we're running in to /dev/kmsg, if it's writable.
Example output:
[ 170.149149] kselftest: Running tests in powerpc
[ 305.300132] kworker/dying (71) used greatest stack depth: 7776 bytes
left
[ 808.915456] kselftest: Running tests in pstore--- tools/testing/selftests/Makefile | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/Makefile +1 -0
@@ -94,6 +94,7 @@ ifdef INSTALL_PATH for TARGET in $(TARGETS); do \ echo "echo ; echo Running tests in $$TARGET" >> $(ALL_SCRIPT); \ echo "echo ========================================" >> $(ALL_SCRIPT); \ + echo "[ -w /dev/kmsg ] && echo \"kselftest: Running tests in $$TARGET\" >> /dev/kmsg" >> $(ALL_SCRIPT); \ echo "cd $$TARGET" >> $(ALL_SCRIPT); \ make -s --no-print-directory -C $$TARGET emit_tests >> $(ALL_SCRIPT); \ echo "cd \$$ROOT" >> $(ALL_SCRIPT); \
Greg Kroah-Hartman
maintainerPATCH 265/329 net/mlx5: Protect from command bit overflow
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leon Romanovsky <[email protected]>
[ Upstream commit 957f6ba8adc7be401a74ccff427e4cfd88d3bfcb ]
The system with CONFIG_UBSAN enabled on produces the following error during driver initialization. The reason to it that max_reg_cmds can be larger enough to cause to "1 << max_reg_cmds" overflow the unsigned long.
================================================================================
UBSAN: Undefined behaviour in drivers/net/ethernet/mellanox/mlx5/core/cmd.c:1805:42 signed integer overflow: -2147483648 - 1 cannot be represented in type 'int' CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.15.0-rc2-00032-g06cda2358d9b-dirty #724 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.7.5-0-ge51488c-20140602_164612-nilsson.home.kraxel.org 04/01/2014 Call Trace: dump_stack+0xe9/0x18f ? dma_virt_alloc+0x81/0x81 ubsan_epilogue+0xe/0x4e handle_overflow+0x187/0x20c mlx5_cmd_init+0x73a/0x12b0 mlx5_load_one+0x1c3d/0x1d30 init_one+0xd02/0xf10 pci_device_probe+0x26c/0x3b0 driver_probe_device+0x622/0xb40 __driver_attach+0x175/0x1b0 bus_for_each_dev+0xef/0x190 bus_add_driver+0x2db/0x490 driver_register+0x16b/0x1e0 __pci_register_driver+0x177/0x1b0 init+0x6d/0x92 do_one_initcall+0x15b/0x270 kernel_init_freeable+0x2d8/0x3d0 kernel_init+0x14/0x190 ret_from_fork+0x24/0x30 ================================================================================
--- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/cmd.c +1 -1
@@ -1765,7 +1765,7 @@ int mlx5_cmd_init(struct mlx5_core_dev * cmd->checksum_disabled =1 ; cmd->max_reg_cmds = (1 << cmd->log_sz) -1 ; - cmd->bitmask = (1 << cmd->max_reg_cmds) -1 ; + cmd->bitmask = (1UL << cmd->max_reg_cmds) -1 ; cmd->cmdif_rev =ioread32be (&dev->iseg->cmdif_rev_fw_sub) >>16 ;if (cmd->cmdif_rev >CMD_IF_REV ) {
Greg Kroah-Hartman
maintainerPATCH 266/329 ath10k: Fix kernel panic while using worker (ath10k_sta_rc_update_wk)
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karthikeyan Periyasamy <[email protected]>
[ Upstream commit 8b2d93dd22615cb7f3046a5a2083a6f8bb8052ed ]
When attempt to run worker (ath10k_sta_rc_update_wk) after the station object (ieee80211_sta) delete will trigger the kernel panic.
This problem arise in AP + Mesh configuration, Where the current node AP VAP and neighbor node mesh VAP MAC address are same. When the current mesh node try to establish the mesh link with neighbor node, driver peer creation for the neighbor mesh node fails due to duplication MAC address. Already the AP VAP created with same MAC address.
It is caused by the following scenario steps.
Steps:
1. In above condition, ath10k driver sta_state callback (ath10k_sta_state) fails to do the state change for a station from IEEE80211_STA_NOTEXIST to IEEE80211_STA_NONE due to peer creation fails. Sta_state callback is called from ieee80211_add_station() to handle the new station (neighbor mesh node) request from the wpa_supplicant.
2. Concurrently ath10k receive the sta_rc_update callback notification from the mesh_neighbour_update() to handle the beacon frames of the above neighbor mesh node. since its atomic callback, ath10k driver queue the work (ath10k_sta_rc_update_wk) to handle rc update.
3. Due to driver sta_state callback fails (step 1), mac80211 free the station object.
4. When the worker (ath10k_sta_rc_update_wk) scheduled to run, it will access the station object which is already deleted. so it will trigger kernel panic.
Added the peer exist check in sta_rc_update callback before queue the work.
Kernel Panic log:
Unable to handle kernel NULL pointer dereference at virtual address 00000000 pgd = c0204000 [00000000] *pgd=00000000 Internal error: Oops: 17 [#1] PREEMPT SMP ARM CPU: 1 PID: 1833 Comm: kworker/u4:2 Not tainted 3.14.77 #1 task: dcef0000 ti: d72b6000 task.ti: d72b6000 PC is at pwq_activate_delayed_work+0x10/0x40 LR is at pwq_activate_delayed_work+0xc/0x40 pc : [<c023f988>] lr : [<c023f984>] psr: 40000193
sp : d72b7f18 ip : 0000007a fp : d72b6000
r10: 00000000 r9 : dd404414 r8 : d8c31998
r7 : d72b6038 r6 : 00000004 r5 : d4907ec8 r4 : dcee1300 r3 : ffffffe0 r2 : 00000000 r1 : 00000001 r0 : 00000000
Flags: nZcv IRQs off FIQs on Mode SVC_32 ISA ARM Segment kernel
Control: 10c5787d Table: 595bc06a DAC: 00000015
...
Process kworker/u4:2 (pid: 1833, stack limit = 0xd72b6238)
Stack: (0xd72b7f18 to 0xd72b8000)
7f00: 00000001 dcee1300
7f20: 00000001 c02410dc d8c31980 dd404400 dd404400 c0242790 d8c31980 00000089 7f40: 00000000 d93e1340 00000000 d8c31980 c0242568 00000000 00000000 00000000 7f60: 00000000 c02474dc 00000000 00000000 000000f8 d8c31980 00000000 00000000 7f80: d72b7f80 d72b7f80 00000000 00000000 d72b7f90 d72b7f90 d72b7fac d93e1340 7fa0: c0247404 00000000 00000000 c0208d20 00000000 00000000 00000000 00000000 7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 7fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000 [<c023f988>] (pwq_activate_delayed_work) from [<c02410dc>] (pwq_dec_nr_in_flight+0x58/0xc4) [<c02410dc>] (pwq_dec_nr_in_flight) from [<c0242790>] (worker_thread+0x228/0x360) [<c0242790>] (worker_thread) from [<c02474dc>] (kthread+0xd8/0xec) [<c02474dc>] (kthread) from [<c0208d20>] (ret_from_fork+0x14/0x34)
Code: e92d4038 e1a05000 ebffffbc[69210.619376] SMP: failed to stop secondary CPUs
Rebooting in 3 seconds..
--- drivers/net/wireless/ath/ath10k/mac.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/net/wireless/ath/ath10k/mac.c +10 -0
@@ -6928,10 +6928,20 @@ static void ath10k_sta_rc_update(struct {struct ath10k *ar = hw->priv;struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; +struct ath10k_vif *arvif = (void *)vif->drv_priv; +struct ath10k_peer *peer;u32 bw, smps;spin_lock_bh (&ar->data_lock); + peer =ath10k_peer_find (ar, arvif->vdev_id, sta->addr); +if (!peer) { +spin_unlock_bh (&ar->data_lock); +ath10k_warn (ar,"mac sta rc update failed to find peer %pM on vdev %i\n" , + sta->addr, arvif->vdev_id); +return ; + } + ath10k_dbg(ar, ATH10K_DBG_MAC, "mac sta rc update for %pM changed %08x bw %d nss %d smps %d\n", sta->addr, changed, sta->bandwidth, sta->rx_nss,
Greg Kroah-Hartman
maintainerPATCH 267/329 cxgb4: Setup FW queues before registering netdev
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arjun Vynipadath <[email protected]>
[ Upstream commit 843bd7db79c861b49e2912d723625f5fa8e94502 ]
When NetworkManager is enabled, there are chances that interface up is called even before probe completes. This means we have not yet allocated the FW sge queues, hence rest of ingress queue allocation wont be proper. Fix this by calling setup_fw_sge_queues() before register_netdev().
--- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +8 -3
@@ -836,8 +836,6 @@ static int setup_fw_sge_queues(struct ad err =t4_sge_alloc_rxq (adap, &s->fw_evtq, true, adap->port[0 ], adap->msi_idx,NULL , fwevtq_handler,NULL ,-1 ); -if (err) -t4_free_sge_resources (adap);return err; }
@@ -4940,6 +4938,13 @@ static int init_one(struct pci_dev *pdevif (err) goto out_free_dev; + err =setup_fw_sge_queues (adapter); +if (err) { +dev_err (adapter->pdev_dev, +"FW sge queue allocation failed, err %d" , err); + goto out_free_dev; + } +/* * The card is now ready to go. If any errors occur during device * registration we do not fail the whole card but rather proceed only
@@ -4983,7 +4988,6 @@ static int init_one(struct pci_dev *pdev }print_adapter_info (adapter); -setup_fw_sge_queues (adapter);return 0 ; sriov:
@@ -5035,6 +5039,7 @@ sriov:#endif out_free_dev: +t4_free_sge_resources (adapter);free_some_resources (adapter);if (adapter->flags &USING_MSIX )free_msix_info (adapter);
Greg Kroah-Hartman
maintainerPATCH 268/329 ima: Fallback to the builtin hash algorithm
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Petr Vorel <[email protected]>
[ Upstream commit ab60368ab6a452466885ef4edf0cefd089465132 ]
IMA requires having it's hash algorithm be compiled-in due to it's early use. The default IMA algorithm is protected by Kconfig to be compiled-in.
The ima_hash kernel parameter allows to choose the hash algorithm. When the specified algorithm is not available or available as a module, IMA initialization fails, which leads to a kernel panic (mknodat syscall calls ima_post_path_mknod()). Therefore as fallback we force IMA to use the default builtin Kconfig hash algorithm.
Fixed crash:
$ grep CONFIG_CRYPTO_MD4 .config CONFIG_CRYPTO_MD4=m
[ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-4.12.14-2.3-default root=UUID=74ae8202-9ca7-4e39-813b-22287ec52f7a video=1024x768-16 plymouth.ignore-serial-consoles console=ttyS0 console=tty resume=/dev/disk/by-path/pci-0000:00:07.0-part3 splash=silent showopts ima_hash=md4 ... [ 1.545190] ima: Can not allocate md4 (reason: -2) ... [ 2.610120] BUG: unable to handle kernel NULL pointer dereference at (null) [ 2.611903] IP: ima_match_policy+0x23/0x390 [ 2.612967] PGD 0 P4D 0 [ 2.613080] Oops: 0000 [#1] SMP [ 2.613080] Modules linked in: autofs4 [ 2.613080] Supported: Yes [ 2.613080] CPU: 0 PID: 1 Comm: systemd Not tainted 4.12.14-2.3-default #1 [ 2.613080] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.0.0-prebuilt.qemu-project.org 04/01/2014 [ 2.613080] task: ffff88003e2d0040 task.stack: ffffc90000190000 [ 2.613080] RIP: 0010:ima_match_policy+0x23/0x390 [ 2.613080] RSP: 0018:ffffc90000193e88 EFLAGS: 00010296 [ 2.613080] RAX: 0000000000000000 RBX: 000000000000000c RCX: 0000000000000004 [ 2.613080] RDX: 0000000000000010 RSI: 0000000000000001 RDI: ffff880037071728 [ 2.613080] RBP: 0000000000008000 R08: 0000000000000000 R09: 0000000000000000 [ 2.613080] R10: 0000000000000008 R11: 61c8864680b583eb R12: 00005580ff10086f [ 2.613080] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000008000 [ 2.613080] FS: 00007f5c1da08940(0000) GS:ffff88003fc00000(0000) knlGS:0000000000000000 [ 2.613080] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 2.613080] CR2: 0000000000000000 CR3: 0000000037002000 CR4: 00000000003406f0 [ 2.613080] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 2.613080] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 2.613080] Call Trace: [ 2.613080] ? shmem_mknod+0xbf/0xd0 [ 2.613080] ima_post_path_mknod+0x1c/0x40 [ 2.613080] SyS_mknod+0x210/0x220 [ 2.613080] entry_SYSCALL_64_fastpath+0x1a/0xa5 [ 2.613080] RIP: 0033:0x7f5c1bfde570 [ 2.613080] RSP: 002b:00007ffde1c90dc8 EFLAGS: 00000246 ORIG_RAX: 0000000000000085 [ 2.613080] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f5c1bfde570 [ 2.613080] RDX: 0000000000000000 RSI: 0000000000008000 RDI: 00005580ff10086f [ 2.613080] RBP: 00007ffde1c91040 R08: 00005580ff10086f R09: 0000000000000000 [ 2.613080] R10: 0000000000104000 R11: 0000000000000246 R12: 00005580ffb99660 [ 2.613080] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000002 [ 2.613080] Code: 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 41 57 41 56 44 8d 14 09 41 55 41 54 55 53 44 89 d3 09 cb 48 83 ec 38 48 8b 05 c5 03 29 01 <4c> 8b 20 4c 39 e0 0f 84 d7 01 00 00 4c 89 44 24 08 89 54 24 20 [ 2.613080] RIP: ima_match_policy+0x23/0x390 RSP: ffffc90000193e88 [ 2.613080] CR2: 0000000000000000 [ 2.613080] ---[ end trace 9a9f0a8a73079f6a ]--- [ 2.673052] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009 [ 2.673052] [ 2.675337] Kernel Offset: disabled [ 2.676405] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009
--- security/integrity/ima/ima_crypto.c | 2 ++ security/integrity/ima/ima_main.c | 13 +++++++++++++ 2 files changed, 15 insertions(+)
security/integrity/ima/ima_crypto.c +2 -0
@@ -78,6 +78,8 @@ int __init ima_init_crypto(void) hash_algo_name[ima_hash_algo], rc);return rc; } +pr_info ("Allocated hash algorithm: %s\n" , + hash_algo_name[ima_hash_algo]);return 0 ; }
security/integrity/ima/ima_main.c +13 -0
@@ -16,6 +16,9 @@* implements the IMA hooks: ima_bprm_check, ima_file_mmap, * and ima_file_check. */ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/module.h> #include <linux/file.h> #include <linux/binfmts.h>
@@ -426,6 +429,16 @@ static int __init init_ima(void)hash_setup (CONFIG_IMA_DEFAULT_HASH ); error =ima_init (); + +if (error &&strcmp (hash_algo_name[ima_hash_algo], +CONFIG_IMA_DEFAULT_HASH ) !=0 ) { +pr_info ("Allocating %s failed, going to use default hash algorithm %s\n" , + hash_algo_name[ima_hash_algo],CONFIG_IMA_DEFAULT_HASH ); + hash_setup_done =0 ; +hash_setup (CONFIG_IMA_DEFAULT_HASH ); + error =ima_init (); + } +if (!error) { ima_initialized =1 ;ima_update_policy_flag ();
Greg Kroah-Hartman
maintainerPATCH 269/329 virtio-net: Fix operstate for virtio when no VIRTIO_NET_F_STATUS
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jay Vosburgh <[email protected]>
[ Upstream commit bda7fab54828bbef2164bb23c0f6b1a7d05cc718 ]
The operstate update logic will leave an interface in the default UNKNOWN operstate if the interface carrier state never changes from the default carrier up state set at creation. This includes the case of an explicit call to netif_carrier_on, as the carrier on to on transition has no effect on operstate.
This affects virtio-net for the case that the virtio peer does
not support VIRTIO_NET_F_STATUS (the feature that provides carrier state updates). Without this feature, the virtio specification states that "the link should be assumed active," so, logically, the operstate should be UP instead of UNKNOWN. This has impact on user space applications that use the operstate to make availability decisions for the interface.
Resolve this by changing the virtio probe logic slightly to callnetif_carrier_off for both the "with" and "without" VIRTIO_NET_F_STATUS cases, and then the existing call to netif_carrier_on for the "without" case will cause an operstate transition.
--- drivers/net/virtio_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/virtio_net.c +1 -1
@@ -1949,8 +1949,8 @@ static int virtnet_probe(struct virtio_d/* Assume link up if device can't report link status, otherwise get link status from config. */ +netif_carrier_off (dev);if (virtio_has_feature (vi->vdev,VIRTIO_NET_F_STATUS )) { -netif_carrier_off (dev);schedule_work (&vi->config_work); }else { vi->status =VIRTIO_NET_S_LINK_UP ;
Greg Kroah-Hartman
maintainerPATCH 270/329 arm: dts: socfpga: fix GIC PPI warning
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Philipp Puschmann <[email protected]>
[ Upstream commit 6d97d5aba08b26108f95dc9fb7bbe4d9436c769c ]
Fixes the warning "GIC: PPI13 is secure or misconfigured" by changing the interrupt type from level_low to edge_raising
--- arch/arm/boot/dts/socfpga.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/socfpga.dtsi +1 -1
@@ -759,7 +759,7 @@ timer@fffec600 { compatible = "arm,cortex-a9-twd-timer"; reg = <0xfffec600 0x100>; - interrupts = <1 13 0xf04>; + interrupts = <1 13 0xf01>; clocks = <&mpu_periph_clk>; };
Greg Kroah-Hartman
maintainerPATCH 271/329 cpufreq: cppc_cpufreq: Fix cppc_cpufreq_init() failure path
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chunyu Hu <[email protected]>
[ Upstream commit 55b55abc17f238c61921360e61dde90dd9a326d1 ]
Kmemleak reported the below leak. When cppc_cpufreq_init went into failure path, the cpu mask is not freed. After fix, this report is gone. And to avaoid potential NULL pointer reference, check the cpu value first.
unreferenced object 0xffff800fd5ea4880 (size 128):
comm "swapper/0", pid 1, jiffies 4294939510 (age 668.680s) hex dump (first 32 bytes):
00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 .... ...........
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<ffff0000082c4ae4>] __kmalloc_node+0x278/0x634
[<ffff0000088f4a74>] alloc_cpumask_var_node+0x28/0x60
[<ffff0000088f4af0>] zalloc_cpumask_var+0x14/0x1c
[<ffff000008d20254>] cppc_cpufreq_init+0xd0/0x19c
[<ffff000008083828>] do_one_initcall+0xec/0x15c
[<ffff000008cd1018>] kernel_init_freeable+0x1f4/0x2a4
[<ffff0000089099b0>] kernel_init+0x18/0x10c
[<ffff000008084d50>] ret_from_fork+0x10/0x18
[<ffffffffffffffff>] 0xffffffffffffffff--- drivers/cpufreq/cppc_cpufreq.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/cpufreq/cppc_cpufreq.c +7 -2
@@ -228,8 +228,13 @@ static int __init cppc_cpufreq_init(voidreturn ret; out: -for_each_possible_cpu (i) -kfree (all_cpu_data[i]); +for_each_possible_cpu (i) { + cpu = all_cpu_data[i]; +if (!cpu) +break ; +free_cpumask_var (cpu->shared_cpu_map); +kfree (cpu); + }kfree (all_cpu_data);return -ENODEV ;
Greg Kroah-Hartman
maintainerPATCH 272/329 zorro: Set up z->dev.dma_mask for the DMA API
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Schmitz <[email protected]>
[ Upstream commit 55496d3fe2acd1a365c43cbd613a20ecd4d74395 ]
The generic DMA API uses dev->dma_mask to check the DMA addressable memory bitmask, and warns if no mask is set or even allocated.
Set z->dev.dma_coherent_mask on Zorro bus scan, and make z->dev.dma_mask to point to z->dev.dma_coherent_mask so device drivers that need DMA have everything set up to avoid warnings from dma_alloc_coherent(). Drivers can still use dma_set_mask_and_coherent() to explicitly set their DMA bit mask.
--- drivers/zorro/zorro.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/zorro/zorro.c +12 -0
@@ -16,6 +16,7 @@#include <linux/bitops.h> #include <linux/string.h> #include <linux/platform_device.h> +#include <linux/dma-mapping.h> #include <linux/slab.h> #include <asm/byteorder.h>
@@ -185,6 +186,17 @@ static int __init amiga_zorro_probe(stru z->dev.parent = &bus->dev; z->dev.bus = &zorro_bus_type; z->dev.id = i; +switch (z->rom.er_Type &ERT_TYPEMASK ) { +case ERT_ZORROIII : + z->dev.coherent_dma_mask =DMA_BIT_MASK (32 ); +break ; + +case ERT_ZORROII : +default : + z->dev.coherent_dma_mask =DMA_BIT_MASK (24 ); +break ; + } + z->dev.dma_mask = &z->dev.coherent_dma_mask; }/* ... then register them */
Greg Kroah-Hartman
maintainerPATCH 273/329 bcache: quit dc->writeback_thread when BCACHE_DEV_DETACHING is set
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Coly Li <[email protected]>
[ Upstream commit fadd94e05c02afec7b70b0b14915624f1782f578 ]
In patch "bcache: fix cached_dev->count usage for bch_cache_set_error()", cached_dev_get() is called when creating dc->writeback_thread, and cached_dev_put() is called when exiting dc->writeback_thread. This modification works well unless people detach the bcache device manually by
'echo 1 > /sys/block/bcache<N>/bcache/detach'
Because this sysfs interface only calls bch_cached_dev_detach() which wakes up dc->writeback_thread but does not stop it. The reason is, before patch "bcache: fix cached_dev->count usage for bch_cache_set_error()", inside bch_writeback_thread(), if cache is not dirty after writeback, cached_dev_put() will be called here. And in cached_dev_make_request() when a new write request makes cache from clean to dirty, cached_dev_get() will be called there. Since we don't operate dc->count in these locations, refcount d->count cannot be dropped after cache becomes clean, and cached_dev_detach_finish() won't be called to detach bcache device.
This patch fixes the issue by checking whether BCACHE_DEV_DETACHING is set inside bch_writeback_thread(). If this bit is set and cache is clean (no existing writeback_keys), break the while-loop, call cached_dev_put() and quit the writeback thread.
Please note if cache is still dirty, even BCACHE_DEV_DETACHING is set the writeback thread should continue to perform writeback, this is the original design of manually detach.
It is safe to do the following check without locking, let me explain why,
+ if (!test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags) &&
+ (!atomic_read(&dc->has_dirty) || !dc->writeback_running)) {
If the kenrel thread does not sleep and continue to run due to conditions are not updated in time on the running CPU core, it just consumes more CPU cycles and has no hurt. This should-sleep-but-run is safe here. We just focus on the should-run-but-sleep condition, which means the writeback thread goes to sleep in mistake while it should continue to run. 1, First of all, no matter the writeback thread is hung or not,
kthread_stop() from cached_dev_detach_finish() will wake up it and terminate by making kthread_should_stop() return true. And in normal run time, bit on index BCACHE_DEV_DETACHING is always cleared, the condition
!test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags)
is always true and can be ignored as constant value.
2, If one of the following conditions is true, the writeback thread should
go to sleep,
"!atomic_read(&dc->has_dirty)" or "!dc->writeback_running)" each of them independently controls the writeback thread should sleep or not, let's analyse them one by one.
2.1 condition "!atomic_read(&dc->has_dirty)"
If dc->has_dirty is set from 0 to 1 on another CPU core, bcache will call bch_writeback_queue() immediately or call bch_writeback_add() which indirectly calls bch_writeback_queue() too. In bch_writeback_queue(), wake_up_process(dc->writeback_thread) is called. It sets writeback thread's task state to TASK_RUNNING and following an implicit memory barrier, then tries to wake up the writeback thread.
In writeback thread, its task state is set to TASK_INTERRUPTIBLE before doing the condition check. If other CPU core sets the TASK_RUNNING state after writeback thread setting TASK_INTERRUPTIBLE, the writeback thread will be scheduled to run very soon because its state is not TASK_INTERRUPTIBLE. If other CPU core sets the TASK_RUNNING state before writeback thread setting TASK_INTERRUPTIBLE, the implict memory barrier of wake_up_process() will make sure modification of dc->has_dirty on other CPU core is updated and observed on the CPU core of writeback thread. Therefore the condition check will correctly be false, and continue writeback code without sleeping.
2.2 condition "!dc->writeback_running)"
dc->writeback_running can be changed via sysfs file, every time it is modified, a following bch_writeback_queue() is alwasy called. So the change is always observed on the CPU core of writeback thread. If dc->writeback_running is changed from 0 to 1 on other CPU core, this condition check will observe the modification and allow writeback thread to continue to run without sleeping.
Now we can see, even without a locking protection, multiple conditions check is safe here, no deadlock or process hang up will happen.
I compose a separte patch because that patch "bcache: fix cached_dev->count usage for bch_cache_set_error()" already gets a "Reviewed-by:" from Hannes Reinecke. Also this fix is not trivial and good for a separate patch.
--- drivers/md/bcache/writeback.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
drivers/md/bcache/writeback.c +17 -3
@@ -421,9 +421,15 @@ static int bch_writeback_thread(void *arwhile (!kthread_should_stop ()) {down_write (&dc->writeback_lock);set_current_state (TASK_INTERRUPTIBLE ); -if (!atomic_read (&dc->has_dirty) || - (!test_bit (BCACHE_DEV_DETACHING , &dc->disk.flags) && - !dc->writeback_running)) { +/* +* If the bache device is detaching, skip here and continue +* to perform writeback. Otherwise, if no dirty data on cache, +* or there is dirty data on cache but writeback is disabled, +* the writeback thread should sleep here and wait for others +* to wake up it. +*/ +if (!test_bit (BCACHE_DEV_DETACHING , &dc->disk.flags) && + (!atomic_read (&dc->has_dirty) || !dc->writeback_running)) {up_write (&dc->writeback_lock);if (kthread_should_stop ()) {
@@ -444,6 +450,14 @@ static int bch_writeback_thread(void *arcached_dev_put (dc);SET_BDEV_STATE (&dc->sb,BDEV_STATE_CLEAN );bch_write_bdev_super (dc,NULL ); +/* +* If bcache device is detaching via sysfs interface, +* writeback thread should stop after there is no dirty +* data on cache. BCACHE_DEV_DETACHING flag is set in +* bch_cached_dev_detach(). +*/ +if (test_bit (BCACHE_DEV_DETACHING , &dc->disk.flags)) +break ; }up_write (&dc->writeback_lock);
Greg Kroah-Hartman
maintainerPATCH 274/329 ACPICA: Events: add a return on failure from acpi_hw_register_read
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Erik Schmauss <[email protected]>
[ Upstream commit b4c0de312613ca676db5bd7e696a44b56795612a ]
This ensures that acpi_ev_fixed_event_detect() does not use fixed_status and and fixed_enable as uninitialized variables.
--- drivers/acpi/acpica/evevent.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/acpi/acpica/evevent.c +7 -2
@@ -204,6 +204,7 @@ u32 acpi_ev_fixed_event_detect(void)u32 fixed_status;u32 fixed_enable;u32 i; +acpi_status status;ACPI_FUNCTION_NAME (ev_fixed_event_detect);
@@ -211,8 +212,12 @@ u32 acpi_ev_fixed_event_detect(void)* Read the fixed feature status and enable registers, as all the cases * depend on their values. Ignore errors here. */ - (void )acpi_hw_register_read (ACPI_REGISTER_PM1_STATUS , &fixed_status); - (void )acpi_hw_register_read (ACPI_REGISTER_PM1_ENABLE , &fixed_enable); + status =acpi_hw_register_read (ACPI_REGISTER_PM1_STATUS , &fixed_status); + status |= +acpi_hw_register_read (ACPI_REGISTER_PM1_ENABLE , &fixed_enable); +if (ACPI_FAILURE (status)) { +return (int_status); + } ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS, "Fixed Event Block: Enable %08X Status %08X\n",
Greg Kroah-Hartman
maintainerPATCH 275/329 ACPICA: acpi: acpica: fix acpi operand cache leak in nseval.c
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Seunghun Han <[email protected]>
[ Upstream commit 97f3c0a4b0579b646b6b10ae5a3d59f0441cc12c ]
I found an ACPI cache leak in ACPI early termination and boot continuing case.
When early termination occurs due to malicious ACPI table, Linux kernel terminates ACPI function and continues to boot process. While kernel terminates ACPI function, kmem_cache_destroy() reports Acpi-Operand cache leak.
Boot log of ACPI operand cache leak is as follows:
Quoted 36 lines
[ 0.464168] ACPI: Added _OSI(Module Device) [ 0.467022] ACPI: Added _OSI(Processor Device) [ 0.469376] ACPI: Added _OSI(3.0 _SCP Extensions) [ 0.471647] ACPI: Added _OSI(Processor Aggregator Device) [ 0.477997] ACPI Error: Null stack entry at ffff880215c0aad8 (20170303/exresop-174) [ 0.482706] ACPI Exception: AE_AML_INTERNAL, While resolving operands for [opcode_name unavailable] (20170303/dswexec-461) [ 0.487503] ACPI Error: Method parse/execution failed [\DBG] (Node ffff88021710ab40), AE_AML_INTERNAL (20170303/psparse-543) [ 0.492136] ACPI Error: Method parse/execution failed [\_SB._INI] (Node ffff88021710a618), AE_AML_INTERNAL (20170303/psparse-543) [ 0.497683] ACPI: Interpreter enabled [ 0.499385] ACPI: (supports S0) [ 0.501151] ACPI: Using IOAPIC for interrupt routing [ 0.503342] ACPI Error: Null stack entry at ffff880215c0aad8 (20170303/exresop-174) [ 0.506522] ACPI Exception: AE_AML_INTERNAL, While resolving operands for [opcode_name unavailable] (20170303/dswexec-461) [ 0.510463] ACPI Error: Method parse/execution failed [\DBG] (Node ffff88021710ab40), AE_AML_INTERNAL (20170303/psparse-543) [ 0.514477] ACPI Error: Method parse/execution failed [\_PIC] (Node ffff88021710ab18), AE_AML_INTERNAL (20170303/psparse-543) [ 0.518867] ACPI Exception: AE_AML_INTERNAL, Evaluating _PIC (20170303/bus-991) [ 0.522384] kmem_cache_destroy Acpi-Operand: Slab cache still has objects [ 0.524597] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.12.0-rc5 #26 [ 0.526795] Hardware name: innotek gmb_h virtual_box/virtual_box, BIOS virtual_box 12/01/2006 [ 0.529668] Call Trace: [ 0.530811] ? dump_stack+0x5c/0x81 [ 0.532240] ? kmem_cache_destroy+0x1aa/0x1c0 [ 0.533905] ? acpi_os_delete_cache+0xa/0x10 [ 0.535497] ? acpi_ut_delete_caches+0x3f/0x7b [ 0.537237] ? acpi_terminate+0xa/0x14 [ 0.538701] ? acpi_init+0x2af/0x34f [ 0.540008] ? acpi_sleep_proc_init+0x27/0x27 [ 0.541593] ? do_one_initcall+0x4e/0x1a0 [ 0.543008] ? kernel_init_freeable+0x19e/0x21f [ 0.546202] ? rest_init+0x80/0x80 [ 0.547513] ? kernel_init+0xa/0x100 [ 0.548817] ? ret_from_fork+0x25/0x30 [ 0.550587] vgaarb: loaded [ 0.551716] EDAC MC: Ver: 3.0.0 [ 0.553744] PCI: Probing PCI hardware [ 0.555038] PCI host bridge to bus 0000:00
Quoted 1 line
... Continue to boot and log is omitted ...
I analyzed this memory leak in detail and found acpi_ns_evaluate() function only removes Info->return_object in AE_CTRL_RETURN_VALUE case. But, when errors occur, the status value is not AE_CTRL_RETURN_VALUE, and Info->return_object is also not null. Therefore, this causes acpi operand memory leak.
This cache leak causes a security threat because an old kernel (<= 4.9) shows memory locations of kernel functions in stack dump. Some malicious users could use this information to neutralize kernel ASLR.
I made a patch to fix ACPI operand cache leak.
--- drivers/acpi/acpica/nseval.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/acpi/acpica/nseval.c +8 -0
@@ -308,6 +308,14 @@ acpi_status acpi_ns_evaluate(struct acpi/* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */ status =AE_OK ; + }else if (ACPI_FAILURE (status)) { + +/* If return_object exists, delete it */ + +if (info->return_object) { +acpi_ut_remove_reference (info->return_object); + info->return_object =NULL ; + } } ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
Greg Kroah-Hartman
maintainerPATCH 276/329 cxgb4: Fix queue free path of ULD drivers
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arjun Vynipadath <[email protected]>
[ Upstream commit d7cb44496a9bb458632cb3c18acb08949c210448 ]
Setting sge_uld_rxq_info to NULL in free_queues_uld(). We are referencing sge_uld_rxq_info in cxgb_up(). This will fix a panic when interface is brought up after a ULDq creation failure.
of resources for ULD)
--- drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c +1 -0
@@ -342,6 +342,7 @@ static void free_queues_uld(struct adapt {struct sge_uld_rxq_info *rxq_info = adap->sge.uld_rxq_info[uld_type]; + adap->sge.uld_rxq_info[uld_type] =NULL ;kfree (rxq_info->rspq_id);kfree (rxq_info->uldrxq);kfree (rxq_info);
Greg Kroah-Hartman
maintainerPATCH 277/329 i2c: mv64xxx: Apply errata delay only in standard mode
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gregory CLEMENT <[email protected]>
[ Upstream commit 31184d8c6ea49ea0676d100cdd7e1f102ad025b5 ]
The errata FE-8471889 description has been updated. There is still a timing violation for repeated start. But the errata now states that it was only the case for the Standard mode (100 kHz), in Fast mode (400 kHz) there is no issue.
This patch limit the errata fix to the Standard mode.
It has been tesed successfully on the clearfog (Aramda 388 based board).
--- drivers/i2c/busses/i2c-mv64xxx.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-mv64xxx.c +6 -2
@@ -848,12 +848,16 @@ mv64xxx_of_config(struct mv64xxx_i2c_dat*/ if (of_device_is_compatible (np,"marvell,mv78230-i2c" )) { drv_data->offload_enabled = true; - drv_data->errata_delay = true; +/* The delay is only needed in standard mode (100kHz) */ +if (bus_freq <=100000 ) + drv_data->errata_delay = true; }if (of_device_is_compatible (np,"marvell,mv78230-a0-i2c" )) { drv_data->offload_enabled = false; - drv_data->errata_delay = true; +/* The delay is only needed in standard mode (100kHz) */ +if (bus_freq <=100000 ) + drv_data->errata_delay = true; }if (of_device_is_compatible (np,"allwinner,sun6i-a31-i2c" ))
Greg Kroah-Hartman
maintainerPATCH 279/329 perf top: Fix top.call-graph config option reading
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yisheng Xie <[email protected]>
[ Upstream commit a3a4a3b37c9b911af4c375b2475cea0fd2b84d38 ]
When trying to add the "call-graph" variable for top into the .perfconfig file, like:
[top]
call-graph = fp
I that perf_top_config() do not parse this variable.
Fix it by calling perf_default_config() when the top.call-graph variable is set.
--- tools/perf/builtin-top.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
tools/perf/builtin-top.c +4 -2
@@ -1061,8 +1061,10 @@ parse_callchain_opt(const struct optionstatic int perf_top_config (const char *var,const char *value,void *cb__maybe_unused ) { -if (!strcmp (var,"top.call-graph" )) - var ="call-graph.record-mode" ;/* fall-through */ +if (!strcmp (var,"top.call-graph" )) { + var ="call-graph.record-mode" ; +return perf_default_config (var, value, cb); + }if (!strcmp (var,"top.children" )) { symbol_conf.cumulate_callchain =perf_config_bool (var, value);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 280/329 perf stat: Fix core dump when flag T is used
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Richter <[email protected]>
[ Upstream commit fca32340a5e8b896f57d41fd94b8b1701df25eb1 ]
Executing command 'perf stat -T -- ls' dumps core on x86 and s390.
Here is the call back chain (done on x86):
# gdb ./perf
....
(gdb) r stat -T -- ls
...
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff56d1963 in vasprintf () from /lib64/libc.so.6
(gdb) where
#0 0x00007ffff56d1963 in vasprintf () from /lib64/libc.so.6
#1 0x00007ffff56ae484 in asprintf () from /lib64/libc.so.6
#2 0x00000000004f1982 in __parse_events_add_pmu (parse_state=0x7fffffffd580,
list=0xbfb970, name=0xbf3ef0 "cpu",
head_config=0xbfb930, auto_merge_stats=false) at util/parse-events.c:1233
#3 0x00000000004f1c8e in parse_events_add_pmu (parse_state=0x7fffffffd580,
list=0xbfb970, name=0xbf3ef0 "cpu",
head_config=0xbfb930) at util/parse-events.c:1288
#4 0x0000000000537ce3 in parse_events_parse (_parse_state=0x7fffffffd580,
scanner=0xbf4210) at util/parse-events.y:234
#5 0x00000000004f2c7a in parse_events__scanner (str=0x6b66c0
"task-clock,{instructions,cycles,cpu/cycles-t/,cpu/tx-start/}",
parse_state=0x7fffffffd580, start_token=258) at util/parse-events.c:1673
#6 0x00000000004f2e23 in parse_events (evlist=0xbe9990, str=0x6b66c0
"task-clock,{instructions,cycles,cpu/cycles-t/,cpu/tx-start/}", err=0x0)
at util/parse-events.c:1713
#7 0x000000000044e137 in add_default_attributes () at builtin-stat.c:2281
#8 0x000000000044f7b5 in cmd_stat (argc=1, argv=0x7fffffffe3b0) at
builtin-stat.c:2828
#9 0x00000000004c8b0f in run_builtin (p=0xab01a0 <commands+288>, argc=4,
argv=0x7fffffffe3b0) at perf.c:297
#10 0x00000000004c8d7c in handle_internal_command (argc=4,
argv=0x7fffffffe3b0) at perf.c:349
#11 0x00000000004c8ece in run_argv (argcp=0x7fffffffe20c,
argv=0x7fffffffe200) at perf.c:393
#12 0x00000000004c929c in main (argc=4, argv=0x7fffffffe3b0) at perf.c:537
(gdb)It turns out that a NULL pointer is referenced. Here are the function calls:
...
cmd_stat()
+---> add_default_attributes() +---> parse_events(evsel_list, transaction_attrs, NULL);
3rd parameter set to NULL
Function parse_events(xx, xx, struct parse_events_error *err) dives into a bison generated scanner and creates
parser state information for it first:
struct parse_events_state parse_state = {
.list = LIST_HEAD_INIT(parse_state.list),
.idx = evlist->nr_entries,
.error = err, <--- NULL POINTER !!!
.evlist = evlist,
};Now various functions inside the bison scanner are called to end up in __parse_events_add_pmu(struct parse_events_state *parse_state, ..) with first parameter being a pointer to above structure definition.
Now the PMU event name is not found (because being executed in a VM) and this function tries to create an error message with
asprintf(&parse_state->error.str, ....)
which references a NULL pointer and dumps core.
Fix this by providing a pointer to the necessary error information instead of NULL. Technically only the else part is needed to avoid the core dump, just lets be safe...
--- tools/perf/builtin-stat.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
tools/perf/builtin-stat.c +7 -2
@@ -2042,11 +2042,16 @@ static int add_default_attributes(void)return 0 ;if (transaction_run) { +struct parse_events_error errinfo; +if (pmu_have_event ("cpu" ,"cycles-ct" ) &&pmu_have_event ("cpu" ,"el-start" )) - err =parse_events (evsel_list, transaction_attrs,NULL ); + err =parse_events (evsel_list, transaction_attrs, + &errinfo);else - err =parse_events (evsel_list, transaction_limited_attrs,NULL ); + err =parse_events (evsel_list, + transaction_limited_attrs, + &errinfo);if (err) {fprintf (stderr,"Cannot set up transaction events\n" );return -1 ;
Greg Kroah-Hartman
maintainerPATCH 281/329 IB/core: Honor port_num while resolving GID for IB link layer
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Parav Pandit <[email protected]>
[ Upstream commit 563c4ba3bd2b8b0b21c65669ec2226b1cfa1138b ]
ah_attr contains the port number to which cm_id is bound. However, while searching for GID table for matching GID entry, the port number is ignored.
This could cause the wrong GID to be used when the ah_attr is converted to an AH.
--- drivers/infiniband/core/multicast.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-)
drivers/infiniband/core/multicast.c +11 -13
@@ -724,21 +724,19 @@ int ib_init_ah_from_mcmember(struct ib_d {int ret;u16 gid_index; -u8 p; -if (rdma_protocol_roce (device, port_num)) { - ret =ib_find_cached_gid_by_port (device, &rec->port_gid, - gid_type, port_num, - ndev, - &gid_index); - }else if (rdma_protocol_ib (device, port_num)) { - ret =ib_find_cached_gid (device, &rec->port_gid, -IB_GID_TYPE_IB ,NULL , &p, - &gid_index); - }else { - ret = -EINVAL ; - } +/* GID table is not based on the netdevice for IB link layer, +* so ignore ndev during search. +*/ +if (rdma_protocol_ib (device, port_num)) + ndev =NULL ; +else if (!rdma_protocol_roce (device, port_num)) +return -EINVAL ; + ret =ib_find_cached_gid_by_port (device, &rec->port_gid, + gid_type, port_num, + ndev, + &gid_index);if (ret)return ret;
Greg Kroah-Hartman
maintainerPATCH 282/329 regulator: gpio: Fix some error handling paths in gpio_regulator_probe()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe Jaillet <[email protected]>
[ Upstream commit ed8cffda27dea6fd3dafb3ee881c5a786edac9ca ]
Re-order error handling code and gotos to avoid leaks in error handling paths.
--- drivers/regulator/gpio-regulator.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/regulator/gpio-regulator.c +7 -9
@@ -268,8 +268,7 @@ static int gpio_regulator_probe(struct p drvdata->desc.name =kstrdup (config->supply_name,GFP_KERNEL );if (drvdata->desc.name ==NULL ) {dev_err (&pdev->dev,"Failed to allocate supply name\n" ); - ret = -ENOMEM ; - goto err; +return -ENOMEM ; }if (config->nr_gpios !=0 ) {
@@ -289,7 +288,7 @@ static int gpio_regulator_probe(struct pdev_err (&pdev->dev,"Could not obtain regulator setting GPIOs: %d\n" , ret); - goto err_memstate; + goto err_memgpio; } }
@@ -300,7 +299,7 @@ static int gpio_regulator_probe(struct pif (drvdata->states ==NULL ) {dev_err (&pdev->dev,"Failed to allocate state data\n" ); ret = -ENOMEM ; - goto err_memgpio; + goto err_stategpio; } drvdata->nr_states = config->nr_states;
@@ -321,7 +320,7 @@ static int gpio_regulator_probe(struct pdefault :dev_err (&pdev->dev,"No regulator type set\n" ); ret = -EINVAL ; - goto err_memgpio; + goto err_memstate; }/* build initial state from gpio init data. */
@@ -358,22 +357,21 @@ static int gpio_regulator_probe(struct pif (IS_ERR (drvdata->dev)) { ret =PTR_ERR (drvdata->dev);dev_err (&pdev->dev,"Failed to register regulator: %d\n" , ret); - goto err_stategpio; + goto err_memstate; }platform_set_drvdata (pdev, drvdata);return 0 ; -err_stategpio: -gpio_free_array (drvdata->gpios, drvdata->nr_gpios); err_memstate:kfree (drvdata->states); +err_stategpio: +gpio_free_array (drvdata->gpios, drvdata->nr_gpios); err_memgpio:kfree (drvdata->gpios); err_name:kfree (drvdata->desc.name); -err:return ret; }
Greg Kroah-Hartman
maintainerPATCH 283/329 spi: bcm-qspi: fIX some error handling paths
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe Jaillet <[email protected]>
[ Upstream commit bc3cc75281b3c2b1c5355d88d147b66a753bb9a5 ]
For some reason, commit c0368e4db4a3 ("spi: bcm-qspi: Fix use after free in bcm_qspi_probe() in error path") has updated some gotos, but not all of them.
This looks spurious, so fix it.
--- drivers/spi/spi-bcm-qspi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi-bcm-qspi.c +2 -2
@@ -1220,7 +1220,7 @@ int bcm_qspi_probe(struct platform_devic qspi->base[MSPI ] =devm_ioremap_resource (dev, res);if (IS_ERR (qspi->base[MSPI ])) { ret =PTR_ERR (qspi->base[MSPI ]); - goto qspi_probe_err; + goto qspi_resource_err; } }else { goto qspi_resource_err;
@@ -1231,7 +1231,7 @@ int bcm_qspi_probe(struct platform_devic qspi->base[BSPI ] =devm_ioremap_resource (dev, res);if (IS_ERR (qspi->base[BSPI ])) { ret =PTR_ERR (qspi->base[BSPI ]); - goto qspi_probe_err; + goto qspi_resource_err; } qspi->bspi_mode = true; }else {
Greg Kroah-Hartman
maintainerPATCH 284/329 MIPS: ath79: Fix AR724X_PLL_REG_PCIE_CONFIG offset
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Kresin <[email protected]>
[ Upstream commit 05454c1bde91fb013c0431801001da82947e6b5a ]
According to the QCA u-boot source the "PCIE Phase Lock Loop Configuration (PCIE_PLL_CONFIG)" register is for all SoCs except the QCA955X and QCA956X at offset 0x10.
Since the PCIE PLL config register is only defined for the AR724x fix only this value. The value is wrong since the day it was added and isn't used by any driver yet.
Patchwork: https://patchwork.linux-mips.org/patch/16048/
--- arch/mips/include/asm/mach-ath79/ar71xx_regs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/include/asm/mach-ath79/ar71xx_regs.h +1 -1
@@ -167,7 +167,7 @@#define AR71XX_AHB_DIV_MASK 0x7#define AR724X_PLL_REG_CPU_CONFIG 0x00 -#define AR724X_PLL_REG_PCIE_CONFIG 0x18 +#define AR724X_PLL_REG_PCIE_CONFIG 0x10#define AR724X_PLL_FB_SHIFT 0#define AR724X_PLL_FB_MASK 0x3ff
Greg Kroah-Hartman
maintainerPATCH 285/329 PCI: Restore config space on runtime resume despite being unbound
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Rafael J. Wysocki" <[email protected]>
[ Upstream commit 5775b843a619b3c93f946e2b55a208d9f0f48b59 ]
We leave PCI devices not bound to a driver in D0 during runtime suspend. But they may have a parent which is bound and can be transitioned to D3cold at runtime. Once the parent goes to D3cold, the unbound child may go to D3cold as well. When the child goes to D3cold, its internal state, including configuration of BARs, MSI, ASPM, MPS, etc., is lost.
One example are recent hybrid graphics laptops which cut power to the discrete GPU when the root port above it goes to ACPI power state D3. Users may provoke this by unbinding the GPU driver and allowing runtime PM on the GPU via sysfs: The PM core will then treat the GPU as "suspended", which in turn allows the root port to runtime suspend, causing the power resources listed in its _PR3 object to be powered off. The GPU's BARs will be uninitialized when a driver later probes it.
Another example are hybrid graphics laptops where the GPU itself (rather than the root port) is capable of runtime suspending to D3cold. If the GPU's integrated HDA controller is not bound and the GPU's driver decides to runtime suspend to D3cold, the HDA controller's BARs will be uninitialized when a driver later probes it.
Fix by saving and restoring config space over a runtime suspend cycle even if the device is not bound.
--- drivers/pci/pci-driver.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/pci/pci-driver.c +11 -6
@@ -1147,11 +1147,14 @@ static int pci_pm_runtime_suspend(structint error;/* -* If pci_dev->driver is not set (unbound), the device should -* always remain in D0 regardless of the runtime PM status +* If pci_dev->driver is not set (unbound), we leave the device in D0, +* but it may go to D3cold when the bridge above it runtime suspends. +* Save its config space in case that happens. */ -if (!pci_dev->driver) +if (!pci_dev->driver) { +pci_save_state (pci_dev);return 0 ; + }if (!pm || !pm->runtime_suspend)return -ENOSYS ;
@@ -1199,16 +1202,18 @@ static int pci_pm_runtime_resume(structconst struct dev_pm_ops *pm = dev->driver ? dev->driver->pm :NULL ;/* -* If pci_dev->driver is not set (unbound), the device should -* always remain in D0 regardless of the runtime PM status +* Restoring config space is necessary even if the device is not bound +* to a driver because although we left it in D0, it may have gone to +* D3cold when the bridge above it runtime suspended. */ +pci_restore_standard_config (pci_dev); +if (!pci_dev->driver)return 0 ;if (!pm || !pm->runtime_resume)return -ENOSYS ; -pci_restore_standard_config (pci_dev);pci_fixup_device (pci_fixup_resume_early, pci_dev);__pci_enable_wake (pci_dev,PCI_D0 , true, false);pci_fixup_device (pci_fixup_resume, pci_dev);
Greg Kroah-Hartman
maintainerPATCH 286/329 ipmi_ssif: Fix kernel panic at msg_done_handler
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kamlakant Patel <[email protected]>
[ Upstream commit f002612b9d86613bc6fde0a444e0095225f6053e ]
This happens when BMC doesn't return any data and the code is trying to print the value of data[2].
Getting following crash:
[ 484.728410] Unable to handle kernel NULL pointer dereference at virtual address 00000002 [ 484.736496] pgd = ffff0000094a2000 [ 484.739885] [00000002] *pgd=00000047fcffe003, *pud=00000047fcffd003, *pmd=0000000000000000 [ 484.748158] Internal error: Oops: 96000005 [#1] SMP [...] [ 485.101451] Call trace: [...] [ 485.188473] [<ffff000000a46e68>] msg_done_handler+0x668/0x700 [ipmi_ssif] [ 485.195249] [<ffff000000a456b8>] ipmi_ssif_thread+0x110/0x128 [ipmi_ssif] [ 485.202038] [<ffff0000080f1430>] kthread+0x108/0x138 [ 485.206994] [<ffff0000080838e0>] ret_from_fork+0x10/0x30 [ 485.212294] Code: aa1903e1 aa1803e0 b900227f 95fef6a5 (39400aa3)
Adding a check to validate the data len before printing data[2] to fix this issue.
--- drivers/char/ipmi/ipmi_ssif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/char/ipmi/ipmi_ssif.c +2 -2
@@ -761,7 +761,7 @@ static void msg_done_handler(struct ssif ssif_info->ssif_state =SSIF_NORMAL ;ipmi_ssif_unlock_cond (ssif_info, flags);pr_warn (PFX "Error getting flags: %d %d, %x\n" , - result, len, data[2 ]); + result, len, (len >=3 ) ? data[2 ] :0 ); }else if (data[0 ] != (IPMI_NETFN_APP_REQUEST |1 ) <<2 || data[1 ] !=IPMI_GET_MSG_FLAGS_CMD ) {/*
@@ -783,7 +783,7 @@ static void msg_done_handler(struct ssifif ((result <0 ) || (len <3 ) || (data[2 ] !=0 )) {/* Error clearing flags */ pr_warn (PFX "Error clearing flags: %d %d, %x\n" , - result, len, data[2 ]); + result, len, (len >=3 ) ? data[2 ] :0 ); }else if (data[0 ] != (IPMI_NETFN_APP_REQUEST |1 ) <<2 || data[1 ] !=IPMI_CLEAR_MSG_FLAGS_CMD ) { pr_warn(PFX "Invalid response clearing flags: %x %x\n",
Greg Kroah-Hartman
maintainerPATCH 288/329 f2fs: fix to check extent cache in f2fs_drop_extent_tree
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit bf617f7a92edc6bb2909db2bfa4576f50b280ee5 ]
If noextent_cache mount option is on, we will never initialize extent tree in inode, but still we're going to access it in f2fs_drop_extent_tree, result in kernel panic as below:
BUG: unable to handle kernel NULL pointer dereference at 0000000000000038 IP: _raw_write_lock+0xc/0x30 Call Trace: ? f2fs_drop_extent_tree+0x41/0x70 [f2fs] f2fs_fallocate+0x5a0/0xdd0 [f2fs] ? common_file_perm+0x47/0xc0 ? apparmor_file_permission+0x1a/0x20 vfs_fallocate+0x15b/0x290 SyS_fallocate+0x44/0x70 do_syscall_64+0x6e/0x160 entry_SYSCALL64_slow_path+0x25/0x25
This patch fixes to check extent cache status before using in f2fs_drop_extent_tree.
--- fs/f2fs/extent_cache.c | 3 +++ 1 file changed, 3 insertions(+)
fs/f2fs/extent_cache.c +3 -0
@@ -647,6 +647,9 @@ void f2fs_drop_extent_tree(struct inodestruct f2fs_sb_info *sbi =F2FS_I_SB (inode);struct extent_tree *et =F2FS_I (inode)->extent_tree; +if (!f2fs_may_extent_tree (inode)) +return ; +set_inode_flag (inode,FI_NO_EXTENT );write_lock (&et->lock);
Greg Kroah-Hartman
maintainerPATCH 289/329 perf/core: Fix perf_output_read_group()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
[ Upstream commit 9e5b127d6f33468143d90c8a45ca12410e4c3fa7 ]
Mark reported his arm64 perf fuzzer runs sometimes splat like:
armv8pmu_read_counter+0x1e8/0x2d8 armpmu_event_update+0x8c/0x188 armpmu_read+0xc/0x18 perf_output_read+0x550/0x11e8 perf_event_read_event+0x1d0/0x248 perf_event_exit_task+0x468/0xbb8 do_exit+0x690/0x1310 do_group_exit+0xd0/0x2b0 get_signal+0x2e8/0x17a8 do_signal+0x144/0x4f8 do_notify_resume+0x148/0x1e8 work_pending+0x8/0x14
which asserts that we only call pmu::read() on ACTIVE events.
The above callchain does:
perf_event_exit_task()
perf_event_exit_task_context()
task_ctx_sched_out() // INACTIVE
perf_event_exit_event()
perf_event_set_state(EXIT) // EXIT
sync_child_event()
perf_event_read_event()
perf_output_read()
perf_output_read_group()
leader->pmu->read()
Which results in doing a pmu::read() on an !ACTIVE event.
I _think_ this is 'new' since we added attr.inherit_stat, which added the perf_event_read_event() to the exit path, without that perf_event_read_output() would only trigger from samples and for @event to trigger a sample, it's leader _must_ be ACTIVE too.
Still, adding this check makes it consistent with the @sub case for the siblings.
--- kernel/events/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/events/core.c +2 -1
@@ -5700,7 +5700,8 @@ static void perf_output_read_group(strucif (read_format &PERF_FORMAT_TOTAL_TIME_RUNNING ) values[n++] = running; -if (leader != event) +if ((leader != event) && + (leader->state ==PERF_EVENT_STATE_ACTIVE )) leader->pmu->read (leader); values[n++] =perf_event_count (leader);
Greg Kroah-Hartman
maintainerPATCH 290/329 drm/panel: simple: Fix the bus format for the Ontat panel
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Anholt <[email protected]>
[ Upstream commit 5651e5e094591f479adad5830ac1bc45196a39b3 ]
This fixes bad color output. When I was first testing the device I had the DPI hardware set to 666 mode, but apparently in the refactor to use the bus_format information from the panel driver, I failed to actually update the panel.
--- drivers/gpu/drm/panel/panel-simple.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/panel/panel-simple.c +1 -1
@@ -1250,7 +1250,7 @@ static const struct panel_desc ontat_yx7 .width = 154, .height = 83, }, - .bus_format = MEDIA_BUS_FMT_RGB888_1X24, + .bus_format = MEDIA_BUS_FMT_RGB666_1X18, }; static const struct drm_display_mode ortustech_com43h4m85ulc_mode = {
Greg Kroah-Hartman
maintainerPATCH 291/329 hwmon: (pmbus/max8688) Accept negative page register values
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
[ Upstream commit a46f8cd696624ef757be0311eb28f119c36778e8 ]
A negative page register value means that no page needs to be selected. This is used by status register evaluations and needs to be accepted.
--- drivers/hwmon/pmbus/max8688.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/pmbus/max8688.c +1 -1
@@ -45,7 +45,7 @@ static int max8688_read_word_data(struct {int ret; -if (page) +if (page >0 )return -ENXIO ;switch (reg) {
Greg Kroah-Hartman
maintainerPATCH 292/329 hwmon: (pmbus/adm1275) Accept negative page register values
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
[ Upstream commit ecb29abd4cb0670c616fb563a078f25d777ce530 ]
A negative page register value means that no page needs to be selected. This is used by status register read operations and needs to be accepted. The failure to do so so results in missed status and limit registers.
--- drivers/hwmon/pmbus/adm1275.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hwmon/pmbus/adm1275.c +2 -2
@@ -154,7 +154,7 @@ static int adm1275_read_word_data(structconst struct adm1275_data *data =to_adm1275_data (info);int ret =0 ; -if (page) +if (page >0 )return -ENXIO ;switch (reg) {
@@ -240,7 +240,7 @@ static int adm1275_write_word_data(strucconst struct adm1275_data *data =to_adm1275_data (info);int ret; -if (page) +if (page >0 )return -ENXIO ;switch (reg) {
Greg Kroah-Hartman
maintainerPATCH 293/329 perf/x86/intel: Properly save/restore the PMU state in the NMI handler
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kan Liang <[email protected]>
[ Upstream commit 82d71ed0277efc45360828af8c4e4d40e1b45352 ]
The PMU is disabled in intel_pmu_handle_irq(), but cpuc->enabled is not updated accordingly.
This is fine in current usage because no-one checks it - but fix it for future code: for example, the drain_pebs() will be modified to fix an auto-reload bug.
Properly save/restore the old PMU state.
--- arch/x86/events/intel/core.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
arch/x86/events/intel/core.c +9 -1
@@ -2066,16 +2066,23 @@ static int intel_pmu_handle_irq(struct pint bit, loops;u64 status;int handled; +int pmu_enabled; cpuc =this_cpu_ptr (&cpu_hw_events);/* +* Save the PMU state. +* It needs to be restored when leaving the handler. +*/ + pmu_enabled = cpuc->enabled; +/* * No known reason to not always do late ACK, * but just in case do it opt-in. */ if (!x86_pmu.late_ack)apic_write (APIC_LVTPC ,APIC_DM_NMI );intel_bts_disable_local (); + cpuc->enabled =0 ;__intel_pmu_disable_all (); handled =intel_pmu_drain_bts_buffer (); handled +=intel_bts_interrupt ();
@@ -2173,7 +2180,8 @@ again: done:/* Only restore PMU state when it's active. See x86_pmu_disable(). */ -if (cpuc->enabled) + cpuc->enabled = pmu_enabled; +if (pmu_enabled)__intel_pmu_enable_all (0 , true);intel_bts_enable_local ();
Greg Kroah-Hartman
maintainerPATCH 294/329 cdrom: do not call check_disk_change() inside cdrom_open()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maurizio Lombardi <[email protected]>
[ Upstream commit 2bbea6e117357d17842114c65e9a9cf2d13ae8a3 ]
when mounting an ISO filesystem sometimes (very rarely) the system hangs because of a race condition between two tasks.
PID: 6766 TASK: ffff88007b2a6dd0 CPU: 0 COMMAND: "mount"
#0 [ffff880078447ae0] __schedule at ffffffff8168d605
#1 [ffff880078447b48] schedule_preempt_disabled at ffffffff8168ed49 #2 [ffff880078447b58] __mutex_lock_slowpath at ffffffff8168c995 #3 [ffff880078447bb8] mutex_lock at ffffffff8168bdef
#4 [ffff880078447bd0] sr_block_ioctl at ffffffffa00b6818 [sr_mod] #5 [ffff880078447c10] blkdev_ioctl at ffffffff812fea50 #6 [ffff880078447c70] ioctl_by_bdev at ffffffff8123a8b3 #7 [ffff880078447c90] isofs_fill_super at ffffffffa04fb1e1 [isofs] #8 [ffff880078447da8] mount_bdev at ffffffff81202570
#9 [ffff880078447e18] isofs_mount at ffffffffa04f9828 [isofs]
#10 [ffff880078447e28] mount_fs at ffffffff81202d09
#11 [ffff880078447e70] vfs_kern_mount at ffffffff8121ea8f #12 [ffff880078447ea8] do_mount at ffffffff81220fee
#13 [ffff880078447f28] sys_mount at ffffffff812218d6
#14 [ffff880078447f80] system_call_fastpath at ffffffff81698c49
RIP: 00007fd9ea914e9a RSP: 00007ffd5d9bf648 RFLAGS: 00010246
RAX: 00000000000000a5 RBX: ffffffff81698c49 RCX: 0000000000000010
RDX: 00007fd9ec2bc210 RSI: 00007fd9ec2bc290 RDI: 00007fd9ec2bcf30
RBP: 0000000000000000 R8: 0000000000000000 R9: 0000000000000010
R10: 00000000c0ed0001 R11: 0000000000000206 R12: 00007fd9ec2bc040
R13: 00007fd9eb6b2380 R14: 00007fd9ec2bc210 R15: 00007fd9ec2bcf30
ORIG_RAX: 00000000000000a5 CS: 0033 SS: 002bThis task was trying to mount the cdrom. It allocated and configured a super_block struct and owned the write-lock for the super_block->s_umount rwsem. While exclusively owning the s_umount lock, it called sr_block_ioctl and waited to acquire the global sr_mutex lock.
PID: 6785 TASK: ffff880078720fb0 CPU: 0 COMMAND: "systemd-udevd"
#0 [ffff880078417898] __schedule at ffffffff8168d605
#1 [ffff880078417900] schedule at ffffffff8168dc59
#2 [ffff880078417910] rwsem_down_read_failed at ffffffff8168f605 #3 [ffff880078417980] call_rwsem_down_read_failed at ffffffff81328838 #4 [ffff8800784179d0] down_read at ffffffff8168cde0
#5 [ffff8800784179e8] get_super at ffffffff81201cc7
#6 [ffff880078417a10] __invalidate_device at ffffffff8123a8de #7 [ffff880078417a40] flush_disk at ffffffff8123a94b
#8 [ffff880078417a88] check_disk_change at ffffffff8123ab50 #9 [ffff880078417ab0] cdrom_open at ffffffffa00a29e1 [cdrom]
#10 [ffff880078417b68] sr_block_open at ffffffffa00b6f9b [sr_mod] #11 [ffff880078417b98] __blkdev_get at ffffffff8123ba86
#12 [ffff880078417bf0] blkdev_get at ffffffff8123bd65
#13 [ffff880078417c78] blkdev_open at ffffffff8123bf9b
#14 [ffff880078417c90] do_dentry_open at ffffffff811fc7f7 #15 [ffff880078417cd8] vfs_open at ffffffff811fc9cf
#16 [ffff880078417d00] do_last at ffffffff8120d53d
#17 [ffff880078417db0] path_openat at ffffffff8120e6b2
#18 [ffff880078417e48] do_filp_open at ffffffff8121082b
#19 [ffff880078417f18] do_sys_open at ffffffff811fdd33
#20 [ffff880078417f70] sys_open at ffffffff811fde4e
#21 [ffff880078417f80] system_call_fastpath at ffffffff81698c49
RIP: 00007f29438b0c20 RSP: 00007ffc76624b78 RFLAGS: 00010246
RAX: 0000000000000002 RBX: ffffffff81698c49 RCX: 0000000000000000
RDX: 00007f2944a5fa70 RSI: 00000000000a0800 RDI: 00007f2944a5fa70
RBP: 00007f2944a5f540 R8: 0000000000000000 R9: 0000000000000020
R10: 00007f2943614c40 R11: 0000000000000246 R12: ffffffff811fde4e
R13: ffff880078417f78 R14: 000000000000000c R15: 00007f2944a4b010
ORIG_RAX: 0000000000000002 CS: 0033 SS: 002bThis task tried to open the cdrom device, the sr_block_open function acquired the global sr_mutex lock. The call to check_disk_change() then saw an event flag indicating a possible media change and tried to flush any cached data for the device.
As part of the flush, it tried to acquire the super_block->s_umount lock associated with the cdrom device.
This was the same super_block as created and locked by the previous task.
The first task acquires the s_umount lock and then the sr_mutex_lock; the second task acquires the sr_mutex_lock and then the s_umount lock.
This patch fixes the issue by moving check_disk_change() out of cdrom_open() and let the caller take care of it.
--- drivers/block/paride/pcd.c | 2 ++ drivers/cdrom/cdrom.c | 3 --- drivers/cdrom/gdrom.c | 3 +++ drivers/ide/ide-cd.c | 2 ++ drivers/scsi/sr.c | 2 ++ 5 files changed, 9 insertions(+), 3 deletions(-)
drivers/block/paride/pcd.c +2 -0
@@ -230,6 +230,8 @@ static int pcd_block_open(struct block_dstruct pcd_unit *cd = bdev->bd_disk->private_data;int ret; +check_disk_change (bdev); +mutex_lock (&pcd_mutex); ret =cdrom_open (&cd->info, bdev, mode);mutex_unlock (&pcd_mutex);
drivers/cdrom/cdrom.c +0 -3
@@ -1154,9 +1154,6 @@ int cdrom_open(struct cdrom_device_infocd_dbg (CD_OPEN ,"entering cdrom_open\n" ); -/* open is event synchronization point, check events first */ -check_disk_change (bdev); -/* if this was a O_NONBLOCK open and we should honor the flags, * do a quick open without drive/disc integrity checks. */ cdi->use_count++;
drivers/cdrom/gdrom.c +3 -0
@@ -497,6 +497,9 @@ static struct cdrom_device_ops gdrom_opsstatic int gdrom_bdops_open (struct block_device *bdev,fmode_t mode) {int ret; + +check_disk_change (bdev); +mutex_lock (&gdrom_mutex); ret =cdrom_open (gd.cd_info, bdev, mode);mutex_unlock (&gdrom_mutex);
drivers/ide/ide-cd.c +2 -0
@@ -1593,6 +1593,8 @@ static int idecd_open(struct block_devicstruct cdrom_info *info;int rc = -ENXIO ; +check_disk_change (bdev); +mutex_lock (&ide_cd_mutex); info =ide_cd_get (bdev->bd_disk);if (!info)
drivers/scsi/sr.c +2 -0
@@ -522,6 +522,8 @@ static int sr_block_open(struct block_destruct scsi_cd *cd;int ret = -ENXIO ; +check_disk_change (bdev); +mutex_lock (&sr_mutex); cd =scsi_cd_get (bdev->bd_disk);if (cd) {
Greg Kroah-Hartman
maintainerPATCH 295/329 perf/x86/intel: Fix large period handling on Broadwell CPUs
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kan Liang <[email protected]>
[ Upstream commit f605cfca8c39ffa2b98c06d2b9f30ba64f1e54e3 ]
Large fixed period values could be truncated on Broadwell, for example:
perf record -e cycles -c 10000000000
Here the fixed period is 0x2540BE400, but the period which finally applied is 0x540BE400 - which is wrong.
The reason is that x86_pmu::limit_period() uses an u32 parameter, so the high 32 bits of 'period' get truncated.
This bug was introduced in:
commit 294fe0f52a44 ("perf/x86/intel: Add INST_RETIRED.ALL workarounds")
It's safe to use u64 instead of u32:
- Although the 'left' is s64, the value of 'left' must be positive when calling limit_period().
- bdw_limit_period() only modifies the lowest 6 bits, it doesn't touch the higher 32 bits.
--- arch/x86/events/intel/core.c | 2 +- arch/x86/events/perf_event.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/events/intel/core.c +1 -1
@@ -3027,7 +3027,7 @@ hsw_get_event_constraints(struct cpu_hw_* Therefore the effective (average) period matches the requested period, * despite coarser hardware granularity. */ -static unsigned bdw_limit_period (struct perf_event *event,unsigned left) +static u64 bdw_limit_period (struct perf_event *event,u64 left) {if ((event->hw.config &INTEL_ARCH_EVENT_MASK ) == X86_CONFIG(.event=0xc0, .umask=0x01)) {
arch/x86/events/perf_event.h +1 -1
@@ -548,7 +548,7 @@ struct x86_pmu {struct x86_pmu_quirk *quirks;int perfctr_second_write;bool late_ack; -unsigned (*limit_period)(struct perf_event *event,unsigned l); +u64 (*limit_period)(struct perf_event *event,u64 l);/* * sysfs attrs
Greg Kroah-Hartman
maintainerPATCH 296/329 perf/x86/intel: Fix event update for auto-reload
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kan Liang <[email protected]>
[ Upstream commit d31fc13fdcb20e1c317f9a7dd6273c18fbd58308 ]
There is a bug when reading event->count with large PEBS enabled.
Here is an example:
# ./read_count 0x71f0 0x122c0 0x1000000001c54 0x100000001257d 0x200000000bdc5
In fixed period mode, the auto-reload mechanism could be enabled for PEBS events, but the calculation of event->count does not take the auto-reload values into account.
Anyone who reads event->count will get the wrong result, e.g x86_pmu_read().
This bug was introduced with the auto-reload mechanism enabled since commit:
851559e35fd5 ("perf/x86/intel: Use the PEBS auto reload mechanism when possible")
Introduce intel_pmu_save_and_restart_reload() to calculate the event->count only for auto-reload.
Since the counter increments a negative counter value and overflows on the sign switch, giving the interval:
[-period, 0]
the difference between two consequtive reads is:
A) value2 - value1;
when no overflows have happened in between,
B) (0 - value1) + (value2 - (-period));
when one overflow happened in between,
C) (0 - value1) + (n - 1) * (period) + (value2 - (-period)); when @n overflows happened in between.
Here A) is the obvious difference, B) is the extension to the discrete interval, where the first term is to the top of the interval and the second term is from the bottom of the next interval and C) the extension to multiple intervals, where the middle term is the whole intervals covered.
The equation for all cases is:
value2 - value1 + n * period
Previously the event->count is updated right before the sample output. But for case A, there is no PEBS record ready. It needs to be specially handled.
Remove the auto-reload code from x86_perf_event_set_period() since we'll not longer call that function in this case.
Based-on-code-from: Peter Zijlstra (Intel) <[email protected]>
--- arch/x86/events/core.c | 15 ++----- arch/x86/events/intel/ds.c | 92 +++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 94 insertions(+), 13 deletions(-)
arch/x86/events/core.c +6 -9
@@ -1155,16 +1155,13 @@ int x86_perf_event_set_period(struct perper_cpu (pmc_prev_left[idx],smp_processor_id ()) = left; -if (!(hwc->flags &PERF_X86_EVENT_AUTO_RELOAD ) || -local64_read (&hwc->prev_count) != (u64)-left) { -/* -* The hw event starts counting from this event offset, -* mark it to be able to extra future deltas: -*/ -local64_set (&hwc->prev_count, (u64)-left); +/* +* The hw event starts counting from this event offset, +* mark it to be able to extra future deltas: +*/ +local64_set (&hwc->prev_count, (u64)-left); -wrmsrl (hwc->event_base, (u64)(-left) & x86_pmu.cntval_mask); - } +wrmsrl (hwc->event_base, (u64)(-left) & x86_pmu.cntval_mask);/* * Due to erratum on certan cpu we need
arch/x86/events/intel/ds.c +88 -4
121 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 297/329 arm64: dts: qcom: Fix SPI5 config on MSM8996
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilia Lin <[email protected]>
[ Upstream commit e723795c702b52cfceb3bb3faa63059eb4658313 ]
Set correct clocks and interrupt values. Fixes the incorrect SPI master configuration. This is mandatory to make the SPI5 interface functional.
--- arch/arm64/boot/dts/qcom/msm8996.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/msm8996.dtsi +2 -2
@@ -326,8 +326,8 @@ blsp2_spi5: spi@075ba000{ compatible = "qcom,spi-qup-v2.2.1"; reg = <0x075ba000 0x600>; - interrupts = <GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&gcc GCC_BLSP2_QUP5_SPI_APPS_CLK>, + interrupts = <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&gcc GCC_BLSP2_QUP6_SPI_APPS_CLK>, <&gcc GCC_BLSP2_AHB_CLK>; clock-names = "core", "iface"; pinctrl-names = "default", "sleep";
Greg Kroah-Hartman
maintainerPATCH 298/329 soc: qcom: wcnss_ctrl: Fix increment in NV upload
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjorn Andersson <[email protected]>
[ Upstream commit 90c29ed7627b6b4aeb603ee197650173c8434512 ]
hdr.len includes both the size of the header and the fragment, so using this when stepping through the firmware causes us to skip 16 bytes every chunk of 3072 bytes; causing only the first fragment to actually be valid data.
Instead use fragment size steps through the firmware blob.
--- drivers/soc/qcom/wcnss_ctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/qcom/wcnss_ctrl.c +1 -1
@@ -247,7 +247,7 @@ static int wcnss_download_nv(struct wcns/* Increment for next fragment */ req->seq++; - data += req->hdr.len; + data +=NV_FRAGMENT_SIZE ; left -=NV_FRAGMENT_SIZE ; }while (left >0 );
Greg Kroah-Hartman
maintainerPATCH 299/329 gfs2: Fix fallocate chunk size
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Gruenbacher <[email protected]>
[ Upstream commit 174d1232ebc84fcde8f5889d1171c9c7e74a10a7 ]
The chunk size of allocations in __gfs2_fallocate is calculated incorrectly. The size can collapse, causing __gfs2_fallocate to allocate one block at a time, which is very inefficient. This needs fixing in two places:
In gfs2_quota_lock_check, always set ap->allowed to UINT_MAX to indicate that there is no quota limit. This fixes callers that rely on ap->allowed to be set even when quotas are off.
In __gfs2_fallocate, reset max_blks to UINT_MAX in each iteration of the loop to make sure that allocation limits from one resource group won't spill over into another resource group.
--- fs/gfs2/file.c | 5 +++-- fs/gfs2/quota.h | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-)
fs/gfs2/file.c +3 -2
@@ -801,7 +801,7 @@ static long __gfs2_fallocate(struct filestruct gfs2_inode *ip =GFS2_I (inode);struct gfs2_alloc_parms ap = { .aflags =0 , };unsigned int data_blocks =0 , ind_blocks =0 , rblocks; -loff_t bytes, max_bytes, max_blks =UINT_MAX ; +loff_t bytes, max_bytes, max_blks;int error;const loff_t pos = offset;const loff_t count = len;
@@ -853,7 +853,8 @@ static long __gfs2_fallocate(struct filereturn error;/* ap.allowed tells us how many blocks quota will allow * us to write. Check if this reduces max_blks */ -if (ap.allowed && ap.allowed < max_blks) + max_blks =UINT_MAX ; +if (ap.allowed) max_blks = ap.allowed; error =gfs2_inplace_reserve (ip, &ap);
fs/gfs2/quota.h +2 -0
@@ -45,6 +45,8 @@ static inline int gfs2_quota_lock_check( {struct gfs2_sbd *sdp =GFS2_SB (&ip->i_inode);int ret; + + ap->allowed =UINT_MAX ;/* Assume we are permitted a whole lot */ if (sdp->sd_args.ar_quota ==GFS2_QUOTA_OFF )return 0 ; ret =gfs2_quota_lock (ip,NO_UID_QUOTA_CHANGE ,NO_GID_QUOTA_CHANGE );
Greg Kroah-Hartman
maintainerPATCH 300/329 x86/devicetree: Initialize device tree before using it
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Gorinov <[email protected]>
[ Upstream commit 628df9dc5ad886b0a9b33c75a7b09710eb859ca1 ]
Commit 08d53aa58cb1 added CRC32 calculation in early_init_dt_verify() and checking in late initcall of_fdt_raw_init(), making early_init_dt_verify() mandatory.
The required call to early_init_dt_verify() was not added to the x86-specific implementation, causing failure to create the sysfs entry in of_fdt_raw_init().
--- arch/x86/kernel/devicetree.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
arch/x86/kernel/devicetree.c +5 -3
@@ -11,6 +11,7 @@#include <linux/of_address.h> #include <linux/of_platform.h> #include <linux/of_irq.h> +#include <linux/libfdt.h> #include <linux/slab.h> #include <linux/pci.h> #include <linux/of_pci.h>
@@ -276,14 +277,15 @@ static void __init x86_flattree_get_conf map_len =max (PAGE_SIZE - (initial_dtb & ~PAGE_MASK ), (u64 )128 ); - initial_boot_params = dt =early_memremap (initial_dtb, map_len); - size =of_get_flat_dt_size (); + dt =early_memremap (initial_dtb, map_len); + size =fdt_totalsize (dt);if (map_len < size) {early_memunmap (dt, map_len); - initial_boot_params = dt =early_memremap (initial_dtb, size); + dt =early_memremap (initial_dtb, size); map_len = size; } +early_init_dt_verify (dt);unflatten_and_copy_device_tree ();early_memunmap (dt, map_len); }
Greg Kroah-Hartman
maintainerPATCH 301/329 x86/devicetree: Fix device IRQ settings in DT
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Gorinov <[email protected]>
[ Upstream commit 0a5169add90e43ab45ab1ba34223b8583fcaf675 ]
IRQ parameters for the SoC devices connected directly to I/O APIC lines (without PCI IRQ routing) may be specified in the Device Tree.
Called from DT IRQ parser, irq_create_fwspec_mapping() calls irq_domain_alloc_irqs() with a pointer to irq_fwspec structure as @arg.
But x86-specific DT IRQ allocation code casts @arg to of_phandle_args structure pointer and crashes trying to read the IRQ parameters. The function was not converted when the mapping descriptor was changed to irq_fwspec in the generic irqdomain code.
--- arch/x86/kernel/devicetree.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
arch/x86/kernel/devicetree.c +8 -5
@@ -200,19 +200,22 @@ static struct of_ioapic_type of_ioapic_tstatic int dt_irqdomain_alloc (struct irq_domain *domain,unsigned int virq,unsigned int nr_irqs,void *arg) { -struct of_phandle_args *irq_data = (void *)arg; +struct irq_fwspec *fwspec = (struct irq_fwspec *)arg;struct of_ioapic_type *it;struct irq_alloc_info tmp; +int type_index; -if (WARN_ON (irq_data->args_count <2 )) +if (WARN_ON (fwspec->param_count <2 ))return -EINVAL ; -if (irq_data->args[1 ] >=ARRAY_SIZE (of_ioapic_type)) + + type_index = fwspec->param[1 ]; +if (type_index >=ARRAY_SIZE (of_ioapic_type))return -EINVAL ; - it = &of_ioapic_type[irq_data->args[1 ]]; + it = &of_ioapic_type[type_index];ioapic_set_alloc_attr (&tmp,NUMA_NO_NODE , it->trigger, it->polarity); tmp.ioapic_id =mpc_ioapic_id (mp_irqdomain_ioapic_idx (domain)); - tmp.ioapic_pin = irq_data->args[0 ]; + tmp.ioapic_pin = fwspec->param[0 ];return mp_irqdomain_alloc (domain, virq, nr_irqs, &tmp); }
Greg Kroah-Hartman
maintainerPATCH 302/329 ALSA: vmaster: Propagate slave error
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit 2e2c177ca84aff092c3c96714b0f6a12900f3946 ]
In slave_update() of vmaster code ignores the error from the slave get() callback and copies the values. It's not only about the missing error code but also that this may potentially lead to a leak of uninitialized variables when the slave get() don't clear them.
This patch fixes slave_update() not to copy the potentially uninitialized values when an error is returned from the slave get() callback, and to propagate the error value properly.
--- sound/core/vmaster.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
sound/core/vmaster.c +4 -1
@@ -68,10 +68,13 @@ static int slave_update(struct link_slavreturn -ENOMEM ; uctl->id = slave->slave.id; err = slave->slave.get (&slave->slave, uctl); +if (err <0 ) + goto error;for (ch =0 ; ch < slave->info.count; ch++) slave->vals[ch] = uctl->value.integer.value[ch]; + error:kfree (uctl); -return 0 ; +return err <0 ? err :0 ; }/* get the slave ctl info and save the initial values */
Greg Kroah-Hartman
maintainerPATCH 303/329 dmaengine: pl330: fix a race condition in case of threaded irqs
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qi Hou <[email protected]>
[ Upstream commit a3ca831249ca8c4c226e4ceafee04e280152e59d ]
When booting up with "threadirqs" in command line, all irq handlers of the DMA controller pl330 will be threaded forcedly. These threads will race for the same list, pl330->req_done.
Before the callback, the spinlock was released. And after it, the spinlock was taken. This opened an race window where another threaded irq handler could steal the spinlock and be permitted to delete entries of the list, pl330->req_done.
If the later deleted an entry that was still referred to by the former, there would be a kernel panic when the former was scheduled and tried to get the next sibling of the deleted entry.
The scenario could be depicted as below:
Thread: T1 pl330->req_done Thread: T2
| | |
| -A-B-C-D- |
Locked | |
| | Waiting
Del A | |
| -B-C-D- |
Unlocked | |
| | Locked
Waiting | |
| | Del B
| | |
| -C-D- Unlocked
Waiting | |
|
Locked
| get C via B
\
- Kernel panic
The kernel panic looked like as below:
Unable to handle kernel paging request at virtual address dead000000000108 pgd = ffffff8008c9e000 [dead000000000108] *pgd=000000027fffe003, *pud=000000027fffe003, *pmd=0000000000000000 Internal error: Oops: 96000044 [#1] PREEMPT SMP Modules linked in: CPU: 0 PID: 85 Comm: irq/59-66330000 Not tainted 4.8.24-WR9.0.0.12_standard #2 Hardware name: Broadcom NS2 SVK (DT) task: ffffffc1f5cc3c00 task.stack: ffffffc1f5ce0000 PC is at pl330_irq_handler+0x27c/0x390 LR is at pl330_irq_handler+0x2a8/0x390 pc : [<ffffff80084cb694>] lr : [<ffffff80084cb6c0>] pstate: 800001c5
sp : ffffffc1f5ce3d00
x29: ffffffc1f5ce3d00 x28: 0000000000000140
x27: ffffffc1f5c530b0 x26: dead000000000100
x25: dead000000000200 x24: 0000000000418958
x23: 0000000000000001 x22: ffffffc1f5ccd668
x21: ffffffc1f5ccd590 x20: ffffffc1f5ccd418
x19: dead000000000060 x18: 0000000000000001
x17: 0000000000000007 x16: 0000000000000001
x15: ffffffffffffffff x14: ffffffffffffffff
x13: ffffffffffffffff x12: 0000000000000000
x11: 0000000000000001 x10: 0000000000000840
x9 : ffffffc1f5ce0000 x8 : ffffffc1f5cc3338
x7 : ffffff8008ce2020 x6 : 0000000000000000
x5 : 0000000000000000 x4 : 0000000000000001
x3 : dead000000000200 x2 : dead000000000100
x1 : 0000000000000140 x0 : ffffffc1f5ccd590
Process irq/59-66330000 (pid: 85, stack limit = 0xffffffc1f5ce0020)
Stack: (0xffffffc1f5ce3d00 to 0xffffffc1f5ce4000)
3d00: ffffffc1f5ce3d80 ffffff80080f09d0 ffffffc1f5ca0c00 ffffffc1f6f7c600 3d20: ffffffc1f5ce0000 ffffffc1f6f7c600 ffffffc1f5ca0c00 ffffff80080f0998 3d40: ffffffc1f5ce0000 ffffff80080f0000 0000000000000000 0000000000000000 3d60: ffffff8008ce202c ffffff8008ce2020 ffffffc1f5ccd668 ffffffc1f5c530b0 3d80: ffffffc1f5ce3db0 ffffff80080f0d70 ffffffc1f5ca0c40 0000000000000001 3da0: ffffffc1f5ce0000 ffffff80080f0cfc ffffffc1f5ce3e20 ffffff80080bf4f8 3dc0: ffffffc1f5ca0c80 ffffff8008bf3798 ffffff8008955528 ffffffc1f5ca0c00 3de0: ffffff80080f0c30 0000000000000000 0000000000000000 0000000000000000 3e00: 0000000000000000 0000000000000000 0000000000000000 ffffff80080f0b68 3e20: 0000000000000000 ffffff8008083690 ffffff80080bf420 ffffffc1f5ca0c80 3e40: 0000000000000000 0000000000000000 0000000000000000 ffffff80080cb648 3e60: ffffff8008b1c780 0000000000000000 0000000000000000 ffffffc1f5ca0c00 3e80: ffffffc100000000 ffffff8000000000 ffffffc1f5ce3e90 ffffffc1f5ce3e90 3ea0: 0000000000000000 ffffff8000000000 ffffffc1f5ce3eb0 ffffffc1f5ce3eb0 3ec0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 3ee0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 3f00: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 3f20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 3f40: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 3f60: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 3f80: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 3fa0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 3fc0: 0000000000000000 0000000000000005 0000000000000000 0000000000000000 3fe0: 0000000000000000 0000000000000000 0000000275ce3ff0 0000000275ce3ff8
Call trace: Exception stack(0xffffffc1f5ce3b30 to 0xffffffc1f5ce3c60)
3b20: dead000000000060 0000008000000000
3b40: ffffffc1f5ce3d00 ffffff80084cb694 0000000000000008 0000000000000e88 3b60: ffffffc1f5ce3bb0 ffffff80080dac68 ffffffc1f5ce3b90 ffffff8008826fe4 3b80: 00000000000001c0 00000000000001c0 ffffffc1f5ce3bb0 ffffff800848dfcc 3ba0: 0000000000020000 ffffff8008b15ae4 ffffffc1f5ce3c00 ffffff800808f000 3bc0: 0000000000000010 ffffff80088377f0 ffffffc1f5ccd590 0000000000000140 3be0: dead000000000100 dead000000000200 0000000000000001 0000000000000000 3c00: 0000000000000000 ffffff8008ce2020 ffffffc1f5cc3338 ffffffc1f5ce0000 3c20: 0000000000000840 0000000000000001 0000000000000000 ffffffffffffffff 3c40: ffffffffffffffff ffffffffffffffff 0000000000000001 0000000000000007
[<ffffff80084cb694>] pl330_irq_handler+0x27c/0x390 [<ffffff80080f09d0>] irq_forced_thread_fn+0x38/0x88 [<ffffff80080f0d70>] irq_thread+0x140/0x200 [<ffffff80080bf4f8>] kthread+0xd8/0xf0 [<ffffff8008083690>] ret_from_fork+0x10/0x40 Code: f2a00838 f9405763 aa1c03e1 aa1503e0 (f9000443) ---[ end trace f50005726d31199c ]--- Kernel panic - not syncing: Fatal exception in interrupt
SMP: stopping secondary CPUs
SMP: failed to stop secondary CPUs 0-1
Kernel Offset: disabled
Memory Limit: none
---[ end Kernel panic - not syncing: Fatal exception in interrupt
To fix this, re-start with the list-head after dropping the lock then re-takeing it.
--- drivers/dma/pl330.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/dma/pl330.c +4 -2
@@ -1570,7 +1570,7 @@ static void pl330_dotask(unsigned long d/* Returns 1 if state was updated, 0 otherwise */ static int pl330_update (struct pl330_dmac *pl330) { -struct dma_pl330_desc *descdone, *tmp; +struct dma_pl330_desc *descdone;unsigned long flags;void __iomem *regs;u32 val;
@@ -1648,7 +1648,9 @@ static int pl330_update(struct pl330_dma }/* Now that we are in no hurry, do the callbacks */ -list_for_each_entry_safe (descdone, tmp, &pl330->req_done, rqd) { +while (!list_empty (&pl330->req_done)) { + descdone =list_first_entry (&pl330->req_done, + struct dma_pl330_desc, rqd);list_del (&descdone->rqd);spin_unlock_irqrestore (&pl330->lock, flags);dma_pl330_rqcb (descdone,PL330_ERR_NONE );
Greg Kroah-Hartman
maintainerPATCH 304/329 dmaengine: rcar-dmac: Check the done lists in rcar_dmac_chan_get_residue()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yoshihiro Shimoda <[email protected]>
[ Upstream commit 3e081628d510b2ddbe493371d9c574d9275da17e ]
This patch fixes an issue that a race condition happens between a client driver and the rcar-dmac driver:
- The rcar_dmac_isr_transfer_end() is called.
- The done list appears, and desc.running is the next active list.
- rcar_dmac_chan_get_residue() is called by a client driver before rcar_dmac_isr_channel_thread() is called.
- The rcar_dmac_chan_get_residue() will not find any descriptors.
- And, the following WARNING happens:
WARN(1, "No descriptor for cookie!");
The sh-sci driver with HSCIF (921,600bps) on R-Car H3 can cause this situation.
So, this patch checks the done lists in rcar_dmac_chan_get_residue() and returns zero if the done lists has the argument cookie.
--- drivers/dma/sh/rcar-dmac.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/dma/sh/rcar-dmac.c +9 -0
@@ -1246,8 +1246,17 @@ static unsigned int rcar_dmac_chan_get_r* If the cookie doesn't correspond to the currently running transfer * then the descriptor hasn't been processed yet, and the residue is * equal to the full descriptor size. +* Also, a client driver is possible to call this function before +* rcar_dmac_isr_channel_thread() runs. In this case, the "desc.running" +* will be the next descriptor, and the done list will appear. So, if +* the argument cookie matches the done list's cookie, we can assume +* the residue is zero. */ if (cookie != desc->async_tx.cookie) { +list_for_each_entry (desc, &chan->desc.done, node) { +if (cookie == desc->async_tx.cookie) +return 0 ; + }list_for_each_entry (desc, &chan->desc.pending, node) {if (cookie == desc->async_tx.cookie)return desc->size;
Greg Kroah-Hartman
maintainerPATCH 305/329 enic: enable rq before updating rq descriptors
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Govindarajulu Varadarajan <[email protected]>
[ Upstream commit e8588e268509292550634d9a35f2723a207683b2 ]
rq should be enabled before posting the buffers to rq desc. If not hw sees stale value and casuses DMAR errors.
--- drivers/net/ethernet/cisco/enic/enic_main.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/ethernet/cisco/enic/enic_main.c +7 -3
@@ -1726,6 +1726,8 @@ static int enic_open(struct net_device * }for (i =0 ; i < enic->rq_count; i++) { +/* enable rq before updating rq desc */ +vnic_rq_enable (&enic->rq[i]);vnic_rq_fill (&enic->rq[i], enic_rq_alloc_buf);/* Need at least one buffer on ring to get going */ if (vnic_rq_desc_used (&enic->rq[i]) ==0 ) {
@@ -1737,8 +1739,6 @@ static int enic_open(struct net_device *for (i =0 ; i < enic->wq_count; i++)vnic_wq_enable (&enic->wq[i]); -for (i =0 ; i < enic->rq_count; i++) -vnic_rq_enable (&enic->rq[i]);if (!enic_is_dynamic (enic) && !enic_is_sriov_vf (enic))enic_dev_add_station_addr (enic);
@@ -1765,8 +1765,12 @@ static int enic_open(struct net_device *return 0 ; err_out_free_rq: -for (i =0 ; i < enic->rq_count; i++) +for (i =0 ; i < enic->rq_count; i++) { + err =vnic_rq_disable (&enic->rq[i]); +if (err) +return err;vnic_rq_clean (&enic->rq[i], enic_free_rq_buf); + }enic_dev_notify_unset (enic); err_out_free_intr:enic_unset_affinity_hint (enic);
Greg Kroah-Hartman
maintainerPATCH 306/329 hwrng: stm32 - add reset during probe
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: "[email protected]" <[email protected]>
[ Upstream commit 326ed382256475aa4b8b7eae8a2f60689fd25e78 ]
Avoid issue when probing the RNG without
reset if bad status has been detected previously
--- drivers/char/hw_random/stm32-rng.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/char/hw_random/stm32-rng.c +9 -0
@@ -21,6 +21,7 @@#include <linux/of_address.h> #include <linux/of_platform.h> #include <linux/pm_runtime.h> +#include <linux/reset.h> #include <linux/slab.h> #define RNG_CR 0x00
@@ -46,6 +47,7 @@ struct stm32_rng_private {struct hwrng rng;void __iomem *base;struct clk *clk; +struct reset_control *rst; };static int stm32_rng_read (struct hwrng *rng,void *data,size_t max,bool wait)
@@ -140,6 +142,13 @@ static int stm32_rng_probe(struct platfoif (IS_ERR (priv->clk))return PTR_ERR (priv->clk); + priv->rst =devm_reset_control_get (&ofdev->dev,NULL ); +if (!IS_ERR (priv->rst)) { +reset_control_assert (priv->rst); +udelay (2 ); +reset_control_deassert (priv->rst); + } +dev_set_drvdata (dev, priv); priv->rng.name = dev_driver_string(dev),
Greg Kroah-Hartman
maintainerPATCH 307/329 dmaengine: qcom: bam_dma: get num-channels and num-ees from dt
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Kandagatla <[email protected]>
[ Upstream commit 48d163b1aa6e7f650c0b7a4f9c61c387a6def868 ]
When Linux is master of BAM, it can directly read registers to know number of supported channels, however when its remotely controlled reading these registers would trigger a crash if the BAM is not yet initialized or powered up on the remote side.
This patch allows driver to read num-channels and num-ees from Device Tree for remotely controlled BAM.
--- drivers/dma/qcom/bam_dma.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-)
drivers/dma/qcom/bam_dma.c +22 -5
@@ -387,6 +387,7 @@ struct bam_device {struct device_dma_parameters dma_parms;struct bam_chan *channels;u32 num_channels; +u32 num_ees;/* execution environment ID, from DT */ u32 ee;
@@ -1076,15 +1077,19 @@ static int bam_init(struct bam_device *bu32 val;/* read revision and configuration information */ - val =readl_relaxed (bam_addr (bdev,0 ,BAM_REVISION )) >>NUM_EES_SHIFT ; - val &=NUM_EES_MASK ; +if (!bdev->num_ees) { + val =readl_relaxed (bam_addr (bdev,0 ,BAM_REVISION )); + bdev->num_ees = (val >>NUM_EES_SHIFT ) &NUM_EES_MASK ; + }/* check that configured EE is within range */ -if (bdev->ee >= val) +if (bdev->ee >= bdev->num_ees)return -EINVAL ; - val =readl_relaxed (bam_addr (bdev,0 ,BAM_NUM_PIPES )); - bdev->num_channels = val &BAM_NUM_PIPES_MASK ; +if (!bdev->num_channels) { + val =readl_relaxed (bam_addr (bdev,0 ,BAM_NUM_PIPES )); + bdev->num_channels = val &BAM_NUM_PIPES_MASK ; + }if (bdev->controlled_remotely)return 0 ;
@@ -1179,6 +1184,18 @@ static int bam_dma_probe(struct platform bdev->controlled_remotely =of_property_read_bool (pdev->dev.of_node,"qcom,controlled-remotely" ); +if (bdev->controlled_remotely) { + ret =of_property_read_u32 (pdev->dev.of_node,"num-channels" , + &bdev->num_channels); +if (ret) +dev_err (bdev->dev,"num-channels unspecified in dt\n" ); + + ret =of_property_read_u32 (pdev->dev.of_node,"qcom,num-ees" , + &bdev->num_ees); +if (ret) +dev_err (bdev->dev,"num-ees unspecified in dt\n" ); + } + bdev->bamclk =devm_clk_get (bdev->dev,"bam_clk" );if (IS_ERR (bdev->bamclk))return PTR_ERR (bdev->bamclk);
Greg Kroah-Hartman
maintainerPATCH 308/329 net: stmmac: ensure that the device has released ownership before reading data
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <[email protected]>
[ Upstream commit a6b25da5e7ba212af5826a662e6a035a79bffabd ]
According to Documentation/memory-barriers.txt, we need to use a dma_rmb() after reading the status/own bit, to ensure that all descriptor fields are read after reading the own bit.
This way, we ensure that the DMA engine is done with the DMA descriptor before we read the other descriptor fields, e.g. reading the tx hardware timestamp (if PTP is enabled).
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +5 -0
@@ -1343,6 +1343,11 @@ static void stmmac_tx_clean(struct stmmaif (unlikely (status & tx_dma_own))break ; +/* Make sure descriptor fields are read after reading +* the own bit. +*/ +dma_rmb (); +/* Just consider the last segment and ...*/ if (likely (!(status & tx_not_ls))) {/* ... verify the status error condition */
Greg Kroah-Hartman
maintainerPATCH 309/329 net: stmmac: ensure that the MSS desc is the last desc to set the own bit
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <[email protected]>
[ Upstream commit 15d2ee42a3087089e73ad52fd8c1b37ab496b87c ]
A dma_wmb() is used to guarantee the ordering, with respect to other writes, to cache coherent DMA memory.
There is a dma_wmb() in prepare_tx_desc()/prepare_tso_tx_desc() which ensures that TDES0/1/2 is written before TDES3 (which contains the own bit), for First Desc.
However, in the rare case that MSS changes, there will be a MSS context descriptor in front of the regular DMA descriptors:
<MSS desc> <- DMA Next Descriptor
<First Desc>
<desc n>
<Last Desc>
Thus, for this special case, we need a dma_wmb()
after prepare_tso_tx_desc()/before writing the own bit to the MSS desc, so that we flush the write to TDES3 for First Desc,
in order to ensure that the MSS descriptor is the last descriptor to set the own bit.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +8 -1
@@ -2141,8 +2141,15 @@ static netdev_tx_t stmmac_tso_xmit(struc tcp_hdrlen(skb) / 4, (skb->len - proto_hdr_len));/* If context desc is used to change MSS */ -if (mss_desc) +if (mss_desc) { +/* Make sure that first descriptor has been completely +* written, including its own bit. This is because MSS is +* actually before first descriptor, so we need to make +* sure that MSS's own bit is the last thing written. +*/ +dma_wmb (); priv->hw->desc->set_tx_owner (mss_desc); + }/* The own bit must be the latest setting done when prepare the * descriptor and then barrier is needed to make sure that
Greg Kroah-Hartman
maintainerPATCH 310/329 cpufreq: Reorder cpufreq_online() error code path
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Viresh Kumar <[email protected]>
[ Upstream commit b24b6478e65f140610ab1ffaadc7bc6bf0be8aad ]
Ideally the de-allocation of resources should happen in the exact opposite order in which they were allocated. It helps maintain the code in long term, even if nothing really breaks with incorrect ordering.
That wasn't followed in cpufreq_online() and it has some inconsistencies. For example, the symlinks were created from within the locked region while they are removed only after putting the locks. Also ->exit() should have been called only after the symlinks are removed and the lock is dropped, as that was the case when ->init() was first called.
--- drivers/cpufreq/cpufreq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/cpufreq/cpufreq.c +3 -3
@@ -1288,14 +1288,14 @@ static int cpufreq_online(unsigned int creturn 0 ; out_exit_policy: +for_each_cpu (j, policy->real_cpus) +remove_cpu_dev_symlink (policy,get_cpu_device (j)); +up_write (&policy->rwsem);if (cpufreq_driver->exit) cpufreq_driver->exit (policy); -for_each_cpu (j, policy->real_cpus) -remove_cpu_dev_symlink (policy,get_cpu_device (j)); - out_free_policy:cpufreq_policy_free (policy, !new_policy);return ret;
Greg Kroah-Hartman
maintainerPATCH 311/329 PCI: Add function 1 DMA alias quirk for Marvell 88SE9220
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Vincent-Cross <[email protected]>
[ Upstream commit 832e4e1f76b8a84991e9db56fdcef1ebce839b8b ]
Add Marvell 88SE9220 DMA quirk as found and tested on bug 42679.
--- drivers/pci/quirks.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/pci/quirks.c +3 -0
@@ -3874,6 +3874,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_M/* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c46 */ DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_MARVELL_EXT ,0x91a0 , quirk_dma_func1_alias); +/* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c127 */ +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_MARVELL_EXT ,0x9220 , + quirk_dma_func1_alias);/* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c49 */ DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_MARVELL_EXT ,0x9230 , quirk_dma_func1_alias);
Greg Kroah-Hartman
maintainerPATCH 313/329 ARM: dts: bcm283x: Fix probing of bcm2835-i2s
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Wahren <[email protected]>
[ Upstream commit 79c81facdc0b43b1cef37b8d5689a8c8b78f8be0 ]
Since 517e7a1537a ("ASoC: bcm2835: move to use the clock framework") the bcm2835-i2s requires a clock as DT property. Unfortunately the necessary DT change has never been applied. While we are at it also fix the first PCM register range to cover the PCM_GRAY register.
--- arch/arm/boot/dts/bcm283x.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/bcm283x.dtsi +2 -2
@@ -146,8 +146,8 @@ i2s: i2s@7e203000 { compatible = "brcm,bcm2835-i2s"; - reg = <0x7e203000 0x20>, - <0x7e101098 0x02>; + reg = <0x7e203000 0x24>; + clocks = <&clocks BCM2835_CLOCK_PCM>; dmas = <&dma 2>, <&dma 3>;
Greg Kroah-Hartman
maintainerPATCH 314/329 audit: return on memory error to avoid null pointer dereference
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Guy Briggs <[email protected]>
[ Upstream commit 23138ead270045f1b3e912e667967b6094244999 ]
If there is a memory allocation error when trying to change an audit kernel feature value, the ignored allocation error will trigger a NULL pointer dereference oops on subsequent use of that pointer. Return instead.
Passes audit-testsuite.
See: https://github.com/linux-audit/audit-kernel/issues/76
--- kernel/audit.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/audit.c +2 -0
@@ -742,6 +742,8 @@ static void audit_log_feature_change(intreturn ; ab =audit_log_start (NULL ,GFP_KERNEL ,AUDIT_FEATURE_CHANGE ); +if (!ab) +return ;audit_log_task_info (ab, current); audit_log_format(ab, " feature=%s old=%u new=%u old_lock=%u new_lock=%u res=%d", audit_feature_names[which], !!old_feature, !!new_feature,
Greg Kroah-Hartman
maintainerPATCH 315/329 rcu: Call touch_nmi_watchdog() while printing stall warnings
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
[ Upstream commit 3caa973b7a260e7a2a69edc94c300ab9c65148c3 ]
When RCU stall warning triggers, it can print out a lot of messages while holding spinlocks. If the console device is slow (e.g. an actual or IPMI serial console), it may end up triggering NMI hard lockup watchdog like the following.
--- kernel/rcu/tree_plugin.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
kernel/rcu/tree_plugin.h +13 -1
@@ -521,8 +521,14 @@ static void rcu_print_detail_task_stall_ } t =list_entry (rnp->gp_tasks->prev, struct task_struct, rcu_node_entry); -list_for_each_entry_continue (t, &rnp->blkd_tasks, rcu_node_entry) +list_for_each_entry_continue (t, &rnp->blkd_tasks, rcu_node_entry) { +/* +* We could be printing a lot while holding a spinlock. +* Avoid triggering hard lockup. +*/ +touch_nmi_watchdog ();sched_show_task (t); + }raw_spin_unlock_irqrestore_rcu_node (rnp, flags); }
@@ -1629,6 +1635,12 @@ static void print_cpu_stall_info(structchar *ticks_title;unsigned long ticks_value; +/* +* We could be printing a lot while holding a spinlock. Avoid +* triggering hard lockup. +*/ +touch_nmi_watchdog (); +if (rsp->gpnum == rdp->gpnum) { ticks_title ="ticks this GP" ; ticks_value = rdp->ticks_this_gp;
Greg Kroah-Hartman
maintainerPATCH 316/329 pinctrl: sh-pfc: r8a7796: Fix MOD_SEL register pin assignment for SSI pins group
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takeshi Kihara <[email protected]>
[ Upstream commit b418c4609d5052d174668ad6d13efe023c45c595 ]
This patch fixes MOD_SEL1 bit20 and MOD_SEL2 bit20, bit21 pin assignment for SSI pins group.
This is a correction to the incorrect implementation of MOD_SEL register pin assignment for R8A7796 SoC specification of R-Car Gen3 Hardware User's Manual Rev.0.51E or later.
--- drivers/pinctrl/sh-pfc/pfc-r8a7796.c | 40 +++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-)
drivers/pinctrl/sh-pfc/pfc-r8a7796.c +20 -20
@@ -1,7 +1,7 @@/* * R8A7796 processor support - PFC hardware block. * -* Copyright (C) 2016 Renesas Electronics Corp. +* Copyright (C) 2016-2017 Renesas Electronics Corp. * * This file is based on the drivers/pinctrl/sh-pfc/pfc-r8a7795.c *
@@ -476,7 +476,7 @@ FM(IP16_31_28) IP16_31_28 FM(IP17_31_28)#define MOD_SEL1_26 FM(SEL_TIMER_TMU_0) FM(SEL_TIMER_TMU_1)#define MOD_SEL1_25_24 FM(SEL_SSP1_1_0) FM(SEL_SSP1_1_1) FM(SEL_SSP1_1_2) FM(SEL_SSP1_1_3)#define MOD_SEL1_23_22_21 FM(SEL_SSP1_0_0) FM(SEL_SSP1_0_1) FM(SEL_SSP1_0_2) FM(SEL_SSP1_0_3) FM(SEL_SSP1_0_4) F_(0, 0) F_(0, 0) F_(0, 0) -#define MOD_SEL1_20 FM(SEL_SSI_0) FM(SEL_SSI_1) +#define MOD_SEL1_20 FM(SEL_SSI1_0) FM(SEL_SSI1_1)#define MOD_SEL1_19 FM(SEL_SPEED_PULSE_0) FM(SEL_SPEED_PULSE_1)#define MOD_SEL1_18_17 FM(SEL_SIMCARD_0) FM(SEL_SIMCARD_1) FM(SEL_SIMCARD_2) FM(SEL_SIMCARD_3)#define MOD_SEL1_16 FM(SEL_SDHI2_0) FM(SEL_SDHI2_1)
@@ -1208,7 +1208,7 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP13_11_8 ,HSCK0 ),PINMUX_IPSR_MSEL (IP13_11_8 ,MSIOF1_SCK_D ,SEL_MSIOF1_3 ),PINMUX_IPSR_MSEL (IP13_11_8 ,AUDIO_CLKB_A ,SEL_ADG_B_0 ), -PINMUX_IPSR_MSEL (IP13_11_8 ,SSI_SDATA1_B ,SEL_SSI_1 ), +PINMUX_IPSR_MSEL (IP13_11_8 ,SSI_SDATA1_B ,SEL_SSI1_1 ),PINMUX_IPSR_MSEL (IP13_11_8 ,TS_SCK0_D ,SEL_TSIF0_3 ),PINMUX_IPSR_MSEL (IP13_11_8 ,STP_ISCLK_0_D ,SEL_SSP1_0_3 ), PINMUX_IPSR_MSEL(IP13_11_8, RIF0_CLK_C, SEL_DRIF0_2),
@@ -1216,14 +1216,14 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP13_15_12 ,HRX0 ),PINMUX_IPSR_MSEL (IP13_15_12 ,MSIOF1_RXD_D ,SEL_MSIOF1_3 ), -PINMUX_IPSR_MSEL (IP13_15_12 ,SSI_SDATA2_B ,SEL_SSI_1 ), +PINMUX_IPSR_MSEL (IP13_15_12 ,SSI_SDATA2_B ,SEL_SSI2_1 ),PINMUX_IPSR_MSEL (IP13_15_12 ,TS_SDEN0_D ,SEL_TSIF0_3 ),PINMUX_IPSR_MSEL (IP13_15_12 ,STP_ISEN_0_D ,SEL_SSP1_0_3 ),PINMUX_IPSR_MSEL (IP13_15_12 ,RIF0_D0_C ,SEL_DRIF0_2 ),PINMUX_IPSR_GPSR (IP13_19_16 ,HTX0 ),PINMUX_IPSR_MSEL (IP13_19_16 ,MSIOF1_TXD_D ,SEL_MSIOF1_3 ), -PINMUX_IPSR_MSEL (IP13_19_16 ,SSI_SDATA9_B ,SEL_SSI_1 ), +PINMUX_IPSR_MSEL (IP13_19_16 ,SSI_SDATA9_B ,SEL_SSI9_1 ),PINMUX_IPSR_MSEL (IP13_19_16 ,TS_SDAT0_D ,SEL_TSIF0_3 ),PINMUX_IPSR_MSEL (IP13_19_16 ,STP_ISD_0_D ,SEL_SSP1_0_3 ), PINMUX_IPSR_MSEL(IP13_19_16, RIF0_D1_C, SEL_DRIF0_2),
@@ -1231,7 +1231,7 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP13_23_20 ,HCTS0_N ),PINMUX_IPSR_MSEL (IP13_23_20 ,RX2_B ,SEL_SCIF2_1 ),PINMUX_IPSR_MSEL (IP13_23_20 ,MSIOF1_SYNC_D ,SEL_MSIOF1_3 ), -PINMUX_IPSR_MSEL (IP13_23_20 ,SSI_SCK9_A ,SEL_SSI_0 ), +PINMUX_IPSR_MSEL (IP13_23_20 ,SSI_SCK9_A ,SEL_SSI9_0 ),PINMUX_IPSR_MSEL (IP13_23_20 ,TS_SPSYNC0_D ,SEL_TSIF0_3 ),PINMUX_IPSR_MSEL (IP13_23_20 ,STP_ISSYNC_0_D ,SEL_SSP1_0_3 ), PINMUX_IPSR_MSEL(IP13_23_20, RIF0_SYNC_C, SEL_DRIF0_2),
@@ -1240,7 +1240,7 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP13_27_24 ,HRTS0_N ),PINMUX_IPSR_MSEL (IP13_27_24 ,TX2_B ,SEL_SCIF2_1 ),PINMUX_IPSR_MSEL (IP13_27_24 ,MSIOF1_SS1_D ,SEL_MSIOF1_3 ), -PINMUX_IPSR_MSEL (IP13_27_24 ,SSI_WS9_A ,SEL_SSI_0 ), +PINMUX_IPSR_MSEL (IP13_27_24 ,SSI_WS9_A ,SEL_SSI9_0 ),PINMUX_IPSR_MSEL (IP13_27_24 ,STP_IVCXO27_0_D ,SEL_SSP1_0_3 ),PINMUX_IPSR_MSEL (IP13_27_24 ,BPFCLK_A ,SEL_FM_0 ), PINMUX_IPSR_GPSR(IP13_27_24, AUDIO_CLKOUT2_A),
@@ -1255,7 +1255,7 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_MSEL (IP14_3_0 ,RX5_A ,SEL_SCIF5_0 ),PINMUX_IPSR_MSEL (IP14_3_0 ,NFWP_N_A ,SEL_NDF_0 ),PINMUX_IPSR_MSEL (IP14_3_0 ,AUDIO_CLKA_C ,SEL_ADG_A_2 ), -PINMUX_IPSR_MSEL (IP14_3_0 ,SSI_SCK2_A ,SEL_SSI_0 ), +PINMUX_IPSR_MSEL (IP14_3_0 ,SSI_SCK2_A ,SEL_SSI2_0 ),PINMUX_IPSR_MSEL (IP14_3_0 ,STP_IVCXO27_0_C ,SEL_SSP1_0_2 ),PINMUX_IPSR_GPSR (IP14_3_0 ,AUDIO_CLKOUT3_A ), PINMUX_IPSR_MSEL(IP14_3_0, TCLK1_B, SEL_TIMER_TMU_1),
@@ -1264,7 +1264,7 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_MSEL (IP14_7_4 ,TX5_A ,SEL_SCIF5_0 ),PINMUX_IPSR_MSEL (IP14_7_4 ,MSIOF1_SS2_D ,SEL_MSIOF1_3 ),PINMUX_IPSR_MSEL (IP14_7_4 ,AUDIO_CLKC_A ,SEL_ADG_C_0 ), -PINMUX_IPSR_MSEL (IP14_7_4 ,SSI_WS2_A ,SEL_SSI_0 ), +PINMUX_IPSR_MSEL (IP14_7_4 ,SSI_WS2_A ,SEL_SSI2_0 ),PINMUX_IPSR_MSEL (IP14_7_4 ,STP_OPWM_0_D ,SEL_SSP1_0_3 ),PINMUX_IPSR_GPSR (IP14_7_4 ,AUDIO_CLKOUT_D ), PINMUX_IPSR_MSEL(IP14_7_4, SPEEDIN_B, SEL_SPEED_PULSE_1),
@@ -1292,10 +1292,10 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_MSEL (IP14_31_28 ,MSIOF1_SS2_F ,SEL_MSIOF1_5 ),/* IPSR15 */ -PINMUX_IPSR_MSEL (IP15_3_0 ,SSI_SDATA1_A ,SEL_SSI_0 ), +PINMUX_IPSR_MSEL (IP15_3_0 ,SSI_SDATA1_A ,SEL_SSI1_0 ), -PINMUX_IPSR_MSEL (IP15_7_4 ,SSI_SDATA2_A ,SEL_SSI_0 ), -PINMUX_IPSR_MSEL (IP15_7_4 ,SSI_SCK1_B ,SEL_SSI_1 ), +PINMUX_IPSR_MSEL (IP15_7_4 ,SSI_SDATA2_A ,SEL_SSI2_0 ), +PINMUX_IPSR_MSEL (IP15_7_4 ,SSI_SCK1_B ,SEL_SSI1_1 ),PINMUX_IPSR_GPSR (IP15_11_8 ,SSI_SCK34 ), PINMUX_IPSR_MSEL(IP15_11_8, MSIOF1_SS1_A, SEL_MSIOF1_0),
@@ -1381,11 +1381,11 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_MSEL (IP16_27_24 ,RIF1_D1_A ,SEL_DRIF1_0 ),PINMUX_IPSR_MSEL (IP16_27_24 ,RIF3_D1_A ,SEL_DRIF3_0 ), -PINMUX_IPSR_MSEL (IP16_31_28 ,SSI_SDATA9_A ,SEL_SSI_0 ), +PINMUX_IPSR_MSEL (IP16_31_28 ,SSI_SDATA9_A ,SEL_SSI9_0 ),PINMUX_IPSR_MSEL (IP16_31_28 ,HSCK2_B ,SEL_HSCIF2_1 ),PINMUX_IPSR_MSEL (IP16_31_28 ,MSIOF1_SS1_C ,SEL_MSIOF1_2 ),PINMUX_IPSR_MSEL (IP16_31_28 ,HSCK1_A ,SEL_HSCIF1_0 ), -PINMUX_IPSR_MSEL (IP16_31_28 ,SSI_WS1_B ,SEL_SSI_1 ), +PINMUX_IPSR_MSEL (IP16_31_28 ,SSI_WS1_B ,SEL_SSI1_1 ),PINMUX_IPSR_GPSR (IP16_31_28 ,SCK1 ),PINMUX_IPSR_MSEL (IP16_31_28 ,STP_IVCXO27_1_A ,SEL_SSP1_1_0 ), PINMUX_IPSR_GPSR(IP16_31_28, SCK5_A),
@@ -1417,7 +1417,7 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP17_19_16 ,USB1_PWEN ),PINMUX_IPSR_MSEL (IP17_19_16 ,SIM0_CLK_C ,SEL_SIMCARD_2 ), -PINMUX_IPSR_MSEL (IP17_19_16 ,SSI_SCK1_A ,SEL_SSI_0 ), +PINMUX_IPSR_MSEL (IP17_19_16 ,SSI_SCK1_A ,SEL_SSI1_0 ),PINMUX_IPSR_MSEL (IP17_19_16 ,TS_SCK0_E ,SEL_TSIF0_4 ),PINMUX_IPSR_MSEL (IP17_19_16 ,STP_ISCLK_0_E ,SEL_SSP1_0_4 ), PINMUX_IPSR_MSEL(IP17_19_16, FMCLK_B, SEL_FM_1),
@@ -1427,7 +1427,7 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP17_23_20 ,USB1_OVC ),PINMUX_IPSR_MSEL (IP17_23_20 ,MSIOF1_SS2_C ,SEL_MSIOF1_2 ), -PINMUX_IPSR_MSEL (IP17_23_20 ,SSI_WS1_A ,SEL_SSI_0 ), +PINMUX_IPSR_MSEL (IP17_23_20 ,SSI_WS1_A ,SEL_SSI1_0 ),PINMUX_IPSR_MSEL (IP17_23_20 ,TS_SDAT0_E ,SEL_TSIF0_4 ),PINMUX_IPSR_MSEL (IP17_23_20 ,STP_ISD_0_E ,SEL_SSP1_0_4 ), PINMUX_IPSR_MSEL(IP17_23_20, FMIN_B, SEL_FM_1),
@@ -1437,7 +1437,7 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP17_27_24 ,USB30_PWEN ),PINMUX_IPSR_GPSR (IP17_27_24 ,AUDIO_CLKOUT_B ), -PINMUX_IPSR_MSEL (IP17_27_24 ,SSI_SCK2_B ,SEL_SSI_1 ), +PINMUX_IPSR_MSEL (IP17_27_24 ,SSI_SCK2_B ,SEL_SSI2_1 ),PINMUX_IPSR_MSEL (IP17_27_24 ,TS_SDEN1_D ,SEL_TSIF1_3 ),PINMUX_IPSR_MSEL (IP17_27_24 ,STP_ISEN_1_D ,SEL_SSP1_1_2 ), PINMUX_IPSR_MSEL(IP17_27_24, STP_OPWM_0_E, SEL_SSP1_0_4),
@@ -1449,7 +1449,7 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP17_31_28 ,USB30_OVC ),PINMUX_IPSR_GPSR (IP17_31_28 ,AUDIO_CLKOUT1_B ), -PINMUX_IPSR_MSEL (IP17_31_28 ,SSI_WS2_B ,SEL_SSI_1 ), +PINMUX_IPSR_MSEL (IP17_31_28 ,SSI_WS2_B ,SEL_SSI2_1 ),PINMUX_IPSR_MSEL (IP17_31_28 ,TS_SPSYNC1_D ,SEL_TSIF1_3 ),PINMUX_IPSR_MSEL (IP17_31_28 ,STP_ISSYNC_1_D ,SEL_SSP1_1_3 ), PINMUX_IPSR_MSEL(IP17_31_28, STP_IVCXO27_0_E, SEL_SSP1_0_4),
@@ -1460,7 +1460,7 @@ static const u16 pinmux_data[] = {/* IPSR18 */ PINMUX_IPSR_GPSR (IP18_3_0 ,GP6_30 ),PINMUX_IPSR_GPSR (IP18_3_0 ,AUDIO_CLKOUT2_B ), -PINMUX_IPSR_MSEL (IP18_3_0 ,SSI_SCK9_B ,SEL_SSI_1 ), +PINMUX_IPSR_MSEL (IP18_3_0 ,SSI_SCK9_B ,SEL_SSI9_1 ),PINMUX_IPSR_MSEL (IP18_3_0 ,TS_SDEN0_E ,SEL_TSIF0_4 ),PINMUX_IPSR_MSEL (IP18_3_0 ,STP_ISEN_0_E ,SEL_SSP1_0_4 ), PINMUX_IPSR_MSEL(IP18_3_0, RIF2_D0_B, SEL_DRIF2_1),
@@ -1471,7 +1471,7 @@ static const u16 pinmux_data[] = {PINMUX_IPSR_GPSR (IP18_7_4 ,GP6_31 ),PINMUX_IPSR_GPSR (IP18_7_4 ,AUDIO_CLKOUT3_B ), -PINMUX_IPSR_MSEL (IP18_7_4 ,SSI_WS9_B ,SEL_SSI_1 ), +PINMUX_IPSR_MSEL (IP18_7_4 ,SSI_WS9_B ,SEL_SSI9_1 ),PINMUX_IPSR_MSEL (IP18_7_4 ,TS_SPSYNC0_E ,SEL_TSIF0_4 ),PINMUX_IPSR_MSEL (IP18_7_4 ,STP_ISSYNC_0_E ,SEL_SSP1_0_4 ), PINMUX_IPSR_MSEL(IP18_7_4, RIF2_D1_B, SEL_DRIF2_1),
Greg Kroah-Hartman
maintainerPATCH 317/329 MIPS: Octeon: Fix logging messages with spurious periods after newlines
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Perches <[email protected]>
[ Upstream commit db6775ca6e0353d2618ca7d5e210fc36ad43bbd4 ]
Using a period after a newline causes bad output.
Patchwork: https://patchwork.linux-mips.org/patch/17886/
--- arch/mips/cavium-octeon/octeon-irq.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/mips/cavium-octeon/octeon-irq.c +5 -5
@@ -2271,7 +2271,7 @@ static int __init octeon_irq_init_cib(st parent_irq =irq_of_parse_and_map (ciu_node,0 );if (!parent_irq) { -pr_err ("ERROR: Couldn't acquire parent_irq for %s\n." , +pr_err ("ERROR: Couldn't acquire parent_irq for %s\n" , ciu_node->name);return -EINVAL ; }
@@ -2283,7 +2283,7 @@ static int __init octeon_irq_init_cib(st addr =of_get_address (ciu_node,0 ,NULL ,NULL );if (!addr) { -pr_err ("ERROR: Couldn't acquire reg(0) %s\n." , ciu_node->name); +pr_err ("ERROR: Couldn't acquire reg(0) %s\n" , ciu_node->name);return -EINVAL ; } host_data->raw_reg = (u64)phys_to_virt(
@@ -2291,7 +2291,7 @@ static int __init octeon_irq_init_cib(st addr =of_get_address (ciu_node,1 ,NULL ,NULL );if (!addr) { -pr_err ("ERROR: Couldn't acquire reg(1) %s\n." , ciu_node->name); +pr_err ("ERROR: Couldn't acquire reg(1) %s\n" , ciu_node->name);return -EINVAL ; } host_data->en_reg = (u64)phys_to_virt(
@@ -2299,7 +2299,7 @@ static int __init octeon_irq_init_cib(st r =of_property_read_u32 (ciu_node,"cavium,max-bits" , &val);if (r) { -pr_err ("ERROR: Couldn't read cavium,max-bits from %s\n." , +pr_err ("ERROR: Couldn't read cavium,max-bits from %s\n" , ciu_node->name);return r; }
@@ -2309,7 +2309,7 @@ static int __init octeon_irq_init_cib(st &octeon_irq_domain_cib_ops, host_data);if (!cib_domain) { -pr_err ("ERROR: Couldn't irq_domain_add_linear()\n." ); +pr_err ("ERROR: Couldn't irq_domain_add_linear()\n" );return -ENOMEM ; }
Greg Kroah-Hartman
maintainerPATCH 319/329 x86/apic: Set up through-local-APIC mode on the boot CPU if noapic specified
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baoquan He <[email protected]>
[ Upstream commit bee3204ec3c49f6f53add9c3962c9012a5c036fa ]
Currently the kdump kernel becomes very slow if 'noapic' is specified. Normal kernel doesn't have this bug.
Kernel parameter 'noapic' is used to disable IO-APIC in system for testing or special purpose. Here the root cause is that in kdump kernel LAPIC is disabled since commit:
522e664644 ("x86/apic: Disable I/O APIC before shutdown of the local APIC")
In this case we need set up through-local-APIC on boot CPU in setup_local_APIC().
In normal kernel the legacy irq mode is enabled by the BIOS. If it is virtual wire mode, the local-APIC has been enabled and set as through-local-APIC.
Though we fixed the regression introduced by commit 522e664644, to further improve robustness set up the through-local-APIC mode explicitly, do not rely on the default boot IRQ mode.
--- arch/x86/kernel/apic/apic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/apic/apic.c +1 -1
@@ -1403,7 +1403,7 @@ void setup_local_APIC(void)* TODO: set up through-local-APIC from through-I/O-APIC? --macro */ value =apic_read (APIC_LVT0 ) &APIC_LVT_MASKED ; -if (!cpu && (pic_mode || !value)) { +if (!cpu && (pic_mode || !value || skip_ioapic_setup)) { value =APIC_DM_EXTINT ;apic_printk (APIC_VERBOSE ,"enabled ExtINT on CPU#%d\n" , cpu); }else {
Greg Kroah-Hartman
maintainerPATCH 320/329 perf tests: Use arch__compare_symbol_names to compare symbols
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Olsa <[email protected]>
[ Upstream commit ab6e9a99345131cd8e54268d1d0dc04a33f7ed11 ]
The symbol search called by machine__find_kernel_symbol_by_name is using internally arch__compare_symbol_names function to compare 2 symbol names, because different archs have different ways of comparing symbols. Mostly for skipping '.' prefixes and similar.
In test 1 when we try to find matching symbols in kallsyms and vmlinux, by address and by symbol name. When either is found we compare the pair symbol names by simple strcmp, which is not good enough for reasons explained in previous paragraph.
On powerpc this can cause lockup, because even thought we found the pair, the compared names are different and don't match simple strcmp. Following code path is executed, that leads to lockup:
- we find the pair in kallsyms by sym->startnext_pair:
- we compare the names and it fails
- we find the pair by sym->name
- the pair addresses match so we call goto next_pair because we assume the names match in this case
--- tools/perf/tests/vmlinux-kallsyms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/vmlinux-kallsyms.c +1 -1
@@ -123,7 +123,7 @@ int test__vmlinux_matches_kallsyms(int sif (pair &&UM (pair->start) == mem_start) { next_pair: -if (strcmp (sym->name, pair->name) ==0 ) { +if (arch__compare_symbol_names (sym->name, pair->name) ==0 ) {/* * kallsyms don't have the symbol end, so we * set that by using the next symbol start - 1,
Greg Kroah-Hartman
maintainerPATCH 321/329 perf report: Fix memory corruption in --branch-history mode --branch-history
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Olsa <[email protected]>
[ Upstream commit e3ebaa465136ecfedf9c6f4671df02bf625f8125 ]
Jin Yao reported memory corrupton in perf report with branch info used for stack trace:
Quoted 15 lines
Following command lines will cause perf crash.
perf record -j call -g -a <application>
perf report --branch-history*** Error in `perf': double free or corruption (!prev):
0x00000000104aa040*** ======= Backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(+0x77725)[0x7f6b37254725] /lib/x86_64-linux-gnu/libc.so.6(+0x7ff4a)[0x7f6b3725cf4a] /lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f6b37260abc] perf[0x51b914]
perf(hist_entry_iter__add+0x1e5)[0x51f305]
perf[0x43cf01]
perf[0x4fa3bf]
perf[0x4fa923]
Quoted 8 lines
perf[0x4fd396]
perf[0x4f9614] perf(perf_session__process_events+0x89e)[0x4fc38e] perf(cmd_report+0x15d2)[0x43f202]
perf[0x4a059f]
perf(main+0x631)[0x427b71] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f6b371fd830] perf(_start+0x29)[0x427d89]
For the cumulative output, we allocate the he_cache array based on the --max-stack option value and populate it with data from 'callchain_cursor'.
The --max-stack option value does not ensure now the limit for number of callchain_cursor nodes, so the cumulative iter code will allocate smaller array than it's actually needed and cause above corruption.
I think the --max-stack limit does not apply here anyway, because we add callchain data as normal hist entries, while the --max-stack control the limit of single entry callchain depth.
Using the callchain_cursor.nr as he_cache array count to fix this. Also removing struct hist_entry_iter::max_stack, because there's no longer any use for it.
We need more fixes to ensure that the branch stack code follows properly the logic of --max-stack, which is not the case at the moment.
--- tools/perf/util/hist.c | 4 +--- tools/perf/util/hist.h | 1 - 2 files changed, 1 insertion(+), 4 deletions(-)
tools/perf/util/hist.c +1 -3
@@ -865,7 +865,7 @@ iter_prepare_cumulative_entry(struct his* cumulated only one time to prevent entries more than 100% * overhead. */ - he_cache =malloc (sizeof (*he_cache) * (iter->max_stack +1 )); + he_cache =malloc (sizeof (*he_cache) * (callchain_cursor.nr +1 ));if (he_cache ==NULL )return -ENOMEM ;
@@ -1030,8 +1030,6 @@ int hist_entry_iter__add(struct hist_entif (err)return err; - iter->max_stack = max_stack_depth; - err = iter->ops->prepare_entry (iter, al);if (err) goto out;
tools/perf/util/hist.h +0 -1
@@ -102,7 +102,6 @@ struct hist_entry_iter {int curr;bool hide_unresolved; -int max_stack;struct perf_evsel *evsel;struct perf_sample *sample;
Greg Kroah-Hartman
maintainerPATCH 322/329 selftests/net: fixes psock_fanout eBPF test case
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Prashant Bhole <[email protected]>
[ Upstream commit ddd0010392d9cbcb95b53d11b7cafc67b373ab56 ]
eBPF test fails due to verifier failure because log_buf is too small. Fixed by increasing log_buf size
--- tools/testing/selftests/net/psock_fanout.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/net/psock_fanout.c +2 -1
@@ -97,6 +97,8 @@ static int sock_fanout_open(uint16_t typstatic void sock_fanout_set_ebpf (int fd) { +static char log_buf[65536 ]; + const int len_off = __builtin_offsetof(struct __sk_buff, len);struct bpf_insn prog[] = { {BPF_ALU64 |BPF_MOV |BPF_X ,6 ,1 ,0 ,0 },
@@ -109,7 +111,6 @@ static void sock_fanout_set_ebpf(int fd) { BPF_ALU | BPF_MOV | BPF_K, 0, 0, 0, 0 }, { BPF_JMP | BPF_EXIT, 0, 0, 0, 0 } }; -char log_buf[512 ];union bpf_attr attr;int pfd;
Greg Kroah-Hartman
maintainerPATCH 323/329 netlabel: If PF_INET6, check sk_buff ip header version
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Haines <[email protected]>
[ Upstream commit 213d7f94775322ba44e0bbb55ec6946e9de88cea ]
When resolving a fallback label, check the sk_buff version as it is possible (e.g. SCTP) to have family = PF_INET6 while receiving ip_hdr(skb)->version = 4.
--- net/netlabel/netlabel_unlabeled.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
net/netlabel/netlabel_unlabeled.c +10 -0
@@ -1469,6 +1469,16 @@ int netlbl_unlabel_getattr(const struct iface =rcu_dereference (netlbl_unlhsh_def);if (iface ==NULL || !iface->valid) goto unlabel_getattr_nolabel; + +#if IS_ENABLED (CONFIG_IPV6 ) +/* When resolving a fallback label, check the sk_buff version as +* it is possible (e.g. SCTP) to have family = PF_INET6 while +* receiving ip_hdr(skb)->version = 4. +*/ +if (family ==PF_INET6 &&ip_hdr (skb)->version ==4 ) + family =PF_INET ; +#endif /* IPv6 */ +switch (family) {case PF_INET : {struct iphdr *hdr4;
Greg Kroah-Hartman
maintainerPATCH 324/329 regmap: Correct comparison in regmap_cached
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Keepax <[email protected]>
[ Upstream commit 71df179363a5a733a8932e9afb869760d7559383 ]
The cache pointer points to the actual memory used by the cache, as the comparison here is looking for the type of the cache it should check against cache_type.
--- drivers/base/regmap/regmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/regmap/regmap.c +1 -1
@@ -98,7 +98,7 @@ bool regmap_cached(struct regmap *map, uint ret;unsigned int val; -if (map->cache ==REGCACHE_NONE ) +if (map->cache_type ==REGCACHE_NONE )return false;if (!map->cache_ops)
Greg Kroah-Hartman
maintainerPATCH 325/329 ARM: dts: imx7d: cl-som-imx7: fix pinctrl_enet
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aapo Vienamo <[email protected]>
[ Upstream commit 2bada7ac1fdcbf79a9689bd2ff65fa515ca7a31f ]
The missing last digit of the CONFIG values is added. Looks like a typo of some sort when comparing to the downstream dt. This fixes intermittent behavior behaviour of the ethernet controllers.
--- arch/arm/boot/dts/imx7d-cl-som-imx7.dts | 52 ++++++++++++++++---------------- 1 file changed, 26 insertions(+), 26 deletions(-)
arch/arm/boot/dts/imx7d-cl-som-imx7.dts +26 -26
@@ -213,37 +213,37 @@ &iomuxc { pinctrl_enet1: enet1grp { fsl,pins = < - MX7D_PAD_SD2_CD_B__ENET1_MDIO 0x3 - MX7D_PAD_SD2_WP__ENET1_MDC 0x3 - MX7D_PAD_ENET1_RGMII_TXC__ENET1_RGMII_TXC 0x1 - MX7D_PAD_ENET1_RGMII_TD0__ENET1_RGMII_TD0 0x1 - MX7D_PAD_ENET1_RGMII_TD1__ENET1_RGMII_TD1 0x1 - MX7D_PAD_ENET1_RGMII_TD2__ENET1_RGMII_TD2 0x1 - MX7D_PAD_ENET1_RGMII_TD3__ENET1_RGMII_TD3 0x1 - MX7D_PAD_ENET1_RGMII_TX_CTL__ENET1_RGMII_TX_CTL 0x1 - MX7D_PAD_ENET1_RGMII_RXC__ENET1_RGMII_RXC 0x1 - MX7D_PAD_ENET1_RGMII_RD0__ENET1_RGMII_RD0 0x1 - MX7D_PAD_ENET1_RGMII_RD1__ENET1_RGMII_RD1 0x1 - MX7D_PAD_ENET1_RGMII_RD2__ENET1_RGMII_RD2 0x1 - MX7D_PAD_ENET1_RGMII_RD3__ENET1_RGMII_RD3 0x1 - MX7D_PAD_ENET1_RGMII_RX_CTL__ENET1_RGMII_RX_CTL 0x1 + MX7D_PAD_SD2_CD_B__ENET1_MDIO 0x30 + MX7D_PAD_SD2_WP__ENET1_MDC 0x30 + MX7D_PAD_ENET1_RGMII_TXC__ENET1_RGMII_TXC 0x11 + MX7D_PAD_ENET1_RGMII_TD0__ENET1_RGMII_TD0 0x11 + MX7D_PAD_ENET1_RGMII_TD1__ENET1_RGMII_TD1 0x11 + MX7D_PAD_ENET1_RGMII_TD2__ENET1_RGMII_TD2 0x11 + MX7D_PAD_ENET1_RGMII_TD3__ENET1_RGMII_TD3 0x11 + MX7D_PAD_ENET1_RGMII_TX_CTL__ENET1_RGMII_TX_CTL 0x11 + MX7D_PAD_ENET1_RGMII_RXC__ENET1_RGMII_RXC 0x11 + MX7D_PAD_ENET1_RGMII_RD0__ENET1_RGMII_RD0 0x11 + MX7D_PAD_ENET1_RGMII_RD1__ENET1_RGMII_RD1 0x11 + MX7D_PAD_ENET1_RGMII_RD2__ENET1_RGMII_RD2 0x11 + MX7D_PAD_ENET1_RGMII_RD3__ENET1_RGMII_RD3 0x11 + MX7D_PAD_ENET1_RGMII_RX_CTL__ENET1_RGMII_RX_CTL 0x11 >; }; pinctrl_enet2: enet2grp { fsl,pins = < - MX7D_PAD_EPDC_GDSP__ENET2_RGMII_TXC 0x1 - MX7D_PAD_EPDC_SDCE2__ENET2_RGMII_TD0 0x1 - MX7D_PAD_EPDC_SDCE3__ENET2_RGMII_TD1 0x1 - MX7D_PAD_EPDC_GDCLK__ENET2_RGMII_TD2 0x1 - MX7D_PAD_EPDC_GDOE__ENET2_RGMII_TD3 0x1 - MX7D_PAD_EPDC_GDRL__ENET2_RGMII_TX_CTL 0x1 - MX7D_PAD_EPDC_SDCE1__ENET2_RGMII_RXC 0x1 - MX7D_PAD_EPDC_SDCLK__ENET2_RGMII_RD0 0x1 - MX7D_PAD_EPDC_SDLE__ENET2_RGMII_RD1 0x1 - MX7D_PAD_EPDC_SDOE__ENET2_RGMII_RD2 0x1 - MX7D_PAD_EPDC_SDSHR__ENET2_RGMII_RD3 0x1 - MX7D_PAD_EPDC_SDCE0__ENET2_RGMII_RX_CTL 0x1 + MX7D_PAD_EPDC_GDSP__ENET2_RGMII_TXC 0x11 + MX7D_PAD_EPDC_SDCE2__ENET2_RGMII_TD0 0x11 + MX7D_PAD_EPDC_SDCE3__ENET2_RGMII_TD1 0x11 + MX7D_PAD_EPDC_GDCLK__ENET2_RGMII_TD2 0x11 + MX7D_PAD_EPDC_GDOE__ENET2_RGMII_TD3 0x11 + MX7D_PAD_EPDC_GDRL__ENET2_RGMII_TX_CTL 0x11 + MX7D_PAD_EPDC_SDCE1__ENET2_RGMII_RXC 0x11 + MX7D_PAD_EPDC_SDCLK__ENET2_RGMII_RD0 0x11 + MX7D_PAD_EPDC_SDLE__ENET2_RGMII_RD1 0x11 + MX7D_PAD_EPDC_SDOE__ENET2_RGMII_RD2 0x11 + MX7D_PAD_EPDC_SDSHR__ENET2_RGMII_RD3 0x11 + MX7D_PAD_EPDC_SDCE0__ENET2_RGMII_RX_CTL 0x11 >; };
Greg Kroah-Hartman
maintainerPATCH 326/329 ARM: dts: porter: Fix HDMI output routing
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Laurent Pinchart <[email protected]>
[ Upstream commit d4b78db6ac3e084e2bdc57d5518bd247c727f396 ]
The HDMI encoder is connected to the RGB output of the DU, which is port@0, not port@1. Fix the incorrect DT description.
--- arch/arm/boot/dts/r8a7791-porter.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/r8a7791-porter.dts +1 -1
@@ -428,7 +428,7 @@ "dclkin.0", "dclkin.1"; ports { - port@1 { + port@0 { endpoint { remote-endpoint = <&adv7511_in>; };
Greg Kroah-Hartman
maintainerPATCH 327/329 regulator: of: Add a missing of_node_put() in an error handling path of of_regulator_match()
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
[ Upstream commit 30966861a7a2051457be8c49466887d78cc47e97 ]
If an unlikely failure in 'of_get_regulator_init_data()' occurs, we must release the reference on the current 'child' node before returning.
--- drivers/regulator/of_regulator.c | 1 + 1 file changed, 1 insertion(+)
drivers/regulator/of_regulator.c +1 -0
@@ -282,6 +282,7 @@ int of_regulator_match(struct device *dedev_err (dev,"failed to parse DT for regulator %s\n" , child->name); +of_node_put (child);return -EINVAL ; } match->of_node =of_node_get (child);
Greg Kroah-Hartman
maintainerPATCH 328/329 pinctrl: msm: Use dynamic GPIO numbering
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjorn Andersson <[email protected]>
[ Upstream commit a7aa75a2a7dba32594291a71c3704000a2fd7089 ]
The base of the TLMM gpiochip should not be statically defined as 0, fix this to not artificially restrict the existence of multiple pinctrl-msm devices.
--- drivers/pinctrl/qcom/pinctrl-msm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/qcom/pinctrl-msm.c +1 -1
@@ -790,7 +790,7 @@ static int msm_gpio_init(struct msm_pincreturn -EINVAL ; chip = &pctrl->chip; - chip->base =0 ; + chip->base =-1 ; chip->ngpio = ngpio; chip->label =dev_name (pctrl->dev); chip->parent = pctrl->dev;
Greg Kroah-Hartman
maintainerPATCH 329/329 kdb: make "mdr" command repeat
In reply to Greg Kroah-Hartman4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <[email protected]>
[ Upstream commit 1e0ce03bf142454f38a5fc050bf4fd698d2d36d8 ]
The "mdr" command should repeat (continue) when only Enter/Return is pressed, so make it do so.
--- kernel/debug/kdb/kdb_main.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)
kernel/debug/kdb/kdb_main.c +21 -6
@@ -1564,6 +1564,7 @@ static int kdb_md(int argc, const char *int symbolic =0 ;int valid =0 ;int phys =0 ; +int raw =0 ;kdbgetintenv ("MDCOUNT" , &mdcount);kdbgetintenv ("RADIX" , &radix);
@@ -1573,9 +1574,10 @@ static int kdb_md(int argc, const char * repeat = mdcount *16 / bytesperword;if (strcmp (argv[0 ],"mdr" ) ==0 ) { -if (argc !=2 ) +if (argc ==2 || (argc ==0 && last_addr !=0 )) + valid = raw =1 ; +else return KDB_ARGCOUNT ; - valid =1 ; }else if (isdigit (argv[0 ][2 ])) { bytesperword = (int )(argv[0 ][2 ] -'0' );if (bytesperword ==0 ) {
@@ -1611,7 +1613,10 @@ static int kdb_md(int argc, const char * radix = last_radix; bytesperword = last_bytesperword; repeat = last_repeat; - mdcount = ((repeat * bytesperword) +15 ) /16 ; +if (raw) + mdcount = repeat; +else + mdcount = ((repeat * bytesperword) +15 ) /16 ; }if (argc) {
@@ -1628,7 +1633,10 @@ static int kdb_md(int argc, const char * diag =kdbgetularg (argv[nextarg], &val);if (!diag) { mdcount = (int ) val; - repeat = mdcount *16 / bytesperword; +if (raw) + repeat = mdcount; +else + repeat = mdcount *16 / bytesperword; } }if (argc >= nextarg+1 ) {
@@ -1638,8 +1646,15 @@ static int kdb_md(int argc, const char * } } -if (strcmp (argv[0 ],"mdr" ) ==0 ) -return kdb_mdr (addr, mdcount); +if (strcmp (argv[0 ],"mdr" ) ==0 ) { +int ret; + last_addr = addr; + ret =kdb_mdr (addr, mdcount); + last_addr += mdcount; + last_repeat = mdcount; + last_bytesperword = bytesperword;// to make REPEAT happy +return ret; + }switch (radix) {case 10 :
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.104 release. There are 329 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed May 30 10:00:51 UTC 2018. Anything received after that time might be too late.
Build results:
total: 146 pass: 146 fail: 0 Qemu test results: total: 139 pass: 139 fail: 0
Details are available at http://kerneltests.org/builders.
Guenter
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.104 release. There are 329 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed May 30 10:00:51 UTC 2018. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.104-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.9.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm and x86_64.
NOTE:
The failed LTP test case "cve-2017-5669" is a waiver here.
Summary
------------------------------------------------------------------------
kernel: 4.9.104-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.9.y
git commit: e11d3afa71760bdd9a9687b439d3e28c0b0fd3af
git describe: v4.9.103-330-ge11d3afa7176
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-4.9-oe/build/v4.9.103-330-ge11d3afa7176
No regressions (compared to build v4.9.103-331-g892592b6a7d3)
Ran 11129 total tests in the following environments and test suites.
Environments
--------------
- dragonboard-410c - arm64
- hi6220-hikey - arm64
- juno-r2 - arm64
- qemu_arm
- qemu_arm64
- qemu_x86_64
- x15 - arm
- x86_64
Test Suites
-----------
* boot
* kselftest
* libhugetlbfs
* ltp-cap_bounds-tests
* ltp-containers-tests
* ltp-cve-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-timers-tests
* kselftest-vsyscall-mode-native
* kselftest-vsyscall-mode-none
Signature · 2 lines
Linaro LKFT https://lkft.linaro.org
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.104 release. There are 329 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed May 30 10:00:51 UTC 2018. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.104-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.9.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah