Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
1ec95bf3
Commit
1ec95bf3
authored
Jul 23, 2011
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
9p: close ACL leaks
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
c0d960f0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
15 deletions
+22
-15
fs/9p/acl.c
fs/9p/acl.c
+13
-9
fs/9p/acl.h
fs/9p/acl.h
+3
-3
fs/9p/vfs_inode_dotl.c
fs/9p/vfs_inode_dotl.c
+6
-3
No files found.
fs/9p/acl.c
View file @
1ec95bf3
...
@@ -185,12 +185,15 @@ int v9fs_acl_chmod(struct dentry *dentry)
...
@@ -185,12 +185,15 @@ int v9fs_acl_chmod(struct dentry *dentry)
}
}
int
v9fs_set_create_acl
(
struct
dentry
*
dentry
,
int
v9fs_set_create_acl
(
struct
dentry
*
dentry
,
struct
posix_acl
*
dpacl
,
struct
posix_acl
*
pacl
)
struct
posix_acl
*
*
dpacl
,
struct
posix_acl
*
*
pacl
)
{
{
v9fs_set_acl
(
dentry
,
ACL_TYPE_DEFAULT
,
dpacl
);
if
(
dentry
)
{
v9fs_set_acl
(
dentry
,
ACL_TYPE_ACCESS
,
pacl
);
v9fs_set_acl
(
dentry
,
ACL_TYPE_DEFAULT
,
*
dpacl
);
posix_acl_release
(
dpacl
);
v9fs_set_acl
(
dentry
,
ACL_TYPE_ACCESS
,
*
pacl
);
posix_acl_release
(
pacl
);
}
posix_acl_release
(
*
dpacl
);
posix_acl_release
(
*
pacl
);
*
dpacl
=
*
pacl
=
NULL
;
return
0
;
return
0
;
}
}
...
@@ -212,11 +215,11 @@ int v9fs_acl_mode(struct inode *dir, mode_t *modep,
...
@@ -212,11 +215,11 @@ int v9fs_acl_mode(struct inode *dir, mode_t *modep,
struct
posix_acl
*
clone
;
struct
posix_acl
*
clone
;
if
(
S_ISDIR
(
mode
))
if
(
S_ISDIR
(
mode
))
*
dpacl
=
acl
;
*
dpacl
=
posix_acl_dup
(
acl
)
;
clone
=
posix_acl_clone
(
acl
,
GFP_NOFS
);
clone
=
posix_acl_clone
(
acl
,
GFP_NOFS
);
retval
=
-
ENOMEM
;
posix_acl_release
(
acl
)
;
if
(
!
clone
)
if
(
!
clone
)
goto
cleanup
;
return
-
ENOMEM
;
retval
=
posix_acl_create_masq
(
clone
,
&
mode
);
retval
=
posix_acl_create_masq
(
clone
,
&
mode
);
if
(
retval
<
0
)
{
if
(
retval
<
0
)
{
...
@@ -225,11 +228,12 @@ int v9fs_acl_mode(struct inode *dir, mode_t *modep,
...
@@ -225,11 +228,12 @@ int v9fs_acl_mode(struct inode *dir, mode_t *modep,
}
}
if
(
retval
>
0
)
if
(
retval
>
0
)
*
pacl
=
clone
;
*
pacl
=
clone
;
else
posix_acl_release
(
clone
);
}
}
*
modep
=
mode
;
*
modep
=
mode
;
return
0
;
return
0
;
cleanup:
cleanup:
posix_acl_release
(
acl
);
return
retval
;
return
retval
;
}
}
...
...
fs/9p/acl.h
View file @
1ec95bf3
...
@@ -19,7 +19,7 @@ extern int v9fs_get_acl(struct inode *, struct p9_fid *);
...
@@ -19,7 +19,7 @@ extern int v9fs_get_acl(struct inode *, struct p9_fid *);
extern
int
v9fs_check_acl
(
struct
inode
*
inode
,
int
mask
);
extern
int
v9fs_check_acl
(
struct
inode
*
inode
,
int
mask
);
extern
int
v9fs_acl_chmod
(
struct
dentry
*
);
extern
int
v9fs_acl_chmod
(
struct
dentry
*
);
extern
int
v9fs_set_create_acl
(
struct
dentry
*
,
extern
int
v9fs_set_create_acl
(
struct
dentry
*
,
struct
posix_acl
*
,
struct
posix_acl
*
);
struct
posix_acl
*
*
,
struct
posix_acl
*
*
);
extern
int
v9fs_acl_mode
(
struct
inode
*
dir
,
mode_t
*
modep
,
extern
int
v9fs_acl_mode
(
struct
inode
*
dir
,
mode_t
*
modep
,
struct
posix_acl
**
dpacl
,
struct
posix_acl
**
pacl
);
struct
posix_acl
**
dpacl
,
struct
posix_acl
**
pacl
);
#else
#else
...
@@ -33,8 +33,8 @@ static inline int v9fs_acl_chmod(struct dentry *dentry)
...
@@ -33,8 +33,8 @@ static inline int v9fs_acl_chmod(struct dentry *dentry)
return
0
;
return
0
;
}
}
static
inline
int
v9fs_set_create_acl
(
struct
dentry
*
dentry
,
static
inline
int
v9fs_set_create_acl
(
struct
dentry
*
dentry
,
struct
posix_acl
*
dpacl
,
struct
posix_acl
*
*
dpacl
,
struct
posix_acl
*
pacl
)
struct
posix_acl
*
*
pacl
)
{
{
return
0
;
return
0
;
}
}
...
...
fs/9p/vfs_inode_dotl.c
View file @
1ec95bf3
...
@@ -242,7 +242,7 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
...
@@ -242,7 +242,7 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
goto
error
;
goto
error
;
/* Now set the ACL based on the default value */
/* Now set the ACL based on the default value */
v9fs_set_create_acl
(
dentry
,
dacl
,
pacl
);
v9fs_set_create_acl
(
dentry
,
&
dacl
,
&
pacl
);
v9inode
=
V9FS_I
(
inode
);
v9inode
=
V9FS_I
(
inode
);
mutex_lock
(
&
v9inode
->
v_mutex
);
mutex_lock
(
&
v9inode
->
v_mutex
);
...
@@ -283,6 +283,7 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
...
@@ -283,6 +283,7 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
err_clunk_old_fid:
err_clunk_old_fid:
if
(
ofid
)
if
(
ofid
)
p9_client_clunk
(
ofid
);
p9_client_clunk
(
ofid
);
v9fs_set_create_acl
(
NULL
,
&
dacl
,
&
pacl
);
return
err
;
return
err
;
}
}
...
@@ -376,12 +377,13 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir,
...
@@ -376,12 +377,13 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir,
d_instantiate
(
dentry
,
inode
);
d_instantiate
(
dentry
,
inode
);
}
}
/* Now set the ACL based on the default value */
/* Now set the ACL based on the default value */
v9fs_set_create_acl
(
dentry
,
dacl
,
pacl
);
v9fs_set_create_acl
(
dentry
,
&
dacl
,
&
pacl
);
inc_nlink
(
dir
);
inc_nlink
(
dir
);
v9fs_invalidate_inode_attr
(
dir
);
v9fs_invalidate_inode_attr
(
dir
);
error:
error:
if
(
fid
)
if
(
fid
)
p9_client_clunk
(
fid
);
p9_client_clunk
(
fid
);
v9fs_set_create_acl
(
NULL
,
&
dacl
,
&
pacl
);
return
err
;
return
err
;
}
}
...
@@ -781,10 +783,11 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode,
...
@@ -781,10 +783,11 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode,
d_instantiate
(
dentry
,
inode
);
d_instantiate
(
dentry
,
inode
);
}
}
/* Now set the ACL based on the default value */
/* Now set the ACL based on the default value */
v9fs_set_create_acl
(
dentry
,
dacl
,
pacl
);
v9fs_set_create_acl
(
dentry
,
&
dacl
,
&
pacl
);
error:
error:
if
(
fid
)
if
(
fid
)
p9_client_clunk
(
fid
);
p9_client_clunk
(
fid
);
v9fs_set_create_acl
(
NULL
,
&
dacl
,
&
pacl
);
return
err
;
return
err
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment