From: Linus Torvalds Date: Thu, 12 Sep 2013 18:57:01 +0000 (-0700) Subject: vfs: don't copy things to user space holding the rcu readlock X-Git-Tag: v3.12-rc1~31 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=ff812d724254b95df76b7775d1359d856927a840;p=~emulex%2Finfiniband.git vfs: don't copy things to user space holding the rcu readlock 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 8b19e34188a3 ("vfs: make getcwd() get the root and pwd path under rcu") Is-a-big-hairy-idiot: Linus Torvalds --- diff --git a/fs/dcache.c b/fs/dcache.c index 99d4d722620..29d58212aaf 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -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; @@ -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; }