Skip to content

Commit e698aaf

Browse files
Toreg87kees
authored andcommitted
pstore: fix crypto dependencies without compression
Commit 58eb5b6 ("pstore: fix crypto dependencies") fixed up the crypto dependencies but missed the case when no compression is selected. With CONFIG_PSTORE=y, CONFIG_PSTORE_COMPRESS=n and CONFIG_CRYPTO=m we see the following link error: fs/pstore/platform.o: In function `pstore_register': (.text+0x1b1): undefined reference to `crypto_has_alg' (.text+0x205): undefined reference to `crypto_alloc_base' fs/pstore/platform.o: In function `pstore_unregister': (.text+0x3b0): undefined reference to `crypto_destroy_tfm' Fix this by checking at compile-time if CONFIG_PSTORE_COMPRESS is enabled. Fixes: 58eb5b6 ("pstore: fix crypto dependencies") Signed-off-by: Tobias Regnery <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Signed-off-by: Kees Cook <[email protected]>
1 parent 58eb5b6 commit e698aaf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/pstore/platform.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ static int pstore_decompress(void *in, void *out,
258258

259259
static void allocate_buf_for_compression(void)
260260
{
261-
if (!zbackend)
261+
if (!IS_ENABLED(CONFIG_PSTORE_COMPRESS) || !zbackend)
262262
return;
263263

264264
if (!crypto_has_comp(zbackend->name, 0, 0)) {
@@ -287,7 +287,7 @@ static void allocate_buf_for_compression(void)
287287

288288
static void free_buf_for_compression(void)
289289
{
290-
if (!IS_ERR_OR_NULL(tfm))
290+
if (IS_ENABLED(CONFIG_PSTORE_COMPRESS) && !IS_ERR_OR_NULL(tfm))
291291
crypto_free_comp(tfm);
292292
kfree(big_oops_buf);
293293
big_oops_buf = NULL;

0 commit comments

Comments
 (0)