Re: Use of disowned struct filename after 3c5499fa56f5?

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

 



On 06/11/2020 10:08, Dmitry Kadashev wrote:
> On Thu, Nov 05, 2020 at 08:57:43PM +0000, Pavel Begunkov wrote:
> That's pretty much what do_unlinkat() does btw. Thanks Pavel for looking
> into this!
> 
> Can I pick your brain some more? do_mkdirat() case is slightly
> different:
> 
> static long do_mkdirat(int dfd, const char __user *pathname, umode_t mode)
> {
> 	struct dentry *dentry;
> 	struct path path;
> 	int error;
> 	unsigned int lookup_flags = LOOKUP_DIRECTORY;
> 
> retry:
> 	dentry = user_path_create(dfd, pathname, &path, lookup_flags);
> 
> If we just change @pathname to struct filename, then user_path_create
> can be swapped for filename_create(). But the same problem on retry
> arises. Is there some more or less "idiomatic" way to solve this?

I don't think there is, fs guys may have a different opinion but
sometimes it's hard to get through them.

I'd take a filename reference before "retry:" and putname(filename) on
exit. Skimmed quickly and looks like nobody changes it anywhere in
user_path_create(). Since you're doing it for io_uring and so going to
push it through Jens's tree it's better to keep it small and localised
in do_mkdirat() to not cause merging troubles.

-- 
Pavel Begunkov



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux