From 3abee87afd6ca7db214ceef4cd2c76e4778fc1c1 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Thu, 6 Feb 2020 21:08:04 -0500 Subject: [PATCH] fixes for 4.14 Signed-off-by: Sasha Levin --- ...-at91-fix-memleak-on-clk_get-failure.patch | 60 +++++++++++++++++++ ...fix-link-training-retries-initiation.patch | 40 +++++++++++++ queue-4.14/series | 3 + ...ger-assertion-on-invalid-no-key-file.patch | 53 ++++++++++++++++ 4 files changed, 156 insertions(+) create mode 100644 queue-4.14/mmc-sdhci-of-at91-fix-memleak-on-clk_get-failure.patch create mode 100644 queue-4.14/pci-keystone-fix-link-training-retries-initiation.patch create mode 100644 queue-4.14/ubifs-don-t-trigger-assertion-on-invalid-no-key-file.patch diff --git a/queue-4.14/mmc-sdhci-of-at91-fix-memleak-on-clk_get-failure.patch b/queue-4.14/mmc-sdhci-of-at91-fix-memleak-on-clk_get-failure.patch new file mode 100644 index 00000000000..216f3d5c83f --- /dev/null +++ b/queue-4.14/mmc-sdhci-of-at91-fix-memleak-on-clk_get-failure.patch @@ -0,0 +1,60 @@ +From 79fe4557f6532f5e6fb303ca175ac1abe6a99cbe Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 2 Jan 2020 11:42:16 +0100 +Subject: mmc: sdhci-of-at91: fix memleak on clk_get failure +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Michał Mirosław + +[ Upstream commit a04184ce777b46e92c2b3c93c6dcb2754cb005e1 ] + +sdhci_alloc_host() does its work not using managed infrastructure, so +needs explicit free on error path. Add it where needed. + +Cc: +Fixes: bb5f8ea4d514 ("mmc: sdhci-of-at91: introduce driver for the Atmel SDMMC") +Signed-off-by: Michał Mirosław +Acked-by: Ludovic Desroches +Acked-by: Adrian Hunter +Link: https://lore.kernel.org/r/b2a44d5be2e06ff075f32477e466598bb0f07b36.1577961679.git.mirq-linux@rere.qmqm.pl +Signed-off-by: Ulf Hansson +Signed-off-by: Sasha Levin +--- + drivers/mmc/host/sdhci-of-at91.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c +index 564e7be21e068..1dadd460cc8fb 100644 +--- a/drivers/mmc/host/sdhci-of-at91.c ++++ b/drivers/mmc/host/sdhci-of-at91.c +@@ -331,19 +331,22 @@ static int sdhci_at91_probe(struct platform_device *pdev) + priv->mainck = devm_clk_get(&pdev->dev, "baseclk"); + if (IS_ERR(priv->mainck)) { + dev_err(&pdev->dev, "failed to get baseclk\n"); +- return PTR_ERR(priv->mainck); ++ ret = PTR_ERR(priv->mainck); ++ goto sdhci_pltfm_free; + } + + priv->hclock = devm_clk_get(&pdev->dev, "hclock"); + if (IS_ERR(priv->hclock)) { + dev_err(&pdev->dev, "failed to get hclock\n"); +- return PTR_ERR(priv->hclock); ++ ret = PTR_ERR(priv->hclock); ++ goto sdhci_pltfm_free; + } + + priv->gck = devm_clk_get(&pdev->dev, "multclk"); + if (IS_ERR(priv->gck)) { + dev_err(&pdev->dev, "failed to get multclk\n"); +- return PTR_ERR(priv->gck); ++ ret = PTR_ERR(priv->gck); ++ goto sdhci_pltfm_free; + } + + ret = sdhci_at91_set_clks_presets(&pdev->dev); +-- +2.20.1 + diff --git a/queue-4.14/pci-keystone-fix-link-training-retries-initiation.patch b/queue-4.14/pci-keystone-fix-link-training-retries-initiation.patch new file mode 100644 index 00000000000..7f243549595 --- /dev/null +++ b/queue-4.14/pci-keystone-fix-link-training-retries-initiation.patch @@ -0,0 +1,40 @@ +From bd193cfef1591c4e8821ae7f9e93b2120e38675a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 17 Dec 2019 14:38:36 +0300 +Subject: PCI: keystone: Fix link training retries initiation + +From: Yurii Monakov + +[ Upstream commit 6df19872d881641e6394f93ef2938cffcbdae5bb ] + +ks_pcie_stop_link() function does not clear LTSSM_EN_VAL bit so +link training was not triggered more than once after startup. +In configurations where link can be unstable during early boot, +for example, under low temperature, it will never be established. + +Fixes: 0c4ffcfe1fbc ("PCI: keystone: Add TI Keystone PCIe driver") +Signed-off-by: Yurii Monakov +Signed-off-by: Lorenzo Pieralisi +Acked-by: Andrew Murray +Cc: stable@vger.kernel.org +Signed-off-by: Sasha Levin +--- + drivers/pci/dwc/pci-keystone-dw.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/pci/dwc/pci-keystone-dw.c b/drivers/pci/dwc/pci-keystone-dw.c +index 2fb20b887d2a5..4cf2662930d86 100644 +--- a/drivers/pci/dwc/pci-keystone-dw.c ++++ b/drivers/pci/dwc/pci-keystone-dw.c +@@ -510,7 +510,7 @@ void ks_dw_pcie_initiate_link_train(struct keystone_pcie *ks_pcie) + /* Disable Link training */ + val = ks_dw_app_readl(ks_pcie, CMD_STATUS); + val &= ~LTSSM_EN_VAL; +- ks_dw_app_writel(ks_pcie, CMD_STATUS, LTSSM_EN_VAL | val); ++ ks_dw_app_writel(ks_pcie, CMD_STATUS, val); + + /* Initiate Link Training */ + val = ks_dw_app_readl(ks_pcie, CMD_STATUS); +-- +2.20.1 + diff --git a/queue-4.14/series b/queue-4.14/series index 21351811bc9..da58823a6d0 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -39,3 +39,6 @@ alarmtimer-unregister-wakeup-source-when-module-get-fails.patch ubifs-reject-unsupported-ioctl-flags-explicitly.patch ubifs-fix-fs_ioc_setflags-unexpectedly-clearing-encrypt-flag.patch ubifs-fix-deadlock-in-concurrent-bulk-read-and-writepage.patch +pci-keystone-fix-link-training-retries-initiation.patch +mmc-sdhci-of-at91-fix-memleak-on-clk_get-failure.patch +ubifs-don-t-trigger-assertion-on-invalid-no-key-file.patch diff --git a/queue-4.14/ubifs-don-t-trigger-assertion-on-invalid-no-key-file.patch b/queue-4.14/ubifs-don-t-trigger-assertion-on-invalid-no-key-file.patch new file mode 100644 index 00000000000..62e048d8ae0 --- /dev/null +++ b/queue-4.14/ubifs-don-t-trigger-assertion-on-invalid-no-key-file.patch @@ -0,0 +1,53 @@ +From 08ddbcc83631432aa7d90e01f93718c4b10f219a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 20 Jan 2020 14:31:59 -0800 +Subject: ubifs: don't trigger assertion on invalid no-key filename + +From: Eric Biggers + +[ Upstream commit f0d07a98a070bb5e443df19c3aa55693cbca9341 ] + +If userspace provides an invalid fscrypt no-key filename which encodes a +hash value with any of the UBIFS node type bits set (i.e. the high 3 +bits), gracefully report ENOENT rather than triggering ubifs_assert(). + +Test case with kvm-xfstests shell: + + . fs/ubifs/config + . ~/xfstests/common/encrypt + dev=$(__blkdev_to_ubi_volume /dev/vdc) + ubiupdatevol $dev -t + mount $dev /mnt -t ubifs + mkdir /mnt/edir + xfs_io -c set_encpolicy /mnt/edir + rm /mnt/edir/_,,,,,DAAAAAAAAAAAAAAAAAAAAAAAAAA + +With the bug, the following assertion fails on the 'rm' command: + + [ 19.066048] UBIFS error (ubi0:0 pid 379): ubifs_assert_failed: UBIFS assert failed: !(hash & ~UBIFS_S_KEY_HASH_MASK), in fs/ubifs/key.h:170 + +Fixes: f4f61d2cc6d8 ("ubifs: Implement encrypted filenames") +Cc: # v4.10+ +Link: https://lore.kernel.org/r/20200120223201.241390-5-ebiggers@kernel.org +Signed-off-by: Eric Biggers +Signed-off-by: Sasha Levin +--- + fs/ubifs/dir.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c +index 4e6e32c0c08a4..358abc26dbc0b 100644 +--- a/fs/ubifs/dir.c ++++ b/fs/ubifs/dir.c +@@ -253,6 +253,8 @@ static struct dentry *ubifs_lookup(struct inode *dir, struct dentry *dentry, + if (nm.hash) { + ubifs_assert(fname_len(&nm) == 0); + ubifs_assert(fname_name(&nm) == NULL); ++ if (nm.hash & ~UBIFS_S_KEY_HASH_MASK) ++ goto done; /* ENOENT */ + dent_key_init_hash(c, &key, dir->i_ino, nm.hash); + err = ubifs_tnc_lookup_dh(c, &key, dent, nm.minor_hash); + } else { +-- +2.20.1 + -- 2.47.3