Received: by 10.223.185.116 with SMTP id b49csp1138129wrg; Fri, 23 Feb 2018 12:36:28 -0800 (PST) X-Google-Smtp-Source: AH8x226pRY5zkn8KIQY06n5o8DykSeurobdDzwvgoBo+D6JyeazftQYFl2k8S8iSLQL1ESh419JU X-Received: by 2002:a17:902:5a88:: with SMTP id r8-v6mr2913469pli.426.1519418187904; Fri, 23 Feb 2018 12:36:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519418187; cv=none; d=google.com; s=arc-20160816; b=RDUPLAf9WMQIds8j+KQb+n77r+2Uf84KTnxOPKVtM+rfOgX+B1cQk18+bWggnUNxF/ JnZIVD8uVf/7RH3epSNTqm/EZgY4m5jXWXhvqmT9znmptlCaN12AGrm0dj4fKb0LI28K /xVMRntcEVDoiyKOI2cduZwuRM2BxCjrec1X1Dntia2XhUeEjwFXKiNOWelJ7JvTdfa7 4+Oanb6DTkdJXuQxb7eC6RE31yllPVxIprHaIWS5ecWZRsr7oQwGw16wEZa+nKsCBqU8 1rUFxS0nuGxm+tOyeMZgeqr1UKjZQyIR8DOAMORvvgpMh87EQ1Yxkp3q9fUiHgzkL4lE np1Q== 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=jh0U38cCoQjJu2IZncDFmTKoFM0+2W9vroPhz6vGAos=; b=pZPJ2BzLV7BQrktib0ZGXspJ+QMEchGWlwQ/0tqJfW64/YmGd/07Fao4kNahUDTXqN Genpd/hk2AyOO+gwISkYhoYJSmXxKBbb00f8pCI+zGY3sC1oppaVEPjfoIaq+lcqKbsE 91ikYoaeJ31i0IwLzAxQhV/M7kQLTe8GmlmYvu5jNre6c4kJvO+PGTN0Ug7hNjnbIYuS cv3O3aU/Jv7ovP1FNQhFfAHhr5/ukRxudlqxg3kjNWkKN6Zs5jfqkpPy4VSNm9oUUTkc 5ko55VD41g3VeKnY7F43huY+8lLkjV6ErdadeDFn4XJArsa3F3txIsK7zziDgnap0IPi +uXg== 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 a34-v6si2279783pld.505.2018.02.23.12.36.13; Fri, 23 Feb 2018 12:36:27 -0800 (PST) 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 S1753950AbeBWUfj (ORCPT + 99 others); Fri, 23 Feb 2018 15:35:39 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:37088 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753565AbeBWSey (ORCPT ); Fri, 23 Feb 2018 13:34:54 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 7E09D124C; Fri, 23 Feb 2018 18:34:53 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Gustavo A. R. Silva" , Ludovic Desroches , Vinod Koul , Sasha Levin Subject: [PATCH 4.4 051/193] dmaengine: at_hdmac: fix potential NULL pointer dereference in atc_prep_dma_interleaved Date: Fri, 23 Feb 2018 19:24:44 +0100 Message-Id: <20180223170334.016821770@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180223170325.997716448@linuxfoundation.org> References: <20180223170325.997716448@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.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: "Gustavo A. R. Silva" [ Upstream commit 62a277d43d47e74972de44d33bd3763e31992414 ] _xt_ is being dereferenced before it is null checked, hence there is a potential null pointer dereference. Fix this by moving the pointer dereference after _xt_ has been null checked. This issue was detected with the help of Coccinelle. Fixes: 4483320e241c ("dmaengine: Use Pointer xt after NULL check.") Signed-off-by: Gustavo A. R. Silva Acked-by: Ludovic Desroches Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/dma/at_hdmac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c @@ -716,7 +716,7 @@ atc_prep_dma_interleaved(struct dma_chan unsigned long flags) { struct at_dma_chan *atchan = to_at_dma_chan(chan); - struct data_chunk *first = xt->sgl; + struct data_chunk *first; struct at_desc *desc = NULL; size_t xfer_count; unsigned int dwidth; @@ -728,6 +728,8 @@ atc_prep_dma_interleaved(struct dma_chan if (unlikely(!xt || xt->numf != 1 || !xt->frame_size)) return NULL; + first = xt->sgl; + dev_info(chan2dev(chan), "%s: src=%pad, dest=%pad, numf=%d, frame_size=%d, flags=0x%lx\n", __func__, &xt->src_start, &xt->dst_start, xt->numf,