* [PATCH] Smack: fix dereferenced before check
@ 2017-12-21 15:57 ` Vasyl Gomonovych
0 siblings, 0 replies; 6+ messages in thread
From: Vasyl Gomonovych @ 2017-12-21 15:57 UTC (permalink / raw)
To: casey, james.l.morris, serge, linux-security-module, gomonovych
Cc: linux-kernel
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>
---
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))
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] Smack: fix dereferenced before check
@ 2017-12-21 15:57 ` Vasyl Gomonovych
0 siblings, 0 replies; 6+ messages in thread
From: Vasyl Gomonovych @ 2017-12-21 15:57 UTC (permalink / raw)
To: linux-security-module
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>
---
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))
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info@ http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] Smack: fix dereferenced before check
2017-12-21 15:57 ` Vasyl Gomonovych
@ 2017-12-21 17:57 ` Serge E. Hallyn
-1 siblings, 0 replies; 6+ messages in thread
From: Serge E. Hallyn @ 2017-12-21 17:57 UTC (permalink / raw)
To: Vasyl Gomonovych
Cc: casey, james.l.morris, serge, linux-security-module, linux-kernel
Quoting Vasyl Gomonovych (gomonovych@gmail.com):
> 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>
Looks obviously correct - thanks.
Acked-by: Serge Hallyn <serge@hallyn.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))
> --
> 1.9.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] Smack: fix dereferenced before check
@ 2017-12-21 17:57 ` Serge E. Hallyn
0 siblings, 0 replies; 6+ messages in thread
From: Serge E. Hallyn @ 2017-12-21 17:57 UTC (permalink / raw)
To: linux-security-module
Quoting Vasyl Gomonovych (gomonovych at gmail.com):
> 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>
Looks obviously correct - thanks.
Acked-by: Serge Hallyn <serge@hallyn.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))
> --
> 1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Smack: fix dereferenced before check
2017-12-21 15:57 ` Vasyl Gomonovych
@ 2017-12-21 18:06 ` Casey Schaufler
-1 siblings, 0 replies; 6+ messages in thread
From: Casey Schaufler @ 2017-12-21 18:06 UTC (permalink / raw)
To: Vasyl Gomonovych, james.l.morris, serge, linux-security-module
Cc: linux-kernel
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))
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] Smack: fix dereferenced before check
@ 2017-12-21 18:06 ` Casey Schaufler
0 siblings, 0 replies; 6+ messages in thread
From: Casey Schaufler @ 2017-12-21 18:06 UTC (permalink / raw)
To: linux-security-module
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))
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info@ http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-12-21 18:06 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-21 15:57 [PATCH] Smack: fix dereferenced before check Vasyl Gomonovych
2017-12-21 15:57 ` Vasyl Gomonovych
2017-12-21 17:57 ` Serge E. Hallyn
2017-12-21 17:57 ` Serge E. Hallyn
2017-12-21 18:06 ` Casey Schaufler
2017-12-21 18:06 ` Casey Schaufler
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.