CVE-2026-31478: ksmbd: replace hardcoded hdr2_len with offsetof() in smb2_calc_max_out_buf_len()
In the Linux kernel, the following vulnerability has been resolved:
ksmbd: replace hardcoded hdr2len with offsetof() in smb2calcmaxoutbuflen()
After this commit (e2b76ab8b5c9 "ksmbd: add support for read compound"), response buffer management was changed to use dynamic iov array. In the new design, smb2calcmaxoutbuflen() expects the second argument (hdr2len) to be the offset of ->Buffer field in the response structure, not a hardcoded magic number. Fix the remaining call sites to use the correct offsetof() value.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.1.176-1Fixed in 6.1.190-1Fixed in 6.12.107-1Fixed in 6.12.113-1Fixed in 7.2.12-1Fixed in 7.2.13-1 - Configuration
Update all remaining call sites to pass the offsetof() value of the response structure's ->Buffer field instead of a hardcoded magic number.
Linux kernel ksmbd hdr2_len passed to smb2_calc_max_out_buf_len() = offsetof(..., ->Buffer)
Event History
Frequently Asked Questions
Which systems are implicated?
The issue is in the Linux kernel's ksmbd SMB server component, specifically in response-buffer length calculation after the dynamic iOV-array design introduced by commit e2b76ab8b5c9. Systems not using ksmbd are not identified by the provided information as exposed.
How can I determine whether the fix is present?
Review the ksmbd source or applied kernel fixes for calls to smb2_calc_max_out_buf_len(). Affected call sites pass a hardcoded hdr2_len value where the function requires the offset of the response structure's Buffer field; the correction uses offsetof().
What is the remediation?
Apply a kernel update containing the correction. The provided stable-tree references identify commits carrying the fix, but the affected and fixed kernel version numbers are not provided.