提交 a9a315d4 编写于 作者: S Sachin Prabhu 提交者: Steve French

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: NSachin Prabhu <sprabhu@redhat.com>
Reviewed-by: NJeff Layton <jlayton@redhat.com>
Reported-by: NNeil Brown <neilb@suse.de>
Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NSteve French <smfrench@gmail.com>
上级 666753c3
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册