From: Parav Pandit <parav@mellanox.com>
To: Ursula Braun <ubraun@linux.vnet.ibm.com>,
"davem@davemloft.net" <davem@davemloft.net>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
"linux-s390@vger.kernel.org" <linux-s390@vger.kernel.org>,
"jwi@linux.vnet.ibm.com" <jwi@linux.vnet.ibm.com>,
"schwidefsky@de.ibm.com" <schwidefsky@de.ibm.com>,
"heiko.carstens@de.ibm.com" <heiko.carstens@de.ibm.com>,
"raspl@linux.vnet.ibm.com" <raspl@linux.vnet.ibm.com>
Subject: RE: [PATCH net-next 01/10] net/smc: add missing dev_put
Date: Mon, 2 Oct 2017 20:36:29 +0000 [thread overview]
Message-ID: <VI1PR0502MB30089D06B9C95D682E21511BD17D0@VI1PR0502MB3008.eurprd05.prod.outlook.com> (raw)
In-Reply-To: <20170920115813.63745-2-ubraun@linux.vnet.ibm.com>
Hi Ursula, Dave, Hans,
> -----Original Message-----
> From: linux-rdma-owner@vger.kernel.org [mailto:linux-rdma-
> owner@vger.kernel.org] On Behalf Of Ursula Braun
> Sent: Wednesday, September 20, 2017 6:58 AM
> 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-next 01/10] net/smc: add missing dev_put
>
> From: Hans Wippel <hwippel@linux.vnet.ibm.com>
>
> In the infiniband part, SMC currently uses get_netdev which calls dev_hold on
> the returned net device. However, the SMC code never calls dev_put on that net
> device resulting in a wrong reference count.
>
> This patch adds a dev_put after the usage of the net device to fix the issue.
>
> Signed-off-by: Hans Wippel <hwippel@linux.vnet.ibm.com>
> Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
> ---
> net/smc/smc_ib.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/net/smc/smc_ib.c b/net/smc/smc_ib.c index
> 547e0e113b17..0b5852299158 100644
> --- a/net/smc/smc_ib.c
> +++ b/net/smc/smc_ib.c
> @@ -380,6 +380,7 @@ static int smc_ib_fill_gid_and_mac(struct smc_ib_device
> *smcibdev, u8 ibport)
> ndev = smcibdev->ibdev->get_netdev(smcibdev->ibdev, ibport);
> if (ndev) {
> memcpy(&smcibdev->mac, ndev->dev_addr, ETH_ALEN);
> + dev_put(ndev);
I am sorry for providing late comments. smc_ib_fill_gid_and_mac() is not coded correctly.
Few fixes are needed.
1. ULP such as SMC should not open code/deference any function pointer like get_netdev() of the IB device.
2. Replace ib_query_gid(..., NULL)
With
ib_query_gid(..., gid_attr);
Use gid_attr.ndev to get the MAC address.
Do dev_put(gid_attr.ndev);
Code should look like below,
struct ib_gid_attr gid_attr;
rc = ib_query_gid(..., &gid_attr);
if (rc || !gid_addr.ndev)
return -ENODEV;
else
memcpy(smcibdev->mac, ndev->dev_addr, ETH_ALEN);
dev_put(gid_addr.ndev);
next prev parent reply other threads:[~2017-10-02 20:36 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-20 11:58 [PATCH net-next 00/10] net/smc: updates 2017-09-20 Ursula Braun
2017-09-20 11:58 ` [PATCH net-next 01/10] net/smc: add missing dev_put Ursula Braun
2017-10-02 20:36 ` Parav Pandit [this message]
2017-10-02 20:39 ` Parav Pandit
2017-10-05 7:54 ` Ursula Braun
2017-10-05 14:44 ` Parav Pandit
2017-09-20 11:58 ` [PATCH net-next 02/10] net/smc: add receive timeout check Ursula Braun
[not found] ` <20170920115813.63745-1-ubraun-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2017-09-20 11:58 ` [PATCH net-next 03/10] net/smc: take RCU read lock for routing cache lookup Ursula Braun
2017-09-20 15:22 ` [PATCH net-next 00/10] net/smc: updates 2017-09-20 Bart Van Assche
2017-09-20 11:58 ` [PATCH net-next 04/10] net/smc: adjust net_device refcount Ursula Braun
2017-09-20 11:58 ` [PATCH net-next 05/10] net/smc: adapt send request completion notification Ursula Braun
2017-09-20 11:58 ` [PATCH net-next 06/10] net/smc: longer delay for client link group removal Ursula Braun
2017-09-20 11:58 ` [PATCH net-next 07/10] net/smc: terminate link group if out-of-sync is received Ursula Braun
2017-09-20 11:58 ` [PATCH net-next 08/10] net/smc: introduce a delay Ursula Braun
2017-09-20 14:03 ` Leon Romanovsky
2017-09-20 14:37 ` Ursula Braun
2017-09-20 11:58 ` [PATCH net-next 09/10] net/smc: parameter cleanup in smc_cdc_get_free_slot() Ursula Braun
2017-09-20 11:58 ` [PATCH net-next 10/10] net/smc: no close wait in case of process shut down Ursula Braun
2017-09-20 23:29 ` [PATCH net-next 00/10] net/smc: updates 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=VI1PR0502MB30089D06B9C95D682E21511BD17D0@VI1PR0502MB3008.eurprd05.prod.outlook.com \
--to=parav@mellanox.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 \
--cc=ubraun@linux.vnet.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).