linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Moyer <jmoyer@redhat.com>
To: <viro@zeniv.linux.org.uk>, "zhangyi \(F\)" <yi.zhang@huawei.com>
Cc: <linux-aio@kvack.org>, <linux-fsdevel@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <bcrl@kvack.org>,
	<wangkefeng.wang@huawei.com>
Subject: Re: [PATCH] aio: add timeout validity check for io_[p]getevents
Date: Mon, 29 Jul 2019 10:57:41 -0400	[thread overview]
Message-ID: <x49y30gnb16.fsf@segfault.boston.devel.redhat.com> (raw)
In-Reply-To: <x49imrqb2e5.fsf@segfault.boston.devel.redhat.com> (Jeff Moyer's message of "Thu, 25 Jul 2019 10:43:46 -0400")

Al, can you take this through your tree?

Thanks,
Jeff

Jeff Moyer <jmoyer@redhat.com> writes:

> "zhangyi (F)" <yi.zhang@huawei.com> writes:
>
>> io_[p]getevents syscall should return -EINVAL if if timeout is out of
>> range, add this validity check.
>>
>> Signed-off-by: zhangyi (F) <yi.zhang@huawei.com>
>> ---
>>  fs/aio.c | 11 +++++++++--
>>  1 file changed, 9 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/aio.c b/fs/aio.c
>> index 01e0fb9..dd967a0 100644
>> --- a/fs/aio.c
>> +++ b/fs/aio.c
>> @@ -2031,10 +2031,17 @@ static long do_io_getevents(aio_context_t ctx_id,
>>  		struct io_event __user *events,
>>  		struct timespec64 *ts)
>>  {
>> -	ktime_t until = ts ? timespec64_to_ktime(*ts) : KTIME_MAX;
>> -	struct kioctx *ioctx = lookup_ioctx(ctx_id);
>> +	ktime_t until = KTIME_MAX;
>> +	struct kioctx *ioctx = NULL;
>>  	long ret = -EINVAL;
>>  
>> +	if (ts) {
>> +		if (!timespec64_valid(ts))
>> +			return ret;
>> +		until = timespec64_to_ktime(*ts);
>> +	}
>> +
>> +	ioctx = lookup_ioctx(ctx_id);
>>  	if (likely(ioctx)) {
>>  		if (likely(min_nr <= nr && min_nr >= 0))
>>  			ret = read_events(ioctx, min_nr, nr, events, until);
>
> Reviewed-by: Jeff Moyer <jmoyer@redhat.com>
>
> The previous suggestion[1] of fixing the helpers never materialized, so
> let's just get this fixed, already.
>
> -Jeff
>
> [1] https://marc.info/?l=linux-fsdevel&m=152209450618587&w=2
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-aio' in
> the body to majordomo@kvack.org.  For more info on Linux AIO,
> see: http://www.kvack.org/aio/
> Don't email: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>

  reply	other threads:[~2019-07-29 14:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-25  7:21 [PATCH] aio: add timeout validity check for io_[p]getevents zhangyi (F)
2019-07-25 14:43 ` Jeff Moyer
2019-07-29 14:57   ` Jeff Moyer [this message]
2019-07-29 15:47     ` Al Viro
2019-07-29 15:59       ` Jeff Moyer
2019-07-30  1:28         ` zhangyi (F)
2020-03-09  1:39       ` zhangyi (F)

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=x49y30gnb16.fsf@segfault.boston.devel.redhat.com \
    --to=jmoyer@redhat.com \
    --cc=bcrl@kvack.org \
    --cc=linux-aio@kvack.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=wangkefeng.wang@huawei.com \
    --cc=yi.zhang@huawei.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;
as well as URLs for NNTP newsgroup(s).