efi_loader: efi_variable_parse_signature() returns NULL on error
efi_variable_parse_signature() returns NULL on error, so IS_NULL() is an incorrect check. The goto err leads to pkcs7_free_message(), which works fine on a NULL ptr.
lib/efi_loader/efi_variable.c +1 -2
@@ -519,9 +519,8 @@ static efi_status_t efi_variable_authenticate(u16 *variable, var_sig =efi_variable_parse_signature (auth->auth_info.cert_data, auth->auth_info.hdr.dwLength -sizeof (auth->auth_info)); -if (IS_ERR (var_sig)) { +if (!var_sig) {debug ("Parsing variable's signature failed\n" ); - var_sig =NULL ; goto err; }
AKASHI Takahiro
Reviewed-byQuoted 5 lines · Patrick Wildt
efi_variable_parse_signature()returns NULL on error, soIS_NULL()is an incorrect check. The goto err leads topkcs7_free_message(), which works fine on a NULL ptr.Signed-off-by Patrick Wildt <[email protected]>
Quoted 16 lines
lib/efi_loader/efi_variable.c +1
-2@@ -519,9 +519,8 @@ static efi_status_t efi_variable_authenticate(u16 *variable, var_sig =efi_variable_parse_signature (auth->auth_info.cert_data, auth->auth_info.hdr.dwLength -sizeof (auth->auth_info)); -if (IS_ERR (var_sig)) { +if (!var_sig) {debug ("Parsing variable's signature failed\n" ); - var_sig =NULL ; goto err; }
AKASHI Takahiro
Reviewed-byQuoted 5 lines · Patrick Wildt
efi_variable_parse_signature()returns NULL on error, soIS_NULL()is an incorrect check. The goto err leads topkcs7_free_message(), which works fine on a NULL ptr.Signed-off-by Patrick Wildt <[email protected]>
Quoted 16 lines
lib/efi_loader/efi_variable.c +1
-2@@ -519,9 +519,8 @@ static efi_status_t efi_variable_authenticate(u16 *variable, var_sig =efi_variable_parse_signature (auth->auth_info.cert_data, auth->auth_info.hdr.dwLength -sizeof (auth->auth_info)); -if (IS_ERR (var_sig)) { +if (!var_sig) {debug ("Parsing variable's signature failed\n" ); - var_sig =NULL ; goto err; }
Quoted 2 lines · AKASHI Takahiro
Quoted 1 line · Patrick Wildt
efi_variable_parse_signature()returns NULL on error, soIS_NULL()
IS_NULL() seems to be a typo. I will replace it by IS_ERR() when merging.
Quoted 6 lines
Quoted 4 lines
is an incorrect check. The goto err leads to
pkcs7_free_message(), which works fine on a NULL ptr.Signed-off-by Patrick Wildt <[email protected]>Reviewed-by AKASHI Takahiro <[email protected]>
Hello Takahiro,
there is a second instance of the same error:
lib/efi_loader/efi_variable.c:412:
??????? msg = pkcs7_parse_message(ebuf, ebuflen);
??????? free(ebuf);
out:
????????if (IS_ERR(msg))
????????????????return NULL;
Please, send a patch for that one too.
Best regards
Heinrich
Quoted 17 lines
Quoted 17 lines
lib/efi_loader/efi_variable.c +1
-2@@ -519,9 +519,8 @@ static efi_status_t efi_variable_authenticate(u16 *variable, var_sig =efi_variable_parse_signature (auth->auth_info.cert_data, auth->auth_info.hdr.dwLength -sizeof (auth->auth_info)); -if (IS_ERR (var_sig)) { +if (!var_sig) {debug ("Parsing variable's signature failed\n" ); - var_sig =NULL ; goto err; }
Quoted 5 lines · Heinrich Schuchardt
Quoted 2 lines · AKASHI Takahiro
Quoted 1 line · Patrick Wildt
efi_variable_parse_signature()returns NULL on error, soIS_NULL()
IS_NULL()seems to be a typo. I will replace it byIS_ERR()when merging.
Hi,
Yes, sorry.
Quoted 19 lines
Quoted 6 lines
Quoted 4 lines
is an incorrect check. The goto err leads to
pkcs7_free_message(), which works fine on a NULL ptr.Signed-off-by Patrick Wildt <[email protected]>Reviewed-by AKASHI Takahiro <[email protected]>Hello Takahiro,
there is a second instance of the same error:
lib/efi_loader/efi_variable.c:412:??????? msg =
pkcs7_parse_message(ebuf, ebuflen);
??????? free(ebuf);
out:
????????if (IS_ERR(msg))
????????????????return NULL;
Quoted 5 lines
Please, send a patch for that one too.
Best regards
Heinrich
No, that is ok. pkcs7_parse_message() returns an ERR_PTR() on failure, as you saw in my other diff. That's why IS_ERR(msg) is fine here, and we can return NULL.
Best regards,
Patrick
Quoted 18 lines
Quoted 17 lines
Quoted 17 lines
lib/efi_loader/efi_variable.c +1
-2@@ -519,9 +519,8 @@ static efi_status_t efi_variable_authenticate(u16 *variable, var_sig =efi_variable_parse_signature (auth->auth_info.cert_data, auth->auth_info.hdr.dwLength -sizeof (auth->auth_info)); -if (IS_ERR (var_sig)) { +if (!var_sig) {debug ("Parsing variable's signature failed\n" ); - var_sig =NULL ; goto err; }