mount.cifs: take extra care that mountpoint isn't changed during mount
authorJeff Layton <jlayton@redhat.com>
Tue, 26 Jan 2010 13:15:41 +0000 (08:15 -0500)
committerJeff Layton <jlayton@redhat.com>
Tue, 26 Jan 2010 13:15:41 +0000 (08:15 -0500)
commit3ae5dac462c4ed0fb2cd94553583c56fce2f9d80
tree1e1c9478b2a38b761a95d1ccc2119cc7618ea159
parent7148eff0b7f3a58be2d2c47516a8b9e3bc3d3c64
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>
client/mount.cifs.c