Re: [PATCH] vfs: use kstrdup()

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Al Viro <viro@...>
Cc: Li Zefan <lizf@...>, Andrew Morton <akpm@...>, LKML <linux-kernel@...>
Date: Monday, July 21, 2008 - 3:09 am

[Al Viro - Mon, Jul 21, 2008 at 08:03:46AM +0100]
| On Mon, Jul 21, 2008 at 02:29:47PM +0800, Li Zefan wrote:
| > > FWIW, it _is_ a good question.
| > > 
| > > 	* is all code treating ->mnt_devname as optional?  AFAICS, there's
| > > at least one place in NFS that doesn't.  We could treat failing allocation
| > > the same way we treat failing allocation of vfsmount itself - callers can
| > > cope with that already.
| > 
| > I just did a cleanup, and the original code didn't check for NULL.
| 
| I know.
| 
| > I just looked into the git history, and I found out since fs/namespace.c was
| > created in v2.4.10.4, the code has never changed to check for failing
| > allocation of ->mnt_devname.
| 
| It used to have no users beyond fs/namespace.c itself and for _those_ the
| thing had been optional, so leaving NULL had been OK.  Unfortunately, it
| still had been a bad idea - new users had appeared and those predictably
| didn't notice that fun detail.
| 
| The right thing here is to consider failing allocation of ->mnt_devname
| as failure of the entire alloc.
|

Hi Al,

thanks a lot for comments! I think it is more then enough for now (i'm
about failing allocation in whole). If that happens and we are not able
to duplicate string - it's quite probable we will be in serious troubles
soon anyway ('cause of further kmalloc calls). So it's better to get
mount allocation fails then NULL deref.
 
		- Cyrill -
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] vfs: use kstrdup(), Li Zefan, (Sat Jul 19, 6:16 am)
Re: [PATCH] vfs: use kstrdup(), Cyrill Gorcunov, (Sat Jul 19, 9:13 am)
Re: [PATCH] vfs: use kstrdup(), Cyrill Gorcunov, (Sat Jul 19, 9:19 am)
Re: [PATCH] vfs: use kstrdup(), Al Viro, (Mon Jul 21, 1:27 am)
Re: [PATCH] vfs: use kstrdup(), Li Zefan, (Mon Jul 21, 2:29 am)
Re: [PATCH] vfs: use kstrdup(), Al Viro, (Mon Jul 21, 3:03 am)
Re: [PATCH] vfs: use kstrdup(), Cyrill Gorcunov, (Mon Jul 21, 4:04 am)
Re: [PATCH] vfs: use kstrdup(), Li Zefan, (Mon Jul 21, 4:28 am)
Re: [PATCH] vfs: use kstrdup(), Cyrill Gorcunov, (Mon Jul 21, 4:44 am)
Re: [PATCH] vfs: use kstrdup(), Li Zefan, (Mon Jul 21, 4:59 am)
Re: [PATCH] vfs: use kstrdup(), Al Viro, (Mon Jul 21, 5:12 am)
Re: [PATCH] vfs: use kstrdup(), Pekka Enberg, (Mon Jul 21, 5:06 am)
Re: [PATCH] vfs: use kstrdup(), Cyrill Gorcunov, (Mon Jul 21, 6:05 am)
Re: [PATCH] vfs: use kstrdup(), Li Zefan, (Mon Jul 21, 6:10 am)
Re: [PATCH] vfs: use kstrdup(), Cyrill Gorcunov, (Mon Jul 21, 6:17 am)
Re: [PATCH] vfs: use kstrdup(), Al Viro, (Mon Jul 21, 4:28 am)
Re: [PATCH] vfs: use kstrdup(), Cyrill Gorcunov, (Mon Jul 21, 4:42 am)
Re: [PATCH] vfs: use kstrdup(), Cyrill Gorcunov, (Mon Jul 21, 4:35 am)
Re: [PATCH] vfs: use kstrdup(), Cyrill Gorcunov, (Mon Jul 21, 3:09 am)
Re: [PATCH] vfs: use kstrdup(), Pekka Enberg, (Sat Jul 19, 7:30 am)