From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xiao Guangrong Subject: Re: [PATCH 2/6] KVM MMU: fix kvm_mmu_zap_page() and its calling path Date: Mon, 12 Apr 2010 17:22:28 +0800 Message-ID: <4BC2E654.7050002@cn.fujitsu.com> References: <4BC2D2E2.1030604@cn.fujitsu.com> <4BC2D345.100@cn.fujitsu.com> <4BC2D8D6.6030306@redhat.com> <4BC2DFA0.6000609@cn.fujitsu.com> <4BC2E2FF.9020005@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , KVM list , LKML To: Avi Kivity Return-path: In-Reply-To: <4BC2E2FF.9020005@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org Hi Avi, Avi Kivity wrote: > hlist_for_each_entry_safe() is supposed to be be safe against removal of > the element that is pointed to by the iteration cursor. If we destroyed the next point, hlist_for_each_entry_safe() is unsafe. List hlist_for_each_entry_safe()'s code: |#define hlist_for_each_entry_safe(tpos, pos, n, head, member) \ | for (pos = (head)->first; \ | pos && ({ n = pos->next; 1; }) && \ | ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ | pos = n) if n is destroyed: 'pos = n, n = pos->next' then it access n again, it's unsafe/illegal for us. Xiao