]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
dma-buf: Check return value of anon_inode_getfile
authorTuomas Tynkkynen <ttynkkynen@nvidia.com>
Tue, 27 Aug 2013 13:30:38 +0000 (16:30 +0300)
committerSumit Semwal <sumit.semwal@linaro.org>
Tue, 10 Sep 2013 05:59:21 +0000 (11:29 +0530)
anon_inode_getfile might fail, so check its return value.

Signed-off-by: Tuomas Tynkkynen <ttynkkynen@nvidia.com>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
drivers/base/dma-buf.c

index 1219ab7c310757cdd493baf9101000b0c5d286b0..2d5ac1a1842ea528d9dfd7d1cad48c42fab8cf8c 100644 (file)
@@ -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);