aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/ucma.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/core/ucma.c')
-rw-r--r--drivers/infiniband/core/ucma.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c
index ec8fb289621f..5f437d1570fb 100644
--- a/drivers/infiniband/core/ucma.c
+++ b/drivers/infiniband/core/ucma.c
@@ -124,6 +124,8 @@ static DEFINE_MUTEX(mut);
124static DEFINE_IDR(ctx_idr); 124static DEFINE_IDR(ctx_idr);
125static DEFINE_IDR(multicast_idr); 125static DEFINE_IDR(multicast_idr);
126 126
127static const struct file_operations ucma_fops;
128
127static inline struct ucma_context *_ucma_find_context(int id, 129static inline struct ucma_context *_ucma_find_context(int id,
128 struct ucma_file *file) 130 struct ucma_file *file)
129{ 131{
@@ -1581,6 +1583,10 @@ static ssize_t ucma_migrate_id(struct ucma_file *new_file,
1581 f = fdget(cmd.fd); 1583 f = fdget(cmd.fd);
1582 if (!f.file) 1584 if (!f.file)
1583 return -ENOENT; 1585 return -ENOENT;
1586 if (f.file->f_op != &ucma_fops) {
1587 ret = -EINVAL;
1588 goto file_put;
1589 }
1584 1590
1585 /* Validate current fd and prevent destruction of id. */ 1591 /* Validate current fd and prevent destruction of id. */
1586 ctx = ucma_get_ctx(f.file->private_data, cmd.id); 1592 ctx = ucma_get_ctx(f.file->private_data, cmd.id);