Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iscsi: Fix iscsi endpoints leak

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>

authored by

Sagi Grimberg and committed by
James Bottomley
4ce30874 e03c2da6

+2
+2
drivers/scsi/scsi_transport_iscsi.c
··· 204 204 iscsi_match_epid); 205 205 if (!dev) 206 206 break; 207 + else 208 + put_device(dev); 207 209 } 208 210 if (id == ISCSI_MAX_EPID) { 209 211 printk(KERN_ERR "Too many connections. Max supported %u\n",