Skip to content

Commit a27ab9f

Browse files
Tetsuo Handaxjamesmorris
authored andcommitted
LSM: Pass original mount flags to security_sb_mount().
This patch allows LSM modules to determine based on original mount flags passed to mount(). A LSM module can get masked mount flags (if needed) by flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE | MS_NOATIME | MS_NODIRATIME | MS_RELATIME| MS_KERNMOUNT | MS_STRICTATIME); Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Signed-off-by: James Morris <jmorris@namei.org>
1 parent 8b8efb4 commit a27ab9f

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

‎fs/namespace.c‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1921,6 +1921,16 @@ long do_mount(char *dev_name, char *dir_name, char *type_page,
19211921
if (data_page)
19221922
((char *)data_page)[PAGE_SIZE - 1] = 0;
19231923

1924+
/* ... and get the mountpoint */
1925+
retval = kern_path(dir_name, LOOKUP_FOLLOW, &path);
1926+
if (retval)
1927+
return retval;
1928+
1929+
retval = security_sb_mount(dev_name, &path,
1930+
type_page, flags, data_page);
1931+
if (retval)
1932+
goto dput_out;
1933+
19241934
/* Default to relatime unless overriden */
19251935
if (!(flags & MS_NOATIME))
19261936
mnt_flags |= MNT_RELATIME;
@@ -1945,16 +1955,6 @@ long do_mount(char *dev_name, char *dir_name, char *type_page,
19451955
MS_NOATIME | MS_NODIRATIME | MS_RELATIME| MS_KERNMOUNT |
19461956
MS_STRICTATIME);
19471957

1948-
/* ... and get the mountpoint */
1949-
retval = kern_path(dir_name, LOOKUP_FOLLOW, &path);
1950-
if (retval)
1951-
return retval;
1952-
1953-
retval = security_sb_mount(dev_name, &path,
1954-
type_page, flags, data_page);
1955-
if (retval)
1956-
goto dput_out;
1957-
19581958
if (flags & MS_REMOUNT)
19591959
retval = do_remount(&path, flags & ~MS_REMOUNT, mnt_flags,
19601960
data_page);

0 commit comments

Comments
 (0)