ext4: fix invalid free tracking in ext4_xattr_move_to_block()
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 8b6d06b3be7648b3b0f428558293ddf6e2cb94bf · < c5fa4eedddd1c8342ce533cb401c0e693e55b4e3| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
ext4: fix invalid free tracking in ext4_xattr_move_to_block()
In ext4_xattr_move_to_block(), the value of the extended attribute which we need to move to an external block may be allocated by kvmalloc() if the value is stored in an external inode. So at the end of the function the code tried to check if this was the case by testing entry->e_value_inum.
However, at this point, the pointer to the xattr entry is no longer valid, because it was removed from the original location where it had been stored. So we could end up calling kvfree() on a pointer which was not allocated by kvmalloc(); or we could also potentially leak memory by not freeing the buffer when it should be freed. Fix this by storing whether it should be freed in a separate variable.
From the CVE record · Linux
The Linux kernel’s ext4_xattr_move_to_block() can use an invalid extended-attribute entry to decide whether to free a buffer. This can cause an invalid free or a memory leak. The input does not establish how an attacker could trigger the issue or whether authentication or user interaction is required.
Anyone running a Linux kernel with the affected ext4 code should check their version; affected versions were not provided.