Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932998AbdHVNhT (ORCPT ); Tue, 22 Aug 2017 09:37:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36100 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932833AbdHVNhQ (ORCPT ); Tue, 22 Aug 2017 09:37:16 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B3937806C0 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=pbonzini@redhat.com Subject: Re: [PATCH] virt/kvm avoids oops by adding parameter checking To: nixiaoming , rkrcmar@redhat.com Cc: kvm@vger.kernel.org, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org References: <20170822010909.103060-1-nixiaoming@huawei.com> From: Paolo Bonzini Message-ID: Date: Tue, 22 Aug 2017 15:37:15 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170822010909.103060-1-nixiaoming@huawei.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 22 Aug 2017 13:37:15 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 492 Lines: 16 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 No. It's simply a precondition that kvm != NULL in this case. Paolo