All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: netlink_getname, packet_getname -- use DECLARE_SOCKADDR guard
@ 2009-11-08 15:51 Cyrill Gorcunov
  2009-11-11  6:31 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Cyrill Gorcunov @ 2009-11-08 15:51 UTC (permalink / raw)
  To: LNML; +Cc: David Miller, Eric Dumazet

Use guard DECLARE_SOCKADDR in a few more places which allow
us to catch if the structure copied back is too big.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---

Please review, comments are welcome!

 net/netlink/af_netlink.c |    2 +-
 net/packet/af_packet.c   |    2 +-
 net/unix/af_unix.c       |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

Index: linux-2.6.git/net/netlink/af_netlink.c
=====================================================================
--- linux-2.6.git.orig/net/netlink/af_netlink.c
+++ linux-2.6.git/net/netlink/af_netlink.c
@@ -707,7 +707,7 @@ static int netlink_getname(struct socket
 {
 	struct sock *sk = sock->sk;
 	struct netlink_sock *nlk = nlk_sk(sk);
-	struct sockaddr_nl *nladdr = (struct sockaddr_nl *)addr;
+	DECLARE_SOCKADDR(struct sockaddr_nl *, nladdr, addr);
 
 	nladdr->nl_family = AF_NETLINK;
 	nladdr->nl_pad = 0;
Index: linux-2.6.git/net/packet/af_packet.c
=====================================================================
--- linux-2.6.git.orig/net/packet/af_packet.c
+++ linux-2.6.git/net/packet/af_packet.c
@@ -1532,7 +1532,7 @@ static int packet_getname(struct socket 
 	struct net_device *dev;
 	struct sock *sk = sock->sk;
 	struct packet_sock *po = pkt_sk(sk);
-	struct sockaddr_ll *sll = (struct sockaddr_ll *)uaddr;
+	DECLARE_SOCKADDR(struct sockaddr_ll *, sll, uaddr);
 
 	if (peer)
 		return -EOPNOTSUPP;
Index: linux-2.6.git/net/unix/af_unix.c
=====================================================================
--- linux-2.6.git.orig/net/unix/af_unix.c
+++ linux-2.6.git/net/unix/af_unix.c
@@ -1258,7 +1258,7 @@ static int unix_getname(struct socket *s
 {
 	struct sock *sk = sock->sk;
 	struct unix_sock *u;
-	struct sockaddr_un *sunaddr = (struct sockaddr_un *)uaddr;
+	DECLARE_SOCKADDR(struct sockaddr_un *, sunaddr, uaddr);
 	int err = 0;
 
 	if (peer) {

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: netlink_getname, packet_getname -- use DECLARE_SOCKADDR guard
  2009-11-08 15:51 [PATCH] net: netlink_getname, packet_getname -- use DECLARE_SOCKADDR guard Cyrill Gorcunov
@ 2009-11-11  6:31 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2009-11-11  6:31 UTC (permalink / raw)
  To: gorcunov; +Cc: netdev, eric.dumazet

From: Cyrill Gorcunov <gorcunov@openvz.org>
Date: Sun, 8 Nov 2009 18:51:19 +0300

> Use guard DECLARE_SOCKADDR in a few more places which allow
> us to catch if the structure copied back is too big.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>

Applied to net-next-2.6, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-11-11  6:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-08 15:51 [PATCH] net: netlink_getname, packet_getname -- use DECLARE_SOCKADDR guard Cyrill Gorcunov
2009-11-11  6:31 ` David Miller

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.