* [PATCH 1/1] NET: llc, zero sockaddr_llc struct
@ 2009-08-22 18:58 Jiri Slaby
2009-08-24 1:56 ` David Miller
0 siblings, 1 reply; 5+ messages in thread
From: Jiri Slaby @ 2009-08-22 18:58 UTC (permalink / raw)
To: davem; +Cc: netdev, linux-kernel, Jiri Slaby, Arnaldo Carvalho de Melo
sllc_arphrd member of sockaddr_llc might not be set. Zero sllc
before copying it to the above layers.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
---
net/llc/af_llc.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c
index 9208cf5..22629fc 100644
--- a/net/llc/af_llc.c
+++ b/net/llc/af_llc.c
@@ -909,7 +909,7 @@ release:
static int llc_ui_getname(struct socket *sock, struct sockaddr *uaddr,
int *uaddrlen, int peer)
{
- struct sockaddr_llc sllc;
+ struct sockaddr_llc sllc = {};
struct sock *sk = sock->sk;
struct llc_sock *llc = llc_sk(sk);
int rc = 0;
--
1.6.3.3
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 1/1] NET: llc, zero sockaddr_llc struct
2009-08-22 18:58 [PATCH 1/1] NET: llc, zero sockaddr_llc struct Jiri Slaby
@ 2009-08-24 1:56 ` David Miller
2009-08-24 2:20 ` Arnaldo Carvalho de Melo
2009-08-24 5:43 ` [PATCH v2 " Jiri Slaby
0 siblings, 2 replies; 5+ messages in thread
From: David Miller @ 2009-08-24 1:56 UTC (permalink / raw)
To: jirislaby; +Cc: netdev, linux-kernel, acme
From: Jiri Slaby <jirislaby@gmail.com>
Date: Sat, 22 Aug 2009 20:58:55 +0200
> sllc_arphrd member of sockaddr_llc might not be set. Zero sllc
> before copying it to the above layers.
>
> Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
> Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
I know it seems arbitrary, but could you please memset() on the
structure instead of using an empty initializer so that it's
consistent with how all other ->getname() implementations deal with
this issue?
It's easier to audit that way.
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] NET: llc, zero sockaddr_llc struct
2009-08-24 1:56 ` David Miller
@ 2009-08-24 2:20 ` Arnaldo Carvalho de Melo
2009-08-24 5:43 ` [PATCH v2 " Jiri Slaby
1 sibling, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2009-08-24 2:20 UTC (permalink / raw)
To: David Miller; +Cc: jirislaby, netdev, linux-kernel
Em Sun, Aug 23, 2009 at 06:56:17PM -0700, David Miller escreveu:
> From: Jiri Slaby <jirislaby@gmail.com>
> Date: Sat, 22 Aug 2009 20:58:55 +0200
>
> > sllc_arphrd member of sockaddr_llc might not be set. Zero sllc
> > before copying it to the above layers.
> >
> > Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
> > Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
>
> I know it seems arbitrary, but could you please memset() on the
> structure instead of using an empty initializer so that it's
> consistent with how all other ->getname() implementations deal with
> this issue?
>
> It's easier to audit that way.
Or just set the uninitialized field to zero. But yeah, if what other
implementations are doing is to memset it to zero... maybe its more
clear from a quick glance :-)
- Arnaldo
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/1] NET: llc, zero sockaddr_llc struct
2009-08-24 1:56 ` David Miller
2009-08-24 2:20 ` Arnaldo Carvalho de Melo
@ 2009-08-24 5:43 ` Jiri Slaby
2009-08-24 5:55 ` David Miller
1 sibling, 1 reply; 5+ messages in thread
From: Jiri Slaby @ 2009-08-24 5:43 UTC (permalink / raw)
To: davem; +Cc: netdev, linux-kernel, Jiri Slaby, Arnaldo Carvalho de Melo
sllc_arphrd member of sockaddr_llc might not be changed. Zero sllc
before copying to the above layer's structure.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
---
net/llc/af_llc.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c
index 9208cf5..c45eee1 100644
--- a/net/llc/af_llc.c
+++ b/net/llc/af_llc.c
@@ -914,6 +914,7 @@ static int llc_ui_getname(struct socket *sock, struct sockaddr *uaddr,
struct llc_sock *llc = llc_sk(sk);
int rc = 0;
+ memset(&sllc, 0, sizeof(sllc));
lock_sock(sk);
if (sock_flag(sk, SOCK_ZAPPED))
goto out;
--
1.6.3.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-08-24 5:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-22 18:58 [PATCH 1/1] NET: llc, zero sockaddr_llc struct Jiri Slaby
2009-08-24 1:56 ` David Miller
2009-08-24 2:20 ` Arnaldo Carvalho de Melo
2009-08-24 5:43 ` [PATCH v2 " Jiri Slaby
2009-08-24 5:55 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).