2011-02-03 11:29:22

by Andrei Vagin

[permalink] [raw]
Subject: [PATCH] fs: Correctly check d_alloc_name() return code in devpts_pty_new

d_alloc_name return NULL in case error, but we expect errno in
devpts_pty_new.

http://bugzilla.openvz.org/show_bug.cgi?id=1758

Signed-off-by: Andrey Vagin <[email protected]>
---
fs/devpts/inode.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index 1bb547c..8392c8c 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -501,7 +501,7 @@ int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty)
mutex_lock(&root->d_inode->i_mutex);

dentry = d_alloc_name(root, s);
- if (!IS_ERR(dentry)) {
+ if (dentry) {
d_add(dentry, inode);
fsnotify_create(root->d_inode, dentry);
}
--
1.7.2.1


2011-02-03 15:57:02

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH] fs: Correctly check d_alloc_name() return code in devpts_pty_new

On Thu, Feb 03, 2011 at 02:29:11PM +0300, Andrey Vagin wrote:
> d_alloc_name return NULL in case error, but we expect errno in
> devpts_pty_new.
>
> http://bugzilla.openvz.org/show_bug.cgi?id=1758
>
> Signed-off-by: Andrey Vagin <[email protected]>
> ---
> fs/devpts/inode.c | 2 +-

Nice, but I'm not the devpts maintainer, why not send this to the vfs
maintainer instead?

thanks,

greg k-h