From owner-svn-src-head@freebsd.org Fri Apr 14 01:56:16 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD75AD3DBE3; Fri, 14 Apr 2017 01:56:16 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D91491D; Fri, 14 Apr 2017 01:56:16 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3E1uFD1057115; Fri, 14 Apr 2017 01:56:15 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3E1uFNi057114; Fri, 14 Apr 2017 01:56:15 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201704140156.v3E1uFNi057114@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Fri, 14 Apr 2017 01:56:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r316804 - head/sys/netpfil/pf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Apr 2017 01:56:16 -0000 Author: glebius Date: Fri Apr 14 01:56:15 2017 New Revision: 316804 URL: https://svnweb.freebsd.org/changeset/base/316804 Log: Fix potential NULL deref. Found by: PVS Studio 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 14 00:45:09 2017 (r316803) +++ head/sys/netpfil/pf/pf_ioctl.c Fri Apr 14 01:56:15 2017 (r316804) @@ -2428,11 +2428,12 @@ DIOCGETSTATES_full: #undef ERROUT DIOCCHANGEADDR_error: - if (newpa->kif) - pfi_kif_unref(newpa->kif); - PF_RULES_WUNLOCK(); - if (newpa != NULL) + if (newpa != NULL) { + if (newpa->kif) + pfi_kif_unref(newpa->kif); free(newpa, M_PFRULE); + } + PF_RULES_WUNLOCK(); if (kif != NULL) free(kif, PFI_MTYPE); break;