Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp876012pxb; Wed, 1 Sep 2021 11:52:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+FGOU9yFOcnMdd9d8sSLuB1E2za+EjAKlLi2pa/dL5KWqnb7G8uVS8DqG8V97Ne/oB1c6 X-Received: by 2002:a17:907:2a85:: with SMTP id fl5mr983204ejc.91.1630522374181; Wed, 01 Sep 2021 11:52:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630522374; cv=none; d=google.com; s=arc-20160816; b=KB8DslIjay2T18UxheKmy3lm17VV0dOlJFBuVLIMbdGyNpTyHo1xu4Fu6O1ukjNTrZ dQ2WvLOGATPctjNX4fcQkSXB5EDtwYC+bH7SDNsFEk7U7vP3F8GR3PCmek7B4KSCbYgx 3HTvuGSdvAV3CgO6oa0Gze+reKYBnOYlb0NSkmNEKPOrab7qo8BDHktQ9PMb+WtWzd5A hd6fS1tzYaXQB16Fr2Cgt/qGyouykLVDzgDgSwCurOW+wYDWoTU62jCx5tdASaDPvbwt ngfbSuZIgcjvlEQ1n3l1kV725TtgYI3aqZ2GpLWun/v2MPlSDm/5N4vmZYceQRv6WJhf odiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=K3dNSiC1ctvlToUdJTaGjfqbtBJFz54MAGEGJMwegss=; b=T4Jcp5+Ih2iogRwb084gzR6Sm2Z2277RnGCK3DagYz3EllnNfJD+O0TI8SAqCH+Sxl hQCPlxZAM7LxwotELtZYkeMU1Q7Y+dxrWxNPUldSrJctxk4+b80P1kAt2k4Pgn+6UnuB /TXy/genLnkKNufFtB1k3QGTA358g/a+h5XKyJTzysr2S2h5Ft7qGZSA77FR1brEukm+ jhIxDbdEcEpjgLXEWI/yTxO7zu+SfF3/l5UxV2uGl4IN78lukBXrcu1Rm2S7pLRKExzi k0OxtyfSY90agiEJz7hed05AknbEj98d7SnG31+0x2vw46k71TS3df/cfN7+ucTSEks5 wWbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hCEkm8EP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e26si679192ejl.88.2021.09.01.11.52.30; Wed, 01 Sep 2021 11:52:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hCEkm8EP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244576AbhIAMaC (ORCPT + 99 others); Wed, 1 Sep 2021 08:30:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:59274 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244214AbhIAM3e (ORCPT ); Wed, 1 Sep 2021 08:29:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 07D1561090; Wed, 1 Sep 2021 12:28:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1630499310; bh=vSW7KQeakcHYXjDc8nLEj/T4IT9NFEEg150K6geatiM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hCEkm8EPQyHkvfQ3z22wLxG0i0Fx0rJ6ZyXn+IYkGcNZsFOy8exQhMFLNliC1KMa7 WfpqZLETvLhsQseTYgG2pdxBG9n7SlRw7+HxeknxrBK1hodyAn4/dV7fX7VzH8auG0 IiAZ1qQWZiuSXTY893EufzdyJp6fudusLztBFYWs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gerd Rausch , Santosh Shilimkar , Jakub Kicinski , Sasha Levin Subject: [PATCH 4.14 18/23] net/rds: dma_map_sg is entitled to merge entries Date: Wed, 1 Sep 2021 14:27:03 +0200 Message-Id: <20210901122250.373007276@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210901122249.786673285@linuxfoundation.org> References: <20210901122249.786673285@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Gerd Rausch [ Upstream commit fb4b1373dcab086d0619c29310f0466a0b2ceb8a ] Function "dma_map_sg" is entitled to merge adjacent entries and return a value smaller than what was passed as "nents". Subsequently "ib_map_mr_sg" needs to work with this value ("sg_dma_len") rather than the original "nents" parameter ("sg_len"). This old RDS bug was exposed and reliably causes kernel panics (using RDMA operations "rds-stress -D") on x86_64 starting with: commit c588072bba6b ("iommu/vt-d: Convert intel iommu driver to the iommu ops") Simply put: Linux 5.11 and later. Signed-off-by: Gerd Rausch Acked-by: Santosh Shilimkar Link: https://lore.kernel.org/r/60efc69f-1f35-529d-a7ef-da0549cad143@oracle.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/rds/ib_frmr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/rds/ib_frmr.c b/net/rds/ib_frmr.c index d290416e79e9..9fd550d4116c 100644 --- a/net/rds/ib_frmr.c +++ b/net/rds/ib_frmr.c @@ -112,9 +112,9 @@ static int rds_ib_post_reg_frmr(struct rds_ib_mr *ibmr) cpu_relax(); } - ret = ib_map_mr_sg_zbva(frmr->mr, ibmr->sg, ibmr->sg_len, + ret = ib_map_mr_sg_zbva(frmr->mr, ibmr->sg, ibmr->sg_dma_len, &off, PAGE_SIZE); - if (unlikely(ret != ibmr->sg_len)) + if (unlikely(ret != ibmr->sg_dma_len)) return ret < 0 ? ret : -EINVAL; /* Perform a WR for the fast_reg_mr. Each individual page -- 2.30.2