[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <493EB22C.2050108@panasas.com>
Date: Tue, 09 Dec 2008 20:00:12 +0200
From: Boaz Harrosh <bharrosh@...asas.com>
To: Christoph Hellwig <hch@...radead.org>
CC: Andrew Morton <akpm@...ux-foundation.org>,
Duane Griffin <duaneg@...da.com>, linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-ext4@...r.kernel.org
Subject: Re: Checking link targets are NULL-terminated
Christoph Hellwig wrote:
> On Mon, Dec 08, 2008 at 02:30:03PM -0800, Andrew Morton wrote:
>> Perhaps nd_set_link() is a suitable place? Change that function so
>> that it is passed a third argument (max_len) and then check that within
>> nd_set_link(). Change nd_set_link() to return a __must_check-marked
>> errno, change callers to handle errors appropriately.
>>
>> Or something totally different ;) But along those lines?
>
> Note that XFS and possibly other filesystem don't store the NULL
> termination on disk.
Note that ext2, for example, also only writes the string bytes without
any NULLs. It only happen to be zero padded because any last-page is zero-padded
from i_size to end of page.
> So having a follow_link interface that uses a
> counted string would be a nice little optimization for the XFS
> follow_link / readlink implementation. But I'm not really sure it's
> worth complicating the VFS for that little gem.
>
The inode's i_size already holds the string count so at the higher level
we have that information. But I'm convinced, nd_set_link() should receive
a new max_len, all users should be changed as a matter of code audit.
nd_set_link() should then proceed to truncate the string at that length
unconditionally no need for error returns.
My $0.017
Boaz
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists