All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [SCSI] dpt_i2o: Add a missing call to kfree
@ 2016-11-19 17:42 ` Quentin Lambert
  0 siblings, 0 replies; 4+ messages in thread
From: Quentin Lambert @ 2016-11-19 17:42 UTC (permalink / raw)
  To: Adaptec OEM Raid Solutions, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi, linux-kernel, kernel-janitors
  Cc: Quentin Lambert

Most error branches following the call to kzalloc contain
a call to kfree. This patch add these calls where they are
missing.

This issue was found with Hector.

Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>

---
 drivers/scsi/dpt_i2o.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -1754,8 +1754,10 @@ static int adpt_i2o_passthru(adpt_hba* p
 	sg_offset = (msg[0]>>4)&0xf;
 	msg[2] = 0x40000000; // IOCTL context
 	msg[3] = adpt_ioctl_to_context(pHba, reply);
-	if (msg[3] == (u32)-1)
+	if (msg[3] == (u32)-1) {
+		kfree(reply);
 		return -EBUSY;
+	}
 
 	memset(sg_list,0, sizeof(sg_list[0])*pHba->sg_tablesize);
 	if(sg_offset) {

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

* [PATCH] [SCSI] dpt_i2o: Add a missing call to kfree
@ 2016-11-19 17:42 ` Quentin Lambert
  0 siblings, 0 replies; 4+ messages in thread
From: Quentin Lambert @ 2016-11-19 17:42 UTC (permalink / raw)
  To: Adaptec OEM Raid Solutions, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi, linux-kernel, kernel-janitors
  Cc: Quentin Lambert

Most error branches following the call to kzalloc contain
a call to kfree. This patch add these calls where they are
missing.

This issue was found with Hector.

Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>

---
 drivers/scsi/dpt_i2o.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -1754,8 +1754,10 @@ static int adpt_i2o_passthru(adpt_hba* p
 	sg_offset = (msg[0]>>4)&0xf;
 	msg[2] = 0x40000000; // IOCTL context
 	msg[3] = adpt_ioctl_to_context(pHba, reply);
-	if (msg[3] = (u32)-1)
+	if (msg[3] = (u32)-1) {
+		kfree(reply);
 		return -EBUSY;
+	}
 
 	memset(sg_list,0, sizeof(sg_list[0])*pHba->sg_tablesize);
 	if(sg_offset) {

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

* Re: [PATCH] [SCSI] dpt_i2o: Add a missing call to kfree
  2016-11-19 17:42 ` Quentin Lambert
@ 2016-11-29 16:55   ` Martin K. Petersen
  -1 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2016-11-29 16:55 UTC (permalink / raw)
  To: Quentin Lambert
  Cc: Adaptec OEM Raid Solutions, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi, linux-kernel, kernel-janitors

>>>>> "Quentin" == Quentin Lambert <lambert.quentin@gmail.com> writes:

Quentin> Most error branches following the call to kzalloc contain a
Quentin> call to kfree. This patch add these calls where they are
Quentin> missing.

Applied to 4.10/scsi-queue.

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH] [SCSI] dpt_i2o: Add a missing call to kfree
@ 2016-11-29 16:55   ` Martin K. Petersen
  0 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2016-11-29 16:55 UTC (permalink / raw)
  To: Quentin Lambert
  Cc: Adaptec OEM Raid Solutions, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi, linux-kernel, kernel-janitors

>>>>> "Quentin" = Quentin Lambert <lambert.quentin@gmail.com> writes:

Quentin> Most error branches following the call to kzalloc contain a
Quentin> call to kfree. This patch add these calls where they are
Quentin> missing.

Applied to 4.10/scsi-queue.

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2016-11-29 16:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-19 17:42 [PATCH] [SCSI] dpt_i2o: Add a missing call to kfree Quentin Lambert
2016-11-19 17:42 ` Quentin Lambert
2016-11-29 16:55 ` Martin K. Petersen
2016-11-29 16:55   ` 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.