Commit b336e40c authored by Thomas Huth's avatar Thomas Huth Committed by Ard Biesheuvel
Browse files

efi: pstore: Drop efivar lock when efi_pstore_open() returns with an error



If kzalloc fails, the function returns -ENOMEM without calling
efivar_unlock(). Since open() returned  an error, the calling site
in pstore_get_backend_records() won't call the close() function, so
the lock is never released. Thus drop the lock in case of errors here.

Fixes: 85974825 ("efi: pstore: Omit efivars caching EFI varstore access layer")
Assisted-by: Claude:claude-opus-4-6
Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
parent a9e8765f
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -60,8 +60,10 @@ static int efi_pstore_open(struct pstore_info *psi)
		return err;

	psi->data = kzalloc(record_size, GFP_KERNEL);
	if (!psi->data)
	if (!psi->data) {
		efivar_unlock();
		return -ENOMEM;
	}

	return 0;
}