diff options
author | Simon Derr <simon.derr@bull.net> | 2013-06-21 09:32:38 -0400 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@gmail.com> | 2013-07-07 23:02:28 -0400 |
commit | 47229ff85e5a0b0613df2288d212938aeb9687da (patch) | |
tree | 8ebb938dc2b5187b44bf2e5e980dca96e5e1e3c2 /net/9p | |
parent | 3fcc62f4e8620fd5f85f957a5e708e69a20adb51 (diff) |
9P/RDMA: Protect against duplicate replies
A well-behaved server would not send twice the reply to a request.
But if it ever happens...
This additional check prevents the kernel from leaking memory
and possibly more nasty consequences in that unlikely event.
Signed-off-by: Simon Derr <simon.derr@bull.net>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'net/9p')
-rw-r--r-- | net/9p/trans_rdma.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c index b8b66d38f5b0..274a9c1d3c3d 100644 --- a/net/9p/trans_rdma.c +++ b/net/9p/trans_rdma.c | |||
@@ -294,6 +294,13 @@ handle_recv(struct p9_client *client, struct p9_trans_rdma *rdma, | |||
294 | if (!req) | 294 | if (!req) |
295 | goto err_out; | 295 | goto err_out; |
296 | 296 | ||
297 | /* Check that we have not yet received a reply for this request. | ||
298 | */ | ||
299 | if (unlikely(req->rc)) { | ||
300 | pr_err("Duplicate reply for request %d", tag); | ||
301 | goto err_out; | ||
302 | } | ||
303 | |||
297 | req->rc = c->rc; | 304 | req->rc = c->rc; |
298 | req->status = REQ_STATUS_RCVD; | 305 | req->status = REQ_STATUS_RCVD; |
299 | p9_client_cb(client, req); | 306 | p9_client_cb(client, req); |