linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH-V2] [fs/9p] Fix NULL point deref in v9fs_dir_release
@ 2010-08-23  2:08 Venkateswararao Jujjuri (JV)
  2010-08-23 14:21 ` [V9fs-developer] " Eric Van Hensbergen
  0 siblings, 1 reply; 2+ messages in thread
From: Venkateswararao Jujjuri (JV) @ 2010-08-23  2:08 UTC (permalink / raw)
  To: v9fs-developer; +Cc: linux-fsdevel, Venkateswararao Jujjuri (JV)

changes from v1:
Now checking fid instead of filp.

There are situations in VFS where we endup calling v9fs_dir_release() before
even we instantiate the fid in filp. Hence the check.

Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
---
 fs/9p/vfs_dir.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c
index 16c8a2a..5b01842 100644
--- a/fs/9p/vfs_dir.c
+++ b/fs/9p/vfs_dir.c
@@ -291,6 +291,8 @@ int v9fs_dir_release(struct inode *inode, struct file *filp)
 	struct p9_fid *fid;
 
 	fid = filp->private_data;
+	if (!fid)
+		return 0;
 	P9_DPRINTK(P9_DEBUG_VFS,
 			"inode: %p filp: %p fid: %d\n", inode, filp, fid->fid);
 	filemap_write_and_wait(inode->i_mapping);
-- 
1.6.5.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [V9fs-developer] [PATCH-V2] [fs/9p] Fix NULL point deref in v9fs_dir_release
  2010-08-23  2:08 [PATCH-V2] [fs/9p] Fix NULL point deref in v9fs_dir_release Venkateswararao Jujjuri (JV)
@ 2010-08-23 14:21 ` Eric Van Hensbergen
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Van Hensbergen @ 2010-08-23 14:21 UTC (permalink / raw)
  To: Venkateswararao Jujjuri (JV); +Cc: v9fs-developer, linux-fsdevel

On Sun, Aug 22, 2010 at 9:08 PM, Venkateswararao Jujjuri (JV)
<jvrao@linux.vnet.ibm.com> wrote:
> changes from v1:
> Now checking fid instead of filp.
>
> There are situations in VFS where we endup calling v9fs_dir_release() before
> even we instantiate the fid in filp. Hence the check.
>
> Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
> ---
>  fs/9p/vfs_dir.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c
> index 16c8a2a..5b01842 100644
> --- a/fs/9p/vfs_dir.c
> +++ b/fs/9p/vfs_dir.c
> @@ -291,6 +291,8 @@ int v9fs_dir_release(struct inode *inode, struct file *filp)
>        struct p9_fid *fid;
>
>        fid = filp->private_data;
> +       if (!fid)
> +               return 0;
>        P9_DPRINTK(P9_DEBUG_VFS,
>                        "inode: %p filp: %p fid: %d\n", inode, filp, fid->fid);
>        filemap_write_and_wait(inode->i_mapping);

It's probably a safe bet that if don't have a fid then
filemap_write_and_wait either won't have anything to write or won't be
able to.  Still, I'm a bit uncomfortable as if we lost the fid for
some reason and it did have something to write it would be treated as
a silent error.  I think it would probably be safer to remove the
fid->fid from the debug print (or make it conditional on fid being
non-null) and then change the clunk to be conditional on the presence
of a fid.

          -eric
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-08-23 14:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-23  2:08 [PATCH-V2] [fs/9p] Fix NULL point deref in v9fs_dir_release Venkateswararao Jujjuri (JV)
2010-08-23 14:21 ` [V9fs-developer] " Eric Van Hensbergen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).