[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOhYWNLVMrG_ddvddrbjpAgYKuY+sPtdBk5ja6HFmW2qOeUENA@mail.gmail.com>
Date: Tue, 26 Mar 2019 06:41:25 -0400
From: Jeff Layton <jlayton@...chiereds.net>
To: Al Viro <viro@...iv.linux.org.uk>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
syzbot <syzbot+7a8ba368b47fdefca61e@...kaller.appspotmail.com>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
Linux List Kernel Mailing <linux-kernel@...r.kernel.org>,
syzkaller-bugs <syzkaller-bugs@...glegroups.com>
Subject: Re: ceph: fix use-after-free on symlink traversal
On Mon, Mar 25, 2019 at 9:39 PM Al Viro <viro@...iv.linux.org.uk> wrote:
>
> free the symlink body after the same RCU delay we have for freeing the
> struct inode itself, so that traversal during RCU pathwalk wouldn't step
> into freed memory.
>
> Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
> ---
> diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
> index e3346628efe2..2d61ddda9bf5 100644
> --- a/fs/ceph/inode.c
> +++ b/fs/ceph/inode.c
> @@ -524,6 +524,7 @@ static void ceph_i_callback(struct rcu_head *head)
> struct inode *inode = container_of(head, struct inode, i_rcu);
> struct ceph_inode_info *ci = ceph_inode(inode);
>
> + kfree(ci->i_symlink);
> kmem_cache_free(ceph_inode_cachep, ci);
> }
>
> @@ -566,7 +567,6 @@ void ceph_destroy_inode(struct inode *inode)
> }
> }
>
> - kfree(ci->i_symlink);
> while ((n = rb_first(&ci->i_fragtree)) != NULL) {
> frag = rb_entry(n, struct ceph_inode_frag, node);
> rb_erase(n, &ci->i_fragtree);
Reviewed-by: Jeff Layton <jlayton@...nel.org>
Powered by blists - more mailing lists