[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200713183554.11719-2-vinay.yadav@chelsio.com>
Date: Tue, 14 Jul 2020 00:05:53 +0530
From: Vinay Kumar Yadav <vinay.yadav@...lsio.com>
To: netdev@...r.kernel.org, davem@...emloft.net, kuba@...nel.org
Cc: secdev@...lsio.com, Vinay Kumar Yadav <vinay.yadav@...lsio.com>
Subject: [PATCH net-next 1/3] crypto/chtls: correct net_device reference count
Release net_device reference hold by ip_dev_find().
Signed-off-by: Vinay Kumar Yadav <vinay.yadav@...lsio.com>
---
drivers/crypto/chelsio/chtls/chtls_cm.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/crypto/chelsio/chtls/chtls_cm.c b/drivers/crypto/chelsio/chtls/chtls_cm.c
index f200fae6f..eedad8caa 100644
--- a/drivers/crypto/chelsio/chtls/chtls_cm.c
+++ b/drivers/crypto/chelsio/chtls/chtls_cm.c
@@ -95,6 +95,7 @@ static struct net_device *chtls_find_netdev(struct chtls_dev *cdev,
struct net_device *ndev = cdev->ports[0];
#if IS_ENABLED(CONFIG_IPV6)
struct net_device *temp;
+ bool put = false;
int addr_type;
#endif
@@ -103,6 +104,7 @@ static struct net_device *chtls_find_netdev(struct chtls_dev *cdev,
if (likely(!inet_sk(sk)->inet_rcv_saddr))
return ndev;
ndev = ip_dev_find(&init_net, inet_sk(sk)->inet_rcv_saddr);
+ put = true;
break;
#if IS_ENABLED(CONFIG_IPV6)
case PF_INET6:
@@ -126,6 +128,9 @@ static struct net_device *chtls_find_netdev(struct chtls_dev *cdev,
if (!ndev)
return NULL;
+ if (put)
+ dev_put(ndev);
+
if (is_vlan_dev(ndev))
return vlan_dev_real_dev(ndev);
return ndev;
--
2.18.1
Powered by blists - more mailing lists