]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
iscsi: Fix iscsi endpoints leak
authorSagi Grimberg <sagig@mellanox.com>
Wed, 20 May 2015 09:38:58 +0000 (12:38 +0300)
committerJames Bottomley <JBottomley@Odin.com>
Wed, 3 Jun 2015 00:26:32 +0000 (17:26 -0700)
When creating a new endpoint, we look for a free id
for the new endpoint. We baisically loop on possible ids
and use the first id that class_find_device() returns NULL.
However, we are missing a reference put when class_find_device()
does find an existing device for a given id.

Reported-by: Alex Lyakas <alex@zadarastorage.com>
Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
drivers/scsi/scsi_transport_iscsi.c

index 67d43e35693df9e9e119bb6a4c2faac56f1bc260..55647aae065cf45795d13326b6056c43f19b4dc6 100644 (file)
@@ -204,6 +204,8 @@ iscsi_create_endpoint(int dd_size)
                                        iscsi_match_epid);
                if (!dev)
                        break;
                                        iscsi_match_epid);
                if (!dev)
                        break;
+               else
+                       put_device(dev);
        }
        if (id == ISCSI_MAX_EPID) {
                printk(KERN_ERR "Too many connections. Max supported %u\n",
        }
        if (id == ISCSI_MAX_EPID) {
                printk(KERN_ERR "Too many connections. Max supported %u\n",