Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Apr 2014 11:36:11 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r264915 - head/sys/netpfil/pf
Message-ID:  <201404251136.s3PBaBKK097854@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Fri Apr 25 11:36:11 2014
New Revision: 264915
URL: http://svnweb.freebsd.org/changeset/base/264915

Log:
  The current API for adding rules with pool addresses is the following:
  
  - DIOCADDADDR adds addresses and puts them into V_pf_pabuf
  - DIOCADDRULE takes all addresses from V_pf_pabuf and links
    them into rule.
  
  The ugly part is that if address is a table, then it is initialized
  in DIOCADDRULE, because we need ruleset, and DIOCADDADDR doesn't
  supply ruleset. But if address is a dynaddr, we need address family,
  and address family could be different for different addresses in one
  rule, so dynaddr is initialized in DIOCADDADDR.
  
  This leads to the entangled state of addresses on V_pf_pabuf. Some are
  initialized, and some not. That's why running pf_empty_pool(&V_pf_pabuf)
  can lead to a panic on a NULL table address.
  
  Since proper fix requires API/ABI change, for now simply plug the panic
  in pf_empty_pool().
  
  Reported by:	danger

Modified:
  head/sys/netpfil/pf/pf_ioctl.c

Modified: head/sys/netpfil/pf/pf_ioctl.c
==============================================================================
--- head/sys/netpfil/pf/pf_ioctl.c	Fri Apr 25 09:54:42 2014	(r264914)
+++ head/sys/netpfil/pf/pf_ioctl.c	Fri Apr 25 11:36:11 2014	(r264915)
@@ -343,7 +343,9 @@ pf_empty_pool(struct pf_palist *poola)
 			pfi_dynaddr_remove(pa->addr.p.dyn);
 			break;
 		case PF_ADDR_TABLE:
-			pfr_detach_table(pa->addr.p.tbl);
+			/* XXX: this could be unfinished pooladdr on pabuf */
+			if (pa->addr.p.tbl != NULL)
+				pfr_detach_table(pa->addr.p.tbl);
 			break;
 		}
 		if (pa->kif)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201404251136.s3PBaBKK097854>