From: Greg Kroah-Hartman Date: Thu, 16 Jan 2020 13:04:14 +0000 (+0100) Subject: 5.4-stable patches X-Git-Tag: v4.14.166~14 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c82a2b0d461443a6ae7f75c1ffd58aae55a14f17;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: affs-fix-a-memory-leak-in-affs_remount.patch clk-fix-memory-leak-in-clk_unregister.patch clk-imx-pll14xx-fix-quick-switch-of-s-k-parameter.patch clk-meson-axg-audio-fix-regmap-last-register.patch clk-samsung-exynos5420-preserve-cpu-clocks-configuration-during-suspend-resume.patch crypto-algif_skcipher-use-chunksize-instead-of-blocksize.patch crypto-arm64-aes-neonbs-add-return-value-of-skcipher_walk_done-in-__xts_crypt.patch crypto-cavium-nitrox-fix-firmware-assignment-to-ae-cores.patch crypto-geode-aes-convert-to-skcipher-api-and-make-thread-safe.patch crypto-hisilicon-select-need_sg_dma_length-in-qm-kconfig.patch crypto-virtio-implement-missing-support-for-output-ivs.patch dmaengine-dw-platform-mark-hclk-clock-optional.patch iio-imu-adis16480-assign-bias-value-only-if-operation-succeeded.patch iio-imu-st_lsm6dsx-fix-gyro-gain-definitions-for-lsm9ds1.patch mei-fix-modalias-documentation.patch nfsd-fix-cld_net-cn_tfm-initialization.patch nfsd-v4-support-requires-crypto_sha256.patch nfsv2-fix-a-typo-in-encode_sattr.patch nfsv4.x-drop-the-slot-if-nfs4_delegreturn_prepare-waits-for-layoutreturn.patch nfsv4.x-handle-bad-dead-sessions-correctly-in-nfs41_sequence_process.patch pinctl-ti-iodelay-fix-error-checking-on-pinctrl_count_index_with_args-call.patch pinctrl-lewisburg-update-pin-list-according-to-v1.1v6.patch pinctrl-sh-pfc-do-not-use-platform_get_irq-to-count-interrupts.patch pinctrl-sh-pfc-fix-pinmux_ipsr_phys-to-set-gpsr.patch rsi-fix-potential-null-dereference-in-rsi_probe.patch --- diff --git a/queue-5.4/affs-fix-a-memory-leak-in-affs_remount.patch b/queue-5.4/affs-fix-a-memory-leak-in-affs_remount.patch new file mode 100644 index 00000000000..e369c1fb00f --- /dev/null +++ b/queue-5.4/affs-fix-a-memory-leak-in-affs_remount.patch @@ -0,0 +1,56 @@ +From 450c3d4166837c496ebce03650c08800991f2150 Mon Sep 17 00:00:00 2001 +From: Navid Emamdoost +Date: Wed, 2 Oct 2019 16:52:37 -0500 +Subject: affs: fix a memory leak in affs_remount + +From: Navid Emamdoost + +commit 450c3d4166837c496ebce03650c08800991f2150 upstream. + +In affs_remount if data is provided it is duplicated into new_opts. The +allocated memory for new_opts is only released if parse_options fails. + +There's a bit of history behind new_options, originally there was +save/replace options on the VFS layer so the 'data' passed must not +change (thus strdup), this got cleaned up in later patches. But not +completely. + +There's no reason to do the strdup in cases where the filesystem does +not need to reuse the 'data' again, because strsep would modify it +directly. + +Fixes: c8f33d0bec99 ("affs: kstrdup() memory handling") +Signed-off-by: Navid Emamdoost +[ update changelog ] +Signed-off-by: David Sterba +Signed-off-by: Greg Kroah-Hartman + +--- + fs/affs/super.c | 6 ------ + 1 file changed, 6 deletions(-) + +--- a/fs/affs/super.c ++++ b/fs/affs/super.c +@@ -561,14 +561,9 @@ affs_remount(struct super_block *sb, int + int root_block; + unsigned long mount_flags; + int res = 0; +- char *new_opts; + char volume[32]; + char *prefix = NULL; + +- new_opts = kstrdup(data, GFP_KERNEL); +- if (data && !new_opts) +- return -ENOMEM; +- + pr_debug("%s(flags=0x%x,opts=\"%s\")\n", __func__, *flags, data); + + sync_filesystem(sb); +@@ -579,7 +574,6 @@ affs_remount(struct super_block *sb, int + &blocksize, &prefix, volume, + &mount_flags)) { + kfree(prefix); +- kfree(new_opts); + return -EINVAL; + } + diff --git a/queue-5.4/clk-fix-memory-leak-in-clk_unregister.patch b/queue-5.4/clk-fix-memory-leak-in-clk_unregister.patch new file mode 100644 index 00000000000..c2ce246f1ba --- /dev/null +++ b/queue-5.4/clk-fix-memory-leak-in-clk_unregister.patch @@ -0,0 +1,56 @@ +From 8247470772beb38822f226c99a2ed8c195f6b438 Mon Sep 17 00:00:00 2001 +From: Kishon Vijay Abraham I +Date: Tue, 22 Oct 2019 12:41:53 +0530 +Subject: clk: Fix memory leak in clk_unregister() + +From: Kishon Vijay Abraham I + +commit 8247470772beb38822f226c99a2ed8c195f6b438 upstream. + +Memory allocated in alloc_clk() for 'struct clk' and +'const char *con_id' while invoking clk_register() is never freed +in clk_unregister(), resulting in kmemleak showing the following +backtrace. + + backtrace: + [<00000000546f5dd0>] kmem_cache_alloc+0x18c/0x270 + [<0000000073a32862>] alloc_clk+0x30/0x70 + [<0000000082942480>] __clk_register+0xc8/0x760 + [<000000005c859fca>] devm_clk_register+0x54/0xb0 + [<00000000868834a8>] 0xffff800008c60950 + [<00000000d5a80534>] platform_drv_probe+0x50/0xa0 + [<000000001b3889fc>] really_probe+0x108/0x348 + [<00000000953fa60a>] driver_probe_device+0x58/0x100 + [<0000000008acc17c>] device_driver_attach+0x6c/0x90 + [<0000000022813df3>] __driver_attach+0x84/0xc8 + [<00000000448d5443>] bus_for_each_dev+0x74/0xc8 + [<00000000294aa93f>] driver_attach+0x20/0x28 + [<00000000e5e52626>] bus_add_driver+0x148/0x1f0 + [<000000001de21efc>] driver_register+0x60/0x110 + [<00000000af07c068>] __platform_driver_register+0x40/0x48 + [<0000000060fa80ee>] 0xffff800008c66020 + +Fix it here. + +Cc: Tomi Valkeinen +Cc: Tero Kristo +Signed-off-by: Kishon Vijay Abraham I +Link: https://lkml.kernel.org/r/20191022071153.21118-1-kishon@ti.com +Fixes: 1df4046a93e0 ("clk: Combine __clk_get() and __clk_create_clk()") +Signed-off-by: Stephen Boyd +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/clk/clk.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/clk/clk.c ++++ b/drivers/clk/clk.c +@@ -3886,6 +3886,7 @@ void clk_unregister(struct clk *clk) + __func__, clk->core->name); + + kref_put(&clk->core->ref, __clk_release); ++ free_clk(clk); + unlock: + clk_prepare_unlock(); + } diff --git a/queue-5.4/clk-imx-pll14xx-fix-quick-switch-of-s-k-parameter.patch b/queue-5.4/clk-imx-pll14xx-fix-quick-switch-of-s-k-parameter.patch new file mode 100644 index 00000000000..a45763cb658 --- /dev/null +++ b/queue-5.4/clk-imx-pll14xx-fix-quick-switch-of-s-k-parameter.patch @@ -0,0 +1,100 @@ +From 094234fcf46146339caaac8282aa15d225a5911a Mon Sep 17 00:00:00 2001 +From: Leonard Crestez +Date: Wed, 4 Sep 2019 12:49:18 +0300 +Subject: clk: imx: pll14xx: Fix quick switch of S/K parameter + +From: Leonard Crestez + +commit 094234fcf46146339caaac8282aa15d225a5911a upstream. + +The PLL14xx on imx8m can change the S and K parameter without requiring +a reset and relock of the whole PLL. + +Fix clk_pll144xx_mp_change register reading and use it for pll1443 as +well since no reset+relock is required on K changes either. + +Signed-off-by: Leonard Crestez +Fixes: 8646d4dcc7fb ("clk: imx: Add PLLs driver for imx8mm soc") +Signed-off-by: Shawn Guo +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/clk/imx/clk-pll14xx.c | 40 ++++++++-------------------------------- + 1 file changed, 8 insertions(+), 32 deletions(-) + +--- a/drivers/clk/imx/clk-pll14xx.c ++++ b/drivers/clk/imx/clk-pll14xx.c +@@ -112,43 +112,17 @@ static unsigned long clk_pll1443x_recalc + return fvco; + } + +-static inline bool clk_pll1416x_mp_change(const struct imx_pll14xx_rate_table *rate, ++static inline bool clk_pll14xx_mp_change(const struct imx_pll14xx_rate_table *rate, + u32 pll_div) + { + u32 old_mdiv, old_pdiv; + +- old_mdiv = (pll_div >> MDIV_SHIFT) & MDIV_MASK; +- old_pdiv = (pll_div >> PDIV_SHIFT) & PDIV_MASK; ++ old_mdiv = (pll_div & MDIV_MASK) >> MDIV_SHIFT; ++ old_pdiv = (pll_div & PDIV_MASK) >> PDIV_SHIFT; + + return rate->mdiv != old_mdiv || rate->pdiv != old_pdiv; + } + +-static inline bool clk_pll1443x_mpk_change(const struct imx_pll14xx_rate_table *rate, +- u32 pll_div_ctl0, u32 pll_div_ctl1) +-{ +- u32 old_mdiv, old_pdiv, old_kdiv; +- +- old_mdiv = (pll_div_ctl0 >> MDIV_SHIFT) & MDIV_MASK; +- old_pdiv = (pll_div_ctl0 >> PDIV_SHIFT) & PDIV_MASK; +- old_kdiv = (pll_div_ctl1 >> KDIV_SHIFT) & KDIV_MASK; +- +- return rate->mdiv != old_mdiv || rate->pdiv != old_pdiv || +- rate->kdiv != old_kdiv; +-} +- +-static inline bool clk_pll1443x_mp_change(const struct imx_pll14xx_rate_table *rate, +- u32 pll_div_ctl0, u32 pll_div_ctl1) +-{ +- u32 old_mdiv, old_pdiv, old_kdiv; +- +- old_mdiv = (pll_div_ctl0 >> MDIV_SHIFT) & MDIV_MASK; +- old_pdiv = (pll_div_ctl0 >> PDIV_SHIFT) & PDIV_MASK; +- old_kdiv = (pll_div_ctl1 >> KDIV_SHIFT) & KDIV_MASK; +- +- return rate->mdiv != old_mdiv || rate->pdiv != old_pdiv || +- rate->kdiv != old_kdiv; +-} +- + static int clk_pll14xx_wait_lock(struct clk_pll14xx *pll) + { + u32 val; +@@ -174,7 +148,7 @@ static int clk_pll1416x_set_rate(struct + + tmp = readl_relaxed(pll->base + 4); + +- if (!clk_pll1416x_mp_change(rate, tmp)) { ++ if (!clk_pll14xx_mp_change(rate, tmp)) { + tmp &= ~(SDIV_MASK) << SDIV_SHIFT; + tmp |= rate->sdiv << SDIV_SHIFT; + writel_relaxed(tmp, pll->base + 4); +@@ -239,13 +213,15 @@ static int clk_pll1443x_set_rate(struct + } + + tmp = readl_relaxed(pll->base + 4); +- div_val = readl_relaxed(pll->base + 8); + +- if (!clk_pll1443x_mpk_change(rate, tmp, div_val)) { ++ if (!clk_pll14xx_mp_change(rate, tmp)) { + tmp &= ~(SDIV_MASK) << SDIV_SHIFT; + tmp |= rate->sdiv << SDIV_SHIFT; + writel_relaxed(tmp, pll->base + 4); + ++ tmp = rate->kdiv << KDIV_SHIFT; ++ writel_relaxed(tmp, pll->base + 8); ++ + return 0; + } + diff --git a/queue-5.4/clk-meson-axg-audio-fix-regmap-last-register.patch b/queue-5.4/clk-meson-axg-audio-fix-regmap-last-register.patch new file mode 100644 index 00000000000..171412a05cb --- /dev/null +++ b/queue-5.4/clk-meson-axg-audio-fix-regmap-last-register.patch @@ -0,0 +1,32 @@ +From 255cab9d27d78703f7450d720859ee146d0ee6e1 Mon Sep 17 00:00:00 2001 +From: Jerome Brunet +Date: Wed, 2 Oct 2019 11:15:26 +0200 +Subject: clk: meson: axg-audio: fix regmap last register + +From: Jerome Brunet + +commit 255cab9d27d78703f7450d720859ee146d0ee6e1 upstream. + +Since the addition of the g12a, the last register is +AUDIO_CLK_SPDIFOUT_B_CTRL. + +Fixes: 075001385c66 ("clk: meson: axg-audio: add g12a support") +Acked-by: Neil Armstrong +Signed-off-by: Jerome Brunet +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/clk/meson/axg-audio.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/clk/meson/axg-audio.c ++++ b/drivers/clk/meson/axg-audio.c +@@ -1001,7 +1001,7 @@ static const struct regmap_config axg_au + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 4, +- .max_register = AUDIO_CLK_PDMIN_CTRL1, ++ .max_register = AUDIO_CLK_SPDIFOUT_B_CTRL, + }; + + struct audioclk_data { diff --git a/queue-5.4/clk-samsung-exynos5420-preserve-cpu-clocks-configuration-during-suspend-resume.patch b/queue-5.4/clk-samsung-exynos5420-preserve-cpu-clocks-configuration-during-suspend-resume.patch new file mode 100644 index 00000000000..294b8b1c4bf --- /dev/null +++ b/queue-5.4/clk-samsung-exynos5420-preserve-cpu-clocks-configuration-during-suspend-resume.patch @@ -0,0 +1,34 @@ +From e21be0d1d7bd7f78a77613f6bcb6965e72b22fc1 Mon Sep 17 00:00:00 2001 +From: Marian Mihailescu +Date: Tue, 29 Oct 2019 11:20:25 +1030 +Subject: clk: samsung: exynos5420: Preserve CPU clocks configuration during suspend/resume + +From: Marian Mihailescu + +commit e21be0d1d7bd7f78a77613f6bcb6965e72b22fc1 upstream. + +Save and restore top PLL related configuration registers for big (APLL) +and LITTLE (KPLL) cores during suspend/resume cycle. So far, CPU clocks +were reset to default values after suspend/resume cycle and performance +after system resume was affected when performance governor has been selected. + +Fixes: 773424326b51 ("clk: samsung: exynos5420: add more registers to restore list") +Signed-off-by: Marian Mihailescu +Signed-off-by: Sylwester Nawrocki +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/clk/samsung/clk-exynos5420.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/clk/samsung/clk-exynos5420.c ++++ b/drivers/clk/samsung/clk-exynos5420.c +@@ -165,6 +165,8 @@ static const unsigned long exynos5x_clk_ + GATE_BUS_CPU, + GATE_SCLK_CPU, + CLKOUT_CMU_CPU, ++ APLL_CON0, ++ KPLL_CON0, + CPLL_CON0, + DPLL_CON0, + EPLL_CON0, diff --git a/queue-5.4/crypto-algif_skcipher-use-chunksize-instead-of-blocksize.patch b/queue-5.4/crypto-algif_skcipher-use-chunksize-instead-of-blocksize.patch new file mode 100644 index 00000000000..5bb2abce71f --- /dev/null +++ b/queue-5.4/crypto-algif_skcipher-use-chunksize-instead-of-blocksize.patch @@ -0,0 +1,126 @@ +From 5b0fe9552336338acb52756daf65dd7a4eeca73f Mon Sep 17 00:00:00 2001 +From: Herbert Xu +Date: Tue, 10 Sep 2019 11:42:05 +1000 +Subject: crypto: algif_skcipher - Use chunksize instead of blocksize + +From: Herbert Xu + +commit 5b0fe9552336338acb52756daf65dd7a4eeca73f upstream. + +When algif_skcipher does a partial operation it always process data +that is a multiple of blocksize. However, for algorithms such as +CTR this is wrong because even though it can process any number of +bytes overall, the partial block must come at the very end and not +in the middle. + +This is exactly what chunksize is meant to describe so this patch +changes blocksize to chunksize. + +Fixes: 8ff590903d5f ("crypto: algif_skcipher - User-space...") +Signed-off-by: Herbert Xu +Acked-by: Ard Biesheuvel +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman + +--- + crypto/algif_skcipher.c | 2 +- + include/crypto/internal/skcipher.h | 30 ------------------------------ + include/crypto/skcipher.h | 30 ++++++++++++++++++++++++++++++ + 3 files changed, 31 insertions(+), 31 deletions(-) + +--- a/crypto/algif_skcipher.c ++++ b/crypto/algif_skcipher.c +@@ -56,7 +56,7 @@ static int _skcipher_recvmsg(struct sock + struct alg_sock *pask = alg_sk(psk); + struct af_alg_ctx *ctx = ask->private; + struct crypto_skcipher *tfm = pask->private; +- unsigned int bs = crypto_skcipher_blocksize(tfm); ++ unsigned int bs = crypto_skcipher_chunksize(tfm); + struct af_alg_async_req *areq; + int err = 0; + size_t len = 0; +--- a/include/crypto/internal/skcipher.h ++++ b/include/crypto/internal/skcipher.h +@@ -205,19 +205,6 @@ static inline unsigned int crypto_skciph + return alg->max_keysize; + } + +-static inline unsigned int crypto_skcipher_alg_chunksize( +- struct skcipher_alg *alg) +-{ +- if ((alg->base.cra_flags & CRYPTO_ALG_TYPE_MASK) == +- CRYPTO_ALG_TYPE_BLKCIPHER) +- return alg->base.cra_blocksize; +- +- if (alg->base.cra_ablkcipher.encrypt) +- return alg->base.cra_blocksize; +- +- return alg->chunksize; +-} +- + static inline unsigned int crypto_skcipher_alg_walksize( + struct skcipher_alg *alg) + { +@@ -232,23 +219,6 @@ static inline unsigned int crypto_skciph + } + + /** +- * crypto_skcipher_chunksize() - obtain chunk size +- * @tfm: cipher handle +- * +- * The block size is set to one for ciphers such as CTR. However, +- * you still need to provide incremental updates in multiples of +- * the underlying block size as the IV does not have sub-block +- * granularity. This is known in this API as the chunk size. +- * +- * Return: chunk size in bytes +- */ +-static inline unsigned int crypto_skcipher_chunksize( +- struct crypto_skcipher *tfm) +-{ +- return crypto_skcipher_alg_chunksize(crypto_skcipher_alg(tfm)); +-} +- +-/** + * crypto_skcipher_walksize() - obtain walk size + * @tfm: cipher handle + * +--- a/include/crypto/skcipher.h ++++ b/include/crypto/skcipher.h +@@ -304,6 +304,36 @@ static inline unsigned int crypto_skciph + return crypto_tfm_alg_blocksize(crypto_skcipher_tfm(tfm)); + } + ++static inline unsigned int crypto_skcipher_alg_chunksize( ++ struct skcipher_alg *alg) ++{ ++ if ((alg->base.cra_flags & CRYPTO_ALG_TYPE_MASK) == ++ CRYPTO_ALG_TYPE_BLKCIPHER) ++ return alg->base.cra_blocksize; ++ ++ if (alg->base.cra_ablkcipher.encrypt) ++ return alg->base.cra_blocksize; ++ ++ return alg->chunksize; ++} ++ ++/** ++ * crypto_skcipher_chunksize() - obtain chunk size ++ * @tfm: cipher handle ++ * ++ * The block size is set to one for ciphers such as CTR. However, ++ * you still need to provide incremental updates in multiples of ++ * the underlying block size as the IV does not have sub-block ++ * granularity. This is known in this API as the chunk size. ++ * ++ * Return: chunk size in bytes ++ */ ++static inline unsigned int crypto_skcipher_chunksize( ++ struct crypto_skcipher *tfm) ++{ ++ return crypto_skcipher_alg_chunksize(crypto_skcipher_alg(tfm)); ++} ++ + static inline unsigned int crypto_sync_skcipher_blocksize( + struct crypto_sync_skcipher *tfm) + { diff --git a/queue-5.4/crypto-arm64-aes-neonbs-add-return-value-of-skcipher_walk_done-in-__xts_crypt.patch b/queue-5.4/crypto-arm64-aes-neonbs-add-return-value-of-skcipher_walk_done-in-__xts_crypt.patch new file mode 100644 index 00000000000..52931266944 --- /dev/null +++ b/queue-5.4/crypto-arm64-aes-neonbs-add-return-value-of-skcipher_walk_done-in-__xts_crypt.patch @@ -0,0 +1,35 @@ +From 9b537997b669c42cec67893538037e8d1c83c91c Mon Sep 17 00:00:00 2001 +From: Yunfeng Ye +Date: Tue, 22 Oct 2019 16:11:18 +0800 +Subject: crypto: arm64/aes-neonbs - add return value of skcipher_walk_done() in __xts_crypt() + +From: Yunfeng Ye + +commit 9b537997b669c42cec67893538037e8d1c83c91c upstream. + +A warning is found by the static code analysis tool: + "Identical condition 'err', second condition is always false" + +Fix this by adding return value of skcipher_walk_done(). + +Fixes: 67cfa5d3b721 ("crypto: arm64/aes-neonbs - implement ciphertext stealing for XTS") +Signed-off-by: Yunfeng Ye +Acked-by: Ard Biesheuvel +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman + +--- + arch/arm64/crypto/aes-neonbs-glue.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/arm64/crypto/aes-neonbs-glue.c ++++ b/arch/arm64/crypto/aes-neonbs-glue.c +@@ -384,7 +384,7 @@ static int __xts_crypt(struct skcipher_r + goto xts_tail; + + kernel_neon_end(); +- skcipher_walk_done(&walk, nbytes); ++ err = skcipher_walk_done(&walk, nbytes); + } + + if (err || likely(!tail)) diff --git a/queue-5.4/crypto-cavium-nitrox-fix-firmware-assignment-to-ae-cores.patch b/queue-5.4/crypto-cavium-nitrox-fix-firmware-assignment-to-ae-cores.patch new file mode 100644 index 00000000000..271f1f1e7b3 --- /dev/null +++ b/queue-5.4/crypto-cavium-nitrox-fix-firmware-assignment-to-ae-cores.patch @@ -0,0 +1,49 @@ +From 6a97a99db848748d582d79447f7c9c330ce1688e Mon Sep 17 00:00:00 2001 +From: Phani Kiran Hemadri +Date: Fri, 20 Sep 2019 06:35:19 +0000 +Subject: crypto: cavium/nitrox - fix firmware assignment to AE cores + +From: Phani Kiran Hemadri + +commit 6a97a99db848748d582d79447f7c9c330ce1688e upstream. + +This patch fixes assigning UCD block number of Asymmetric crypto +firmware to AE cores of CNN55XX device. + +Fixes: a7268c4d4205 ("crypto: cavium/nitrox - Add support for loading asymmetric crypto firmware") +Signed-off-by: Phani Kiran Hemadri +Reviewed-by: Srikanth Jampala +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/crypto/cavium/nitrox/nitrox_main.c | 9 ++++----- + 1 file changed, 4 insertions(+), 5 deletions(-) + +--- a/drivers/crypto/cavium/nitrox/nitrox_main.c ++++ b/drivers/crypto/cavium/nitrox/nitrox_main.c +@@ -103,8 +103,7 @@ static void write_to_ucd_unit(struct nit + offset = UCD_UCODE_LOAD_BLOCK_NUM; + nitrox_write_csr(ndev, offset, block_num); + +- code_size = ucode_size; +- code_size = roundup(code_size, 8); ++ code_size = roundup(ucode_size, 16); + while (code_size) { + data = ucode_data[i]; + /* write 8 bytes at a time */ +@@ -220,11 +219,11 @@ static int nitrox_load_fw(struct nitrox_ + + /* write block number and firmware length + * bit:<2:0> block number +- * bit:3 is set SE uses 32KB microcode +- * bit:3 is clear SE uses 64KB microcode ++ * bit:3 is set AE uses 32KB microcode ++ * bit:3 is clear AE uses 64KB microcode + */ + core_2_eid_val.value = 0ULL; +- core_2_eid_val.ucode_blk = 0; ++ core_2_eid_val.ucode_blk = 2; + if (ucode_size <= CNN55XX_UCD_BLOCK_SIZE) + core_2_eid_val.ucode_len = 1; + else diff --git a/queue-5.4/crypto-geode-aes-convert-to-skcipher-api-and-make-thread-safe.patch b/queue-5.4/crypto-geode-aes-convert-to-skcipher-api-and-make-thread-safe.patch new file mode 100644 index 00000000000..1384ff5fea1 --- /dev/null +++ b/queue-5.4/crypto-geode-aes-convert-to-skcipher-api-and-make-thread-safe.patch @@ -0,0 +1,702 @@ +From 4549f7e5aa27ffc2cba63b5db8842a3b486f5688 Mon Sep 17 00:00:00 2001 +From: Eric Biggers +Date: Thu, 10 Oct 2019 21:51:32 -0700 +Subject: crypto: geode-aes - convert to skcipher API and make thread-safe + +From: Eric Biggers + +commit 4549f7e5aa27ffc2cba63b5db8842a3b486f5688 upstream. + +The geode AES driver is heavily broken because it stores per-request +state in the transform context. So it will crash or produce the wrong +result if used by any of the many places in the kernel that issue +concurrent requests for the same transform object. + +This driver is also implemented using the deprecated blkcipher API, +which makes it difficult to fix, and puts it among the drivers +preventing that API from being removed. + +Convert this driver to use the skcipher API, and change it to not store +per-request state in the transform context. + +Fixes: 9fe757b0cfce ("[PATCH] crypto: Add support for the Geode LX AES hardware") +Signed-off-by: Eric Biggers +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/crypto/geode-aes.c | 448 +++++++++++++++------------------------------ + drivers/crypto/geode-aes.h | 15 - + 2 files changed, 153 insertions(+), 310 deletions(-) + +--- a/drivers/crypto/geode-aes.c ++++ b/drivers/crypto/geode-aes.c +@@ -10,7 +10,7 @@ + #include + #include + #include +-#include ++#include + + #include + #include +@@ -24,12 +24,12 @@ static spinlock_t lock; + + /* Write a 128 bit field (either a writable key or IV) */ + static inline void +-_writefield(u32 offset, void *value) ++_writefield(u32 offset, const void *value) + { + int i; + + for (i = 0; i < 4; i++) +- iowrite32(((u32 *) value)[i], _iobase + offset + (i * 4)); ++ iowrite32(((const u32 *) value)[i], _iobase + offset + (i * 4)); + } + + /* Read a 128 bit field (either a writable key or IV) */ +@@ -43,12 +43,12 @@ _readfield(u32 offset, void *value) + } + + static int +-do_crypt(void *src, void *dst, int len, u32 flags) ++do_crypt(const void *src, void *dst, u32 len, u32 flags) + { + u32 status; + u32 counter = AES_OP_TIMEOUT; + +- iowrite32(virt_to_phys(src), _iobase + AES_SOURCEA_REG); ++ iowrite32(virt_to_phys((void *)src), _iobase + AES_SOURCEA_REG); + iowrite32(virt_to_phys(dst), _iobase + AES_DSTA_REG); + iowrite32(len, _iobase + AES_LENA_REG); + +@@ -65,16 +65,14 @@ do_crypt(void *src, void *dst, int len, + return counter ? 0 : 1; + } + +-static unsigned int +-geode_aes_crypt(struct geode_aes_op *op) ++static void ++geode_aes_crypt(const struct geode_aes_tfm_ctx *tctx, const void *src, ++ void *dst, u32 len, u8 *iv, int mode, int dir) + { + u32 flags = 0; + unsigned long iflags; + int ret; + +- if (op->len == 0) +- return 0; +- + /* If the source and destination is the same, then + * we need to turn on the coherent flags, otherwise + * we don't need to worry +@@ -82,32 +80,28 @@ geode_aes_crypt(struct geode_aes_op *op) + + flags |= (AES_CTRL_DCA | AES_CTRL_SCA); + +- if (op->dir == AES_DIR_ENCRYPT) ++ if (dir == AES_DIR_ENCRYPT) + flags |= AES_CTRL_ENCRYPT; + + /* Start the critical section */ + + spin_lock_irqsave(&lock, iflags); + +- if (op->mode == AES_MODE_CBC) { ++ if (mode == AES_MODE_CBC) { + flags |= AES_CTRL_CBC; +- _writefield(AES_WRITEIV0_REG, op->iv); ++ _writefield(AES_WRITEIV0_REG, iv); + } + +- if (!(op->flags & AES_FLAGS_HIDDENKEY)) { +- flags |= AES_CTRL_WRKEY; +- _writefield(AES_WRITEKEY0_REG, op->key); +- } ++ flags |= AES_CTRL_WRKEY; ++ _writefield(AES_WRITEKEY0_REG, tctx->key); + +- ret = do_crypt(op->src, op->dst, op->len, flags); ++ ret = do_crypt(src, dst, len, flags); + BUG_ON(ret); + +- if (op->mode == AES_MODE_CBC) +- _readfield(AES_WRITEIV0_REG, op->iv); ++ if (mode == AES_MODE_CBC) ++ _readfield(AES_WRITEIV0_REG, iv); + + spin_unlock_irqrestore(&lock, iflags); +- +- return op->len; + } + + /* CRYPTO-API Functions */ +@@ -115,13 +109,13 @@ geode_aes_crypt(struct geode_aes_op *op) + static int geode_setkey_cip(struct crypto_tfm *tfm, const u8 *key, + unsigned int len) + { +- struct geode_aes_op *op = crypto_tfm_ctx(tfm); ++ struct geode_aes_tfm_ctx *tctx = crypto_tfm_ctx(tfm); + unsigned int ret; + +- op->keylen = len; ++ tctx->keylen = len; + + if (len == AES_KEYSIZE_128) { +- memcpy(op->key, key, len); ++ memcpy(tctx->key, key, len); + return 0; + } + +@@ -134,132 +128,93 @@ static int geode_setkey_cip(struct crypt + /* + * The requested key size is not supported by HW, do a fallback + */ +- op->fallback.cip->base.crt_flags &= ~CRYPTO_TFM_REQ_MASK; +- op->fallback.cip->base.crt_flags |= (tfm->crt_flags & CRYPTO_TFM_REQ_MASK); ++ tctx->fallback.cip->base.crt_flags &= ~CRYPTO_TFM_REQ_MASK; ++ tctx->fallback.cip->base.crt_flags |= ++ (tfm->crt_flags & CRYPTO_TFM_REQ_MASK); + +- ret = crypto_cipher_setkey(op->fallback.cip, key, len); ++ ret = crypto_cipher_setkey(tctx->fallback.cip, key, len); + if (ret) { + tfm->crt_flags &= ~CRYPTO_TFM_RES_MASK; +- tfm->crt_flags |= (op->fallback.cip->base.crt_flags & CRYPTO_TFM_RES_MASK); ++ tfm->crt_flags |= (tctx->fallback.cip->base.crt_flags & ++ CRYPTO_TFM_RES_MASK); + } + return ret; + } + +-static int geode_setkey_blk(struct crypto_tfm *tfm, const u8 *key, +- unsigned int len) ++static int geode_setkey_skcipher(struct crypto_skcipher *tfm, const u8 *key, ++ unsigned int len) + { +- struct geode_aes_op *op = crypto_tfm_ctx(tfm); ++ struct geode_aes_tfm_ctx *tctx = crypto_skcipher_ctx(tfm); + unsigned int ret; + +- op->keylen = len; ++ tctx->keylen = len; + + if (len == AES_KEYSIZE_128) { +- memcpy(op->key, key, len); ++ memcpy(tctx->key, key, len); + return 0; + } + + if (len != AES_KEYSIZE_192 && len != AES_KEYSIZE_256) { + /* not supported at all */ +- tfm->crt_flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; ++ crypto_skcipher_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN); + return -EINVAL; + } + + /* + * The requested key size is not supported by HW, do a fallback + */ +- crypto_sync_skcipher_clear_flags(op->fallback.blk, CRYPTO_TFM_REQ_MASK); +- crypto_sync_skcipher_set_flags(op->fallback.blk, +- tfm->crt_flags & CRYPTO_TFM_REQ_MASK); +- +- ret = crypto_sync_skcipher_setkey(op->fallback.blk, key, len); +- if (ret) { +- tfm->crt_flags &= ~CRYPTO_TFM_RES_MASK; +- tfm->crt_flags |= crypto_sync_skcipher_get_flags(op->fallback.blk) & +- CRYPTO_TFM_RES_MASK; +- } ++ crypto_skcipher_clear_flags(tctx->fallback.skcipher, ++ CRYPTO_TFM_REQ_MASK); ++ crypto_skcipher_set_flags(tctx->fallback.skcipher, ++ crypto_skcipher_get_flags(tfm) & ++ CRYPTO_TFM_REQ_MASK); ++ ret = crypto_skcipher_setkey(tctx->fallback.skcipher, key, len); ++ crypto_skcipher_set_flags(tfm, ++ crypto_skcipher_get_flags(tctx->fallback.skcipher) & ++ CRYPTO_TFM_RES_MASK); + return ret; + } + +-static int fallback_blk_dec(struct blkcipher_desc *desc, +- struct scatterlist *dst, struct scatterlist *src, +- unsigned int nbytes) +-{ +- struct geode_aes_op *op = crypto_blkcipher_ctx(desc->tfm); +- SYNC_SKCIPHER_REQUEST_ON_STACK(req, op->fallback.blk); +- +- skcipher_request_set_sync_tfm(req, op->fallback.blk); +- skcipher_request_set_callback(req, 0, NULL, NULL); +- skcipher_request_set_crypt(req, src, dst, nbytes, desc->info); +- +- return crypto_skcipher_decrypt(req); +-} +- +-static int fallback_blk_enc(struct blkcipher_desc *desc, +- struct scatterlist *dst, struct scatterlist *src, +- unsigned int nbytes) +-{ +- struct geode_aes_op *op = crypto_blkcipher_ctx(desc->tfm); +- SYNC_SKCIPHER_REQUEST_ON_STACK(req, op->fallback.blk); +- +- skcipher_request_set_sync_tfm(req, op->fallback.blk); +- skcipher_request_set_callback(req, 0, NULL, NULL); +- skcipher_request_set_crypt(req, src, dst, nbytes, desc->info); +- +- return crypto_skcipher_encrypt(req); +-} +- + static void + geode_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) + { +- struct geode_aes_op *op = crypto_tfm_ctx(tfm); ++ const struct geode_aes_tfm_ctx *tctx = crypto_tfm_ctx(tfm); + +- if (unlikely(op->keylen != AES_KEYSIZE_128)) { +- crypto_cipher_encrypt_one(op->fallback.cip, out, in); ++ if (unlikely(tctx->keylen != AES_KEYSIZE_128)) { ++ crypto_cipher_encrypt_one(tctx->fallback.cip, out, in); + return; + } + +- op->src = (void *) in; +- op->dst = (void *) out; +- op->mode = AES_MODE_ECB; +- op->flags = 0; +- op->len = AES_BLOCK_SIZE; +- op->dir = AES_DIR_ENCRYPT; +- +- geode_aes_crypt(op); ++ geode_aes_crypt(tctx, in, out, AES_BLOCK_SIZE, NULL, ++ AES_MODE_ECB, AES_DIR_ENCRYPT); + } + + + static void + geode_decrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) + { +- struct geode_aes_op *op = crypto_tfm_ctx(tfm); ++ const struct geode_aes_tfm_ctx *tctx = crypto_tfm_ctx(tfm); + +- if (unlikely(op->keylen != AES_KEYSIZE_128)) { +- crypto_cipher_decrypt_one(op->fallback.cip, out, in); ++ if (unlikely(tctx->keylen != AES_KEYSIZE_128)) { ++ crypto_cipher_decrypt_one(tctx->fallback.cip, out, in); + return; + } + +- op->src = (void *) in; +- op->dst = (void *) out; +- op->mode = AES_MODE_ECB; +- op->flags = 0; +- op->len = AES_BLOCK_SIZE; +- op->dir = AES_DIR_DECRYPT; +- +- geode_aes_crypt(op); ++ geode_aes_crypt(tctx, in, out, AES_BLOCK_SIZE, NULL, ++ AES_MODE_ECB, AES_DIR_DECRYPT); + } + + static int fallback_init_cip(struct crypto_tfm *tfm) + { + const char *name = crypto_tfm_alg_name(tfm); +- struct geode_aes_op *op = crypto_tfm_ctx(tfm); ++ struct geode_aes_tfm_ctx *tctx = crypto_tfm_ctx(tfm); + +- op->fallback.cip = crypto_alloc_cipher(name, 0, +- CRYPTO_ALG_NEED_FALLBACK); ++ tctx->fallback.cip = crypto_alloc_cipher(name, 0, ++ CRYPTO_ALG_NEED_FALLBACK); + +- if (IS_ERR(op->fallback.cip)) { ++ if (IS_ERR(tctx->fallback.cip)) { + printk(KERN_ERR "Error allocating fallback algo %s\n", name); +- return PTR_ERR(op->fallback.cip); ++ return PTR_ERR(tctx->fallback.cip); + } + + return 0; +@@ -267,10 +222,9 @@ static int fallback_init_cip(struct cryp + + static void fallback_exit_cip(struct crypto_tfm *tfm) + { +- struct geode_aes_op *op = crypto_tfm_ctx(tfm); ++ struct geode_aes_tfm_ctx *tctx = crypto_tfm_ctx(tfm); + +- crypto_free_cipher(op->fallback.cip); +- op->fallback.cip = NULL; ++ crypto_free_cipher(tctx->fallback.cip); + } + + static struct crypto_alg geode_alg = { +@@ -283,7 +237,7 @@ static struct crypto_alg geode_alg = { + .cra_init = fallback_init_cip, + .cra_exit = fallback_exit_cip, + .cra_blocksize = AES_BLOCK_SIZE, +- .cra_ctxsize = sizeof(struct geode_aes_op), ++ .cra_ctxsize = sizeof(struct geode_aes_tfm_ctx), + .cra_module = THIS_MODULE, + .cra_u = { + .cipher = { +@@ -296,220 +250,126 @@ static struct crypto_alg geode_alg = { + } + }; + +-static int +-geode_cbc_decrypt(struct blkcipher_desc *desc, +- struct scatterlist *dst, struct scatterlist *src, +- unsigned int nbytes) +-{ +- struct geode_aes_op *op = crypto_blkcipher_ctx(desc->tfm); +- struct blkcipher_walk walk; +- int err, ret; +- +- if (nbytes % AES_BLOCK_SIZE) +- return -EINVAL; +- +- if (unlikely(op->keylen != AES_KEYSIZE_128)) +- return fallback_blk_dec(desc, dst, src, nbytes); +- +- blkcipher_walk_init(&walk, dst, src, nbytes); +- err = blkcipher_walk_virt(desc, &walk); +- op->iv = walk.iv; +- +- while ((nbytes = walk.nbytes)) { +- op->src = walk.src.virt.addr, +- op->dst = walk.dst.virt.addr; +- op->mode = AES_MODE_CBC; +- op->len = nbytes - (nbytes % AES_BLOCK_SIZE); +- op->dir = AES_DIR_DECRYPT; +- +- ret = geode_aes_crypt(op); +- +- nbytes -= ret; +- err = blkcipher_walk_done(desc, &walk, nbytes); +- } +- +- return err; +-} +- +-static int +-geode_cbc_encrypt(struct blkcipher_desc *desc, +- struct scatterlist *dst, struct scatterlist *src, +- unsigned int nbytes) +-{ +- struct geode_aes_op *op = crypto_blkcipher_ctx(desc->tfm); +- struct blkcipher_walk walk; +- int err, ret; +- +- if (nbytes % AES_BLOCK_SIZE) +- return -EINVAL; +- +- if (unlikely(op->keylen != AES_KEYSIZE_128)) +- return fallback_blk_enc(desc, dst, src, nbytes); +- +- blkcipher_walk_init(&walk, dst, src, nbytes); +- err = blkcipher_walk_virt(desc, &walk); +- op->iv = walk.iv; +- +- while ((nbytes = walk.nbytes)) { +- op->src = walk.src.virt.addr, +- op->dst = walk.dst.virt.addr; +- op->mode = AES_MODE_CBC; +- op->len = nbytes - (nbytes % AES_BLOCK_SIZE); +- op->dir = AES_DIR_ENCRYPT; +- +- ret = geode_aes_crypt(op); +- nbytes -= ret; +- err = blkcipher_walk_done(desc, &walk, nbytes); +- } +- +- return err; +-} +- +-static int fallback_init_blk(struct crypto_tfm *tfm) ++static int geode_init_skcipher(struct crypto_skcipher *tfm) + { +- const char *name = crypto_tfm_alg_name(tfm); +- struct geode_aes_op *op = crypto_tfm_ctx(tfm); ++ const char *name = crypto_tfm_alg_name(&tfm->base); ++ struct geode_aes_tfm_ctx *tctx = crypto_skcipher_ctx(tfm); + +- op->fallback.blk = crypto_alloc_sync_skcipher(name, 0, +- CRYPTO_ALG_NEED_FALLBACK); +- if (IS_ERR(op->fallback.blk)) { ++ tctx->fallback.skcipher = ++ crypto_alloc_skcipher(name, 0, CRYPTO_ALG_NEED_FALLBACK | ++ CRYPTO_ALG_ASYNC); ++ if (IS_ERR(tctx->fallback.skcipher)) { + printk(KERN_ERR "Error allocating fallback algo %s\n", name); +- return PTR_ERR(op->fallback.blk); ++ return PTR_ERR(tctx->fallback.skcipher); + } + ++ crypto_skcipher_set_reqsize(tfm, sizeof(struct skcipher_request) + ++ crypto_skcipher_reqsize(tctx->fallback.skcipher)); + return 0; + } + +-static void fallback_exit_blk(struct crypto_tfm *tfm) ++static void geode_exit_skcipher(struct crypto_skcipher *tfm) + { +- struct geode_aes_op *op = crypto_tfm_ctx(tfm); ++ struct geode_aes_tfm_ctx *tctx = crypto_skcipher_ctx(tfm); + +- crypto_free_sync_skcipher(op->fallback.blk); +- op->fallback.blk = NULL; ++ crypto_free_skcipher(tctx->fallback.skcipher); + } + +-static struct crypto_alg geode_cbc_alg = { +- .cra_name = "cbc(aes)", +- .cra_driver_name = "cbc-aes-geode", +- .cra_priority = 400, +- .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER | +- CRYPTO_ALG_KERN_DRIVER_ONLY | +- CRYPTO_ALG_NEED_FALLBACK, +- .cra_init = fallback_init_blk, +- .cra_exit = fallback_exit_blk, +- .cra_blocksize = AES_BLOCK_SIZE, +- .cra_ctxsize = sizeof(struct geode_aes_op), +- .cra_alignmask = 15, +- .cra_type = &crypto_blkcipher_type, +- .cra_module = THIS_MODULE, +- .cra_u = { +- .blkcipher = { +- .min_keysize = AES_MIN_KEY_SIZE, +- .max_keysize = AES_MAX_KEY_SIZE, +- .setkey = geode_setkey_blk, +- .encrypt = geode_cbc_encrypt, +- .decrypt = geode_cbc_decrypt, +- .ivsize = AES_BLOCK_SIZE, +- } +- } +-}; +- +-static int +-geode_ecb_decrypt(struct blkcipher_desc *desc, +- struct scatterlist *dst, struct scatterlist *src, +- unsigned int nbytes) +-{ +- struct geode_aes_op *op = crypto_blkcipher_ctx(desc->tfm); +- struct blkcipher_walk walk; +- int err, ret; ++static int geode_skcipher_crypt(struct skcipher_request *req, int mode, int dir) ++{ ++ struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); ++ const struct geode_aes_tfm_ctx *tctx = crypto_skcipher_ctx(tfm); ++ struct skcipher_walk walk; ++ unsigned int nbytes; ++ int err; + +- if (nbytes % AES_BLOCK_SIZE) +- return -EINVAL; ++ if (unlikely(tctx->keylen != AES_KEYSIZE_128)) { ++ struct skcipher_request *subreq = skcipher_request_ctx(req); + +- if (unlikely(op->keylen != AES_KEYSIZE_128)) +- return fallback_blk_dec(desc, dst, src, nbytes); ++ *subreq = *req; ++ skcipher_request_set_tfm(subreq, tctx->fallback.skcipher); ++ if (dir == AES_DIR_DECRYPT) ++ return crypto_skcipher_decrypt(subreq); ++ else ++ return crypto_skcipher_encrypt(subreq); ++ } + +- blkcipher_walk_init(&walk, dst, src, nbytes); +- err = blkcipher_walk_virt(desc, &walk); ++ err = skcipher_walk_virt(&walk, req, false); + +- while ((nbytes = walk.nbytes)) { +- op->src = walk.src.virt.addr, +- op->dst = walk.dst.virt.addr; +- op->mode = AES_MODE_ECB; +- op->len = nbytes - (nbytes % AES_BLOCK_SIZE); +- op->dir = AES_DIR_DECRYPT; +- +- ret = geode_aes_crypt(op); +- nbytes -= ret; +- err = blkcipher_walk_done(desc, &walk, nbytes); ++ while ((nbytes = walk.nbytes) != 0) { ++ geode_aes_crypt(tctx, walk.src.virt.addr, walk.dst.virt.addr, ++ round_down(nbytes, AES_BLOCK_SIZE), ++ walk.iv, mode, dir); ++ err = skcipher_walk_done(&walk, nbytes % AES_BLOCK_SIZE); + } + + return err; + } + +-static int +-geode_ecb_encrypt(struct blkcipher_desc *desc, +- struct scatterlist *dst, struct scatterlist *src, +- unsigned int nbytes) +-{ +- struct geode_aes_op *op = crypto_blkcipher_ctx(desc->tfm); +- struct blkcipher_walk walk; +- int err, ret; +- +- if (nbytes % AES_BLOCK_SIZE) +- return -EINVAL; +- +- if (unlikely(op->keylen != AES_KEYSIZE_128)) +- return fallback_blk_enc(desc, dst, src, nbytes); +- +- blkcipher_walk_init(&walk, dst, src, nbytes); +- err = blkcipher_walk_virt(desc, &walk); +- +- while ((nbytes = walk.nbytes)) { +- op->src = walk.src.virt.addr, +- op->dst = walk.dst.virt.addr; +- op->mode = AES_MODE_ECB; +- op->len = nbytes - (nbytes % AES_BLOCK_SIZE); +- op->dir = AES_DIR_ENCRYPT; +- +- ret = geode_aes_crypt(op); +- nbytes -= ret; +- ret = blkcipher_walk_done(desc, &walk, nbytes); +- } ++static int geode_cbc_encrypt(struct skcipher_request *req) ++{ ++ return geode_skcipher_crypt(req, AES_MODE_CBC, AES_DIR_ENCRYPT); ++} + +- return err; ++static int geode_cbc_decrypt(struct skcipher_request *req) ++{ ++ return geode_skcipher_crypt(req, AES_MODE_CBC, AES_DIR_DECRYPT); + } + +-static struct crypto_alg geode_ecb_alg = { +- .cra_name = "ecb(aes)", +- .cra_driver_name = "ecb-aes-geode", +- .cra_priority = 400, +- .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER | +- CRYPTO_ALG_KERN_DRIVER_ONLY | +- CRYPTO_ALG_NEED_FALLBACK, +- .cra_init = fallback_init_blk, +- .cra_exit = fallback_exit_blk, +- .cra_blocksize = AES_BLOCK_SIZE, +- .cra_ctxsize = sizeof(struct geode_aes_op), +- .cra_alignmask = 15, +- .cra_type = &crypto_blkcipher_type, +- .cra_module = THIS_MODULE, +- .cra_u = { +- .blkcipher = { +- .min_keysize = AES_MIN_KEY_SIZE, +- .max_keysize = AES_MAX_KEY_SIZE, +- .setkey = geode_setkey_blk, +- .encrypt = geode_ecb_encrypt, +- .decrypt = geode_ecb_decrypt, +- } +- } ++static int geode_ecb_encrypt(struct skcipher_request *req) ++{ ++ return geode_skcipher_crypt(req, AES_MODE_ECB, AES_DIR_ENCRYPT); ++} ++ ++static int geode_ecb_decrypt(struct skcipher_request *req) ++{ ++ return geode_skcipher_crypt(req, AES_MODE_ECB, AES_DIR_DECRYPT); ++} ++ ++static struct skcipher_alg geode_skcipher_algs[] = { ++ { ++ .base.cra_name = "cbc(aes)", ++ .base.cra_driver_name = "cbc-aes-geode", ++ .base.cra_priority = 400, ++ .base.cra_flags = CRYPTO_ALG_KERN_DRIVER_ONLY | ++ CRYPTO_ALG_NEED_FALLBACK, ++ .base.cra_blocksize = AES_BLOCK_SIZE, ++ .base.cra_ctxsize = sizeof(struct geode_aes_tfm_ctx), ++ .base.cra_alignmask = 15, ++ .base.cra_module = THIS_MODULE, ++ .init = geode_init_skcipher, ++ .exit = geode_exit_skcipher, ++ .setkey = geode_setkey_skcipher, ++ .encrypt = geode_cbc_encrypt, ++ .decrypt = geode_cbc_decrypt, ++ .min_keysize = AES_MIN_KEY_SIZE, ++ .max_keysize = AES_MAX_KEY_SIZE, ++ .ivsize = AES_BLOCK_SIZE, ++ }, { ++ .base.cra_name = "ecb(aes)", ++ .base.cra_driver_name = "ecb-aes-geode", ++ .base.cra_priority = 400, ++ .base.cra_flags = CRYPTO_ALG_KERN_DRIVER_ONLY | ++ CRYPTO_ALG_NEED_FALLBACK, ++ .base.cra_blocksize = AES_BLOCK_SIZE, ++ .base.cra_ctxsize = sizeof(struct geode_aes_tfm_ctx), ++ .base.cra_alignmask = 15, ++ .base.cra_module = THIS_MODULE, ++ .init = geode_init_skcipher, ++ .exit = geode_exit_skcipher, ++ .setkey = geode_setkey_skcipher, ++ .encrypt = geode_ecb_encrypt, ++ .decrypt = geode_ecb_decrypt, ++ .min_keysize = AES_MIN_KEY_SIZE, ++ .max_keysize = AES_MAX_KEY_SIZE, ++ }, + }; + + static void geode_aes_remove(struct pci_dev *dev) + { + crypto_unregister_alg(&geode_alg); +- crypto_unregister_alg(&geode_ecb_alg); +- crypto_unregister_alg(&geode_cbc_alg); ++ crypto_unregister_skciphers(geode_skcipher_algs, ++ ARRAY_SIZE(geode_skcipher_algs)); + + pci_iounmap(dev, _iobase); + _iobase = NULL; +@@ -547,20 +407,14 @@ static int geode_aes_probe(struct pci_de + if (ret) + goto eiomap; + +- ret = crypto_register_alg(&geode_ecb_alg); ++ ret = crypto_register_skciphers(geode_skcipher_algs, ++ ARRAY_SIZE(geode_skcipher_algs)); + if (ret) + goto ealg; + +- ret = crypto_register_alg(&geode_cbc_alg); +- if (ret) +- goto eecb; +- + dev_notice(&dev->dev, "GEODE AES engine enabled.\n"); + return 0; + +- eecb: +- crypto_unregister_alg(&geode_ecb_alg); +- + ealg: + crypto_unregister_alg(&geode_alg); + +--- a/drivers/crypto/geode-aes.h ++++ b/drivers/crypto/geode-aes.h +@@ -46,21 +46,10 @@ + + #define AES_OP_TIMEOUT 0x50000 + +-struct geode_aes_op { +- +- void *src; +- void *dst; +- +- u32 mode; +- u32 dir; +- u32 flags; +- int len; +- ++struct geode_aes_tfm_ctx { + u8 key[AES_KEYSIZE_128]; +- u8 *iv; +- + union { +- struct crypto_sync_skcipher *blk; ++ struct crypto_skcipher *skcipher; + struct crypto_cipher *cip; + } fallback; + u32 keylen; diff --git a/queue-5.4/crypto-hisilicon-select-need_sg_dma_length-in-qm-kconfig.patch b/queue-5.4/crypto-hisilicon-select-need_sg_dma_length-in-qm-kconfig.patch new file mode 100644 index 00000000000..1068d716ba6 --- /dev/null +++ b/queue-5.4/crypto-hisilicon-select-need_sg_dma_length-in-qm-kconfig.patch @@ -0,0 +1,32 @@ +From b981744ef04f7e8cb6931edab50021fff3c8077e Mon Sep 17 00:00:00 2001 +From: Zhou Wang +Date: Fri, 11 Oct 2019 19:18:10 +0800 +Subject: crypto: hisilicon - select NEED_SG_DMA_LENGTH in qm Kconfig + +From: Zhou Wang + +commit b981744ef04f7e8cb6931edab50021fff3c8077e upstream. + +To avoid compile error in some platforms, select NEED_SG_DMA_LENGTH in +qm Kconfig. + +Fixes: dfed0098ab91 ("crypto: hisilicon - add hardware SGL support") +Signed-off-by: Zhou Wang +Reported-by: kbuild test robot +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/crypto/hisilicon/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/crypto/hisilicon/Kconfig ++++ b/drivers/crypto/hisilicon/Kconfig +@@ -17,6 +17,7 @@ config CRYPTO_DEV_HISI_SEC + config CRYPTO_DEV_HISI_QM + tristate + depends on ARM64 && PCI && PCI_MSI ++ select NEED_SG_DMA_LENGTH + help + HiSilicon accelerator engines use a common queue management + interface. Specific engine driver may use this module. diff --git a/queue-5.4/crypto-virtio-implement-missing-support-for-output-ivs.patch b/queue-5.4/crypto-virtio-implement-missing-support-for-output-ivs.patch new file mode 100644 index 00000000000..5afe51172b3 --- /dev/null +++ b/queue-5.4/crypto-virtio-implement-missing-support-for-output-ivs.patch @@ -0,0 +1,52 @@ +From 500e6807ce93b1fdc7d5b827c5cc167cc35630db Mon Sep 17 00:00:00 2001 +From: Ard Biesheuvel +Date: Sat, 9 Nov 2019 18:09:26 +0100 +Subject: crypto: virtio - implement missing support for output IVs + +From: Ard Biesheuvel + +commit 500e6807ce93b1fdc7d5b827c5cc167cc35630db upstream. + +In order to allow for CBC to be chained, which is something that the +CTS template relies upon, implementations of CBC need to pass the +IV to be used for subsequent invocations via the IV buffer. This was +not implemented yet for virtio-crypto so implement it now. + +Fixes: dbaf0624ffa5 ("crypto: add virtio-crypto driver") +Cc: "Michael S. Tsirkin" +Cc: Jason Wang +Cc: Gonglei +Cc: virtualization@lists.linux-foundation.org +Signed-off-by: Ard Biesheuvel +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/crypto/virtio/virtio_crypto_algs.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +--- a/drivers/crypto/virtio/virtio_crypto_algs.c ++++ b/drivers/crypto/virtio/virtio_crypto_algs.c +@@ -435,6 +435,11 @@ __virtio_crypto_ablkcipher_do_req(struct + goto free; + } + memcpy(iv, req->info, ivsize); ++ if (!vc_sym_req->encrypt) ++ scatterwalk_map_and_copy(req->info, req->src, ++ req->nbytes - AES_BLOCK_SIZE, ++ AES_BLOCK_SIZE, 0); ++ + sg_init_one(&iv_sg, iv, ivsize); + sgs[num_out++] = &iv_sg; + vc_sym_req->iv = iv; +@@ -571,6 +576,10 @@ static void virtio_crypto_ablkcipher_fin + struct ablkcipher_request *req, + int err) + { ++ if (vc_sym_req->encrypt) ++ scatterwalk_map_and_copy(req->info, req->dst, ++ req->nbytes - AES_BLOCK_SIZE, ++ AES_BLOCK_SIZE, 0); + crypto_finalize_ablkcipher_request(vc_sym_req->base.dataq->engine, + req, err); + kzfree(vc_sym_req->iv); diff --git a/queue-5.4/dmaengine-dw-platform-mark-hclk-clock-optional.patch b/queue-5.4/dmaengine-dw-platform-mark-hclk-clock-optional.patch new file mode 100644 index 00000000000..0f920b81552 --- /dev/null +++ b/queue-5.4/dmaengine-dw-platform-mark-hclk-clock-optional.patch @@ -0,0 +1,37 @@ +From f27c22736d133baff0ab3fdc7b015d998267d817 Mon Sep 17 00:00:00 2001 +From: Andy Shevchenko +Date: Tue, 24 Sep 2019 11:51:16 +0300 +Subject: dmaengine: dw: platform: Mark 'hclk' clock optional + +From: Andy Shevchenko + +commit f27c22736d133baff0ab3fdc7b015d998267d817 upstream. + +On some platforms the clock can be fixed rate, always running one and +there is no need to do anything with it. + +In order to support those platforms, switch to use optional clock. + +Fixes: f8d9ddbc2851 ("dmaengine: dw: platform: Enable iDMA 32-bit on Intel Elkhart Lake") +Depends-on: 60b8f0ddf1a9 ("clk: Add (devm_)clk_get_optional() functions") +Signed-off-by: Andy Shevchenko +Acked-by: Viresh Kumar +Link: https://lore.kernel.org/r/20190924085116.83683-1-andriy.shevchenko@linux.intel.com +Signed-off-by: Vinod Koul +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/dma/dw/platform.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/dma/dw/platform.c ++++ b/drivers/dma/dw/platform.c +@@ -66,7 +66,7 @@ static int dw_probe(struct platform_devi + + data->chip = chip; + +- chip->clk = devm_clk_get(chip->dev, "hclk"); ++ chip->clk = devm_clk_get_optional(chip->dev, "hclk"); + if (IS_ERR(chip->clk)) + return PTR_ERR(chip->clk); + err = clk_prepare_enable(chip->clk); diff --git a/queue-5.4/iio-imu-adis16480-assign-bias-value-only-if-operation-succeeded.patch b/queue-5.4/iio-imu-adis16480-assign-bias-value-only-if-operation-succeeded.patch new file mode 100644 index 00000000000..d183f0ba269 --- /dev/null +++ b/queue-5.4/iio-imu-adis16480-assign-bias-value-only-if-operation-succeeded.patch @@ -0,0 +1,45 @@ +From 9b742763d9d4195e823ae6ece760c9ed0500c1dc Mon Sep 17 00:00:00 2001 +From: Alexandru Ardelean +Date: Fri, 1 Nov 2019 11:35:03 +0200 +Subject: iio: imu: adis16480: assign bias value only if operation succeeded + +From: Alexandru Ardelean + +commit 9b742763d9d4195e823ae6ece760c9ed0500c1dc upstream. + +This was found only after the whole thing with the inline functions, but +the compiler actually found something. The value of the `bias` (in +adis16480_get_calibbias()) should only be set if the read operation was +successful. + +No actual known problem occurs as users of this function all +ultimately check the return value. Hence probably not stable material. + +Fixes: 2f3abe6cbb6c9 ("iio:imu: Add support for the ADIS16480 and similar IMUs") +Signed-off-by: Alexandru Ardelean +Signed-off-by: Jonathan Cameron +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/iio/imu/adis16480.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/drivers/iio/imu/adis16480.c ++++ b/drivers/iio/imu/adis16480.c +@@ -454,12 +454,14 @@ static int adis16480_get_calibbias(struc + case IIO_MAGN: + case IIO_PRESSURE: + ret = adis_read_reg_16(&st->adis, reg, &val16); +- *bias = sign_extend32(val16, 15); ++ if (ret == 0) ++ *bias = sign_extend32(val16, 15); + break; + case IIO_ANGL_VEL: + case IIO_ACCEL: + ret = adis_read_reg_32(&st->adis, reg, &val32); +- *bias = sign_extend32(val32, 31); ++ if (ret == 0) ++ *bias = sign_extend32(val32, 31); + break; + default: + ret = -EINVAL; diff --git a/queue-5.4/iio-imu-st_lsm6dsx-fix-gyro-gain-definitions-for-lsm9ds1.patch b/queue-5.4/iio-imu-st_lsm6dsx-fix-gyro-gain-definitions-for-lsm9ds1.patch new file mode 100644 index 00000000000..78858c94af4 --- /dev/null +++ b/queue-5.4/iio-imu-st_lsm6dsx-fix-gyro-gain-definitions-for-lsm9ds1.patch @@ -0,0 +1,36 @@ +From 1b3751017e09f0857bc38f9b1be08dce38f3d92c Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +Date: Mon, 7 Oct 2019 11:12:13 +0200 +Subject: iio: imu: st_lsm6dsx: fix gyro gain definitions for LSM9DS1 + +From: Lorenzo Bianconi + +commit 1b3751017e09f0857bc38f9b1be08dce38f3d92c upstream. + +Fix typos in gyro gain definitions for LSM9DS1 sensor + +Fixes: 52f4b1f19679 ("iio: imu: st_lsm6dsx: add support for accel/gyro unit of lsm9ds1") +Signed-off-by: Lorenzo Bianconi +Signed-off-by: Jonathan Cameron +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c ++++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +@@ -152,9 +152,10 @@ static const struct st_lsm6dsx_settings + .addr = 0x10, + .mask = GENMASK(4, 3), + }, +- .fs_avl[0] = { IIO_DEGREE_TO_RAD(245), 0x0 }, +- .fs_avl[1] = { IIO_DEGREE_TO_RAD(500), 0x1 }, +- .fs_avl[2] = { IIO_DEGREE_TO_RAD(2000), 0x3 }, ++ ++ .fs_avl[0] = { IIO_DEGREE_TO_RAD(8750), 0x0 }, ++ .fs_avl[1] = { IIO_DEGREE_TO_RAD(17500), 0x1 }, ++ .fs_avl[2] = { IIO_DEGREE_TO_RAD(70000), 0x3 }, + .fs_len = 3, + }, + }, diff --git a/queue-5.4/mei-fix-modalias-documentation.patch b/queue-5.4/mei-fix-modalias-documentation.patch new file mode 100644 index 00000000000..2ff6b8598e4 --- /dev/null +++ b/queue-5.4/mei-fix-modalias-documentation.patch @@ -0,0 +1,33 @@ +From 73668309215285366c433489de70d31362987be9 Mon Sep 17 00:00:00 2001 +From: Alexander Usyskin +Date: Tue, 8 Oct 2019 03:57:34 +0300 +Subject: mei: fix modalias documentation + +From: Alexander Usyskin + +commit 73668309215285366c433489de70d31362987be9 upstream. + +mei client bus added the client protocol version to the device alias, +but ABI documentation was not updated. + +Fixes: b26864cad1c9 (mei: bus: add client protocol version to the device alias) +Signed-off-by: Alexander Usyskin +Signed-off-by: Tomas Winkler +Link: https://lore.kernel.org/r/20191008005735.12707-1-tomas.winkler@intel.com +Signed-off-by: Greg Kroah-Hartman + +--- + Documentation/ABI/testing/sysfs-bus-mei | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/Documentation/ABI/testing/sysfs-bus-mei ++++ b/Documentation/ABI/testing/sysfs-bus-mei +@@ -4,7 +4,7 @@ KernelVersion: 3.10 + Contact: Samuel Ortiz + linux-mei@linux.intel.com + Description: Stores the same MODALIAS value emitted by uevent +- Format: mei::: ++ Format: mei::: + + What: /sys/bus/mei/devices/.../name + Date: May 2015 diff --git a/queue-5.4/nfsd-fix-cld_net-cn_tfm-initialization.patch b/queue-5.4/nfsd-fix-cld_net-cn_tfm-initialization.patch new file mode 100644 index 00000000000..e4c282f863e --- /dev/null +++ b/queue-5.4/nfsd-fix-cld_net-cn_tfm-initialization.patch @@ -0,0 +1,62 @@ +From 18b9a895e652979b70f9c20565394a69354dfebc Mon Sep 17 00:00:00 2001 +From: Scott Mayhew +Date: Tue, 12 Nov 2019 14:01:43 -0500 +Subject: nfsd: Fix cld_net->cn_tfm initialization + +From: Scott Mayhew + +commit 18b9a895e652979b70f9c20565394a69354dfebc upstream. + +Don't assign an error pointer to cld_net->cn_tfm, otherwise an oops will +occur in nfsd4_remove_cld_pipe(). + +Also, move the initialization of cld_net->cn_tfm so that it occurs after +the check to see if nfsdcld is running. This is necessary because +nfsd4_client_tracking_init() looks for -ETIMEDOUT to determine whether +to use the "old" nfsdcld tracking ops. + +Fixes: 6ee95d1c8991 ("nfsd: add support for upcall version 2") +Reported-by: Jamie Heilman +Signed-off-by: Scott Mayhew +Signed-off-by: J. Bruce Fields +Signed-off-by: Greg Kroah-Hartman + +--- + fs/nfsd/nfs4recover.c | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +--- a/fs/nfsd/nfs4recover.c ++++ b/fs/nfsd/nfs4recover.c +@@ -1578,6 +1578,7 @@ nfsd4_cld_tracking_init(struct net *net) + struct nfsd_net *nn = net_generic(net, nfsd_net_id); + bool running; + int retries = 10; ++ struct crypto_shash *tfm; + + status = nfs4_cld_state_init(net); + if (status) +@@ -1586,11 +1587,6 @@ nfsd4_cld_tracking_init(struct net *net) + status = __nfsd4_init_cld_pipe(net); + if (status) + goto err_shutdown; +- nn->cld_net->cn_tfm = crypto_alloc_shash("sha256", 0, 0); +- if (IS_ERR(nn->cld_net->cn_tfm)) { +- status = PTR_ERR(nn->cld_net->cn_tfm); +- goto err_remove; +- } + + /* + * rpc pipe upcalls take 30 seconds to time out, so we don't want to +@@ -1607,6 +1603,12 @@ nfsd4_cld_tracking_init(struct net *net) + status = -ETIMEDOUT; + goto err_remove; + } ++ tfm = crypto_alloc_shash("sha256", 0, 0); ++ if (IS_ERR(tfm)) { ++ status = PTR_ERR(tfm); ++ goto err_remove; ++ } ++ nn->cld_net->cn_tfm = tfm; + + status = nfsd4_cld_get_version(nn); + if (status == -EOPNOTSUPP) diff --git a/queue-5.4/nfsd-v4-support-requires-crypto_sha256.patch b/queue-5.4/nfsd-v4-support-requires-crypto_sha256.patch new file mode 100644 index 00000000000..360dd2b206d --- /dev/null +++ b/queue-5.4/nfsd-v4-support-requires-crypto_sha256.patch @@ -0,0 +1,33 @@ +From a2e2f2dc77a18d2b0f450fb7fcb4871c9f697822 Mon Sep 17 00:00:00 2001 +From: Scott Mayhew +Date: Tue, 12 Nov 2019 14:01:55 -0500 +Subject: nfsd: v4 support requires CRYPTO_SHA256 + +From: Scott Mayhew + +commit a2e2f2dc77a18d2b0f450fb7fcb4871c9f697822 upstream. + +The new nfsdcld client tracking operations use sha256 to compute hashes +of the kerberos principals, so make sure CRYPTO_SHA256 is enabled. + +Fixes: 6ee95d1c8991 ("nfsd: add support for upcall version 2") +Reported-by: Jamie Heilman +Signed-off-by: Scott Mayhew +Signed-off-by: J. Bruce Fields +Signed-off-by: Greg Kroah-Hartman + +--- + fs/nfsd/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/fs/nfsd/Kconfig ++++ b/fs/nfsd/Kconfig +@@ -73,7 +73,7 @@ config NFSD_V4 + select NFSD_V3 + select FS_POSIX_ACL + select SUNRPC_GSS +- select CRYPTO ++ select CRYPTO_SHA256 + select GRACE_PERIOD + help + This option enables support in your system's NFS server for diff --git a/queue-5.4/nfsv2-fix-a-typo-in-encode_sattr.patch b/queue-5.4/nfsv2-fix-a-typo-in-encode_sattr.patch new file mode 100644 index 00000000000..ac8cd0d0ebc --- /dev/null +++ b/queue-5.4/nfsv2-fix-a-typo-in-encode_sattr.patch @@ -0,0 +1,30 @@ +From ad97a995d8edff820d4238bd0dfc69f440031ae6 Mon Sep 17 00:00:00 2001 +From: Trond Myklebust +Date: Fri, 4 Oct 2019 17:01:54 -0400 +Subject: NFSv2: Fix a typo in encode_sattr() + +From: Trond Myklebust + +commit ad97a995d8edff820d4238bd0dfc69f440031ae6 upstream. + +Encode the mtime correctly. + +Fixes: 95582b0083883 ("vfs: change inode times to use struct timespec64") +Signed-off-by: Trond Myklebust +Signed-off-by: Greg Kroah-Hartman + +--- + fs/nfs/nfs2xdr.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/fs/nfs/nfs2xdr.c ++++ b/fs/nfs/nfs2xdr.c +@@ -370,7 +370,7 @@ static void encode_sattr(struct xdr_stre + } else + p = xdr_time_not_set(p); + if (attr->ia_valid & ATTR_MTIME_SET) { +- ts = timespec64_to_timespec(attr->ia_atime); ++ ts = timespec64_to_timespec(attr->ia_mtime); + xdr_encode_time(p, &ts); + } else if (attr->ia_valid & ATTR_MTIME) { + ts = timespec64_to_timespec(attr->ia_mtime); diff --git a/queue-5.4/nfsv4.x-drop-the-slot-if-nfs4_delegreturn_prepare-waits-for-layoutreturn.patch b/queue-5.4/nfsv4.x-drop-the-slot-if-nfs4_delegreturn_prepare-waits-for-layoutreturn.patch new file mode 100644 index 00000000000..8486427f494 --- /dev/null +++ b/queue-5.4/nfsv4.x-drop-the-slot-if-nfs4_delegreturn_prepare-waits-for-layoutreturn.patch @@ -0,0 +1,34 @@ +From 5326de9e94bedcf7366e7e7625d4deb8c1f1ca8a Mon Sep 17 00:00:00 2001 +From: Trond Myklebust +Date: Wed, 13 Nov 2019 09:39:36 +0100 +Subject: NFSv4.x: Drop the slot if nfs4_delegreturn_prepare waits for layoutreturn + +From: Trond Myklebust + +commit 5326de9e94bedcf7366e7e7625d4deb8c1f1ca8a upstream. + +If nfs4_delegreturn_prepare needs to wait for a layoutreturn to complete +then make sure we drop the sequence slot if we hold it. + +Fixes: 1c5bd76d17cc ("pNFS: Enable layoutreturn operation for return-on-close") +Signed-off-by: Trond Myklebust +Signed-off-by: Greg Kroah-Hartman + +--- + fs/nfs/nfs4proc.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/fs/nfs/nfs4proc.c ++++ b/fs/nfs/nfs4proc.c +@@ -6252,8 +6252,10 @@ static void nfs4_delegreturn_prepare(str + + d_data = (struct nfs4_delegreturndata *)data; + +- if (!d_data->lr.roc && nfs4_wait_on_layoutreturn(d_data->inode, task)) ++ if (!d_data->lr.roc && nfs4_wait_on_layoutreturn(d_data->inode, task)) { ++ nfs4_sequence_done(task, &d_data->res.seq_res); + return; ++ } + + lo = d_data->args.lr_args ? d_data->args.lr_args->layout : NULL; + if (lo && !pnfs_layout_is_valid(lo)) { diff --git a/queue-5.4/nfsv4.x-handle-bad-dead-sessions-correctly-in-nfs41_sequence_process.patch b/queue-5.4/nfsv4.x-handle-bad-dead-sessions-correctly-in-nfs41_sequence_process.patch new file mode 100644 index 00000000000..88743320d50 --- /dev/null +++ b/queue-5.4/nfsv4.x-handle-bad-dead-sessions-correctly-in-nfs41_sequence_process.patch @@ -0,0 +1,116 @@ +From 5c441544f045e679afd6c3c6d9f7aaf5fa5f37b0 Mon Sep 17 00:00:00 2001 +From: Trond Myklebust +Date: Wed, 13 Nov 2019 08:34:00 +0100 +Subject: NFSv4.x: Handle bad/dead sessions correctly in nfs41_sequence_process() + +From: Trond Myklebust + +commit 5c441544f045e679afd6c3c6d9f7aaf5fa5f37b0 upstream. + +If the server returns a bad or dead session error, the we don't want +to update the session slot number, but just immediately schedule +recovery and allow it to proceed. + +We can/should then remove handling in other places + +Fixes: 3453d5708b33 ("NFSv4.1: Avoid false retries when RPC calls are interrupted") +Signed-off-by: Trond Myklebust +Signed-off-by: Greg Kroah-Hartman + +--- + fs/nfs/nfs4proc.c | 34 +++++++++++++++++++++++++--------- + 1 file changed, 25 insertions(+), 9 deletions(-) + +--- a/fs/nfs/nfs4proc.c ++++ b/fs/nfs/nfs4proc.c +@@ -521,9 +521,7 @@ static int nfs4_do_handle_exception(stru + case -NFS4ERR_DEADSESSION: + case -NFS4ERR_SEQ_FALSE_RETRY: + case -NFS4ERR_SEQ_MISORDERED: +- dprintk("%s ERROR: %d Reset session\n", __func__, +- errorcode); +- nfs4_schedule_session_recovery(clp->cl_session, errorcode); ++ /* Handled in nfs41_sequence_process() */ + goto wait_on_recovery; + #endif /* defined(CONFIG_NFS_V4_1) */ + case -NFS4ERR_FILE_OPEN: +@@ -782,6 +780,7 @@ static int nfs41_sequence_process(struct + struct nfs4_session *session; + struct nfs4_slot *slot = res->sr_slot; + struct nfs_client *clp; ++ int status; + int ret = 1; + + if (slot == NULL) +@@ -793,8 +792,13 @@ static int nfs41_sequence_process(struct + session = slot->table->session; + + trace_nfs4_sequence_done(session, res); ++ ++ status = res->sr_status; ++ if (task->tk_status == -NFS4ERR_DEADSESSION) ++ status = -NFS4ERR_DEADSESSION; ++ + /* Check the SEQUENCE operation status */ +- switch (res->sr_status) { ++ switch (status) { + case 0: + /* Mark this sequence number as having been acked */ + nfs4_slot_sequence_acked(slot, slot->seq_nr); +@@ -866,6 +870,10 @@ static int nfs41_sequence_process(struct + */ + slot->seq_nr = slot->seq_nr_highest_sent; + goto out_retry; ++ case -NFS4ERR_BADSESSION: ++ case -NFS4ERR_DEADSESSION: ++ case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION: ++ goto session_recover; + default: + /* Just update the slot sequence no. */ + slot->seq_done = 1; +@@ -876,8 +884,10 @@ out: + out_noaction: + return ret; + session_recover: +- nfs4_schedule_session_recovery(session, res->sr_status); +- goto retry_nowait; ++ nfs4_schedule_session_recovery(session, status); ++ dprintk("%s ERROR: %d Reset session\n", __func__, status); ++ nfs41_sequence_free_slot(res); ++ goto out; + retry_new_seq: + ++slot->seq_nr; + retry_nowait: +@@ -2188,7 +2198,6 @@ static int nfs4_handle_delegation_recall + case -NFS4ERR_BAD_HIGH_SLOT: + case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION: + case -NFS4ERR_DEADSESSION: +- nfs4_schedule_session_recovery(server->nfs_client->cl_session, err); + return -EAGAIN; + case -NFS4ERR_STALE_CLIENTID: + case -NFS4ERR_STALE_STATEID: +@@ -7820,6 +7829,15 @@ nfs41_same_server_scope(struct nfs41_ser + static void + nfs4_bind_one_conn_to_session_done(struct rpc_task *task, void *calldata) + { ++ struct nfs41_bind_conn_to_session_args *args = task->tk_msg.rpc_argp; ++ struct nfs_client *clp = args->client; ++ ++ switch (task->tk_status) { ++ case -NFS4ERR_BADSESSION: ++ case -NFS4ERR_DEADSESSION: ++ nfs4_schedule_session_recovery(clp->cl_session, ++ task->tk_status); ++ } + } + + static const struct rpc_call_ops nfs4_bind_one_conn_to_session_ops = { +@@ -8867,8 +8885,6 @@ static int nfs41_reclaim_complete_handle + case -NFS4ERR_BADSESSION: + case -NFS4ERR_DEADSESSION: + case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION: +- nfs4_schedule_session_recovery(clp->cl_session, +- task->tk_status); + break; + default: + nfs4_schedule_lease_recovery(clp); diff --git a/queue-5.4/pinctl-ti-iodelay-fix-error-checking-on-pinctrl_count_index_with_args-call.patch b/queue-5.4/pinctl-ti-iodelay-fix-error-checking-on-pinctrl_count_index_with_args-call.patch new file mode 100644 index 00000000000..3173f7f23e8 --- /dev/null +++ b/queue-5.4/pinctl-ti-iodelay-fix-error-checking-on-pinctrl_count_index_with_args-call.patch @@ -0,0 +1,37 @@ +From 5ff8aca906f3a7a7db79fad92f2a4401107ef50d Mon Sep 17 00:00:00 2001 +From: Colin Ian King +Date: Fri, 20 Sep 2019 14:20:30 +0200 +Subject: pinctl: ti: iodelay: fix error checking on pinctrl_count_index_with_args call + +From: Colin Ian King + +commit 5ff8aca906f3a7a7db79fad92f2a4401107ef50d upstream. + +The call to pinctrl_count_index_with_args checks for a -EINVAL return +however this function calls pinctrl_get_list_and_count and this can +return -ENOENT. Rather than check for a specific error, fix this by +checking for any error return to catch the -ENOENT case. + +Addresses-Coverity: ("Improper use of negative") +Fixes: 003910ebc83b ("pinctrl: Introduce TI IOdelay configuration driver") +Signed-off-by: Colin Ian King +Link: https://lore.kernel.org/r/20190920122030.14340-1-colin.king@canonical.com +Acked-by: Tony Lindgren +Signed-off-by: Linus Walleij +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/pinctrl/ti/pinctrl-ti-iodelay.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/pinctrl/ti/pinctrl-ti-iodelay.c ++++ b/drivers/pinctrl/ti/pinctrl-ti-iodelay.c +@@ -496,7 +496,7 @@ static int ti_iodelay_dt_node_to_map(str + return -EINVAL; + + rows = pinctrl_count_index_with_args(np, name); +- if (rows == -EINVAL) ++ if (rows < 0) + return rows; + + *map = devm_kzalloc(iod->dev, sizeof(**map), GFP_KERNEL); diff --git a/queue-5.4/pinctrl-lewisburg-update-pin-list-according-to-v1.1v6.patch b/queue-5.4/pinctrl-lewisburg-update-pin-list-according-to-v1.1v6.patch new file mode 100644 index 00000000000..fba72b1cd17 --- /dev/null +++ b/queue-5.4/pinctrl-lewisburg-update-pin-list-according-to-v1.1v6.patch @@ -0,0 +1,227 @@ +From e66ff71fd0dba36a53f91f39e4da6c7b84764f2e Mon Sep 17 00:00:00 2001 +From: Andy Shevchenko +Date: Wed, 20 Nov 2019 15:37:39 +0200 +Subject: pinctrl: lewisburg: Update pin list according to v1.1v6 + +From: Andy Shevchenko + +commit e66ff71fd0dba36a53f91f39e4da6c7b84764f2e upstream. + +Version 1.1v6 of pin list has some changes in pin names for Intel Lewisburg. + +Update the driver accordingly. + +Note, it reveals the bug in the driver that misses two pins in GPP_L and +has rather two extra ones. That's why the ordering of some groups is changed. + +Fixes: e480b745386e ("pinctrl: intel: Add Intel Lewisburg GPIO support") +Signed-off-by: Andy Shevchenko +Link: https://lore.kernel.org/r/20191120133739.54332-1-andriy.shevchenko@linux.intel.com +Acked-by: Mika Westerberg +Signed-off-by: Linus Walleij +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/pinctrl/intel/pinctrl-lewisburg.c | 171 +++++++++++++++--------------- + 1 file changed, 86 insertions(+), 85 deletions(-) + +--- a/drivers/pinctrl/intel/pinctrl-lewisburg.c ++++ b/drivers/pinctrl/intel/pinctrl-lewisburg.c +@@ -33,6 +33,7 @@ + .npins = ((e) - (s) + 1), \ + } + ++/* Lewisburg */ + static const struct pinctrl_pin_desc lbg_pins[] = { + /* GPP_A */ + PINCTRL_PIN(0, "RCINB"), +@@ -72,7 +73,7 @@ static const struct pinctrl_pin_desc lbg + PINCTRL_PIN(33, "SRCCLKREQB_4"), + PINCTRL_PIN(34, "SRCCLKREQB_5"), + PINCTRL_PIN(35, "GPP_B_11"), +- PINCTRL_PIN(36, "GLB_RST_WARN_N"), ++ PINCTRL_PIN(36, "SLP_S0B"), + PINCTRL_PIN(37, "PLTRSTB"), + PINCTRL_PIN(38, "SPKR"), + PINCTRL_PIN(39, "GPP_B_15"), +@@ -185,96 +186,96 @@ static const struct pinctrl_pin_desc lbg + PINCTRL_PIN(141, "GBE_PCI_DIS"), + PINCTRL_PIN(142, "GBE_LAN_DIS"), + PINCTRL_PIN(143, "GPP_I_10"), +- PINCTRL_PIN(144, "GPIO_RCOMP_3P3"), + /* GPP_J */ +- PINCTRL_PIN(145, "GBE_LED_0_0"), +- PINCTRL_PIN(146, "GBE_LED_0_1"), +- PINCTRL_PIN(147, "GBE_LED_1_0"), +- PINCTRL_PIN(148, "GBE_LED_1_1"), +- PINCTRL_PIN(149, "GBE_LED_2_0"), +- PINCTRL_PIN(150, "GBE_LED_2_1"), +- PINCTRL_PIN(151, "GBE_LED_3_0"), +- PINCTRL_PIN(152, "GBE_LED_3_1"), +- PINCTRL_PIN(153, "GBE_SCL_0"), +- PINCTRL_PIN(154, "GBE_SDA_0"), +- PINCTRL_PIN(155, "GBE_SCL_1"), +- PINCTRL_PIN(156, "GBE_SDA_1"), +- PINCTRL_PIN(157, "GBE_SCL_2"), +- PINCTRL_PIN(158, "GBE_SDA_2"), +- PINCTRL_PIN(159, "GBE_SCL_3"), +- PINCTRL_PIN(160, "GBE_SDA_3"), +- PINCTRL_PIN(161, "GBE_SDP_0_0"), +- PINCTRL_PIN(162, "GBE_SDP_0_1"), +- PINCTRL_PIN(163, "GBE_SDP_1_0"), +- PINCTRL_PIN(164, "GBE_SDP_1_1"), +- PINCTRL_PIN(165, "GBE_SDP_2_0"), +- PINCTRL_PIN(166, "GBE_SDP_2_1"), +- PINCTRL_PIN(167, "GBE_SDP_3_0"), +- PINCTRL_PIN(168, "GBE_SDP_3_1"), ++ PINCTRL_PIN(144, "GBE_LED_0_0"), ++ PINCTRL_PIN(145, "GBE_LED_0_1"), ++ PINCTRL_PIN(146, "GBE_LED_1_0"), ++ PINCTRL_PIN(147, "GBE_LED_1_1"), ++ PINCTRL_PIN(148, "GBE_LED_2_0"), ++ PINCTRL_PIN(149, "GBE_LED_2_1"), ++ PINCTRL_PIN(150, "GBE_LED_3_0"), ++ PINCTRL_PIN(151, "GBE_LED_3_1"), ++ PINCTRL_PIN(152, "GBE_SCL_0"), ++ PINCTRL_PIN(153, "GBE_SDA_0"), ++ PINCTRL_PIN(154, "GBE_SCL_1"), ++ PINCTRL_PIN(155, "GBE_SDA_1"), ++ PINCTRL_PIN(156, "GBE_SCL_2"), ++ PINCTRL_PIN(157, "GBE_SDA_2"), ++ PINCTRL_PIN(158, "GBE_SCL_3"), ++ PINCTRL_PIN(159, "GBE_SDA_3"), ++ PINCTRL_PIN(160, "GBE_SDP_0_0"), ++ PINCTRL_PIN(161, "GBE_SDP_0_1"), ++ PINCTRL_PIN(162, "GBE_SDP_1_0"), ++ PINCTRL_PIN(163, "GBE_SDP_1_1"), ++ PINCTRL_PIN(164, "GBE_SDP_2_0"), ++ PINCTRL_PIN(165, "GBE_SDP_2_1"), ++ PINCTRL_PIN(166, "GBE_SDP_3_0"), ++ PINCTRL_PIN(167, "GBE_SDP_3_1"), + /* GPP_K */ +- PINCTRL_PIN(169, "GBE_RMIICLK"), +- PINCTRL_PIN(170, "GBE_RMII_TXD_0"), +- PINCTRL_PIN(171, "GBE_RMII_TXD_1"), ++ PINCTRL_PIN(168, "GBE_RMIICLK"), ++ PINCTRL_PIN(169, "GBE_RMII_RXD_0"), ++ PINCTRL_PIN(170, "GBE_RMII_RXD_1"), ++ PINCTRL_PIN(171, "GBE_RMII_CRS_DV"), + PINCTRL_PIN(172, "GBE_RMII_TX_EN"), +- PINCTRL_PIN(173, "GBE_RMII_CRS_DV"), +- PINCTRL_PIN(174, "GBE_RMII_RXD_0"), +- PINCTRL_PIN(175, "GBE_RMII_RXD_1"), +- PINCTRL_PIN(176, "GBE_RMII_RX_ER"), +- PINCTRL_PIN(177, "GBE_RMII_ARBIN"), +- PINCTRL_PIN(178, "GBE_RMII_ARB_OUT"), +- PINCTRL_PIN(179, "PE_RST_N"), +- PINCTRL_PIN(180, "GPIO_RCOMP_1P8_3P3"), ++ PINCTRL_PIN(173, "GBE_RMII_TXD_0"), ++ PINCTRL_PIN(174, "GBE_RMII_TXD_1"), ++ PINCTRL_PIN(175, "GBE_RMII_RX_ER"), ++ PINCTRL_PIN(176, "GBE_RMII_ARBIN"), ++ PINCTRL_PIN(177, "GBE_RMII_ARB_OUT"), ++ PINCTRL_PIN(178, "PE_RST_N"), + /* GPP_G */ +- PINCTRL_PIN(181, "FAN_TACH_0"), +- PINCTRL_PIN(182, "FAN_TACH_1"), +- PINCTRL_PIN(183, "FAN_TACH_2"), +- PINCTRL_PIN(184, "FAN_TACH_3"), +- PINCTRL_PIN(185, "FAN_TACH_4"), +- PINCTRL_PIN(186, "FAN_TACH_5"), +- PINCTRL_PIN(187, "FAN_TACH_6"), +- PINCTRL_PIN(188, "FAN_TACH_7"), +- PINCTRL_PIN(189, "FAN_PWM_0"), +- PINCTRL_PIN(190, "FAN_PWM_1"), +- PINCTRL_PIN(191, "FAN_PWM_2"), +- PINCTRL_PIN(192, "FAN_PWM_3"), +- PINCTRL_PIN(193, "GSXDOUT"), +- PINCTRL_PIN(194, "GSXSLOAD"), +- PINCTRL_PIN(195, "GSXDIN"), +- PINCTRL_PIN(196, "GSXSRESETB"), +- PINCTRL_PIN(197, "GSXCLK"), +- PINCTRL_PIN(198, "ADR_COMPLETE"), +- PINCTRL_PIN(199, "NMIB"), +- PINCTRL_PIN(200, "SMIB"), +- PINCTRL_PIN(201, "SSATA_DEVSLP_0"), +- PINCTRL_PIN(202, "SSATA_DEVSLP_1"), +- PINCTRL_PIN(203, "SSATA_DEVSLP_2"), +- PINCTRL_PIN(204, "SSATAXPCIE0_SSATAGP0"), ++ PINCTRL_PIN(179, "FAN_TACH_0"), ++ PINCTRL_PIN(180, "FAN_TACH_1"), ++ PINCTRL_PIN(181, "FAN_TACH_2"), ++ PINCTRL_PIN(182, "FAN_TACH_3"), ++ PINCTRL_PIN(183, "FAN_TACH_4"), ++ PINCTRL_PIN(184, "FAN_TACH_5"), ++ PINCTRL_PIN(185, "FAN_TACH_6"), ++ PINCTRL_PIN(186, "FAN_TACH_7"), ++ PINCTRL_PIN(187, "FAN_PWM_0"), ++ PINCTRL_PIN(188, "FAN_PWM_1"), ++ PINCTRL_PIN(189, "FAN_PWM_2"), ++ PINCTRL_PIN(190, "FAN_PWM_3"), ++ PINCTRL_PIN(191, "GSXDOUT"), ++ PINCTRL_PIN(192, "GSXSLOAD"), ++ PINCTRL_PIN(193, "GSXDIN"), ++ PINCTRL_PIN(194, "GSXSRESETB"), ++ PINCTRL_PIN(195, "GSXCLK"), ++ PINCTRL_PIN(196, "ADR_COMPLETE"), ++ PINCTRL_PIN(197, "NMIB"), ++ PINCTRL_PIN(198, "SMIB"), ++ PINCTRL_PIN(199, "SSATA_DEVSLP_0"), ++ PINCTRL_PIN(200, "SSATA_DEVSLP_1"), ++ PINCTRL_PIN(201, "SSATA_DEVSLP_2"), ++ PINCTRL_PIN(202, "SSATAXPCIE0_SSATAGP0"), + /* GPP_H */ +- PINCTRL_PIN(205, "SRCCLKREQB_6"), +- PINCTRL_PIN(206, "SRCCLKREQB_7"), +- PINCTRL_PIN(207, "SRCCLKREQB_8"), +- PINCTRL_PIN(208, "SRCCLKREQB_9"), +- PINCTRL_PIN(209, "SRCCLKREQB_10"), +- PINCTRL_PIN(210, "SRCCLKREQB_11"), +- PINCTRL_PIN(211, "SRCCLKREQB_12"), +- PINCTRL_PIN(212, "SRCCLKREQB_13"), +- PINCTRL_PIN(213, "SRCCLKREQB_14"), +- PINCTRL_PIN(214, "SRCCLKREQB_15"), +- PINCTRL_PIN(215, "SML2CLK"), +- PINCTRL_PIN(216, "SML2DATA"), +- PINCTRL_PIN(217, "SML2ALERTB"), +- PINCTRL_PIN(218, "SML3CLK"), +- PINCTRL_PIN(219, "SML3DATA"), +- PINCTRL_PIN(220, "SML3ALERTB"), +- PINCTRL_PIN(221, "SML4CLK"), +- PINCTRL_PIN(222, "SML4DATA"), +- PINCTRL_PIN(223, "SML4ALERTB"), +- PINCTRL_PIN(224, "SSATAXPCIE1_SSATAGP1"), +- PINCTRL_PIN(225, "SSATAXPCIE2_SSATAGP2"), +- PINCTRL_PIN(226, "SSATAXPCIE3_SSATAGP3"), +- PINCTRL_PIN(227, "SSATAXPCIE4_SSATAGP4"), +- PINCTRL_PIN(228, "SSATAXPCIE5_SSATAGP5"), ++ PINCTRL_PIN(203, "SRCCLKREQB_6"), ++ PINCTRL_PIN(204, "SRCCLKREQB_7"), ++ PINCTRL_PIN(205, "SRCCLKREQB_8"), ++ PINCTRL_PIN(206, "SRCCLKREQB_9"), ++ PINCTRL_PIN(207, "SRCCLKREQB_10"), ++ PINCTRL_PIN(208, "SRCCLKREQB_11"), ++ PINCTRL_PIN(209, "SRCCLKREQB_12"), ++ PINCTRL_PIN(210, "SRCCLKREQB_13"), ++ PINCTRL_PIN(211, "SRCCLKREQB_14"), ++ PINCTRL_PIN(212, "SRCCLKREQB_15"), ++ PINCTRL_PIN(213, "SML2CLK"), ++ PINCTRL_PIN(214, "SML2DATA"), ++ PINCTRL_PIN(215, "SML2ALERTB"), ++ PINCTRL_PIN(216, "SML3CLK"), ++ PINCTRL_PIN(217, "SML3DATA"), ++ PINCTRL_PIN(218, "SML3ALERTB"), ++ PINCTRL_PIN(219, "SML4CLK"), ++ PINCTRL_PIN(220, "SML4DATA"), ++ PINCTRL_PIN(221, "SML4ALERTB"), ++ PINCTRL_PIN(222, "SSATAXPCIE1_SSATAGP1"), ++ PINCTRL_PIN(223, "SSATAXPCIE2_SSATAGP2"), ++ PINCTRL_PIN(224, "SSATAXPCIE3_SSATAGP3"), ++ PINCTRL_PIN(225, "SSATAXPCIE4_SSATAGP4"), ++ PINCTRL_PIN(226, "SSATAXPCIE5_SSATAGP5"), + /* GPP_L */ ++ PINCTRL_PIN(227, "GPP_L_0"), ++ PINCTRL_PIN(228, "EC_CSME_INTR_OUT"), + PINCTRL_PIN(229, "VISA2CH0_D0"), + PINCTRL_PIN(230, "VISA2CH0_D1"), + PINCTRL_PIN(231, "VISA2CH0_D2"), diff --git a/queue-5.4/pinctrl-sh-pfc-do-not-use-platform_get_irq-to-count-interrupts.patch b/queue-5.4/pinctrl-sh-pfc-do-not-use-platform_get_irq-to-count-interrupts.patch new file mode 100644 index 00000000000..69dc21c677f --- /dev/null +++ b/queue-5.4/pinctrl-sh-pfc-do-not-use-platform_get_irq-to-count-interrupts.patch @@ -0,0 +1,72 @@ +From ad7fe1a1a35994a201497443b5140bf54b074cca Mon Sep 17 00:00:00 2001 +From: Geert Uytterhoeven +Date: Wed, 16 Oct 2019 16:26:01 +0200 +Subject: pinctrl: sh-pfc: Do not use platform_get_irq() to count interrupts +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Geert Uytterhoeven + +commit ad7fe1a1a35994a201497443b5140bf54b074cca upstream. + +As platform_get_irq() now prints an error when the interrupt does not +exist, counting interrupts by looping until failure causes the printing +of scary messages like: + + sh-pfc e6060000.pin-controller: IRQ index 0 not found + +Fix this by using the platform_irq_count() helper instead. + +Fixes: 7723f4c5ecdb8d83 ("driver core: platform: Add an error message to platform_get_irq*()") +Signed-off-by: Geert Uytterhoeven +Reviewed-by: Yoshihiro Shimoda +Reviewed-by: Stephen Boyd +Reviewed-by: Niklas Söderlund +Tested-by: Yoshihiro Shimoda +Link: https://lore.kernel.org/r/20191016142601.28255-1-geert+renesas@glider.be +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/pinctrl/sh-pfc/core.c | 16 ++++++---------- + 1 file changed, 6 insertions(+), 10 deletions(-) + +--- a/drivers/pinctrl/sh-pfc/core.c ++++ b/drivers/pinctrl/sh-pfc/core.c +@@ -29,12 +29,12 @@ + static int sh_pfc_map_resources(struct sh_pfc *pfc, + struct platform_device *pdev) + { +- unsigned int num_windows, num_irqs; + struct sh_pfc_window *windows; + unsigned int *irqs = NULL; ++ unsigned int num_windows; + struct resource *res; + unsigned int i; +- int irq; ++ int num_irqs; + + /* Count the MEM and IRQ resources. */ + for (num_windows = 0;; num_windows++) { +@@ -42,17 +42,13 @@ static int sh_pfc_map_resources(struct s + if (!res) + break; + } +- for (num_irqs = 0;; num_irqs++) { +- irq = platform_get_irq(pdev, num_irqs); +- if (irq == -EPROBE_DEFER) +- return irq; +- if (irq < 0) +- break; +- } +- + if (num_windows == 0) + return -EINVAL; + ++ num_irqs = platform_irq_count(pdev); ++ if (num_irqs < 0) ++ return num_irqs; ++ + /* Allocate memory windows and IRQs arrays. */ + windows = devm_kcalloc(pfc->dev, num_windows, sizeof(*windows), + GFP_KERNEL); diff --git a/queue-5.4/pinctrl-sh-pfc-fix-pinmux_ipsr_phys-to-set-gpsr.patch b/queue-5.4/pinctrl-sh-pfc-fix-pinmux_ipsr_phys-to-set-gpsr.patch new file mode 100644 index 00000000000..fed011ac189 --- /dev/null +++ b/queue-5.4/pinctrl-sh-pfc-fix-pinmux_ipsr_phys-to-set-gpsr.patch @@ -0,0 +1,42 @@ +From d30710b8cce3a581c170d69002e311cc18ed47d3 Mon Sep 17 00:00:00 2001 +From: Keiya Nobuta +Date: Tue, 8 Oct 2019 15:01:12 +0900 +Subject: pinctrl: sh-pfc: Fix PINMUX_IPSR_PHYS() to set GPSR + +From: Keiya Nobuta + +commit d30710b8cce3a581c170d69002e311cc18ed47d3 upstream. + +This patch allows PINMUX_IPSR_PHYS() to set bits in GPSR. +When assigning function to pin, GPSR should be set to peripheral +function. +For example when using SCL3, GPSR2 bit7 (PWM1_A pin) should be set to +peripheral function. + +Signed-off-by: Keiya Nobuta +Link: https://lore.kernel.org/r/20191008060112.29819-1-nobuta.keiya@fujitsu.com +Fixes: 50d1ba1764b3e00a ("pinctrl: sh-pfc: Add physical pin multiplexing helper macros") +Signed-off-by: Geert Uytterhoeven +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/pinctrl/sh-pfc/sh_pfc.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/pinctrl/sh-pfc/sh_pfc.h ++++ b/drivers/pinctrl/sh-pfc/sh_pfc.h +@@ -422,12 +422,12 @@ extern const struct sh_pfc_soc_info shx3 + /* + * Describe a pinmux configuration in which a pin is physically multiplexed + * with other pins. +- * - ipsr: IPSR field (unused, for documentation purposes only) ++ * - ipsr: IPSR field + * - fn: Function name + * - psel: Physical multiplexing selector + */ + #define PINMUX_IPSR_PHYS(ipsr, fn, psel) \ +- PINMUX_DATA(fn##_MARK, FN_##psel) ++ PINMUX_DATA(fn##_MARK, FN_##psel, FN_##ipsr) + + /* + * Describe a pinmux configuration for a single-function pin with GPIO diff --git a/queue-5.4/rsi-fix-potential-null-dereference-in-rsi_probe.patch b/queue-5.4/rsi-fix-potential-null-dereference-in-rsi_probe.patch new file mode 100644 index 00000000000..d20205b65ec --- /dev/null +++ b/queue-5.4/rsi-fix-potential-null-dereference-in-rsi_probe.patch @@ -0,0 +1,36 @@ +From f170d44bc4ec2feae5f6206980e7ae7fbf0432a0 Mon Sep 17 00:00:00 2001 +From: Denis Efremov +Date: Wed, 2 Oct 2019 20:18:11 +0300 +Subject: rsi: fix potential null dereference in rsi_probe() + +From: Denis Efremov + +commit f170d44bc4ec2feae5f6206980e7ae7fbf0432a0 upstream. + +The id pointer can be NULL in rsi_probe(). It is checked everywhere except +for the else branch in the idProduct condition. The patch adds NULL check +before the id dereference in the rsi_dbg() call. + +Fixes: 54fdb318c111 ("rsi: add new device model for 9116") +Cc: Amitkumar Karwar +Cc: Siva Rebbagondla +Cc: Kalle Valo +Signed-off-by: Denis Efremov +Signed-off-by: Kalle Valo +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/wireless/rsi/rsi_91x_usb.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/rsi/rsi_91x_usb.c ++++ b/drivers/net/wireless/rsi/rsi_91x_usb.c +@@ -793,7 +793,7 @@ static int rsi_probe(struct usb_interfac + adapter->device_model = RSI_DEV_9116; + } else { + rsi_dbg(ERR_ZONE, "%s: Unsupported RSI device id 0x%x\n", +- __func__, id->idProduct); ++ __func__, id ? id->idProduct : 0x0); + goto err1; + } + diff --git a/queue-5.4/rxrpc-fix-missing-security-check-on-incoming-calls.patch b/queue-5.4/rxrpc-fix-missing-security-check-on-incoming-calls.patch deleted file mode 100644 index 69239c61500..00000000000 --- a/queue-5.4/rxrpc-fix-missing-security-check-on-incoming-calls.patch +++ /dev/null @@ -1,279 +0,0 @@ -From 063c60d39180cec7c9317f5acfc3071f8fecd705 Mon Sep 17 00:00:00 2001 -From: David Howells -Date: Fri, 20 Dec 2019 16:17:16 +0000 -Subject: rxrpc: Fix missing security check on incoming calls - -From: David Howells - -commit 063c60d39180cec7c9317f5acfc3071f8fecd705 upstream. - -Fix rxrpc_new_incoming_call() to check that we have a suitable service key -available for the combination of service ID and security class of a new -incoming call - and to reject calls for which we don't. - -This causes an assertion like the following to appear: - - rxrpc: Assertion failed - 6(0x6) == 12(0xc) is false - kernel BUG at net/rxrpc/call_object.c:456! - -Where call->state is RXRPC_CALL_SERVER_SECURING (6) rather than -RXRPC_CALL_COMPLETE (12). - -Fixes: 248f219cb8bc ("rxrpc: Rewrite the data and ack handling code") -Reported-by: Marc Dionne -Signed-off-by: David Howells -Signed-off-by: Greg Kroah-Hartman - ---- - net/rxrpc/ar-internal.h | 10 ++++-- - net/rxrpc/call_accept.c | 14 +++++++-- - net/rxrpc/conn_event.c | 16 ---------- - net/rxrpc/conn_service.c | 4 ++ - net/rxrpc/rxkad.c | 5 ++- - net/rxrpc/security.c | 70 ++++++++++++++++++++++------------------------- - 6 files changed, 59 insertions(+), 60 deletions(-) - ---- a/net/rxrpc/ar-internal.h -+++ b/net/rxrpc/ar-internal.h -@@ -209,6 +209,7 @@ struct rxrpc_skb_priv { - struct rxrpc_security { - const char *name; /* name of this service */ - u8 security_index; /* security type provided */ -+ u32 no_key_abort; /* Abort code indicating no key */ - - /* Initialise a security service */ - int (*init)(void); -@@ -977,8 +978,9 @@ static inline void rxrpc_reduce_conn_tim - struct rxrpc_connection *rxrpc_find_service_conn_rcu(struct rxrpc_peer *, - struct sk_buff *); - struct rxrpc_connection *rxrpc_prealloc_service_connection(struct rxrpc_net *, gfp_t); --void rxrpc_new_incoming_connection(struct rxrpc_sock *, -- struct rxrpc_connection *, struct sk_buff *); -+void rxrpc_new_incoming_connection(struct rxrpc_sock *, struct rxrpc_connection *, -+ const struct rxrpc_security *, struct key *, -+ struct sk_buff *); - void rxrpc_unpublish_service_conn(struct rxrpc_connection *); - - /* -@@ -1103,7 +1105,9 @@ extern const struct rxrpc_security rxkad - int __init rxrpc_init_security(void); - void rxrpc_exit_security(void); - int rxrpc_init_client_conn_security(struct rxrpc_connection *); --int rxrpc_init_server_conn_security(struct rxrpc_connection *); -+bool rxrpc_look_up_server_security(struct rxrpc_local *, struct rxrpc_sock *, -+ const struct rxrpc_security **, struct key **, -+ struct sk_buff *); - - /* - * sendmsg.c ---- a/net/rxrpc/call_accept.c -+++ b/net/rxrpc/call_accept.c -@@ -247,6 +247,8 @@ static struct rxrpc_call *rxrpc_alloc_in - struct rxrpc_local *local, - struct rxrpc_peer *peer, - struct rxrpc_connection *conn, -+ const struct rxrpc_security *sec, -+ struct key *key, - struct sk_buff *skb) - { - struct rxrpc_backlog *b = rx->backlog; -@@ -294,7 +296,7 @@ static struct rxrpc_call *rxrpc_alloc_in - conn->params.local = rxrpc_get_local(local); - conn->params.peer = peer; - rxrpc_see_connection(conn); -- rxrpc_new_incoming_connection(rx, conn, skb); -+ rxrpc_new_incoming_connection(rx, conn, sec, key, skb); - } else { - rxrpc_get_connection(conn); - } -@@ -333,9 +335,11 @@ struct rxrpc_call *rxrpc_new_incoming_ca - struct sk_buff *skb) - { - struct rxrpc_skb_priv *sp = rxrpc_skb(skb); -+ const struct rxrpc_security *sec = NULL; - struct rxrpc_connection *conn; - struct rxrpc_peer *peer = NULL; -- struct rxrpc_call *call; -+ struct rxrpc_call *call = NULL; -+ struct key *key = NULL; - - _enter(""); - -@@ -358,7 +362,11 @@ struct rxrpc_call *rxrpc_new_incoming_ca - */ - conn = rxrpc_find_connection_rcu(local, skb, &peer); - -- call = rxrpc_alloc_incoming_call(rx, local, peer, conn, skb); -+ if (!conn && !rxrpc_look_up_server_security(local, rx, &sec, &key, skb)) -+ goto no_call; -+ -+ call = rxrpc_alloc_incoming_call(rx, local, peer, conn, sec, key, skb); -+ key_put(key); - if (!call) { - skb->mark = RXRPC_SKB_MARK_REJECT_BUSY; - _leave(" = NULL [busy]"); ---- a/net/rxrpc/conn_event.c -+++ b/net/rxrpc/conn_event.c -@@ -376,21 +376,7 @@ static void rxrpc_secure_connection(stru - _enter("{%d}", conn->debug_id); - - ASSERT(conn->security_ix != 0); -- -- if (!conn->params.key) { -- _debug("set up security"); -- ret = rxrpc_init_server_conn_security(conn); -- switch (ret) { -- case 0: -- break; -- case -ENOENT: -- abort_code = RX_CALL_DEAD; -- goto abort; -- default: -- abort_code = RXKADNOAUTH; -- goto abort; -- } -- } -+ ASSERT(conn->server_key); - - if (conn->security->issue_challenge(conn) < 0) { - abort_code = RX_CALL_DEAD; ---- a/net/rxrpc/conn_service.c -+++ b/net/rxrpc/conn_service.c -@@ -148,6 +148,8 @@ struct rxrpc_connection *rxrpc_prealloc_ - */ - void rxrpc_new_incoming_connection(struct rxrpc_sock *rx, - struct rxrpc_connection *conn, -+ const struct rxrpc_security *sec, -+ struct key *key, - struct sk_buff *skb) - { - struct rxrpc_skb_priv *sp = rxrpc_skb(skb); -@@ -160,6 +162,8 @@ void rxrpc_new_incoming_connection(struc - conn->service_id = sp->hdr.serviceId; - conn->security_ix = sp->hdr.securityIndex; - conn->out_clientflag = 0; -+ conn->security = sec; -+ conn->server_key = key_get(key); - if (conn->security_ix) - conn->state = RXRPC_CONN_SERVICE_UNSECURED; - else ---- a/net/rxrpc/rxkad.c -+++ b/net/rxrpc/rxkad.c -@@ -648,9 +648,9 @@ static int rxkad_issue_challenge(struct - u32 serial; - int ret; - -- _enter("{%d,%x}", conn->debug_id, key_serial(conn->params.key)); -+ _enter("{%d,%x}", conn->debug_id, key_serial(conn->server_key)); - -- ret = key_validate(conn->params.key); -+ ret = key_validate(conn->server_key); - if (ret < 0) - return ret; - -@@ -1293,6 +1293,7 @@ static void rxkad_exit(void) - const struct rxrpc_security rxkad = { - .name = "rxkad", - .security_index = RXRPC_SECURITY_RXKAD, -+ .no_key_abort = RXKADUNKNOWNKEY, - .init = rxkad_init, - .exit = rxkad_exit, - .init_connection_security = rxkad_init_connection_security, ---- a/net/rxrpc/security.c -+++ b/net/rxrpc/security.c -@@ -101,62 +101,58 @@ int rxrpc_init_client_conn_security(stru - } - - /* -- * initialise the security on a server connection -+ * Find the security key for a server connection. - */ --int rxrpc_init_server_conn_security(struct rxrpc_connection *conn) -+bool rxrpc_look_up_server_security(struct rxrpc_local *local, struct rxrpc_sock *rx, -+ const struct rxrpc_security **_sec, -+ struct key **_key, -+ struct sk_buff *skb) - { - const struct rxrpc_security *sec; -- struct rxrpc_local *local = conn->params.local; -- struct rxrpc_sock *rx; -- struct key *key; -- key_ref_t kref; -+ struct rxrpc_skb_priv *sp = rxrpc_skb(skb); -+ key_ref_t kref = NULL; - char kdesc[5 + 1 + 3 + 1]; - - _enter(""); - -- sprintf(kdesc, "%u:%u", conn->service_id, conn->security_ix); -+ sprintf(kdesc, "%u:%u", sp->hdr.serviceId, sp->hdr.securityIndex); - -- sec = rxrpc_security_lookup(conn->security_ix); -+ sec = rxrpc_security_lookup(sp->hdr.securityIndex); - if (!sec) { -- _leave(" = -ENOKEY [lookup]"); -- return -ENOKEY; -+ trace_rxrpc_abort(0, "SVS", -+ sp->hdr.cid, sp->hdr.callNumber, sp->hdr.seq, -+ RX_INVALID_OPERATION, EKEYREJECTED); -+ skb->mark = RXRPC_SKB_MARK_REJECT_ABORT; -+ skb->priority = RX_INVALID_OPERATION; -+ return false; - } - -- /* find the service */ -- read_lock(&local->services_lock); -- rx = rcu_dereference_protected(local->service, -- lockdep_is_held(&local->services_lock)); -- if (rx && (rx->srx.srx_service == conn->service_id || -- rx->second_service == conn->service_id)) -- goto found_service; -- -- /* the service appears to have died */ -- read_unlock(&local->services_lock); -- _leave(" = -ENOENT"); -- return -ENOENT; -+ if (sp->hdr.securityIndex == RXRPC_SECURITY_NONE) -+ goto out; - --found_service: - if (!rx->securities) { -- read_unlock(&local->services_lock); -- _leave(" = -ENOKEY"); -- return -ENOKEY; -+ trace_rxrpc_abort(0, "SVR", -+ sp->hdr.cid, sp->hdr.callNumber, sp->hdr.seq, -+ RX_INVALID_OPERATION, EKEYREJECTED); -+ skb->mark = RXRPC_SKB_MARK_REJECT_ABORT; -+ skb->priority = RX_INVALID_OPERATION; -+ return false; - } - - /* look through the service's keyring */ - kref = keyring_search(make_key_ref(rx->securities, 1UL), - &key_type_rxrpc_s, kdesc, true); - if (IS_ERR(kref)) { -- read_unlock(&local->services_lock); -- _leave(" = %ld [search]", PTR_ERR(kref)); -- return PTR_ERR(kref); -+ trace_rxrpc_abort(0, "SVK", -+ sp->hdr.cid, sp->hdr.callNumber, sp->hdr.seq, -+ sec->no_key_abort, EKEYREJECTED); -+ skb->mark = RXRPC_SKB_MARK_REJECT_ABORT; -+ skb->priority = sec->no_key_abort; -+ return false; - } - -- key = key_ref_to_ptr(kref); -- read_unlock(&local->services_lock); -- -- conn->server_key = key; -- conn->security = sec; -- -- _leave(" = 0"); -- return 0; -+out: -+ *_sec = sec; -+ *_key = key_ref_to_ptr(kref); -+ return true; - } diff --git a/queue-5.4/series b/queue-5.4/series index 0310a0bdc4b..41ce815c36b 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -90,9 +90,33 @@ platform-x86-gpd-pocket-fan-use-default-values-when-wrong-modparams-are-given.pa asm-generic-nds32-don-t-redefine-cacheflush-primitives.patch documentation-abi-fix-documentation-inconsistency-for-mlxreg-io-sysfs-interfaces.patch documentation-abi-add-missed-attribute-for-mlxreg-io-sysfs-interfaces.patch -rxrpc-fix-missing-security-check-on-incoming-calls.patch xprtrdma-fix-create_qp-crash-on-device-unload.patch xprtrdma-fix-completion-wait-during-device-removal.patch xprtrdma-fix-oops-in-receive-handler-after-device-removal.patch dm-add-dm-clone-to-the-documentation-index.patch scsi-ufs-give-an-unique-id-to-each-ufs-bsg.patch +crypto-cavium-nitrox-fix-firmware-assignment-to-ae-cores.patch +crypto-hisilicon-select-need_sg_dma_length-in-qm-kconfig.patch +crypto-arm64-aes-neonbs-add-return-value-of-skcipher_walk_done-in-__xts_crypt.patch +crypto-virtio-implement-missing-support-for-output-ivs.patch +crypto-algif_skcipher-use-chunksize-instead-of-blocksize.patch +crypto-geode-aes-convert-to-skcipher-api-and-make-thread-safe.patch +nfsv2-fix-a-typo-in-encode_sattr.patch +nfsd-fix-cld_net-cn_tfm-initialization.patch +nfsd-v4-support-requires-crypto_sha256.patch +nfsv4.x-handle-bad-dead-sessions-correctly-in-nfs41_sequence_process.patch +nfsv4.x-drop-the-slot-if-nfs4_delegreturn_prepare-waits-for-layoutreturn.patch +iio-imu-st_lsm6dsx-fix-gyro-gain-definitions-for-lsm9ds1.patch +iio-imu-adis16480-assign-bias-value-only-if-operation-succeeded.patch +mei-fix-modalias-documentation.patch +clk-meson-axg-audio-fix-regmap-last-register.patch +clk-samsung-exynos5420-preserve-cpu-clocks-configuration-during-suspend-resume.patch +clk-fix-memory-leak-in-clk_unregister.patch +dmaengine-dw-platform-mark-hclk-clock-optional.patch +clk-imx-pll14xx-fix-quick-switch-of-s-k-parameter.patch +rsi-fix-potential-null-dereference-in-rsi_probe.patch +affs-fix-a-memory-leak-in-affs_remount.patch +pinctl-ti-iodelay-fix-error-checking-on-pinctrl_count_index_with_args-call.patch +pinctrl-sh-pfc-fix-pinmux_ipsr_phys-to-set-gpsr.patch +pinctrl-sh-pfc-do-not-use-platform_get_irq-to-count-interrupts.patch +pinctrl-lewisburg-update-pin-list-according-to-v1.1v6.patch