Skip to contentSkip to conversation

Staging: rtl8192e: Fix potential NULL pointer dereference

PATCH In review Emil Goode 2 participants 4 messages Jul 2, 2014

Subsystems (2)
lore
Share & tools
lore

Emil Goode

author
#0 lore raw

PATCH 1/1 Staging: rtl8192e: Fix potential NULL pointer dereference

We need to make sure the struct rtllib_device pointer ieee is not NULL after the goto rx_dropped label since it is dereferenced there.

---
 drivers/staging/rtl8192e/rtllib_rx.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/rtl8192e/rtllib_rx.c +2 -1
index 60de54c..7db3e74 100644
@@ -1496,7 +1496,8 @@ int rtllib_rx(struct rtllib_device *ieee, struct sk_buff *skb,
 	return ret;
 
  rx_dropped:
-	ieee->stats.rx_dropped++;
+	if (ieee)
+		ieee->stats.rx_dropped++;
 	return 0;
 }
 EXPORT_SYMBOL(rtllib_rx);
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 13 lines · Emil Goode

We need to make sure the struct rtllib_device pointer ieee is not NULL after the goto rx_dropped label since it is dereferenced there.

---
 drivers/staging/rtl8192e/rtllib_rx.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/rtl8192e/rtllib_rx.c +0 -0
index 60de54c..7db3e74 100644

drivers/staging/rtl8192e/rtllib_rx.c int rtllib_rx(struct rtllib_device *ieee, struct sk_buff *skb, · line 1503

Quoted 9 lines
drivers/staging/rtl8192e/rtllib_rx.c +2 -1
@@ -1496,7 +1496,8 @@ int rtllib_rx(struct rtllib_device *ieee, struct sk_buff *skb,
 	return ret;
 
  rx_dropped:
-	ieee->stats.rx_dropped++;
+	if (ieee)
+		ieee->stats.rx_dropped++;
 	return 0;
 }
 EXPORT_SYMBOL(rtllib_rx);

Is this something that is hitting users today in the tree, or is this just a bug you found looking at the code?

thanks,

greg k-h

author
#2 lore raw

Hello Greg,

Quoted 16 lines · Greg Kroah-Hartman
Quoted 15 lines · Emil Goode

We need to make sure the struct rtllib_device pointer ieee is not NULL after the goto rx_dropped label since it is dereferenced there.

---
 drivers/staging/rtl8192e/rtllib_rx.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/rtl8192e/rtllib_rx.c +0 -0
index 60de54c..7db3e74 100644
@@ -1496,7 +1496,8 @@ int rtllib_rx(struct rtllib_device *ieee, struct sk_buff *skb,
 	return ret;
 
Quoted 10 lines

drivers/staging/rtl8192e/rtllib_rx.c int rtllib_rx(struct rtllib_device *ieee, struct sk_buff *skb, · line 1503

Quoted 7 lines
drivers/staging/rtl8192e/rtllib_rx.c +2 -1
  rx_dropped:
-	ieee->stats.rx_dropped++;
+	if (ieee)
+		ieee->stats.rx_dropped++;
 	return 0;
 }
 EXPORT_SYMBOL(rtllib_rx);

Is this something that is hitting users today in the tree, or is this just a bug you found looking at the code?

It's a static checker fix and I'm not aware of any impact on users. If you want I will resend with that information added?

Best regards,

Emil Goode

#3 lore raw
Quoted 30 lines · Emil Goode

Hello Greg,

Quoted 16 lines · Greg Kroah-Hartman
Quoted 15 lines · Emil Goode

We need to make sure the struct rtllib_device pointer ieee is not NULL after the goto rx_dropped label since it is dereferenced there.

---
 drivers/staging/rtl8192e/rtllib_rx.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/rtl8192e/rtllib_rx.c +0 -0
index 60de54c..7db3e74 100644
@@ -1496,7 +1496,8 @@ int rtllib_rx(struct rtllib_device *ieee, struct sk_buff *skb,
 	return ret;
 
Quoted 10 lines

drivers/staging/rtl8192e/rtllib_rx.c int rtllib_rx(struct rtllib_device *ieee, struct sk_buff *skb, · line 1503

Quoted 7 lines
drivers/staging/rtl8192e/rtllib_rx.c +2 -1
  rx_dropped:
-	ieee->stats.rx_dropped++;
+	if (ieee)
+		ieee->stats.rx_dropped++;
 	return 0;
 }
 EXPORT_SYMBOL(rtllib_rx);

Is this something that is hitting users today in the tree, or is this just a bug you found looking at the code?

Quoted 2 lines

It's a static checker fix and I'm not aware of any impact on users. If you want I will resend with that information added?

No, that's fine, just trying to see which kernel to apply this to...

thanks,

greg k-h