mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-28 03:40:04 +00:00
Merge tag 'afs-fixes-20180529' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs
Pull AFS fixes from David Howells: - fix a BUG triggerable from faccessat() - fix the mounting of backup volumes * tag 'afs-fixes-20180529' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs: afs: Fix mounting of backup volumes afs: Fix directory permissions check
This commit is contained in:
commit
91fc957a61
2 changed files with 13 additions and 16 deletions
|
@ -372,18 +372,14 @@ int afs_permission(struct inode *inode, int mask)
|
||||||
mask, access, S_ISDIR(inode->i_mode) ? "dir" : "file");
|
mask, access, S_ISDIR(inode->i_mode) ? "dir" : "file");
|
||||||
|
|
||||||
if (S_ISDIR(inode->i_mode)) {
|
if (S_ISDIR(inode->i_mode)) {
|
||||||
if (mask & MAY_EXEC) {
|
if (mask & (MAY_EXEC | MAY_READ | MAY_CHDIR)) {
|
||||||
if (!(access & AFS_ACE_LOOKUP))
|
if (!(access & AFS_ACE_LOOKUP))
|
||||||
goto permission_denied;
|
goto permission_denied;
|
||||||
} else if (mask & MAY_READ) {
|
}
|
||||||
if (!(access & AFS_ACE_LOOKUP))
|
if (mask & MAY_WRITE) {
|
||||||
goto permission_denied;
|
|
||||||
} else if (mask & MAY_WRITE) {
|
|
||||||
if (!(access & (AFS_ACE_DELETE | /* rmdir, unlink, rename from */
|
if (!(access & (AFS_ACE_DELETE | /* rmdir, unlink, rename from */
|
||||||
AFS_ACE_INSERT))) /* create, mkdir, symlink, rename to */
|
AFS_ACE_INSERT))) /* create, mkdir, symlink, rename to */
|
||||||
goto permission_denied;
|
goto permission_denied;
|
||||||
} else {
|
|
||||||
BUG();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!(access & AFS_ACE_LOOKUP))
|
if (!(access & AFS_ACE_LOOKUP))
|
||||||
|
|
|
@ -23,7 +23,7 @@ static int afs_deliver_vl_get_entry_by_name_u(struct afs_call *call)
|
||||||
struct afs_uvldbentry__xdr *uvldb;
|
struct afs_uvldbentry__xdr *uvldb;
|
||||||
struct afs_vldb_entry *entry;
|
struct afs_vldb_entry *entry;
|
||||||
bool new_only = false;
|
bool new_only = false;
|
||||||
u32 tmp, nr_servers;
|
u32 tmp, nr_servers, vlflags;
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
|
||||||
_enter("");
|
_enter("");
|
||||||
|
@ -55,6 +55,7 @@ static int afs_deliver_vl_get_entry_by_name_u(struct afs_call *call)
|
||||||
new_only = true;
|
new_only = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vlflags = ntohl(uvldb->flags);
|
||||||
for (i = 0; i < nr_servers; i++) {
|
for (i = 0; i < nr_servers; i++) {
|
||||||
struct afs_uuid__xdr *xdr;
|
struct afs_uuid__xdr *xdr;
|
||||||
struct afs_uuid *uuid;
|
struct afs_uuid *uuid;
|
||||||
|
@ -64,12 +65,13 @@ static int afs_deliver_vl_get_entry_by_name_u(struct afs_call *call)
|
||||||
if (tmp & AFS_VLSF_DONTUSE ||
|
if (tmp & AFS_VLSF_DONTUSE ||
|
||||||
(new_only && !(tmp & AFS_VLSF_NEWREPSITE)))
|
(new_only && !(tmp & AFS_VLSF_NEWREPSITE)))
|
||||||
continue;
|
continue;
|
||||||
if (tmp & AFS_VLSF_RWVOL)
|
if (tmp & AFS_VLSF_RWVOL) {
|
||||||
entry->fs_mask[i] |= AFS_VOL_VTM_RW;
|
entry->fs_mask[i] |= AFS_VOL_VTM_RW;
|
||||||
|
if (vlflags & AFS_VLF_BACKEXISTS)
|
||||||
|
entry->fs_mask[i] |= AFS_VOL_VTM_BAK;
|
||||||
|
}
|
||||||
if (tmp & AFS_VLSF_ROVOL)
|
if (tmp & AFS_VLSF_ROVOL)
|
||||||
entry->fs_mask[i] |= AFS_VOL_VTM_RO;
|
entry->fs_mask[i] |= AFS_VOL_VTM_RO;
|
||||||
if (tmp & AFS_VLSF_BACKVOL)
|
|
||||||
entry->fs_mask[i] |= AFS_VOL_VTM_BAK;
|
|
||||||
if (!entry->fs_mask[i])
|
if (!entry->fs_mask[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -89,15 +91,14 @@ static int afs_deliver_vl_get_entry_by_name_u(struct afs_call *call)
|
||||||
for (i = 0; i < AFS_MAXTYPES; i++)
|
for (i = 0; i < AFS_MAXTYPES; i++)
|
||||||
entry->vid[i] = ntohl(uvldb->volumeId[i]);
|
entry->vid[i] = ntohl(uvldb->volumeId[i]);
|
||||||
|
|
||||||
tmp = ntohl(uvldb->flags);
|
if (vlflags & AFS_VLF_RWEXISTS)
|
||||||
if (tmp & AFS_VLF_RWEXISTS)
|
|
||||||
__set_bit(AFS_VLDB_HAS_RW, &entry->flags);
|
__set_bit(AFS_VLDB_HAS_RW, &entry->flags);
|
||||||
if (tmp & AFS_VLF_ROEXISTS)
|
if (vlflags & AFS_VLF_ROEXISTS)
|
||||||
__set_bit(AFS_VLDB_HAS_RO, &entry->flags);
|
__set_bit(AFS_VLDB_HAS_RO, &entry->flags);
|
||||||
if (tmp & AFS_VLF_BACKEXISTS)
|
if (vlflags & AFS_VLF_BACKEXISTS)
|
||||||
__set_bit(AFS_VLDB_HAS_BAK, &entry->flags);
|
__set_bit(AFS_VLDB_HAS_BAK, &entry->flags);
|
||||||
|
|
||||||
if (!(tmp & (AFS_VLF_RWEXISTS | AFS_VLF_ROEXISTS | AFS_VLF_BACKEXISTS))) {
|
if (!(vlflags & (AFS_VLF_RWEXISTS | AFS_VLF_ROEXISTS | AFS_VLF_BACKEXISTS))) {
|
||||||
entry->error = -ENOMEDIUM;
|
entry->error = -ENOMEDIUM;
|
||||||
__set_bit(AFS_VLDB_QUERY_ERROR, &entry->flags);
|
__set_bit(AFS_VLDB_QUERY_ERROR, &entry->flags);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue