From patchwork Wed Sep 25 10:03:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 174352 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp411229ill; Wed, 25 Sep 2019 03:03:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqzMz/Wj1UfKT+qSepJvOIlTNRCMRHnjpP16mhBbSExogvGMrjYV7MH7aNcb8XsAmxaeV5xw X-Received: by 2002:a05:600c:230d:: with SMTP id 13mr7006397wmo.114.1569405836234; Wed, 25 Sep 2019 03:03:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569405836; cv=none; d=google.com; s=arc-20160816; b=ou8MCylRXAYi+6s+/3aRSbBT6xOUQsagy6YOYQP3AYryGSe6yFArI2x/CSt6R7z3Yh 0Ck0Rh2kpnhjnkq4rqHvgRbm0K72cPjOE5wNp9qbu0W0WmCuLH7LWuyKR6nmh5lP2OdG nkKxi7tGTfb7wXqTgIhG1t9lzbqepcmKX7VguIkHnGj2S732fuw0u4Lq796l07/fwGJC 8D11KlbmHN6PsHWukoX9L3Yr7mEFiiy87nFGSSO2TJFxTr2+7+f/cKpSZmx0LoGcfAER 7GQNkdNrowpvkNMDV9wapGQyFpXhf+lGLlHhes3/NMsZpdMTxszuZkUTfT9H6Gvs9NI5 J9Cg== 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; bh=D2+Lw+Pa01X7BomivX93hO8QHJLkQUok4YlT1BdSE8Q=; b=o8f38xN34/TU/uL4LwrtX4AZWWqINdUsuyvAR+yukR9cmBVV1KkqqCTe1jBBR8vq5G Mhz/J90gd4vFdPEi6xc/pJ9wo9p44I2jaub9ICGWthDA3kxhG1e7l1kbbM2RtjgbHi5Z YVeXSEEbIDcnFpRqXLxjVBw3CcgP2v/niOcw5XJmkEuPnwn0MdWC5g2GfPBwNoYeqR/8 YXNI+mDxKWzmwf5vuBmtIU0itpeZ7miBx2WZvaXvNI3KHcXWX+0N8/f6Vs6/aSM9ps6R qJugDDnBpnFCPZIpKqf6viHolnf/mFafgTSdqUlk/xLPk5Xs7fGmQDiUZHP3ph3UDjBH E81w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=E5T74E7a; 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=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 q1si3271607edj.354.2019.09.25.03.03.55; Wed, 25 Sep 2019 03:03:56 -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=@linaro.org header.s=google header.b=E5T74E7a; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387956AbfIYKDw (ORCPT + 26 others); Wed, 25 Sep 2019 06:03:52 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:44589 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726480AbfIYKDv (ORCPT ); Wed, 25 Sep 2019 06:03:51 -0400 Received: by mail-pg1-f196.google.com with SMTP id g3so2908631pgs.11 for ; Wed, 25 Sep 2019 03:03:51 -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=D2+Lw+Pa01X7BomivX93hO8QHJLkQUok4YlT1BdSE8Q=; b=E5T74E7aiLNp58UWXnpZyalzu/mEv9i0J0gVytsV9dTDjmkgfai15/LekVtp2q1QcL gaUVymGSBo5rrEU8HwK0LQX+zl+RCTe3huCu6qasixs/qsPmjPe0FjMPf+1/ysEXI4gr QY0M7E5Xm3nU70nK+lwHwWAw3Cz7idV3KUWPfpiqvoXtfPDSilQp97dXeagEI3L2wun7 CHBsMtM3phTNDbBI0YHMjhb6eSItTo2M8qOB910EXVdoDmfkiqKoeggt1ynccRLa9e4o VRAYo4oTP1CPOM3JmlA6MHB5owQWFCmvxN45t3Ys8AAd9TFxvLW5ATyKJk3K9NvvFbhH DBTQ== 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=D2+Lw+Pa01X7BomivX93hO8QHJLkQUok4YlT1BdSE8Q=; b=gSqWkQz+K2/730hcLoJl/+VTZCyjDoW27KLHOmOnYzCIEsKdvkjxOYl0q8ly21HS5S Up9fz4YPTdAOIxGCYyUuC5F42k6dR5QO6taVznkjXMuncB6yVugtzLH2/d6R3Fj4xd3w xj9vM0+Plstf+XFrDj96thPuot8LhTvUN+gpWvABc2NFm4lHvPR8hVM2PAAj3J8CPRV+ YTuSBoqu2SFxlqjKlYMo6JCrZThrEdOCpR0728IJit7Q/3otjfyMhRSCFvCE9uNvCJ5p Wn53fM6VASosIna+eAa6Cpu+aEevuWLvn+c/ab2XYy8sgt0FmdOS9DCd/kwuSfBROj3v e4PA== X-Gm-Message-State: APjAAAUezXMXUyPAiPdrAXJ59/Rq5Mv1Op+lbt7qLqHSwTjJLq2sMpc1 Tg1W9krGnvEqcs28+g2eqvnW3w== X-Received: by 2002:a17:90a:bf0e:: with SMTP id c14mr5285165pjs.69.1569405831188; Wed, 25 Sep 2019 03:03:51 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id j25sm4753752pfi.113.2019.09.25.03.03.47 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Sep 2019 03:03:50 -0700 (PDT) From: Baolin Wang To: stable@vger.kernel.org, sre@kernel.org Cc: david@lechnology.com, linux-pm@vger.kernel.org, arnd@arndb.de, baolin.wang@linaro.org, orsonzhai@gmail.com, vincent.guittot@linaro.org, linux-kernel@vger.kernel.org Subject: [BACKPORT 4.14.y v3 3/3] power: supply: sysfs: ratelimit property read error message Date: Wed, 25 Sep 2019 18:03:35 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: David Lechner [Upstream commit 87a2b65fc855e6be50f791c2ebbb492541896827] This adds rate limiting to the message that is printed when reading a power supply property via sysfs returns an error. This will prevent userspace applications from unintentionally dDOSing the system by continuously reading a property that returns an error. Signed-off-by: David Lechner Signed-off-by: Sebastian Reichel Signed-off-by: Baolin Wang --- drivers/power/supply/power_supply_sysfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 1.7.9.5 diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c index eb5dc74..2ccaf4f 100644 --- a/drivers/power/supply/power_supply_sysfs.c +++ b/drivers/power/supply/power_supply_sysfs.c @@ -91,7 +91,8 @@ static ssize_t power_supply_show_property(struct device *dev, dev_dbg(dev, "driver has no data for `%s' property\n", attr->attr.name); else if (ret != -ENODEV && ret != -EAGAIN) - dev_err(dev, "driver failed to report `%s' property: %zd\n", + dev_err_ratelimited(dev, + "driver failed to report `%s' property: %zd\n", attr->attr.name, ret); return ret; }