From patchwork Sun Nov 8 15:51:19 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cyrill Gorcunov X-Patchwork-Id: 37937 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 166C5B70B3 for ; Mon, 9 Nov 2009 02:51:28 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753901AbZKHPvR (ORCPT ); Sun, 8 Nov 2009 10:51:17 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753663AbZKHPvQ (ORCPT ); Sun, 8 Nov 2009 10:51:16 -0500 Received: from mail-ew0-f207.google.com ([209.85.219.207]:62108 "EHLO mail-ew0-f207.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753515AbZKHPvQ (ORCPT ); Sun, 8 Nov 2009 10:51:16 -0500 Received: by ewy3 with SMTP id 3so2432149ewy.37 for ; Sun, 08 Nov 2009 07:51:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:received:date:from:to :cc:subject:message-id:mime-version:content-type:content-disposition :user-agent; bh=Un6fXBonew1cgPq3/N3jqv9P+PUnVjXELBltWubckbo=; b=PuRHA23wS1QxniV+9dS9trPlslzpL3c/hg9IX/4wUXkMJk+XSPK31ONrwAk4O4k9DK SMsdBbS75cXRL2w2vZzOBrvsHxSWdL37BJKVFMLQ5cVCEsWPNxJeSdhEem7qHhan57YX MbVPWifLhQ+fe9KtSIaC92LwZ1ndx5ohQjzlI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=UW4/+muRt6Fs37aJkIepj4RwEuVrj/MzWNOLJthDl/y9RsVdFTJ6uu9rIXwWE101pw eVOSFTu/AiAoUMTC70S4wKdTb/V7ab92WetL6nL7mi4+7zarhC8B8pNIulZLj1ASSsoI D/muAIzgoW+ssT8jQWNjgCE4aa5kt86A3Svmo= Received: by 10.213.63.75 with SMTP id a11mr392837ebi.63.1257695480808; Sun, 08 Nov 2009 07:51:20 -0800 (PST) Received: from gorcunov (ppp78-37-228-144.pppoe.avangarddsl.ru [78.37.228.144]) by mx.google.com with ESMTPS id 7sm3827077eyb.32.2009.11.08.07.51.20 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 08 Nov 2009 07:51:20 -0800 (PST) Received: by gorcunov (Postfix, from userid 1000) id 0B68CC0A; Sun, 8 Nov 2009 18:51:19 +0300 (MSK) Date: Sun, 8 Nov 2009 18:51:19 +0300 From: Cyrill Gorcunov To: LNML Cc: David Miller , Eric Dumazet Subject: [PATCH] net: netlink_getname, packet_getname -- use DECLARE_SOCKADDR guard Message-ID: <20091108155119.GA25940@lenovo> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- 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(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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) {