In the Linux kernel, the following vulnerability has been resolved:
smb: client: fix possible double free in smb2setea()
Clang static checker(scan-build) warning: fs/smb/client/smb2ops.c:1304:2: Attempt to free released memory. 1304 | kfree(ea); | ^~~~~~~~~
There is a double free in such case: 'ea is initialized to NULL' -> 'first successful memory allocation for ea' -> 'something failed, goto seaexit' -> 'first memory release for ea' -> 'goto replayagain' -> 'second goto sea_exit before allocate memory for ea' -> 'second memory release for ea resulted in double free'.
Re-initialie 'ea' to NULL near to the replay_again label, it can fix this double free problem.
[ { "signature_type": "Line", "id": "CVE-2024-50152-1ddc1c09", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@c9f758ecf2562dfdd4adf12c22921b5de8366123", "signature_version": "v1", "target": { "file": "fs/smb/client/smb2ops.c" }, "digest": { "threshold": 0.9, "line_hashes": [ "181752994804624985473797380791165520575", "160094015984062311499875896195332093945", "232487310492337458051871773680296818723", "148977909161567846076145602611829973117", "19687940681883350010964141460048876931", "51185311092022158412006186000846920631", "257654467267488291549648768722464989734" ] }, "deprecated": false }, { "signature_type": "Function", "id": "CVE-2024-50152-2824a172", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@c9f758ecf2562dfdd4adf12c22921b5de8366123", "signature_version": "v1", "target": { "function": "smb2_set_ea", "file": "fs/smb/client/smb2ops.c" }, "digest": { "function_hash": "130900275430707642710601217788606293492", "length": 3766.0 }, "deprecated": false }, { "signature_type": "Function", "id": "CVE-2024-50152-8096d952", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@b1813c220b76f60b1727984794377c4aa849d4c1", "signature_version": "v1", "target": { "function": "smb2_set_ea", "file": "fs/smb/client/smb2ops.c" }, "digest": { "function_hash": "130900275430707642710601217788606293492", "length": 3766.0 }, "deprecated": false }, { "signature_type": "Line", "id": "CVE-2024-50152-dd492049", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@b1813c220b76f60b1727984794377c4aa849d4c1", "signature_version": "v1", "target": { "file": "fs/smb/client/smb2ops.c" }, "digest": { "threshold": 0.9, "line_hashes": [ "181752994804624985473797380791165520575", "160094015984062311499875896195332093945", "232487310492337458051871773680296818723", "148977909161567846076145602611829973117", "19687940681883350010964141460048876931", "51185311092022158412006186000846920631", "257654467267488291549648768722464989734" ] }, "deprecated": false } ]