Patchwork [net-next,02/11] caif: added check for potential null return

login
register
mail settings
Submitter sjur.brandeland@stericsson.com
Date June 25, 2012, 5:49 p.m.
Message ID <1340646583-21059-3-git-send-email-sjur.brandeland@stericsson.com>
Download mbox | patch
Permalink /patch/167184/
State Accepted
Delegated to: David Miller
Headers show

Comments

sjur.brandeland@stericsson.com - June 25, 2012, 5:49 p.m.
From: Kim Lilliestierna XX <kim.xx.lilliestierna@stericsson.com>

Add check on NULL return from caif_get().

Signed-off-by: Kim Lilliestierna <Kim.xx.Lilliestierna@stericsson.com>
Signed-off-by: Sjur Brændeland <sjur.brandeland@stericssion.com>
---
 net/caif/caif_dev.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

Patch

diff --git a/net/caif/caif_dev.c b/net/caif/caif_dev.c
index 92c9397..0f010af 100644
--- a/net/caif/caif_dev.c
+++ b/net/caif/caif_dev.c
@@ -129,6 +129,11 @@  void caif_flow_cb(struct sk_buff *skb)
 
 	rcu_read_lock();
 	caifd = caif_get(skb->dev);
+
+	WARN_ON(caifd == NULL);
+	if (caifd == NULL)
+		return;
+
 	caifd_hold(caifd);
 	rcu_read_unlock();