mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
cifs: Percolate error up to the caller during get/set acls [try #4]
Modify get/set_cifs_acl* calls to reutrn error code and percolate the error code up to the caller. Signed-off-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com> Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
This commit is contained in:
parent
a7851ce73b
commit
987b21d7d9
2 changed files with 27 additions and 19 deletions
|
@ -560,7 +560,7 @@ static struct cifs_ntsd *get_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb,
|
||||||
struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
|
struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
|
||||||
|
|
||||||
if (IS_ERR(tlink))
|
if (IS_ERR(tlink))
|
||||||
return NULL;
|
return ERR_CAST(tlink);
|
||||||
|
|
||||||
xid = GetXid();
|
xid = GetXid();
|
||||||
rc = CIFSSMBGetCIFSACL(xid, tlink_tcon(tlink), fid, &pntsd, pacllen);
|
rc = CIFSSMBGetCIFSACL(xid, tlink_tcon(tlink), fid, &pntsd, pacllen);
|
||||||
|
@ -568,7 +568,9 @@ static struct cifs_ntsd *get_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb,
|
||||||
|
|
||||||
cifs_put_tlink(tlink);
|
cifs_put_tlink(tlink);
|
||||||
|
|
||||||
cFYI(1, "GetCIFSACL rc = %d ACL len %d", rc, *pacllen);
|
cFYI(1, "%s: rc = %d ACL len %d", __func__, rc, *pacllen);
|
||||||
|
if (rc)
|
||||||
|
return ERR_PTR(rc);
|
||||||
return pntsd;
|
return pntsd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -583,7 +585,7 @@ static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb,
|
||||||
struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
|
struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
|
||||||
|
|
||||||
if (IS_ERR(tlink))
|
if (IS_ERR(tlink))
|
||||||
return NULL;
|
return ERR_CAST(tlink);
|
||||||
|
|
||||||
tcon = tlink_tcon(tlink);
|
tcon = tlink_tcon(tlink);
|
||||||
xid = GetXid();
|
xid = GetXid();
|
||||||
|
@ -591,18 +593,17 @@ static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb,
|
||||||
rc = CIFSSMBOpen(xid, tcon, path, FILE_OPEN, READ_CONTROL, 0,
|
rc = CIFSSMBOpen(xid, tcon, path, FILE_OPEN, READ_CONTROL, 0,
|
||||||
&fid, &oplock, NULL, cifs_sb->local_nls,
|
&fid, &oplock, NULL, cifs_sb->local_nls,
|
||||||
cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
|
cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
|
||||||
if (rc) {
|
if (!rc) {
|
||||||
cERROR(1, "Unable to open file to get ACL");
|
rc = CIFSSMBGetCIFSACL(xid, tcon, fid, &pntsd, pacllen);
|
||||||
goto out;
|
CIFSSMBClose(xid, tcon, fid);
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = CIFSSMBGetCIFSACL(xid, tcon, fid, &pntsd, pacllen);
|
|
||||||
cFYI(1, "GetCIFSACL rc = %d ACL len %d", rc, *pacllen);
|
|
||||||
|
|
||||||
CIFSSMBClose(xid, tcon, fid);
|
|
||||||
out:
|
|
||||||
cifs_put_tlink(tlink);
|
cifs_put_tlink(tlink);
|
||||||
FreeXid(xid);
|
FreeXid(xid);
|
||||||
|
|
||||||
|
cFYI(1, "%s: rc = %d ACL len %d", __func__, rc, *pacllen);
|
||||||
|
if (rc)
|
||||||
|
return ERR_PTR(rc);
|
||||||
return pntsd;
|
return pntsd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -695,7 +696,7 @@ static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Translate the CIFS ACL (simlar to NTFS ACL) for a file into mode bits */
|
/* Translate the CIFS ACL (simlar to NTFS ACL) for a file into mode bits */
|
||||||
void
|
int
|
||||||
cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr,
|
cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr,
|
||||||
struct inode *inode, const char *path, const __u16 *pfid)
|
struct inode *inode, const char *path, const __u16 *pfid)
|
||||||
{
|
{
|
||||||
|
@ -711,13 +712,17 @@ cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr,
|
||||||
pntsd = get_cifs_acl(cifs_sb, inode, path, &acllen);
|
pntsd = get_cifs_acl(cifs_sb, inode, path, &acllen);
|
||||||
|
|
||||||
/* if we can retrieve the ACL, now parse Access Control Entries, ACEs */
|
/* if we can retrieve the ACL, now parse Access Control Entries, ACEs */
|
||||||
if (pntsd)
|
if (IS_ERR(pntsd)) {
|
||||||
|
rc = PTR_ERR(pntsd);
|
||||||
|
cERROR(1, "%s: error %d getting sec desc", __func__, rc);
|
||||||
|
} else {
|
||||||
rc = parse_sec_desc(pntsd, acllen, fattr);
|
rc = parse_sec_desc(pntsd, acllen, fattr);
|
||||||
if (rc)
|
kfree(pntsd);
|
||||||
cFYI(1, "parse sec desc failed rc = %d", rc);
|
if (rc)
|
||||||
|
cERROR(1, "parse sec desc failed rc = %d", rc);
|
||||||
|
}
|
||||||
|
|
||||||
kfree(pntsd);
|
return rc;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert mode bits to an ACL so we can update the ACL on the server */
|
/* Convert mode bits to an ACL so we can update the ACL on the server */
|
||||||
|
@ -736,7 +741,10 @@ int mode_to_acl(struct inode *inode, const char *path, __u64 nmode)
|
||||||
/* Add three ACEs for owner, group, everyone getting rid of
|
/* Add three ACEs for owner, group, everyone getting rid of
|
||||||
other ACEs as chmod disables ACEs and set the security descriptor */
|
other ACEs as chmod disables ACEs and set the security descriptor */
|
||||||
|
|
||||||
if (pntsd) {
|
if (IS_ERR(pntsd)) {
|
||||||
|
rc = PTR_ERR(pntsd);
|
||||||
|
cERROR(1, "%s: error %d getting sec desc", __func__, rc);
|
||||||
|
} else {
|
||||||
/* allocate memory for the smb header,
|
/* allocate memory for the smb header,
|
||||||
set security descriptor request security descriptor
|
set security descriptor request security descriptor
|
||||||
parameters, and secuirty descriptor itself */
|
parameters, and secuirty descriptor itself */
|
||||||
|
|
|
@ -130,7 +130,7 @@ extern int cifs_get_file_info_unix(struct file *filp);
|
||||||
extern int cifs_get_inode_info_unix(struct inode **pinode,
|
extern int cifs_get_inode_info_unix(struct inode **pinode,
|
||||||
const unsigned char *search_path,
|
const unsigned char *search_path,
|
||||||
struct super_block *sb, int xid);
|
struct super_block *sb, int xid);
|
||||||
extern void cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb,
|
extern int cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb,
|
||||||
struct cifs_fattr *fattr, struct inode *inode,
|
struct cifs_fattr *fattr, struct inode *inode,
|
||||||
const char *path, const __u16 *pfid);
|
const char *path, const __u16 *pfid);
|
||||||
extern int mode_to_acl(struct inode *inode, const char *path, __u64);
|
extern int mode_to_acl(struct inode *inode, const char *path, __u64);
|
||||||
|
|
Loading…
Reference in a new issue