Received: by 10.223.185.116 with SMTP id b49csp1065011wrg; Fri, 23 Feb 2018 11:16:33 -0800 (PST) X-Google-Smtp-Source: AH8x2273iDvVb2nRZ3DK7RJ8z6Bc6BZ/g1RhakkwuCMPS1oVGLaJ0tYiYaoUWA1UKclKGI+ZsAP+ X-Received: by 10.101.83.194 with SMTP id z2mr2196516pgr.133.1519413393642; Fri, 23 Feb 2018 11:16:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519413393; cv=none; d=google.com; s=arc-20160816; b=RQ7SBGju8bSJ4UiD0eH8QetYH4V2FS09FXsHLNGcOju4GJM29jRCRYZPWmTLBzaRYG lb85jXyUpLS4p/GcMxwTXuzyKpjZ6RDXrW5jSkRHxDXLQCUPT8xAZMILT26Cv/I/wnrm EFkdV652IqikzICSfINl2Qq6GiYoocntJzMvt4oUNGLMHo16jfmgfNUtzFENr1AZm4u6 YBHqMWk2ECpag332TyhHWIQfU7VbBq8xhfEb7hSI4hCa1fmw3RMvZZ4uD3vLdHOEjet8 41QpNwwSg1l12KT6HjlsuAUBJQJz5aFHBAT+2fzv9L+T70K14N+EPjcamLLHbhGAP56A Rc0g== 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=ktNh1WzeZLWYNDXdQETSzWmShxv6gflzzE1SWI5vUIY=; b=y3/1h/zqhFfvwWPrvSuen2qsEvjy7tOlWFfj5ICZf+1IXiuteD91uSeXLMMEYNnIwR UllyrHjTZwcAeFnW5s7se3vsUXKRvQCNqJVocLzoN5PRpRlG/5WkITiwyh0Lex8yPhSU WjJiRjYKnRr2WMoA29YHauefOL7/BcHuZykQKqmmMqh/6cn9gsxIseVwCDf6++Gc7UQZ cfPcB4aJjj5r2ky1BqLrjxmtP3cMCkmYxufeLX6BbvWgZwCvJD7ZpSTs8RzjHcmvVyWD BgCMkwJgKSuSoEgSv1xZlJFnKClREeEB3+Cbjvmkkz4Nk7bLzRi+LEAfbWq4gqzlTxzt mP4g== 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 u7-v6si2162601plr.241.2018.02.23.11.16.19; Fri, 23 Feb 2018 11:16:33 -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 S965157AbeBWSzZ (ORCPT + 99 others); Fri, 23 Feb 2018 13:55:25 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:48160 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964838AbeBWSzU (ORCPT ); Fri, 23 Feb 2018 13:55:20 -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 16CB11269; Fri, 23 Feb 2018 18:55:19 +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.14 132/159] dmaengine: at_hdmac: fix potential NULL pointer dereference in atc_prep_dma_interleaved Date: Fri, 23 Feb 2018 19:27:20 +0100 Message-Id: <20180223170759.079898794@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180223170743.086611315@linuxfoundation.org> References: <20180223170743.086611315@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.14-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 @@ -708,7 +708,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; @@ -720,6 +720,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,