Skip to content

Commit

Permalink
cifs: Fix check for regular file in couldbe_mf_symlink()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Jeff Layton <[email protected]>
Reported-by: Neil Brown <[email protected]>
Reported-by: Dan Carpenter <[email protected]>
Signed-off-by: Steve French <[email protected]>
  • Loading branch information
spuiuk authored and smfrench committed Jan 31, 2014
1 parent 666753c commit a9a315d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/cifs/link.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit a9a315d

Please sign in to comment.