Home Home > GIT Browse > SLE12-SP4-AZURE
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-02-21 09:07:34 +0100
committerTakashi Iwai <tiwai@suse.de>2019-02-21 09:07:34 +0100
commitde848715195be0a456364708c57359a8b29c5c30 (patch)
treeb089b647f8e40d8b552c7bcfbe764a60efe552db
parentb333acf0c5d8c643d8aa24832ed6cd947aa392e7 (diff)
assoc_array: Fix shortcut creation (bsc#1051510).
-rw-r--r--patches.fixes/assoc_array-Fix-shortcut-creation.patch59
-rw-r--r--series.conf1
2 files changed, 60 insertions, 0 deletions
diff --git a/patches.fixes/assoc_array-Fix-shortcut-creation.patch b/patches.fixes/assoc_array-Fix-shortcut-creation.patch
new file mode 100644
index 0000000000..68fb938039
--- /dev/null
+++ b/patches.fixes/assoc_array-Fix-shortcut-creation.patch
@@ -0,0 +1,59 @@
+From bb2ba2d75a2d673e76ddaf13a9bd30d6a8b1bb08 Mon Sep 17 00:00:00 2001
+From: David Howells <dhowells@redhat.com>
+Date: Thu, 14 Feb 2019 16:20:15 +0000
+Subject: [PATCH] assoc_array: Fix shortcut creation
+Git-commit: bb2ba2d75a2d673e76ddaf13a9bd30d6a8b1bb08
+Patch-mainline: v5.0
+References: bsc#1051510
+
+Fix the creation of shortcuts for which the length of the index key value
+is an exact multiple of the machine word size. The problem is that the
+code that blanks off the unused bits of the shortcut value malfunctions if
+the number of bits in the last word equals machine word size. This is due
+to the "<<" operator being given a shift of zero in this case, and so the
+mask that should be all zeros is all ones instead. This causes the
+subsequent masking operation to clear everything rather than clearing
+nothing.
+
+Ordinarily, the presence of the hash at the beginning of the tree index key
+makes the issue very hard to test for, but in this case, it was encountered
+due to a development mistake that caused the hash output to be either 0
+(keyring) or 1 (non-keyring) only. This made it susceptible to the
+keyctl/unlink/valid test in the keyutils package.
+
+The fix is simply to skip the blanking if the shift would be 0. For
+example, an index key that is 64 bits long would produce a 0 shift and thus
+a 'blank' of all 1s. This would then be inverted and AND'd onto the
+index_key, incorrectly clearing the entire last word.
+
+Fixes: 3cb989501c26 ("Add a generic associative array implementation.")
+Signed-off-by: David Howells <dhowells@redhat.com>
+Signed-off-by: James Morris <james.morris@microsoft.com>
+Acked-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ lib/assoc_array.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/lib/assoc_array.c b/lib/assoc_array.c
+index c6659cb37033..59875eb278ea 100644
+--- a/lib/assoc_array.c
++++ b/lib/assoc_array.c
+@@ -768,9 +768,11 @@ static bool assoc_array_insert_into_terminal_node(struct assoc_array_edit *edit,
+ new_s0->index_key[i] =
+ ops->get_key_chunk(index_key, i * ASSOC_ARRAY_KEY_CHUNK_SIZE);
+
+- blank = ULONG_MAX << (level & ASSOC_ARRAY_KEY_CHUNK_MASK);
+- pr_devel("blank off [%zu] %d: %lx\n", keylen - 1, level, blank);
+- new_s0->index_key[keylen - 1] &= ~blank;
++ if (level & ASSOC_ARRAY_KEY_CHUNK_MASK) {
++ blank = ULONG_MAX << (level & ASSOC_ARRAY_KEY_CHUNK_MASK);
++ pr_devel("blank off [%zu] %d: %lx\n", keylen - 1, level, blank);
++ new_s0->index_key[keylen - 1] &= ~blank;
++ }
+
+ /* This now reduces to a node splitting exercise for which we'll need
+ * to regenerate the disparity table.
+--
+2.16.4
+
diff --git a/series.conf b/series.conf
index 4607a0da2b..c599baaa3a 100644
--- a/series.conf
+++ b/series.conf
@@ -20387,6 +20387,7 @@
patches.drivers/i2c-cadence-Fix-the-hold-bit-setting.patch
patches.drivers/i2c-bcm2835-Clear-current-buffer-pointers-and-counts.patch
patches.fixes/mac80211-Restore-vif-beacon-interval-if-start-ap-fai.patch
+ patches.fixes/assoc_array-Fix-shortcut-creation.patch
patches.drivers/ALSA-hda-realtek-Headset-microphone-and-internal-spe.patch
patches.drivers/ALSA-hda-realtek-Disable-PC-beep-in-passthrough-on-a.patch