[sheepdog] [PATCH] sheep: fix possible NULL defererence by stat_request_begin

Liu Yuan namei.unix at gmail.com
Thu Jan 9 16:03:19 CET 2014


After queue_peer_request(), request might be released, so move stat_request_begin
ahead of request handling to avoid possible NULL deferencec.

Reported-by: Marcin Mirosław <marcin at mejor.pl>
Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 sheep/request.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sheep/request.c b/sheep/request.c
index 9f3f110..161b7db 100644
--- a/sheep/request.c
+++ b/sheep/request.c
@@ -474,7 +474,7 @@ static void queue_request(struct request *req)
 	}
 
 	req->vinfo = get_vnode_info();
-
+	stat_request_begin(req);
 	if (is_peer_op(req->op)) {
 		queue_peer_request(req);
 	} else if (is_gateway_op(req->op)) {
@@ -491,7 +491,6 @@ static void queue_request(struct request *req)
 		rsp->result = SD_RES_SYSTEM_ERROR;
 		goto done;
 	}
-	stat_request_begin(req);
 
 	return;
 done:
-- 
1.8.1.2




More information about the sheepdog mailing list