[PATCH] keys: big_key: Reserve the final quota before destroying the payload
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Fri Oct 16 04:07:11 UTC 2026
> A big_key is charged a fixed 16 bytes of key quota, regardless of the
> actual payload size. big_key_update() currently reserves the actual new
> payload length before destroying the old payload, while the subsequent
> generic_key_instantiate() reserves the fixed quota length.
>
> For an update to a payload shorter than 16 bytes, the first reservation
> temporarily returns quota. Another key operation by the same user can
> consume that quota before generic_key_instantiate() tries to reserve it
> again. If that second reservation fails, the key remains instantiated but
> its old big_key payload has already been destroyed. Reading a
> buffer-backed key or revoking a shmem-backed key then dereferences a NULL
> payload pointer.
>
> On a KASAN build, reading a buffer-backed key reports:
>
> [ ... ]
>
> Fixes: b6f61c314649 ("keys: Implement update for the big_key type")
> Cc: stable at vger.kernel.org
> Assisted-by: LLM
> Signed-off-by: Daehyeon Ko <4ncienth at gmail.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261016040004.324286-1-4ncienth@gmail.com?part=1
More information about the Linux-security-module-archive
mailing list