diff mbox series

[4/4] btrfs: drop path before copying subvol info to userspace

Message ID 55751bdd305f45c046c9fd1d11a29565bbdbb790.1668056532.git.anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show
Series btrfs: drop path before copying to userspace | expand

Commit Message

Anand Jain Nov. 10, 2022, 6:06 a.m. UTC
btrfs_ioctl_get_subvol_info() frees the search path after the userspace
copy from the temp buffer %subvol_info. This can lead to a lock splat
warning.

Fix this by freeing the path before we copy it to userspace.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 fs/btrfs/ioctl.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index ec310868591c..18be82a4d01b 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -2214,6 +2214,8 @@  static int btrfs_ioctl_get_subvol_info(struct inode *inode, void __user *argp)
 		}
 	}
 
+	btrfs_free_path(path);
+	path = NULL;
 	if (copy_to_user(argp, subvol_info, sizeof(*subvol_info)))
 		ret = -EFAULT;