From: Sasha Levin Date: Mon, 2 Mar 2020 03:23:26 +0000 (-0500) Subject: fixes for 4.14 X-Git-Tag: v4.19.108~80 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1a0d911f2fdf812200525d680512c6cce9188260;p=thirdparty%2Fkernel%2Fstable-queue.git fixes for 4.14 Signed-off-by: Sasha Levin --- diff --git a/queue-4.14/arm-ftrace-fix-be-text-poking.patch b/queue-4.14/arm-ftrace-fix-be-text-poking.patch new file mode 100644 index 00000000000..b8a93b1d841 --- /dev/null +++ b/queue-4.14/arm-ftrace-fix-be-text-poking.patch @@ -0,0 +1,46 @@ +From 5c01d47e9e5bde52f25b9da7015f906662b7f6a5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 7 Feb 2020 12:57:36 +0100 +Subject: arm/ftrace: Fix BE text poking + +From: Peter Zijlstra + +[ Upstream commit be993e44badc448add6a18d6f12b20615692c4c3 ] + +The __patch_text() function already applies __opcode_to_mem_*(), so +when __opcode_to_mem_*() is not the identity (BE*), it is applied +twice, wrecking the instruction. + +Fixes: 42e51f187f86 ("arm/ftrace: Use __patch_text()") +Reported-by: Dmitry Osipenko +Signed-off-by: Peter Zijlstra (Intel) +Signed-off-by: Ingo Molnar +Tested-by: Dmitry Osipenko +Signed-off-by: Sasha Levin +--- + arch/arm/kernel/ftrace.c | 7 ++----- + 1 file changed, 2 insertions(+), 5 deletions(-) + +diff --git a/arch/arm/kernel/ftrace.c b/arch/arm/kernel/ftrace.c +index 5617932a83dfa..26b7321bb2152 100644 +--- a/arch/arm/kernel/ftrace.c ++++ b/arch/arm/kernel/ftrace.c +@@ -106,13 +106,10 @@ static int ftrace_modify_code(unsigned long pc, unsigned long old, + { + unsigned long replaced; + +- if (IS_ENABLED(CONFIG_THUMB2_KERNEL)) { ++ if (IS_ENABLED(CONFIG_THUMB2_KERNEL)) + old = __opcode_to_mem_thumb32(old); +- new = __opcode_to_mem_thumb32(new); +- } else { ++ else + old = __opcode_to_mem_arm(old); +- new = __opcode_to_mem_arm(new); +- } + + if (validate) { + if (probe_kernel_read(&replaced, (void *)pc, MCOUNT_INSN_SIZE)) +-- +2.20.1 + diff --git a/queue-4.14/bcache-ignore-pending-signals-when-creating-gc-and-a.patch b/queue-4.14/bcache-ignore-pending-signals-when-creating-gc-and-a.patch new file mode 100644 index 00000000000..497eb59fb48 --- /dev/null +++ b/queue-4.14/bcache-ignore-pending-signals-when-creating-gc-and-a.patch @@ -0,0 +1,102 @@ +From f52c4302ac3bf412369138c1a10881090c855399 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 13 Feb 2020 22:12:05 +0800 +Subject: bcache: ignore pending signals when creating gc and allocator thread + +From: Coly Li + +[ Upstream commit 0b96da639a4874311e9b5156405f69ef9fc3bef8 ] + +When run a cache set, all the bcache btree node of this cache set will +be checked by bch_btree_check(). If the bcache btree is very large, +iterating all the btree nodes will occupy too much system memory and +the bcache registering process might be selected and killed by system +OOM killer. kthread_run() will fail if current process has pending +signal, therefore the kthread creating in run_cache_set() for gc and +allocator kernel threads are very probably failed for a very large +bcache btree. + +Indeed such OOM is safe and the registering process will exit after +the registration done. Therefore this patch flushes pending signals +during the cache set start up, specificly in bch_cache_allocator_start() +and bch_gc_thread_start(), to make sure run_cache_set() won't fail for +large cahced data set. + +Signed-off-by: Coly Li +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + drivers/md/bcache/alloc.c | 18 ++++++++++++++++-- + drivers/md/bcache/btree.c | 13 +++++++++++++ + 2 files changed, 29 insertions(+), 2 deletions(-) + +diff --git a/drivers/md/bcache/alloc.c b/drivers/md/bcache/alloc.c +index ada94a01e1423..9e85d44faeb49 100644 +--- a/drivers/md/bcache/alloc.c ++++ b/drivers/md/bcache/alloc.c +@@ -67,6 +67,7 @@ + #include + #include + #include ++#include + #include + + #define MAX_OPEN_BUCKETS 128 +@@ -700,8 +701,21 @@ int bch_open_buckets_alloc(struct cache_set *c) + + int bch_cache_allocator_start(struct cache *ca) + { +- struct task_struct *k = kthread_run(bch_allocator_thread, +- ca, "bcache_allocator"); ++ struct task_struct *k; ++ ++ /* ++ * In case previous btree check operation occupies too many ++ * system memory for bcache btree node cache, and the ++ * registering process is selected by OOM killer. Here just ++ * ignore the SIGKILL sent by OOM killer if there is, to ++ * avoid kthread_run() being failed by pending signals. The ++ * bcache registering process will exit after the registration ++ * done. ++ */ ++ if (signal_pending(current)) ++ flush_signals(current); ++ ++ k = kthread_run(bch_allocator_thread, ca, "bcache_allocator"); + if (IS_ERR(k)) + return PTR_ERR(k); + +diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c +index 96a6583e7b522..d61c1a4937109 100644 +--- a/drivers/md/bcache/btree.c ++++ b/drivers/md/bcache/btree.c +@@ -34,6 +34,7 @@ + #include + #include + #include ++#include + #include + + #include +@@ -1801,6 +1802,18 @@ static int bch_gc_thread(void *arg) + + int bch_gc_thread_start(struct cache_set *c) + { ++ /* ++ * In case previous btree check operation occupies too many ++ * system memory for bcache btree node cache, and the ++ * registering process is selected by OOM killer. Here just ++ * ignore the SIGKILL sent by OOM killer if there is, to ++ * avoid kthread_run() being failed by pending signals. The ++ * bcache registering process will exit after the registration ++ * done. ++ */ ++ if (signal_pending(current)) ++ flush_signals(current); ++ + c->gc_thread = kthread_run(bch_gc_thread, c, "bcache_gc"); + if (IS_ERR(c->gc_thread)) + return PTR_ERR(c->gc_thread); +-- +2.20.1 + diff --git a/queue-4.14/cfg80211-add-missing-policy-for-nl80211_attr_status_.patch b/queue-4.14/cfg80211-add-missing-policy-for-nl80211_attr_status_.patch new file mode 100644 index 00000000000..19fadd36e2d --- /dev/null +++ b/queue-4.14/cfg80211-add-missing-policy-for-nl80211_attr_status_.patch @@ -0,0 +1,36 @@ +From a55b178aba19ad3ba5ee8507371e31b14799acc5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 13 Feb 2020 13:16:16 +0000 +Subject: cfg80211: add missing policy for NL80211_ATTR_STATUS_CODE + +From: Sergey Matyukevich + +[ Upstream commit ea75080110a4c1fa011b0a73cb8f42227143ee3e ] + +The nl80211_policy is missing for NL80211_ATTR_STATUS_CODE attribute. +As a result, for strictly validated commands, it's assumed to not be +supported. + +Signed-off-by: Sergey Matyukevich +Link: https://lore.kernel.org/r/20200213131608.10541-2-sergey.matyukevich.os@quantenna.com +Signed-off-by: Johannes Berg +Signed-off-by: Sasha Levin +--- + net/wireless/nl80211.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c +index df8c5312f26ad..b248578aeb7bc 100644 +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -321,6 +321,7 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { + [NL80211_ATTR_CONTROL_PORT_ETHERTYPE] = { .type = NLA_U16 }, + [NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT] = { .type = NLA_FLAG }, + [NL80211_ATTR_PRIVACY] = { .type = NLA_FLAG }, ++ [NL80211_ATTR_STATUS_CODE] = { .type = NLA_U16 }, + [NL80211_ATTR_CIPHER_SUITE_GROUP] = { .type = NLA_U32 }, + [NL80211_ATTR_WPA_VERSIONS] = { .type = NLA_U32 }, + [NL80211_ATTR_PID] = { .type = NLA_U32 }, +-- +2.20.1 + diff --git a/queue-4.14/cfg80211-check-wiphy-driver-existence-for-drvinfo-re.patch b/queue-4.14/cfg80211-check-wiphy-driver-existence-for-drvinfo-re.patch new file mode 100644 index 00000000000..9929af48079 --- /dev/null +++ b/queue-4.14/cfg80211-check-wiphy-driver-existence-for-drvinfo-re.patch @@ -0,0 +1,44 @@ +From 5bf59e8019e1156f986417cc477b96237037e024 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 3 Feb 2020 10:56:50 +0000 +Subject: cfg80211: check wiphy driver existence for drvinfo report + +From: Sergey Matyukevich + +[ Upstream commit bfb7bac3a8f47100ebe7961bd14e924c96e21ca7 ] + +When preparing ethtool drvinfo, check if wiphy driver is defined +before dereferencing it. Driver may not exist, e.g. if wiphy is +attached to a virtual platform device. + +Signed-off-by: Sergey Matyukevich +Link: https://lore.kernel.org/r/20200203105644.28875-1-sergey.matyukevich.os@quantenna.com +Signed-off-by: Johannes Berg +Signed-off-by: Sasha Levin +--- + net/wireless/ethtool.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/net/wireless/ethtool.c b/net/wireless/ethtool.c +index a9c0f368db5d2..24e18405cdb48 100644 +--- a/net/wireless/ethtool.c ++++ b/net/wireless/ethtool.c +@@ -7,9 +7,13 @@ + void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) + { + struct wireless_dev *wdev = dev->ieee80211_ptr; ++ struct device *pdev = wiphy_dev(wdev->wiphy); + +- strlcpy(info->driver, wiphy_dev(wdev->wiphy)->driver->name, +- sizeof(info->driver)); ++ if (pdev->driver) ++ strlcpy(info->driver, pdev->driver->name, ++ sizeof(info->driver)); ++ else ++ strlcpy(info->driver, "N/A", sizeof(info->driver)); + + strlcpy(info->version, init_utsname()->release, sizeof(info->version)); + +-- +2.20.1 + diff --git a/queue-4.14/cifs-fix-mode-output-in-debugging-statements.patch b/queue-4.14/cifs-fix-mode-output-in-debugging-statements.patch new file mode 100644 index 00000000000..88d2f6f446b --- /dev/null +++ b/queue-4.14/cifs-fix-mode-output-in-debugging-statements.patch @@ -0,0 +1,72 @@ +From e8252334edc4a07259282cd163ad0d0d20d3aded Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 12 Feb 2020 15:31:48 -0600 +Subject: cifs: Fix mode output in debugging statements + +From: Frank Sorenson + +[ Upstream commit f52aa79df43c4509146140de0241bc21a4a3b4c7 ] + +A number of the debug statements output file or directory mode +in hex. Change these to print using octal. + +Signed-off-by: Frank Sorenson +Signed-off-by: Steve French +Signed-off-by: Sasha Levin +--- + fs/cifs/cifsacl.c | 4 ++-- + fs/cifs/connect.c | 2 +- + fs/cifs/inode.c | 2 +- + 3 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c +index b98436f5c7c74..73d428af97a9e 100644 +--- a/fs/cifs/cifsacl.c ++++ b/fs/cifs/cifsacl.c +@@ -603,7 +603,7 @@ static void access_flags_to_mode(__le32 ace_flags, int type, umode_t *pmode, + ((flags & FILE_EXEC_RIGHTS) == FILE_EXEC_RIGHTS)) + *pmode |= (S_IXUGO & (*pbits_to_set)); + +- cifs_dbg(NOISY, "access flags 0x%x mode now 0x%x\n", flags, *pmode); ++ cifs_dbg(NOISY, "access flags 0x%x mode now %04o\n", flags, *pmode); + return; + } + +@@ -632,7 +632,7 @@ static void mode_to_access_flags(umode_t mode, umode_t bits_to_use, + if (mode & S_IXUGO) + *pace_flags |= SET_FILE_EXEC_RIGHTS; + +- cifs_dbg(NOISY, "mode: 0x%x, access flags now 0x%x\n", ++ cifs_dbg(NOISY, "mode: %04o, access flags now 0x%x\n", + mode, *pace_flags); + return; + } +diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c +index 6e5ecf70996a0..697edc92dff27 100644 +--- a/fs/cifs/connect.c ++++ b/fs/cifs/connect.c +@@ -3521,7 +3521,7 @@ int cifs_setup_cifs_sb(struct smb_vol *pvolume_info, + cifs_sb->mnt_gid = pvolume_info->linux_gid; + cifs_sb->mnt_file_mode = pvolume_info->file_mode; + cifs_sb->mnt_dir_mode = pvolume_info->dir_mode; +- cifs_dbg(FYI, "file mode: 0x%hx dir mode: 0x%hx\n", ++ cifs_dbg(FYI, "file mode: %04ho dir mode: %04ho\n", + cifs_sb->mnt_file_mode, cifs_sb->mnt_dir_mode); + + cifs_sb->actimeo = pvolume_info->actimeo; +diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c +index a35c141059067..3a10d405362e2 100644 +--- a/fs/cifs/inode.c ++++ b/fs/cifs/inode.c +@@ -1581,7 +1581,7 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, umode_t mode) + struct TCP_Server_Info *server; + char *full_path; + +- cifs_dbg(FYI, "In cifs_mkdir, mode = 0x%hx inode = 0x%p\n", ++ cifs_dbg(FYI, "In cifs_mkdir, mode = %04ho inode = 0x%p\n", + mode, inode); + + cifs_sb = CIFS_SB(inode->i_sb); +-- +2.20.1 + diff --git a/queue-4.14/dax-pass-nowait-flag-to-iomap_apply.patch b/queue-4.14/dax-pass-nowait-flag-to-iomap_apply.patch new file mode 100644 index 00000000000..e5864c67c54 --- /dev/null +++ b/queue-4.14/dax-pass-nowait-flag-to-iomap_apply.patch @@ -0,0 +1,43 @@ +From 46155dc8eaf1a8ebd75c058a411123f5e80006bf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 5 Feb 2020 14:15:58 -0500 +Subject: dax: pass NOWAIT flag to iomap_apply + +From: Jeff Moyer + +[ Upstream commit 96222d53842dfe54869ec4e1b9d4856daf9105a2 ] + +fstests generic/471 reports a failure when run with MOUNT_OPTIONS="-o +dax". The reason is that the initial pwrite to an empty file with the +RWF_NOWAIT flag set does not return -EAGAIN. It turns out that +dax_iomap_rw doesn't pass that flag through to iomap_apply. + +With this patch applied, generic/471 passes for me. + +Signed-off-by: Jeff Moyer +Reviewed-by: Christoph Hellwig +Reviewed-by: Jan Kara +Link: https://lore.kernel.org/r/x49r1z86e1d.fsf@segfault.boston.devel.redhat.com +Signed-off-by: Dan Williams +Signed-off-by: Sasha Levin +--- + fs/dax.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/fs/dax.c b/fs/dax.c +index ddb4981ae32eb..34a55754164f4 100644 +--- a/fs/dax.c ++++ b/fs/dax.c +@@ -1057,6 +1057,9 @@ dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter, + lockdep_assert_held(&inode->i_rwsem); + } + ++ if (iocb->ki_flags & IOCB_NOWAIT) ++ flags |= IOMAP_NOWAIT; ++ + while (iov_iter_count(iter)) { + ret = iomap_apply(inode, pos, iov_iter_count(iter), flags, ops, + iter, dax_iomap_actor); +-- +2.20.1 + diff --git a/queue-4.14/drm-msm-set-dma-maximum-segment-size-for-mdss.patch b/queue-4.14/drm-msm-set-dma-maximum-segment-size-for-mdss.patch new file mode 100644 index 00000000000..efb95a63324 --- /dev/null +++ b/queue-4.14/drm-msm-set-dma-maximum-segment-size-for-mdss.patch @@ -0,0 +1,95 @@ +From b32b2b5c28a5e1681e1b3982b8c2c9af7bd1d11b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 21 Jan 2020 11:18:48 -0800 +Subject: drm/msm: Set dma maximum segment size for mdss + +From: Sean Paul + +[ Upstream commit db735fc4036bbe1fbe606819b5f0ff26cc76cdff ] + +Turning on CONFIG_DMA_API_DEBUG_SG results in the following error: + +[ 12.078665] msm ae00000.mdss: DMA-API: mapping sg segment longer than device claims to support [len=3526656] [max=65536] +[ 12.089870] WARNING: CPU: 6 PID: 334 at /mnt/host/source/src/third_party/kernel/v4.19/kernel/dma/debug.c:1301 debug_dma_map_sg+0x1dc/0x318 +[ 12.102655] Modules linked in: joydev +[ 12.106442] CPU: 6 PID: 334 Comm: frecon Not tainted 4.19.0 #2 +[ 12.112450] Hardware name: Google Cheza (rev3+) (DT) +[ 12.117566] pstate: 60400009 (nZCv daif +PAN -UAO) +[ 12.122506] pc : debug_dma_map_sg+0x1dc/0x318 +[ 12.126995] lr : debug_dma_map_sg+0x1dc/0x318 +[ 12.131487] sp : ffffff800cc3ba80 +[ 12.134913] x29: ffffff800cc3ba80 x28: 0000000000000000 +[ 12.140395] x27: 0000000000000004 x26: 0000000000000004 +[ 12.145868] x25: ffffff8008e55b18 x24: 0000000000000000 +[ 12.151337] x23: 00000000ffffffff x22: ffffff800921c000 +[ 12.156809] x21: ffffffc0fa75b080 x20: ffffffc0f7195090 +[ 12.162280] x19: ffffffc0f1c53280 x18: 0000000000000000 +[ 12.167749] x17: 0000000000000000 x16: 0000000000000000 +[ 12.173218] x15: 0000000000000000 x14: 0720072007200720 +[ 12.178689] x13: 0720072007200720 x12: 0720072007200720 +[ 12.184161] x11: 0720072007200720 x10: 0720072007200720 +[ 12.189641] x9 : ffffffc0f1fc6b60 x8 : 0000000000000000 +[ 12.195110] x7 : ffffff8008132ce0 x6 : 0000000000000000 +[ 12.200585] x5 : 0000000000000000 x4 : ffffff8008134734 +[ 12.206058] x3 : ffffff800cc3b830 x2 : ffffffc0f1fc6240 +[ 12.211532] x1 : 25045a74f48a7400 x0 : 25045a74f48a7400 +[ 12.217006] Call trace: +[ 12.219535] debug_dma_map_sg+0x1dc/0x318 +[ 12.223671] get_pages+0x19c/0x20c +[ 12.227177] msm_gem_fault+0x64/0xfc +[ 12.230874] __do_fault+0x3c/0x140 +[ 12.234383] __handle_mm_fault+0x70c/0xdb8 +[ 12.238603] handle_mm_fault+0xac/0xc4 +[ 12.242473] do_page_fault+0x1bc/0x3d4 +[ 12.246342] do_translation_fault+0x54/0x88 +[ 12.250652] do_mem_abort+0x60/0xf0 +[ 12.254250] el0_da+0x20/0x24 +[ 12.257317] irq event stamp: 67260 +[ 12.260828] hardirqs last enabled at (67259): [] console_unlock+0x214/0x608 +[ 12.269693] hardirqs last disabled at (67260): [] do_debug_exception+0x5c/0x178 +[ 12.278820] softirqs last enabled at (67256): [] __do_softirq+0x4d4/0x520 +[ 12.287510] softirqs last disabled at (67249): [] irq_exit+0xa8/0x100 +[ 12.295742] ---[ end trace e63cfc40c313ffab ]--- + +The root of the problem is that the default segment size for sgt is +(UINT_MAX & PAGE_MASK), and the default segment size for device dma is +64K. As such, if you compare the 2, you would deduce that the sg segment +will overflow the device's capacity. In reality, the hardware can +accommodate the larger sg segments, it's just not initializing its max +segment properly. This patch initializes the max segment size for the +mdss device, which gets rid of that pesky warning. + +Reported-by: Stephen Boyd +Tested-by: Stephen Boyd +Tested-by: Sai Prakash Ranjan +Reviewed-by: Rob Clark +Signed-off-by: Sean Paul +Signed-off-by: Douglas Anderson +Link: https://patchwork.freedesktop.org/patch/msgid/20200121111813.REPOST.1.I92c66a35fb13f368095b05287bdabdbe88ca6922@changeid +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/msm/msm_drv.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c +index 77c45a2ebd833..d9c0687435a05 100644 +--- a/drivers/gpu/drm/msm/msm_drv.c ++++ b/drivers/gpu/drm/msm/msm_drv.c +@@ -420,6 +420,14 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv) + if (ret) + goto fail; + ++ if (!dev->dma_parms) { ++ dev->dma_parms = devm_kzalloc(dev, sizeof(*dev->dma_parms), ++ GFP_KERNEL); ++ if (!dev->dma_parms) ++ return -ENOMEM; ++ } ++ dma_set_max_seg_size(dev, DMA_BIT_MASK(32)); ++ + msm_gem_shrinker_init(ddev); + + switch (get_mdp_ver(pdev)) { +-- +2.20.1 + diff --git a/queue-4.14/ipmi-ssif-handle-a-possible-null-pointer-reference.patch b/queue-4.14/ipmi-ssif-handle-a-possible-null-pointer-reference.patch new file mode 100644 index 00000000000..3b50d32091f --- /dev/null +++ b/queue-4.14/ipmi-ssif-handle-a-possible-null-pointer-reference.patch @@ -0,0 +1,45 @@ +From 22cd0341214a429d9058890a9ea37849f4445d45 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 23 Dec 2019 10:42:19 -0600 +Subject: ipmi:ssif: Handle a possible NULL pointer reference + +From: Corey Minyard + +[ Upstream commit 6b8526d3abc02c08a2f888e8c20b7ac9e5776dfe ] + +In error cases a NULL can be passed to memcpy. The length will always +be zero, so it doesn't really matter, but go ahead and check for NULL, +anyway, to be more precise and avoid static analysis errors. + +Reported-by: kbuild test robot +Signed-off-by: Corey Minyard +Signed-off-by: Sasha Levin +--- + drivers/char/ipmi/ipmi_ssif.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c +index 941bffd9b49cd..0146bc3252c5a 100644 +--- a/drivers/char/ipmi/ipmi_ssif.c ++++ b/drivers/char/ipmi/ipmi_ssif.c +@@ -750,10 +750,14 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result, + flags = ipmi_ssif_lock_cond(ssif_info, &oflags); + msg = ssif_info->curr_msg; + if (msg) { ++ if (data) { ++ if (len > IPMI_MAX_MSG_LENGTH) ++ len = IPMI_MAX_MSG_LENGTH; ++ memcpy(msg->rsp, data, len); ++ } else { ++ len = 0; ++ } + msg->rsp_size = len; +- if (msg->rsp_size > IPMI_MAX_MSG_LENGTH) +- msg->rsp_size = IPMI_MAX_MSG_LENGTH; +- memcpy(msg->rsp, data, msg->rsp_size); + ssif_info->curr_msg = NULL; + } + +-- +2.20.1 + diff --git a/queue-4.14/mac80211-consider-more-elements-in-parsing-crc.patch b/queue-4.14/mac80211-consider-more-elements-in-parsing-crc.patch new file mode 100644 index 00000000000..e8f49d72b05 --- /dev/null +++ b/queue-4.14/mac80211-consider-more-elements-in-parsing-crc.patch @@ -0,0 +1,68 @@ +From 5a170d9caea8bb92a38ef52b2e738c65414fa8eb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 31 Jan 2020 13:12:58 +0200 +Subject: mac80211: consider more elements in parsing CRC + +From: Johannes Berg + +[ Upstream commit a04564c99bb4a92f805a58e56b2d22cc4978f152 ] + +We only use the parsing CRC for checking if a beacon changed, +and elements with an ID > 63 cannot be represented in the +filter. Thus, like we did before with WMM and Cisco vendor +elements, just statically add these forgotten items to the +CRC: + - WLAN_EID_VHT_OPERATION + - WLAN_EID_OPMODE_NOTIF + +I guess that in most cases when VHT/HE operation change, the HT +operation also changed, and so the change was picked up, but we +did notice that pure operating mode notification changes were +ignored. + +Signed-off-by: Johannes Berg +Signed-off-by: Luca Coelho +Link: https://lore.kernel.org/r/20200131111300.891737-22-luca@coelho.fi +[restrict to VHT for the mac80211 branch] +Signed-off-by: Johannes Berg +Signed-off-by: Sasha Levin +--- + net/mac80211/util.c | 18 ++++++++++++------ + 1 file changed, 12 insertions(+), 6 deletions(-) + +diff --git a/net/mac80211/util.c b/net/mac80211/util.c +index 81f120466c38b..cd3cdd1a0b576 100644 +--- a/net/mac80211/util.c ++++ b/net/mac80211/util.c +@@ -944,16 +944,22 @@ u32 ieee802_11_parse_elems_crc(const u8 *start, size_t len, bool action, + elem_parse_failed = true; + break; + case WLAN_EID_VHT_OPERATION: +- if (elen >= sizeof(struct ieee80211_vht_operation)) ++ if (elen >= sizeof(struct ieee80211_vht_operation)) { + elems->vht_operation = (void *)pos; +- else +- elem_parse_failed = true; ++ if (calc_crc) ++ crc = crc32_be(crc, pos - 2, elen + 2); ++ break; ++ } ++ elem_parse_failed = true; + break; + case WLAN_EID_OPMODE_NOTIF: +- if (elen > 0) ++ if (elen > 0) { + elems->opmode_notif = pos; +- else +- elem_parse_failed = true; ++ if (calc_crc) ++ crc = crc32_be(crc, pos - 2, elen + 2); ++ break; ++ } ++ elem_parse_failed = true; + break; + case WLAN_EID_MESH_ID: + elems->mesh_id = pos; +-- +2.20.1 + diff --git a/queue-4.14/net-ena-add-missing-ethtool-tx-timestamping-indicati.patch b/queue-4.14/net-ena-add-missing-ethtool-tx-timestamping-indicati.patch new file mode 100644 index 00000000000..3b1616f7f3f --- /dev/null +++ b/queue-4.14/net-ena-add-missing-ethtool-tx-timestamping-indicati.patch @@ -0,0 +1,45 @@ +From a650d869e60df5b5a6c4b83e1a38c9818e881cac Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 11 Feb 2020 15:17:42 +0000 +Subject: net: ena: add missing ethtool TX timestamping indication + +From: Arthur Kiyanovski + +[ Upstream commit cf6d17fde93bdda23c9b02dd5906a12bf8c55209 ] + +Current implementation of the driver calls skb_tx_timestamp()to add a +software tx timestamp to the skb, however the software-transmit capability +is not reported in ethtool -T. + +This commit updates the ethtool structure to report the software-transmit +capability in ethtool -T using the standard ethtool_op_get_ts_info(). +This function reports all software timestamping capabilities (tx and rx), +as well as setting phc_index = -1. phc_index is the index of the PTP +hardware clock device that will be used for hardware timestamps. Since we +don't have such a device in ENA, using the default -1 value is the correct +setting. + +Fixes: 1738cd3ed342 ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)") +Signed-off-by: Ezequiel Lara Gomez +Signed-off-by: Arthur Kiyanovski +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/amazon/ena/ena_ethtool.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/net/ethernet/amazon/ena/ena_ethtool.c b/drivers/net/ethernet/amazon/ena/ena_ethtool.c +index a2f02c23fe141..c58ad61909519 100644 +--- a/drivers/net/ethernet/amazon/ena/ena_ethtool.c ++++ b/drivers/net/ethernet/amazon/ena/ena_ethtool.c +@@ -816,6 +816,7 @@ static const struct ethtool_ops ena_ethtool_ops = { + .get_channels = ena_get_channels, + .get_tunable = ena_get_tunable, + .set_tunable = ena_set_tunable, ++ .get_ts_info = ethtool_op_get_ts_info, + }; + + void ena_set_ethtool_ops(struct net_device *netdev) +-- +2.20.1 + diff --git a/queue-4.14/net-ena-ena-com.c-prevent-null-pointer-dereference.patch b/queue-4.14/net-ena-ena-com.c-prevent-null-pointer-dereference.patch new file mode 100644 index 00000000000..c0ddcd84c4e --- /dev/null +++ b/queue-4.14/net-ena-ena-com.c-prevent-null-pointer-dereference.patch @@ -0,0 +1,52 @@ +From 2aa7b10d56beaa153cf2f4b385944421a281e999 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 11 Feb 2020 15:17:51 +0000 +Subject: net: ena: ena-com.c: prevent NULL pointer dereference + +From: Arthur Kiyanovski + +[ Upstream commit c207979f5ae10ed70aff1bb13f39f0736973de99 ] + +comp_ctx can be NULL in a very rare case when an admin command is executed +during the execution of ena_remove(). + +The bug scenario is as follows: + +* ena_destroy_device() sets the comp_ctx to be NULL +* An admin command is executed before executing unregister_netdev(), + this can still happen because our device can still receive callbacks + from the netdev infrastructure such as ethtool commands. +* When attempting to access the comp_ctx, the bug occurs since it's set + to NULL + +Fix: +Added a check that comp_ctx is not NULL + +Fixes: 1738cd3ed342 ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)") +Signed-off-by: Sameeh Jubran +Signed-off-by: Arthur Kiyanovski +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/amazon/ena/ena_com.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/drivers/net/ethernet/amazon/ena/ena_com.c b/drivers/net/ethernet/amazon/ena/ena_com.c +index 552db5399503f..31e0cf1442012 100644 +--- a/drivers/net/ethernet/amazon/ena/ena_com.c ++++ b/drivers/net/ethernet/amazon/ena/ena_com.c +@@ -199,6 +199,11 @@ static inline void comp_ctxt_release(struct ena_com_admin_queue *queue, + static struct ena_comp_ctx *get_comp_ctxt(struct ena_com_admin_queue *queue, + u16 command_id, bool capture) + { ++ if (unlikely(!queue->comp_ctx)) { ++ pr_err("Completion context is NULL\n"); ++ return NULL; ++ } ++ + if (unlikely(command_id >= queue->q_depth)) { + pr_err("command id is larger than the queue size. cmd_id: %u queue size %d\n", + command_id, queue->q_depth); +-- +2.20.1 + diff --git a/queue-4.14/net-ena-ethtool-use-correct-value-for-crc32-hash.patch b/queue-4.14/net-ena-ethtool-use-correct-value-for-crc32-hash.patch new file mode 100644 index 00000000000..a384fb0581b --- /dev/null +++ b/queue-4.14/net-ena-ethtool-use-correct-value-for-crc32-hash.patch @@ -0,0 +1,45 @@ +From 98118307c70e565c0cfb1ef217e164f569e5d0da Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 11 Feb 2020 15:17:50 +0000 +Subject: net: ena: ethtool: use correct value for crc32 hash + +From: Sameeh Jubran + +[ Upstream commit 886d2089276e40d460731765083a741c5c762461 ] + +Up till kernel 4.11 there was no enum defined for crc32 hash in ethtool, +thus the xor enum was used for supporting crc32. + +Fixes: 1738cd3ed342 ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)") +Signed-off-by: Sameeh Jubran +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/amazon/ena/ena_ethtool.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/amazon/ena/ena_ethtool.c b/drivers/net/ethernet/amazon/ena/ena_ethtool.c +index 9601ddc274274..22238f25e0713 100644 +--- a/drivers/net/ethernet/amazon/ena/ena_ethtool.c ++++ b/drivers/net/ethernet/amazon/ena/ena_ethtool.c +@@ -705,7 +705,7 @@ static int ena_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, + func = ETH_RSS_HASH_TOP; + break; + case ENA_ADMIN_CRC32: +- func = ETH_RSS_HASH_XOR; ++ func = ETH_RSS_HASH_CRC32; + break; + default: + netif_err(adapter, drv, netdev, +@@ -751,7 +751,7 @@ static int ena_set_rxfh(struct net_device *netdev, const u32 *indir, + case ETH_RSS_HASH_TOP: + func = ENA_ADMIN_TOEPLITZ; + break; +- case ETH_RSS_HASH_XOR: ++ case ETH_RSS_HASH_CRC32: + func = ENA_ADMIN_CRC32; + break; + default: +-- +2.20.1 + diff --git a/queue-4.14/net-ena-fix-incorrect-default-rss-key.patch b/queue-4.14/net-ena-fix-incorrect-default-rss-key.patch new file mode 100644 index 00000000000..a2ecb8c4b19 --- /dev/null +++ b/queue-4.14/net-ena-fix-incorrect-default-rss-key.patch @@ -0,0 +1,83 @@ +From f2fbc78617b350147f2000b869632bb6f19992a4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 11 Feb 2020 15:17:43 +0000 +Subject: net: ena: fix incorrect default RSS key + +From: Arthur Kiyanovski + +[ Upstream commit 0d1c3de7b8c78a5e44b74b62ede4a63629f5d811 ] + +Bug description: +When running "ethtool -x " the key shows up as all zeros. + +When we use "ethtool -X hfunc toeplitz hkey " to +set the key and then try to retrieve it using "ethtool -x " then +we return the correct key because we return the one we saved. + +Bug cause: +We don't fetch the key from the device but instead return the key +that we have saved internally which is by default set to zero upon +allocation. + +Fix: +This commit fixes the issue by initializing the key to a random value +using netdev_rss_key_fill(). + +Fixes: 1738cd3ed342 ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)") +Signed-off-by: Sameeh Jubran +Signed-off-by: Arthur Kiyanovski +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/amazon/ena/ena_com.c | 15 +++++++++++++++ + drivers/net/ethernet/amazon/ena/ena_com.h | 1 + + 2 files changed, 16 insertions(+) + +diff --git a/drivers/net/ethernet/amazon/ena/ena_com.c b/drivers/net/ethernet/amazon/ena/ena_com.c +index f2dde1ab424a1..c5df80f31005f 100644 +--- a/drivers/net/ethernet/amazon/ena/ena_com.c ++++ b/drivers/net/ethernet/amazon/ena/ena_com.c +@@ -843,6 +843,19 @@ static int ena_com_get_feature(struct ena_com_dev *ena_dev, + 0); + } + ++static void ena_com_hash_key_fill_default_key(struct ena_com_dev *ena_dev) ++{ ++ struct ena_admin_feature_rss_flow_hash_control *hash_key = ++ (ena_dev->rss).hash_key; ++ ++ netdev_rss_key_fill(&hash_key->key, sizeof(hash_key->key)); ++ /* The key is stored in the device in u32 array ++ * as well as the API requires the key to be passed in this ++ * format. Thus the size of our array should be divided by 4 ++ */ ++ hash_key->keys_num = sizeof(hash_key->key) / sizeof(u32); ++} ++ + static int ena_com_hash_key_allocate(struct ena_com_dev *ena_dev) + { + struct ena_rss *rss = &ena_dev->rss; +@@ -2403,6 +2416,8 @@ int ena_com_rss_init(struct ena_com_dev *ena_dev, u16 indr_tbl_log_size) + if (unlikely(rc)) + goto err_hash_key; + ++ ena_com_hash_key_fill_default_key(ena_dev); ++ + rc = ena_com_hash_ctrl_init(ena_dev); + if (unlikely(rc)) + goto err_hash_ctrl; +diff --git a/drivers/net/ethernet/amazon/ena/ena_com.h b/drivers/net/ethernet/amazon/ena/ena_com.h +index 7b784f8a06a66..90fce5c0ca48a 100644 +--- a/drivers/net/ethernet/amazon/ena/ena_com.h ++++ b/drivers/net/ethernet/amazon/ena/ena_com.h +@@ -42,6 +42,7 @@ + #include + #include + #include ++#include + + #include "ena_common_defs.h" + #include "ena_admin_defs.h" +-- +2.20.1 + diff --git a/queue-4.14/net-ena-fix-incorrectly-saving-queue-numbers-when-se.patch b/queue-4.14/net-ena-fix-incorrectly-saving-queue-numbers-when-se.patch new file mode 100644 index 00000000000..7f895d8dfe8 --- /dev/null +++ b/queue-4.14/net-ena-fix-incorrectly-saving-queue-numbers-when-se.patch @@ -0,0 +1,97 @@ +From f3ea374a3daecc4401996f3c6b6722e3add01f7e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 11 Feb 2020 15:17:47 +0000 +Subject: net: ena: fix incorrectly saving queue numbers when setting RSS + indirection table + +From: Arthur Kiyanovski + +[ Upstream commit 92569fd27f5cb0ccbdf7c7d70044b690e89a0277 ] + +The indirection table has the indices of the Rx queues. When we store it +during set indirection operation, we convert the indices to our internal +representation of the indices. + +Our internal representation of the indices is: even indices for Tx and +uneven indices for Rx, where every Tx/Rx pair are in a consecutive order +starting from 0. For example if the driver has 3 queues (3 for Tx and 3 +for Rx) then the indices are as follows: +0 1 2 3 4 5 +Tx Rx Tx Rx Tx Rx + +The BUG: +The issue is that when we satisfy a get request for the indirection +table, we don't convert the indices back to the original representation. + +The FIX: +Simply apply the inverse function for the indices of the indirection +table after we set it. + +Fixes: 1738cd3ed342 ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)") +Signed-off-by: Sameeh Jubran +Signed-off-by: Arthur Kiyanovski +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/amazon/ena/ena_ethtool.c | 24 ++++++++++++++++++- + drivers/net/ethernet/amazon/ena/ena_netdev.h | 2 ++ + 2 files changed, 25 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/amazon/ena/ena_ethtool.c b/drivers/net/ethernet/amazon/ena/ena_ethtool.c +index 7ca7bade1c090..9601ddc274274 100644 +--- a/drivers/net/ethernet/amazon/ena/ena_ethtool.c ++++ b/drivers/net/ethernet/amazon/ena/ena_ethtool.c +@@ -648,6 +648,28 @@ static u32 ena_get_rxfh_key_size(struct net_device *netdev) + return ENA_HASH_KEY_SIZE; + } + ++static int ena_indirection_table_get(struct ena_adapter *adapter, u32 *indir) ++{ ++ struct ena_com_dev *ena_dev = adapter->ena_dev; ++ int i, rc; ++ ++ if (!indir) ++ return 0; ++ ++ rc = ena_com_indirect_table_get(ena_dev, indir); ++ if (rc) ++ return rc; ++ ++ /* Our internal representation of the indices is: even indices ++ * for Tx and uneven indices for Rx. We need to convert the Rx ++ * indices to be consecutive ++ */ ++ for (i = 0; i < ENA_RX_RSS_TABLE_SIZE; i++) ++ indir[i] = ENA_IO_RXQ_IDX_TO_COMBINED_IDX(indir[i]); ++ ++ return rc; ++} ++ + static int ena_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, + u8 *hfunc) + { +@@ -656,7 +678,7 @@ static int ena_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, + u8 func; + int rc; + +- rc = ena_com_indirect_table_get(adapter->ena_dev, indir); ++ rc = ena_indirection_table_get(adapter, indir); + if (rc) + return rc; + +diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.h b/drivers/net/ethernet/amazon/ena/ena_netdev.h +index 3404376c28ca3..5a72267b858b1 100644 +--- a/drivers/net/ethernet/amazon/ena/ena_netdev.h ++++ b/drivers/net/ethernet/amazon/ena/ena_netdev.h +@@ -113,6 +113,8 @@ + + #define ENA_IO_TXQ_IDX(q) (2 * (q)) + #define ENA_IO_RXQ_IDX(q) (2 * (q) + 1) ++#define ENA_IO_TXQ_IDX_TO_COMBINED_IDX(q) ((q) / 2) ++#define ENA_IO_RXQ_IDX_TO_COMBINED_IDX(q) (((q) - 1) / 2) + + #define ENA_MGMNT_IRQ_IDX 0 + #define ENA_IO_IRQ_FIRST_IDX 1 +-- +2.20.1 + diff --git a/queue-4.14/net-ena-fix-potential-crash-when-rxfh-key-is-null.patch b/queue-4.14/net-ena-fix-potential-crash-when-rxfh-key-is-null.patch new file mode 100644 index 00000000000..e006b6989b8 --- /dev/null +++ b/queue-4.14/net-ena-fix-potential-crash-when-rxfh-key-is-null.patch @@ -0,0 +1,55 @@ +From fa281edb2e222fcecf23045baf645343c412efda Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 11 Feb 2020 15:17:40 +0000 +Subject: net: ena: fix potential crash when rxfh key is NULL + +From: Arthur Kiyanovski + +[ Upstream commit 91a65b7d3ed8450f31ab717a65dcb5f9ceb5ab02 ] + +When ethtool -X is called without an hkey, ena_com_fill_hash_function() +is called with key=NULL, which is passed to memcpy causing a crash. + +This commit fixes this issue by checking key is not NULL. + +Fixes: 1738cd3ed342 ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)") +Signed-off-by: Sameeh Jubran +Signed-off-by: Arthur Kiyanovski +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/amazon/ena/ena_com.c | 17 +++++++++-------- + 1 file changed, 9 insertions(+), 8 deletions(-) + +diff --git a/drivers/net/ethernet/amazon/ena/ena_com.c b/drivers/net/ethernet/amazon/ena/ena_com.c +index 10e6053f66712..f2dde1ab424a1 100644 +--- a/drivers/net/ethernet/amazon/ena/ena_com.c ++++ b/drivers/net/ethernet/amazon/ena/ena_com.c +@@ -2069,15 +2069,16 @@ int ena_com_fill_hash_function(struct ena_com_dev *ena_dev, + + switch (func) { + case ENA_ADMIN_TOEPLITZ: +- if (key_len > sizeof(hash_key->key)) { +- pr_err("key len (%hu) is bigger than the max supported (%zu)\n", +- key_len, sizeof(hash_key->key)); +- return -EINVAL; ++ if (key) { ++ if (key_len != sizeof(hash_key->key)) { ++ pr_err("key len (%hu) doesn't equal the supported size (%zu)\n", ++ key_len, sizeof(hash_key->key)); ++ return -EINVAL; ++ } ++ memcpy(hash_key->key, key, key_len); ++ rss->hash_init_val = init_val; ++ hash_key->keys_num = key_len >> 2; + } +- +- memcpy(hash_key->key, key, key_len); +- rss->hash_init_val = init_val; +- hash_key->keys_num = key_len >> 2; + break; + case ENA_ADMIN_CRC32: + rss->hash_init_val = init_val; +-- +2.20.1 + diff --git a/queue-4.14/net-ena-fix-uses-of-round_jiffies.patch b/queue-4.14/net-ena-fix-uses-of-round_jiffies.patch new file mode 100644 index 00000000000..2c198c42f07 --- /dev/null +++ b/queue-4.14/net-ena-fix-uses-of-round_jiffies.patch @@ -0,0 +1,75 @@ +From 34d63f77966b618a5accf5f3f88a481bb958cff7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 11 Feb 2020 15:17:41 +0000 +Subject: net: ena: fix uses of round_jiffies() + +From: Arthur Kiyanovski + +[ Upstream commit 2a6e5fa2f4c25b66c763428a3e65363214946931 ] + +>From the documentation of round_jiffies(): +"Rounds a time delta in the future (in jiffies) up or down to +(approximately) full seconds. This is useful for timers for which +the exact time they fire does not matter too much, as long as +they fire approximately every X seconds. +By rounding these timers to whole seconds, all such timers will fire +at the same time, rather than at various times spread out. The goal +of this is to have the CPU wake up less, which saves power." + +There are 2 parts to this patch: +================================ +Part 1: +------- +In our case we need timer_service to be called approximately every +X=1 seconds, and the exact time does not matter, so using round_jiffies() +is the right way to go. + +Therefore we add round_jiffies() to the mod_timer() in ena_timer_service(). + +Part 2: +------- +round_jiffies() is used in check_for_missing_keep_alive() when +getting the jiffies of the expiration of the keep_alive timeout. Here it +is actually a mistake to use round_jiffies() because we want the exact +time when keep_alive should expire and not an approximate rounded time, +which can cause early, false positive, timeouts. + +Therefore we remove round_jiffies() in the calculation of +keep_alive_expired() in check_for_missing_keep_alive(). + +Fixes: 82ef30f13be0 ("net: ena: add hardware hints capability to the driver") +Fixes: 1738cd3ed342 ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)") +Signed-off-by: Arthur Kiyanovski +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/amazon/ena/ena_netdev.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c +index 518ff393a026b..d9ece9ac6f53c 100644 +--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c ++++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c +@@ -2803,8 +2803,8 @@ static void check_for_missing_keep_alive(struct ena_adapter *adapter) + if (adapter->keep_alive_timeout == ENA_HW_HINTS_NO_TIMEOUT) + return; + +- keep_alive_expired = round_jiffies(adapter->last_keep_alive_jiffies + +- adapter->keep_alive_timeout); ++ keep_alive_expired = adapter->last_keep_alive_jiffies + ++ adapter->keep_alive_timeout; + if (unlikely(time_is_before_jiffies(keep_alive_expired))) { + netif_err(adapter, drv, adapter->netdev, + "Keep alive watchdog timeout.\n"); +@@ -2906,7 +2906,7 @@ static void ena_timer_service(unsigned long data) + } + + /* Reset the timer */ +- mod_timer(&adapter->timer_service, jiffies + HZ); ++ mod_timer(&adapter->timer_service, round_jiffies(jiffies + HZ)); + } + + static int ena_calc_io_queue_num(struct pci_dev *pdev, +-- +2.20.1 + diff --git a/queue-4.14/net-ena-rss-fix-failure-to-get-indirection-table.patch b/queue-4.14/net-ena-rss-fix-failure-to-get-indirection-table.patch new file mode 100644 index 00000000000..c3c90e306b6 --- /dev/null +++ b/queue-4.14/net-ena-rss-fix-failure-to-get-indirection-table.patch @@ -0,0 +1,52 @@ +From 1e4af737e9cb6e37332fb00c92fd7557cc77910f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 11 Feb 2020 15:17:45 +0000 +Subject: net: ena: rss: fix failure to get indirection table + +From: Sameeh Jubran + +[ Upstream commit 0c8923c0a64fb5d14bebb9a9065d2dc25ac5e600 ] + +On old hardware, getting / setting the hash function is not supported while +gettting / setting the indirection table is. + +This commit enables us to still show the indirection table on older +hardwares by setting the hash function and key to NULL. + +Fixes: 1738cd3ed342 ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)") +Signed-off-by: Sameeh Jubran +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/amazon/ena/ena_ethtool.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/drivers/net/ethernet/amazon/ena/ena_ethtool.c b/drivers/net/ethernet/amazon/ena/ena_ethtool.c +index c58ad61909519..7ca7bade1c090 100644 +--- a/drivers/net/ethernet/amazon/ena/ena_ethtool.c ++++ b/drivers/net/ethernet/amazon/ena/ena_ethtool.c +@@ -660,7 +660,21 @@ static int ena_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, + if (rc) + return rc; + ++ /* We call this function in order to check if the device ++ * supports getting/setting the hash function. ++ */ + rc = ena_com_get_hash_function(adapter->ena_dev, &ena_func, key); ++ ++ if (rc) { ++ if (rc == -EOPNOTSUPP) { ++ key = NULL; ++ hfunc = NULL; ++ rc = 0; ++ } ++ ++ return rc; ++ } ++ + if (rc) + return rc; + +-- +2.20.1 + diff --git a/queue-4.14/net-ena-rss-store-hash-function-as-values-and-not-bi.patch b/queue-4.14/net-ena-rss-store-hash-function-as-values-and-not-bi.patch new file mode 100644 index 00000000000..07e64ff031d --- /dev/null +++ b/queue-4.14/net-ena-rss-store-hash-function-as-values-and-not-bi.patch @@ -0,0 +1,56 @@ +From 3e4a91cee0603e3b63880654dc88097735d58116 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 11 Feb 2020 15:17:46 +0000 +Subject: net: ena: rss: store hash function as values and not bits + +From: Arthur Kiyanovski + +[ Upstream commit 4844470d472d660c26149ad764da2406adb13423 ] + +The device receives, stores and retrieves the hash function value as bits +and not as their enum value. + +The bug: +* In ena_com_set_hash_function() we set + cmd.u.flow_hash_func.selected_func to the bit value of rss->hash_func. + (1 << rss->hash_func) +* In ena_com_get_hash_function() we retrieve the hash function and store + it's bit value in rss->hash_func. (Now the bit value of rss->hash_func + is stored in rss->hash_func instead of it's enum value) + +The fix: +This commit fixes the issue by converting the retrieved hash function +values from the device to the matching enum value of the set bit using +ffs(). ffs() finds the first set bit's index in a word. Since the function +returns 1 for the LSB's index, we need to subtract 1 from the returned +value (note that BIT(0) is 1). + +Fixes: 1738cd3ed342 ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)") +Signed-off-by: Sameeh Jubran +Signed-off-by: Arthur Kiyanovski +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/amazon/ena/ena_com.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/amazon/ena/ena_com.c b/drivers/net/ethernet/amazon/ena/ena_com.c +index c5df80f31005f..552db5399503f 100644 +--- a/drivers/net/ethernet/amazon/ena/ena_com.c ++++ b/drivers/net/ethernet/amazon/ena/ena_com.c +@@ -2128,7 +2128,11 @@ int ena_com_get_hash_function(struct ena_com_dev *ena_dev, + if (unlikely(rc)) + return rc; + +- rss->hash_func = get_resp.u.flow_hash_func.selected_func; ++ /* ffs() returns 1 in case the lsb is set */ ++ rss->hash_func = ffs(get_resp.u.flow_hash_func.selected_func); ++ if (rss->hash_func) ++ rss->hash_func--; ++ + if (func) + *func = rss->hash_func; + +-- +2.20.1 + diff --git a/queue-4.14/qmi_wwan-re-add-dw5821e-pre-production-variant.patch b/queue-4.14/qmi_wwan-re-add-dw5821e-pre-production-variant.patch new file mode 100644 index 00000000000..4a66ea57e4a --- /dev/null +++ b/queue-4.14/qmi_wwan-re-add-dw5821e-pre-production-variant.patch @@ -0,0 +1,79 @@ +From 24f74604b9470bb498d2c51e738f1928722b6b76 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 8 Feb 2020 15:50:36 +0100 +Subject: qmi_wwan: re-add DW5821e pre-production variant +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Bjørn Mork + +[ Upstream commit 88bf54603f6f2c137dfee1abf6436ceac3528d2d ] + +Commit f25e1392fdb5 removed the support for the pre-production variant +of the Dell DW5821e to avoid probing another USB interface unnecessarily. +However, the pre-production samples are found in the wild, and this lack +of support is causing problems for users of such samples. It is therefore +necessary to support both variants. + +Matching on both interfaces 0 and 1 is not expected to cause any problem +with either variant, as only the QMI function will be probed successfully +on either. Interface 1 will be rejected based on the HID class for the +production variant: + +T: Bus=01 Lev=03 Prnt=04 Port=00 Cnt=01 Dev#= 16 Spd=480 MxCh= 0 +D: Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 2 +P: Vendor=413c ProdID=81d7 Rev=03.18 +S: Manufacturer=DELL +S: Product=DW5821e Snapdragon X20 LTE +S: SerialNumber=0123456789ABCDEF +C: #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA +I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan +I: If#= 1 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=00 Prot=00 Driver=usbhid +I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option +I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option +I: If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option +I: If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option + +And interface 0 will be rejected based on too few endpoints for the +pre-production variant: + +T: Bus=01 Lev=02 Prnt=02 Port=03 Cnt=03 Dev#= 7 Spd=480 MxCh= 0 +D: Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 2 +P: Vendor=413c ProdID=81d7 Rev= 3.18 +S: Manufacturer=DELL +S: Product=DW5821e Snapdragon X20 LTE +S: SerialNumber=0123456789ABCDEF +C: #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA +I: If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver= +I: If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan +I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option +I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option +I: If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option + +Fixes: f25e1392fdb5 ("qmi_wwan: fix interface number for DW5821e production firmware") +Link: https://whrl.pl/Rf0vNk +Reported-by: Lars Melin +Cc: Aleksander Morgado +Signed-off-by: Bjørn Mork +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/usb/qmi_wwan.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c +index db70d4c5778a6..08215a9f61454 100644 +--- a/drivers/net/usb/qmi_wwan.c ++++ b/drivers/net/usb/qmi_wwan.c +@@ -1287,6 +1287,7 @@ static const struct usb_device_id products[] = { + {QMI_FIXED_INTF(0x413c, 0x81b6, 8)}, /* Dell Wireless 5811e */ + {QMI_FIXED_INTF(0x413c, 0x81b6, 10)}, /* Dell Wireless 5811e */ + {QMI_FIXED_INTF(0x413c, 0x81d7, 0)}, /* Dell Wireless 5821e */ ++ {QMI_FIXED_INTF(0x413c, 0x81d7, 1)}, /* Dell Wireless 5821e preproduction config */ + {QMI_FIXED_INTF(0x413c, 0x81e0, 0)}, /* Dell Wireless 5821e with eSIM support*/ + {QMI_FIXED_INTF(0x03f0, 0x4e1d, 8)}, /* HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module */ + {QMI_FIXED_INTF(0x03f0, 0x9d1d, 1)}, /* HP lt4120 Snapdragon X5 LTE */ +-- +2.20.1 + diff --git a/queue-4.14/qmi_wwan-unconditionally-reject-2-ep-interfaces.patch b/queue-4.14/qmi_wwan-unconditionally-reject-2-ep-interfaces.patch new file mode 100644 index 00000000000..a4e11492f29 --- /dev/null +++ b/queue-4.14/qmi_wwan-unconditionally-reject-2-ep-interfaces.patch @@ -0,0 +1,135 @@ +From 50ffc50513d1079bcf48dec9b3b5d05850217e6c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 8 Feb 2020 16:55:04 +0100 +Subject: qmi_wwan: unconditionally reject 2 ep interfaces +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Bjørn Mork + +[ Upstream commit 00516d13d4cfa56ce39da144db2dbf08b09b9357 ] + +We have been using the fact that the QMI and DIAG functions +usually are the only ones with class/subclass/protocol being +ff/ff/ff on Quectel modems. This has allowed us to match the +QMI function without knowing the exact interface number, +which can vary depending on firmware configuration. + +The ability to silently reject the DIAG function, which is +usually handled by the option driver, is important for this +method to work. This is done based on the knowledge that it +has exactly 2 bulk endpoints. QMI function control interfaces +will have either 3 or 1 endpoint. This rule is universal so +the quirk condition can be removed. + +The fixed layouts known from the Gobi1k and Gobi2k modems +have been gradually replaced by more dynamic layouts, and +many vendors now use configurable layouts without changing +device IDs. Renaming the class/subclass/protocol matching +macro makes it more obvious that this is now not Quectel +specific anymore. + +Cc: Kristian Evensen +Cc: Aleksander Morgado +Signed-off-by: Bjørn Mork +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/usb/qmi_wwan.c | 42 ++++++++++++++------------------------ + 1 file changed, 15 insertions(+), 27 deletions(-) + +diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c +index 08215a9f61454..189715438328f 100644 +--- a/drivers/net/usb/qmi_wwan.c ++++ b/drivers/net/usb/qmi_wwan.c +@@ -63,7 +63,6 @@ enum qmi_wwan_flags { + + enum qmi_wwan_quirks { + QMI_WWAN_QUIRK_DTR = 1 << 0, /* needs "set DTR" request */ +- QMI_WWAN_QUIRK_QUECTEL_DYNCFG = 1 << 1, /* check num. endpoints */ + }; + + struct qmimux_hdr { +@@ -853,16 +852,6 @@ static const struct driver_info qmi_wwan_info_quirk_dtr = { + .data = QMI_WWAN_QUIRK_DTR, + }; + +-static const struct driver_info qmi_wwan_info_quirk_quectel_dyncfg = { +- .description = "WWAN/QMI device", +- .flags = FLAG_WWAN | FLAG_SEND_ZLP, +- .bind = qmi_wwan_bind, +- .unbind = qmi_wwan_unbind, +- .manage_power = qmi_wwan_manage_power, +- .rx_fixup = qmi_wwan_rx_fixup, +- .data = QMI_WWAN_QUIRK_DTR | QMI_WWAN_QUIRK_QUECTEL_DYNCFG, +-}; +- + #define HUAWEI_VENDOR_ID 0x12D1 + + /* map QMI/wwan function by a fixed interface number */ +@@ -883,14 +872,18 @@ static const struct driver_info qmi_wwan_info_quirk_quectel_dyncfg = { + #define QMI_GOBI_DEVICE(vend, prod) \ + QMI_FIXED_INTF(vend, prod, 0) + +-/* Quectel does not use fixed interface numbers on at least some of their +- * devices. We need to check the number of endpoints to ensure that we bind to +- * the correct interface. ++/* Many devices have QMI and DIAG functions which are distinguishable ++ * from other vendor specific functions by class, subclass and ++ * protocol all being 0xff. The DIAG function has exactly 2 endpoints ++ * and is silently rejected when probed. ++ * ++ * This makes it possible to match dynamically numbered QMI functions ++ * as seen on e.g. many Quectel modems. + */ +-#define QMI_QUIRK_QUECTEL_DYNCFG(vend, prod) \ ++#define QMI_MATCH_FF_FF_FF(vend, prod) \ + USB_DEVICE_AND_INTERFACE_INFO(vend, prod, USB_CLASS_VENDOR_SPEC, \ + USB_SUBCLASS_VENDOR_SPEC, 0xff), \ +- .driver_info = (unsigned long)&qmi_wwan_info_quirk_quectel_dyncfg ++ .driver_info = (unsigned long)&qmi_wwan_info_quirk_dtr + + static const struct usb_device_id products[] = { + /* 1. CDC ECM like devices match on the control interface */ +@@ -996,10 +989,10 @@ static const struct usb_device_id products[] = { + USB_DEVICE_AND_INTERFACE_INFO(0x03f0, 0x581d, USB_CLASS_VENDOR_SPEC, 1, 7), + .driver_info = (unsigned long)&qmi_wwan_info, + }, +- {QMI_QUIRK_QUECTEL_DYNCFG(0x2c7c, 0x0125)}, /* Quectel EC25, EC20 R2.0 Mini PCIe */ +- {QMI_QUIRK_QUECTEL_DYNCFG(0x2c7c, 0x0306)}, /* Quectel EP06/EG06/EM06 */ +- {QMI_QUIRK_QUECTEL_DYNCFG(0x2c7c, 0x0512)}, /* Quectel EG12/EM12 */ +- {QMI_QUIRK_QUECTEL_DYNCFG(0x2c7c, 0x0800)}, /* Quectel RM500Q-GL */ ++ {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0125)}, /* Quectel EC25, EC20 R2.0 Mini PCIe */ ++ {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0306)}, /* Quectel EP06/EG06/EM06 */ ++ {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0512)}, /* Quectel EG12/EM12 */ ++ {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0800)}, /* Quectel RM500Q-GL */ + + /* 3. Combined interface devices matching on interface number */ + {QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */ +@@ -1379,7 +1372,6 @@ static int qmi_wwan_probe(struct usb_interface *intf, + { + struct usb_device_id *id = (struct usb_device_id *)prod; + struct usb_interface_descriptor *desc = &intf->cur_altsetting->desc; +- const struct driver_info *info; + + /* Workaround to enable dynamic IDs. This disables usbnet + * blacklisting functionality. Which, if required, can be +@@ -1415,12 +1407,8 @@ static int qmi_wwan_probe(struct usb_interface *intf, + * different. Ignore the current interface if the number of endpoints + * equals the number for the diag interface (two). + */ +- info = (void *)id->driver_info; +- +- if (info->data & QMI_WWAN_QUIRK_QUECTEL_DYNCFG) { +- if (desc->bNumEndpoints == 2) +- return -ENODEV; +- } ++ if (desc->bNumEndpoints == 2) ++ return -ENODEV; + + return usbnet_probe(intf, id); + } +-- +2.20.1 + diff --git a/queue-4.14/series b/queue-4.14/series index 73efe5f48f8..df32bfbb916 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -3,3 +3,23 @@ netfilter-nf_conntrack-resolve-clash-for-matching-co.patch ext4-fix-potential-race-between-online-resizing-and-.patch ext4-fix-potential-race-between-s_flex_groups-online.patch ext4-fix-potential-race-between-s_group_info-online-.patch +ipmi-ssif-handle-a-possible-null-pointer-reference.patch +drm-msm-set-dma-maximum-segment-size-for-mdss.patch +dax-pass-nowait-flag-to-iomap_apply.patch +mac80211-consider-more-elements-in-parsing-crc.patch +cfg80211-check-wiphy-driver-existence-for-drvinfo-re.patch +qmi_wwan-re-add-dw5821e-pre-production-variant.patch +qmi_wwan-unconditionally-reject-2-ep-interfaces.patch +arm-ftrace-fix-be-text-poking.patch +net-ena-fix-potential-crash-when-rxfh-key-is-null.patch +net-ena-fix-uses-of-round_jiffies.patch +net-ena-add-missing-ethtool-tx-timestamping-indicati.patch +net-ena-fix-incorrect-default-rss-key.patch +net-ena-rss-fix-failure-to-get-indirection-table.patch +net-ena-rss-store-hash-function-as-values-and-not-bi.patch +net-ena-fix-incorrectly-saving-queue-numbers-when-se.patch +net-ena-ethtool-use-correct-value-for-crc32-hash.patch +net-ena-ena-com.c-prevent-null-pointer-dereference.patch +cifs-fix-mode-output-in-debugging-statements.patch +bcache-ignore-pending-signals-when-creating-gc-and-a.patch +cfg80211-add-missing-policy-for-nl80211_attr_status_.patch