From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933391AbWF0J3A (ORCPT ); Tue, 27 Jun 2006 05:29:00 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S933074AbWF0J27 (ORCPT ); Tue, 27 Jun 2006 05:28:59 -0400 Received: from ns1.suse.de ([195.135.220.2]:8089 "EHLO mx1.suse.de") by vger.kernel.org with ESMTP id S933391AbWF0J27 (ORCPT ); Tue, 27 Jun 2006 05:28:59 -0400 Date: Tue, 27 Jun 2006 11:28:56 +0200 Message-ID: From: Takashi Iwai To: Dave Jones Cc: alsa-devel@lists.sourceforge.net, Linux Kernel Subject: Re: list corruption on removal of snd_seq_dummy In-Reply-To: <20060627032738.GA26575@redhat.com> References: <20060623031526.GB19461@redhat.com> <20060627032738.GA26575@redhat.com> User-Agent: Wanderlust/2.12.0 (Your Wildest Dreams) SEMI/1.14.6 (Maruoka) FLIM/1.14.7 (=?ISO-8859-4?Q?Sanj=F2?=) APEL/10.6 MULE XEmacs/21.5 (beta25) (eggplant) (+CVS-20060326) (i386-suse-linux) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org At Mon, 26 Jun 2006 23:27:38 -0400, Dave Jones wrote: > > On Fri, Jun 23, 2006 at 12:47:46PM +0200, Takashi Iwai wrote: > > > > The code in question is doing.. > > > > > > __list_add(&deleted_list, > > > client->ports_list_head.prev, > > > client->ports_list_head.next); > > > > > > which looks fishy, as those two elements aren't going to be consecutive, > > > as __list_add expects. > > > > I think the code behaves correctly but probably misusing __list_add(). > > It movies the whole entries from an existing list_head A > > (clients->ports_list_head) to a new list_head B (deleted_list). > > The above is exapnded: > > > > A->next->prev = B; > > B->next = A->next; > > B->prev = A->prev; > > A->prev->next = B; > > > > Any better way to achieve it using standard macros? > > Why can't you just list_move() the elements ? No, list_move() can't move the whole elements without loop. A solution is list_add(B, A); list_del_init(A); (although this introduces a bit more code :) Takashi