* [PATCH] aio: add timeout validity check for io_[p]getevents
@ 2019-07-25 7:21 zhangyi (F)
2019-07-25 14:43 ` Jeff Moyer
0 siblings, 1 reply; 7+ messages in thread
From: zhangyi (F) @ 2019-07-25 7:21 UTC (permalink / raw)
To: linux-aio, linux-fsdevel, linux-kernel
Cc: bcrl, viro, yi.zhang, wangkefeng.wang
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);
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] aio: add timeout validity check for io_[p]getevents
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
0 siblings, 1 reply; 7+ messages in thread
From: Jeff Moyer @ 2019-07-25 14:43 UTC (permalink / raw)
To: zhangyi (F)
Cc: linux-aio, linux-fsdevel, linux-kernel, bcrl, viro, wangkefeng.wang
"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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] aio: add timeout validity check for io_[p]getevents
2019-07-25 14:43 ` Jeff Moyer
@ 2019-07-29 14:57 ` Jeff Moyer
2019-07-29 15:47 ` Al Viro
0 siblings, 1 reply; 7+ messages in thread
From: Jeff Moyer @ 2019-07-29 14:57 UTC (permalink / raw)
To: viro, zhangyi (F)
Cc: linux-aio, linux-fsdevel, linux-kernel, bcrl, wangkefeng.wang
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>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] aio: add timeout validity check for io_[p]getevents
2019-07-29 14:57 ` Jeff Moyer
@ 2019-07-29 15:47 ` Al Viro
2019-07-29 15:59 ` Jeff Moyer
2020-03-09 1:39 ` zhangyi (F)
0 siblings, 2 replies; 7+ messages in thread
From: Al Viro @ 2019-07-29 15:47 UTC (permalink / raw)
To: Jeff Moyer
Cc: zhangyi (F),
linux-aio, linux-fsdevel, linux-kernel, bcrl, wangkefeng.wang
On Mon, Jul 29, 2019 at 10:57:41AM -0400, Jeff Moyer wrote:
> Al, can you take this through your tree?
Umm... Can do, but I had an impression that Arnd and Deepa
had a tree for timespec-related work. OTOH, it had been
relatively quiet last cycle, so... If they have nothing
in the area, I can take it through vfs.git.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] aio: add timeout validity check for io_[p]getevents
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)
1 sibling, 1 reply; 7+ messages in thread
From: Jeff Moyer @ 2019-07-29 15:59 UTC (permalink / raw)
To: Al Viro
Cc: zhangyi (F),
linux-aio, linux-fsdevel, linux-kernel, bcrl, wangkefeng.wang
Al Viro <viro@zeniv.linux.org.uk> writes:
> On Mon, Jul 29, 2019 at 10:57:41AM -0400, Jeff Moyer wrote:
>> Al, can you take this through your tree?
>
> Umm... Can do, but I had an impression that Arnd and Deepa
> had a tree for timespec-related work. OTOH, it had been
> relatively quiet last cycle, so... If they have nothing
> in the area, I can take it through vfs.git.
Hmm, okay. Yi, can you repost the patch, adding my Reviewed-by tag, and
CC-ing Arnd and Deepa:
Arnd Bergmann <arnd@arndb.de>
Deepa Dinamani <deepa.kernel@gmail.com>
Thanks!
Jeff
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] aio: add timeout validity check for io_[p]getevents
2019-07-29 15:59 ` Jeff Moyer
@ 2019-07-30 1:28 ` zhangyi (F)
0 siblings, 0 replies; 7+ messages in thread
From: zhangyi (F) @ 2019-07-30 1:28 UTC (permalink / raw)
To: Jeff Moyer, Al Viro
Cc: linux-aio, linux-fsdevel, linux-kernel, bcrl, wangkefeng.wang
On 2019/7/29 23:59, Jeff Moyer Wrote:
> Al Viro <viro@zeniv.linux.org.uk> writes:
>
>> On Mon, Jul 29, 2019 at 10:57:41AM -0400, Jeff Moyer wrote:
>>> Al, can you take this through your tree?
>>
>> Umm... Can do, but I had an impression that Arnd and Deepa
>> had a tree for timespec-related work. OTOH, it had been
>> relatively quiet last cycle, so... If they have nothing
>> in the area, I can take it through vfs.git.
>
> Hmm, okay. Yi, can you repost the patch, adding my Reviewed-by tag, and
> CC-ing Arnd and Deepa:
>
Yes, will do.
Thanks,
Yi.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] aio: add timeout validity check for io_[p]getevents
2019-07-29 15:47 ` Al Viro
2019-07-29 15:59 ` Jeff Moyer
@ 2020-03-09 1:39 ` zhangyi (F)
1 sibling, 0 replies; 7+ messages in thread
From: zhangyi (F) @ 2020-03-09 1:39 UTC (permalink / raw)
To: Al Viro
Cc: Jeff Moyer, linux-aio, linux-fsdevel, linux-kernel, bcrl,
wangkefeng.wang, yangerkun
Hi, Al, could you please consider applying this patch ?
Thanks,
Yi.
On 2019/7/29 23:47, Al Viro wrote:
> On Mon, Jul 29, 2019 at 10:57:41AM -0400, Jeff Moyer wrote:
>> Al, can you take this through your tree?
>
> Umm... Can do, but I had an impression that Arnd and Deepa
> had a tree for timespec-related work. OTOH, it had been
> relatively quiet last cycle, so... If they have nothing
> in the area, I can take it through vfs.git.
>
> .
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-03-09 1:39 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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)
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).