Skip to contentSkip to conversation

irda: missing allocation result check in irlap_change_speed()

PATCH In review [email protected] 1 participant 1 message Jun 2, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 14/17 irda: missing allocation result check in irlap_change_speed()

From: Florin Malita <[email protected]>

The skb allocation may fail, which can result in a NULL pointer dereference in irlap_queue_xmit().

Coverity CID: 434.

davem: "If the allocation fails we should probably do something more interesting here, such as schedule a timer to try again later. Otherwise the speed change will silently never occur."

---

 net/irda/irlap.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/irda/irlap.c renamed from net/irda/irlap.c~irda-missing-allocation-result-check-in-irlap_change_speed +2 -1
diff -puN net/irda/irlap.c~irda-missing-allocation-result-check-in-irlap_change_speed net/irda/irlap.c
@@ -884,7 +884,8 @@ static void irlap_change_speed(struct ir
 	if (now) {
 		/* Send down empty frame to trigger speed change */
 		skb = dev_alloc_skb(0);
-		irlap_queue_xmit(self, skb);
+		if (skb)
+			irlap_queue_xmit(self, skb);
 	}
 }
 

_