From: Vasily Averin <vvs@virtuozzo.com>
To: Jiri Slaby <jslaby@suse.cz>, Matthew Wilcox <willy@infradead.org>,
Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, Waiman Long <longman@redhat.com>,
Andreas Schwab <schwab@suse.de>
Subject: Re: [PATCH] ipc/util.c: sysvipc_find_ipc() incorrectly updates position index
Date: Tue, 12 May 2020 18:45:16 +0300 [thread overview]
Message-ID: <cf6990b5-1978-3f05-375a-e22db480e832@virtuozzo.com> (raw)
In-Reply-To: <eb1efdee-6d9c-2f03-fb88-ffec0db61037@suse.cz>
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
prev parent reply other threads:[~2020-05-12 15:45 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-24 7:03 [PATCH 7/7] sysvipc_find_ipc should increase position index Vasily Averin
2020-01-24 16:26 ` Waiman Long
2020-02-25 6:35 ` Vasily Averin
2020-05-05 16:13 ` Andreas Schwab
2020-05-06 5:03 ` Vasily Averin
2020-05-06 6:25 ` [PATCH] ipc/util.c: sysvipc_find_ipc() incorrectly updates " Vasily Averin
2020-05-06 15:59 ` Waiman Long
2020-05-07 12:29 ` Vasily Averin
2020-05-08 0:02 ` Andrew Morton
2020-05-08 3:36 ` Matthew Wilcox
2020-05-08 6:07 ` Vasily Averin
2020-05-08 10:01 ` Vasily Averin
2020-05-12 9:21 ` Jiri Slaby
2020-05-12 15:45 ` Vasily Averin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cf6990b5-1978-3f05-375a-e22db480e832@virtuozzo.com \
--to=vvs@virtuozzo.com \
--cc=akpm@linux-foundation.org \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=schwab@suse.de \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox