Fix for 4.4-rc7
PATCH 1/1 Fix for 4.4-rc7
Hi Jens,
Sorry for sending a patch so late. I found a bug upon generic media manager initialization, followed by bad block list traversal, leading to a faulty out-of-bound memory access. Unfortunately, the media manager is initialized just after device initialization. In most cases the kernel will crash upon boot when a device that supports multiple channels is available.
Could you please pick this one up?
Thanks,
Matias
Matias Bjørling (1):
lightnvm: wrong offset in bad blk lun calculation
drivers/lightnvm/gennvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
2.1.4
PATCH 1/1 lightnvm: wrong offset in bad blk lun calculation
dev->nr_luns reports the total number of luns available in a device while dev->luns_per_chnl is the number of luns per channel.
When multiple channels are available, the offset is calculated from a channel and lun id into a linear array. As it multiplies with the total number of luns, we go out of bound when channel id > 0 and causes the kernel to panic when we read a protected kernel memory area.
--- drivers/lightnvm/gennvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/lightnvm/gennvm.c +1 -1
@@ -75,7 +75,7 @@ static int gennvm_block_bb(struct ppa_addr ppa, int nr_blocks, u8 *blks,struct nvm_block *blk;int i; - lun = &gn->luns[(dev->nr_luns * ppa.g.ch) + ppa.g.lun]; + lun = &gn->luns[(dev->luns_per_chnl * ppa.g.ch) + ppa.g.lun];for (i =0 ; i < nr_blocks; i++) {if (blks[i] ==0 )
Signature · 1 line
2.1.4
Re: [PATCH] lightnvm: wrong offset in bad blk lun calculation
Quoted 7 lines · Matias Bjørling
dev->nr_lunsreports the total number of luns available in a device whiledev->luns_per_chnlis the number of luns per channel.When multiple channels are available, the offset is calculated from a channel and lun id into a linear array. As it multiplies with the total number of luns, we go out of bound when channel id > 0 and causes the kernel to panic when we read a protected kernel memory area.
Added for 4.4, thanks.
Signature · 1 line
Jens Axboe