Skip to content

Commit

Permalink
vfs: don't copy things to user space holding the rcu readlock
Browse files Browse the repository at this point in the history
Oops.  That wasn't very smart.  We don't actually need the RCU lock any
more by the time we copy the cwd string to user space, but I had
stupidly surrounded the whole thing with it.

Introduced by commit 8b19e34 ("vfs: make getcwd() get the root and
pwd path under rcu")

Is-a-big-hairy-idiot: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Linus Torvalds committed Sep 12, 2013
1 parent 5223161 commit ff812d7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/dcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -3067,6 +3067,7 @@ SYSCALL_DEFINE2(getcwd, char __user *, buf, unsigned long, size)
prepend(&cwd, &buflen, "\0", 1);
error = prepend_path(&pwd, &root, &cwd, &buflen);
br_read_unlock(&vfsmount_lock);
rcu_read_unlock();

if (error < 0)
goto out;
Expand All @@ -3087,10 +3088,10 @@ SYSCALL_DEFINE2(getcwd, char __user *, buf, unsigned long, size)
}
} else {
br_read_unlock(&vfsmount_lock);
rcu_read_unlock();
}

out:
rcu_read_unlock();
free_page((unsigned long) page);
return error;
}
Expand Down

0 comments on commit ff812d7

Please sign in to comment.