Skip to contentSkip to conversation

module/decompress: Fix error checking on zstd decompression

PATCH In review Lucas De Marchi 2 participants 2 messages Jun 1, 2023 Module support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 module/decompress: Fix error checking on zstd decompression

While implementing support for in-kernel decompression in kmod, finit_module() was returning a very suspicious value:

	finit_module(3, "", MODULE_INIT_COMPRESSED_FILE) = 18446744072717407296

It turns out the check for module_get_next_page() failing is wrong, and hence the decompression was not really taking place. Invert the condition to fix it.

Fixes 169a58ad824d ("module/decompress: Support zstd in-kernel decompression")
Cc Luis Chamberlain <[email protected]>
Cc Dmitry Torokhov <[email protected]>
Cc Stephen Boyd <[email protected]>
---
 kernel/module/decompress.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/module/decompress.c +1 -1
index e97232b125eb..8a5d6d63b06c 100644
@@ -257,7 +257,7 @@ static ssize_t module_zstd_decompress(struct load_info *info,
 	do {
 		struct page *page = module_get_next_page(info);
 
-		if (!IS_ERR(page)) {
+		if (IS_ERR(page)) {
 			retval = PTR_ERR(page);
 			goto out;
 		}
Signature · 1 line
2.40.1
maintainer
#1 lore raw
Quoted 9 lines · Lucas De Marchi

While implementing support for in-kernel decompression in kmod, finit_module() was returning a very suspicious value:

	finit_module(3, "", MODULE_INIT_COMPRESSED_FILE) = 18446744072717407296

It turns out the check for module_get_next_page() failing is wrong, and hence the decompression was not really taking place. Invert the condition to fix it.

Quoted 6 lines
Fixes 169a58ad824d ("module/decompress: Support zstd in-kernel decompression")
Cc Luis Chamberlain <[email protected]>
Cc Dmitry Torokhov <[email protected]>
Cc Stephen Boyd <[email protected]>

Applied and pushed, will send a pull to Linus right away, thanks!

Luis