Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1502331

Re: [PATCH] aio: fix a use after free (and fix freeze protection of aio writes)

From Jeff Moyer <jmoyer@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH] aio: fix a use after free (and fix freeze protection of aio writes)
Date 2016-10-17 20:30 +0200
Message-ID <stkPD-7cX-19@gated-at.bofh.it> (permalink)
References <ssMEh-1F5-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi, Christoph,

Christoph Hellwig <hch@lst.de> writes:

> diff --git a/fs/aio.c b/fs/aio.c
> index 1157e13..bf315cd 100644
> --- a/fs/aio.c
> +++ b/fs/aio.c
> @@ -1078,6 +1078,17 @@ static void aio_complete(struct kiocb *kiocb, long res, long res2)
>  	unsigned tail, pos, head;
>  	unsigned long	flags;
>  
> +	if (kiocb->ki_flags & IOCB_WRITE) {
> +		struct file *file = kiocb->ki_filp;
> +
> +		/*
> +		 * Tell lockdep we inherited freeze protection from submission
> +		 * thread.
> +		 */
> +		__sb_writers_acquired(file_inode(file)->i_sb, SB_FREEZE_WRITE);
> +		file_end_write(file);

This ends up being a call to __sb_end_write:

void __sb_end_write(struct super_block *sb, int level)
{
        percpu_up_read(sb->s_writers.rw_sem + level-1);
}

Nothing guarantees that submission and completion happen on the same
CPU.  Is this safe?

-Jeff

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] aio: fix a use after free (and fix freeze protection of aio writes) Christoph Hellwig <hch@lst.de> - 2016-10-16 08:00 +0200
  Re: [PATCH] aio: fix a use after free (and fix freeze protection of aio writes) Jeff Moyer <jmoyer@redhat.com> - 2016-10-17 20:30 +0200
    Re: [PATCH] aio: fix a use after free (and fix freeze protection         of aio writes) Christoph Hellwig <hch@lst.de> - 2016-10-17 21:00 +0200
      Re: [PATCH] aio: fix a use after free (and fix freeze protection of aio writes) Jeff Moyer <jmoyer@redhat.com> - 2016-10-17 21:50 +0200
        Re: [PATCH] aio: fix a use after free (and fix freeze protection of  aio writes) Peter Zijlstra <peterz@infradead.org> - 2016-10-17 22:00 +0200
          Re: [PATCH] aio: fix a use after free (and fix freeze protection         of aio writes) Christoph Hellwig <hch@lst.de> - 2016-10-17 22:10 +0200
          Re: [PATCH] aio: fix a use after free (and fix freeze protection of aio writes) Jeff Moyer <jmoyer@redhat.com> - 2016-10-17 22:10 +0200
      Re: [PATCH] aio: fix a use after free (and fix freeze protection of  aio writes) Peter Zijlstra <peterz@infradead.org> - 2016-10-17 22:00 +0200
  Re: [PATCH] aio: fix a use after free (and fix freeze protection of aio writes) Jeff Moyer <jmoyer@redhat.com> - 2016-10-17 22:10 +0200
  Re: [PATCH] aio: fix a use after free (and fix freeze protection         of aio writes) Christoph Hellwig <hch@lst.de> - 2016-10-24 08:40 +0200

csiph-web