Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8102253imu; Tue, 4 Dec 2018 03:03:06 -0800 (PST) X-Google-Smtp-Source: AFSGD/VWlawYC1uLLLur2cg2K6dOMoqwOvUcanAMvsTMgtg300/v0GTvx0A60Gl133Ml0nyLJLBX X-Received: by 2002:a63:7219:: with SMTP id n25mr16559346pgc.324.1543921385998; Tue, 04 Dec 2018 03:03:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543921385; cv=none; d=google.com; s=arc-20160816; b=cVdqdIIFIFyWUT/ikK6R8mgpgNmfkz6ZVoyzugwtvyZZPfTA6yaQ2TBLxeG+Xh9TpH WI3CTiaPzdoesG/lRFoo4qgfwHbw6RembvVHHFfmxxzWHJfH6vAwpa/WZ7NutWmDT/qs urorcLr32I0QnP3zzJ9woSKKBR6z0jcdbQDApClFyvVLEVvTDN3hyyf4AgaJe+qMMHCc /YV26ZQtNfpkXReePlaL+rdqyT6IdSJU126c4kAiRkk/p2CFo7kpRHaLZg749JdjZUNG 6vpVCMglsEPB6zFK/FjUXpI02axYr5J0g519jv3Vuqoc9JjERNFfvwgVw5riAVgN3GGB KqEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JDhH8f6DRLIhiJABggLtRo1mbveOAQUewfh0WNGbNkQ=; b=QnJxcL4JR2cmRQ1l/7mIfwphYns1uS6vTPxYktX1awPKZw2O/Nd0RAxiUqp4hXumMo iaxWduq+C22QKuzBw4LAKxnpZgSCCf21uBmMci7vtFH3u3/rsxzN5LGttda14lhYXK1Q 9r/KObKgsVIZ+QLPWUB6bhRTSukjY7F6+LfJAkcyDsh6kDO/GP/lS9+C7mIciSe422MN Ge33/P7ACM2YUpDDOPV4Hb6oXipV2AojCsbx2PEBWAsP/5qPtW/ESjUKofyJ06YGXcl0 5IiwnIfk/wg0HiFddd13TUNm5v/YKGWgqeQEsWuIjndLjhgctgPDmjs+KdRLxyfdw9se yIoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZqKeEpsQ; 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 p189si9719542pfb.0.2018.12.04.03.02.50; Tue, 04 Dec 2018 03:03:05 -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; dkim=pass header.i=@kernel.org header.s=default header.b=ZqKeEpsQ; 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 S1727295AbeLDLAS (ORCPT + 99 others); Tue, 4 Dec 2018 06:00:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:45500 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727269AbeLDLAQ (ORCPT ); Tue, 4 Dec 2018 06:00:16 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2BA6B214C1; Tue, 4 Dec 2018 11:00:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543921215; bh=QEDQt/mEAZWbSJFu/Cp6VZN1D9a8JUx07Pf3kB9Jn1I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZqKeEpsQ0FkLCTpXLF+YxD65Gr2zMK602wbO+C3GyhW6PkgdNg09DaK3sWW1Be2TX JK8vlh6bXV0x3BKe8T2boAGfFdZ/fUA5wYwBRFrgbaLxWQZSLdELqOdSvnPGoXZAHK iECIaOH8K66GKEe3yZly0edupmvvM5T4NdjrQlJs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Sergio Paracuellos Subject: [PATCH 4.19 126/139] staging: mt7621-dma: fix potentially dereferencing uninitialized tx_desc Date: Tue, 4 Dec 2018 11:50:07 +0100 Message-Id: <20181204103655.905702538@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181204103649.950154335@linuxfoundation.org> References: <20181204103649.950154335@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sergio Paracuellos commit 354e379684fcc70ab8d5450b4d57bd92b5294dfd upstream. Function 'mtk_hsdma_start_transfer' uses 'tx_desc' pointer which can be dereferenced before it is initializated. Initializate pointer before avoiding the problem. Fixes: 0853c7a53eb3 ("staging: mt7621-dma: ralink: add rt2880 dma engine") Reported-by: Dan Carpenter Signed-off-by: Sergio Paracuellos Cc: stable Signed-off-by: Greg Kroah-Hartman --- drivers/staging/mt7621-dma/mtk-hsdma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/staging/mt7621-dma/mtk-hsdma.c +++ b/drivers/staging/mt7621-dma/mtk-hsdma.c @@ -335,6 +335,8 @@ static int mtk_hsdma_start_transfer(stru /* tx desc */ src = sg->src_addr; for (i = 0; i < chan->desc->num_sgs; i++) { + tx_desc = &chan->tx_ring[chan->tx_idx]; + if (len > HSDMA_MAX_PLEN) tlen = HSDMA_MAX_PLEN; else @@ -344,7 +346,6 @@ static int mtk_hsdma_start_transfer(stru tx_desc->addr1 = src; tx_desc->flags |= HSDMA_DESC_PLEN1(tlen); } else { - tx_desc = &chan->tx_ring[chan->tx_idx]; tx_desc->addr0 = src; tx_desc->flags = HSDMA_DESC_PLEN0(tlen);