lkml.org 
[lkml]   [2020]   [May]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] ipc/util.c: sysvipc_find_ipc() incorrectly updates position index
From
Date
On 5/12/20 12:21 PM, Jiri Slaby wrote:
> On 08. 05. 20, 12:01, Vasily Averin wrote:
>> On 5/8/20 9:07 AM, Vasily Averin wrote:
>>> On 5/8/20 6:36 AM, Matthew Wilcox wrote:
>>>> On Thu, May 07, 2020 at 05:02:42PM -0700, Andrew Morton wrote:
>>>>> Here's how I resolved things. Please check?
>>>>>
>>>>> static struct kern_ipc_perm *sysvipc_find_ipc(struct ipc_ids *ids, loff_t pos,
>>>>> loff_t *new_pos)
>>>>> {
>>>>> unsigned long index = pos;
>>>>> struct kern_ipc_perm *ipc;
>>>>>
>>>>> rcu_read_lock();
>>>>> ipc = xa_find(&ids->ipcs, &index, ULONG_MAX, XA_PRESENT);
>>>>> if (ipc)
>>>>> ipc_lock_object(ipc);
>>>>> else
>>>>> rcu_read_unlock();
>>>>> *new_pos = pos + 1;
>>>>> return ipc;
>>>>> }
>>>>
>>>> Surely that should be '*new_pos = index + 1'? Or did I misunderstand
>>>> the reasoning behind the other patch?
>>>
>>> I'm not sure however it looks like xa_find() can return index < pos
>> it seems, I was wrong here.
>> So I'm agree with Matthew, '*new_pos = index + 1' should be used.
>
> Any progress on this? 5.7-rc*, 5.4.40, and 5.6.12 are still affected.

Andrew included fix to -mm tree and I hope he'll push it to mainline/stable soon.
https://ozlabs.org/~akpm/mmots/broken-out/ipc-utilc-sysvipc_find_ipc-incorrectly-updates-position-index.patch

> Wouldn't it be better to rebase (apply the originally submitted patch)
> before the XA rewrite and push that one to Linus?
I'm expecting thins too.

Thank you,
Vasily Averin

\
 
 \ /
  Last update: 2020-05-12 17:46    [W:0.075 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site