]> git.karo-electronics.de Git - karo-tx-linux.git/commit
We leak in drivers/scsi/aacraid/commctrl.c::aac_send_raw_srb() :
authorJesper Juhl <jj@chaosbits.net>
Tue, 26 Jul 2011 10:14:49 +0000 (20:14 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 29 Jul 2011 05:49:13 +0000 (15:49 +1000)
commit88c1818963a7a4431e29073ea251b83cd4a57512
tree157d333cda29ec28c1cb6ca421e2d55bddce2442
parent99ad25649ebea704704110c669fa8906ce183d25
We leak in drivers/scsi/aacraid/commctrl.c::aac_send_raw_srb() :

We allocate memory:
        ...
                        struct user_sgmap* usg;
                        usg = kmalloc(actual_fibsize - sizeof(struct aac_srb)
                          + sizeof(struct sgmap), GFP_KERNEL);
and then neglect to free it:
        ...
                        for (i = 0; i < usg->count; i++) {
                                u64 addr;
                                void* p;
                                if (usg->sg[i].count >
                                    ((dev->adapter_info.options &
                                     AAC_OPT_NEW_COMM) ?
                                      (dev->scsi_host_ptr->max_sectors << 9) :
                                      65536)) {
                                        rcode = -EINVAL;
                                        goto cleanup;
        ... this 'goto' makes 'usg' go out of scope and leak the memory we
            allocated.
            Other exits properly kfree(usg), it's just here it is neglected.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/scsi/aacraid/commctrl.c