CWE
544
Advisory Published
Updated

CVE-2021-47482: net: batman-adv: fix error handling

First published: Wed May 22 2024(Updated: )

In the Linux kernel, the following vulnerability has been resolved: net: batman-adv: fix error handling Syzbot reported ODEBUG warning in batadv_nc_mesh_free(). The problem was in wrong error handling in batadv_mesh_init(). Before this patch batadv_mesh_init() was calling batadv_mesh_free() in case of any batadv_*_init() calls failure. This approach may work well, when there is some kind of indicator, which can tell which parts of batadv are initialized; but there isn't any. All written above lead to cleaning up uninitialized fields. Even if we hide ODEBUG warning by initializing bat_priv->nc.work, syzbot was able to hit GPF in batadv_nc_purge_paths(), because hash pointer in still NULL. [1] To fix these bugs we can unwind batadv_*_init() calls one by one. It is good approach for 2 reasons: 1) It fixes bugs on error handling path 2) It improves the performance, since we won't call unneeded batadv_*_free() functions. So, this patch makes all batadv_*_init() clean up all allocated memory before returning with an error to no call correspoing batadv_*_free() and open-codes batadv_mesh_free() with proper order to avoid touching uninitialized fields.

Credit: 416baaa9-dc9f-4396-8d5f-8c081fb06d67

Affected SoftwareAffected VersionHow to fix
Linux Kernel
Linux Kernel>=2.6.38<4.4.293
Linux Kernel>=4.5<4.9.289
Linux Kernel>=4.10<4.14.254
Linux Kernel>=4.15<4.19.215
Linux Kernel>=4.20<5.4.157
Linux Kernel>=5.5<5.10.77
Linux Kernel>=5.11<5.14.16
Linux Kernel=5.15-rc1
Linux Kernel=5.15-rc2
Linux Kernel=5.15-rc3
Linux Kernel=5.15-rc4
Linux Kernel=5.15-rc5
Linux Kernel=5.15-rc6
Linux Kernel=5.15-rc7

Never miss a vulnerability like this again

Sign up to SecAlerts for real-time vulnerability data matched to your software, aggregated from hundreds of sources.

Frequently Asked Questions

  • What is the severity of CVE-2021-47482?

    CVE-2021-47482 has been classified as a medium severity vulnerability due to improper error handling in the Linux kernel.

  • How do I fix CVE-2021-47482?

    To fix CVE-2021-47482, you should apply the latest patches or updates provided by your Linux distribution's repository.

  • What systems are affected by CVE-2021-47482?

    CVE-2021-47482 affects systems running the Linux kernel that utilize the batman-adv networking protocol.

  • What type of vulnerability is CVE-2021-47482?

    CVE-2021-47482 is an error handling vulnerability in the batman-adv module of the Linux kernel.

  • Who reported the CVE-2021-47482 vulnerability?

    The CVE-2021-47482 vulnerability was reported by the Syzbot automated testing system.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2025 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203