NET: llc, zero sockaddr_llc struct
Subsystems (3)
PATCH 1/1 NET: llc, zero sockaddr_llc struct
sllc_arphrd member of sockaddr_llc might not be set. Zero sllc before copying it to the above layers.
--- net/llc/af_llc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/llc/af_llc.c +1 -1
@@ -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 ;
Signature · 1 line
1.6.3.3
David Miller
maintainerFrom: Jiri Slaby <[email protected]>
Date: Sat, 22 Aug 2009 20:58:55 +0200
Quoted 5 lines
sllc_arphrdmember ofsockaddr_llcmight not be set. Zero sllc before copying it to the above layers.Signed-off-by Jiri Slaby <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>
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.
Em Sun, Aug 23, 2009 at 06:56:17PM -0700, David Miller escreveu:
Quoted 9 lines
From: Jiri Slaby <[email protected]>
Date: Sat, 22 Aug 2009 20:58:55 +0200Quoted 5 lines
sllc_arphrdmember ofsockaddr_llcmight not be set. Zero sllc before copying it to the above layers.Signed-off-by Jiri Slaby <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>
Quoted 6 lines
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
PATCH v2 1/1 NET: llc, zero sockaddr_llc struct
In reply to David Millersllc_arphrd member of sockaddr_llc might not be changed. Zero sllc before copying to the above layer's structure.
--- net/llc/af_llc.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
net/llc/af_llc.c +1 -0
@@ -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;
Signature · 1 line
1.6.3.3
From: Jiri Slaby <[email protected]>
Date: Mon, 24 Aug 2009 07:43:39 +0200
Quoted 4 lines
sllc_arphrdmember ofsockaddr_llcmight not be changed. Zero sllc before copying to the above layer's structure.Signed-off-by Jiri Slaby <[email protected]>
Applied, thanks Jiri.