Commit 7bf570dc authored by David Howells's avatar David Howells Committed by Linus Torvalds

Security: Make secctx_to_secid() take const secdata

Make secctx_to_secid() take constant secdata.
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 7663c1e2
...@@ -1481,7 +1481,7 @@ struct security_operations { ...@@ -1481,7 +1481,7 @@ struct security_operations {
int (*getprocattr) (struct task_struct *p, char *name, char **value); int (*getprocattr) (struct task_struct *p, char *name, char **value);
int (*setprocattr) (struct task_struct *p, char *name, void *value, size_t size); int (*setprocattr) (struct task_struct *p, char *name, void *value, size_t size);
int (*secid_to_secctx) (u32 secid, char **secdata, u32 *seclen); int (*secid_to_secctx) (u32 secid, char **secdata, u32 *seclen);
int (*secctx_to_secid) (char *secdata, u32 seclen, u32 *secid); int (*secctx_to_secid) (const char *secdata, u32 seclen, u32 *secid);
void (*release_secctx) (char *secdata, u32 seclen); void (*release_secctx) (char *secdata, u32 seclen);
#ifdef CONFIG_SECURITY_NETWORK #ifdef CONFIG_SECURITY_NETWORK
...@@ -1730,7 +1730,7 @@ int security_setprocattr(struct task_struct *p, char *name, void *value, size_t ...@@ -1730,7 +1730,7 @@ int security_setprocattr(struct task_struct *p, char *name, void *value, size_t
int security_netlink_send(struct sock *sk, struct sk_buff *skb); int security_netlink_send(struct sock *sk, struct sk_buff *skb);
int security_netlink_recv(struct sk_buff *skb, int cap); int security_netlink_recv(struct sk_buff *skb, int cap);
int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen); int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen);
int security_secctx_to_secid(char *secdata, u32 seclen, u32 *secid); int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid);
void security_release_secctx(char *secdata, u32 seclen); void security_release_secctx(char *secdata, u32 seclen);
#else /* CONFIG_SECURITY */ #else /* CONFIG_SECURITY */
...@@ -2449,7 +2449,7 @@ static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *secle ...@@ -2449,7 +2449,7 @@ static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *secle
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
static inline int security_secctx_to_secid(char *secdata, static inline int security_secctx_to_secid(const char *secdata,
u32 seclen, u32 seclen,
u32 *secid) u32 *secid)
{ {
......
...@@ -968,7 +968,7 @@ static int dummy_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) ...@@ -968,7 +968,7 @@ static int dummy_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
static int dummy_secctx_to_secid(char *secdata, u32 seclen, u32 *secid) static int dummy_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid)
{ {
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
......
...@@ -886,7 +886,7 @@ int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) ...@@ -886,7 +886,7 @@ int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
} }
EXPORT_SYMBOL(security_secid_to_secctx); EXPORT_SYMBOL(security_secid_to_secctx);
int security_secctx_to_secid(char *secdata, u32 seclen, u32 *secid) int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid)
{ {
return security_ops->secctx_to_secid(secdata, seclen, secid); return security_ops->secctx_to_secid(secdata, seclen, secid);
} }
......
...@@ -5238,7 +5238,7 @@ static int selinux_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) ...@@ -5238,7 +5238,7 @@ static int selinux_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
return security_sid_to_context(secid, secdata, seclen); return security_sid_to_context(secid, secdata, seclen);
} }
static int selinux_secctx_to_secid(char *secdata, u32 seclen, u32 *secid) static int selinux_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid)
{ {
return security_context_to_sid(secdata, seclen, secid); return security_context_to_sid(secdata, seclen, secid);
} }
......
...@@ -96,7 +96,7 @@ int security_sid_to_context(u32 sid, char **scontext, ...@@ -96,7 +96,7 @@ int security_sid_to_context(u32 sid, char **scontext,
int security_context_to_sid(const char *scontext, u32 scontext_len, int security_context_to_sid(const char *scontext, u32 scontext_len,
u32 *out_sid); u32 *out_sid);
int security_context_to_sid_default(char *scontext, u32 scontext_len, int security_context_to_sid_default(const char *scontext, u32 scontext_len,
u32 *out_sid, u32 def_sid, gfp_t gfp_flags); u32 *out_sid, u32 def_sid, gfp_t gfp_flags);
int security_get_user_sids(u32 callsid, char *username, int security_get_user_sids(u32 callsid, char *username,
......
...@@ -858,8 +858,8 @@ int security_context_to_sid(const char *scontext, u32 scontext_len, u32 *sid) ...@@ -858,8 +858,8 @@ int security_context_to_sid(const char *scontext, u32 scontext_len, u32 *sid)
* Returns -%EINVAL if the context is invalid, -%ENOMEM if insufficient * Returns -%EINVAL if the context is invalid, -%ENOMEM if insufficient
* memory is available, or 0 on success. * memory is available, or 0 on success.
*/ */
int security_context_to_sid_default(char *scontext, u32 scontext_len, u32 *sid, int security_context_to_sid_default(const char *scontext, u32 scontext_len,
u32 def_sid, gfp_t gfp_flags) u32 *sid, u32 def_sid, gfp_t gfp_flags)
{ {
return security_context_to_sid_core(scontext, scontext_len, return security_context_to_sid_core(scontext, scontext_len,
sid, def_sid, gfp_flags); sid, def_sid, gfp_flags);
......
...@@ -2406,7 +2406,7 @@ static int smack_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) ...@@ -2406,7 +2406,7 @@ static int smack_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
* *
* Exists for audit and networking code. * Exists for audit and networking code.
*/ */
static int smack_secctx_to_secid(char *secdata, u32 seclen, u32 *secid) static int smack_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid)
{ {
*secid = smack_to_secid(secdata); *secid = smack_to_secid(secdata);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment