From nobody Wed Nov 08 21:56:13 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SQf6k13dJz50RsZ; Wed, 8 Nov 2023 21:56:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SQf6k0Zt7z4cJ7; Wed, 8 Nov 2023 21:56:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699480574; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gZaOUP8vU5yPt+BbuZh89B2wUG38TME1mqww68YKeSg=; b=CE72olXDJqDrwtkpr0+WlnhiURYakAIr5Pv4zGJbJf0/sJitHHWi9SddSOEBEPnsRuwmok sx0AC2lTGNrOxGjZd5fDa/WOWeK8FlZseK0aCVipXnxPWMkZiHvUIMM+GuSqxt3PaS73Ek 1Goss9jb5HFluudQCkDGlpQq2+Fi3n7xu/ekwoifX9VLT1W8tDU5rQlsxvg2AuL8tTUpTf AyGeD5LqYWSNofrKsQIFbR9zq9YYID6ifE+tMDiohyUEghPye24fTGumECvHFW2LBIU3X3 TeKQemhFcRctzJOOmu7tUZ+aSFV4jJ6oK/YxBR8V6OkElsNLQGTxAe8FyEjAQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699480574; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gZaOUP8vU5yPt+BbuZh89B2wUG38TME1mqww68YKeSg=; b=vc/ztrfFfeZX9rqPRp/oZKVu6ilzy+mWN3vQahXDbXgCUQh5vDkbTvHwjTdm2z2YJ7YMpK Y+PCnwBSdwkwQ/w7ZQHb3bqTidIbXZD/tfUW+1qr+6CXYqWtRwYMSLSmI6BBij4skOYrCb bUzN1Wz+rWidI2G87Ju2ZD6VCwXFh8GCZUEHhX89ACV6vezCbmg2uWkrcVdhh2neyxhmaW hSzsMS5hVDuFczMq68CSC2qmWWb1heIG2mOMH5MMEAJ8IxVwzeUmtRjSUDziJ6nQtDVvTZ AnnSCa9VPzpN8ZAI71GOf7Ou5NTt0FzgcfJ/bEI31pk9Ba6LuPRF3wgXccFjzg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1699480574; a=rsa-sha256; cv=none; b=XzyvhCOx7oXREO0MByU8AP4bXJawqz23+3czOXziJUT2fozb8igm3XHcZrExBAvMiHxR5a x78tapEGCEHoElegBa1dhiH+tYSo5jIbU1R4xAqA8A8DPGgdrJzpPuVHnjOuv9bLiVDXqT LEw0T7Uc1RSAO9JnFJ0tagOM35h3i057IP+P64q9weOSdezz9Cslo3G0G/L0rBI0b53eg6 dOP1DNnRuMTmMKoDioxGRrtqsZOs+n0P7phhyKNI0N2fep20p2tBB9+fduXOZyDVS05w0Z hAXv75V7+MEFJH6+90KtFlP+eESjXaKVv70o6Q53s8FAh9Z63e0MYOE81TFhdA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SQf6j6lJJzphK; Wed, 8 Nov 2023 21:56:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3A8LuDCR095326; Wed, 8 Nov 2023 21:56:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3A8LuDdd095323; Wed, 8 Nov 2023 21:56:13 GMT (envelope-from git) Date: Wed, 8 Nov 2023 21:56:13 GMT Message-Id: <202311082156.3A8LuDdd095323@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: a6246a50b634 - main - pf: fix double free if pf_ioctl_addrule() fails List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a6246a50b63450d0fe34e3429807bd5aba8cc2ac Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=a6246a50b63450d0fe34e3429807bd5aba8cc2ac commit a6246a50b63450d0fe34e3429807bd5aba8cc2ac Author: Kristof Provost AuthorDate: 2023-11-08 14:06:15 +0000 Commit: Kristof Provost CommitDate: 2023-11-08 20:58:52 +0000 pf: fix double free if pf_ioctl_addrule() fails If pf_ioctl_addrule() returns an error it will have freed the rule itself. There's no need for the caller to free it again. PR: 274915 Reported by: Dave Cottlehuber MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf_nl.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/sys/netpfil/pf/pf_nl.c b/sys/netpfil/pf/pf_nl.c index bf3d23051c05..fe5ded0e86a4 100644 --- a/sys/netpfil/pf/pf_nl.c +++ b/sys/netpfil/pf/pf_nl.c @@ -632,9 +632,6 @@ pf_handle_addrule(struct nlmsghdr *hdr, struct nl_pstate *npt) attrs.anchor, attrs.anchor_call, nlp_get_cred(npt->nlp)->cr_uid, hdr->nlmsg_pid); - if (error != 0) - pf_krule_free(attrs.rule); - return (error); }