From 9022e24e8946400d53719a761815069c3183e2bd Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Tue, 27 Aug 2013 16:30:38 +0300 Subject: dma-buf: Check return value of anon_inode_getfile anon_inode_getfile might fail, so check its return value. Signed-off-by: Tuomas Tynkkynen Signed-off-by: Sumit Semwal --- drivers/base/dma-buf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'drivers/base/dma-buf.c') diff --git a/drivers/base/dma-buf.c b/drivers/base/dma-buf.c index 1219ab7c3107..2d5ac1a1842e 100644 --- a/drivers/base/dma-buf.c +++ b/drivers/base/dma-buf.c @@ -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); -- cgit v1.2.2