Re: [PATCH 1/2] fs: add link restrictions
From: Kees Cook
Date: Sun Jul 01 2012 - 21:27:23 EST
On Sun, Jul 1, 2012 at 5:43 PM, Kees Cook <keescook@xxxxxxxxxxxx> wrote:
> On Sat, Jun 30, 2012 at 2:14 AM, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
>> On Mon, Jun 25, 2012 at 02:05:26PM -0700, Kees Cook wrote:
>>> + err = may_follow_link(&link);
>>> + if (unlikely(err))
>>> + break;
>>
>> No. This is definitely wrong - you are leaking dentries and vfsmount here.
>
> What should I do to avoid the leak? I thought it was avoiding the need
> to call put_link because it aborts before calling follow_link.
Does this need "path_put(&nd->path);" added to the abort case?
If so, is this also missing from follow_link()'s final "return error",
or is it the responsibility of dentry->d_inode->i_op->follow_link() to
have already called path_put()?
-Kees
--
Kees Cook
Chrome OS Security
--
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/