Re: [PATCH] virt/kvm avoids oops by adding parameter checking
From: Paolo Bonzini
Date: Tue Aug 22 2017 - 09:37:22 EST
On 22/08/2017 03:09, nixiaoming wrote:
> The error parameter passed through the external interface causes the system oops.
> So it is necessary to increase the parameter check for all EXPORT_SYMBOL_GPL
>
> example:
> void kvm_get_kvm(struct kvm *kvm)
> {
> refcount_inc(&kvm->users_count); /*oops if kvm == NULL */
> }
> EXPORT_SYMBOL_GPL(kvm_get_kvm);
>
> Signed-off-by: nixiaoming <nixiaoming@xxxxxxxxxx>
No. It's simply a precondition that kvm != NULL in this case.
Paolo