* [PATCH] iscsi: Fix iscsi endpoints leak
@ 2015-05-20 9:38 Sagi Grimberg
2015-06-02 15:21 ` Sagi Grimberg
2015-06-02 17:23 ` Mike Christie
0 siblings, 2 replies; 3+ messages in thread
From: Sagi Grimberg @ 2015-05-20 9:38 UTC (permalink / raw)
To: linux-scsi; +Cc: Mike Christie, James Bottomley, Or Gerlitz, Alex Lyakas
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>
---
drivers/scsi/scsi_transport_iscsi.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 67d43e3..55647aa 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -204,6 +204,8 @@ iscsi_create_endpoint(int dd_size)
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",
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] iscsi: Fix iscsi endpoints leak
2015-05-20 9:38 [PATCH] iscsi: Fix iscsi endpoints leak Sagi Grimberg
@ 2015-06-02 15:21 ` Sagi Grimberg
2015-06-02 17:23 ` Mike Christie
1 sibling, 0 replies; 3+ messages in thread
From: Sagi Grimberg @ 2015-06-02 15:21 UTC (permalink / raw)
To: linux-scsi, Mike Christie; +Cc: James Bottomley
On 5/20/2015 12:38 PM, Sagi Grimberg wrote:
> 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>
> ---
> drivers/scsi/scsi_transport_iscsi.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
> index 67d43e3..55647aa 100644
> --- a/drivers/scsi/scsi_transport_iscsi.c
> +++ b/drivers/scsi/scsi_transport_iscsi.c
> @@ -204,6 +204,8 @@ iscsi_create_endpoint(int dd_size)
> 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",
>
ping?
Mike, can I get a review on this one?
I think this leak existed since this code was introduced
in 2.6.37, but I've only tested back to 3.10.
So I think this deserves a CC to stable 3.10+
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iscsi: Fix iscsi endpoints leak
2015-05-20 9:38 [PATCH] iscsi: Fix iscsi endpoints leak Sagi Grimberg
2015-06-02 15:21 ` Sagi Grimberg
@ 2015-06-02 17:23 ` Mike Christie
1 sibling, 0 replies; 3+ messages in thread
From: Mike Christie @ 2015-06-02 17:23 UTC (permalink / raw)
To: Sagi Grimberg, linux-scsi; +Cc: James Bottomley, Or Gerlitz, Alex Lyakas
On 05/20/2015 04:38 AM, Sagi Grimberg wrote:
> 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>
> ---
> drivers/scsi/scsi_transport_iscsi.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
> index 67d43e3..55647aa 100644
> --- a/drivers/scsi/scsi_transport_iscsi.c
> +++ b/drivers/scsi/scsi_transport_iscsi.c
> @@ -204,6 +204,8 @@ iscsi_create_endpoint(int dd_size)
> 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",
>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-06-02 17:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-20 9:38 [PATCH] iscsi: Fix iscsi endpoints leak Sagi Grimberg
2015-06-02 15:21 ` Sagi Grimberg
2015-06-02 17:23 ` Mike Christie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).