public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] irda: missing allocation result check in irlap_change_speed()
@ 2006-05-25  0:13 Florin Malita
  2006-05-25 23:22 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Florin Malita @ 2006-05-25  0:13 UTC (permalink / raw)
  To: samuel; +Cc: akpm, linux-kernel

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

Coverity CID: 434.

Signed-off-by: Florin Malita <fmalita@gmail.com>
---

diff --git a/net/irda/irlap.c b/net/irda/irlap.c
index 7029618..a165286 100644
--- a/net/irda/irlap.c
+++ b/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);
 	}
 }
 



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] irda: missing allocation result check in irlap_change_speed()
  2006-05-25  0:13 [PATCH] irda: missing allocation result check in irlap_change_speed() Florin Malita
@ 2006-05-25 23:22 ` David Miller
  2006-05-26  0:15   ` Florin Malita
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2006-05-25 23:22 UTC (permalink / raw)
  To: fmalita; +Cc: samuel, akpm, linux-kernel

From: Florin Malita <fmalita@gmail.com>
Date: Wed, 24 May 2006 20:13:26 -0400

> The skb allocation may fail, which can result in a NULL pointer
> dereference in irlap_queue_xmit().
> 
> Coverity CID: 434.
> 
> Signed-off-by: Florin Malita <fmalita@gmail.com>

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] irda: missing allocation result check in irlap_change_speed()
  2006-05-25 23:22 ` David Miller
@ 2006-05-26  0:15   ` Florin Malita
  0 siblings, 0 replies; 3+ messages in thread
From: Florin Malita @ 2006-05-26  0:15 UTC (permalink / raw)
  To: David Miller; +Cc: samuel, akpm, linux-kernel

David Miller wrote:
> 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.
>   
I thought the speed change would be piggybacked on the next frame, same
as when 'now' == 0. Is that not the case?

	self->speed = speed;

	/* Change speed now, or just piggyback speed on frames */
	if (now) {
		/* Send down empty frame to trigger speed change */
		skb = dev_alloc_skb(0);
		if (skb)
			irlap_queue_xmit(self, skb);
	}



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-05-26  0:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-25  0:13 [PATCH] irda: missing allocation result check in irlap_change_speed() Florin Malita
2006-05-25 23:22 ` David Miller
2006-05-26  0:15   ` Florin Malita

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox