Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp566238pxb; Wed, 1 Sep 2021 05:28:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznvS2mh4qu+74xE1/7sNRmfPX34fCciWLlZVYqObp0PBdhBIkMSXd6zNKy56pyx24rhtC9 X-Received: by 2002:a05:6e02:e03:: with SMTP id a3mr236883ilk.144.1630499325231; Wed, 01 Sep 2021 05:28:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630499325; cv=none; d=google.com; s=arc-20160816; b=AH8lv1Korhu4wx5/giSe4dIAEFLoANVpXL5P2jxdeOBF9C4N0bNef/rimx671o41cL ULS+mYB1HkYe5I6VnHhNjhqO3HPkQNNcu02BkAxE7TyQU7gNU92ABpxDtgCSdoSUuTFb BGg4K+3ljV08aiFR+Z1pf1d7Y3zHhhjoxUN7mX257y8mw6yQRWqoIMnrcATvuVFXYoIU I7lHr0rnoVpnGTzhn+CaTvkML7xaLKRQM9B5PdWBuAXIBzfArWIeFYarHcxXOrAUNYFm opAfSHWVzTKwtFiwEBbbOQEHMZc88gBrq9o+/VfB8Tt/csJlbeG2ghJDr48f4efMsyL6 uO9g== 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=8HyV/FdoXfEWHHjP2A1fgvve0WVNxQNCD8ExXYQCV8M=; b=uROzqYumgodYsOTNIGuuKCYt8SbOf0W3xqmZ9Vt+H67ESKddMJdShm8BSssOkCaYa0 JlErUyThpn2GDYTd/3g39lNN9eWFgjTGj/R4luWYDVXIEVT53dNq0tRB81RM99fYuVWY FqJKcugEn5se6t7GF/S0Wot/CqlHp9OrlXVMXkET0ah/4o4gVQNfUMU9yN+HJfk0LceL KHjDd3WoPvlhRQdDBzxF5xCRl/eMa+9v/ZAjqKL2smOj23iahckkouO/9My/1xlZf1qV pZEv1okbwYqI2FzWCITbPBy0hFbfb8UQQ8kzMbLEFwvXndtOUHqw1obI52D/SE7bCK4O yI5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wjExnEkD; 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 u2si21536816ilk.59.2021.09.01.05.28.33; Wed, 01 Sep 2021 05:28:45 -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=wjExnEkD; 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 S244278AbhIAM2U (ORCPT + 99 others); Wed, 1 Sep 2021 08:28:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:57470 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244202AbhIAM2K (ORCPT ); Wed, 1 Sep 2021 08:28:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1D4BA61056; Wed, 1 Sep 2021 12:27:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1630499232; bh=AUH35JSSsY17ol35rLqw1Deg7KdQeZy6AL5d2IXjs4Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wjExnEkDy8gG2CJBdcW3KFH6nWMvlQyagSJCK/MhCM/cupH+jrPMlYc/cmLQJ8PaO jFs0OggCnS2kLR+UESbFUN9OIVONOnM4y/48pPhg8+ccZAxpgz4GXUc1irps2C5rVH DcX6zz2Hk4g2Lo3XriKxlKH5X/juNA6+2AyrAKh8= 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.9 12/16] net/rds: dma_map_sg is entitled to merge entries Date: Wed, 1 Sep 2021 14:26:38 +0200 Message-Id: <20210901122249.305212889@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210901122248.920548099@linuxfoundation.org> References: <20210901122248.920548099@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 3d9c4c6397c3..20d045faf07c 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