From: Waiman Long <longman@redhat.com>
To: Vasily Averin <vvs@virtuozzo.com>, linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
Andreas Schwab <schwab@suse.de>
Subject: Re: [PATCH] ipc/util.c: sysvipc_find_ipc() incorrectly updates position index
Date: Wed, 6 May 2020 11:59:59 -0400 [thread overview]
Message-ID: <8e04d756-29f5-9aff-2f0b-61663ecff649@redhat.com> (raw)
In-Reply-To: <4921fe9b-9385-a2b4-1dc4-1099be6d2e39@virtuozzo.com>
On 5/6/20 2:25 AM, Vasily Averin wrote:
> new_pos should jump through hole of unused ids,
> pos can be updated inside "for" cycle.
>
> Cc: stable@vger.kernel.org
> Fixes: 89163f93c6f9 ("ipc/util.c: sysvipc_find_ipc() should increase position index")
> Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
> ---
> ipc/util.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/ipc/util.c b/ipc/util.c
> index 7acccfd..cfa0045 100644
> --- a/ipc/util.c
> +++ b/ipc/util.c
> @@ -764,21 +764,21 @@ static struct kern_ipc_perm *sysvipc_find_ipc(struct ipc_ids *ids, loff_t pos,
> total++;
> }
>
> - *new_pos = pos + 1;
> + ipc = NULL;
> if (total >= ids->in_use)
> - return NULL;
> + goto out;
>
> for (; pos < ipc_mni; pos++) {
> ipc = idr_find(&ids->ipcs_idr, pos);
> if (ipc != NULL) {
> rcu_read_lock();
> ipc_lock_object(ipc);
> - return ipc;
> + break;
> }
> }
> -
> - /* Out of range - return NULL to terminate iteration */
> - return NULL;
> +out:
> + *new_pos = pos + 1;
> + return ipc;
> }
>
> static void *sysvipc_proc_next(struct seq_file *s, void *it, loff_t *pos)
Acked-by: Waiman Long <longman@redhat.com>
next prev parent reply other threads:[~2020-05-06 16:00 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 [this message]
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
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=8e04d756-29f5-9aff-2f0b-61663ecff649@redhat.com \
--to=longman@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=schwab@suse.de \
--cc=vvs@virtuozzo.com \
/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