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] [thread-next>] [day] [month] [year] [list]
Message-ID: <11654b05dd8fb87e195aed20cbdaa22d8856b072.camel@ew.tq-group.com>
Date:   Tue, 25 Aug 2020 14:00:38 +0200
From:   Matthias Schiffer <matthias.schiffer@...tq-group.com>
To:     Ulf Hansson <ulf.hansson@...aro.org>
Cc:     Sascha Hauer <s.hauer@...gutronix.de>,
        "linux-mmc@...r.kernel.org" <linux-mmc@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: (EXT) Re: [PATCH mmc-next v2] mmc: allow setting slot index via
 device tree alias

On Tue, 2020-08-25 at 11:39 +0200, Matthias Schiffer wrote:
> On Tue, 2020-08-25 at 11:14 +0200, Ulf Hansson wrote:
> > On Thu, 20 Aug 2020 at 09:59, Matthias Schiffer
> > <matthias.schiffer@...tq-group.com> wrote:
> > > --- a/drivers/mmc/core/host.c
> > > +++ b/drivers/mmc/core/host.c
> > > @@ -387,6 +387,7 @@ struct mmc_host *mmc_alloc_host(int extra,
> > > struct device *dev)
> > >  {
> > >         int err;
> > >         struct mmc_host *host;
> > > +       int alias_id, min_idx, max_idx;
> > > 
> > >         host = kzalloc(sizeof(struct mmc_host) + extra,
> > > GFP_KERNEL);
> > >         if (!host)
> > > @@ -395,7 +396,18 @@ struct mmc_host *mmc_alloc_host(int extra,
> > > struct device *dev)
> > >         /* scanning will be enabled when we're ready */
> > >         host->rescan_disable = 1;
> > > 
> > > -       err = ida_simple_get(&mmc_host_ida, 0, 0, GFP_KERNEL);
> > > +       host->parent = dev;
> > > +
> > > +       alias_id = mmc_get_reserved_index(host);
> > > +       if (alias_id >= 0) {
> > > +               min_idx = alias_id;
> > > +               max_idx = alias_id + 1;
> > > +       } else {
> > > +               min_idx = mmc_first_nonreserved_index();
> > > +               max_idx = 0;
> > > +       }
> > > +
> > > +       err = ida_simple_get(&mmc_host_ida, min_idx, max_idx,
> > > GFP_KERNEL);


One more question I came across when reworking my patch: Do we need a
fallback here for the case where the reserved index is already taken?
To handle an SD card being replaced while still mounted?


> > >         if (err < 0) {
> > >                 kfree(host);
> > >                 return NULL;
> > > @@ -406,7 +418,6 @@ struct mmc_host *mmc_alloc_host(int extra,
> > > struct device *dev)
> > >         dev_set_name(&host->class_dev, "mmc%d", host->index);
> > >         host->ws = wakeup_source_register(NULL, dev_name(&host-
> > > > class_dev));
> > > 
> > > -       host->parent = dev;
> > >         host->class_dev.parent = dev;
> > >         host->class_dev.class = &mmc_host_class;
> > >         device_initialize(&host->class_dev);
> > > --
> > > 2.17.1
> > > 
> > 
> > Kind regards
> > Uffe

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ