Re: [PATCH] KVM: dereference of NULL pointer in set_pal_result()

roel kluin <[email protected]>
Newsgroups org.kernel.vger.kvm-ia64,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
>> For the check "(p && p->exit_reason = EXIT_REASON_PAL_CALL", if p is NULL, the reference about "p->exit_reason = EXIT_REASON_PAL_CALL" won't be checked any more, so no issue here.

>> >     p = kvm_get_exit_data(vcpu);
>> > -   if (p && p->exit_reason = EXIT_REASON_PAL_CALL) {
>> > +   if (!p)
>> > +           return;
>> > +   if (p->exit_reason = EXIT_REASON_PAL_CALL) {
>> >             p->u.pal_data.ret = result;
>> > -           return ;
>> > +           return;
>> >     }
>> >     INIT_PAL_STATUS_UNIMPLEMENTED(p->u.pal_data.ret);
>
> IMHO it's not the test but the INIT_PAL_STATUS_UNIMPLEMENTED() that does
> the unwanted dereferencing, and that's fixed by the patch.
>
> Gabor

Correct. Thanks,

Roel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.