From patchwork Wed Sep 25 09:53:12 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: 174346 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp400427ill; Wed, 25 Sep 2019 02:53:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqypIFDrR3iOEqgD/59c4C5i8A4qELJyr6OPUfpA6q5pzSgFlGERAcaTgsXu1YDBeQFwPaIw X-Received: by 2002:a5d:430e:: with SMTP id h14mr8210526wrq.18.1569405221351; Wed, 25 Sep 2019 02:53:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569405221; cv=none; d=google.com; s=arc-20160816; b=HhVOQPsAtBdFGiImBBnnztyZi4pB2yFRCCDekzYw1fDX8U6kpeaFUj2cxU1hzpHkMD VCu8YesktHUBSNswab1AW5NHFAmrcd5rHhYUPE2zBUx/pqS6tzh4PNFqUGFhch8QSqI/ W18GGR5/2ZnYFCbhxyISOl2CECNHyecpeEgDJxwFOE2T2xMhkEQXqJb9FKvemk5A1YrT 4Hddyp4rrdjeCC4rXhh4phHk6kU/x7byx+sjOEuCji1n199ctXGAUUKL+1PPpEAKXkxV jpc3wS/5mq2d301O1l/Ev/+3Dwm9ydAvJmeKA62ACiz3EkF3Kdw3OolBWpFAyvfC85qJ DuWQ== 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=D6PfaOSiK5wWk46TCo3+Vx3pnanuAKuyWAXUeX0igJw=; b=po9JuZdUW72IQx+LEN5yMGPOiuOuZegZtPSSy2104N4URVcb8ySPLoM5pDKKe0Otzv bqRNQ73w0sfacCxX+K9UORk9ShdA1W+HnwUgIwY0u4ku2ao28FX/ORz9gh9rprj6v/Gi 6z0o95lvNkhWv7ReaM6/HpvbvFUiHYkbt/56EZXakPAS5WT4TdNPyHPfVeAyofY7fNUy g2gyFNign6PDZpF0lygPtznPeZCcXWWFVAMRNjqN0rKLVGg9d+aMPywMDjf/JtcnMq/U A2Rgd074+9hc0vVojCLP+UXSWzFLbZ7D4GRClMW3U/WOADFwm6MX+KR8okMMMuQPkoef s9yA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lBYt+7KM; 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 a14si3284239eda.111.2019.09.25.02.53.41; Wed, 25 Sep 2019 02:53:41 -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=lBYt+7KM; 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 S1732153AbfIYJxk (ORCPT + 26 others); Wed, 25 Sep 2019 05:53:40 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:42151 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727579AbfIYJxj (ORCPT ); Wed, 25 Sep 2019 05:53:39 -0400 Received: by mail-pf1-f195.google.com with SMTP id q12so3068187pff.9 for ; Wed, 25 Sep 2019 02:53:39 -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=D6PfaOSiK5wWk46TCo3+Vx3pnanuAKuyWAXUeX0igJw=; b=lBYt+7KM1phKd/Mg67rR70qFXk2fx7VgIHTfyDK91GSNr5+6CQr8bQQ8hg1pR0ghSQ diNdvPjQuTEZKaYUFJDoVmaAHayHS5MvLuFY41wN5GYGxJ9Pv+vWBnifx+bbo+H+tybk Wkr1cUhcOEX9ry9+GkXxBMN43P2uS599c3QQY9kXnOtsolhtsp4K/lpktiWOUy29grOv scjYue4zUnGohWsIl5saJX7Qe0dNfkgKFqbtnkgdJSxph/T0pG9kIlYfvFqLkVouEkWi ysHoDOujZOGOpOE3V1A8LL4rAqDj8GG+pb90xKe+Ms9qcDWM2AJGzxAArEKGb89rkdUD VCyQ== 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=D6PfaOSiK5wWk46TCo3+Vx3pnanuAKuyWAXUeX0igJw=; b=YpYbJkzf+hXVv/V+UjpKGlyasxYlUrw7d5ZxweoeXQoalDa47NGi6saM90kFhnJD/o 9/r6McEAsns1/L1JCiRy6q3470qx4ckdjbr9va0y4JymOpLFpie8AwPwcdwoaU6J+He0 8+bSXEacnhXyCnvaRPuI+2Q9ec2nGr8QVn4kBdakJe3EEeUyzTmklWNMJ4fcxhG1iiH9 K++sErownlmC5g0grK61tpEUt+inRz9Gie1V9UDwcOfhMyrjqLYQVz4zGrD6hT2nmLgK blyk4ADR0eR6QZOvZXR+oeVe/XmZyK/FbAPR2RRwAVYkx838dJyC78ko0d0LPa/ib4nT iuDw== X-Gm-Message-State: APjAAAU+9wDQgBadPVfrSw8qIk/LbHiGsz/KIBN3kiXcLP+Nc+ulWJCK 4AWdZGV9z1pQSl6lRCj+DWjxRw== X-Received: by 2002:aa7:8bcc:: with SMTP id s12mr8722557pfd.93.1569405219091; Wed, 25 Sep 2019 02:53:39 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id 197sm5054282pge.39.2019.09.25.02.53.35 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Sep 2019 02:53:38 -0700 (PDT) From: Baolin Wang To: stable@vger.kernel.org, peterz@infradead.org, mingo@redhat.com Cc: longman@redhat.com, arnd@arndb.de, baolin.wang@linaro.org, orsonzhai@gmail.com, vincent.guittot@linaro.org, linux-kernel@vger.kernel.org Subject: [BACKPORT 4.19.y 1/3] locking/lockdep: Add debug_locks check in __lock_downgrade() Date: Wed, 25 Sep 2019 17:53:12 +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: Waiman Long [Upstream commit 513e1073d52e55b8024b4f238a48de7587c64ccf] Tetsuo Handa had reported he saw an incorrect "downgrading a read lock" warning right after a previous lockdep warning. It is likely that the previous warning turned off lock debugging causing the lockdep to have inconsistency states leading to the lock downgrade warning. Fix that by add a check for debug_locks at the beginning of __lock_downgrade(). Reported-by: Tetsuo Handa Reported-by: syzbot+53383ae265fb161ef488@syzkaller.appspotmail.com Signed-off-by: Waiman Long Signed-off-by: Peter Zijlstra (Intel) Cc: Andrew Morton Cc: Linus Torvalds Cc: Paul E. McKenney Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Will Deacon Link: https://lkml.kernel.org/r/1547093005-26085-1-git-send-email-longman@redhat.com Signed-off-by: Ingo Molnar Signed-off-by: Baolin Wang --- kernel/locking/lockdep.c | 3 +++ 1 file changed, 3 insertions(+) -- 1.7.9.5 diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index e810e8c..1e272f6 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -3605,6 +3605,9 @@ static int __lock_downgrade(struct lockdep_map *lock, unsigned long ip) unsigned int depth; int i; + if (unlikely(!debug_locks)) + return 0; + depth = curr->lockdep_depth; /* * This function is about (re)setting the class of a held lock, From patchwork Wed Sep 25 09:54:09 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: 174347 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp401353ill; Wed, 25 Sep 2019 02:54:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqyGaZdcp7MZKSDhJRygLrPvxOq74Ubq8hnu9ACVzCjwKZWWbd/kfjU2GO5m111+E2YIq50T X-Received: by 2002:a19:431e:: with SMTP id q30mr5144678lfa.171.1569405274392; Wed, 25 Sep 2019 02:54:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569405274; cv=none; d=google.com; s=arc-20160816; b=PJOjaYad/JFbYekf73vw714fDAsmrj6tNA9qyd8+C91qtObFxH1IYydAG9eWRhg5NR B5ifRO079SX0w+MujD5AWaByvAKo1O/5ovdYn4XtSxyy7HaBxkBFWicXpMzDvpROcHYo 5WCOriAQTGwP8Dww5ztHG1ryXMU/sgP8JYP1VKWLM3T0JOr/oZLG+nXHxywpR7gGCKpW wydSWAZ/o+33DdmvkXDTY3q5BgsdD4JDuGR4jj3oPovbQgbFNje3oT8znu1oaMKl9+ul izTIwbVoSAI0S77VexCA8onhTk3tr5H7O/4BW+qhomgttkCGGSgl4r3pwu3XLY9MXTmc ewng== 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=qjt9nGee6IRgKbTvjid5ObbFQrI9vCTeU4UrRiALsas=; b=DlShYmlVtMjTEsdZ/JpmUm5S2FYgIJaBcnxd93SfCr9ursxIVuF5ALz3yfFl3xa63t YZrXWcFr80p6CGqcO4k0FpVHx1TadJlSaTmQh91ZWNoGLY2RJmgRqx+QKyS/K5bkHI0O YW7Loe7BNvBH8G8IE8FZRfI9+dEJZtZsDE9rRziakx+hPYU5cMYy8rfrnmYUW8WwSu/8 rxDCMkAQdqngUTXnOrUosvqtvKQUgqkRq3EUgry5reM1cOsY0ZCMv8pDBryDu8L1M9hk tqQGS4y6MSFGqkhzgjO1sVbr1Kd6JyMPHCRjh/d7+K2AN3vQkuy7vgFxuVkLlV7wXWlo iQNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kg8lbcqY; 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 o2si2381851ejm.367.2019.09.25.02.54.34; Wed, 25 Sep 2019 02:54:34 -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=kg8lbcqY; 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 S1732615AbfIYJyd (ORCPT + 26 others); Wed, 25 Sep 2019 05:54:33 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:33144 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726698AbfIYJyc (ORCPT ); Wed, 25 Sep 2019 05:54:32 -0400 Received: by mail-pg1-f196.google.com with SMTP id i30so2932978pgl.0 for ; Wed, 25 Sep 2019 02:54:32 -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=qjt9nGee6IRgKbTvjid5ObbFQrI9vCTeU4UrRiALsas=; b=kg8lbcqYpgzcKQyZHGhI7ejPMzvDJkhTF8+VLoKNp6I0PZW3MWX13h0iqXQz+W4ftP jTixi9u0JwyhtYY/BNrY/39d/0c5CbNRDkCmfFRpVwNbzp3epZud42ngEFiREiFbRIP0 rYOdkfT4JsJx6qUBBuX9DR4DnVh4+NmfUFyMIozvXGnO3AoyZZEjseLyCkL81vZbmxiK kkBcMijzCe69hXkUI1owV1UhlJ3LiVqMGzgNMjDPArVDbfnK40jQDxvDToQwzaG5HnyL toDVSZDPE+7C9XGhcRlKuLbkIDgZWDK0fCO6XoMQR/ZqKlkjzm2Qb6XAAWGfstda6Puh KM7A== 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=qjt9nGee6IRgKbTvjid5ObbFQrI9vCTeU4UrRiALsas=; b=uGrOBYF85A1DT/c4hv+HmkpPrASOQwMO1CE7E/uv5ScYdla4AUJKltlKVZC4gHwHLk J8/KrIcJagTWw3lw0J4lyU7+s8ATdrIiRLfKsIHTA/iSpB9W5ukJNIdgaHYhpY6r0/aw OkVkcUiAjUq/tow3cGpCicHizW9tDlGnlZqknSTF4jnAfwh0KfUmqbKrvlh7eYXCCpIi FVLQHzNDGH9ENf3bK7T784dcbv43C8khXND/COkqkDI/dSo1wsDkq/+N2LBVk5rsQeMT cQjv6MdaAe99p5Ou86J0icVMcMEwq15ON5DKFAJDF9K4SHjO8ml2VP0ecVonXdcQ/qZu sYhw== X-Gm-Message-State: APjAAAXfuGGM8WjtSUxfz2BdbB1H0fyg3IyVHd79emKa5cLI9HFlv+Tk XdB/k2cL0DucbyUTf0jtUtbW2Q== X-Received: by 2002:a63:1950:: with SMTP id 16mr8180123pgz.213.1569405271867; Wed, 25 Sep 2019 02:54:31 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id i126sm5298307pfc.29.2019.09.25.02.54.28 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Sep 2019 02:54:30 -0700 (PDT) From: Baolin Wang To: stable@vger.kernel.org, linus.walleij@linaro.org, natechancellor@gmail.com Cc: linux-gpio@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.19.y 2/3] pinctrl: sprd: Use define directive for sprd_pinconf_params values Date: Wed, 25 Sep 2019 17:54:09 +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: Nathan Chancellor [Upstream commit 957063c924736d4341e5d588757b9f31e8f6fa24] Clang warns when one enumerated type is implicitly converted to another: drivers/pinctrl/sprd/pinctrl-sprd.c:845:19: warning: implicit conversion from enumeration type 'enum sprd_pinconf_params' to different enumeration type 'enum pin_config_param' [-Wenum-conversion] {"sprd,control", SPRD_PIN_CONFIG_CONTROL, 0}, ~ ^~~~~~~~~~~~~~~~~~~~~~~ drivers/pinctrl/sprd/pinctrl-sprd.c:846:22: warning: implicit conversion from enumeration type 'enum sprd_pinconf_params' to different enumeration type 'enum pin_config_param' [-Wenum-conversion] {"sprd,sleep-mode", SPRD_PIN_CONFIG_SLEEP_MODE, 0}, ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~ It is expected that pinctrl drivers can extend pin_config_param because of the gap between PIN_CONFIG_END and PIN_CONFIG_MAX so this conversion isn't an issue. Most drivers that take advantage of this define the PIN_CONFIG variables as constants, rather than enumerated values. Do the same thing here so that Clang no longer warns. Link: https://github.com/ClangBuiltLinux/linux/issues/138 Signed-off-by: Nathan Chancellor Reviewed-by: Baolin Wang Signed-off-by: Linus Walleij Signed-off-by: Baolin Wang --- drivers/pinctrl/sprd/pinctrl-sprd.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) -- 1.7.9.5 diff --git a/drivers/pinctrl/sprd/pinctrl-sprd.c b/drivers/pinctrl/sprd/pinctrl-sprd.c index 78c2f54..8f3468d 100644 --- a/drivers/pinctrl/sprd/pinctrl-sprd.c +++ b/drivers/pinctrl/sprd/pinctrl-sprd.c @@ -159,10 +159,8 @@ struct sprd_pinctrl { struct sprd_pinctrl_soc_info *info; }; -enum sprd_pinconf_params { - SPRD_PIN_CONFIG_CONTROL = PIN_CONFIG_END + 1, - SPRD_PIN_CONFIG_SLEEP_MODE = PIN_CONFIG_END + 2, -}; +#define SPRD_PIN_CONFIG_CONTROL (PIN_CONFIG_END + 1) +#define SPRD_PIN_CONFIG_SLEEP_MODE (PIN_CONFIG_END + 2) static int sprd_pinctrl_get_id_by_name(struct sprd_pinctrl *sprd_pctl, const char *name) From patchwork Wed Sep 25 09:55:03 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: 174348 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp402186ill; Wed, 25 Sep 2019 02:55:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqz+B66JGBzQIgiai6MVt6v02Juqz29zTjeUH3KYBEC1UVruNaYJlnq3GihsyiUVFB/88AL0 X-Received: by 2002:a2e:9748:: with SMTP id f8mr2208375ljj.167.1569405327372; Wed, 25 Sep 2019 02:55:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569405327; cv=none; d=google.com; s=arc-20160816; b=K+m3+X7tRNGI12G7XWRYXZ4DcgN0I/RudKwTyYlaUgkRgCSwDJeQQcHCNBcJRsoJxx OJrMrxBgAVFSKQDVJFKqwYgE2B0KO6+Hm44otKMVtUVEt+E+9ltXx0rRA/Mlou7z/9mB HNnwPqk7VETDEpKwn7iVVvNXCIeCUmL/wJJ98VHDutGuKG4SSAZs32PEos7IKaI+Aijj kLUWIfitAIP00BxXaNWFrCgA4MVBsrlv5QZQS/6OWMpXb+PtFR6zY+uZhmw4kdjhjOA+ Kxl+w4cDtwQixjMHLLDMy/MpVSLFCGLsGhtmM3S1YizuT8SyJisUJQm3YHBYumM+6kZj m8Og== 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=DWhbUGv2lQeZO4jYvuR/nIX8VcsQRP/3s99PPL6K370=; b=Ar1kROeKpB9zFEB//e/aGBQFtpgs1udVTOlss4SjgM23+PbEzbNbeVTRziofx0o9CA 7JLrZZ8VuqN21KbZOBkJrcSm7kG22BtgGpuMJfONEsgo+VwTYMpVJ1Q0evy3mLBxIP55 v4FuBLEpMFPHMxYTDJTJgqm9wnSHcLMflS1KuhuGelaevX1coxrTs0B/dnvAlRHY7T9G 0EzglfVPWW+fb+Hvbl5rLr0IFII0I5Dssz7DBgtV3VTho0o7GA1a2I0gnCPZrQq+8rKR rB6zXs2MWn4QNgXr12hch1A4AIsCD4EvemQYNrXZwJj3mZ9QcNFRUENYvTvtvvZlzFNL lXtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=q10EU45N; 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 w5si2899363eds.179.2019.09.25.02.55.27; Wed, 25 Sep 2019 02:55:27 -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=q10EU45N; 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 S1732768AbfIYJz0 (ORCPT + 26 others); Wed, 25 Sep 2019 05:55:26 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:37732 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726698AbfIYJz0 (ORCPT ); Wed, 25 Sep 2019 05:55:26 -0400 Received: by mail-pf1-f196.google.com with SMTP id y5so3088115pfo.4 for ; Wed, 25 Sep 2019 02:55:25 -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=DWhbUGv2lQeZO4jYvuR/nIX8VcsQRP/3s99PPL6K370=; b=q10EU45NTJwIJeYfgsOBdN94NNFG3fwiOLyu8Ix7i+TuDo3WIftED76Ja2vnuOZ5rh qgmTU6GXJaHLYtMrF1wV0dwXj61rzxSLCXubwBC3wO2v+J84vvhJoyfkrzkgkLMBDx0P gaNMRxZrXdRvGNO8WCQ2H84Jtw78GxePE1UxWdthzJtNwMbuPhan0oFMKBAbcRLIdqIf wrUOFwSm10824LM2VQZACB2CD0ZR3+oy5SoJtq4pHz/2sAg04gbbi7BWmkpa+GVSafvJ dAuGXkJHykPpnzfplGIaOccK6F41LMCUwyy1T+tSybzxhFYFPWUk4xVrzityIH3k36ZE hRWA== 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=DWhbUGv2lQeZO4jYvuR/nIX8VcsQRP/3s99PPL6K370=; b=YCW1mtJv/QcKk0tvghBp7KVoI4YM9mujNzeJYGfXI5wKyW73MMM1S4oUmFOPgKDGKv SzHBxUXJnOECzPI2ctfzltE2m16Li5MVe4hkU8qpjPrEcLeE2P+SfJ92eIlhZgCAPFn9 4mrDmXXo7wNgvY4hrUhKt6ackLuAmXuDIGvSUWB6cKSCm8niN2pT0KBfL7iReAI2CcRw 0vAx6R+wcvDncLGU6v2BPm1IgN/A9MQAuj8qxSooacxKHDmq69hMJiivLSGB0SupraJA 1Plfc51ReF7Paga8/iVFGHUIv7pO1ClXnVgyfQ5iIQiHaem9iDl/FUbdavXerInxnct3 q6OA== X-Gm-Message-State: APjAAAVXau0WJhi1Wu+1o5j8tcWlixcc1Rzq3SWm1zAr/oBwBAugEx+n PhL6uRcX9dMW5M4h0mDdSXysmg== X-Received: by 2002:a62:f249:: with SMTP id y9mr8759936pfl.147.1569405325359; Wed, 25 Sep 2019 02:55:25 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id i7sm2430831pjs.1.2019.09.25.02.55.21 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Sep 2019 02:55:24 -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.19.y 3/3] power: supply: sysfs: ratelimit property read error message Date: Wed, 25 Sep 2019 17:55:03 +0800 Message-Id: <117b7b2d9bed2a288676f5614d8dd8d09746ab93.1569404757.git.baolin.wang@linaro.org> 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 5a2757a..5358a80 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; }