diff options
author | Sachin Prabhu <sprabhu@redhat.com> | 2014-01-31 09:27:16 -0500 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2014-01-31 10:06:43 -0500 |
commit | a9a315d41407cd1079eb815f4adae897cc08b0d2 (patch) | |
tree | abd61b5ea4012204d5c973d5b261b2f004bbbfb5 | |
parent | 666753c3ef8fc88b0ddd5be4865d0aa66428ac35 (diff) |
cifs: Fix check for regular file in couldbe_mf_symlink()
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>
-rw-r--r-- | fs/cifs/link.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/cifs/link.c b/fs/cifs/link.c index 52f41f9f7def..264ece71bdb2 100644 --- a/fs/cifs/link.c +++ b/fs/cifs/link.c | |||
@@ -185,7 +185,7 @@ format_mf_symlink(u8 *buf, unsigned int buf_len, const char *link_str) | |||
185 | bool | 185 | bool |
186 | couldbe_mf_symlink(const struct cifs_fattr *fattr) | 186 | couldbe_mf_symlink(const struct cifs_fattr *fattr) |
187 | { | 187 | { |
188 | if (!(fattr->cf_mode & S_IFREG)) | 188 | if (!S_ISREG(fattr->cf_mode)) |
189 | /* it's not a symlink */ | 189 | /* it's not a symlink */ |
190 | return false; | 190 | return false; |
191 | 191 | ||