[PATCH v2 24/25] Fix slotted list and getpeersec_d

Kees Cook keescook at chromium.org
Wed Jun 19 05:50:38 UTC 2019


On Tue, Jun 18, 2019 at 04:05:50PM -0700, Casey Schaufler wrote:
> Signed-off-by: Casey Schaufler <casey at schaufler-ca.com>

Was this supposed to be folded into patch 4?

-Kees

> ---
>  security/security.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/security/security.c b/security/security.c
> index 5a23ccec7c7b..8aca43ab3e81 100644
> --- a/security/security.c
> +++ b/security/security.c
> @@ -461,6 +461,8 @@ int __init security_add_hooks(struct security_hook_list *hooks, int count,
>  		    hooks[i].head == &security_hook_heads.kernel_act_as ||
>  		    hooks[i].head ==
>  			&security_hook_heads.socket_getpeersec_dgram ||
> +		    hooks[i].head == &security_hook_heads.getprocattr ||
> +		    hooks[i].head == &security_hook_heads.setprocattr ||
>  		    hooks[i].head == &security_hook_heads.secctx_to_secid ||
>  		    hooks[i].head == &security_hook_heads.release_secctx ||
>  		    hooks[i].head == &security_hook_heads.ipc_getsecid ||
> @@ -2269,7 +2271,9 @@ int security_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb,
>  			     list) {
>  		rc = hp->hook.socket_getpeersec_dgram(sock, skb,
>  						      &l->secid[hp->slot]);
> -		if (rc != 0)
> +		if (rc == -ENOPROTOOPT)
> +			rc = 0;
> +		else if (rc != 0)
>  			break;
>  	}
>  	return rc;
> -- 
> 2.20.1
> 

-- 
Kees Cook



More information about the Linux-security-module-archive mailing list