Skip to contentSkip to conversation

Fix NULL point deref in v9fs_dir_release

PATCH Superseded Venkateswararao Jujjuri (JV) 2 participants 3 messages Aug 17, 2010

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix NULL point deref in v9fs_dir_release

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

---
 fs/9p/vfs_dir.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
fs/9p/vfs_dir.c +2 -0
index 16c8a2a..9be9b35 100644
@@ -290,6 +290,8 @@ int v9fs_dir_release(struct inode *inode, struct file *filp)
 {
 	struct p9_fid *fid;
 
+	if (!filp)
+		return 0;
 	fid = filp->private_data;
 	P9_DPRINTK(P9_DEBUG_VFS,
 			"inode: %p filp: %p fid: %d\n", inode, filp, fid->fid);
Signature · 1 line
1.6.5.2
#1 lore raw
Quoted 2 lines · Venkateswararao Jujjuri (JV)

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

Err, what callchain would that be? This really should not happen.

#2 lore raw
Quoted 6 lines · Christoph Hellwig
Quoted 2 lines · Venkateswararao Jujjuri (JV)

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

Err, what callchain would that be? This really should not happen.

Call Trace:
 [<ffffffff81209cb1>] v9fs_dir_release+0x29/0x2f
 [<ffffffff81105985>] fput+0x13a/0x1ec
 [<ffffffff81207e97>] ? v9fs_open_created+0x0/0xd
 [<ffffffff811031bd>] __dentry_open+0x1d3/0x29e
 [<ffffffff811033d3>] lookup_instantiate_filp+0x6b/0x8c
 [<ffffffff81208fc6>] v9fs_vfs_create_dotl+0x1a7/0x20d
 [<ffffffff8110e30a>] vfs_create+0x70/0x92
 [<ffffffff8110eddc>] do_last+0x2e0/0x605
 [<ffffffff8110f553>] do_filp_open+0x1f8/0x5f8
 [<ffffffff811019e7>] ? mem_cgroup_charge_common+0x6a/0x7a
 [<ffffffff8125e933>] ? might_fault+0x21/0x23
 [<ffffffff8125ea32>] ? __strncpy_from_user+0x1e/0x49
 [<ffffffff81118ec2>] ? alloc_fd+0x7b/0x124
 [<ffffffff81102ef2>] do_sys_open+0x63/0x10f
 [<ffffffff81102fd1>] sys_open+0x20/0x22
 [<ffffffff81009c32>] system_call_fastpath+0x16/0x1b