All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] nvme_fc: avoid double kfree(), don't call nvme_cleanup_cmd() in nvme_fc_unmap_data()
@ 2017-04-06 16:47 Ewan D. Milne
  2017-04-06 18:17 ` Johannes Thumshirn
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ewan D. Milne @ 2017-04-06 16:47 UTC (permalink / raw)


nvme_cleanup_cmd() is already called by callers of nvme_fc_unmap_data().
Don't call it twice to avoid double-free on completion of discard commands.

v2:
Move nvme_cleanup_cmd() call *after* nvme_fc_unmap_data() for consistency.

Signed-off-by: Ewan D. Milne <emilne at redhat.com>
---
 drivers/nvme/host/fc.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index fc42172..5ff8674 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -1700,8 +1700,6 @@ enum blk_eh_timer_return
 				((rq_data_dir(rq) == WRITE) ?
 					DMA_TO_DEVICE : DMA_FROM_DEVICE));
 
-	nvme_cleanup_cmd(rq);
-
 	sg_free_table_chained(&freq->sg_table, true);
 
 	freq->sg_cnt = 0;
@@ -1929,8 +1927,8 @@ enum blk_eh_timer_return
 
 	state = atomic_xchg(&op->state, FCPOP_STATE_IDLE);
 
-	nvme_cleanup_cmd(rq);
 	nvme_fc_unmap_data(ctrl, rq, op);
+	nvme_cleanup_cmd(rq);
 	nvme_complete_rq(rq);
 	nvme_fc_ctrl_put(ctrl);
 
-- 
1.7.1

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

* [PATCH v2] nvme_fc: avoid double kfree(), don't call nvme_cleanup_cmd() in nvme_fc_unmap_data()
  2017-04-06 16:47 [PATCH v2] nvme_fc: avoid double kfree(), don't call nvme_cleanup_cmd() in nvme_fc_unmap_data() Ewan D. Milne
@ 2017-04-06 18:17 ` Johannes Thumshirn
  2017-04-07  7:27 ` Christoph Hellwig
  2017-04-09 12:28 ` Sagi Grimberg
  2 siblings, 0 replies; 4+ messages in thread
From: Johannes Thumshirn @ 2017-04-06 18:17 UTC (permalink / raw)


On Thu, Apr 06, 2017@12:47:56PM -0400, Ewan Milne wrote:
> nvme_cleanup_cmd() is already called by callers of nvme_fc_unmap_data().
> Don't call it twice to avoid double-free on completion of discard commands.
> 
> v2:
> Move nvme_cleanup_cmd() call *after* nvme_fc_unmap_data() for consistency.
> 
> Signed-off-by: Ewan D. Milne <emilne at redhat.com>
> ---

Thanks,
Reviewed-by: Johannes Thumshirn <jthumshirn at suse.de>

-- 
Johannes Thumshirn                                          Storage
jthumshirn at suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

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

* [PATCH v2] nvme_fc: avoid double kfree(), don't call nvme_cleanup_cmd() in nvme_fc_unmap_data()
  2017-04-06 16:47 [PATCH v2] nvme_fc: avoid double kfree(), don't call nvme_cleanup_cmd() in nvme_fc_unmap_data() Ewan D. Milne
  2017-04-06 18:17 ` Johannes Thumshirn
@ 2017-04-07  7:27 ` Christoph Hellwig
  2017-04-09 12:28 ` Sagi Grimberg
  2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2017-04-07  7:27 UTC (permalink / raw)


Looks good,

Reviewed-by: Christoph Hellwig <hch at lst.de>

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

* [PATCH v2] nvme_fc: avoid double kfree(), don't call nvme_cleanup_cmd() in nvme_fc_unmap_data()
  2017-04-06 16:47 [PATCH v2] nvme_fc: avoid double kfree(), don't call nvme_cleanup_cmd() in nvme_fc_unmap_data() Ewan D. Milne
  2017-04-06 18:17 ` Johannes Thumshirn
  2017-04-07  7:27 ` Christoph Hellwig
@ 2017-04-09 12:28 ` Sagi Grimberg
  2 siblings, 0 replies; 4+ messages in thread
From: Sagi Grimberg @ 2017-04-09 12:28 UTC (permalink / raw)


Reviewed-by: Sagi Grimberg <sagi at grimbeg.me>

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

end of thread, other threads:[~2017-04-09 12:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-06 16:47 [PATCH v2] nvme_fc: avoid double kfree(), don't call nvme_cleanup_cmd() in nvme_fc_unmap_data() Ewan D. Milne
2017-04-06 18:17 ` Johannes Thumshirn
2017-04-07  7:27 ` Christoph Hellwig
2017-04-09 12:28 ` Sagi Grimberg

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.