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
Kirill Smelkov
linux
Commits
9a2d40c1
Commit
9a2d40c1
authored
Jan 16, 2017
by
John Johansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
apparmor: add strn version of aa_find_ns
Signed-off-by:
John Johansen
<
john.johansen@canonical.com
>
parent
1741e9eb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
6 deletions
+29
-6
security/apparmor/include/policy_ns.h
security/apparmor/include/policy_ns.h
+10
-3
security/apparmor/policy_ns.c
security/apparmor/policy_ns.c
+19
-3
No files found.
security/apparmor/include/policy_ns.h
View file @
9a2d40c1
...
...
@@ -82,6 +82,7 @@ void aa_free_root_ns(void);
void
aa_free_ns_kref
(
struct
kref
*
kref
);
struct
aa_ns
*
aa_find_ns
(
struct
aa_ns
*
root
,
const
char
*
name
);
struct
aa_ns
*
aa_findn_ns
(
struct
aa_ns
*
root
,
const
char
*
name
,
size_t
n
);
struct
aa_ns
*
aa_prepare_ns
(
const
char
*
name
);
void
__aa_remove_ns
(
struct
aa_ns
*
ns
);
...
...
@@ -119,18 +120,24 @@ static inline void aa_put_ns(struct aa_ns *ns)
}
/**
* __aa_find_ns - find a namespace on a list by @name
* __aa_find
n
_ns - find a namespace on a list by @name
* @head: list to search for namespace on (NOT NULL)
* @name: name of namespace to look for (NOT NULL)
*
*
@n: length of @name
* Returns: unrefcounted namespace
*
* Requires: rcu_read_lock be held
*/
static
inline
struct
aa_ns
*
__aa_findn_ns
(
struct
list_head
*
head
,
const
char
*
name
,
size_t
n
)
{
return
(
struct
aa_ns
*
)
__policy_strn_find
(
head
,
name
,
n
);
}
static
inline
struct
aa_ns
*
__aa_find_ns
(
struct
list_head
*
head
,
const
char
*
name
)
{
return
(
struct
aa_ns
*
)
__policy_find
(
head
,
name
);
return
__aa_findn_ns
(
head
,
name
,
strlen
(
name
)
);
}
#endif
/* AA_NAMESPACE_H */
security/apparmor/policy_ns.c
View file @
9a2d40c1
...
...
@@ -139,26 +139,42 @@ void aa_free_ns(struct aa_ns *ns)
}
/**
* aa_find_ns - look up a profile namespace on the namespace list
* aa_find
n
_ns - look up a profile namespace on the namespace list
* @root: namespace to search in (NOT NULL)
* @name: name of namespace to find (NOT NULL)
* @n: length of @name
*
* Returns: a refcounted namespace on the list, or NULL if no namespace
* called @name exists.
*
* refcount released by caller
*/
struct
aa_ns
*
aa_find
_ns
(
struct
aa_ns
*
root
,
const
char
*
name
)
struct
aa_ns
*
aa_find
n_ns
(
struct
aa_ns
*
root
,
const
char
*
name
,
size_t
n
)
{
struct
aa_ns
*
ns
=
NULL
;
rcu_read_lock
();
ns
=
aa_get_ns
(
__aa_find
_ns
(
&
root
->
sub_ns
,
name
));
ns
=
aa_get_ns
(
__aa_find
n_ns
(
&
root
->
sub_ns
,
name
,
n
));
rcu_read_unlock
();
return
ns
;
}
/**
* aa_find_ns - look up a profile namespace on the namespace list
* @root: namespace to search in (NOT NULL)
* @name: name of namespace to find (NOT NULL)
*
* Returns: a refcounted namespace on the list, or NULL if no namespace
* called @name exists.
*
* refcount released by caller
*/
struct
aa_ns
*
aa_find_ns
(
struct
aa_ns
*
root
,
const
char
*
name
)
{
return
aa_findn_ns
(
root
,
name
,
strlen
(
name
));
}
/**
* aa_prepare_ns - find an existing or create a new namespace of @name
* @name: the namespace to find or add (MAYBE NULL)
...
...
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