<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.freebsd.org/bugzilla/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.freebsd.org/bugzilla/"
          
          maintainer="bugmeister@FreeBSD.org"
>

    <bug>
          <bug_id>255879</bug_id>
          
          <creation_ts>2021-05-14 14:13:40 +0000</creation_ts>
          <short_desc>[PATCH] netpfil/ipfw: Fix a double free in codel_enqueue</short_desc>
          <delta_ts>2021-05-25 23:24:42 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Base System</product>
          <component>kern</component>
          <version>CURRENT</version>
          <rep_platform>Any</rep_platform>
          <op_sys>Any</op_sys>
          <bug_status>Closed</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>---</priority>
          <bug_severity>Affects Many People</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>lylgood</reporter>
          <assigned_to name="Mark Johnston">markj</assigned_to>
          <cc>freebsd.68fba</cc>
    
    <cc>ipfw</cc>
    
    <cc>markj</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1161336</commentid>
    <comment_count>0</comment_count>
      <attachid>224942</attachid>
    <who name="">lylgood</who>
    <bug_when>2021-05-14 14:13:40 +0000</bug_when>
    <thetext>Created attachment 224942
removes the redundant m_freem() in drop branch.

Bug File: sys/netpfil/ipfw/dn_sched_fq_codel.c

In function codel_enqueue, m is freed via m_freem() at line 193.
But the freed m is freed again in the drop branch via m_freem() at line 205, which is a double free bug.

My patch removes the redundant m_freem() in drop branch.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1162010</commentid>
    <comment_count>1</comment_count>
    <who name="">commit-hook</who>
    <bug_when>2021-05-18 19:44:53 +0000</bug_when>
    <thetext>A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=c4a6258d70f73c27d8f0c6233edbcc609791806b

commit c4a6258d70f73c27d8f0c6233edbcc609791806b
Author:     Mark Johnston &lt;markj@FreeBSD.org&gt;
AuthorDate: 2021-05-18 19:22:21 +0000
Commit:     Mark Johnston &lt;markj@FreeBSD.org&gt;
CommitDate: 2021-05-18 19:25:16 +0000

    dummynet: Fix mbuf tag allocation failure handling

    PR:             255875, 255878, 255879, 255880
    Reviewed by:    donner, kp
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D30318

 sys/netpfil/ipfw/dn_aqm_codel.c      | 4 +---
 sys/netpfil/ipfw/dn_aqm_pie.c        | 6 +++---
 sys/netpfil/ipfw/dn_sched_fq_codel.c | 4 +---
 sys/netpfil/ipfw/dn_sched_fq_pie.c   | 6 +++---
 4 files changed, 8 insertions(+), 12 deletions(-)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1163053</commentid>
    <comment_count>2</comment_count>
    <who name="">commit-hook</who>
    <bug_when>2021-05-25 13:28:51 +0000</bug_when>
    <thetext>A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=b14db362bbd20e5a3d97d121c403b72473fdc733

commit b14db362bbd20e5a3d97d121c403b72473fdc733
Author:     Mark Johnston &lt;markj@FreeBSD.org&gt;
AuthorDate: 2021-05-18 19:22:21 +0000
Commit:     Mark Johnston &lt;markj@FreeBSD.org&gt;
CommitDate: 2021-05-25 13:26:09 +0000

    dummynet: Fix mbuf tag allocation failure handling

    PR:             255875, 255878, 255879, 255880
    Reviewed by:    donner, kp
    Sponsored by:   The FreeBSD Foundation

    (cherry picked from commit c4a6258d70f73c27d8f0c6233edbcc609791806b)

 sys/netpfil/ipfw/dn_aqm_codel.c      | 4 +---
 sys/netpfil/ipfw/dn_aqm_pie.c        | 6 +++---
 sys/netpfil/ipfw/dn_sched_fq_codel.c | 4 +---
 sys/netpfil/ipfw/dn_sched_fq_pie.c   | 6 +++---
 4 files changed, 8 insertions(+), 12 deletions(-)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1163058</commentid>
    <comment_count>3</comment_count>
    <who name="">commit-hook</who>
    <bug_when>2021-05-25 13:29:55 +0000</bug_when>
    <thetext>A commit in branch stable/12 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=419a11681c22ce12d3b9a4ab9ab45ff6b7c4ce83

commit 419a11681c22ce12d3b9a4ab9ab45ff6b7c4ce83
Author:     Mark Johnston &lt;markj@FreeBSD.org&gt;
AuthorDate: 2021-05-18 19:22:21 +0000
Commit:     Mark Johnston &lt;markj@FreeBSD.org&gt;
CommitDate: 2021-05-25 13:29:00 +0000

    dummynet: Fix mbuf tag allocation failure handling

    PR:             255875, 255878, 255879, 255880
    Reviewed by:    donner, kp
    Sponsored by:   The FreeBSD Foundation

    (cherry picked from commit c4a6258d70f73c27d8f0c6233edbcc609791806b)

 sys/netpfil/ipfw/dn_aqm_codel.c      | 4 +---
 sys/netpfil/ipfw/dn_aqm_pie.c        | 6 +++---
 sys/netpfil/ipfw/dn_sched_fq_codel.c | 4 +---
 sys/netpfil/ipfw/dn_sched_fq_pie.c   | 6 +++---
 4 files changed, 8 insertions(+), 12 deletions(-)</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>224942</attachid>
            <date>2021-05-14 14:13:40 +0000</date>
            <delta_ts>2021-05-14 14:13:40 +0000</delta_ts>
            <desc>removes the redundant m_freem() in drop branch.</desc>
            <filename>0001-netpfil-ipfw-double-free-codel_enqueue.patch</filename>
            <type>text/plain</type>
            <size>388</size>
            <attacher>lylgood</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL3N5cy9uZXRwZmlsL2lwZncvZG5fc2NoZWRfZnFfY29kZWwuYyBiL3N5cy9u
ZXRwZmlsL2lwZncvZG5fc2NoZWRfZnFfY29kZWwuYwppbmRleCA1NTgwZGQ5MWJiZmUuLmY5OTJm
MGQ4Y2VkZSAxMDA2NDQKLS0tIGEvc3lzL25ldHBmaWwvaXBmdy9kbl9zY2hlZF9mcV9jb2RlbC5j
CisrKyBiL3N5cy9uZXRwZmlsL2lwZncvZG5fc2NoZWRfZnFfY29kZWwuYwpAQCAtMjAyLDcgKzIw
Miw2IEBAIGNvZGVsX2VucXVldWUoc3RydWN0IGZxX2NvZGVsX2Zsb3cgKnEsIHN0cnVjdCBtYnVm
ICptLCBzdHJ1Y3QgZnFfY29kZWxfc2kgKnNpKQogCiBkcm9wOgogCWZxX3VwZGF0ZV9zdGF0cyhx
LCBzaSwgbGVuLCAxKTsKLQltX2ZyZWVtKG0pOwogCXJldHVybiAxOwogfQogCg==
</data>

          </attachment>
      

    </bug>

</bugzilla>