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
af4a5372
Commit
af4a5372
authored
Dec 01, 2017
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move dentry_open() calls up into do_mq_open()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
eecec19d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
24 deletions
+20
-24
ipc/mqueue.c
ipc/mqueue.c
+20
-24
No files found.
ipc/mqueue.c
View file @
af4a5372
...
@@ -727,17 +727,16 @@ static int mq_attr_ok(struct ipc_namespace *ipc_ns, struct mq_attr *attr)
...
@@ -727,17 +727,16 @@ static int mq_attr_ok(struct ipc_namespace *ipc_ns, struct mq_attr *attr)
/*
/*
* Invoked when creating a new queue via sys_mq_open
* Invoked when creating a new queue via sys_mq_open
*/
*/
static
struct
file
*
do_create
(
struct
ipc_namespace
*
ipc_ns
,
struct
inode
*
dir
,
static
int
do_create
(
struct
ipc_namespace
*
ipc_ns
,
struct
inode
*
dir
,
struct
path
*
path
,
int
oflag
,
umode_t
mode
,
struct
path
*
path
,
int
oflag
,
umode_t
mode
,
struct
mq_attr
*
attr
)
struct
mq_attr
*
attr
)
{
{
const
struct
cred
*
cred
=
current_cred
();
int
ret
;
int
ret
;
if
(
attr
)
{
if
(
attr
)
{
ret
=
mq_attr_ok
(
ipc_ns
,
attr
);
ret
=
mq_attr_ok
(
ipc_ns
,
attr
);
if
(
ret
)
if
(
ret
)
return
ERR_PTR
(
ret
)
;
return
ret
;
}
else
{
}
else
{
struct
mq_attr
def_attr
;
struct
mq_attr
def_attr
;
...
@@ -747,28 +746,23 @@ static struct file *do_create(struct ipc_namespace *ipc_ns, struct inode *dir,
...
@@ -747,28 +746,23 @@ static struct file *do_create(struct ipc_namespace *ipc_ns, struct inode *dir,
ipc_ns
->
mq_msgsize_default
);
ipc_ns
->
mq_msgsize_default
);
ret
=
mq_attr_ok
(
ipc_ns
,
&
def_attr
);
ret
=
mq_attr_ok
(
ipc_ns
,
&
def_attr
);
if
(
ret
)
if
(
ret
)
return
ERR_PTR
(
ret
)
;
return
ret
;
}
}
ret
=
vfs_mkobj
(
path
->
dentry
,
mode
&
~
current_umask
(),
ret
urn
vfs_mkobj
(
path
->
dentry
,
mode
&
~
current_umask
(),
mqueue_create_attr
,
attr
);
mqueue_create_attr
,
attr
);
if
(
ret
)
return
ERR_PTR
(
ret
);
return
dentry_open
(
path
,
oflag
,
cred
);
}
}
/* Opens existing queue */
/* Opens existing queue */
static
struct
file
*
do_open
(
struct
path
*
path
,
int
oflag
)
static
int
do_open
(
struct
path
*
path
,
int
oflag
)
{
{
static
const
int
oflag2acc
[
O_ACCMODE
]
=
{
MAY_READ
,
MAY_WRITE
,
static
const
int
oflag2acc
[
O_ACCMODE
]
=
{
MAY_READ
,
MAY_WRITE
,
MAY_READ
|
MAY_WRITE
};
MAY_READ
|
MAY_WRITE
};
int
acc
;
int
acc
;
if
((
oflag
&
O_ACCMODE
)
==
(
O_RDWR
|
O_WRONLY
))
if
((
oflag
&
O_ACCMODE
)
==
(
O_RDWR
|
O_WRONLY
))
return
ERR_PTR
(
-
EINVAL
)
;
return
-
EINVAL
;
acc
=
oflag2acc
[
oflag
&
O_ACCMODE
];
acc
=
oflag2acc
[
oflag
&
O_ACCMODE
];
if
(
inode_permission
(
d_inode
(
path
->
dentry
),
acc
))
return
inode_permission
(
d_inode
(
path
->
dentry
),
acc
);
return
ERR_PTR
(
-
EACCES
);
return
dentry_open
(
path
,
oflag
,
current_cred
());
}
}
static
int
do_mq_open
(
const
char
__user
*
u_name
,
int
oflag
,
umode_t
mode
,
static
int
do_mq_open
(
const
char
__user
*
u_name
,
int
oflag
,
umode_t
mode
,
...
@@ -805,28 +799,30 @@ static int do_mq_open(const char __user *u_name, int oflag, umode_t mode,
...
@@ -805,28 +799,30 @@ static int do_mq_open(const char __user *u_name, int oflag, umode_t mode,
if
(
oflag
&
O_CREAT
)
{
if
(
oflag
&
O_CREAT
)
{
if
(
d_really_is_positive
(
path
.
dentry
))
{
/* entry already exists */
if
(
d_really_is_positive
(
path
.
dentry
))
{
/* entry already exists */
audit_inode
(
name
,
path
.
dentry
,
0
);
audit_inode
(
name
,
path
.
dentry
,
0
);
if
(
oflag
&
O_EXCL
)
{
if
(
oflag
&
O_EXCL
)
error
=
-
EEXIST
;
error
=
-
EEXIST
;
goto
out
;
else
}
error
=
do_open
(
&
path
,
oflag
);
filp
=
do_open
(
&
path
,
oflag
);
}
else
{
}
else
{
if
(
ro
)
{
if
(
ro
)
{
error
=
ro
;
error
=
ro
;
goto
out
;
}
else
{
audit_inode_parent_hidden
(
name
,
root
);
error
=
do_create
(
ipc_ns
,
d_inode
(
root
),
&
path
,
oflag
,
mode
,
attr
);
}
}
audit_inode_parent_hidden
(
name
,
root
);
filp
=
do_create
(
ipc_ns
,
d_inode
(
root
),
&
path
,
oflag
,
mode
,
attr
);
}
}
}
else
{
}
else
{
if
(
d_really_is_negative
(
path
.
dentry
))
{
if
(
d_really_is_negative
(
path
.
dentry
))
{
error
=
-
ENOENT
;
error
=
-
ENOENT
;
goto
out
;
}
else
{
audit_inode
(
name
,
path
.
dentry
,
0
);
error
=
do_open
(
&
path
,
oflag
);
}
}
audit_inode
(
name
,
path
.
dentry
,
0
);
filp
=
do_open
(
&
path
,
oflag
);
}
}
if
(
error
)
goto
out
;
filp
=
dentry_open
(
&
path
,
oflag
,
current_cred
());
if
(
!
IS_ERR
(
filp
))
if
(
!
IS_ERR
(
filp
))
fd_install
(
fd
,
filp
);
fd_install
(
fd
,
filp
);
...
...
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