summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/9p/client.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/9p/client.c b/net/9p/client.c
index aaa37b07e30a..b554f8357f96 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -297,6 +297,11 @@ p9_tag_alloc(struct p9_client *c, int8_t type, uint t_size, uint r_size,
p9pdu_reset(&req->rc);
req->t_err = 0;
req->status = REQ_STATUS_ALLOC;
+ /* refcount needs to be set to 0 before inserting into the idr
+ * so p9_tag_lookup does not accept a request that is not fully
+ * initialized. refcount_set to 2 below will mark request ready.
+ */
+ refcount_set(&req->refcount, 0);
init_waitqueue_head(&req->wq);
INIT_LIST_HEAD(&req->req_list);