Created attachment 92221 [details] dmesg w/ call trace Consider the following tree: /srv/symtest /srv/symtest/dir /srv/symtest/dir/subdir /srv/symtest/link -> dir this works: # mount.cifs //smbsrv/symtest/dir/subdir/ /mnt/ this causes oops: # mount.cifs //smbsrv/symtest/link/subdir/ /mnt/ This issue was introduced in commit fec11dd9a0109fe52fd631e5c510778d6cbff6cc.
Created attachment 92231 [details] patch -- ensure that cifs_get_root only traverses directories Thanks for the bug report. This patch fixes it for me, does it also fix it for you?
I should mention too that this fixes the oops, but will give you an ENOTDIR error when you try to traverse a symlink like this. I think that's probably the safest course of action here since chasing symlinks is pretty complex and is possibly racy.
The patch indeed fixes the BUG, but I'd argue that throwing an error is not a great solution considering the functionality was available before.
So out of curiousity... What if the symlink is an absolute one and points outside the share? For instance: /srv/symtest/link -> /root ...what happened at that point with the older kernels?
On older kernels, mounting anything below an absolute link pointing outside the share (whether the mounting user is allowed to read it or not) indeed gives ENOTDIR. But with /srv/symtest/abslink -> /srv/symtest/dir mounting //localhost/symtest/abslink/subdir works.
Created attachment 92241 [details] cifsFYI from working mount with old kernels (using a relative link)
Created attachment 92251 [details] cifsFYI from crashing mount with new kernels (using a relative link)
Posted the patch upstream since that should at least fix the oops. Feel free to weigh in with your use case that involves mounting through symlinks, and maybe someone will fix that case at some point.
A patch referencing this bug report has been merged in Linux v3.9-rc1: commit ce2ac52105aa663056dfc17966ebed1bf93e6e64 Author: Jeff Layton <jlayton@redhat.com> Date: Fri Feb 1 15:11:01 2013 -0500 cifs: ensure that cifs_get_root() only traverses directories