Bug 1220922 (CVE-2021-47084) - VUL-0: REJECTED: CVE-2021-47084: kernel: hamradio: defer ax25 kfree after unregister_netdev
Summary: VUL-0: REJECTED: CVE-2021-47084: kernel: hamradio: defer ax25 kfree after unr...
Status: RESOLVED INVALID
Alias: CVE-2021-47084
Product: SUSE Security Incidents
Classification: Novell Products
Component: Incidents (show other bugs)
Version: unspecified
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Security Team bot
QA Contact: Security Team bot
URL: https://smash.suse.de/issue/396230/
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-05 09:17 UTC by SMASH SMASH
Modified: 2024-05-31 13:19 UTC (History)
3 users (show)

See Also:
Found By: Security Response Team
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description SMASH SMASH 2024-03-05 09:17:41 UTC
In the Linux kernel, the following vulnerability has been resolved:

hamradio: defer ax25 kfree after unregister_netdev

There is a possible race condition (use-after-free) like below

 (USE)                       |  (FREE)
ax25_sendmsg                 |
 ax25_queue_xmit             |
  dev_queue_xmit             |
   __dev_queue_xmit          |
    __dev_xmit_skb           |
     sch_direct_xmit         | ...
      xmit_one               |
       netdev_start_xmit     | tty_ldisc_kill
        __netdev_start_xmit  |  mkiss_close
         ax_xmit             |   kfree
          ax_encaps          |
                             |

Even though there are two synchronization primitives before the kfree:
1. wait_for_completion(&ax->dead). This can prevent the race with
routines from mkiss_ioctl. However, it cannot stop the routine coming
from upper layer, i.e., the ax25_sendmsg.

2. netif_stop_queue(ax->dev). It seems that this line of code aims to
halt the transmit queue but it fails to stop the routine that already
being xmit.

This patch reorder the kfree after the unregister_netdev to avoid the
possible UAF as the unregister_netdev() is well synchronized and won't
return if there is a running routine.

References:
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2021-47084
https://www.cve.org/CVERecord?id=CVE-2021-47084
https://lore.kernel.org/linux-cve-announce/2024030455-CVE-2021-47084-4984@gregkh/

Patch:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=3e0588c291d6
Comment 1 Andrea Mattiazzo 2024-03-05 09:59:40 UTC
Already fixed:
-cve/linux-5.14
-stable
-SLE15-SP6

@kernel-team please add the CVE reference.

cve/linux-4.4, cve/linux-4.12, cve/linux-5.3 not affected because CONFIG_MKISS is not set.
Comment 3 Oscar Salvador 2024-04-15 12:23:11 UTC
Rejected, back to sec-team.
Comment 4 Andrea Mattiazzo 2024-05-31 13:19:43 UTC
Closing as invalid since it's rejected