sunrpc/xprtrdma/transport.c: fix use-after-free
authorAdrian Bunk <bunk@kernel.org>
Thu, 15 Nov 2007 01:00:00 +0000 (17:00 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 15 Nov 2007 02:45:41 +0000 (18:45 -0800)
Fix an obvious use-after-free spotted by the Coverity checker.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Neil Brown <neilb@suse.de>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
net/sunrpc/xprtrdma/transport.c

index dc55cc974c906e78d974aa664bde940fe058637c..1afeb3eb8e4c2d2e6080f3d6e47853d1b8ff8e41 100644 (file)
@@ -320,9 +320,9 @@ xprt_setup_rdma(struct xprt_create *args)
        xprt->slot = kcalloc(xprt->max_reqs,
                                sizeof(struct rpc_rqst), GFP_KERNEL);
        if (xprt->slot == NULL) {
-               kfree(xprt);
                dprintk("RPC:       %s: couldn't allocate %d slots\n",
                        __func__, xprt->max_reqs);
+               kfree(xprt);
                return ERR_PTR(-ENOMEM);
        }