Re: 2.6.20.3: kernel BUG at mm/slab.c:597 try#2

Pekka Enberg
2007-03-19T08:32:06Z

On 3/19/07, Pekka Enberg <penberg@cs.helsinki.fi> wrote:
> EIP is at kmem_cache_free+0x29/0x5a
> eax: c1800000 ebx: f0ae12c0 ecx: c18f73c0 edx: c1800000
> esi: c1919de0 edi: 00000000 ebp: 00001000 esp: f1fe7e14
> ds: 007b es: 007b ss: 0068
>
> But somehow eax and edx have the same value 0xc1800000 here. Hmm?

Aah, but if you look at contents of the stack:

Stack: f0ae12c0 c1919de0 ffffffea c0137f97 00000000 f0ae12c0 c1919e20 c0168d45
f0ae12c0 00001000 c0168fb9 c02a77e3 00001000 00000000 00000000 00000000
00000000 c17bb6e0 00001000 00000000 f1b38be8 00000003 f54ac050 c1b9d6e8
Call Trace:
[<c0137f97>] mempool_free+0x48/0x4c
[<c0168d45>] bio_free+0x21/0x2c
[<c0168fb9>] bio_put+0x22/0x23

You can see that mempool_free is passing a NULL pointer to
kmem_cache_free() which doesn't handle it properly. The NULL pointer
comes from bio_free() where ->bi_io_vec is NULL because nr_iovecs
passed to bio_alloc_bioset() was zero.

The question is, why is nr_pages zero in scsi_req_map_sg()?