All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ceph: fix use-after-free for fsc->mdsc
@ 2020-07-23  7:32 xiubli
  2020-07-23 10:41 ` Jeff Layton
  0 siblings, 1 reply; 2+ messages in thread
From: xiubli @ 2020-07-23  7:32 UTC (permalink / raw)
  To: jlayton; +Cc: idryomov, zyan, pdonnell, ceph-devel, Xiubo Li

From: Xiubo Li <xiubli@redhat.com>

If the ceph_mdsc_init() fails, it will free the mdsc already.

Reported-by: syzbot+b57f46d8d6ea51960b8c@syzkaller.appspotmail.com
URL: https://tracker.ceph.com/issues/46684
Signed-off-by: Xiubo Li <xiubli@redhat.com>
---
 fs/ceph/mds_client.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index af7221d1c610..590822fab767 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -4453,7 +4453,6 @@ int ceph_mdsc_init(struct ceph_fs_client *fsc)
 		goto err_mdsc;
 	}
 
-	fsc->mdsc = mdsc;
 	init_completion(&mdsc->safe_umount_waiters);
 	init_waitqueue_head(&mdsc->session_close_wq);
 	INIT_LIST_HEAD(&mdsc->waiting_for_map);
@@ -4508,6 +4507,8 @@ int ceph_mdsc_init(struct ceph_fs_client *fsc)
 
 	strscpy(mdsc->nodename, utsname()->nodename,
 		sizeof(mdsc->nodename));
+
+	fsc->mdsc = mdsc;
 	return 0;
 
 err_mdsmap:
-- 
2.18.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ceph: fix use-after-free for fsc->mdsc
  2020-07-23  7:32 [PATCH] ceph: fix use-after-free for fsc->mdsc xiubli
@ 2020-07-23 10:41 ` Jeff Layton
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Layton @ 2020-07-23 10:41 UTC (permalink / raw)
  To: xiubli; +Cc: idryomov, zyan, pdonnell, ceph-devel

On Thu, 2020-07-23 at 15:32 +0800, xiubli@redhat.com wrote:
> From: Xiubo Li <xiubli@redhat.com>
> 
> If the ceph_mdsc_init() fails, it will free the mdsc already.
> 
> Reported-by: syzbot+b57f46d8d6ea51960b8c@syzkaller.appspotmail.com
> URL: https://tracker.ceph.com/issues/46684
> Signed-off-by: Xiubo Li <xiubli@redhat.com>
> ---
>  fs/ceph/mds_client.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
> index af7221d1c610..590822fab767 100644
> --- a/fs/ceph/mds_client.c
> +++ b/fs/ceph/mds_client.c
> @@ -4453,7 +4453,6 @@ int ceph_mdsc_init(struct ceph_fs_client *fsc)
>  		goto err_mdsc;
>  	}
>  
> -	fsc->mdsc = mdsc;
>  	init_completion(&mdsc->safe_umount_waiters);
>  	init_waitqueue_head(&mdsc->session_close_wq);
>  	INIT_LIST_HEAD(&mdsc->waiting_for_map);
> @@ -4508,6 +4507,8 @@ int ceph_mdsc_init(struct ceph_fs_client *fsc)
>  
>  	strscpy(mdsc->nodename, utsname()->nodename,
>  		sizeof(mdsc->nodename));
> +
> +	fsc->mdsc = mdsc;
>  	return 0;
>  
>  err_mdsmap:

Looks good, merged into testing.

Thanks!
-- 
Jeff Layton <jlayton@kernel.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-23 10:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-23  7:32 [PATCH] ceph: fix use-after-free for fsc->mdsc xiubli
2020-07-23 10:41 ` Jeff Layton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.