In the Linux kernel, the following vulnerability has been resolved:
i3c: master: svc: Fix use after free vulnerability in svci3cmaster Driver Due to Race Condition
In the svci3cmasterprobe function, &master->hjwork is bound with svci3cmasterhjwork, &master->ibiwork is bound with svci3cmasteribiwork. And svci3cmasteribiwork can start the hjwork, svci3cmasterirqhandler can start the ibi_work.
If we remove the module which will call svci3cmasterremove to make cleanup, it will free master->base through i3cmaster_unregister while the work mentioned above will be used. The sequence of operations that may lead to a UAF bug is as follows:
CPU0 CPU1
| svc_i3c_master_hj_work
svci3cmasterremove | i3cmasterunregister(&master->base)| deviceunregister(&master->dev) | devicerelease | //free master->base | | i3cmasterdodaa(&master->base) | //use master->base
Fix it by ensuring that the work is canceled before proceeding with the cleanup in svci3cmaster_remove.
{ "vanir_signatures": [ { "id": "CVE-2024-49874-78fd2aff", "signature_type": "Line", "target": { "file": "drivers/i3c/master/svc-i3c-master.c" }, "signature_version": "v1", "digest": { "line_hashes": [ "305332054609222264757079223340452996073", "201032073115062260719368493882519536530", "70606614684647688786454425219541058342" ], "threshold": 0.9 }, "deprecated": false, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@56bddf543d4d7ddeff3f87b554ddacfdf086bffe" }, { "id": "CVE-2024-49874-c59c1173", "signature_type": "Function", "target": { "file": "drivers/i3c/master/svc-i3c-master.c", "function": "svc_i3c_master_remove" }, "signature_version": "v1", "digest": { "length": 178.0, "function_hash": "244370420548098976851651582795020009588" }, "deprecated": false, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@56bddf543d4d7ddeff3f87b554ddacfdf086bffe" } ] }