|
@@ -124,6 +124,8 @@ static DEFINE_MUTEX(mut);
|
|
|
static DEFINE_IDR(ctx_idr);
|
|
static DEFINE_IDR(ctx_idr);
|
|
|
static DEFINE_IDR(multicast_idr);
|
|
static DEFINE_IDR(multicast_idr);
|
|
|
|
|
|
|
|
|
|
+static const struct file_operations ucma_fops;
|
|
|
|
|
+
|
|
|
static inline struct ucma_context *_ucma_find_context(int id,
|
|
static inline struct ucma_context *_ucma_find_context(int id,
|
|
|
struct ucma_file *file)
|
|
struct ucma_file *file)
|
|
|
{
|
|
{
|
|
@@ -1581,6 +1583,10 @@ static ssize_t ucma_migrate_id(struct ucma_file *new_file,
|
|
|
f = fdget(cmd.fd);
|
|
f = fdget(cmd.fd);
|
|
|
if (!f.file)
|
|
if (!f.file)
|
|
|
return -ENOENT;
|
|
return -ENOENT;
|
|
|
|
|
+ if (f.file->f_op != &ucma_fops) {
|
|
|
|
|
+ ret = -EINVAL;
|
|
|
|
|
+ goto file_put;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
/* Validate current fd and prevent destruction of id. */
|
|
/* Validate current fd and prevent destruction of id. */
|
|
|
ctx = ucma_get_ctx(f.file->private_data, cmd.id);
|
|
ctx = ucma_get_ctx(f.file->private_data, cmd.id);
|