From: Adrian Bunk Date: Sat, 26 Nov 2005 23:37:36 +0000 (+0100) Subject: [PATCH] drivers/infiniband/core/mad.c: fix use-after-release case X-Git-Tag: v2.6.15-rc3~35 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2012a116d9e6803fb072d0cfe1aae0cc4e6d6416;p=linux-2.6 [PATCH] drivers/infiniband/core/mad.c: fix use-after-release case The Coverity checker spotted this obvious use-after-release bug caused by a wrong order of the cleanups. Signed-off-by: Adrian Bunk Signed-off-by: Linus Torvalds --- diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index 41d6b4017a..d393b504bf 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c @@ -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; }