lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20201008084954.f45lospaagookbwp@bogus>
Date:   Thu, 8 Oct 2020 09:49:54 +0100
From:   Sudeep Holla <sudeep.holla@....com>
To:     Jassi Brar <jassisinghbrar@...il.com>
Cc:     Jassi Brar <jaswinder.singh@...aro.org>,
        Viresh Kumar <viresh.kumar@...aro.org>,
        ALKML <linux-arm-kernel@...ts.infradead.org>,
        DTML <devicetree@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Frank Rowand <frowand.list@...il.com>,
        Bjorn Andersson <bjorn.andersson@...aro.org>,
        Rob Herring <robh@...nel.org>, Rob Herring <robh+dt@...nel.org>
Subject: Re: [PATCH 4/4] mailbox: arm_mhu: Add ARM MHU doorbell driver

On Wed, Oct 07, 2020 at 10:43:19AM -0500, Jassi Brar wrote:
> On Wed, Oct 7, 2020 at 6:40 AM Sudeep Holla <sudeep.holla@....com> 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 <sudeep.holla@....com> 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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ