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]
Date:	Wed, 17 Sep 2014 16:18:33 -0400 (EDT)
From:	Rodrigo Freire <rfreire@...hat.com>
To:	Jörn Engel <joern@...fs.org>
Cc:	dwmw2 <dwmw2@...radead.org>, nbd@...nwrt.org,
	computersforpeace@...il.com, linux-kernel@...r.kernel.org,
	herton@...hat.com, linux-mtd@...ts.infradead.org
Subject: Re: [PATCH] block2mtd: mtd: Present block2mtd timely on boot time

Hi Jörn,

----- Original Message ----- 
From: "Jörn Engel" <joern@...fs.org> 
> On Mon, 8 September 2014 16:04:40 -0400, Rodrigo Freire wrote: 
> > 
> > @@ -257,13 +281,15 @@ static struct block2mtd_dev *add_device( 
> > 
> > /* Setup the MTD structure */ 
> > /* make the name contain the block device in */ 
> > - name = kasprintf(GFP_KERNEL, "block2mtd: %s", devname); 
> > + if (!mtdname) 
> > + mtdname = devname; 
> > + name = kmalloc(strlen(mtdname) + 1, GFP_KERNEL); 
> > if (!name) 
> > goto err_destroy_mutex; 
> > 
> > + strcpy(name, mtdname); 
> kstrdup. 
> And see below for the ABI change. 

Thanks for pointing. Fixed.


> >  	dev->mtd.name = name;
> > -
> > -	dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK;
> > +	dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK & ~(erase_size - 1);
> 
> PAGE_MASK is no longer needed with the new term.  Or does anyone
> seriously want to support erase_size < PAGE_SIZE?

Makes sense. I was talking to Felix and indeed there are some MTD devices 
which have 4k erase page size. Unheard of something smaller.
But it is on the MTD land and not block2mtd.


> Timeout has a default value, but name defaults to NULL. Add three 
> devices without specifying the name and you get funny results. 
> If we handled the NULL case by doing what the driver used to do before 
> this patch, I think this would be fine. 

Please see the fragment below:

@@ -257,13 +281,15 @@ static struct block2mtd_dev *add_device(
 
 	/* Setup the MTD structure */
 	/* make the name contain the block device in */
-	name = kasprintf(GFP_KERNEL, "block2mtd: %s", devname);
+	if (!mtdname)
+		mtdname = devname;
+	name = kstrdup(mtdname, GFP_KERNEL);
 	if (!name)
 		goto err_destroy_mutex;

If the name is a NULL or not provided, the mtdname will then become the mtd device name.
I also tried mounting several partitions, with both specified name and not and everything seemed to work nicely.

See a V2 patch on the next message.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ