Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8277266ybi; Tue, 9 Jul 2019 12:29:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqzkhdoVenI3cn6X0PFzdMsOnzr2SF+Ktx3EGWDhkavGeIKDIWUVPNo/KUeA31dqp33Usw8S X-Received: by 2002:a63:f857:: with SMTP id v23mr29990450pgj.228.1562700588105; Tue, 09 Jul 2019 12:29:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562700588; cv=none; d=google.com; s=arc-20160816; b=nqY2Lb2yuZHm+uOOaSKWN/sEW+vBIERJYWBNGVI3VrxAJY5CMyt54LQgab8XvOv4JD 0uuZq+eafv8h5nrvAZDcxTkZmomW3VQ+Okn4Yhbt9n0W28jtRGpUd1cxGMpeevtIOJv/ 21KRv8+WlzjjZCL3o9PPOkGwVFr/4YOo4rNAgmZDGqdowFzDYihyGtsda1gsqFBo5Sh5 fZmViY0Kuov5aXB7o4FY4GcaI7+Tn0RcNVWK5c+PuiuqLW5kHBvzAMl6j/s9ihp+0bhG HMJe2CzBvO+wnwQocPe8ytoh8oJsYUZswlRox/9BaMM2KgYk5L7Ay/DtGlq8TiHrl80f alQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=qFPYMlatRmetzjaVywzD1EkupZI+i6KZ4Te6RX2Ssgg=; b=Xu5QVgku1O6xw0xbWu9xuJeCN/7Hy56+phYiNzVfp1PZIY88+BEMzhR6M/85plEtX0 4tgRzJLNZWo3nfB0TuqfOSF+5GK+YR3fsN19bpqR+ITneM3sV4yoi/wcnsTetmHRroz2 YM43YsYXIIZJLgaPkkp9ujiImLhUcoRE7WFq/npMXXRv5StZ4pIkBG0N2eDBpjIqmBaj 7AuBTxGYuZmvHQ3KwWZuc80haiMXE3vy/du/1JBWWLR2JjZdGNvC0zmrmp4YNMRcSFEz c2EHH9IFPtVsSAELJvpce59lzmrxcwq9R6T7Dm8YRmeW7xamKhKl8s+AVa0R4KPLVN0I tucQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=IqFeC6lq; 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 g18si22829894plq.190.2019.07.09.12.29.32; Tue, 09 Jul 2019 12:29:48 -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; dkim=pass header.i=@ziepe.ca header.s=google header.b=IqFeC6lq; 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 S1727942AbfGIT25 (ORCPT + 99 others); Tue, 9 Jul 2019 15:28:57 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:38821 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727053AbfGIT25 (ORCPT ); Tue, 9 Jul 2019 15:28:57 -0400 Received: by mail-qk1-f195.google.com with SMTP id a27so14177qkk.5 for ; Tue, 09 Jul 2019 12:28:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=qFPYMlatRmetzjaVywzD1EkupZI+i6KZ4Te6RX2Ssgg=; b=IqFeC6lqXbdZ3dpbNj3MGYkWGyiAaZVTE68AzWEvPyH4U3Si1l43DWpa2CyOJzFxaD MTb7VJKkn6UIHASdo7JQ9V9d4c1ythaZULvzJt7fggl/SvsAjJsRptHHGmEtgUTHnR+6 OATTQitRgXk6Rn1E3BoFgh0xNdo7Re5Rs+5ktOVDwndn3TPrmKBOVlsNXgxnxW9UnPPg s71UovCRFpFCjJLBLX/b51pywqQafrbHj0UL9RUuvxaQ0hDEl8tPG6RBpvpnjQWJ1Zxu j3l7IdDnFpLWU/SRTHiSySFYCwaTXSZqw1SI1koykt9u+S0WhVWFWLzl+KUSEZtqMue2 WVBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=qFPYMlatRmetzjaVywzD1EkupZI+i6KZ4Te6RX2Ssgg=; b=ZkXfvllwIowa/6+iIax7/1+uuf6+6JZoh5EZIHE82HmLnD/YGwGzk2YFM0VCdSi4oS U8qTZ1gPEln6ZpVQt+ae1VySePPTvoEQbjr7eYJLqPskRt7OTihOI4o19UCgcccBt4lp ymsh98dwG0GxVYW37bdqLx2wYFRiH4HCcdvPPUGc2iEaf6Ydl/n2HW8WsSEYYwxUlSDR +cjErbKd2OE23WovozC4YiKORh4MBK97jxuAM9rUGbUWiUrc1f80V7kPBSCAa4f5DjVX XThKAaSxgrpbQfGbOy/BIcmzNHNnJU3LeSGT+Jb/ddwRdSuDIqjczscIc+SacRnB97Vj qGng== X-Gm-Message-State: APjAAAU9OYUPZoTFqOZF+P5T0r8FHsK9BXdD8y2HjcQp/wyvyUdNL6EJ IECSzcC6ghX0ASZbCRIwD7xHog== X-Received: by 2002:ae9:f809:: with SMTP id x9mr20461177qkh.86.1562700535890; Tue, 09 Jul 2019 12:28:55 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-55-100.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.55.100]) by smtp.gmail.com with ESMTPSA id c82sm8224941qkb.112.2019.07.09.12.28.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Jul 2019 12:28:55 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1hkvnK-0003m5-Te; Tue, 09 Jul 2019 16:28:54 -0300 Date: Tue, 9 Jul 2019 16:28:54 -0300 From: Jason Gunthorpe To: Dag Moxnes Cc: dledford@redhat.com, leon@kernel.org, parav@mellanox.com, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4] RDMA/core: Fix race when resolving IP address Message-ID: <20190709192854.GA14462@ziepe.ca> References: <1562673026-31996-1-git-send-email-dag.moxnes@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1562673026-31996-1-git-send-email-dag.moxnes@oracle.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 09, 2019 at 01:50:26PM +0200, Dag Moxnes wrote: > Use the neighbour lock when copying the MAC address from the neighbour > data struct in dst_fetch_ha. > > When not using the lock, it is possible for the function to race with > neigh_update(), causing it to copy an torn MAC address: > > rdma_resolve_addr() > rdma_resolve_ip() > addr_resolve() > addr_resolve_neigh() > fetch_ha() > dst_fetch_ha() > memcpy(dev_addr->dst_dev_addr, n->ha, MAX_ADDR_LEN) > > and > > net_ioctl() > arp_ioctl() > arp_rec_delete() > arp_invalidate() > neigh_update() > __neigh_update() > memcpy(&neigh->ha, lladdr, dev->addr_len) > > It is possible to provoke this error by calling rdma_resolve_addr() in a > tight loop, while deleting the corresponding ARP entry in another tight > loop. > > Fixes: 51d45974515c ("infiniband: addr: Consolidate code to fetch neighbour hardware address from dst.") > Signed-off-by: Dag Moxnes > Signed-off-by: HÃ¥kon Bugge > Reviewed-by: Parav Pandit > Signed-off-by: Jason Gunthorpe > --- > drivers/infiniband/core/addr.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Applied to for-next, thanks Jason