]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
cifs: Fix check for regular file in couldbe_mf_symlink()
authorSachin Prabhu <sprabhu@redhat.com>
Fri, 31 Jan 2014 14:27:16 +0000 (14:27 +0000)
committerSteve French <smfrench@gmail.com>
Fri, 31 Jan 2014 15:06:43 +0000 (09:06 -0600)
MF Symlinks are regular files containing content in a specified format.

The function couldbe_mf_symlink() checks the mode for a set S_IFREG bit
as a test to confirm that it is a regular file. This bit is also set for
other filetypes and simply checking for this bit being set may return
false positives.

We ensure that we are actually checking for a regular file by using the
S_ISREG macro to test instead.

Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Reported-by: Neil Brown <neilb@suse.de>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Steve French <smfrench@gmail.com>
fs/cifs/link.c

index 52f41f9f7defc59b21da4a03fe789b9221c65e3b..264ece71bdb20673d331c9335350705505d6e3fd 100644 (file)
@@ -185,7 +185,7 @@ format_mf_symlink(u8 *buf, unsigned int buf_len, const char *link_str)
 bool
 couldbe_mf_symlink(const struct cifs_fattr *fattr)
 {
-       if (!(fattr->cf_mode & S_IFREG))
+       if (!S_ISREG(fattr->cf_mode))
                /* it's not a symlink */
                return false;