Re: [PATCH 3/3] tomoyo: robustify handling of mm->exe_file

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

 



Thank you, but I think this patch is wrong and redundant.

Davidlohr Bueso wrote:
> On Wed, 2015-02-18 at 16:10 -0800, Davidlohr Bueso wrote:
> > +static const char *tomoyo_get_exe(struct mm_struct *mm)
> > +{
> > +	struct file *exe_file;
> > +	const char *cp = NULL;
> > +
> > +	if (!mm)
> > +		return NULL;
> > +	exe_file = get_mm_exe_file(mm);
> > +	if (!exe_file)
> > +		return NULL;
> > +
> > +	cp = tomoyo_realpath_from_path(&exe_file->f_path);
> 
> tomoyo_realpath_from_path can return NULL here, thus we'd leak the
> f_path in the caller... I guess this should be:
> 
> > +	path_get(&exe_file->f_path);
> 
> 	if (cp)
> 		path_get(&exe_file->f_path);
> 
Why do we need to let the caller call path_put() ?
There is no need to do like proc_exe_link() does, for
tomoyo_get_exe() returns pathname as "char *".

> > +	fput(exe_file);
> > +	return cp;
> > +}

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]