On Wed, Sep 26, 2007 at 12:58:47AM +0200, Miklos Szeredi wrote:
> if (!S_ISREG(mode) && !S_ISCHR(mode) && !S_ISBLK(mode) &&
> - !S_ISFIFO(mode) && !S_ISSOCK(mode) && mode != 0) {
> + !S_ISFIFO(mode) && !S_ISSOCK(mode) && (mode & S_IFMT) != 0) {
FYI this whole section might be cleaner as
static int may_mknod(mode_t mode)
{
switch (mode & S_IFMT) {
case S_IFREG:
case S_IFCHR:
case S_IFBLK:
case S_IFFIFO:
case S_IFSOCK:
case 0: /* zero mode translates to S_IFREG *
return 0;
case S_IFDIR:
return -EPERM;
default:
return -EINVAL;
}
}
and then in sys_mknodat just a
error = may_mknod(mode);
if (error)
goto out_dput;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]