mount.cifs: take extra care that mountpoint isn't changed during mount
commita395811b01e1ee40198749e45eeaf56d0093a7b6
authorJeff Layton <jlayton@redhat.com>
Tue, 26 Jan 2010 13:35:35 +0000 (26 08:35 -0500)
committerKarolin Seeger <kseeger@samba.org>
Mon, 29 Mar 2010 07:40:59 +0000 (29 09:40 +0200)
tree39556bf29ac941378e9c1febce6bd754accd83db
parentfc8689cf9ec4588d57d734999d524f6725d34b1d
mount.cifs: take extra care that mountpoint isn't changed during mount

It's possible to trick mount.cifs into mounting onto the wrong directory
by replacing the mountpoint with a symlink to a directory. mount.cifs
attempts to check the validity of the mountpoint, but there's still a
possible race between those checks and the mount(2) syscall.

To guard against this, chdir to the mountpoint very early, and only deal
with it as "." from then on out.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
(cherry picked from commit a60afceaa71c0c9b53b2ec1014db5d09d777803d)
client/mount.cifs.c