cifs: use cifs_invalidate_cache() in cifs_do_truncate() for O_TRUNC
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
cifs: use cifs_invalidate_cache() in cifs_do_truncate() for O_TRUNC
cifs_do_truncate() is invoked from cifs_open() without i_rwsem, so it cannot use cifs_resize_file_locked() to perform a proper fscache cookie resize. Instead, add cifs_invalidate_cache() after cifs_setsize().
cifs_invalidate_cache() calls fscache_invalidate(), which works without holding i_rwsem: it unconditionally increments inval_counter and sets FSCACHE_COOKIE_NO_DATA_TO_READ, ensuring that stale cached data is not served once the cookie is later activated by fscache_use_cookie(). Truncation to zero leaves no valid cached data, making invalidation the correct semantic here.
From the CVE record · Linux
The Linux kernel's CIFS O_TRUNC path could leave cached data valid after a file is truncated to zero, allowing stale data to be served when the cache cookie is later activated. The input does not describe an attacker scenario or specify network access, authentication, or user-interaction requirements.
Engineers running Linux kernels with CIFS should check their versions; affected versions are not specified.