Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp49235imm; Wed, 12 Sep 2018 17:50:23 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYRPEtoxC6G/5r+rAXe0yfVzfvfJj1mq7qnOVmJsxfVY4kvmsr7CBg1StDvbJ/NtmksFiBL X-Received: by 2002:a62:bd4:: with SMTP id 81-v6mr4899224pfl.67.1536799823591; Wed, 12 Sep 2018 17:50:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536799823; cv=none; d=google.com; s=arc-20160816; b=0ZCL+KbvUv5HBrshSZgW2pEqh0ToW6yNWJPDol2MA6g2gfRGw1ClVJcd0YFeT0g5Qx naZYsyBcGwIsshHqTJ9gz5iyAj0bvAanIfmo+f7HUinVREVC4yzITcPWiN+HFlykyyan iiMxzJrYZh3k42D/92PtRjzrEP6Od7eoMu/SH5CmRcd8fxRL28rSzMe/Rw7w+EKEtM1F jtc/lEQuYOwq0ijruGrRRD8YtSCWAEbEy7OjdBe+ACF3SljBxFAUsj8sUXHlmGeJvSyN BxiWsC7T/Yc4QJaY2+hNl2l9qkBNGh6fCs1kgsCflgTinSkUW3GtovWkK2qqpCRWxLdL thPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=prFj7rcxV2cnB62BqhkybRrNpLWDoSqJLcSTiGmpZ50=; b=zGEn6U9+j0v06jLU7r7/flEXDzi9LBGsnh+YJLUAql++ozRy0Pr2lAq6fncPAobkFs FDK18LpaUWcyXZDnOE1QTeiKdsna0/W6mdbU7+W39hpymQEHOnl5/MjV77ZpyJB2qKFM Gc3yuJnMegCeBfAAEMinQHnaDgORQW7UQpgWIU6PGHjXFVxSWKhfT0YlZyDDp/6tVka+ gwLQyW5v9TqW+WQ0Vl+Z+iq4BOIdrU1Kz9jj6294/lKGfBjvpry8ixEDi1HwRvpKgPQz iuSuF5gOa+kCEOkNKRU4BiN/foUdCgtunV+xcasRmSxkoPVFnS4aHHk+k1ne/ocR1uI3 75rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lechnology.com header.s=default header.b="hA/KPb1n"; 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 e14-v6si2573986pgg.345.2018.09.12.17.50.08; Wed, 12 Sep 2018 17:50:23 -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=fail header.i=@lechnology.com header.s=default header.b="hA/KPb1n"; 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 S1727716AbeIMFz5 (ORCPT + 99 others); Thu, 13 Sep 2018 01:55:57 -0400 Received: from vern.gendns.com ([206.190.152.46]:46415 "EHLO vern.gendns.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727657AbeIMFz5 (ORCPT ); Thu, 13 Sep 2018 01:55:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lechnology.com; s=default; h=Message-Id:Date:Subject:Cc:To:From:Sender: Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=prFj7rcxV2cnB62BqhkybRrNpLWDoSqJLcSTiGmpZ50=; b=hA/KPb1nWBkCAJUUDeFhhgPXhB vydTDCud4NzABQKkIVsj53BsNgu8cGdQI4ccj+GqwOKBdklWxKvHXldfiko6W+7Etz63DmrvSi1R1 yAOUYg2OagcIAyh5YDPVyVVVbDGG+mkfPmo8G5/BJTOGMm6OInXH2WnZFOjnFbvH45vo6AwkQAqhI th3SQqBb6jFeXDHNjG6+pH/xQGafY7rME4JLVAFLsaKLmy2rja2+HiIiYR3SQ0/W7hU7+mDN0SPR0 CsgMkE+65iv4aXHy6Nv3AauY2BS6BjiP+PLdo9owMLWAlWLWUWs1mAEVhzPrwhOBksp9mQOvxmkrX fC1mayHw==; Received: from 108-198-5-147.lightspeed.okcbok.sbcglobal.net ([108.198.5.147]:34302 helo=freyr.lechnology.com) by vern.gendns.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.91) (envelope-from ) id 1g0FoS-00AI73-LB; Wed, 12 Sep 2018 20:48:52 -0400 From: David Lechner To: Sebastian Reichel , linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, David Lechner Subject: [PATCH] power_supply: sysfs: ratelimit property read error message Date: Wed, 12 Sep 2018 19:48:30 -0500 Message-Id: <20180913004830.1265-1-david@lechnology.com> X-Mailer: git-send-email 2.17.1 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vern.gendns.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lechnology.com X-Get-Message-Sender-Via: vern.gendns.com: authenticated_id: davidmain+lechnology.com/only user confirmed/virtual account not confirmed X-Authenticated-Sender: vern.gendns.com: davidmain@lechnology.com X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This adds ratelimiting 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 continuosuly reading a property that returns an error. Signed-off-by: David Lechner --- drivers/power/supply/power_supply_sysfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c index 6170ed8b6854..dce24f596160 100644 --- a/drivers/power/supply/power_supply_sysfs.c +++ b/drivers/power/supply/power_supply_sysfs.c @@ -131,7 +131,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; } -- 2.17.1