reservation_object_fini(dmabuf->resv);
module_put(dmabuf->owner);
+ kfree(dmabuf->exp_name);
kfree(dmabuf);
return 0;
}
return file->f_op == &dma_buf_fops;
}
+#define MAX_EXP_FILE_NAME (DNAME_INLINE_LEN - 7) /* 7: strlen("dmabuf_") */
+
/**
* DOC: dma buf device access
*
struct reservation_object *resv = exp_info->resv;
struct file *file;
size_t alloc_size = sizeof(struct dma_buf);
+ char filename[MAX_EXP_FILE_NAME];
int ret;
if (!exp_info->resv)
goto err_module;
}
+ dmabuf->exp_name = kstrdup(exp_info->exp_name, GFP_KERNEL);
+ if (!dmabuf->exp_name) {
+ ret = -ENOMEM;
+ goto err_expname;
+ }
+
+ snprintf(filename, MAX_EXP_FILE_NAME, "dmabuf_%s", dmabuf->exp_name);
+
dmabuf->priv = exp_info->priv;
dmabuf->ops = exp_info->ops;
dmabuf->size = exp_info->size;
- dmabuf->exp_name = exp_info->exp_name;
dmabuf->owner = exp_info->owner;
init_waitqueue_head(&dmabuf->poll);
dmabuf->cb_excl.poll = dmabuf->cb_shared.poll = &dmabuf->poll;
}
dmabuf->resv = resv;
- file = anon_inode_getfile("dmabuf", &dma_buf_fops, dmabuf,
+ file = anon_inode_getfile(filename, &dma_buf_fops, dmabuf,
exp_info->flags);
if (IS_ERR(file)) {
ret = PTR_ERR(file);
return dmabuf;
err_dmabuf:
+ kfree(dmabuf->exp_name);
+err_expname:
kfree(dmabuf);
err_module:
module_put(exp_info->owner);