drm/vc4: fix krealloc() memory leak
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 6d45c81d229d71da54d374143e7d6abad4c0cf31 · < 4fc692dc6df5bc777cc1bcebf95179e28594875f| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
drm/vc4: fix krealloc() memory leak
Don't just overwrite the original pointer passed to krealloc() with its return value without checking latter:
MEM = krealloc(MEM, SZ, GFP);
If krealloc() returns NULL, that erases the pointer to the still allocated memory, hence leaks this memory. Instead, use a temporary variable, check it's not NULL and only then assign it to the original pointer:
TMP = krealloc(MEM, SZ, GFP); if (!TMP) return; MEM = TMP;
While on it, use krealloc_array().
From the CVE record · Linux
The Linux kernel’s drm/vc4 component can leak memory if krealloc() fails, because its original allocation pointer is overwritten. The input does not specify how an attacker could trigger this condition or whether network access, authentication, or user interaction is required.
Operators running Linux kernels with the affected drm/vc4 code should check their versions; no affected versions are specified.