Skip to contentSkip to conversation

Add a Warning to catch NULL fids passed to p9_client_clunk().

PATCH In review Venkateswararao Jujjuri (JV) 2 participants 3 messages Aug 25, 2010 – Aug 26, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add a Warning to catch NULL fids passed to p9_client_clunk().

---
 net/9p/client.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
net/9p/client.c +6 -0
index dc6f2f2..aa7be29 100644
@@ -1201,6 +1201,12 @@ int p9_client_clunk(struct p9_fid *fid)
 	struct p9_client *clnt;
 	struct p9_req_t *req;
 
+	if (!fid) {
+		P9_EPRINTK(KERN_WARNING, "Trying to clunk with NULL fid\n");
+		dump_stack();
+		return 0;
+	}
+
 	P9_DPRINTK(P9_DEBUG_9P, ">>> TCLUNK fid %d\n", fid->fid);
 	err = 0;
 	clnt = fid->clnt;
Signature · 1 line
1.6.5.2
#1 lore raw
Quoted 12 lines · Venkateswararao Jujjuri (JV)
---
 net/9p/client.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
net/9p/client.c +0 -0
index dc6f2f2..aa7be29 100644
@@ -1201,6 +1201,12 @@ int p9_client_clunk(struct p9_fid *fid)
 	struct p9_client *clnt;
 	struct p9_req_t *req;

net/9p/client.c int p9_client_clunk(struct p9_fid *fid) · line 1212

Quoted 10 lines
net/9p/client.c +6 -0
 
+	if (!fid) {
+		P9_EPRINTK(KERN_WARNING, "Trying to clunk with NULL fid\n");
+		dump_stack();
+		return 0;
+	}
+
 	P9_DPRINTK(P9_DEBUG_9P, ">>> TCLUNK fid %d\n", fid->fid);
 	err = 0;
 	clnt = fid->clnt;

But why ? We should not have called clunk on null fid. Do you see any area of code that can do this ? Or is it a debug patch that you did when developing other features. In case of later do we need to merge this upstream ?

-aneesh

#2 lore raw
Quoted 14 lines · Aneesh Kumar K. V
Quoted 13 lines · Venkateswararao Jujjuri (JV)
---
 net/9p/client.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
net/9p/client.c +0 -0
index dc6f2f2..aa7be29 100644
@@ -1201,6 +1201,12 @@ int p9_client_clunk(struct p9_fid *fid)
 	struct p9_client *clnt;
 	struct p9_req_t *req;
 
Quoted 14 lines

net/9p/client.c int p9_client_clunk(struct p9_fid *fid) · line 1212

Quoted 9 lines
net/9p/client.c +6 -0
+	if (!fid) {
+		P9_EPRINTK(KERN_WARNING, "Trying to clunk with NULL fid\n");
+		dump_stack();
+		return 0;
+	}
+
 	P9_DPRINTK(P9_DEBUG_9P, ">>> TCLUNK fid %d\n", fid->fid);
 	err = 0;
 	clnt = fid->clnt;

But why ? We should not have called clunk on null fid. Do you see any area of code that can do this ? Or is it a debug patch that you did when developing other features. In case of later do we need to merge this upstream ?

It is kind of debug patch..as we don't know any known case, assuming that the v9fs_dir_release()
goes into mainline.
It will be nice if merged into upstream..but not an absolute requirement.

Thanks,
JV

Quoted 2 lines

-aneesh