From owner-freebsd-bugs@FreeBSD.ORG Fri May 20 12:40:10 2011 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B0924106566C for ; Fri, 20 May 2011 12:40:10 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 72E408FC16 for ; Fri, 20 May 2011 12:40:10 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p4KCeANU007116 for ; Fri, 20 May 2011 12:40:10 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p4KCeAja007115; Fri, 20 May 2011 12:40:10 GMT (envelope-from gnats) Resent-Date: Fri, 20 May 2011 12:40:10 GMT Resent-Message-Id: <201105201240.p4KCeAja007115@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Dmitrij Tejblum Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F27E2106566C for ; Fri, 20 May 2011 12:33:35 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id E1E5F8FC16 for ; Fri, 20 May 2011 12:33:35 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p4KCXZDq068380 for ; Fri, 20 May 2011 12:33:35 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id p4KCXZ1R068374; Fri, 20 May 2011 12:33:35 GMT (envelope-from nobody) Message-Id: <201105201233.p4KCXZ1R068374@red.freebsd.org> Date: Fri, 20 May 2011 12:33:35 GMT From: Dmitrij Tejblum To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: kern/157209: [patch] locking error in rip6_input() (sys/netinet6/raw_ip6.c) X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 May 2011 12:40:10 -0000 >Number: 157209 >Category: kern >Synopsis: [patch] locking error in rip6_input() (sys/netinet6/raw_ip6.c) >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri May 20 12:40:10 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Dmitrij Tejblum >Release: 8.2-STABLE >Organization: Yandex >Environment: >Description: On a failure path in rip6_input(), the PCB is unlocked before the lock is taken. >How-To-Repeat: >Fix: A possible quick patch is attached; anothe quick possibility would be to remove the unlock. Patch attached with submission follows: --- sys/netinet6/raw_ip6.c 2010-08-31 19:52:12.000000000 +0400 +++ sys/netinet6/raw_ip6.c 2011-05-14 00:27:24.000000000 +0400 @@ -193,20 +193,20 @@ if (!IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) && prison_check_ip6(in6p->inp_cred, &ip6->ip6_dst) != 0) continue; } + INP_RLOCK(in6p); if (in6p->in6p_cksum != -1) { V_rip6stat.rip6s_isum++; if (in6_cksum(m, proto, *offp, m->m_pkthdr.len - *offp)) { INP_RUNLOCK(in6p); V_rip6stat.rip6s_badsum++; continue; } } - INP_RLOCK(in6p); /* * If this raw socket has multicast state, and we * have received a multicast, check if this socket * should receive it, as multicast filtering is now * the responsibility of the transport layer. >Release-Note: >Audit-Trail: >Unformatted: