Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1778952

Summary: Fix covscan-detected issues
Product: Red Hat Enterprise Linux 8 Reporter: Phil Sutter <psutter>
Component: libnftnlAssignee: Phil Sutter <psutter>
Status: CLOSED ERRATA QA Contact: Tomas Dolezal <todoleza>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.2CC: todoleza
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: 8.2   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libnftnl-1.1.5-2.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-28 16:06:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Phil Sutter 2019-12-02 22:04:24 UTC
Fix potential issues detected by covscan in 1.1.5 rebase.

Comment 1 Phil Sutter 2019-12-02 22:25:39 UTC
Fixes sent upstream: https://lore.kernel.org/netfilter-devel/20191202222401.867-1-phil@nwl.cc/

Comment 2 Phil Sutter 2019-12-03 20:13:17 UTC
Upstream commits to backport:

commit ba1b02594e8d05e4c791925a50f9309f89b55c80
Author: Phil Sutter <phil>
Date:   Mon Dec 2 22:57:40 2019 +0100

    flowtable: Fix memleak in error path of nftnl_flowtable_parse_devs()
    
    In error case, allocated dev_array is not freed.
    
    Fixes: 7f99639dd9217 ("flowtable: device array dynamic allocation")
    Signed-off-by: Phil Sutter <phil>
    Acked-by: Pablo Neira Ayuso <pablo>

commit 32a8c5f52355ef69bf74c28e27345b2e03d948e7
Author: Phil Sutter <phil>
Date:   Mon Dec 2 23:00:20 2019 +0100

    chain: Fix memleak in error path of nftnl_chain_parse_devs()
    
    In error case, dev_array is not freed when it should.
    
    Fixes: e3ac19b5ec162 ("chain: multi-device support")
    Signed-off-by: Phil Sutter <phil>
    Acked-by: Pablo Neira Ayuso <pablo>

commit 835d645f4052551c5c1829c37a07c882f2260f65
Author: Phil Sutter <phil>
Date:   Mon Dec 2 23:08:07 2019 +0100

    flowtable: Correctly check realloc() call
    
    If realloc() fails, it returns NULL but the original pointer is
    untouchted and therefore still has to be freed. Unconditionally
    overwriting the old pointer is therefore a bad idea, use a temporary
    variable instead.
    
    Fixes: 7f99639dd9217 ("flowtable: device array dynamic allocation")
    Signed-off-by: Phil Sutter <phil>
    Acked-by: Pablo Neira Ayuso <pablo>

commit d95a703746d5394d56a9f464e343594e4882da0d
Author: Phil Sutter <phil>
Date:   Mon Dec 2 23:12:34 2019 +0100

    chain: Correctly check realloc() call
    
    If realloc() fails, it returns NULL but the original pointer is
    untouchted and therefore still has to be freed. Unconditionally
    overwriting the old pointer is therefore a bad idea, use a temporary
    variable instead.
    
    Fixes: e3ac19b5ec162 ("chain: multi-device support")
    Signed-off-by: Phil Sutter <phil>
    Acked-by: Pablo Neira Ayuso <pablo>

Comment 6 errata-xmlrpc 2020-04-28 16:06:56 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2020:1763