From patchwork Wed Sep 25 10:01:36 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: 174350 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp408696ill; Wed, 25 Sep 2019 03:01:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqxIbFZD2bEuk4DDUlhJ6yZsh2amg7sM7JWWcHQQIBrq07rTM7aAd8t1gXAjtzWqYn7RcDI9 X-Received: by 2002:a2e:a41b:: with SMTP id p27mr5541479ljn.104.1569405717961; Wed, 25 Sep 2019 03:01:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569405717; cv=none; d=google.com; s=arc-20160816; b=oHusJ1SFd3jFHp2o/aKykjsoHtqJ1sXZocOJzP+eTm+1F9WhbRnDQ/YC/w3orcxK8Z wEgFNhUTz/o9F9IT7zSjC/901ttdHQ5KQ/nf28jaAAvM4Awm+EhGx2MavzoDVHJaSemH qiDluwHIX+SS5RtHVQlA+JQAo541OADdjvFuJOtqa/If7nTOtSFa4OQRn5trai5k4wG3 Plh0eG/KpnUUN/hljQ4nsEDDduNpnrg8Y/HfZ3Ec+yIX9GObKN5HbxAfwfof+wWaFnN+ 9w+WR84eM7IruXM7x0B4xTvaLCr5mcypadTU9fcm7SW6iEVpKb4UbgR0+4GwBBLnH3k4 pY2Q== 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=bv8aLyZNsRQTuIGo9WBDbNKWSEWFm7lp2gBa2Tmb/+Y=; b=d9IHL3SsavX7o+Vm3pWE3DTrc8pCqnO3SJv0zYC1U9f09b9YKb72uFdTPPKsjfQuts 2hd3siXSJ6sGjImu5LqI29lNhYI6vuHUtSg8IhezIe6GgB0Ga8LVQ3K2KEP6xIfv7Oei oJVjHeLtvHxVGizM6IKzH7Nz4T6Y06Ka5R25wLm01+VlrTTuMMg1g3khSBcNSyQAhMsK i5Kg4R3zVXWnQsmdMzJicRGyWOkZygVoySTXW1UGdT5aOPbcSpkS9YM7atqYYmcaZ7GE p+4JQK1/yqrqxXEiqf09tusS78bdtkFiABMx+bkNKz5c2aHOT5IkOIttdV4dj8ckXwLg XkUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fgZbG64I; 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 va7si2477221ejb.4.2019.09.25.03.01.57; Wed, 25 Sep 2019 03:01:57 -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=fgZbG64I; 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 S2387663AbfIYKB5 (ORCPT + 26 others); Wed, 25 Sep 2019 06:01:57 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:35419 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732976AbfIYKB4 (ORCPT ); Wed, 25 Sep 2019 06:01:56 -0400 Received: by mail-pg1-f196.google.com with SMTP id a24so2935444pgj.2 for ; Wed, 25 Sep 2019 03:01:55 -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=bv8aLyZNsRQTuIGo9WBDbNKWSEWFm7lp2gBa2Tmb/+Y=; b=fgZbG64IXUHsvM7TRcuP1teXZYFqfqW0l7SKxCbGRJ2bNJ7G8EpFcfSrax7r7CdozP BXABVYGo2CR6D7Kkw4DVVdg474IKzw+R/pjsSnecWmnrGWxcJIMEYZ/++gMw9Idhwayu KCu7xK+zUn8yzhG++1aJwt2wXHOFVUz8LaagufwcDMk+08VxWMdzBibttTcqMYfRFoK+ rS/LwlpKsMDnOodWs+bKhJf6aKTdIapjDcd/xKx8DoXFGOZncOcYpM8kybdG8Qve6P41 j1jqedeNLtUzS/caYff3jb/HZHZj/vdy4Z9vKf31CSU1jaih7Ergo6ZtzgZlJ0Ima141 GGTA== 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=bv8aLyZNsRQTuIGo9WBDbNKWSEWFm7lp2gBa2Tmb/+Y=; b=mGiqKuHcyY9KkrAfHC9Aw5kxq3QWsgngjbC4yAQ15ggMEn+Xwr7pchRbQ8HIIVI2+I hZmx9vxtxNsWtGvvxGbIH81xiLfzSeLdsdbpial2hzvatyYspBVFBWanF/F0QHtpsLbK 64zQLWDYULhqjYNaePygCzj1C9atXvS19HQQhxYbFAUjuudObkoGGeIsiDUtMcdQkvqA tA9UI5ERBWEs3e3uiu6AkFrWH7n/2dM2gkiuT/zgSdZYzLQw8na0tAwbbff0AJRtnVqd sfTdvmbwu31kolR5kVoC2VtbhT9KaSj3azWCguQgK2VOIDwWsdFhspdmBEbYiird/KLy cRyw== X-Gm-Message-State: APjAAAXa99gmz4zqk8cCaPi37DODFiJheYV7KYMB7BOHHUc01NM7em5E ULDEvYNrMqGAiUTTJshXW1R3xQ== X-Received: by 2002:a62:7710:: with SMTP id s16mr8743537pfc.139.1569405715384; Wed, 25 Sep 2019 03:01:55 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id l6sm3847418pje.28.2019.09.25.03.01.52 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Sep 2019 03:01:54 -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.14.y v3 1/3] locking/lockdep: Add debug_locks check in __lock_downgrade() Date: Wed, 25 Sep 2019 18:01:36 +0800 Message-Id: <4ac2e84637ceaf5ec67cfc11ad58c489778693a8.1569405445.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: 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 565005a..5c370c6 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -3650,6 +3650,9 @@ static int reacquire_held_locks(struct task_struct *curr, unsigned int depth, 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 10:02:24 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: 174351 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp409795ill; Wed, 25 Sep 2019 03:02:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqxuJBBysk0Ale+pdZnpcy+oVcZgEOZdcBC/6kjjFQJwyGXDn1g5O73EkP2euyikPcGHDWdZ X-Received: by 2002:a2e:810e:: with SMTP id d14mr5600864ljg.160.1569405769946; Wed, 25 Sep 2019 03:02:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569405769; cv=none; d=google.com; s=arc-20160816; b=rzeZBn9Hw1oXSKtsBqrhqeFWKmKJ2k583lf+5kTZCftCpxCexlluj3uLSceDoQXbQh YQRakuZufMMG/3VqZmA0hC8Q56kYvwvfcTxuIcBLLIn4hTVysAOhaGijmAf1CSlbpVA0 zdh/QBvoYoOAqwaGS8SLEgves8Np1hte+62u1QLDKGl6Bgq02I/XeLXSVwW8ZVntBfZN WGXHbQP5cEbwMGMVXFsEfb+4exyQtNsFctHk4PA7p3ZJ8+7F1CnmShhC7u4cZkDI1+Rn CR9T3lYAT5J0t48mVZDyYwthrex5SjfSv+WyRV0yOJ8jEpckvoL8Im2/VpN/siirUZDG mIwg== 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=PfNn/W0PmjQ9bUUZ6dAEkvRvRPYcOrbr2656dQFRs6Q=; b=0zReqG5xlPxdRAIzDyFmjnFluuQvivkr4KVcYH33wg8w8TyJW1b/g52KhkDCSAhBb9 sIaKkyMsRH2HQnlWIen1LDy3WmB1E1p0eCgK5VW/ImxuSNnckDLBVjNIabTLHqbIcuVp H4/6lQt8bBwt7iH6D3HJKfXRphUZsibeUUT03x5eyKRJr/tAyCVwxwwsPVJHFwz127nA QFXHgGe8m3MrzX286NbOCalIFE6tzA5I0Mj+tRCOu4JF1yjn4faILqj+aZEVsDFsVAoN BIsag11yajiveF0UxTPyVTv1GzAarXUExj5Sy2Bb8LcZ67eZZJkINjGWQDOBUTDOQrZT X3FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JarDPZ4d; 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 va7si2477221ejb.4.2019.09.25.03.02.49; Wed, 25 Sep 2019 03:02:49 -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=JarDPZ4d; 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 S2387758AbfIYKCs (ORCPT + 26 others); Wed, 25 Sep 2019 06:02:48 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:34388 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730072AbfIYKCs (ORCPT ); Wed, 25 Sep 2019 06:02:48 -0400 Received: by mail-pl1-f194.google.com with SMTP id k7so1614136pll.1 for ; Wed, 25 Sep 2019 03:02:48 -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=PfNn/W0PmjQ9bUUZ6dAEkvRvRPYcOrbr2656dQFRs6Q=; b=JarDPZ4d06l2rW7Tu+eOhbKXjmaAqntGdoyAud9fRFwzpo4YMJtFxlV5eduVtlyARe B4i1ZZZWGSLwcag8ovQS3K8AykaAoeVKdcMVP8lW4wk+sd9bpmrorRr+I69d90dBmVVM jzw+zP+XH/1pDAwdv1JU0R+mFF9R3e0UzCWvyvvd0Lm1XA2u1XakxrnFeJ9Y8oTkt7Gy qHEzZWlpC16y4HdG2TsCm2RfHF8Tl9nme/f+P8hDJ8WR9R0TzdOIU/l+y5E/UWvNmM30 UFsizMezvTWeHjibmEMPCYQs7EiGmiLhIW3DJ84JZlDWxb4cl4zRtQaa7FmLvq+NcBkj 7t1A== 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=PfNn/W0PmjQ9bUUZ6dAEkvRvRPYcOrbr2656dQFRs6Q=; b=pJekaMdx4KGeZZO2qaNrJhnU8BwHnSb6h0hCNqiEERMRS9faeqey/KqSkP2o3mKZj5 SSHiILD6t2BZKAEAtr0oc224adeisLmzVJwC5mIHkmWJlCGe4Q401Zwb2aj8c0Y8A429 +aSKCoNTW21zwXu3dVQUjOriIoLx1qv7owXb5HnPFhg7FhmgF7qlr1gdkfh6acCIlwa7 LX3fHTjU6qT4xpPeVXx+vZfit6uC37jJoJSoHxja6sJSsHhA16qcwYlmX5PPzSr/IG3J 4pieHXBcVdCesd/bN7D0uRJcXmh9L7D4Os7TcazUE+mBKmBCr4rm7V37CPGhFSASJMhy dsAQ== X-Gm-Message-State: APjAAAW4Yg5n1YCBc8p+8yr88pVV+zkgD4dekgP858++YEARaEZDHa0Q MxUxhV3oxzBgfzn9GkGarC2ajQ== X-Received: by 2002:a17:902:a58a:: with SMTP id az10mr8426558plb.42.1569405767740; Wed, 25 Sep 2019 03:02:47 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id u31sm13973216pgn.93.2019.09.25.03.02.42 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Sep 2019 03:02:46 -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.14.y v3 2/3] pinctrl: sprd: Use define directive for sprd_pinconf_params values Date: Wed, 25 Sep 2019 18:02:24 +0800 Message-Id: <93a07f8a37d17bdfbda6bcc9fdb5032a724d5f10.1569405445.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: 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 6352991..83958bd 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 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; }