some bug fixes for stable for cifs
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQGcBAABAgAGBQJZn2HQAAoJEIosvXAHck9RXMAL/iVeR4DjmXLwGQtOIQUzj0pv 0JRubkh8/ud5VvfznjDvy0bBl/jodCK6N2wU7iqBhJUYW5Tc/TLaRt6MZ2KT4pLo PrD64hdjEtxkU5si+LOVLU11KndEIIQUV5+Mh9Zqj51DTHsyXJHPi/98HjNJm5Gq pXfUk+4eq229Pqq1JuPtfPaNHH/fZCODLf82vDQZedlaZhzHgXtDg6iQM0SalNhg iQSAWvmFr5lHlMs5/QMkhurvSaS38GXd+npWUGlJmFymlQbpqzpPGdYMgjnzLxDC Jw/Uowzo136CWSkSQV2DudKveNfIrVDYGgb97NgtZxsXYlBuJu4rCJvpLOsm6zap ZRnSReRvEIr6/TvMJ2wnRioz0JkbpPz8gMg7EUzfaexZtuAHXx6bguf2RjrnLJiH jhV+U+1uwTOgJejbvju/KVV6AP9kECyE5tZjuDF8FenfWkboqAYNaxxWVAfZreF5 wMF0FeJWoGUxwYgRvd8neG1VWB5LQO8rNaQmYNBi7w== =MlGX -----END PGP SIGNATURE----- Merge tag 'cifs-fixes-for-4.13-rc6-and-stable' of git://git.samba.org/sfrench/cifs-2.6 Pull cifs fixes from Steve French: "Some bug fixes for stable for cifs" * tag 'cifs-fixes-for-4.13-rc6-and-stable' of git://git.samba.org/sfrench/cifs-2.6: cifs: return ENAMETOOLONG for overlong names in cifs_open()/cifs_lookup() cifs: Fix df output for users with quota limits
This commit is contained in:
commit
8c7932a32e
2 changed files with 14 additions and 8 deletions
|
@ -194,15 +194,20 @@ cifs_bp_rename_retry:
|
|||
}
|
||||
|
||||
/*
|
||||
* Don't allow path components longer than the server max.
|
||||
* Don't allow the separator character in a path component.
|
||||
* The VFS will not allow "/", but "\" is allowed by posix.
|
||||
*/
|
||||
static int
|
||||
check_name(struct dentry *direntry)
|
||||
check_name(struct dentry *direntry, struct cifs_tcon *tcon)
|
||||
{
|
||||
struct cifs_sb_info *cifs_sb = CIFS_SB(direntry->d_sb);
|
||||
int i;
|
||||
|
||||
if (unlikely(direntry->d_name.len >
|
||||
tcon->fsAttrInfo.MaxPathNameComponentLength))
|
||||
return -ENAMETOOLONG;
|
||||
|
||||
if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS)) {
|
||||
for (i = 0; i < direntry->d_name.len; i++) {
|
||||
if (direntry->d_name.name[i] == '\\') {
|
||||
|
@ -500,10 +505,6 @@ cifs_atomic_open(struct inode *inode, struct dentry *direntry,
|
|||
return finish_no_open(file, res);
|
||||
}
|
||||
|
||||
rc = check_name(direntry);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
xid = get_xid();
|
||||
|
||||
cifs_dbg(FYI, "parent inode = 0x%p name is: %pd and dentry = 0x%p\n",
|
||||
|
@ -516,6 +517,11 @@ cifs_atomic_open(struct inode *inode, struct dentry *direntry,
|
|||
}
|
||||
|
||||
tcon = tlink_tcon(tlink);
|
||||
|
||||
rc = check_name(direntry, tcon);
|
||||
if (rc)
|
||||
goto out_free_xid;
|
||||
|
||||
server = tcon->ses->server;
|
||||
|
||||
if (server->ops->new_lease_key)
|
||||
|
@ -776,7 +782,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
|
|||
}
|
||||
pTcon = tlink_tcon(tlink);
|
||||
|
||||
rc = check_name(direntry);
|
||||
rc = check_name(direntry, pTcon);
|
||||
if (rc)
|
||||
goto lookup_out;
|
||||
|
||||
|
|
|
@ -3219,8 +3219,8 @@ copy_fs_info_to_kstatfs(struct smb2_fs_full_size_info *pfs_inf,
|
|||
kst->f_bsize = le32_to_cpu(pfs_inf->BytesPerSector) *
|
||||
le32_to_cpu(pfs_inf->SectorsPerAllocationUnit);
|
||||
kst->f_blocks = le64_to_cpu(pfs_inf->TotalAllocationUnits);
|
||||
kst->f_bfree = le64_to_cpu(pfs_inf->ActualAvailableAllocationUnits);
|
||||
kst->f_bavail = le64_to_cpu(pfs_inf->CallerAvailableAllocationUnits);
|
||||
kst->f_bfree = kst->f_bavail =
|
||||
le64_to_cpu(pfs_inf->CallerAvailableAllocationUnits);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue