Skip to contentSkip to conversation

drivers/net: ks8842 Fix crash on received packet when in PIO mode.

PATCH In review Dennis Aberilla 2 participants 3 messages May 18, 2011 – May 19, 2011

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

PATCH 1/1 drivers/net: ks8842 Fix crash on received packet when in PIO mode.

This patch fixes a kernel crash during packet reception due to not enough allocated bytes for the skb. This applies to the driver when running in PIO mode in an ISA bus setup.

---

drivers/net/ks8842.c +1 -1
index f0d8346..9069aee 100644
@@ -662,7 +662,7 @@ static void ks8842_rx_frame(struct net_device *netdev,
 
 	/* check the status */
 	if ((status & RXSR_VALID) && !(status & RXSR_ERROR)) {
-		struct sk_buff *skb = netdev_alloc_skb_ip_align(netdev, len);
+		struct sk_buff *skb = netdev_alloc_skb_ip_align(netdev, len + 2);
 
 		if (skb) {
 

--

Using mutt this time.

|Dennis
=======================================================================
This email, including any attachments, is only for the intended addressee. It is subject to copyright, is confidential and may be the subject of legal or other privilege, none of which is waived or lost by reason of this transmission.
If the receiver is not the intended addressee, please accept our apologies, notify us by return, delete all copies and perform no other act on the email.
Unfortunately, we cannot warrant that the email has not been altered or corrupted during transmission.
=======================================================================

maintainer
#1 lore raw

From: Dennis Aberilla <[email protected]>
Date: Thu, 19 May 2011 10:59:47 +1200

Quoted 5 lines

This patch fixes a kernel crash during packet reception due to not enough allocated bytes for the skb. This applies to the driver when running in PIO mode in an ISA bus setup.

If you're trying to accomodate the fact that the loops iterate always by 2 or 4 bytes at a time, then you will need to allocate up to "3" bytes of slack space, not just "2".

You need to describe exactly what the precise problem is in your commit message, or else people might find it difficult to figure out exactly what the problem is.

#2 lore raw
Quoted 9 lines · David Miller

From: Dennis Aberilla <[email protected]>
Date: Thu, 19 May 2011 10:59:47 +1200

Quoted 5 lines

This patch fixes a kernel crash during packet reception due to not enough allocated bytes for the skb. This applies to the driver when running in PIO mode in an ISA bus setup.

Quoted 7 lines

If you're trying to accomodate the fact that the loops iterate always by 2 or 4 bytes at a time, then you will need to allocate up to "3" bytes of slack space, not just "2".

You need to describe exactly what the precise problem is in your commit message, or else people might find it difficult to figure out exactly what the problem is.

Ah right, it should actually be 3. Yes, it accounts for the fact that the loops are reading the Rx buffer 4 bytes at a time. Sorry it wasn't too clear previously.

|Dennis
=======================================================================
This email, including any attachments, is only for the intended addressee. It is subject to copyright, is confidential and may be the subject of legal or other privilege, none of which is waived or lost by reason of this transmission.
If the receiver is not the intended addressee, please accept our apologies, notify us by return, delete all copies and perform no other act on the email.
Unfortunately, we cannot warrant that the email has not been altered or corrupted during transmission.
=======================================================================