Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3520870ybi; Mon, 29 Jul 2019 08:00:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqwPgGly2dmShZRQgfiGTA9xVATELGOgDP5eeYf2fvgR1ytMTMYTYLIdWpLmys4/4dbsAtWb X-Received: by 2002:a17:90a:c68c:: with SMTP id n12mr112969700pjt.33.1564412432670; Mon, 29 Jul 2019 08:00:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564412432; cv=none; d=google.com; s=arc-20160816; b=ZjD7FjeVg+NmQtesZ268m9witPx9lSO7u0XAmnbHhtu9YqmN/914nr8kjNcrcaxF7z 0WT6GqVzaKiTL9EvTckyW+xYhf5Jmv9BkkCL5p+EHv+dHcID7Aa5R+9nNnc2MOVI1Tb2 bg+VP4ZmiS9ZEEfaA4th/4dTf+6UQxPXkWaku56e3WECNnjbAcS4UO2+M7QukkC+wpbu DxVusblrqR4G8vMRdTlWkc/QUOC7bTHAAWtsYJj4jsqHYAsNMTJAo2E+ue7WT1CQJ80z mY5EOgqvRzoWbS0ANKZLRQdfv7Uv1uSNznX6UhRDb8ukCRjTtOOpbQlgY2XiJWLGuj0D UfRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from; bh=1U/nT+YFdcBJulr5CP1AxcQbzF3CgXui7RdCCC4zGOk=; b=yUnEP0h7BUfGs5QYzaqEs5dfKFNy55RuU9IK80uJgl60VOIFqVTlANfJb202Bym1Lf QI6CWC6x36KDEsnRuKwDdBN9tw5jv5ZzkWNYATTQYb+vPFeO6Kjb9TT1mpAK/ibDgHPO We4UtwKzmXWwVNPDcN6BsY1RvgniwIyVziD9cp2dnsTWysOIeBk+VVgy5CuEZhZI7Raj 2CAlhbGhqK0bbsTx6oT0weSx9Smv+Bf7LTSGIrwxIdx7wzxjKEblerNx0bqW1xyDgi+r 1rDk8RrU6a3cH7Sb8Du5/ijHDrcsnbBCGwLxP2pw8Hc+Q14aTYJMAuDz5QNVuy0Fvw+S L24A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f1si27928669plf.410.2019.07.29.08.00.14; Mon, 29 Jul 2019 08:00:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387842AbfG2O5o (ORCPT + 99 others); Mon, 29 Jul 2019 10:57:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52696 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726281AbfG2O5o (ORCPT ); Mon, 29 Jul 2019 10:57:44 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 866603007C58; Mon, 29 Jul 2019 14:57:43 +0000 (UTC) Received: from segfault.boston.devel.redhat.com (segfault.boston.devel.redhat.com [10.19.60.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BD32C60C5F; Mon, 29 Jul 2019 14:57:42 +0000 (UTC) From: Jeff Moyer To: , "zhangyi \(F\)" Cc: , , , , Subject: Re: [PATCH] aio: add timeout validity check for io_[p]getevents References: <1564039289-7672-1-git-send-email-yi.zhang@huawei.com> X-PGP-KeyID: 1F78E1B4 X-PGP-CertKey: F6FE 280D 8293 F72C 65FD 5A58 1FF8 A7CA 1F78 E1B4 Date: Mon, 29 Jul 2019 10:57:41 -0400 In-Reply-To: (Jeff Moyer's message of "Thu, 25 Jul 2019 10:43:46 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Mon, 29 Jul 2019 14:57:43 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Al, can you take this through your tree? Thanks, Jeff Jeff Moyer writes: > "zhangyi (F)" writes: > >> io_[p]getevents syscall should return -EINVAL if if timeout is out of >> range, add this validity check. >> >> Signed-off-by: zhangyi (F) >> --- >> 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 > > 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: aart@kvack.org