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: <20170725142816.GM30901@pali>
Date:   Tue, 25 Jul 2017 16:28:16 +0200
From:   Pali Rohár <pali.rohar@...il.com>
To:     Richard Weinberger <richard.weinberger@...il.com>
Cc:     Joern Engel <joern@...ybastard.org>,
        David Woodhouse <dwmw2@...radead.org>,
        Brian Norris <computersforpeace@...il.com>,
        Boris Brezillon <boris.brezillon@...e-electrons.com>,
        Marek Vasut <marek.vasut@...il.com>,
        Richard Weinberger <richard@....at>,
        Cyrille Pitchen <cyrille.pitchen@...el.com>,
        Artem Bityutskiy <dedekind1@...il.com>,
        "linux-mtd@...ts.infradead.org" <linux-mtd@...ts.infradead.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 3/5] mtd: block2mtd: Fallback to read-only mode

On Friday 21 July 2017 21:53:26 Richard Weinberger wrote:
> > @@ -240,6 +244,13 @@ static struct block2mtd_dev *add_device(char *devname, uint32_t erase_size,
> >         /* Get a handle on the device */
> >         bdev = blkdev_get_by_path(devname, mode, dev);
> >
> > +       /* Try fallback to read only mode */
> > +       if (IS_ERR(bdev)) {
> > +               bdev = blkdev_get_by_path(devname, FMODE_READ, dev);
> > +               if (!IS_ERR(bdev))
> > +                       dev->ro_mode = true;
> > +       }
> > +
> 
> Please use bdev_read_only() instead of blindly trying again with another mode.
> 
> >  #ifndef MODULE
> >         /*
> >          * We might not have the root device mounted at this point.
> > @@ -261,6 +272,13 @@ static struct block2mtd_dev *add_device(char *devname, uint32_t erase_size,
> >                 if (!devt)
> >                         continue;
> >                 bdev = blkdev_get_by_dev(devt, mode, dev);
> > +
> > +               /* Try fallback to read only mode */
> > +               if (IS_ERR(bdev)) {
> > +                       bdev = blkdev_get_by_path(devname, FMODE_READ, dev);
> > +                       if (!IS_ERR(bdev))
> > +                               dev->ro_mode = true;
> > +               }
> 
> Same here.

Ok, I will change it.

-- 
Pali Rohár
pali.rohar@...il.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ