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 to a fixed release to a version that resolves this vulnerability.
Patch e2b76ab8b5c9
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.