public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* dynamic mtd_blktrans_dev not fully init'd under UBI?
@ 2007-11-30 20:58 catboat
  2007-12-01  9:28 ` David Woodhouse
  0 siblings, 1 reply; 3+ messages in thread
From: catboat @ 2007-11-30 20:58 UTC (permalink / raw)
  To: linux-mtd



Hi all,

I have a UBI system, and I notice this causes a kernel panic.
Make a volume that does not previously exist, eg 50:

     ubimkvol -d0 -n50 -N vol50 -s 640000 
     cat /dev/mtdblock/vol50  >/dev/null 

I get a panic in mtdblockd as it handles the block
requests generated by cat. 

In older versions, the struct semaphore of mtd_blktrans_dev
is not initialized, so the kernel panics in __down. 

In the newest git, I see a mutex named "lock" instead, but 
I don't think it's initialized either. See the function 
mtdblock_add_mtd() in drivers/mtd/mtdblock.c. The struct
mtd_blktrans_dev is just kzalloc'd leaving the mutex lock
all zeroes. 

Can anybody recreate this? 

Monte Copeland
IBM Austin

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

* Re: dynamic mtd_blktrans_dev not fully init'd under UBI?
  2007-11-30 20:58 dynamic mtd_blktrans_dev not fully init'd under UBI? catboat
@ 2007-12-01  9:28 ` David Woodhouse
  2007-12-01 17:00   ` catboat
  0 siblings, 1 reply; 3+ messages in thread
From: David Woodhouse @ 2007-12-01  9:28 UTC (permalink / raw)
  To: catboat; +Cc: linux-mtd

On Fri, 2007-11-30 at 14:58 -0600, catboat@texas.net wrote:
> In the newest git, I see a mutex named "lock" instead, but 
> I don't think it's initialized either. See the function 
> mtdblock_add_mtd() in drivers/mtd/mtdblock.c. The struct
> mtd_blktrans_dev is just kzalloc'd leaving the mutex lock
> all zeroes. 

diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index 74d9d30..839eed8 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -248,9 +248,9 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
 		return -EBUSY;
 	}
 
-	mutex_init(&new->lock);
 	list_add_tail(&new->list, &tr->devs);
  added:
+	mutex_init(&new->lock);
 	if (!tr->writesect)
 		new->readonly = 1;
 

-- 
dwmw2

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

* Re: dynamic mtd_blktrans_dev not fully init'd under UBI?
  2007-12-01  9:28 ` David Woodhouse
@ 2007-12-01 17:00   ` catboat
  0 siblings, 0 replies; 3+ messages in thread
From: catboat @ 2007-12-01 17:00 UTC (permalink / raw)
  To: David Woodhouse; +Cc: catboat, linux-mtd



Thanks David. 




Quoting David Woodhouse <dwmw2@infradead.org>:

> On Fri, 2007-11-30 at 14:58 -0600, catboat@texas.net wrote:
> > In the newest git, I see a mutex named "lock" instead, but 
> > I don't think it's initialized either. See the function 
> > mtdblock_add_mtd() in drivers/mtd/mtdblock.c. The struct
> > mtd_blktrans_dev is just kzalloc'd leaving the mutex lock
> > all zeroes. 
> 
> diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
> index 74d9d30..839eed8 100644
> --- a/drivers/mtd/mtd_blkdevs.c
> +++ b/drivers/mtd/mtd_blkdevs.c
> @@ -248,9 +248,9 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
>  		return -EBUSY;
>  	}
>  
> -	mutex_init(&new->lock);
>  	list_add_tail(&new->list, &tr->devs);
>   added:
> +	mutex_init(&new->lock);
>  	if (!tr->writesect)
>  		new->readonly = 1;
>  
> 
> -- 
> dwmw2
> 
> 
> 

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

end of thread, other threads:[~2007-12-01 17:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-30 20:58 dynamic mtd_blktrans_dev not fully init'd under UBI? catboat
2007-12-01  9:28 ` David Woodhouse
2007-12-01 17:00   ` catboat

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