[PATCH] drivers/infiniband/core/mad.c: fix use-after-release case
authorAdrian Bunk <bunk@stusta.de>
Sat, 26 Nov 2005 23:37:36 +0000 (00:37 +0100)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 28 Nov 2005 04:23:13 +0000 (20:23 -0800)
The Coverity checker spotted this obvious use-after-release bug caused
by a wrong order of the cleanups.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/infiniband/core/mad.c

index 41d6b40..d393b50 100644 (file)
@@ -355,9 +355,9 @@ error4:
        spin_unlock_irqrestore(&port_priv->reg_lock, flags);
        kfree(reg_req);
 error3:
-       kfree(mad_agent_priv);
-error2:
        ib_dereg_mr(mad_agent_priv->agent.mr);
+error2:
+       kfree(mad_agent_priv);
 error1:
        return ret;
 }