Skip to content

Fix file type check for submount points

Hanna Czenczek requested to merge (removed):fix-submount-dir-check into main

The current check (mode & IFDIR != 0) only kind of works accidentally. It should be mode & IFMT == IFDIR.

Judging from my bits/stat.h, block devices and sockets would also pass the mode & IFDIR != 0 condition. That is not exactly catastrophic, we just never tested what happens what happens if we were to mark something that is not a directory a submount, and so we only allow directories to be submount points until someone needs guest submounts for mount points that are not directories.

Note that the kernel also has a guard to only allow submounts on directory nodes, so in practice this patch should not change any user-visible behavior.

Merge request reports