Skip to contentSkip to conversation

drivers/infiniband/core/mad.c: fix a NULL pointer dereference

PATCH In review Adrian Bunk 2 participants 6 messages Nov 26, 2005 – Nov 29, 2005 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/infiniband/core/mad.c: fix a NULL pointer dereference

The Coverity checker spotted this obvious NULL pointer dereference caused by a wrong order of the cleanups.

---

This patch was already sent on:
- 23 Nov 2005
- 21 Nov 2005

drivers/infiniband/core/mad.c renamed from drivers/infiniband/core/mad.c.old +2 -2
@@ -355,9 +355,9 @@
 	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;
 }
#1 lore raw

Thanks, I already have this in my git tree of pending changes
(I found it by actually hitting the crash it causes with CONFIG_DEBUG_SLAB=y).

- R.

#2 lore raw
Quoted 2 lines · Roland Dreier

Thanks, I already have this in my git tree of pending changes
(I found it by actually hitting the crash it causes with CONFIG_DEBUG_SLAB=y).

Can you Cc me when forwarding it to Linus?

After it's in Linus' tree, Greg will accept it for the 2.6.14 stable tree.

Quoted 1 line

- R.

TIA
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#3 lore raw

Adrian> Can you Cc me when forwarding it to Linus?

Looks like it went into Linus's tree directly from you (which is fine).

Adrian> After it's in Linus' tree, Greg will accept it for the Adrian> 2.6.14 stable tree.

Is this really important enough for the stable tree?

- R.

#4 lore raw
Quoted 3 lines · Roland Dreier

Adrian> Can you Cc me when forwarding it to Linus?

Looks like it went into Linus's tree directly from you (which is fine).

It went through Andrew.

Quoted 4 lines

Adrian> After it's in Linus' tree, Greg will accept it for the Adrian> 2.6.14 stable tree.

Is this really important enough for the stable tree?

You said it fixed a crash for you.

Besides this, it's a small and easy to verify change.

Quoted 1 line

- R.

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#5 lore raw

Roland> Is this really important enough for the stable tree?

Adrian> You said it fixed a crash for you.

To trigger the patch, you have to hit the error path, which in practical terms requires buggy code calling into the function. And you also have to either be running with CONFIG_DEBUG_SLAB=y or be extremely unlucky. So I don't think anyone who's not developing IB driver code could ever hit the crash, and any developers are going to be running the latest tree anyway.

Adrian> Besides this, it's a small and easy to verify change.

Sure, I don't mind it going into the stable tree. I'm just not sure it's worth spending everyone's time on it.

- R.