linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fuse: Avoid potential use after free
@ 2021-04-06 23:53 Aditya Pakki
  2021-04-07 15:50 ` Vivek Goyal
  2021-04-22  0:44 ` Al Viro
  0 siblings, 2 replies; 4+ messages in thread
From: Aditya Pakki @ 2021-04-06 23:53 UTC (permalink / raw)
  To: pakki001
  Cc: Vivek Goyal, Stefan Hajnoczi, Miklos Szeredi, virtualization,
	linux-fsdevel, linux-kernel

In virtio_fs_get_tree, after fm is freed, it is again freed in case
s_root is NULL and virtio_fs_fill_super() returns an error. To avoid
a double free, set fm to NULL.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
 fs/fuse/virtio_fs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c
index 4ee6f734ba83..a7484c1539bf 100644
--- a/fs/fuse/virtio_fs.c
+++ b/fs/fuse/virtio_fs.c
@@ -1447,6 +1447,7 @@ static int virtio_fs_get_tree(struct fs_context *fsc)
 	if (fsc->s_fs_info) {
 		fuse_conn_put(fc);
 		kfree(fm);
+		fm = NULL;
 	}
 	if (IS_ERR(sb))
 		return PTR_ERR(sb);
-- 
2.25.1


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

end of thread, other threads:[~2021-04-22  0:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-06 23:53 [PATCH] fuse: Avoid potential use after free Aditya Pakki
2021-04-07 15:50 ` Vivek Goyal
2021-04-21 13:28   ` Krzysztof Kozlowski
2021-04-22  0:44 ` Al Viro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).