Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp50365imm; Wed, 12 Sep 2018 17:51:58 -0700 (PDT) X-Google-Smtp-Source: ANB0VdY8DEZzPrmUP/cXlEQhkvFFdM5mPe1ljboSFp1t88hIHDqqXqfiCyHoSluwUmGLB3VqYmQv X-Received: by 2002:a63:fa0c:: with SMTP id y12-v6mr4759462pgh.177.1536799918726; Wed, 12 Sep 2018 17:51:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536799918; cv=none; d=google.com; s=arc-20160816; b=CtAArsSdhvxR6ixiIrPh5XO5N+gLWTiOm3ptn5YSea4LrSMkwyZoc4QJQFH3W87Xfo k1oGq/xrHB976EU0I+e8OY+ntcR3nh3LmxUWffM9TTABGRiu2KOXQCogBwH84GCAtwiK 7ZP7aiYX5JraaqgAI6dGEIxtAQHaI1OJRJxrcG0+gECQJyYHLf3kyxTI/185S+RLO4vX DEjvTm51nfivaN1huSB0hP3arV00sQqzInnbl2U115727eVbT8QEL1fL+3Zf0pxux20w YUXwSCgMnLI/XgkX6pkzg6KdLgXmNMo5iFT2ag4VS3Vy8aREuDSMK0L/Ikv3DFe8+NE0 Xrdw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=2JfjiaZwDCyHr2071LwKYtbP5Ea6N5RM9k1W4ooGLqM=; b=zgvOJYGrGrKKjod0/cP30K6/celzCOOSvc0v4IAwri3xY+OvMJWJ8aNDiEU+LrBRWT w0ImiBxoWrCG4NWZRzOxuTD6/z2uaHZXXKoBOJQf2t2kaBrBzrofomnlpXEg2oenmoVM RkstyGn8ZuHr/o2z1Fo1kASJYhULAO8o7SzqAl5IANG3zU5v24uHC4ymEJ7JismwaRXA pMKAhr6G9uMn5DhqqTDhbmghUFYXLNyUnpBwVgIqwYfRn8t4o9Q488hmzXHxDodthePx o9gUCVtALX/8TSd5q8mtAOcJCHNcmWrjbNFyjzVjecFtVQOAPqcXrmKE7kaOI0zs71vj XClA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lechnology.com header.s=default header.b=RG6z+Wrt; 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 b79-v6si2755181pfc.156.2018.09.12.17.51.43; Wed, 12 Sep 2018 17:51:58 -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=RG6z+Wrt; 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 S1727628AbeIMF6H (ORCPT + 99 others); Thu, 13 Sep 2018 01:58:07 -0400 Received: from vern.gendns.com ([206.190.152.46]:46447 "EHLO vern.gendns.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726680AbeIMF6H (ORCPT ); Thu, 13 Sep 2018 01:58:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lechnology.com; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=2JfjiaZwDCyHr2071LwKYtbP5Ea6N5RM9k1W4ooGLqM=; b=RG6z+WrtRkAvm1DYXAEIHHBWjT /CR8OVeoyZuo+ZrGYFS5mHK2TQ0Fw041yMSxABasP+WpIzCd1SdsAfue+oSg6KfATjjxU2XgFDgFV 17AmC+oARyTlFW8WAjZoIBTMyUaGD+mJlsURXcGa3dwGdrinJVKN7mxDWBev46TrPJzifp7LugfJe eH4FBG6LbLW+O9WDxC560xlUpJlkOTzDdBVmTAVqMC6fReketvsrSkq9X5xQ0JZInwSkl6WP7060S sKypbF8c1WqQdXbS46E3jdR4ZtT3MvN9J8gyMMr6iq4QvYPEvRx64+97usLIp4y8V31fqSmMjrNpy seAyl8Hw==; Received: from 108-198-5-147.lightspeed.okcbok.sbcglobal.net ([108.198.5.147]:34326 helo=[192.168.0.134]) by vern.gendns.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.91) (envelope-from ) id 1g0FqY-00AIQi-Vh; Wed, 12 Sep 2018 20:51:03 -0400 Subject: Re: [PATCH] power_supply: sysfs: ratelimit property read error message To: Sebastian Reichel , linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org References: <20180913004830.1265-1-david@lechnology.com> From: David Lechner Message-ID: Date: Wed, 12 Sep 2018 19:51:03 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180913004830.1265-1-david@lechnology.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit 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 On 09/12/2018 07:48 PM, David Lechner wrote: > 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. s/continuosuly/continuously/ > > 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; > } >