selinux: handle files opened with flags 3 by checking ioctl permission
[sfrench/cifs-2.6.git] / security / selinux / hooks.c
index 4bf4807f2d44351f9a46084a21e26567e8602448..c2fef7b12dc7de21bb32cb40d8dbc1032b256f38 100644 (file)
@@ -800,7 +800,8 @@ static void selinux_sb_clone_mnt_opts(const struct super_block *oldsb,
        mutex_unlock(&newsbsec->lock);
 }
 
-int selinux_parse_opts_str(char *options, struct security_mnt_opts *opts)
+static int selinux_parse_opts_str(char *options,
+                                 struct security_mnt_opts *opts)
 {
        char *p;
        char *context = NULL, *defcontext = NULL;
@@ -1629,6 +1630,12 @@ static inline u32 file_to_av(struct file *file)
                else
                        av |= FILE__WRITE;
        }
+       if (!av) {
+               /*
+                * Special file opened with flags 3 for ioctl-only use.
+                */
+               av = FILE__IOCTL;
+       }
 
        return av;
 }