Patch "rhashtable: Fix rhlist duplicates insertion" has been added to the 4.15-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
rhashtable: Fix rhlist duplicates insertion
to the 4.15-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
rhashtable-fix-rhlist-duplicates-insertion.patch
and it can be found in the queue-4.15 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From foo@baz Wed Mar 28 18:37:51 CEST 2018
From: Paul Blakey <[email protected]>
Date: Sun, 4 Mar 2018 17:29:48 +0200
Subject: rhashtable: Fix rhlist duplicates insertion
From: Paul Blakey <[email protected]>
[ Upstream commit d3dcf8eb615537526bd42ff27a081d46d337816e ]
When inserting duplicate objects (those with the same key), current rhlist implementation messes up the chain pointers by updating the bucket pointer instead of prev next pointer to the newly inserted node. This causes missing elements on removal and travesal.
Fix that by properly updating pprev pointer to point to the correct rhash_head next pointer.
Issue: 1241076
--- include/linux/rhashtable.h | 4 +++- lib/rhashtable.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-)
include/linux/rhashtable.h +3 -1
@@ -750,8 +750,10 @@ slow_path:if (!key || (params.obj_cmpfn ? params.obj_cmpfn (&arg,rht_obj (ht, head)) : -rhashtable_compare (&arg,rht_obj (ht, head)))) +rhashtable_compare (&arg,rht_obj (ht, head)))) { + pprev = &head->next;continue ; + } data =rht_obj (ht, head);
lib/rhashtable.c +3 -1
@@ -537,8 +537,10 @@ static void *rhashtable_lookup_one(strucif (!key || (ht->p.obj_cmpfn ? ht->p.obj_cmpfn (&arg,rht_obj (ht, head)) : -rhashtable_compare (&arg,rht_obj (ht, head)))) +rhashtable_compare (&arg,rht_obj (ht, head)))) { + pprev = &head->next;continue ; + }if (!ht->rhlist)return rht_obj (ht, head);
Patches currently in stable-queue which might be from [email protected] are
queue-4.15/rhashtable-fix-rhlist-duplicates-insertion.patch queue-4.15/test_rhashtable-add-test-case-for-rhltable-with-duplicate-objects.patch