]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Aug 2021 09:22:26 +0000 (11:22 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Aug 2021 09:22:26 +0000 (11:22 +0200)
added patches:
mtd-cfi_cmdset_0002-fix-crash-when-erasing-writing-amd-cards.patch

queue-5.4/mtd-cfi_cmdset_0002-fix-crash-when-erasing-writing-amd-cards.patch [new file with mode: 0644]
queue-5.4/series

diff --git a/queue-5.4/mtd-cfi_cmdset_0002-fix-crash-when-erasing-writing-amd-cards.patch b/queue-5.4/mtd-cfi_cmdset_0002-fix-crash-when-erasing-writing-amd-cards.patch
new file mode 100644 (file)
index 0000000..fcd1aad
--- /dev/null
@@ -0,0 +1,34 @@
+From 2394e628738933aa014093d93093030f6232946d Mon Sep 17 00:00:00 2001
+From: Andreas Persson <andreasp56@outlook.com>
+Date: Mon, 12 Jul 2021 09:54:52 +0200
+Subject: mtd: cfi_cmdset_0002: fix crash when erasing/writing AMD cards
+
+From: Andreas Persson <andreasp56@outlook.com>
+
+commit 2394e628738933aa014093d93093030f6232946d upstream.
+
+Erasing an AMD linear flash card (AM29F016D) crashes after the first
+sector has been erased. Likewise, writing to it crashes after two bytes
+have been written. The reason is a missing check for a null pointer -
+the cmdset_priv field is not set for this type of card.
+
+Fixes: 4844ef80305d ("mtd: cfi_cmdset_0002: Add support for polling status register")
+Signed-off-by: Andreas Persson <andreasp56@outlook.com>
+Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
+Link: https://lore.kernel.org/linux-mtd/DB6P189MB05830B3530B8087476C5CFE4C1159@DB6P189MB0583.EURP189.PROD.OUTLOOK.COM
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/mtd/chips/cfi_cmdset_0002.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/mtd/chips/cfi_cmdset_0002.c
++++ b/drivers/mtd/chips/cfi_cmdset_0002.c
+@@ -119,7 +119,7 @@ static int cfi_use_status_reg(struct cfi
+       struct cfi_pri_amdstd *extp = cfi->cmdset_priv;
+       u8 poll_mask = CFI_POLL_STATUS_REG | CFI_POLL_DQ;
+-      return extp->MinorVersion >= '5' &&
++      return extp && extp->MinorVersion >= '5' &&
+               (extp->SoftwareFeatures & poll_mask) == CFI_POLL_STATUS_REG;
+ }
index 75e854701d69257e91333ddd9b6879b9c959e383..71ffdb95c7e1afe6da5e4155ae625e0ad69cb5ff 100644 (file)
@@ -5,3 +5,4 @@ ath9k-clear-key-cache-explicitly-on-disabling-hardware.patch
 ath-export-ath_hw_keysetmac.patch
 ath-modify-ath_key_delete-to-not-need-full-key-entry.patch
 ath9k-postpone-key-cache-entry-deletion-for-txq-frames-reference-it.patch
+mtd-cfi_cmdset_0002-fix-crash-when-erasing-writing-amd-cards.patch