Initialise scatter/gather list in sg driver
authorAnton Blanchard <anton@samba.org>
Fri, 26 Oct 2007 12:00:14 +0000 (14:00 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Mon, 29 Oct 2007 08:18:03 +0000 (09:18 +0100)
After turning on DEBUG_SG I hit a fail:

kernel BUG at include/linux/scatterlist.h:50!

sg_build_indirect
sg_build_reserve
sg_open
chrdev_open
__dentry_open
do_filp_open
do_sys_open

We should initialise the sg list when we allocate it in sg_build_sgat.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
drivers/scsi/sg.c

index b5fa4f091387eb83cdc9009e2050d0062fa9201f..f1871ea0404573e610ef439e8d377d0b4a7a1419 100644 (file)
@@ -1652,6 +1652,7 @@ sg_build_sgat(Sg_scatter_hold * schp, const Sg_fd * sfp, int tablesize)
        schp->buffer = kzalloc(sg_bufflen, gfp_flags);
        if (!schp->buffer)
                return -ENOMEM;
+       sg_init_table(schp->buffer, tablesize);
        schp->sglist_len = sg_bufflen;
        return tablesize;       /* number of scat_gath elements allocated */
 }