]> 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>
Wed, 3 Aug 2011 00:52:45 +0000 (10:52 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 3 Aug 2011 04:19:19 +0000 (14:19 +1000)
commitcf3b1e0af7f2a50c6478b4d47b5f0bcf86d335f5
tree8d566fac517a7e177f62d1e147e455af2be3cfab
parenta53e7ef3960c930465c2e2ead1c138021bf9c63f
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