Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751582Ab0AHHMG (ORCPT ); Fri, 8 Jan 2010 02:12:06 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750982Ab0AHHMF (ORCPT ); Fri, 8 Jan 2010 02:12:05 -0500 Received: from boogie.lpds.sztaki.hu ([193.224.70.237]:53717 "EHLO boogie.lpds.sztaki.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750934Ab0AHHME (ORCPT ); Fri, 8 Jan 2010 02:12:04 -0500 Date: Fri, 8 Jan 2010 08:12:00 +0100 From: Gabor Gombas To: "Zhang, Xiantao" Cc: Roel Kluin , "kvm-ia64@vger.kernel.org" , Andrew Morton , LKML Subject: Re: [PATCH] KVM: dereference of NULL pointer in set_pal_result() Message-ID: <20100108071200.GB15621@boogie.lpds.sztaki.hu> References: <4B465C2D.8030303@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Copyright: Forwarding or publishing without permission is prohibited. Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1449 Lines: 37 On Fri, Jan 08, 2010 at 07:28:57AM +0800, Zhang, Xiantao wrote: > 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. > > diff --git a/arch/ia64/kvm/kvm_fw.c b/arch/ia64/kvm/kvm_fw.c > > index e4b8231..d28494f 100644 > > --- a/arch/ia64/kvm/kvm_fw.c > > +++ b/arch/ia64/kvm/kvm_fw.c > > @@ -75,9 +75,11 @@ static void set_pal_result(struct kvm_vcpu *vcpu, > > struct exit_ctl_data *p; > > > > 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 -- --------------------------------------------------------- MTA SZTAKI Computer and Automation Research Institute Hungarian Academy of Sciences --------------------------------------------------------- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/