netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ursula Braun <ubraun@linux.vnet.ibm.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
	linux-s390@vger.kernel.org, jwi@linux.vnet.ibm.com,
	schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com,
	raspl@linux.vnet.ibm.com, ubraun@linux.vnet.ibm.com
Subject: [PATCH net 4/9] net/smc: adjust net_device refcount
Date: Thu, 21 Sep 2017 09:16:29 +0200	[thread overview]
Message-ID: <20170921071634.16883-5-ubraun@linux.vnet.ibm.com> (raw)
In-Reply-To: <20170921071634.16883-1-ubraun@linux.vnet.ibm.com>

smc_pnet_fill_entry() uses dev_get_by_name() adding a refcount to ndev.
The following smc_pnet_enter() has to reduce the refcount if the entry
to be added exists already in the pnet table.

Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
---
 net/smc/smc_pnet.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/smc/smc_pnet.c b/net/smc/smc_pnet.c
index 78f7af28ae4f..31f8453c25c5 100644
--- a/net/smc/smc_pnet.c
+++ b/net/smc/smc_pnet.c
@@ -181,8 +181,10 @@ static int smc_pnet_enter(struct smc_pnetentry *new_pnetelem)
 			     sizeof(new_pnetelem->ndev->name)) ||
 		    smc_pnet_same_ibname(pnetelem,
 					 new_pnetelem->smcibdev->ibdev->name,
-					 new_pnetelem->ib_port))
+					 new_pnetelem->ib_port)) {
+			dev_put(pnetelem->ndev);
 			goto found;
+		}
 	}
 	list_add_tail(&new_pnetelem->list, &smc_pnettable.pnetlist);
 	rc = 0;
-- 
2.13.5

  parent reply	other threads:[~2017-09-21  7:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-21  7:16 [PATCH net 0/9] net/smc: bug fixes 2017-09-20 Ursula Braun
2017-09-21  7:16 ` [PATCH net 2/9] net/smc: add receive timeout check Ursula Braun
2017-09-21  7:16 ` [PATCH net 3/9] net/smc: take RCU read lock for routing cache lookup Ursula Braun
2017-09-21  7:16 ` Ursula Braun [this message]
     [not found] ` <20170921071634.16883-1-ubraun-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2017-09-21  7:16   ` [PATCH net 1/9] net/smc: add missing dev_put Ursula Braun
2017-09-21  7:16   ` [PATCH net 5/9] net/smc: adapt send request completion notification Ursula Braun
2017-09-21  7:16   ` [PATCH net 6/9] net/smc: longer delay for client link group removal Ursula Braun
2017-09-21  7:16   ` [PATCH net 7/9] net/smc: terminate link group if out-of-sync is received Ursula Braun
2017-09-21  7:16   ` [PATCH net 9/9] net/smc: no close wait in case of process shut down Ursula Braun
2017-09-21  7:16 ` [PATCH net 8/9] net/smc: introduce a delay Ursula Braun
2017-09-21 22:31 ` [PATCH net 0/9] net/smc: bug fixes 2017-09-20 David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170921071634.16883-5-ubraun@linux.vnet.ibm.com \
    --to=ubraun@linux.vnet.ibm.com \
    --cc=davem@davemloft.net \
    --cc=heiko.carstens@de.ibm.com \
    --cc=jwi@linux.vnet.ibm.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=raspl@linux.vnet.ibm.com \
    --cc=schwidefsky@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).