Re: [PATCH] fs: hardlink creation restrictions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Feb 18, 2012 at 12:56 PM, Marcin Slusarz
<marcin.slusarz@xxxxxxxxx> wrote:
> On Sat, Feb 18, 2012 at 11:38:57AM -0800, Kees Cook wrote:
>> @@ -3052,6 +3119,9 @@ SYSCALL_DEFINE5(linkat, int, olddfd, const char __user *, oldname,
>>       error = mnt_want_write(new_path.mnt);
>>       if (error)
>>               goto out_dput;
>> +     error = may_linkat(&old_path);
>> +     if (error)
>> +             goto out_dput;
>>       error = security_path_link(old_path.dentry, &new_path, new_dentry);
>>       if (error)
>>               goto out_drop_write;
>
> You should give up write access after check failure (i.e. goto out_drop_write).

Ah! Thanks, yes, good catch. I will move the check before mnt_want_write().

-Kees

-- 
Kees Cook
ChromeOS Security
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux