* efi_loader: efi_variable_parse_signature() returns NULL on error
@ 2020-05-07 0:13 Patrick Wildt
2020-05-07 7:14 ` AKASHI Takahiro
2020-05-07 7:15 ` AKASHI Takahiro
0 siblings, 2 replies; 5+ messages in thread
From: Patrick Wildt @ 2020-05-07 0:13 UTC (permalink / raw)
To: u-boot
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.
Signed-off-by: Patrick Wildt <patrick@blueri.se>
diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c
index 58f8fae358..c5fe896de2 100644
--- a/lib/efi_loader/efi_variable.c
+++ b/lib/efi_loader/efi_variable.c
@@ -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;
}
^ permalink raw reply related [flat|nested] 5+ messages in thread
* efi_loader: efi_variable_parse_signature() returns NULL on error
2020-05-07 0:13 efi_loader: efi_variable_parse_signature() returns NULL on error Patrick Wildt
@ 2020-05-07 7:14 ` AKASHI Takahiro
2020-05-07 7:15 ` AKASHI Takahiro
1 sibling, 0 replies; 5+ messages in thread
From: AKASHI Takahiro @ 2020-05-07 7:14 UTC (permalink / raw)
To: u-boot
On Thu, May 07, 2020 at 02:13:18AM +0200, Patrick Wildt wrote:
> 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.
>
> Signed-off-by: Patrick Wildt <patrick@blueri.se>
Reviewed-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
>
> diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c
> index 58f8fae358..c5fe896de2 100644
> --- a/lib/efi_loader/efi_variable.c
> +++ b/lib/efi_loader/efi_variable.c
> @@ -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;
> }
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* efi_loader: efi_variable_parse_signature() returns NULL on error
2020-05-07 0:13 efi_loader: efi_variable_parse_signature() returns NULL on error Patrick Wildt
2020-05-07 7:14 ` AKASHI Takahiro
@ 2020-05-07 7:15 ` AKASHI Takahiro
2020-05-07 13:53 ` Heinrich Schuchardt
1 sibling, 1 reply; 5+ messages in thread
From: AKASHI Takahiro @ 2020-05-07 7:15 UTC (permalink / raw)
To: u-boot
On Thu, May 07, 2020 at 02:13:18AM +0200, Patrick Wildt wrote:
> 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.
>
> Signed-off-by: Patrick Wildt <patrick@blueri.se>
Reviewed-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
>
> diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c
> index 58f8fae358..c5fe896de2 100644
> --- a/lib/efi_loader/efi_variable.c
> +++ b/lib/efi_loader/efi_variable.c
> @@ -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;
> }
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* efi_loader: efi_variable_parse_signature() returns NULL on error
2020-05-07 7:15 ` AKASHI Takahiro
@ 2020-05-07 13:53 ` Heinrich Schuchardt
2020-05-07 23:18 ` Patrick Wildt
0 siblings, 1 reply; 5+ messages in thread
From: Heinrich Schuchardt @ 2020-05-07 13:53 UTC (permalink / raw)
To: u-boot
On 07.05.20 09:15, AKASHI Takahiro wrote:
> On Thu, May 07, 2020 at 02:13:18AM +0200, Patrick Wildt wrote:
>> efi_variable_parse_signature() returns NULL on error, so IS_NULL()
IS_NULL() seems to be a typo. I will replace it by IS_ERR() when merging.
>> is an incorrect check. The goto err leads to pkcs7_free_message(),
>> which works fine on a NULL ptr.
>>
>> Signed-off-by: Patrick Wildt <patrick@blueri.se>
>
> Reviewed-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
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
>
>>
>> diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c
>> index 58f8fae358..c5fe896de2 100644
>> --- a/lib/efi_loader/efi_variable.c
>> +++ b/lib/efi_loader/efi_variable.c
>> @@ -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;
>> }
>>
^ permalink raw reply [flat|nested] 5+ messages in thread
* efi_loader: efi_variable_parse_signature() returns NULL on error
2020-05-07 13:53 ` Heinrich Schuchardt
@ 2020-05-07 23:18 ` Patrick Wildt
0 siblings, 0 replies; 5+ messages in thread
From: Patrick Wildt @ 2020-05-07 23:18 UTC (permalink / raw)
To: u-boot
On Thu, May 07, 2020 at 03:53:29PM +0200, Heinrich Schuchardt wrote:
> On 07.05.20 09:15, AKASHI Takahiro wrote:
> > On Thu, May 07, 2020 at 02:13:18AM +0200, Patrick Wildt wrote:
> >> efi_variable_parse_signature() returns NULL on error, so IS_NULL()
>
> IS_NULL() seems to be a typo. I will replace it by IS_ERR() when merging.
Hi,
Yes, sorry.
> >> is an incorrect check. The goto err leads to pkcs7_free_message(),
> >> which works fine on a NULL ptr.
> >>
> >> Signed-off-by: Patrick Wildt <patrick@blueri.se>
> >
> > Reviewed-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
>
> 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
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
> >
> >>
> >> diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c
> >> index 58f8fae358..c5fe896de2 100644
> >> --- a/lib/efi_loader/efi_variable.c
> >> +++ b/lib/efi_loader/efi_variable.c
> >> @@ -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;
> >> }
> >>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-05-07 23:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-07 0:13 efi_loader: efi_variable_parse_signature() returns NULL on error Patrick Wildt
2020-05-07 7:14 ` AKASHI Takahiro
2020-05-07 7:15 ` AKASHI Takahiro
2020-05-07 13:53 ` Heinrich Schuchardt
2020-05-07 23:18 ` Patrick Wildt
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.