hfsplus: fix bug causing custom uid and gid being unable to be assigned with mount
commit 9f2b5debc0
upstream.
Despite specifying UID and GID in mount command, the specified UID and GID
were not being assigned. This patch fixes this issue.
Link: https://lkml.kernel.org/r/C0264BF5-059C-45CF-B8DA-3A3BD2C803A2@live.com
Signed-off-by: Aditya Garg <gargaditya08@live.com>
Reviewed-by: Viacheslav Dubeyko <slava@dubeyko.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Родитель
76d52b5412
Коммит
ed9947277b
|
@ -198,6 +198,8 @@ struct hfsplus_sb_info {
|
|||
#define HFSPLUS_SB_HFSX 3
|
||||
#define HFSPLUS_SB_CASEFOLD 4
|
||||
#define HFSPLUS_SB_NOBARRIER 5
|
||||
#define HFSPLUS_SB_UID 6
|
||||
#define HFSPLUS_SB_GID 7
|
||||
|
||||
static inline struct hfsplus_sb_info *HFSPLUS_SB(struct super_block *sb)
|
||||
{
|
||||
|
|
|
@ -190,11 +190,11 @@ static void hfsplus_get_perms(struct inode *inode,
|
|||
mode = be16_to_cpu(perms->mode);
|
||||
|
||||
i_uid_write(inode, be32_to_cpu(perms->owner));
|
||||
if (!i_uid_read(inode) && !mode)
|
||||
if ((test_bit(HFSPLUS_SB_UID, &sbi->flags)) || (!i_uid_read(inode) && !mode))
|
||||
inode->i_uid = sbi->uid;
|
||||
|
||||
i_gid_write(inode, be32_to_cpu(perms->group));
|
||||
if (!i_gid_read(inode) && !mode)
|
||||
if ((test_bit(HFSPLUS_SB_GID, &sbi->flags)) || (!i_gid_read(inode) && !mode))
|
||||
inode->i_gid = sbi->gid;
|
||||
|
||||
if (dir) {
|
||||
|
|
|
@ -140,6 +140,8 @@ int hfsplus_parse_options(char *input, struct hfsplus_sb_info *sbi)
|
|||
if (!uid_valid(sbi->uid)) {
|
||||
pr_err("invalid uid specified\n");
|
||||
return 0;
|
||||
} else {
|
||||
set_bit(HFSPLUS_SB_UID, &sbi->flags);
|
||||
}
|
||||
break;
|
||||
case opt_gid:
|
||||
|
@ -151,6 +153,8 @@ int hfsplus_parse_options(char *input, struct hfsplus_sb_info *sbi)
|
|||
if (!gid_valid(sbi->gid)) {
|
||||
pr_err("invalid gid specified\n");
|
||||
return 0;
|
||||
} else {
|
||||
set_bit(HFSPLUS_SB_GID, &sbi->flags);
|
||||
}
|
||||
break;
|
||||
case opt_part:
|
||||
|
|
Загрузка…
Ссылка в новой задаче