RE: NULL Pointer Deference: NFS & Telnet

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Arce, Abraham
Date: Tuesday, May 25, 2010 - 6:48 pm

Hi,

I am able to avoid the NULL pointer dereference but not sure if the handling
is the correct one... find the patch below...


Check for NULL data in sk_buff before sending to put_page

Signed-off-by: Abraham Arce <x0066660@ti.com>
---
 net/core/skbuff.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index f8abf68..eb81f76 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -334,7 +334,7 @@ static void skb_release_data(struct sk_buff *skb)
 	if (!skb->cloned ||
 	    !atomic_sub_return(skb->nohdr ? (1 << SKB_DATAREF_SHIFT) + 1 : 1,
 			       &skb_shinfo(skb)->dataref)) {
-		if (skb_shinfo(skb)->nr_frags) {
+		if (skb_shinfo(skb)->nr_frags && skb_has_frags(skb)) {
 			int i;
 			for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
 				put_page(skb_shinfo(skb)->frags[i].page);
-- 
1.5.4.3

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
NULL Pointer Deference: NFS &amp; Telnet, Arce, Abraham, (Mon May 24, 7:19 pm)
RE: NULL Pointer Deference: NFS & Telnet, Arce, Abraham, (Tue May 25, 6:48 pm)
Re: NULL Pointer Deference: NFS &amp; Telnet, David Miller, (Tue May 25, 6:52 pm)
RE: NULL Pointer Deference: NFS &amp; Telnet, Arce, Abraham, (Tue May 25, 7:02 pm)
RE: NULL Pointer Deference: NFS &amp; Telnet, Eric Dumazet, (Tue May 25, 10:29 pm)
RE: NULL Pointer Deference: NFS &amp; Telnet, Arce, Abraham, (Wed May 26, 1:19 pm)
RE: NULL Pointer Deference: NFS &amp; Telnet, Eric Dumazet, (Wed May 26, 1:48 pm)
Re: NULL Pointer Deference: NFS &amp; Telnet, David Miller, (Fri Jun 4, 4:15 pm)