Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp8338224ybi; Thu, 6 Jun 2019 10:31:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqyhPqgjppslWx5Jz2NHv/T5zYL2fmOF1M99Qt8VoTOcJZ+UrH9290cGwkaviTD7XSZxBobT X-Received: by 2002:a17:902:20e2:: with SMTP id v31mr51157439plg.138.1559842272672; Thu, 06 Jun 2019 10:31:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559842272; cv=none; d=google.com; s=arc-20160816; b=0cA7zsaYv/XIRsgevZRa9MFQ5nWndZmmVnxC4otrjvPKw/ut63XghDLSrD6p2E88+B z20JCP/cjuzEK6/nY38DzrKdRNr1gxFhzZBUeXChgDMl9WRKEPawPSV8pLI8LRYMkq1i 4v0MhNzyxhxjI0ZmqL+IGk2FqFFcAvF+v+NdRhWIvp5RVhHfmZbV1PVi3bEhFzClBDCD IL0eE3GAtDKeyexmgCLyTK5io6du3/pt92I08KI2TsSZ4qU8bFcHE2JF7T8KDBymPPq5 4x7vBqRaVdq4u0zGlRf1tcutjLqJk7eOsL0sN+2STnNFWGHpuaQNAcqINsdEK3S+3D+O dlHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=2YcQi322gU65udmxZ663ZZ4Wmd0vpO9jY2pkneP18U8=; b=TpI/MmQQsBCVa4ZsKfr3iFOpo1SGYDrh07/L/LYInUAck+IKt2kw57Mg2OtnO55rWT kHLneacD9SfJZcth5GvBCP86Besrho6I+UqThNqkoCJdm+CzFwup6MjtXXowIePjCJAH 52JTa6YvueuyCqw/Ql9Kv0ZKtLsIcORhMbC1T4S4lM6D6jrhFIWbiBRLI+PCixWKRHhr 0gYlfFIcrKtUkIxbVoDoH7eYMECMF8DGYjFAuQ/rnSL2K8X63OQQOVYOb/Jr/QpRxvuK fakLb7icnmDNjpSW/pWZjIj1JWptWeTNUIufFgM+3aOSAyhq3OgPuWiPwQxYgOxnoNVu vifg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arista.com header.s=googlenew header.b=dPVis3py; 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; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=arista.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h16si2296174pfn.162.2019.06.06.10.30.49; Thu, 06 Jun 2019 10:31:12 -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=@arista.com header.s=googlenew header.b=dPVis3py; 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; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=arista.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727068AbfFFONH (ORCPT + 99 others); Thu, 6 Jun 2019 10:13:07 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:39765 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727559AbfFFONH (ORCPT ); Thu, 6 Jun 2019 10:13:07 -0400 Received: by mail-pl1-f196.google.com with SMTP id g9so982638plm.6 for ; Thu, 06 Jun 2019 07:13:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arista.com; s=googlenew; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2YcQi322gU65udmxZ663ZZ4Wmd0vpO9jY2pkneP18U8=; b=dPVis3pyGrHlNapFxyZ1x9FyS9jHmd9LaTMqq9zxLdzeQq73zejEUwtK4x5P95VHCi WbnjrcVTw0kkko56uuK+VX/DWBgM1VpJFCd01k6qoXzQQtq5xVio6DKcJm6ewlYcOpur 4SZVbac3X8ApQkp/ZMqoc/JPST/Xr+gZGXi8VKa5d133BKihAWW0jSubtK9BEMlwopWe 7L860vq3MXyqIsj+4++leoIvxTpF8yJnIP2AiZFrB6iLZeBX8MQWEC+C0Lp2378pgD1f bFvIhFlWxE9Cx7pYCOPUTs9+JHwiZYModJGX45diPPvUZXpA4lIYB4iXdVnR1cgeoluJ 4tKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2YcQi322gU65udmxZ663ZZ4Wmd0vpO9jY2pkneP18U8=; b=RuksFNxZD6A/3aNsWoNT+ou+ngJjts6253MZjMUbd9hwnUXx+hhBZ5H6r9L7CPmdNl EqgX2iZW3AkgWg7O0tU384CZjTiQyetp1WYZXTMPTz2ROf/P6wWbunzCvY2cZoH0ogNs l0Su0qqd2THEk3etbOyxWeKmYWHYm35EHVO3ZYv0HmbwoHm/G7woGx+Y64vYstzcaVpa hpCTbJRopkipTR6NTfKQGQeRJ1ZIMEzRjtPMF90Rn/fg+2U2zn4cwZ91bb+XZGIAJZj3 VhG3YV9JNL4P03yMZ3iZiA2cFtkhbwI54QARrN7FxECmhan2EJW31ZB+RhqNXuFNEj0I zviA== X-Gm-Message-State: APjAAAWOJVH/MxGIegaKCxuZw/BqAKlOBafMi54ByQQzSc6FQXXB50gI Sc7J0R3D1oOvnnFRsgzpcyRb01neuc8tyYdX/aRf5TCa X-Received: by 2002:a17:902:4c:: with SMTP id 70mr26034435pla.308.1559830386509; Thu, 06 Jun 2019 07:13:06 -0700 (PDT) MIME-Version: 1.0 References: <20190506164440.37399-1-cai@lca.pw> <20190507073901.GC3486@suse.de> In-Reply-To: <20190507073901.GC3486@suse.de> From: Tom Murphy Date: Thu, 6 Jun 2019 15:12:54 +0100 Message-ID: Subject: Re: [PATCH -next v2] iommu/amd: fix a null-ptr-deref in map_sg() To: Joerg Roedel Cc: Qian Cai , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org 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 Hi Joerg, Is there anything I need to do to get this patch into linux-next? My patch to convert the amd iommu driver to use the dma-iommu ops depends on this patch. Thanks, Tom On Tue, May 7, 2019 at 8:39 AM Joerg Roedel wrote: > > Hi Qian, > > On Mon, May 06, 2019 at 12:44:40PM -0400, Qian Cai wrote: > > The commit 1a1079011da3 ("iommu/amd: Flush not present cache in > > iommu_map_page") added domain_flush_np_cache() in map_sg() which > > triggered a crash below during boot. sg_next() could return NULL if > > sg_is_last() is true, so after for_each_sg(sglist, s, nelems, i), "s" > > could be NULL which ends up deferencing a NULL pointer later here, > > > > domain_flush_np_cache(domain, s->dma_address, s->dma_length); > > > > so move domain_flush_np_cache() call inside for_each_sg() to loop over > > each sg element. > > Thanks for the fix, but it is too late to merge it into the tree. I am > going to revert commit 1a1079011da3 for now and we can try again in the > next cycle. > > > Thanks, > > Joerg >