[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <VI1PR0502MB300838CF1E188B2D7831D28CD14A0@VI1PR0502MB3008.eurprd05.prod.outlook.com>
Date: Wed, 11 Oct 2017 14:43:05 +0000
From: Parav Pandit <parav@...lanox.com>
To: Ursula Braun <ubraun@...ux.vnet.ibm.com>,
"davem@...emloft.net" <davem@...emloft.net>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>,
"linux-s390@...r.kernel.org" <linux-s390@...r.kernel.org>,
"jwi@...ux.vnet.ibm.com" <jwi@...ux.vnet.ibm.com>,
"schwidefsky@...ibm.com" <schwidefsky@...ibm.com>,
"heiko.carstens@...ibm.com" <heiko.carstens@...ibm.com>,
"raspl@...ux.vnet.ibm.com" <raspl@...ux.vnet.ibm.com>
Subject: RE: [PATCH v2 net 2/2] net/smc: dev_put for netdev after usage of
ib_query_gid()
> -----Original Message-----
> From: Ursula Braun [mailto:ubraun@...ux.vnet.ibm.com]
> Sent: Wednesday, October 11, 2017 6:47 AM
> To: davem@...emloft.net
> Cc: netdev@...r.kernel.org; linux-rdma@...r.kernel.org; linux-
> s390@...r.kernel.org; jwi@...ux.vnet.ibm.com; schwidefsky@...ibm.com;
> heiko.carstens@...ibm.com; raspl@...ux.vnet.ibm.com;
> ubraun@...ux.vnet.ibm.com; Parav Pandit <parav@...lanox.com>
> Subject: [PATCH v2 net 2/2] net/smc: dev_put for netdev after usage of
> ib_query_gid()
>
> For RoCEs ib_query_gid() takes a reference count on the net_device.
> This reference count must be decreased by the caller.
>
> Signed-off-by: Ursula Braun <ubraun@...ux.vnet.ibm.com>
> Reported-by: Parav Pandit <parav@...lanox.com>
> Reviewed-by: Parav Pandit <parav@...lanox.com>
> Fixes: 0cfdd8f92cac ("smc: connection and link group creation")
> ---
> net/smc/smc_core.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c index
> 20b66e79c5d6..5f6a20084157 100644
> --- a/net/smc/smc_core.c
> +++ b/net/smc/smc_core.c
> @@ -380,10 +380,14 @@ static int smc_link_determine_gid(struct
> smc_link_group *lgr)
> if (ib_query_gid(lnk->smcibdev->ibdev, lnk->ibport, i, &gid,
> &gattr))
> continue;
> - if (gattr.ndev &&
> - (vlan_dev_vlan_id(gattr.ndev) == lgr->vlan_id)) {
> - lnk->gid = gid;
> - return 0;
> + if (gattr.ndev) {
> + if (is_vlan_dev(gattr.ndev) &&
> + vlan_dev_vlan_id(gattr.ndev) == lgr->vlan_id) {
> + lnk->gid = gid;
> + dev_put(gattr.ndev);
> + return 0;
> + }
> + dev_put(gattr.ndev);
> }
> }
> return -ENODEV;
> --
> 2.13.5
Looks fine now.
Powered by blists - more mailing lists