Merge branch 'vfs.file' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs...
[sfrench/cifs-2.6.git] / net / core / scm.c
index eec78e31255094f43b8d16b419c3efbde9e343f5..db3f7cd519c2da12c9986c11836b384dafc11568 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/nsproxy.h>
 #include <linux/slab.h>
 #include <linux/errqueue.h>
+#include <linux/io_uring.h>
 
 #include <linux/uaccess.h>
 
@@ -103,6 +104,11 @@ static int scm_fp_copy(struct cmsghdr *cmsg, struct scm_fp_list **fplp)
 
                if (fd < 0 || !(file = fget_raw(fd)))
                        return -EBADF;
+               /* don't allow io_uring files */
+               if (io_uring_get_socket(file)) {
+                       fput(file);
+                       return -EINVAL;
+               }
                *fpp++ = file;
                fpl->count++;
        }