Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aaccb00d authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "fs: fix NULL dereference due to data race in prepend_path()"

parents 3f91d017 df33f711
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -102,6 +102,8 @@ static int prepend_path(const struct path *path,

		if (dentry == vfsmnt->mnt_root || IS_ROOT(dentry)) {
			struct mount *parent = READ_ONCE(mnt->mnt_parent);
			struct mnt_namespace *mnt_ns;

			/* Escaped? */
			if (dentry != vfsmnt->mnt_root) {
				bptr = *buffer;
@@ -116,7 +118,9 @@ static int prepend_path(const struct path *path,
				vfsmnt = &mnt->mnt;
				continue;
			}
			if (is_mounted(vfsmnt) && !is_anon_ns(mnt->mnt_ns))
			mnt_ns = READ_ONCE(mnt->mnt_ns);
			/* open-coded is_mounted() to use local mnt_ns */
			if (!IS_ERR_OR_NULL(mnt_ns) && !is_anon_ns(mnt_ns))
				error = 1;	// absolute root
			else
				error = 2;	// detached or not attached yet