From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Yan Zheng" Subject: [PATCH]AIO: fix cleanup in io_submit_one(...) Date: Sun, 7 Oct 2007 00:24:28 +0800 Message-ID: <3d0408630710060924l348462e4k67d462f5e85079a6@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit To: linux-fsdevel@vger.kernel.org, linux-kernel@zh-kernel.org, akpm@linux-foundation.org Return-path: Received: from fk-out-0910.google.com ([209.85.128.188]:23808 "EHLO fk-out-0910.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760125AbXJFQYa (ORCPT ); Sat, 6 Oct 2007 12:24:30 -0400 Received: by fk-out-0910.google.com with SMTP id z23so846225fkz for ; Sat, 06 Oct 2007 09:24:28 -0700 (PDT) Content-Disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org Hello, When IOCB_FLAG_RESFD flag is set and iocb->aio_resfd is incorrect, statement 'goto out_put_req' is executed. At label 'out_put_req', aio_put_req(..) is called, which requires 'req->ki_filp' set. Regards Signed-off-by: Yan Zheng ---- diff -ur linux-2.6.23-rc9/fs/aio.c linux/fs/aio.c --- linux-2.6.23-rc9/fs/aio.c 2007-07-09 07:32:17.000000000 +0800 +++ linux/fs/aio.c 2007-10-07 00:05:10.000000000 +0800 @@ -1562,6 +1562,7 @@ fput(file); return -EAGAIN; } + req->ki_filp = file; if (iocb->aio_flags & IOCB_FLAG_RESFD) { /* * If the IOCB_FLAG_RESFD flag of aio_flags is set, get an @@ -1576,7 +1577,6 @@ } } - req->ki_filp = file; ret = put_user(req->ki_key, &user_iocb->aio_key); if (unlikely(ret)) { dprintk("EFAULT: aio_key\n");