Re: [PATCH] utime(s): Honour CAP_FOWNER when times==NULL

From: Linus Torvalds
Date: Mon Jul 16 2007 - 14:48:41 EST




On Tue, 17 Jul 2007, Satyam Sharma wrote:
>
> [PATCH] utime(s): Honour CAP_FOWNER when times==NULL
>
> do_utimes() does not honour CAP_FOWNER when times==NULL.
> Trivial and obvious one-line fix.

Ahh, ok. Is this old, or was it introduced recently (I'm looking at my
recent change to that area, it doesn't seem to introduce this)?

IOW, how did you even notice this?

Also, while your one-liner looks correct, it does make me wonder: the
whole

if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))

test is a rather common test, and in fact, arguably, every time you see
one part of it, you should probably see the other. Would it make sense to
make a helper inline function to do this, and replace all users? Doing a

git grep 'fsuid.*\<i_uid\>'

seems to show quite a few cases of this pattern..

Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/