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

From: roel kluin
Date: Fri Jan 08 2010 - 07:25:57 EST


>> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/