From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4187C43467 for ; Thu, 8 Oct 2020 08:51:33 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5258E20714 for ; Thu, 8 Oct 2020 08:51:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Cjqluf9S" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5258E20714 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=cMEq+fmF/8V/ab4RbRSWoVLto/W2vXJ3ZhktS+BmR5U=; b=Cjqluf9Sf9OB1epPjZKoWRjfB 75QlZZ2QQ19ufWDYyXbIBf8jdBGUJvM8y6MBs+Y77oRPdwGMJRbRr7ID9bB85svKSo1DAicz+r4zR amr9NGBQZTf+cRDxwn47ivQbMPDbLGEikpDPJeoWeoDq01hUJoNg399MC1tm3jfAJw9ntrLiht/Q5 x7LszzroNb+GzdfFx5lo/3b1QNKS4Sqyl6Q8SxE2T0k3w7IeS9MKyp8Q82UQpyl66x8vp3/hV72/u v+Y1IVOWkb5+Qi//Ojx7Io4hBpLaclG6hZTZGZ1vU7hv+2P8fPCJWK+qy18MpQg9tKjEwsnQfe+mL Zkh4TRWLw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kQRcl-0006G8-EV; Thu, 08 Oct 2020 08:50:07 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kQRci-0006FT-8P for linux-arm-kernel@lists.infradead.org; Thu, 08 Oct 2020 08:50:05 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5B2171042; Thu, 8 Oct 2020 01:50:02 -0700 (PDT) Received: from bogus (unknown [10.57.53.233]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C6E673F70D; Thu, 8 Oct 2020 01:50:00 -0700 (PDT) Date: Thu, 8 Oct 2020 09:49:54 +0100 From: Sudeep Holla To: Jassi Brar Subject: Re: [PATCH 4/4] mailbox: arm_mhu: Add ARM MHU doorbell driver Message-ID: <20201008084954.f45lospaagookbwp@bogus> References: <20200928114445.19689-1-sudeep.holla@arm.com> <20200928114445.19689-5-sudeep.holla@arm.com> <20201007114034.rkiujybiknaedy7m@bogus> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20171215 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201008_045004_354407_758506E5 X-CRM114-Status: GOOD ( 23.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: DTML , Vincent Guittot , Rob Herring , Viresh Kumar , LKML , Bjorn Andersson , Jassi Brar , Rob Herring , Frank Rowand , ALKML Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Oct 07, 2020 at 10:43:19AM -0500, Jassi Brar wrote: > On Wed, Oct 7, 2020 at 6:40 AM Sudeep Holla wrote: > > > > On Fri, Oct 02, 2020 at 02:42:37PM -0500, Jassi Brar wrote: > > > On Mon, Sep 28, 2020 at 6:45 AM Sudeep Holla wrote: > > > > > > > + > > > > +static void mhu_db_shutdown(struct mbox_chan *chan) > > > > +{ > > > > + struct mhu_db_channel *chan_info = chan->con_priv; > > > > + struct mbox_controller *mbox = &chan_info->mhu->mbox; > > > > + int i; > > > > + > > > > + for (i = 0; i < mbox->num_chans; i++) > > > > + if (chan == &mbox->chans[i]) > > > > + break; > > > > + > > > > + if (mbox->num_chans == i) { > > > > + dev_warn(mbox->dev, "Request to free non-existent channel\n"); > > > > + return; > > > > + } > > > > + > > > > + /* Reset channel */ > > > > + mhu_db_mbox_clear_irq(chan); > > > > + chan->con_priv = NULL; > > > > > > > request->free->request will fail because of this NULL assignment. > > > Maybe add a 'taken' flag in mhu_db_channel, which should also be > > > checked before calling mbox_chan_received_data because the data may > > > arrive for a now relinquished channel. > > > > > > > Good point, but the new 'taken' flag will have the same race as con_priv. > > We need a lock here and can we use chan->lock or do you prefer this > > driver maintains it own for this purpose. > > > I meant the con_priv is allocated in mhu_db_mbox_xlate and simply > assigning it NULL leaks memory, if not a crash by some other path. At > least free it before. > Ah right, sorry got confused. Too much reliance on devm_* apis and I didn't realise it was not in probe but in xlate which is mbox_startup path. Fixed now, will post v2 with both issues addressed. -- Regards, Sudeep _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel