In the Linux kernel, the following vulnerability has been resolved:
watchdog: Fix kmemleak in watchdogcdevregister
kmemleak reports memory leaks in watchdogdevregister, as follows: unreferenced object 0xffff888116233000 (size 2048): comm ""modprobe"", pid 28147, jiffies 4353426116 (age 61.741s) hex dump (first 32 bytes): 80 fa b9 05 81 88 ff ff 08 30 23 16 81 88 ff ff .........0#..... 08 30 23 16 81 88 ff ff 00 00 00 00 00 00 00 00 .0#............. backtrace: [<000000007f001ffd>] _kmemcacheallocnode+0x157/0x220 [<000000006a389304>] kmalloctrace+0x21/0x110 [<000000008d640eea>] watchdogdevregister+0x4e/0x780 [watchdog] [<0000000053c9f248>] _watchdogregisterdevice+0x4f0/0x680 [watchdog] [<00000000b2979824>] watchdogregisterdevice+0xd2/0x110 [watchdog] [<000000001f730178>] 0xffffffffc10880ae [<000000007a1a8bcc>] dooneinitcall+0xcb/0x4d0 [<00000000b98be325>] doinitmodule+0x1ca/0x5f0 [<0000000046d08e7c>] load_module+0x6133/0x70f0 ...
unreferenced object 0xffff888105b9fa80 (size 16): comm ""modprobe"", pid 28147, jiffies 4353426116 (age 61.741s) hex dump (first 16 bytes): 77 61 74 63 68 64 6f 67 31 00 b9 05 81 88 ff ff watchdog1....... backtrace: [<000000007f001ffd>] _kmemcacheallocnode+0x157/0x220 [<00000000486ab89b>] _kmallocnodetrackcaller+0x44/0x1b0 [<000000005a39aab0>] kvasprintf+0xb5/0x140 [<0000000024806f85>] kvasprintfconst+0x55/0x180 [<000000009276cb7f>] kobjectsetnamevargs+0x56/0x150 [<00000000a92e820b>] devsetname+0xab/0xe0 [<00000000cec812c6>] watchdogdevregister+0x285/0x780 [watchdog] [<0000000053c9f248>] _watchdogregisterdevice+0x4f0/0x680 [watchdog] [<00000000b2979824>] watchdogregisterdevice+0xd2/0x110 [watchdog] [<000000001f730178>] 0xffffffffc10880ae [<000000007a1a8bcc>] dooneinitcall+0xcb/0x4d0 [<00000000b98be325>] doinitmodule+0x1ca/0x5f0 [<0000000046d08e7c>] loadmodule+0x6133/0x70f0 ...
The reason is that putdevice is not be called if cdevdevice_add fails and wdd->id != 0.
watchdogcdevregister wddata = kzalloc [1] err = devsetname [2] .. err = cdevdevice_add if (err) { if (wdd->id == 0) { // wdd->id != 0 .. } return err; // [1],[2] would be leaked
To fix it, call put_device in all wdd->id cases.
{ "vanir_signatures": [ { "signature_version": "v1", "signature_type": "Line", "target": { "file": "drivers/watchdog/watchdog_dev.c" }, "deprecated": false, "digest": { "line_hashes": [ "203334233816328410031583138344763108940", "78106306351430730249524450188502339548", "209061981589835101449623552957237543128", "35512475718556658807159095342520336405", "322582273554571543766080922298640162515" ], "threshold": 0.9 }, "id": "CVE-2023-53234-29f818fe", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@bf26b0e430ce34261f45959989edaf680b64d538" }, { "signature_version": "v1", "signature_type": "Line", "target": { "file": "drivers/watchdog/watchdog_dev.c" }, "deprecated": false, "digest": { "line_hashes": [ "203334233816328410031583138344763108940", "78106306351430730249524450188502339548", "209061981589835101449623552957237543128", "35512475718556658807159095342520336405", "322582273554571543766080922298640162515" ], "threshold": 0.9 }, "id": "CVE-2023-53234-66aa46db", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@50808d034e199fe3ff7a9d2068a4eebeb6b4098a" }, { "signature_version": "v1", "signature_type": "Line", "target": { "file": "drivers/watchdog/watchdog_dev.c" }, "deprecated": false, "digest": { "line_hashes": [ "203334233816328410031583138344763108940", "78106306351430730249524450188502339548", "209061981589835101449623552957237543128", "35512475718556658807159095342520336405", "322582273554571543766080922298640162515" ], "threshold": 0.9 }, "id": "CVE-2023-53234-83828f72", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ac099d94e0480c937aa9172ab64074981ca1a4d3" }, { "signature_version": "v1", "signature_type": "Line", "target": { "file": "drivers/watchdog/watchdog_dev.c" }, "deprecated": false, "digest": { "line_hashes": [ "203334233816328410031583138344763108940", "78106306351430730249524450188502339548", "209061981589835101449623552957237543128", "35512475718556658807159095342520336405", "322582273554571543766080922298640162515" ], "threshold": 0.9 }, "id": "CVE-2023-53234-95732df3", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@59e391b3fc507a15b7e8e9d9f4de87cae177c366" }, { "signature_version": "v1", "signature_type": "Function", "target": { "file": "drivers/watchdog/watchdog_dev.c", "function": "watchdog_cdev_register" }, "deprecated": false, "digest": { "length": 2152.0, "function_hash": "4755909046260068398127531540737039680" }, "id": "CVE-2023-53234-9a8b0eab", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ac099d94e0480c937aa9172ab64074981ca1a4d3" }, { "signature_version": "v1", "signature_type": "Function", "target": { "file": "drivers/watchdog/watchdog_dev.c", "function": "watchdog_cdev_register" }, "deprecated": false, "digest": { "length": 2152.0, "function_hash": "4755909046260068398127531540737039680" }, "id": "CVE-2023-53234-b1be629d", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@13721a2ac66b246f5802ba1b75ad8637e53eeecc" }, { "signature_version": "v1", "signature_type": "Function", "target": { "file": "drivers/watchdog/watchdog_dev.c", "function": "watchdog_cdev_register" }, "deprecated": false, "digest": { "length": 1850.0, "function_hash": "313314128669020853711463083838001539799" }, "id": "CVE-2023-53234-bd7a59f8", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@bf26b0e430ce34261f45959989edaf680b64d538" }, { "signature_version": "v1", "signature_type": "Function", "target": { "file": "drivers/watchdog/watchdog_dev.c", "function": "watchdog_cdev_register" }, "deprecated": false, "digest": { "length": 2040.0, "function_hash": "188132590197316029884818833886751146077" }, "id": "CVE-2023-53234-c6b1917b", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@8c1655600f4f2839fb844fe8c70b2b65fadc7a56" }, { "signature_version": "v1", "signature_type": "Function", "target": { "file": "drivers/watchdog/watchdog_dev.c", "function": "watchdog_cdev_register" }, "deprecated": false, "digest": { "length": 2069.0, "function_hash": "311632920651588615982285934565914700643" }, "id": "CVE-2023-53234-d27bb049", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@59e391b3fc507a15b7e8e9d9f4de87cae177c366" }, { "signature_version": "v1", "signature_type": "Function", "target": { "file": "drivers/watchdog/watchdog_dev.c", "function": "watchdog_cdev_register" }, "deprecated": false, "digest": { "length": 2152.0, "function_hash": "4755909046260068398127531540737039680" }, "id": "CVE-2023-53234-e01f0fad", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@50808d034e199fe3ff7a9d2068a4eebeb6b4098a" }, { "signature_version": "v1", "signature_type": "Line", "target": { "file": "drivers/watchdog/watchdog_dev.c" }, "deprecated": false, "digest": { "line_hashes": [ "203334233816328410031583138344763108940", "78106306351430730249524450188502339548", "209061981589835101449623552957237543128", "35512475718556658807159095342520336405", "322582273554571543766080922298640162515" ], "threshold": 0.9 }, "id": "CVE-2023-53234-e44ef2f3", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@13721a2ac66b246f5802ba1b75ad8637e53eeecc" }, { "signature_version": "v1", "signature_type": "Line", "target": { "file": "drivers/watchdog/watchdog_dev.c" }, "deprecated": false, "digest": { "line_hashes": [ "203334233816328410031583138344763108940", "78106306351430730249524450188502339548", "209061981589835101449623552957237543128", "35512475718556658807159095342520336405", "322582273554571543766080922298640162515" ], "threshold": 0.9 }, "id": "CVE-2023-53234-fcce7601", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@8c1655600f4f2839fb844fe8c70b2b65fadc7a56" } ] }