From: Casey Schaufler <casey@schaufler-ca.com>
To: Vasyl Gomonovych <gomonovych@gmail.com>,
james.l.morris@oracle.com, serge@hallyn.com,
linux-security-module@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Smack: fix dereferenced before check
Date: Thu, 21 Dec 2017 10:06:35 -0800 [thread overview]
Message-ID: <4da2b0f6-a2d9-ead0-d573-a75bc78938a7@schaufler-ca.com> (raw)
In-Reply-To: <1513871872-18759-1-git-send-email-gomonovych@gmail.com>
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@gmail.com>
I will take this into the Smack tree. Thank you.
Acked-by: Casey Schaufler <casey@schaufler-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))
prev parent reply other threads:[~2017-12-21 18:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-21 15:57 Vasyl Gomonovych
2017-12-21 17:57 ` Serge E. Hallyn
2017-12-21 18:06 ` Casey Schaufler [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4da2b0f6-a2d9-ead0-d573-a75bc78938a7@schaufler-ca.com \
--to=casey@schaufler-ca.com \
--cc=gomonovych@gmail.com \
--cc=james.l.morris@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=serge@hallyn.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®