Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261550AbVDZSI1 (ORCPT ); Tue, 26 Apr 2005 14:08:27 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261566AbVDZSI1 (ORCPT ); Tue, 26 Apr 2005 14:08:27 -0400 Received: from relay.2ka.mipt.ru ([194.85.82.65]:12735 "EHLO 2ka.mipt.ru") by vger.kernel.org with ESMTP id S261550AbVDZSIN (ORCPT ); Tue, 26 Apr 2005 14:08:13 -0400 Date: Tue, 26 Apr 2005 22:07:13 +0400 From: Evgeniy Polyakov To: dtor_core@ameritech.net Cc: dmitry.torokhov@gmail.com, netdev@oss.sgi.com, Greg KH , Jamal Hadi Salim , Kay Sievers , Herbert Xu , James Morris , Guillaume Thouvenin , linux-kernel@vger.kernel.org, Andrew Morton , Thomas Graf , Jay Lan Subject: Re: [1/1] connector/CBUS: new messaging subsystem. Revision number next. Message-ID: <20050426220713.7915e036@zanzibar.2ka.mipt.ru> In-Reply-To: References: <20050411125932.GA19538@uganda.factory.vocord.ru> <20050426202437.234e7d45@zanzibar.2ka.mipt.ru> <20050426203023.378e4831@zanzibar.2ka.mipt.ru> Reply-To: johnpol@2ka.mipt.ru Organization: MIPT X-Mailer: Sylpheed-Claws 0.9.12b (GTK+ 1.2.10; i386-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-1.7.5 (2ka.mipt.ru [194.85.82.65]); Tue, 26 Apr 2005 22:07:29 +0400 (MSD) Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2387 Lines: 67 On Tue, 26 Apr 2005 12:34:13 -0500 Dmitry Torokhov wrote: > On 4/26/05, Evgeniy Polyakov wrote: > > > > --- orig/drivers/connector/connector.c > > +++ mod/drivers/connector/connector.c > > @@ -151,8 +151,8 @@ > > __cbq->ddata = data; > > __cbq->destruct_data = destruct_data; > > > > - queue_work(dev->cbdev->cn_queue, &__cbq->work); > > - found = 1; > > + if (queue_work(dev->cbdev->cn_queue, &__cbq->work)) > > + found = 1; > > break; > > What does it help exactly? By the time you checked result of > queue_work you have already corrupted work structure wuth the new data > (and probably destructor). > > Also, where is the rest of the code? Should we notify caller that > cn_netlink_send has dropped the message? And how do we do that? Yes, I found it too. Following patch should be the solution: --- orig/drivers/connector/connector.c +++ mod/drivers/connector/connector.c @@ -146,13 +146,16 @@ spin_lock_bh(&dev->cbdev->queue_lock); list_for_each_entry(__cbq, &dev->cbdev->queue_list, callback_entry) { if (cn_cb_equal(&__cbq->cb->id, &msg->id)) { - __cbq->cb->priv = msg; + + if (!test_bit(0, &work->pending)) { + __cbq->cb->priv = msg; - __cbq->ddata = data; - __cbq->destruct_data = destruct_data; + __cbq->ddata = data; + __cbq->destruct_data = destruct_data; - if (queue_work(dev->cbdev->cn_queue, &__cbq->work)) - found = 1; + if (queue_work(dev->cbdev->cn_queue, &__cbq->work)) + found = 1; + } break; } } > -- > Dmitry > Evgeniy Polyakov Only failure makes us experts. -- Theo de Raadt - 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/