Commit 7be9ab63 authored by Chris Webb's avatar Chris Webb Committed by Kent Overstreet
Browse files

bcachefs: Return -ENOKEY/EINVAL when mount decryption fails



bch2_fs_encryption_init() correctly passes back -ENOKEY from request_key()
when no unlock key is found, or -EINVAL if superblock decryption fails
because of an invalid key. However, these get absorbed into a generic NULL
return from bch2_fs_alloc() and later returned to user space as -ENOMEM,
leading to a misleading error from mount(1):

  mount(2) system call failed: Out of memory.

Return explicit error pointers out of bch2_fs_alloc() and handle them in
both callers, so the user instead sees

  mount(2) system call failed: Required key not available.

when attempting to mount a filesystem which is still locked.

Signed-off-by: default avatarChris Webb <chris@arachsys.com>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 076c783c
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment