All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sbp-target: add the missed kfree() in an error path
@ 2020-05-28 10:20 ` Chuhong Yuan
  0 siblings, 0 replies; 8+ messages in thread
From: Chuhong Yuan @ 2020-05-28 10:20 UTC (permalink / raw)
  Cc: Chris Boot, Martin K . Petersen, Nicholas Bellinger,
	Stefan Richter, linux-scsi, target-devel, linux1394-devel,
	linux-kernel, Chuhong Yuan

sbp_fetch_command() forgets to call kfree() in an error path.
Add the missed call to fix it.

Fixes: a511ce339780 ("sbp-target: Initial merge of firewire/ieee-1394 target mode support")
Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
---
 drivers/target/sbp/sbp_target.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/target/sbp/sbp_target.c b/drivers/target/sbp/sbp_target.c
index e4a9b9fe3dfb..504a755ea344 100644
--- a/drivers/target/sbp/sbp_target.c
+++ b/drivers/target/sbp/sbp_target.c
@@ -1128,8 +1128,10 @@ static int sbp_fetch_command(struct sbp_target_request *req)
 				req->orb_pointer + sizeof(req->orb),
 				req->cmd_buf + sizeof(req->orb.command_block),
 				copy_len);
-		if (ret != RCODE_COMPLETE)
+		if (ret != RCODE_COMPLETE) {
+			kfree(req->cmd_buf);
 			return -EIO;
+		}
 	}
 
 	return 0;
-- 
2.26.2


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

* [PATCH] sbp-target: add the missed kfree() in an error path
@ 2020-05-28 10:20 ` Chuhong Yuan
  0 siblings, 0 replies; 8+ messages in thread
From: Chuhong Yuan @ 2020-05-28 10:20 UTC (permalink / raw)
  Cc: Chris Boot, Martin K . Petersen, Nicholas Bellinger,
	Stefan Richter, linux-scsi, target-devel, linux1394-devel,
	linux-kernel, Chuhong Yuan

sbp_fetch_command() forgets to call kfree() in an error path.
Add the missed call to fix it.

Fixes: a511ce339780 ("sbp-target: Initial merge of firewire/ieee-1394 target mode support")
Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
---
 drivers/target/sbp/sbp_target.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/target/sbp/sbp_target.c b/drivers/target/sbp/sbp_target.c
index e4a9b9fe3dfb..504a755ea344 100644
--- a/drivers/target/sbp/sbp_target.c
+++ b/drivers/target/sbp/sbp_target.c
@@ -1128,8 +1128,10 @@ static int sbp_fetch_command(struct sbp_target_request *req)
 				req->orb_pointer + sizeof(req->orb),
 				req->cmd_buf + sizeof(req->orb.command_block),
 				copy_len);
-		if (ret != RCODE_COMPLETE)
+		if (ret != RCODE_COMPLETE) {
+			kfree(req->cmd_buf);
 			return -EIO;
+		}
 	}
 
 	return 0;
-- 
2.26.2

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

* Re: [PATCH] sbp-target: add the missed kfree() in an error path
  2020-05-28 10:20 ` Chuhong Yuan
@ 2020-05-28 14:53   ` Bart Van Assche
  -1 siblings, 0 replies; 8+ messages in thread
From: Bart Van Assche @ 2020-05-28 14:53 UTC (permalink / raw)
  To: Chris Boot
  Cc: Chuhong Yuan, Martin K . Petersen, Nicholas Bellinger,
	Stefan Richter, linux-scsi, target-devel, linux1394-devel,
	linux-kernel

On 2020-05-28 03:20, Chuhong Yuan wrote:
> sbp_fetch_command() forgets to call kfree() in an error path.
> Add the missed call to fix it.

Hi Chris,

The changelog of the code under drivers/target/sbp makes we wonder
whether this driver has ever had any other users than its original
author. Do you agree with this? If so, do you want to keep this driver
in the kernel tree?

Thanks,

Bart.

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

* Re: [PATCH] sbp-target: add the missed kfree() in an error path
@ 2020-05-28 14:53   ` Bart Van Assche
  0 siblings, 0 replies; 8+ messages in thread
From: Bart Van Assche @ 2020-05-28 14:53 UTC (permalink / raw)
  To: Chris Boot
  Cc: Chuhong Yuan, Martin K . Petersen, Nicholas Bellinger,
	Stefan Richter, linux-scsi, target-devel, linux1394-devel,
	linux-kernel

On 2020-05-28 03:20, Chuhong Yuan wrote:
> sbp_fetch_command() forgets to call kfree() in an error path.
> Add the missed call to fix it.

Hi Chris,

The changelog of the code under drivers/target/sbp makes we wonder
whether this driver has ever had any other users than its original
author. Do you agree with this? If so, do you want to keep this driver
in the kernel tree?

Thanks,

Bart.

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

* Re: [PATCH] sbp-target: add the missed kfree() in an error path
  2020-05-28 14:53   ` Bart Van Assche
@ 2020-05-28 15:16     ` Chris Boot
  -1 siblings, 0 replies; 8+ messages in thread
From: Chris Boot @ 2020-05-28 15:16 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Chuhong Yuan, Martin K . Petersen, Nicholas Bellinger,
	Stefan Richter, linux-scsi, target-devel, linux1394-devel,
	linux-kernel

On 28/05/2020 15:53, Bart Van Assche wrote:
> On 2020-05-28 03:20, Chuhong Yuan wrote:
>> sbp_fetch_command() forgets to call kfree() in an error path.
>> Add the missed call to fix it.
> 
> Hi Chris,
> 
> The changelog of the code under drivers/target/sbp makes we wonder
> whether this driver has ever had any other users than its original
> author. Do you agree with this? If so, do you want to keep this driver
> in the kernel tree?

Hi Bart,

I think you might be right. I also don't have much time to maintain it
these days and the hardware I had is long dead. It probably should be
removed for everyone's sanity.

Best regards,
Chris

-- 
Chris Boot
bootc@bootc.net

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

* Re: [PATCH] sbp-target: add the missed kfree() in an error path
@ 2020-05-28 15:16     ` Chris Boot
  0 siblings, 0 replies; 8+ messages in thread
From: Chris Boot @ 2020-05-28 15:16 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Chuhong Yuan, Martin K . Petersen, Nicholas Bellinger,
	Stefan Richter, linux-scsi, target-devel, linux1394-devel,
	linux-kernel

On 28/05/2020 15:53, Bart Van Assche wrote:
> On 2020-05-28 03:20, Chuhong Yuan wrote:
>> sbp_fetch_command() forgets to call kfree() in an error path.
>> Add the missed call to fix it.
> 
> Hi Chris,
> 
> The changelog of the code under drivers/target/sbp makes we wonder
> whether this driver has ever had any other users than its original
> author. Do you agree with this? If so, do you want to keep this driver
> in the kernel tree?

Hi Bart,

I think you might be right. I also don't have much time to maintain it
these days and the hardware I had is long dead. It probably should be
removed for everyone's sanity.

Best regards,
Chris

-- 
Chris Boot
bootc@bootc.net

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

* Re: [PATCH] sbp-target: add the missed kfree() in an error path
  2020-05-28 15:16     ` Chris Boot
@ 2020-06-03  1:01       ` Martin K. Petersen
  -1 siblings, 0 replies; 8+ messages in thread
From: Martin K. Petersen @ 2020-06-03  1:01 UTC (permalink / raw)
  To: Chris Boot
  Cc: Bart Van Assche, Chuhong Yuan, Martin K . Petersen,
	Nicholas Bellinger, Stefan Richter, linux-scsi, target-devel,
	linux1394-devel, linux-kernel


Chris,

> I think you might be right. I also don't have much time to maintain it
> these days and the hardware I had is long dead.

In that case I'd appreciate a patch to remove it.

Thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH] sbp-target: add the missed kfree() in an error path
@ 2020-06-03  1:01       ` Martin K. Petersen
  0 siblings, 0 replies; 8+ messages in thread
From: Martin K. Petersen @ 2020-06-03  1:01 UTC (permalink / raw)
  To: Chris Boot
  Cc: Bart Van Assche, Chuhong Yuan, Martin K . Petersen,
	Nicholas Bellinger, Stefan Richter, linux-scsi, target-devel,
	linux1394-devel, linux-kernel


Chris,

> I think you might be right. I also don't have much time to maintain it
> these days and the hardware I had is long dead.

In that case I'd appreciate a patch to remove it.

Thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2020-06-03  1:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-28 10:20 [PATCH] sbp-target: add the missed kfree() in an error path Chuhong Yuan
2020-05-28 10:20 ` Chuhong Yuan
2020-05-28 14:53 ` Bart Van Assche
2020-05-28 14:53   ` Bart Van Assche
2020-05-28 15:16   ` Chris Boot
2020-05-28 15:16     ` Chris Boot
2020-06-03  1:01     ` Martin K. Petersen
2020-06-03  1:01       ` 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.