[SCSI] mptfusion: Fix memory leak in mptctl_getiocinfo()
authorJesper Juhl <jj@chaosbits.net>
Sun, 26 Dec 2010 21:14:01 +0000 (22:14 +0100)
committerJames Bottomley <James.Bottomley@suse.de>
Mon, 24 Jan 2011 17:42:10 +0000 (11:42 -0600)
A 'kfree(karg)' is missing in a failure path in
mptctl.c::mptctl_getiocinfo() which can cause a memory leak.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Acked-by: "Desai, Kashyap" <Kashyap.Desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
drivers/message/fusion/mptctl.c

index a3856ed..1dcc13a 100644 (file)
@@ -1307,8 +1307,10 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
        else
                karg->adapterType = MPT_IOCTL_INTERFACE_SCSI;
 
-       if (karg->hdr.port > 1)
+       if (karg->hdr.port > 1) {
+               kfree(karg);
                return -EINVAL;
+       }
        port = karg->hdr.port;
 
        karg->port = port;