public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* m25p80: missing MTD owner
@ 2012-10-01  8:01 Grégor Boirie
  2012-10-05  0:51 ` Marek Vasut
  0 siblings, 1 reply; 2+ messages in thread
From: Grégor Boirie @ 2012-10-01  8:01 UTC (permalink / raw)
  To: linux-mtd@lists.infradead.org

Hi all,

It seems possible to unload m25p80 module while a JFFS2 partition is
still mounted onto flash. This produces oops when MTD layer tries to
access underlying device later on.

A quick look at m25p_probe shows that "owner" field of allocated mtd
device structure is left uninitialized, preventing MTD layer from
incrementing module usage count. This patch for v3.4.11 solves the issue
for me :

@@ -873,6 +873,7 @@ static int __devinit m25p_probe(struct spi_device *spi)
        else
                flash->mtd.name = dev_name(&spi->dev);

+       flash->mtd.owner = THIS_MODULE;
        flash->mtd.type = MTD_NORFLASH;
        flash->mtd.writesize = 1;
        flash->mtd.flags = MTD_CAP_NORFLASH;


Regards.

-- 
Grégor Boirie
Software engineer
R&D / OS platform
tel +33 1 48 03 73 24
-----------------------------------------
Parrot
174, quai de Jemmapes
75010 Paris  France
tel + 33 1 48 03 60 60
fax + 33 1 48 03 06 66
-----------------------------------------
http://www.parrot.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: m25p80: missing MTD owner
  2012-10-01  8:01 m25p80: missing MTD owner Grégor Boirie
@ 2012-10-05  0:51 ` Marek Vasut
  0 siblings, 0 replies; 2+ messages in thread
From: Marek Vasut @ 2012-10-05  0:51 UTC (permalink / raw)
  To: linux-mtd; +Cc: Grégor Boirie

Dear Grégor Boirie,

> Hi all,
> 
> It seems possible to unload m25p80 module while a JFFS2 partition is
> still mounted onto flash. This produces oops when MTD layer tries to
> access underlying device later on.
> 
> A quick look at m25p_probe shows that "owner" field of allocated mtd
> device structure is left uninitialized, preventing MTD layer from
> incrementing module usage count. This patch for v3.4.11 solves the issue
> for me :
> 
> @@ -873,6 +873,7 @@ static int __devinit m25p_probe(struct spi_device *spi)
>         else
>                 flash->mtd.name = dev_name(&spi->dev);
> 
> +       flash->mtd.owner = THIS_MODULE;
>         flash->mtd.type = MTD_NORFLASH;
>         flash->mtd.writesize = 1;
>         flash->mtd.flags = MTD_CAP_NORFLASH;
> 
> 
> Regards.

Do you mind submitting a proper patch via git send-email please?

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-10-05  0:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-01  8:01 m25p80: missing MTD owner Grégor Boirie
2012-10-05  0:51 ` Marek Vasut

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox