CVE-2026-89544: SUNRPC: fix gssx_dec_option_array error path bugs
In the Linux kernel, the following vulnerability has been resolved:
SUNRPC: fix gssxdecoptionarray error path bugs
Four coupled defects in the gssx XDR option-array decoder make the error paths unsafe: a NULL deref in the caller, a refcount leak on the decoded groupinfo, and a latent use-after-free that the leak fix would otherwise expose.
gssxdecoptionarray() sets oa->count = 1 before allocating oa->data. If that allocation fails, -ENOMEM is returned with oa->count == 1 and oa->data == NULL. All other error paths jump to freeoa: which frees oa->data and NULLs it but also leaves oa->count == 1. The caller trusts the count:
gsspacceptseccontextupcall() gssxdecacceptseccontext() gssxdecoptionarray() / fails, count=1 data=NULL / data = res.options.data[0].value / NULL deref /
Independently, freecreds: releases the partially decoded svccred with a bare kfree(creds). gssxdeclinuxcreds() installs a groupsalloc() result into creds->crgroupinfo; that object is kvmalloc-backed and refcounted, and only putgroupinfo() reaches kvfree(). A plain kfree(creds) drops the wrapper and leaks the groupinfo allocation.
The natural fix for the leak is to call freesvccred(creds) before kfree(creds), but freesvccred() invokes putgroupinfo() on creds->crgroupinfo unconditionally when non-NULL. The existing outfreegroups: path in gssxdeclinuxcreds() already called groupsfree() on that pointer without clearing it, so once freesvccred() is wired in, the subsequent putgroupinfo() would touch freed memory.
Fix all four together:
- Move the oa->count = 1 assignment below the oa->data allocation so it is never set when oa->data is NULL. - Reset oa->count to 0 at freeoa: so count and data stay coherent and the caller sees an empty option array. - Call freesvccred(creds) before kfree(creds) at freecreds: so the refcounted crgroupinfo is released. freesvccred() either NULL-guards each field explicitly (crgroupinfo has an if() check) or delegates to a helper that is NULL-safe itself (kfree for the string fields, gssmechput() which guards with if(gm) at gssmechswitch.c:342), so it is safe to call on a partially decoded svccred where only cruid/crgid/crgroupinfo have been written and everything else is zero from kzalloc. - In gssxdeclinuxcreds()'s outfreegroups: path, release crgroupinfo with putgroupinfo() rather than groupsfree() so the teardown matches freesvccred()'s refcount-aware path, and clear the pointer so a later freesvccred() on the same creds does not release it a second time.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Configuration
In gssx_dec_option_array(), move the assignment `oa->count = 1` so it is placed below the `oa->data` allocation; this prevents `oa->count` from being trusted when the allocation fails.
gssx_dec_option_array (Linux kernel SUNRPC gssx XDR option-array decoder) oa->count initialization order = Set oa->count = 1 after allocating oa->data - Configuration
In the `free_oa:` cleanup path, reset `oa->count` to `0` so `count` and `data` do not remain coupled in a state where `count` is non-zero but `oa->data` is NULL.
gssx_dec_option_array / free_oa (Linux kernel SUNRPC gssx XDR option-array decoder) oa->count reset behavior in free_oa = Set oa->count = 0 when freeing - Configuration
Before freeing `creds` with `kfree(creds)` at `free_creds`, call `free_svc_cred(creds)` first; this releases a partially decoded `svc_cred` and avoids leaking/wrapper-loss from a plain `kfree(creds)` that drops the wrapper.
gssx_dec_linux_creds() (Linux kernel SUNRPC gssx XDR option-array decoder) free_creds ordering = Call free_svc_cred(creds) before kfree(creds) - Configuration
Fix the error-path coupling in gssx_dec_linux_creds()’s `out_free_groups`/`free_oa` flow so that when `gssx_dec_option_array()` fails with `count=1 data=NULL`, the teardown does not leave partially freed/NULL-invalid state that can later cause NULL dereference in the caller or a use-after-free/touch of freed memory.
gssx_dec_linux_creds() (Linux kernel SUNRPC gssx XDR option-array decoder) free_oa/free_groups error-path NULL handling = Avoid teardown paths that assume oa->data when NULL
Event History
Frequently Asked Questions
What conditions are needed to reach the vulnerable error paths?
An allocation or decoding failure must occur while processing the gssx XDR option array or partially decoded Linux credentials. The provided data does not identify a remote attack vector, required privileges, or affected service configuration.
What failures can result from the flawed cleanup handling?
A failed option-array allocation or later decoder error can leave the option count set to 1 while its data pointer is NULL, causing the caller to dereference NULL. Cleanup of partially decoded credentials can leak the refcounted group_info object, and correcting that leak without the accompanying lifetime handling can expose a use-after-free.
How can an administrator determine whether the fix is present?
Verify whether the installed Linux kernel includes the stable commits referenced for this issue: 3ff45361e9469e85c0f86b8e7b82c63e50bab8ef, f85a83774d7f4e2ac71c0c384df0dfb6f7d0179a, and 5e9a94539b1ec17a89177d952badfd0d844d694a. The supplied data does not provide affected or fixed kernel version numbers.