Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934829AbXEUTjh (ORCPT ); Mon, 21 May 2007 15:39:37 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1765200AbXEUT0p (ORCPT ); Mon, 21 May 2007 15:26:45 -0400 Received: from 216-99-217-87.dsl.aracnet.com ([216.99.217.87]:35746 "EHLO sous-sol.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932664AbXEUT0n (ORCPT ); Mon, 21 May 2007 15:26:43 -0400 Message-Id: <20070521191730.253921000@sous-sol.org> References: <20070521191612.800400000@sous-sol.org> User-Agent: quilt/0.46-1 Date: Mon, 21 May 2007 12:16:47 -0700 From: Chris Wright To: linux-kernel@vger.kernel.org, stable@kernel.org Cc: Justin Forbes , Zwane Mwaikambo , "Theodore Ts'o" , Randy Dunlap , Dave Jones , Chuck Wolber , Chris Wedgwood , Michael Krufky , Chuck Ebbert , torvalds@linux-foundation.org, akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk, Vlad Yasevich , David S Miller Subject: [patch 35/69] SCTP: Correctly copy addresses in sctp_copy_laddrs Content-Disposition: inline; filename=sctp-correctly-copy-addresses-in-sctp_copy_laddrs.patch Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2336 Lines: 76 -stable review patch. If anyone has any objections, please let us know. --------------------- From: Vlad Yasevich I broke the non-wildcard case recently. This is to fixes it. Now, explictitly bound addresses can ge retrieved using the API. Signed-off-by: Vlad Yasevich Signed-off-by: David S. Miller Signed-off-by: Chris Wright --- net/sctp/socket.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) --- linux-2.6.21.1.orig/net/sctp/socket.c +++ linux-2.6.21.1/net/sctp/socket.c @@ -4016,6 +4016,7 @@ static int sctp_getsockopt_local_addrs_o rwlock_t *addr_lock; int err = 0; void *addrs; + void *buf; int bytes_copied = 0; if (len != sizeof(struct sctp_getaddrs_old)) @@ -4069,13 +4070,14 @@ static int sctp_getsockopt_local_addrs_o } } + buf = addrs; list_for_each(pos, &bp->address_list) { addr = list_entry(pos, struct sctp_sockaddr_entry, list); memcpy(&temp, &addr->a, sizeof(temp)); sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp); addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len; - memcpy(addrs, &temp, addrlen); - to += addrlen; + memcpy(buf, &temp, addrlen); + buf += addrlen; bytes_copied += addrlen; cnt ++; if (cnt >= getaddrs.addr_num) break; @@ -4118,6 +4120,7 @@ static int sctp_getsockopt_local_addrs(s size_t space_left; int bytes_copied = 0; void *addrs; + void *buf; if (len <= sizeof(struct sctp_getaddrs)) return -EINVAL; @@ -4168,6 +4171,7 @@ static int sctp_getsockopt_local_addrs(s } } + buf = addrs; list_for_each(pos, &bp->address_list) { addr = list_entry(pos, struct sctp_sockaddr_entry, list); memcpy(&temp, &addr->a, sizeof(temp)); @@ -4177,8 +4181,8 @@ static int sctp_getsockopt_local_addrs(s err = -ENOMEM; /*fixme: right error?*/ goto error; } - memcpy(addrs, &temp, addrlen); - to += addrlen; + memcpy(buf, &temp, addrlen); + buf += addrlen; bytes_copied += addrlen; cnt ++; space_left -= addrlen; -- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/