From patchwork Thu Sep 5 03:08:27 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: 173110 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp154887ilq; Wed, 4 Sep 2019 20:08:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqwde/IqIE6ISmfXpPCgGyQFq4PgEZW/hNSJSN7DMyJEYFLCYmQ7aeAkqYpfols+VJQaJbOa X-Received: by 2002:a17:902:3363:: with SMTP id a90mr1055901plc.270.1567652939152; Wed, 04 Sep 2019 20:08:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567652939; cv=none; d=google.com; s=arc-20160816; b=GO3G2shFDdLli30SpLjBRmdX1NZ2pJC485dJvgpJlbetMVfCXBFiTwn8AeC/Qaqr3n 0u1/LhiCcFdxOM9yJJ6Pc27Wg3LK8JrDy+reYKJZthzmQOyiDPVMs74EJ2zhjv0h7N3w cGFdk1E11NoxAsFHgOvD7xWRmssMWSXrUfVS5PgJKUXo43vMeePYWhg9y2jM7g81zuyI Fo7CtfFavqy4M9lsyzCEiaU+HsKmByrtZj9My2l9YbpJ6odBGAuzyYQKwH5SDFko7ftR QJmlwB5wAVis82fEaVQfsqG/9+dswlIwWpDU1NSvl0B2CR2A38EG1NP1Z8p0FRT1pb1b cgtw== 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=Y8+GRxgWK8p8hVWUPZubhD6HdNjtdif5DVbTswXPbq7fs2x7p2ivt1lcb0sr0hhEBI uH4pfqCTY/+jogPpi8azKQt3348trn7nd2seue6PvZGcKnsKC2QK29Xi8Rm6aEmuGnJL bJxOg1L/C2Nul5XYz642oRLGeKPvQ+ab3l5tzcjwTysuuzM4vHSnIHT5H5Iz+Vs6oDro Fpv7QzoVpJqH/ay3CGG3gOfeI2U/gBUlOHOvd2Ofvt5DpAV85sD8MBRUN+pQsmK4RUeD 9YHp+8IR9YlXRkSNTzWjo01jcFwlNyv8yx4SAb5OHgp2vWh5JLZABZmaLydRU1f4sdLA MamQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aPGFjshz; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 h17si802347pjq.34.2019.09.04.20.08.58; Wed, 04 Sep 2019 20:08:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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=aPGFjshz; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1730730AbfIEDI6 (ORCPT + 11 others); Wed, 4 Sep 2019 23:08:58 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:37739 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730522AbfIEDI6 (ORCPT ); Wed, 4 Sep 2019 23:08:58 -0400 Received: by mail-pl1-f194.google.com with SMTP id b10so577267plr.4 for ; Wed, 04 Sep 2019 20:08:57 -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=aPGFjshzn2XCAuii6qIibENbOZhgqdquG5oRwq7Kx0HzuYOTiUtXN7eWd6ZNU43Q4H Unn4mfqnnzZqmZgpSI8dC7YRgOMw0XW0Mu0d+FNBXAmxMJvsjKPI6uu+hkvv3ASKufag XWVjeE2JPTv95d8nKg7UjUcD2c06y5+OzF/+Dhrj/FaaRWtfZIoZlftN7LxzW9jIxclY wPgb3MTUJJAMswWF1k6M0M3fXQD2KoMaVSwRsj65n2TI5lvUHP8qStdM2nZZRzExL4Z1 tr6rfW1g43jLJh245M6ZjbdKtNwxuQtUgnpBwM4qgFrs/osS2ScNuLzvBh+GNEYaPBCb G/0Q== 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=ltTWoVsppR5YzGurZAClwywZCXHkCuVQ07KB7qiRA49me41CsbmumhibUJWRXsHVBr 15CwyhOByDNKT6gS8E+OMUlTNm9JBVZOho026VaOf54G1pyzrcCnNxtNfGnd9BqkNuQE 8+HoXTdTCJ6oG62dLZfwiwaay6lXST7bq/llEoodspr5VkR4yOat0RBD6TXqqud4ysVZ GGPcvXWcvZuE1tW+NGPA8diHOjp9pOOWYu0OAio7MKJ97MxiEiZHX6lYQ/0JEW9DEvXh z4hlLlPRtdGftVzeVfjBQWUlBgituvZQkcpYEWAa8TxMm18CO10JFC1MKv9FMWAwpiEF DTdw== X-Gm-Message-State: APjAAAXcqIylExIqp31pahayKo4DO4OX8l5Vbnk+FeECm7VvE5/YmzdW IDUcxw8KP1Nkm1Yfmbd48RY4GA== X-Received: by 2002:a17:902:7b8c:: with SMTP id w12mr971732pll.276.1567652937442; Wed, 04 Sep 2019 20:08:57 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id s5sm474988pfe.52.2019.09.04.20.08.54 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 04 Sep 2019 20:08:56 -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 v2 4/6] power: supply: sysfs: ratelimit property read error message Date: Thu, 5 Sep 2019 11:08:27 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@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; }