lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 21 Dec 2017 10:06:35 -0800
From:   Casey Schaufler <casey@...aufler-ca.com>
To:     Vasyl Gomonovych <gomonovych@...il.com>, james.l.morris@...cle.com,
        serge@...lyn.com, linux-security-module@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Smack: fix dereferenced before check

On 12/21/2017 7:57 AM, Vasyl Gomonovych wrote:
> This patch fixes the warning reported by smatch:
> security/smack/smack_lsm.c:2872 smack_socket_connect() warn:
> variable dereferenced before check 'sock->sk' (see line 2869)
>
> Signed-off-by: Vasyl Gomonovych <gomonovych@...il.com>

I will take this into the Smack tree. Thank you.

Acked-by: Casey Schaufler <casey@...aufler-ca.com>

> ---
>  security/smack/smack_lsm.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
> index 14cc7940b36d..30f2c3d1c11c 100644
> --- a/security/smack/smack_lsm.c
> +++ b/security/smack/smack_lsm.c
> @@ -2866,12 +2866,16 @@ static int smack_socket_connect(struct socket *sock, struct sockaddr *sap,
>  #endif
>  #ifdef SMACK_IPV6_SECMARK_LABELING
>  	struct smack_known *rsp;
> -	struct socket_smack *ssp = sock->sk->sk_security;
> +	struct socket_smack *ssp;
>  #endif
>  
>  	if (sock->sk == NULL)
>  		return 0;
>  
> +#ifdef SMACK_IPV6_SECMARK_LABELING
> +	ssp = sock->sk->sk_security;
> +#endif
> +
>  	switch (sock->sk->sk_family) {
>  	case PF_INET:
>  		if (addrlen < sizeof(struct sockaddr_in))

Powered by blists - more mailing lists