From patchwork Tue Jul 17 08:08:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 142112 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp3359751ljj; Tue, 17 Jul 2018 01:08:45 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdJ6VPLP7eGlgECl5cKSK/XlGfGyLb6A1IvM0tN+mxh6uye3BlBqDXNgKTN77Fc4f146ZOu X-Received: by 2002:a63:5d09:: with SMTP id r9-v6mr578530pgb.303.1531814925717; Tue, 17 Jul 2018 01:08:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531814925; cv=none; d=google.com; s=arc-20160816; b=dawSsPJjE8GwTB8/OBa96eX+O1MkN7z5C7Q+0dxrjkmpSBwkzrGvgRCwvvULw9Ki7R MFMeatLbGC8peCmMCpQhzoIGqTQADQUIXwM+oMi3494QVQ0bWtlPhpbKWwmpTWC/KkpV ZG0oqJfiiV0rHlQlDY0F0Un35h8vdwggcKhGYIY/pwbo0g3mOOjadhb0kkxeB3lHf/oC mWiXJXm/sCQlvhPhpOdFnY8tij0lLK9YrqIPsgglwZxwTeyhrTjbqz836ahq+LjgyppY 7JVoyglANlrx9S9AgUR6qfcCRkXBfOsLbzcyHduS5zZVCW4nsYFZdO46IH21CxwdXvsi D2oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=f+wktuiXwMxTwX3SeLknLYOMnDUJyVZk9bfPE+u2HUE=; b=qlbSxH3Ba8D8BIWdx9hiJneKUW4QCw/JjtS4O/MIU4avsb6J4otSlPwJGEx4tEGDfn jZzOhF49xI+opCpTDaJLaJ0RFhVdvwVb7B14V51gx0gtg+Tjg+v8BEOOKIRE9V+/0LHL I5g9yPOOwyZjstDCpqYmq445AyJLon1cKG29RQrufiMfqHiEFmicLt2YsVAXs0BnwERW v1ZFZD+tHlFbBBwNs0OdKxOqtotqso5eNPbeJcJ0MnVwAxo6rKM024M69BzI+eAJZfUW IUSi3HpxMxtOn0gWP2k2gfXNjtCDBnwZ3kc2hsoFW60+m5wkFf8MCy76AvDR+gKA3C31 R0Yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iesbWB+n; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j1-v6si309442pll.493.2018.07.17.01.08.45; Tue, 17 Jul 2018 01:08:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=@linaro.org header.s=google header.b=iesbWB+n; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727796AbeGQIkG (ORCPT + 13 others); Tue, 17 Jul 2018 04:40:06 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:46713 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726819AbeGQIkG (ORCPT ); Tue, 17 Jul 2018 04:40:06 -0400 Received: by mail-pl0-f65.google.com with SMTP id 30-v6so111538pld.13 for ; Tue, 17 Jul 2018 01:08:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=f+wktuiXwMxTwX3SeLknLYOMnDUJyVZk9bfPE+u2HUE=; b=iesbWB+nSut5OLzMYR0qo8zcV+rHPqqJPfzRyX101x7v/Qpt4bn+OiuTWxPzkpzHoY zjMTTfGF7K1KK3X2m6oL8rcf9CMVwVC6SSmbNWg6amonPtTnMUqqV3K6gmZT2oD0niEi 8bEQOmwop/cqX/4g267LyGbaSpfcvFZviKQWo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=f+wktuiXwMxTwX3SeLknLYOMnDUJyVZk9bfPE+u2HUE=; b=A6kflT9yJv6yk0ZyHTN1W9PeJpwWNDk3Tt5iWELa1+Y1+VeRyQybFfjRQXfqQl46W3 kwJkxyDWSWlXy+vgaAoVJEO6RpFOIA7S/EjJlXmlC6C5qOz/dbykOMs6F9cBZwhdeUSg tvbdSkP2uVJFym+wBwJSnI8BcQ7iuY0xfO1l3dbMkEGcjWYz+bq+qaC17yVuSrGmK66N Eg60o0FpredDXT8OngvVl7kcUBud9G9lmW3pWQ00+QZvgINIHYgW3wZwsvUDJArjTAtb 65ilUrBFaj/W9D963MGxRH0nXwH33nrHJFdjxQd/SGcwL9uKQudmerlZmV3Ha6Jf+/je y+1Q== X-Gm-Message-State: AOUpUlF6TlrkUVhEoL1OiPakyHL7Q6qlnUxDnnyO55ua+EJHN91CV9B1 sqLnnmtCgDzOnuxU1mraxcGWMA== X-Received: by 2002:a17:902:381:: with SMTP id d1-v6mr606658pld.309.1531814924179; Tue, 17 Jul 2018 01:08:44 -0700 (PDT) Received: from localhost.localdomain ([106.51.22.240]) by smtp.gmail.com with ESMTPSA id c85-v6sm2205083pfd.110.2018.07.17.01.08.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Jul 2018 01:08:43 -0700 (PDT) From: Amit Pundir To: Greg KH , Stable Cc: Jaehoon Chung , Lorenzo Pieralisi Subject: [PATCH for-4.14.y 1/5] PCI: exynos: Fix a potential init_clk_resources NULL pointer dereference Date: Tue, 17 Jul 2018 13:38:30 +0530 Message-Id: <1531814914-19191-2-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531814914-19191-1-git-send-email-amit.pundir@linaro.org> References: <1531814914-19191-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jaehoon Chung commit b5d6bc90c9129279d363ccbc02ad11e7b657c0b4 upstream. In order to avoid triggering a NULL pointer dereference in exynos_pcie_probe() a check must be put in place to detect if the init_clk_resources hook is initialized before calling it. Add the respective function pointer check in exynos_pcie_probe(). Signed-off-by: Jaehoon Chung [lorenzo.pieralisi@arm.com: rewrote the commit log] Signed-off-by: Lorenzo Pieralisi Signed-off-by: Amit Pundir --- Cherry-picked from lede tree https://git.lede-project.org/?p=source.git drivers/pci/dwc/pci-exynos.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/pci/dwc/pci-exynos.c b/drivers/pci/dwc/pci-exynos.c index 5596fdedbb94..ea03f1ec12a4 100644 --- a/drivers/pci/dwc/pci-exynos.c +++ b/drivers/pci/dwc/pci-exynos.c @@ -695,7 +695,8 @@ static int __init exynos_pcie_probe(struct platform_device *pdev) return ret; } - if (ep->ops && ep->ops->get_clk_resources) { + if (ep->ops && ep->ops->get_clk_resources && + ep->ops->init_clk_resources) { ret = ep->ops->get_clk_resources(ep); if (ret) return ret; From patchwork Tue Jul 17 08:08:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 142113 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp3359793ljj; Tue, 17 Jul 2018 01:08:48 -0700 (PDT) X-Google-Smtp-Source: AAOMgpduWt8D4UOzPTE0d1irYnrYF8iR99ZiOiIl4hEoNwGN1KUrLE967UUWgnbwFoybsgnIrOdt X-Received: by 2002:a63:d011:: with SMTP id z17-v6mr598513pgf.272.1531814928392; Tue, 17 Jul 2018 01:08:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531814928; cv=none; d=google.com; s=arc-20160816; b=xtTx+A1yU+jAclgC7vIJFinK9icg8UAmo5WtYXKzGxdZ6CEJKIAQoJZ+Q4FAD7QYhM gEtrMrLcPikInRWsN2LqUVIzaecZZ8QUcCx5BQZsA4E8SQB8np47VoGpveW8JgVU2tv6 K/nsqjgRAfgXEkuBikGY6QlRa2FFF7F1qthmQBf7weBbFUcj2fBfjuAesOXZ7fcLKNzh D65L/79xloPWYGQlX/B2IhL293u7zBK/o99K9kRkDWd4o7N4P3Br39V4hIGz8/vWFQgl eJLnCthZ1sfhQazJYSKtxfRhpsZP3oz602dMYpaFkvQ5yX4RqMgvmDcNYHOoWtxXP37R VMNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=xfaSidnn8WMqIPb6/VQJY7fHwCZk18IuD4nzK4x5dd0=; b=rdf7oDO8KnMvqdVBuUG8ToEW2/Ji9GtRxrg3W5XtrjZdr4/quIr6p0xycXQLe5dlvW DwlITm0f7gFsb7Aujtins1NQowlOLeSCQlqHmZOSDz7ydwtFZg34J1CUPfcmJXlhf93p fyQpikPbu4Pe4D5KOn+DLxFfhCJNZYJ7BsRCH0SWcrD2M+sde8LHB6h1eVKpjELWxu+4 yUJj8fN1pobWWdHoF0WP3QPZmYVbTwIsnRkyIFpbSq+BU4uk4eIfzZGcrO3x4efcnykk dwWYOzBI2SizZfmdhIt/gJX9m10LFX7UfaH3v/liPYp+CLinMvdshpl1ArxffI42Oe6X b9ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Qp/3mBkR"; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j1-v6si309442pll.493.2018.07.17.01.08.48; Tue, 17 Jul 2018 01:08:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=@linaro.org header.s=google header.b="Qp/3mBkR"; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729661AbeGQIkJ (ORCPT + 13 others); Tue, 17 Jul 2018 04:40:09 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:45353 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726819AbeGQIkJ (ORCPT ); Tue, 17 Jul 2018 04:40:09 -0400 Received: by mail-pl0-f65.google.com with SMTP id 94-v6so114060ple.12 for ; Tue, 17 Jul 2018 01:08:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xfaSidnn8WMqIPb6/VQJY7fHwCZk18IuD4nzK4x5dd0=; b=Qp/3mBkRTSTe+x28nAwlIRfgAeFYJBBScWKaqI9CJADWoUnNSS+iU4Vl5cmTd94BsP pHAqSDDD3mNlzhlUtupPZJ4PYjGoVqcfG+HXfwzHhAb8ey6/df1uqJf2Qq8dayWIAlyT PwMxEdAOp0OcS9Q0tGMNKJiGNT+/i5PDyCYhg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xfaSidnn8WMqIPb6/VQJY7fHwCZk18IuD4nzK4x5dd0=; b=MSYdzFibpbElsnqj+sN7yp91R3V+5DVN9Ct5RUqlwNHhTm9AC1W/2RkMva4EFOMWSq u7vt+F7eVw0qgQSAlEXShIG7IWusVcm4TouTuFC57tuEexfqSHTSWzayIzkmIl2jobXA 6KcwB3Y9eXQhO6+h8bzoa7634fJ8HPBrf7F17GA7tHH8wroOlYy056lOOlXvVw1Zd+LY NpwXh2HZAH7Mz5LUz6yfigxFb7Y3nYJnCgOaHx2xrsmwzHP4/02n/Ar5lg0xLNNfNP1H d3h82UQ6xTwVCugNTRvRT+JOp/Z/cFUDgpkNrHK4tEvR1gRN3JPvpTKYDBdZ3yuL9X21 F+qg== X-Gm-Message-State: AOUpUlFVNpduCU2POElkEeTXlXRGHX1faLzPTEe4d9+6xcztu3z6N4bJ TuqjIT0M/F89SOwsQnh3YA5xWeDvmho= X-Received: by 2002:a17:902:9302:: with SMTP id bc2-v6mr634650plb.280.1531814926942; Tue, 17 Jul 2018 01:08:46 -0700 (PDT) Received: from localhost.localdomain ([106.51.22.240]) by smtp.gmail.com with ESMTPSA id c85-v6sm2205083pfd.110.2018.07.17.01.08.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Jul 2018 01:08:45 -0700 (PDT) From: Amit Pundir To: Greg KH , Stable Cc: Christian Lamparter , Herbert Xu Subject: [PATCH for-4.14.y 2/5] crypto: crypto4xx - remove bad list_del Date: Tue, 17 Jul 2018 13:38:31 +0530 Message-Id: <1531814914-19191-3-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531814914-19191-1-git-send-email-amit.pundir@linaro.org> References: <1531814914-19191-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Christian Lamparter commit a728a196d253530f17da5c86dc7dfbe58c5f7094 upstream. alg entries are only added to the list, after the registration was successful. If the registration failed, it was never added to the list in the first place. Signed-off-by: Christian Lamparter Signed-off-by: Herbert Xu Signed-off-by: Amit Pundir --- Cherry-picked from lede tree https://git.lede-project.org/?p=source.git drivers/crypto/amcc/crypto4xx_core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) -- 2.7.4 diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers/crypto/amcc/crypto4xx_core.c index 65dc78b91dea..3118cec0d81e 100644 --- a/drivers/crypto/amcc/crypto4xx_core.c +++ b/drivers/crypto/amcc/crypto4xx_core.c @@ -1033,12 +1033,10 @@ int crypto4xx_register_alg(struct crypto4xx_device *sec_dev, break; } - if (rc) { - list_del(&alg->entry); + if (rc) kfree(alg); - } else { + else list_add_tail(&alg->entry, &sec_dev->alg_list); - } } return 0; From patchwork Tue Jul 17 08:08:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 142114 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp3359833ljj; Tue, 17 Jul 2018 01:08:51 -0700 (PDT) X-Google-Smtp-Source: AAOMgpenNcBzKFKkwakLjYz/RTkqgaHlvu/5W+GkPb61GD04ztGizaNx/LpKgKuPfSI0196GxKIR X-Received: by 2002:a62:8b0f:: with SMTP id j15-v6mr656705pfe.33.1531814931233; Tue, 17 Jul 2018 01:08:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531814931; cv=none; d=google.com; s=arc-20160816; b=N9WgZBEX9n1V1grs4NfGukZLXSyGA1MSVjkEoGsgXC97PXs4UYusyGzOhNFez+gMZ1 TS/IgmxpzivE5xaJex4bjLL8hjc+H7qtXGF9SVjZQYdxtx3a0g+Zk7bbjbwFel6+jfeR FqWyXd6Tu/ajNf7p0t+Fa4WW2WLhMM9MjF9LZ7qM16YSmcorul+Yh+Q21PJYE1zERAPy shyg1hcU8osXINt3YpSrNiOnYDuvFfSfar66aF2mtnWPeF7KbC8nU7DAmQxCvOa5WWfd U5WmXweIotSz3dR2yQXvMjXHosjN+qfmcdW/gL/CM59S3L7FbAxv/fDh3r2priqqHr8Q qyxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=XMQRq9D5op91GTLZsCfXJahcD4VKogpoOB1GVcvoyoc=; b=N8di43ReSmp64HTPA7BMLaZzZNjVyeoV7YFMZzs9zUE78sw3UL7XcgciclTUGrbg3y V3xsK6qWD4qhIrAaP2JciFJ2+EkThWEUkTzUHFRH7defMEUNk0EUptbsx5R5QRCla7pT HQiFsGkCfFvj8DgHGAZTMK3fiVdHmDSm3zaGw+YRP1XUROamMVT5POu39jn++lwQ/jH7 pbqTkn0XYuP4lSKoxkbMfQCcOXfFzi/1fjNXquhVxrYbW+GsYiPdJFsRaiXKq3SITMv/ k0HNGP11/chKPhVVhfXTA6nXiQpe/A6Xl8Sd8UA/EBDX67EJZeWoY4Yt/psEbOWwXHO9 A2Kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=I5jIJYp8; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j1-v6si309442pll.493.2018.07.17.01.08.51; Tue, 17 Jul 2018 01:08:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=@linaro.org header.s=google header.b=I5jIJYp8; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729701AbeGQIkM (ORCPT + 13 others); Tue, 17 Jul 2018 04:40:12 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:35291 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726819AbeGQIkM (ORCPT ); Tue, 17 Jul 2018 04:40:12 -0400 Received: by mail-pl0-f68.google.com with SMTP id w3-v6so126476plq.2 for ; Tue, 17 Jul 2018 01:08:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XMQRq9D5op91GTLZsCfXJahcD4VKogpoOB1GVcvoyoc=; b=I5jIJYp8aCExZdFDldIpo2Q9WGRbHjDlwVliyFV8Vt9ljMsvnH4YwniMXilLFbyPUi rBtrHGdwLjsudiNfidvJiu0TLuz/4eN7/3cfSROwZo/TQiocOwyayo+QXXxTksAlgznO HST2ejAOkxUOAlYmU0lCIjwnfRRue9VUhM8ic= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=XMQRq9D5op91GTLZsCfXJahcD4VKogpoOB1GVcvoyoc=; b=NRIN3ImGW751C1zAKZhtHHLiTpZe67V62wonXf2ENAlyuvMHIH8ym83U9jaLAtgoGS uMhsrSi5SWjWbL24W2ll60l7urt+vYQ+IHOhuzJgj4WNTSX5qRKFjOSJDmoxXMofcDod zvGmN3CoCWfKrXgeYWoaf1CKfGaSXSIC917igO7/MpRMDC7YbhJT7UOV1+/EnUIoJe5Z z0zQc3R+4wGSzpn8I1DYGhrxukdli3JrvqSmi4nNh3fRg05kmMtKUuSB/ZXFntjU9KE1 42SSj+gnR+FkbO3nAArq9yhOJIH59NZCQt+NOjkgJn3VjeUNBTq9xUvjWfZgEINPFuLL avlA== X-Gm-Message-State: AOUpUlHfT5GLVuwOc7yphSBC2jcSN0zK2ATwb1o+rI6WBvgEkwDqE71q RYCOfzpXS8Q2B/YhNm0u4CDs//NWn+U= X-Received: by 2002:a17:902:bc85:: with SMTP id bb5-v6mr614898plb.229.1531814929642; Tue, 17 Jul 2018 01:08:49 -0700 (PDT) Received: from localhost.localdomain ([106.51.22.240]) by smtp.gmail.com with ESMTPSA id c85-v6sm2205083pfd.110.2018.07.17.01.08.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Jul 2018 01:08:48 -0700 (PDT) From: Amit Pundir To: Greg KH , Stable Cc: Christian Lamparter , Herbert Xu Subject: [PATCH for-4.14.y 3/5] crypto: crypto4xx - fix crypto4xx_build_pdr, crypto4xx_build_sdr leak Date: Tue, 17 Jul 2018 13:38:32 +0530 Message-Id: <1531814914-19191-4-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531814914-19191-1-git-send-email-amit.pundir@linaro.org> References: <1531814914-19191-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Christian Lamparter commit 5d59ad6eea82ef8df92b4109615a0dde9d8093e9 upstream. If one of the later memory allocations in rypto4xx_build_pdr() fails: dev->pdr (and/or) dev->pdr_uinfo wouldn't be freed. crypto4xx_build_sdr() has the same issue with dev->sdr. Signed-off-by: Christian Lamparter Signed-off-by: Herbert Xu Signed-off-by: Amit Pundir --- Cherry-picked from lede tree https://git.lede-project.org/?p=source.git drivers/crypto/amcc/crypto4xx_core.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) -- 2.7.4 diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers/crypto/amcc/crypto4xx_core.c index 3118cec0d81e..3f9eee7e555f 100644 --- a/drivers/crypto/amcc/crypto4xx_core.c +++ b/drivers/crypto/amcc/crypto4xx_core.c @@ -207,7 +207,7 @@ static u32 crypto4xx_build_pdr(struct crypto4xx_device *dev) dev->pdr_pa); return -ENOMEM; } - memset(dev->pdr, 0, sizeof(struct ce_pd) * PPC4XX_NUM_PD); + memset(dev->pdr, 0, sizeof(struct ce_pd) * PPC4XX_NUM_PD); dev->shadow_sa_pool = dma_alloc_coherent(dev->core_dev->device, 256 * PPC4XX_NUM_PD, &dev->shadow_sa_pool_pa, @@ -240,13 +240,15 @@ static u32 crypto4xx_build_pdr(struct crypto4xx_device *dev) static void crypto4xx_destroy_pdr(struct crypto4xx_device *dev) { - if (dev->pdr != NULL) + if (dev->pdr) dma_free_coherent(dev->core_dev->device, sizeof(struct ce_pd) * PPC4XX_NUM_PD, dev->pdr, dev->pdr_pa); + if (dev->shadow_sa_pool) dma_free_coherent(dev->core_dev->device, 256 * PPC4XX_NUM_PD, dev->shadow_sa_pool, dev->shadow_sa_pool_pa); + if (dev->shadow_sr_pool) dma_free_coherent(dev->core_dev->device, sizeof(struct sa_state_record) * PPC4XX_NUM_PD, @@ -416,12 +418,12 @@ static u32 crypto4xx_build_sdr(struct crypto4xx_device *dev) static void crypto4xx_destroy_sdr(struct crypto4xx_device *dev) { - if (dev->sdr != NULL) + if (dev->sdr) dma_free_coherent(dev->core_dev->device, sizeof(struct ce_sd) * PPC4XX_NUM_SD, dev->sdr, dev->sdr_pa); - if (dev->scatter_buffer_va != NULL) + if (dev->scatter_buffer_va) dma_free_coherent(dev->core_dev->device, dev->scatter_buffer_size * PPC4XX_NUM_SD, dev->scatter_buffer_va, @@ -1191,7 +1193,7 @@ static int crypto4xx_probe(struct platform_device *ofdev) rc = crypto4xx_build_gdr(core_dev->dev); if (rc) - goto err_build_gdr; + goto err_build_pdr; rc = crypto4xx_build_sdr(core_dev->dev); if (rc) @@ -1234,12 +1236,11 @@ static int crypto4xx_probe(struct platform_device *ofdev) err_request_irq: irq_dispose_mapping(core_dev->irq); tasklet_kill(&core_dev->tasklet); - crypto4xx_destroy_sdr(core_dev->dev); err_build_sdr: + crypto4xx_destroy_sdr(core_dev->dev); crypto4xx_destroy_gdr(core_dev->dev); -err_build_gdr: - crypto4xx_destroy_pdr(core_dev->dev); err_build_pdr: + crypto4xx_destroy_pdr(core_dev->dev); kfree(core_dev->dev); err_alloc_dev: kfree(core_dev); From patchwork Tue Jul 17 08:08:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 142115 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp3359868ljj; Tue, 17 Jul 2018 01:08:54 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdSntMho2uT8R0P+Vkkt/GCGiyc1nV+RdIctwjxT6tbR4qnInXmYi7tZmQCQjJgn9R9IUNv X-Received: by 2002:a63:b047:: with SMTP id z7-v6mr588204pgo.335.1531814934030; Tue, 17 Jul 2018 01:08:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531814934; cv=none; d=google.com; s=arc-20160816; b=OOMfOyyLWB+VNNXqTVApvHf0TweZj4HRW+1acdwhZY9GB2KM3LWm+PZX2RtxyXBaIC hMPqJ9bMWN/Xgqvv5vKM2aaiNBnIJRZJ87ELZeCfqotb+uX6cANV8y6AVUIo+GKq1EPA wUiBXeVC2LWQ3j+a+iuqvhk40l7/xiRXOf/s+3/KlgY9LlpnxCrhWG/dTs87dUyOT0ju B9IbbbjS4HX0DByHkTsMNOVQH/N4AlJNLU72RNbsMQMXFSeo1ZWTf3/um/5h+Xj/3LE/ ZqiqRKAnFDJUohVVB27ZDQ/U21nNy6lXNurN4zNQTHNQp4ABrdutbtf9mZnOW2qGiFWt w4SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=P6YxmUpCcKbTgwIO3mE4/21tq21XyGLZfs4HTjiecrU=; b=T1JUGTg1R5exksel3jUVCbL5FCtpntkb/w1RaCqGfcqoDc2ZkQ8K0yq/9LECqrjs0V 0xjm6t+9s6x5B5LITzLzuTBbl1KekbmkZNKTGsExaspjrHJBAARhntHOeOEslNvb+R70 vXb46iaJfptUfox5n2gHatZpGhFGtPVupv1B9I1Jup66yAzsMsJiPYnK0/en9GY6de9M 3RSWabLsCrjD4AomKEbByKLeiQYBzC2LEs6dIQ4mgmU4PSy7ZAZ+F9Y2yLz7eZp9Bf4W HA3po9ulAQa4C4sKn+/B6r42VY2X52W86hulkJvFuGph3PxeQ+RaIe1re/FViYBxX2SU xlKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kb04lFx0; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j1-v6si309442pll.493.2018.07.17.01.08.53; Tue, 17 Jul 2018 01:08:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=@linaro.org header.s=google header.b=kb04lFx0; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729717AbeGQIkP (ORCPT + 13 others); Tue, 17 Jul 2018 04:40:15 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:33691 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726819AbeGQIkP (ORCPT ); Tue, 17 Jul 2018 04:40:15 -0400 Received: by mail-pl0-f65.google.com with SMTP id 6-v6so129355plb.0 for ; Tue, 17 Jul 2018 01:08:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=P6YxmUpCcKbTgwIO3mE4/21tq21XyGLZfs4HTjiecrU=; b=kb04lFx0j4CS/qn9/VM3WkEvDsvEJ95CU4DecfazHDbkjUrcHtafayHrjT+mwA0Jjn FQ3jlc6edXE/0p5PPgYoD71LDORswjA7Q4OO6p2tgqO+j6nR82QD/ROwQ1UKyR+JT/ib IByl7mu4Jt2RhF4GykYmdchZJjbYQt7mBF/Iw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=P6YxmUpCcKbTgwIO3mE4/21tq21XyGLZfs4HTjiecrU=; b=gxxyno5wbHGLVFvKUogPXA3dgWeIfpIeQpXN2Fo+v1WMD8ueiCQS38LwhW+R6fgEcn dJ1cOm43UI4IRDGeMGS/9s0AH7rLR0XAzCG6jmQ1izERZ4oL/J51olZ0263a1KA/YofF JKmEjXAXe/R/0rDucRZBywqaHKgwDJJNJBm/VbcTQMEZXvX7kHa95H/o06Jca7MLBWjW 1qUgSemuNl+nqjUWLAqFJR8wcnsJBCpM2CKJCcqWOTtYTSeVu9Zdlf1WGLR7zU6SLahq GJXzhsNNlW07imFd2IbFQx2n3UfGghZvop7gASz2HqJRIk/+QqBl6KIJi7go+dLFg6jy dxXg== X-Gm-Message-State: AOUpUlFBhzanRwmsHLumqEGlAJMPSaXozxg/d+4+0FG84Bv0ohF3I7K8 mNTw7qWgDxPYYzrJHU9Pzv1IfFLQ2VU= X-Received: by 2002:a17:902:8f86:: with SMTP id z6-v6mr656171plo.38.1531814932423; Tue, 17 Jul 2018 01:08:52 -0700 (PDT) Received: from localhost.localdomain ([106.51.22.240]) by smtp.gmail.com with ESMTPSA id c85-v6sm2205083pfd.110.2018.07.17.01.08.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Jul 2018 01:08:51 -0700 (PDT) From: Amit Pundir To: Greg KH , Stable Cc: Jonas Gorski , "David S . Miller" Subject: [PATCH for-4.14.y 4/5] bcm63xx_enet: correct clock usage Date: Tue, 17 Jul 2018 13:38:33 +0530 Message-Id: <1531814914-19191-5-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531814914-19191-1-git-send-email-amit.pundir@linaro.org> References: <1531814914-19191-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jonas Gorski commit 9c86b846ce02f7e35d7234cf090b80553eba5389 upstream. Check the return code of prepare_enable and change one last instance of enable only to prepare_enable. Also properly disable and release the clock in error paths and on remove for enetsw. Signed-off-by: Jonas Gorski Signed-off-by: David S. Miller Signed-off-by: Amit Pundir --- Cherry-picked from lede tree https://git.lede-project.org/?p=source.git drivers/net/ethernet/broadcom/bcm63xx_enet.c | 31 +++++++++++++++++++++------- 1 file changed, 23 insertions(+), 8 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c index 4f3845a58126..b7d8b6600be6 100644 --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c @@ -1773,7 +1773,9 @@ static int bcm_enet_probe(struct platform_device *pdev) ret = PTR_ERR(priv->mac_clk); goto out; } - clk_prepare_enable(priv->mac_clk); + ret = clk_prepare_enable(priv->mac_clk); + if (ret) + goto out_put_clk_mac; /* initialize default and fetch platform data */ priv->rx_ring_size = BCMENET_DEF_RX_DESC; @@ -1805,9 +1807,11 @@ static int bcm_enet_probe(struct platform_device *pdev) if (IS_ERR(priv->phy_clk)) { ret = PTR_ERR(priv->phy_clk); priv->phy_clk = NULL; - goto out_put_clk_mac; + goto out_disable_clk_mac; } - clk_prepare_enable(priv->phy_clk); + ret = clk_prepare_enable(priv->phy_clk); + if (ret) + goto out_put_clk_phy; } /* do minimal hardware init to be able to probe mii bus */ @@ -1901,13 +1905,16 @@ static int bcm_enet_probe(struct platform_device *pdev) out_uninit_hw: /* turn off mdc clock */ enet_writel(priv, 0, ENET_MIISC_REG); - if (priv->phy_clk) { + if (priv->phy_clk) clk_disable_unprepare(priv->phy_clk); + +out_put_clk_phy: + if (priv->phy_clk) clk_put(priv->phy_clk); - } -out_put_clk_mac: +out_disable_clk_mac: clk_disable_unprepare(priv->mac_clk); +out_put_clk_mac: clk_put(priv->mac_clk); out: free_netdev(dev); @@ -2752,7 +2759,9 @@ static int bcm_enetsw_probe(struct platform_device *pdev) ret = PTR_ERR(priv->mac_clk); goto out_unmap; } - clk_enable(priv->mac_clk); + ret = clk_prepare_enable(priv->mac_clk); + if (ret) + goto out_put_clk; priv->rx_chan = 0; priv->tx_chan = 1; @@ -2773,7 +2782,7 @@ static int bcm_enetsw_probe(struct platform_device *pdev) ret = register_netdev(dev); if (ret) - goto out_put_clk; + goto out_disable_clk; netif_carrier_off(dev); platform_set_drvdata(pdev, dev); @@ -2782,6 +2791,9 @@ static int bcm_enetsw_probe(struct platform_device *pdev) return 0; +out_disable_clk: + clk_disable_unprepare(priv->mac_clk); + out_put_clk: clk_put(priv->mac_clk); @@ -2813,6 +2825,9 @@ static int bcm_enetsw_remove(struct platform_device *pdev) res = platform_get_resource(pdev, IORESOURCE_MEM, 0); release_mem_region(res->start, resource_size(res)); + clk_disable_unprepare(priv->mac_clk); + clk_put(priv->mac_clk); + free_netdev(dev); return 0; } From patchwork Tue Jul 17 08:08:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 142116 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp3359894ljj; Tue, 17 Jul 2018 01:08:56 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeYVyU35khUS1gn+tuw+6GtyUfAJz9feEzfK7fckIR7oar5/tYHrJj0Hty3rPmHljOmXFk/ X-Received: by 2002:a17:902:7891:: with SMTP id q17-v6mr654062pll.186.1531814936513; Tue, 17 Jul 2018 01:08:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531814936; cv=none; d=google.com; s=arc-20160816; b=YHB1SKnw989aC7OPaScnXeWD3laIAVE6ln9cDfS9nZDrwsj7O9eJifgbCaPOaQv4Qz 8uUiqSNmOGsgj/oAdlDy6Wg3sFudTwEeDND6vacmtHo7GMI3dLrEyzKno+h1jp4yzk4J KzUnnf3GvO0jp/qLDL0+FkRXwnH+tWoqQ9KZe5PHuj0QFvx0wZ1DDkR33rbYMoLDkf+j fOpuYDoH4pjl1keRkf1FTNLoeKsVMcJZAlQKYgFAvalGbki+NOZLuHn9Ao7f3cESMjDK ROZ7bqsKFDkC8VcxVgcXESZxpKc4gf6SgYVKvQJWKa+MI5b4FUGPzMiOK//Qme2RtmkZ 1S6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=kjyHC2CTB+TeXZkTpurH1FLtNuT/tvE0R5TEbUJKX1k=; b=UBcj289cNczc0nXWap5t2pOnWhdLCmwWt2YutzBZYdNWLkzqt/vAXUexkmNLW3uAW7 kTTrau9mSoFHilIllbGnFRdtJpVi55bL5/d3/vZsD+m9FTXO/ynXxawvTTmm6uG3nz15 o+CbjVxa4sTN8zPnm8+pvNo0ijDLW/pB0RI6igypUGtxCCMgJyUim3VUuaM+20tDVbZr mRqOJx4mvwhuabne1q3eoCIQX3EY5hxexI7nwhVcih44ljJxLjnGJFG6IVxrxgiErSHU YovGRPAI8SP42R0oUMMCPnA9hNkF6q2BhE5aWymkZ5amKRPNLBZkr5+ZriiHWG5KjYJT 0fRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BE+Uf5Nc; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j1-v6si309442pll.493.2018.07.17.01.08.56; Tue, 17 Jul 2018 01:08:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=@linaro.org header.s=google header.b=BE+Uf5Nc; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729720AbeGQIkR (ORCPT + 13 others); Tue, 17 Jul 2018 04:40:17 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:35298 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729718AbeGQIkR (ORCPT ); Tue, 17 Jul 2018 04:40:17 -0400 Received: by mail-pl0-f66.google.com with SMTP id w3-v6so126605plq.2 for ; Tue, 17 Jul 2018 01:08:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=kjyHC2CTB+TeXZkTpurH1FLtNuT/tvE0R5TEbUJKX1k=; b=BE+Uf5NcXdL6x6IFUErCSJ1SZo22Yzlt/DSTiiTNHJH1J6YJ8VdWvDX2I8iVvYuRDE 0wFuD3c7dGUNO/v009fJO2/dadMNmp8ouKyfDPmCfgmMgl/yzGuqQfQmP46VjDnGfddD zDjGA0478HU/vftZGHCM68HnyivBhAHaOQNt0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=kjyHC2CTB+TeXZkTpurH1FLtNuT/tvE0R5TEbUJKX1k=; b=hhq/F+vUdPlDsD4WmGrzs8RYs+21D3IzXia+9th9JNVoBGkNpf/BSUglzwZJVMqJ57 0+fHMF/Xkrpm98Gr8Gj9eqodzYyR3+1+i1gcjXDQVvfiXPeBj4JAn6pQNn/YGerJ3arR B095IRm9UsX5jJiGpj74FrE4rnYPDz5CrPrkyO7tg30+i2bPqztoXjQ2GLTZ2AxRlwJd 7m9b1wiYIvdZQMkru1ZOOLFOIMBgOItfVnsrAV4SloYeILyYJ0jK6+0cJHLVdKqYjONB 2k3vZxWqIpUSmYeP8rqKQhSKOMDyc7O0omM4Q922Xd1EVDaCqXArJuvAXAtxboJISF09 IEHg== X-Gm-Message-State: AOUpUlEcG5/UX9kBO84G8+ovJ17pvPZjFbDXH448z1UUftl/MMK5EbXK HNxXKNh92mFM9KIEy4Y62OEq3+kKSak= X-Received: by 2002:a17:902:8bc6:: with SMTP id r6-v6mr599428plo.257.1531814935139; Tue, 17 Jul 2018 01:08:55 -0700 (PDT) Received: from localhost.localdomain ([106.51.22.240]) by smtp.gmail.com with ESMTPSA id c85-v6sm2205083pfd.110.2018.07.17.01.08.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Jul 2018 01:08:54 -0700 (PDT) From: Amit Pundir To: Greg KH , Stable Cc: Jonas Gorski , "David S . Miller" Subject: [PATCH for-4.14.y 5/5] bcm63xx_enet: do not write to random DMA channel on BCM6345 Date: Tue, 17 Jul 2018 13:38:34 +0530 Message-Id: <1531814914-19191-6-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531814914-19191-1-git-send-email-amit.pundir@linaro.org> References: <1531814914-19191-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jonas Gorski commit d6213c1f2ad54a964b77471690264ed685718928 upstream. The DMA controller regs actually point to DMA channel 0, so the write to ENETDMA_CFG_REG will actually modify a random DMA channel. Since DMA controller registers do not exist on BCM6345, guard the write with the usual check for dma_has_sram. Signed-off-by: Jonas Gorski Signed-off-by: David S. Miller Signed-off-by: Amit Pundir --- Cherry-picked from lede tree https://git.lede-project.org/?p=source.git drivers/net/ethernet/broadcom/bcm63xx_enet.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c index b7d8b6600be6..68470c7c630a 100644 --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c @@ -1062,7 +1062,8 @@ static int bcm_enet_open(struct net_device *dev) val = enet_readl(priv, ENET_CTL_REG); val |= ENET_CTL_ENABLE_MASK; enet_writel(priv, val, ENET_CTL_REG); - enet_dma_writel(priv, ENETDMA_CFG_EN_MASK, ENETDMA_CFG_REG); + if (priv->dma_has_sram) + enet_dma_writel(priv, ENETDMA_CFG_EN_MASK, ENETDMA_CFG_REG); enet_dmac_writel(priv, priv->dma_chan_en_mask, ENETDMAC_CHANCFG, priv->rx_chan);