[PATCH net-next] net: caif: Add a missing rcu_read_unlock() in caif_flow_cb

From: YueHaibing
Date: Wed Jul 18 2018 - 22:27:52 EST


Add a missing rcu_read_unlock in the error path

Fixes: c95567c80352 ("caif: added check for potential null return")
Signed-off-by: YueHaibing <yuehaibing@xxxxxxxxxx>
---
net/caif/caif_dev.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/caif/caif_dev.c b/net/caif/caif_dev.c
index e0adcd1..711d715 100644
--- a/net/caif/caif_dev.c
+++ b/net/caif/caif_dev.c
@@ -131,8 +131,10 @@ static void caif_flow_cb(struct sk_buff *skb)
caifd = caif_get(skb->dev);

WARN_ON(caifd == NULL);
- if (caifd == NULL)
+ if (!caifd) {
+ rcu_read_unlock();
return;
+ }

caifd_hold(caifd);
rcu_read_unlock();
--
2.7.0