Skip to contentSkip to conversation

dma-buf: Check return value of anon_inode_getfile

PATCH New Tuomas Tynkkynen 1 participant 1 message Aug 27, 2013

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

PATCH 1/1 dma-buf: Check return value of anon_inode_getfile

anon_inode_getfile might fail, so check its return value.

---
 drivers/base/dma-buf.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/base/dma-buf.c +4 -1
index 1219ab7..2d5ac1a 100644
@@ -133,7 +133,10 @@ struct dma_buf *dma_buf_export_named(void *priv, const struct dma_buf_ops *ops,
 	dmabuf->exp_name = exp_name;
 
 	file = anon_inode_getfile("dmabuf", &dma_buf_fops, dmabuf, flags);
-
+	if (IS_ERR(file)) {
+		kfree(dmabuf);
+		return ERR_CAST(file);
+	}
 	dmabuf->file = file;
 
 	mutex_init(&dmabuf->lock);
Signature · 1 line
1.8.1.5