From owner-svn-src-stable-6@FreeBSD.ORG Tue Sep 28 19:17:40 2010 Return-Path: Delivered-To: svn-src-stable-6@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37E09106566C; Tue, 28 Sep 2010 19:17:40 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 266FF8FC18; Tue, 28 Sep 2010 19:17:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8SJHeoc083136; Tue, 28 Sep 2010 19:17:40 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8SJHebT083134; Tue, 28 Sep 2010 19:17:40 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201009281917.o8SJHebT083134@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 28 Sep 2010 19:17:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213249 - stable/6/sys/netinet X-BeenThere: svn-src-stable-6@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 6-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2010 19:17:40 -0000 Author: bz Date: Tue Sep 28 19:17:39 2010 New Revision: 213249 URL: http://svn.freebsd.org/changeset/base/213249 Log: r201663 introduced a bug in stable/6 that prison_ip() might change the passed address argument, while we are only interested in whether it is a valid address of the jail. This can modify an address in the live interface address list with an address of the jail. Make a copy of the address for the call to prison_ip() to avoid this. Reported by: Andreas Longwitz (longwitz incore.de) Tested by: Andreas Longwitz (longwitz incore.de) PR: kern/114325 Modified: stable/6/sys/netinet/in.c Modified: stable/6/sys/netinet/in.c ============================================================================== --- stable/6/sys/netinet/in.c Tue Sep 28 15:33:30 2010 (r213248) +++ stable/6/sys/netinet/in.c Tue Sep 28 19:17:39 2010 (r213249) @@ -252,12 +252,15 @@ in_control(so, cmd, data, ifp, td) * the first one on the interface, if possible. */ if (ifp) { + struct in_addr tmp; + dst = ((struct sockaddr_in *)&ifr->ifr_addr)->sin_addr; LIST_FOREACH(iap, INADDR_HASH(dst.s_addr), ia_hash) if (iap->ia_ifp == ifp && iap->ia_addr.sin_addr.s_addr == dst.s_addr) { + tmp.s_addr = dst.s_addr; if (td == NULL || !prison_ip( - td->td_ucred, 0, &dst.s_addr)) + td->td_ucred, 0, &tmp.s_addr)) ia = iap; break; } @@ -265,9 +268,11 @@ in_control(so, cmd, data, ifp, td) TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { iap = ifatoia(ifa); if (iap->ia_addr.sin_family == AF_INET) { + tmp.s_addr = + iap->ia_addr.sin_addr.s_addr; if (td != NULL && prison_ip(td->td_ucred, 0, - &iap->ia_addr.sin_addr.s_addr)) + &tmp.s_addr)) continue; ia = iap; break;