All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] scsi: dpt_i2o: double free on error path
@ 2016-11-30 19:36 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2016-11-30 19:36 UTC (permalink / raw)
  To: Adaptec OEM Raid Solutions, Quentin Lambert
  Cc: James E.J. Bottomley, Martin K. Petersen, linux-scsi, kernel-janitors

We recently introduced a kfree() in the caller for this function.
That's where, logically, you would think the kfree() should be.
Unfortunately the code was just ugly and not buggy so the static
checker warning was a false postive and introduced a double free.

I've removed the old kfree() and left the new one.

Fixes: 021e2927586d ("scsi: dpt_i2o: Add a missing call to kfree")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index f88b3d2..27c0dce 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -651,7 +651,6 @@ static u32 adpt_ioctl_to_context(adpt_hba * pHba, void *reply)
 	}
 	spin_unlock_irqrestore(pHba->host->host_lock, flags);
 	if (i >= nr) {
-		kfree (reply);
 		printk(KERN_WARNING"%s: Too many outstanding "
 				"ioctl commands\n", pHba->name);
 		return (u32)-1;

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [patch] scsi: dpt_i2o: double free on error path
@ 2016-11-30 19:36 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2016-11-30 19:36 UTC (permalink / raw)
  To: Adaptec OEM Raid Solutions, Quentin Lambert
  Cc: James E.J. Bottomley, Martin K. Petersen, linux-scsi, kernel-janitors

We recently introduced a kfree() in the caller for this function.
That's where, logically, you would think the kfree() should be.
Unfortunately the code was just ugly and not buggy so the static
checker warning was a false postive and introduced a double free.

I've removed the old kfree() and left the new one.

Fixes: 021e2927586d ("scsi: dpt_i2o: Add a missing call to kfree")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index f88b3d2..27c0dce 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -651,7 +651,6 @@ static u32 adpt_ioctl_to_context(adpt_hba * pHba, void *reply)
 	}
 	spin_unlock_irqrestore(pHba->host->host_lock, flags);
 	if (i >= nr) {
-		kfree (reply);
 		printk(KERN_WARNING"%s: Too many outstanding "
 				"ioctl commands\n", pHba->name);
 		return (u32)-1;

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [patch] scsi: dpt_i2o: double free on error path
  2016-11-30 19:36 ` Dan Carpenter
@ 2016-11-30 20:18   ` Quentin Lambert
  -1 siblings, 0 replies; 6+ messages in thread
From: Quentin Lambert @ 2016-11-30 20:18 UTC (permalink / raw)
  To: Dan Carpenter, Adaptec OEM Raid Solutions
  Cc: James E.J. Bottomley, Martin K. Petersen, linux-scsi, kernel-janitors



On 11/30/2016 08:36 PM, Dan Carpenter wrote:
> We recently introduced a kfree() in the caller for this function.
> That's where, logically, you would think the kfree() should be.
> Unfortunately the code was just ugly and not buggy so the static
> checker warning was a false postive and introduced a double free.
>
oh, yes! Sorry I missed that.

Quentin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] scsi: dpt_i2o: double free on error path
@ 2016-11-30 20:18   ` Quentin Lambert
  0 siblings, 0 replies; 6+ messages in thread
From: Quentin Lambert @ 2016-11-30 20:18 UTC (permalink / raw)
  To: Dan Carpenter, Adaptec OEM Raid Solutions
  Cc: James E.J. Bottomley, Martin K. Petersen, linux-scsi, kernel-janitors



On 11/30/2016 08:36 PM, Dan Carpenter wrote:
> We recently introduced a kfree() in the caller for this function.
> That's where, logically, you would think the kfree() should be.
> Unfortunately the code was just ugly and not buggy so the static
> checker warning was a false postive and introduced a double free.
>
oh, yes! Sorry I missed that.

Quentin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] scsi: dpt_i2o: double free on error path
  2016-11-30 19:36 ` Dan Carpenter
@ 2016-12-01  0:54   ` Martin K. Petersen
  -1 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2016-12-01  0:54 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Adaptec OEM Raid Solutions, Quentin Lambert,
	James E.J. Bottomley, Martin K. Petersen, linux-scsi,
	kernel-janitors

>>>>> "Dan" = Dan Carpenter <dan.carpenter@oracle.com> writes:

Dan> We recently introduced a kfree() in the caller for this function.
Dan> That's where, logically, you would think the kfree() should be.
Dan> Unfortunately the code was just ugly and not buggy so the static
Dan> checker warning was a false postive and introduced a double free.

Dan> I've removed the old kfree() and left the new one.

Applied to 4.10/scsi-queue.

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] scsi: dpt_i2o: double free on error path
@ 2016-12-01  0:54   ` Martin K. Petersen
  0 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2016-12-01  0:54 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Adaptec OEM Raid Solutions, Quentin Lambert,
	James E.J. Bottomley, Martin K. Petersen, linux-scsi,
	kernel-janitors

>>>>> "Dan" == Dan Carpenter <dan.carpenter@oracle.com> writes:

Dan> We recently introduced a kfree() in the caller for this function.
Dan> That's where, logically, you would think the kfree() should be.
Dan> Unfortunately the code was just ugly and not buggy so the static
Dan> checker warning was a false postive and introduced a double free.

Dan> I've removed the old kfree() and left the new one.

Applied to 4.10/scsi-queue.

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-12-01  0:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-30 19:36 [patch] scsi: dpt_i2o: double free on error path Dan Carpenter
2016-11-30 19:36 ` Dan Carpenter
2016-11-30 20:18 ` Quentin Lambert
2016-11-30 20:18   ` Quentin Lambert
2016-12-01  0:54 ` Martin K. Petersen
2016-12-01  0:54   ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.