Skip to contentSkip to conversation

dma-buf: fix order of trace and fput

PATCH In review Christian König 2 participants 3 messages Apr 8 – Apr 13

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dma-buf: fix order of trace and fput

Dropping the last reference to the DMA-buf and then accessing the name for tracing can't work correctly.

Only compile tested!

Fixed: 281a22631423 ("dma-buf: add some tracepoints to debug.")

---
 drivers/dma-buf/dma-buf.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/dma-buf/dma-buf.c +1 -2
index 11711874a325..3a9d5113b98c 100644
@@ -845,9 +845,8 @@ void dma_buf_put(struct dma_buf *dmabuf)
 	if (WARN_ON(!dmabuf || !dmabuf->file))
 		return;
 
-	fput(dmabuf->file);
-
 	DMA_BUF_TRACE(trace_dma_buf_put, dmabuf);
+	fput(dmabuf->file);
 }
 EXPORT_SYMBOL_NS_GPL(dma_buf_put, "DMA_BUF");
 
Signature · 1 line
2.43.0
#1 lore raw

Hi Christian,

drivers/dma-buf/dma-buf.c void dma_buf_put(struct dma_buf *dmabuf) · line 849

Quoted 8 lines
drivers/dma-buf/dma-buf.c +1 -2
@@ -845,9 +845,8 @@ void dma_buf_put(struct dma_buf *dmabuf)
 	if (WARN_ON(!dmabuf || !dmabuf->file))
 		return;
 
-	fput(dmabuf->file);
-
 	DMA_BUF_TRACE(trace_dma_buf_put, dmabuf);
+	fput(dmabuf->file);

funny, I just found out I sent the exact same patch, just few minutes later :-) [*]

Andi

Review void dma_buf_put(struct dma_buf *dmabuf) · line 850

Quoted 1 line
(quoted diff) +0 -0
 }

[*] https://lore.kernel.org/all/[email protected]/

#2 lore raw
Quoted 6 lines · Andi Shyti

Hi Christian,

Quoted 4 lines
drivers/dma-buf/dma-buf.c +0 -0
@@ -845,9 +845,8 @@ void dma_buf_put(struct dma_buf *dmabuf)
 	if (WARN_ON(!dmabuf || !dmabuf->file))
 		return;
 
Quoted 7 lines

drivers/dma-buf/dma-buf.c void dma_buf_put(struct dma_buf *dmabuf) · line 849

Quoted 4 lines
drivers/dma-buf/dma-buf.c +1 -2
-	fput(dmabuf->file);
-
 	DMA_BUF_TRACE(trace_dma_buf_put, dmabuf);
+	fput(dmabuf->file);

funny, I just found out I sent the exact same patch, just few minutes later :-) [*]

I liked your patch better since it has more accurate tags.

Just reviewed and pushed that one to drm-misc-fixes, should land upstream by the end of the week.

Regards,
Christian.

Quoted 6 lines

Andi

Review void dma_buf_put(struct dma_buf *dmabuf) · line 850

Quoted 1 line
(quoted diff) +0 -0
 }

[*] https://lore.kernel.org/all/[email protected]/