[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <17b36d70-31a2-d705-a74a-51b2420444f3@mellanox.com>
Date: Sun, 4 Mar 2018 17:32:30 +0200
From: Paul Blakey <paulb@...lanox.com>
To: Mark Bloch <markb@...lanox.com>, Thomas Graf <tgraf@...g.ch>,
Herbert Xu <herbert@...dor.apana.org.au>,
David Miller <davem@...emloft.net>
Cc: paulb@...lanox.com, netdev@...r.kernel.org,
Yevgeny Kliteynik <kliteyn@...lanox.com>,
Roi Dayan <roid@...lanox.com>,
Shahar Klein <shahark@...lanox.com>,
Jiri Pirko <jiri@...lanox.com>,
Or Gerlitz <ogerlitz@...lanox.com>,
Matan Barak <matanb@...lanox.com>
Subject: Re: [PATCH net v2 1/2] rhashtable: Fix rhlist duplicates insertion
On 04/03/2018 17:13, Mark Bloch wrote:
>
>
> On 04/03/2018 15:26, Paul Blakey wrote:
>> 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.
>>
>> Fixes: ca26893f05e8 ('rhashtable: Add rhlist interface')
>> Signed-off-by: Paul Blakey <paulb@...lanox.com>
>> ---
>> include/linux/rhashtable.h | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
>> index c9df252..668a21f 100644
>> --- a/include/linux/rhashtable.h
>> +++ b/include/linux/rhashtable.h
>> @@ -766,8 +766,10 @@ static inline void *__rhashtable_insert_fast(
>> 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;
>
> It seems rhashtable_lookup_one() might need the same fix.
yes was just about to send it!
it's in v3 with a test that shows it.
>
>> continue;
>> + }
>>
>> data = rht_obj(ht, head);
>>
>>
>
> Mark
>
Powered by blists - more mailing lists