Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1111450imm; Wed, 1 Aug 2018 10:21:53 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdrr3S+kE9KIjr0mgBadq9kbP3xdfg58Eqr1on9sejHbym+ZQ8TcgJ077hIz79CiKoo0W0v X-Received: by 2002:a63:4a07:: with SMTP id x7-v6mr25722957pga.34.1533144113796; Wed, 01 Aug 2018 10:21:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533144113; cv=none; d=google.com; s=arc-20160816; b=uXaDPsuEva+sNu5bJ6bxd+2xC/uPJ1m1kXbUB3apQHf1UAs++NwvCPAXzPe2GnEmzt hym/V4LmaEnq8Cr+5uJVGxIxQOXiEbeZXGN8TMu45w5LUX/iRcJswQONWxD007kQmjCN tAOQy52wlbjPPi2mNHJmDS8pXS0ro+ojCNAsPEz2wDxNb+z+OyU17oSZ/xHhXheafKwv pJCBxNZ8RhmaXTMgsRPHOcjoLcY/UYXAV90QSW/kq7JI/oyOS0monGqt657RC99hsEaB hXlC3hMUYl3OKIOthjOQc6VupCNQ5xs22YqUVJmRP9C5PpE/KMFOTDSnvjkNbnwAoQvT U9Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=s95uiwBtppJ3EnEbuTnpMsQFE3U6+QACujTpbWZNGng=; b=mx7/CgY+4LuZruauT/Q9SsEOEkZ0J7ZvCihAkdK9btmvfTiCHHDhzozhlWe+JN6O7D AWAWTUYBfWfTki+uxQXGT1Q4naChlyJ5hy7ER5c/Ggpax5dPMiSRsAXaEyF81yUvLB+O 34AU3EYjzhIi2MRhSgzEC53hNltC3iiQzL1FPyi+7jp2jK50lILMr2kTrcoV+QPxwlSk 1PJNg485iPUwyFGUCAjEJDAinU94D2i04+tuCQYOvuD5Ral3qQ6uk4DS1VHbLdNfXYxJ lS3uOkbnGF8G00kyL8ajq9t426BlbtxM8WtoV6Sn9fRBne8biMMjKFLQ7RDYlq3sVnIe EzFQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z22-v6si15906576plo.219.2018.08.01.10.21.39; Wed, 01 Aug 2018 10:21:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405310AbeHATGk (ORCPT + 99 others); Wed, 1 Aug 2018 15:06:40 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48940 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404595AbeHATGk (ORCPT ); Wed, 1 Aug 2018 15:06:40 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id ED6C6D38; Wed, 1 Aug 2018 17:19:57 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Boyko , Alexey Lyashkov , Doug Oucharek , "John L. Hammond" , Sasha Levin Subject: [PATCH 4.14 165/246] staging: lustre: o2iblnd: fix race at kiblnd_connect_peer Date: Wed, 1 Aug 2018 18:51:15 +0200 Message-Id: <20180801165019.647438013@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801165011.700991984@linuxfoundation.org> References: <20180801165011.700991984@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Doug Oucahrek [ Upstream commit cf04968efe341b9b1c30a527e5dd61b2af9c43d2 ] cmid will be destroyed at OFED if kiblnd_cm_callback return error. if error happen before the end of kiblnd_connect_peer, it will touch destroyed cmid and fail as (o2iblnd_cb.c:1315:kiblnd_connect_peer()) ASSERTION( cmid->device != ((void *)0) ) failed: Signed-off-by: Alexander Boyko Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-10015 Reviewed-by: Alexey Lyashkov Reviewed-by: Doug Oucharek Reviewed-by: John L. Hammond Signed-off-by: Doug Oucharek Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 18 +++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c @@ -1289,11 +1289,6 @@ kiblnd_connect_peer(struct kib_peer *pee goto failed2; } - LASSERT(cmid->device); - CDEBUG(D_NET, "%s: connection bound to %s:%pI4h:%s\n", - libcfs_nid2str(peer->ibp_nid), dev->ibd_ifname, - &dev->ibd_ifip, cmid->device->name); - return; failed2: @@ -2995,8 +2990,19 @@ kiblnd_cm_callback(struct rdma_cm_id *cm } else { rc = rdma_resolve_route( cmid, *kiblnd_tunables.kib_timeout * 1000); - if (!rc) + if (!rc) { + struct kib_net *net = peer->ibp_ni->ni_data; + struct kib_dev *dev = net->ibn_dev; + + CDEBUG(D_NET, "%s: connection bound to "\ + "%s:%pI4h:%s\n", + libcfs_nid2str(peer->ibp_nid), + dev->ibd_ifname, + &dev->ibd_ifip, cmid->device->name); + return 0; + } + /* Can't initiate route resolution */ CERROR("Can't resolve route for %s: %d\n", libcfs_nid2str(peer->ibp_nid), rc);