From patchwork Fri Mar 22 15:43:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160916 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp959336jan; Fri, 22 Mar 2019 08:45:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqzkfJIqHysWXMzDIgFAAbs7GGESibpmlGwup6XMQZfRZ3IEb8S9ZdeeMiLjZV10o8R9HMFn X-Received: by 2002:a17:902:850c:: with SMTP id bj12mr9892050plb.69.1553269507626; Fri, 22 Mar 2019 08:45:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553269507; cv=none; d=google.com; s=arc-20160816; b=AD1e6RwVCadjN+/TvfVYzvTs63yiNo+3ynCf7xsoJr4EfxGOq+CePUgPZa9bgPlxx+ irpOVM0r2e9ZsrgDxkM3gyBYDL+KmSTvFwXQVMyBSDv8OOxLHark/OmUfwhkBm/izhZD 26OBWYLC3p/fYZ76vsT9dfOq1cKk7qZYNSltu4E7n3mmL2obGo7OKZ+t0JL+gFVBe9hm nmA5GMvyaPbgo8vO5lLdKLZjKZejhiu9O6CBTSmEAS/aSy43IAd62pzN0e15YbaDS0ui NRnd4woxX8X6a0REMBDvdT72Sb64Utqpw4yGdZuQMlMfsCuhrDhQEZAo8XMDS8P12eF/ dhCw== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=r7TWXvSkzg9FDtBISdMFiTn+mY7s6jTZFKqn8rlCQgo=; b=QXkmcas6oe1nhYZto+eLrd/HkOH+jrSonlBvimAYqQdjHzL0cvVZkmi89KwvYGZWyL RBtKJcHi4iTBoYuGoAFKy+q6vXKjjeBjo61KQ9LP/FwCjYclg/8yhw6Vq8hGOf7KZuZO vazRNIJvGpvHOvWeBwqMJT9+3KIgTBMdaup4b3RtaLoy/ODOLNQH1qt16q+0J73ZMb66 batfBi9fbE9BUrK7oVRiS7huvJM4swo+a2KDA5/OHOUvTLqyrztXpYqioFydL0qOoS0d lHrwXVQ4hIBadBkn3GyrHLZIXxYvsrQ+riD0CnnfDp/Tny6RXktoaxcSPog6eIpUhaDm vsxA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 w19si6763487ply.264.2019.03.22.08.45.07; Fri, 22 Mar 2019 08:45:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727439AbfCVPpG (ORCPT + 14 others); Fri, 22 Mar 2019 11:45:06 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:45359 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725981AbfCVPpG (ORCPT ); Fri, 22 Mar 2019 11:45:06 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1M2w8Y-1h8TLT0ncK-003KEI; Fri, 22 Mar 2019 16:44:59 +0100 From: Arnd Bergmann To: stable@vger.kernel.org, Ulf Hansson , Janusz Krzysztofik , Linus Walleij , "Tobin C. Harding" , Geert Uytterhoeven Cc: Julia Lawall , Arnd Bergmann , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [BACKPORT 4.4.y 01/25] mmc: pwrseq: constify mmc_pwrseq_ops structures Date: Fri, 22 Mar 2019 16:43:52 +0100 Message-Id: <20190322154425.3852517-2-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190322154425.3852517-1-arnd@arndb.de> References: <20190322154425.3852517-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:oe8376lywJ1RlgN89xWJQlf+8ZN8YDWsg4NYJjq+An/jq+TA3OO iRU3TJcxTNCk2RPXuCFKIGL03nBVIEj79YFJiDLmz1HJZhgoAroXmEqJjWtOS8rjBwBABhY IWwRX0wx8cMrHa1cZE6u1U9/XXHYduegiEDbHGGRXfwewHHR0nZdYOGyZo1bJxrkm++SImw H0m9QaPU7eMWkeR79GdVQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:W4KUOBxIZrU=:yV+7BtWADOH09wsWx39kaZ wHIZrDycVFQIt7W3f2Pdi4h5KFryWkZWTFjBkkANQXkdqErAZgiFsf4vdTyGCjzw+sxfeNPrj 4wssvVI9T1x9Pkb1MuE9+qI3FhzdqfaBhSRzqzz68qtjz74VjzONMZO9VmlhA378jrSxv/ipX CWjeQ45empv1htdOXAmjM4DNn/CtXw6aIVBizPH6nWqihoglMVbt/H0i9ZhxRKoJUMdYOMwq6 V+shWTBgqwMuTcFMkR8B+B89yi7QaJsfJKEidra36l7lH7kMH70fyF33xdJusJl3x20rZyMX0 WlAYYCb5nDBi3dY0U7iNbufDdRIbd+46gy1zClKr2DdnWgeoDG92FuO5p0fcGn8SBmjpIQPB2 1GAGQuAm8kfUO8tiepI090EpKmX4qbV23kcQxFH14uCiZCSJeqZ7Pz8lfAolVaOakcbhtFrte u5xEmuhQab+OJYeXrHWjbkr9TNXaeInF3/w8MjllwayfX9P/87Hd0pow/gnhR+XvgCWCGgkbQ wg44V6CnYv5UFAE7mB60set1WbYe6o0Ziu6qOACWRewly+hxSKt7ozDnATQjqQY3Tb+ws8/Uf 9du26OULb4lXQaQRbunR3X/fFksm/gqxgjv30JlFmJCjzYkP8+bM4DZAPI2zUfWw7nB5Eq303 qArUwlLDqYMBfiCDTMQZC5VtBnDU7086Am6DsJF6xXhBuByFotzII8Jf+NISofo8knykflgvW g2Hh3O6gyq6tpAdlDuFQA0XnGK9OwD+g1UNP/g== Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Julia Lawall The mmc_pwrseq_ops structures are never modified, so declare them as const. Done with the help of Coccinelle. Signed-off-by: Julia Lawall Signed-off-by: Ulf Hansson (cherry picked from commit ffedbd2210f2f4cba490a9205adc11fd1b89a852) Signed-off-by: Arnd Bergmann --- drivers/mmc/core/pwrseq.h | 2 +- drivers/mmc/core/pwrseq_emmc.c | 2 +- drivers/mmc/core/pwrseq_simple.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) -- 2.20.0 diff --git a/drivers/mmc/core/pwrseq.h b/drivers/mmc/core/pwrseq.h index 096da48c6a7e..133de0426687 100644 --- a/drivers/mmc/core/pwrseq.h +++ b/drivers/mmc/core/pwrseq.h @@ -16,7 +16,7 @@ struct mmc_pwrseq_ops { }; struct mmc_pwrseq { - struct mmc_pwrseq_ops *ops; + const struct mmc_pwrseq_ops *ops; }; #ifdef CONFIG_OF diff --git a/drivers/mmc/core/pwrseq_emmc.c b/drivers/mmc/core/pwrseq_emmc.c index ad4f94ec7e8d..4a82bc77fe49 100644 --- a/drivers/mmc/core/pwrseq_emmc.c +++ b/drivers/mmc/core/pwrseq_emmc.c @@ -51,7 +51,7 @@ static void mmc_pwrseq_emmc_free(struct mmc_host *host) kfree(pwrseq); } -static struct mmc_pwrseq_ops mmc_pwrseq_emmc_ops = { +static const struct mmc_pwrseq_ops mmc_pwrseq_emmc_ops = { .post_power_on = mmc_pwrseq_emmc_reset, .free = mmc_pwrseq_emmc_free, }; diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c index d10538bb5e07..2b16263458af 100644 --- a/drivers/mmc/core/pwrseq_simple.c +++ b/drivers/mmc/core/pwrseq_simple.c @@ -87,7 +87,7 @@ static void mmc_pwrseq_simple_free(struct mmc_host *host) kfree(pwrseq); } -static struct mmc_pwrseq_ops mmc_pwrseq_simple_ops = { +static const struct mmc_pwrseq_ops mmc_pwrseq_simple_ops = { .pre_power_on = mmc_pwrseq_simple_pre_power_on, .post_power_on = mmc_pwrseq_simple_post_power_on, .power_off = mmc_pwrseq_simple_power_off, From patchwork Fri Mar 22 15:43:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160922 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp961132jan; Fri, 22 Mar 2019 08:46:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqzlnnQX9l2g/KeAtn4/HQEeKnQCKamauCw8SBBPIxeOIk6Zg2lqA8HEpTp4i0Ip+KAAmxTo X-Received: by 2002:a17:902:eb84:: with SMTP id cx4mr581780plb.52.1553269614603; Fri, 22 Mar 2019 08:46:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553269614; cv=none; d=google.com; s=arc-20160816; b=g41MurzFnns3pq2Qj9fWo3BpqHjJfV9mlFm8iSPVFcRLfTYA22hElR+2VhXyTewINx bcuSWckmsSgAQXwTLzHVS5H6UZvwqECIfkp5bDB3jr0JPv8KYZWmTXI6+zhjgBR2WxkQ dgL8/au6pXnEeZ3mq++6xVHh5dtEMZUN1BzHgGcVvx8YpLSHaGqv6e+R5h2OI4+BPYWu gvtCt4SORyCWefOqimEUirllvMNXSwx2ARCGNOEvj7hsOmMYp8L1HfHEL2ulaEWjM4hQ q/lukZpgMQDB94q4kl8lYXDejJcpnNsKYYw5szuB/A1TXl2McErKzzP0iosuLS7/HJou m3hg== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=6LCEq5orkSi25bhFJIZFhZa+RwawfwSFf65ioXHTrkc=; b=Whn6hZMvg8Dxhx90dBYXlPqPfkMQO3VYNiOHZMEvB46TQKbHAZbX02BraLUqTUskfy giw0p2LV8Oae2U1k1k4LN0SVK+5OmM426msK1gbgZh1D+craNiVCYjbH5W5XXUteuR3k enGg7sObyFEZAXz17789gzqxDVym3RRS+jF7s5l1I6WduiVNDdyCsQ0MnUizdEKBVCQB vPaCfbet0P8Zn4rjvx0QI4v5c0CtBCrqACVIkzSA6AAOjDT4JsniDbqNAXlOkHbdsWGZ 5PToWxc4ad+OXy5Ex+5vA+1+xfgjQA62iUWBHSfXYsosGOwXNJ0qFjg+WeuBFofKhmQG Gcrw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 g6si6745112pgk.478.2019.03.22.08.46.54; Fri, 22 Mar 2019 08:46:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727364AbfCVPqx (ORCPT + 14 others); Fri, 22 Mar 2019 11:46:53 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:57135 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727251AbfCVPqx (ORCPT ); Fri, 22 Mar 2019 11:46:53 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1Ml6du-1giFMn2xJs-00lUfW; Fri, 22 Mar 2019 16:46:21 +0100 From: Arnd Bergmann To: stable@vger.kernel.org, Ulf Hansson , Avri Altman , Shawn Lin , Martin Hicks , =?utf-8?q?Niklas_S=C3=B6derlund?= , Wolfram Sang , Ritesh Harjani , Simon Horman , hongjiefang , Yinbo Zhu , Kyle Roeschley Cc: Arnd Bergmann , Jiong Wu , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [BACKPORT 4.4.y 07/25] mmc: sanitize 'bus width' in debug output Date: Fri, 22 Mar 2019 16:43:58 +0100 Message-Id: <20190322154425.3852517-8-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190322154425.3852517-1-arnd@arndb.de> References: <20190322154425.3852517-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:G768/5n7N+5yTCnRzLr3RNwvzu/HYJiMFqxjs0wDv/J34Szl14D ox4n6suF/EFsAqlzN5tGJcDQeBomC44kIT1Opy/9ltW98MuFx8iQOTAdh6V4Y4E8/Q04Vq8 zKSNVc3eiLey+XUBSjqgbkYVmQG8JrIq4aPEOmdNxWtaewmVNV6EnbbB2XDXz7HSHF+M7zI fr9ElsuIRW32OqLNzcnLA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:7T/GpsWXrRI=:gv5/lMUz3Skxdq2x4iCNw+ sU6OSLFoZYnZpQt1+S9bwibN8jBoon6VFG1qC2ImbUemPsECYLxT9ZbeHcnAjQZdkVEhLAmuF yl46ggRrpiFXEXk6uSO4gq5OUGeQ1nFglHQ38RK90n4tM3NAsnfEeFhT1Lujfm4OkcihFY8/v rxKppeDax2KUhokn2BvHVHYJQpTrh4/1mHiMY40D1xYJCbJL8fbwuE6Eqj4gdsnhF8NGCB/qR SG9Q4yYlCCWQ9WeY7DrxIf7NCm1RKKVjjMWckSuBFAXmj50m2tqem0nz4feDAt1Ymnh0sfbQ9 fM6X5f83+xxb5+8rpctpxiQqkIr26l4cFuX75SjGXKJ65WwiLomgjrx4LNABekiTAkKWS9ovr Ql5EUUAXC7eg9Ed8I9KHRPDWQiVDrjXbx94uxmrfRFENYG9r07lP97FfIP/yY4hZtYAGn0zPc 0n5aUm4jRlvdjwcGK0unpI07ivx+bdwpva4c2z5oBMxmTcaTSD3epFj1sgS94HIJGfr8mZpz3 ROwJRE+OqtgyL0rystPgFaybsfXd7Qnxp2JqQiTemf3C2btIakaa5188Ze44Bt7S+6uugRv6+ tWqxYxLQ2CBPxKIF5UhKlWlZ1XwZTUmo2uoq/1J+jypGgaV1YNHXyprhh/ozWzeveqkC9pwmA CvUw2pAabo/BSaXurlWmOUr3f5Yp66f0tarxnxo+W4cYj/karKv8VoSg3JVYFDKB2g52CUpWT IqJIqwl7naZsgWNi/FJgQ1vTRKxiz9OirC7rwA== Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Wolfram Sang The bus width is sometimes the actual bus width, and sometimes indices to different arrays encoding the bus width. In my debugging case "2" could mean 8-bit as well as 4-bit, which was extremly confusing. Let's use the human-readable actual bus width in all places. Signed-off-by: Wolfram Sang Signed-off-by: Ulf Hansson (cherry picked from commit ed9feec72fc1fa194ebfdb79e14561b35decce63) Signed-off-by: Arnd Bergmann --- drivers/mmc/core/core.c | 2 +- drivers/mmc/core/mmc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -- 2.20.0 diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 299a83f1ad38..e2e927d1f7e4 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1039,7 +1039,7 @@ static inline void mmc_set_ios(struct mmc_host *host) "width %u timing %u\n", mmc_hostname(host), ios->clock, ios->bus_mode, ios->power_mode, ios->chip_select, ios->vdd, - ios->bus_width, ios->timing); + 1 << ios->bus_width, ios->timing); host->ops->set_ios(host, ios); } diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index adc3291e9d6a..7286d0d324e1 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -952,7 +952,7 @@ static int mmc_select_bus_width(struct mmc_card *card) break; } else { pr_warn("%s: switch to bus width %d failed\n", - mmc_hostname(host), ext_csd_bits[idx]); + mmc_hostname(host), 1 << bus_width); } } From patchwork Fri Mar 22 15:44:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160925 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp961672jan; Fri, 22 Mar 2019 08:47:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqxGtGuIFBD/ZupTmP4YfyMFMIVQZainkw1hLzOAf44OKFnthIZnl2VIplDbKE1zB78uLBAo X-Received: by 2002:a62:560f:: with SMTP id k15mr9803680pfb.231.1553269648288; Fri, 22 Mar 2019 08:47:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553269648; cv=none; d=google.com; s=arc-20160816; b=Anl/OTFuVogLiNecubZ2rXgklAlnl1u07re94vphQCky26EFDq2LUJAI/8AzborHrn EH0lbVBBKJShTGfyliL6ovjhc4YUbvZRuOZ4WBX7FVirkNJ8s4y/LEuzUzdt9XGgNl95 cZ7G36hknR8+66QwZR0qRxNsxqqxleR69J9N8g5EcAy0mTvPmjnICfbTHBVajJhqu+Fj R7sa8yDdiQGNrtNtoWVJoPiwSN9umxux8RIKu5xSbPJ4UtECWNrLBLwoQMutUlAfbvWg nhJZfenV32UzMNg8g8kUON0OJt5LNpr943rE4rczTRYFtLaXOZaQeYWNAD9Tj75BumT2 yd+A== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=jMF7FGNLq2yAuE1q5n39N1+YXXZh5YtTev4LFokQmgs=; b=kM/0OHXOixC4OV/gPoqvpZpgotM9yTVBMQP1T5rKktZDaF/z0GpHlFYj08+yt6mcfR 1JtdCcZpEqA2J+trs3NWlYgJwFnoaD+syy6eAmyI3PKDaK+pxEwIEIwDVfjAJ01pW9at mZbiwxMMqf2k1CeGiCInxMumeV31d83gb/y2qKszKsteaQmH8aTsENM0P/j8oWfmH/+E FU1mW29sA2GLxQFzyh06f+QLgCbDInrc84ulTiLX6nU92X/iywTwODm2nJcKBsCIX5gu ZM5xje4RGGAFIlbxNBlgB5OuGK1SZ9vuMz+XtrFHbdAmHpDJNrm9PF7pJmVZgc3F7yab XhCg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 y4si6963548pfy.157.2019.03.22.08.47.28; Fri, 22 Mar 2019 08:47:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727516AbfCVPr1 (ORCPT + 14 others); Fri, 22 Mar 2019 11:47:27 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:50135 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727438AbfCVPr1 (ORCPT ); Fri, 22 Mar 2019 11:47:27 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1Mz9hF-1glrBT0Dlz-00wEbJ; Fri, 22 Mar 2019 16:46:56 +0100 From: Arnd Bergmann To: stable@vger.kernel.org, Catalin Marinas , Will Deacon , "Eric W. Biederman" , Mark Rutland , "Rafael J. Wysocki" , Anshuman Khandual , James Morse , Peter Maydell , Andrey Konovalov Cc: Arnd Bergmann , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [BACKPORT 4.4.y 10/25] arm64: mm: Add trace_irqflags annotations to do_debug_exception() Date: Fri, 22 Mar 2019 16:44:01 +0100 Message-Id: <20190322154425.3852517-11-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190322154425.3852517-1-arnd@arndb.de> References: <20190322154425.3852517-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:ZFpF8CAe8AmBwG8PGJWPFop0PRfjbeBIlad56HwVq67hsFHJ0tt /vTMl2X1z7FjJcfBD0yN8KM2IpfFg+j50kqftvc8+oe9L9ijCZIB96BSaGpzYkwAB3tKm5x QsQSsWeUgJ4gewKBKXcbAFOG+noCIE8Jlpu1KFR853UTVguO/qJWsuPHpuFMH4tfXZccPsR OKODfg19h+O9i3y9U71xQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:vhym0IdyrDA=:IagoDTjJ/AZm8MOUQihw/h lfjIfsiKuAjcr0YkJUa3nKwnT87irDoj13onxU3W5TDW0hf4b9zn9hX/tbM+y3Kd3QZY9nW4P ENXHg/s6eOeXdL/57nJ3gRv4nWemwtl58VGfkAJ/9GQRdeb4RZO3oaMPLSBP6XDcsIdZ+Idp4 jXvlvemWe6/NVlMZMALxF3//wuKh9mj0yT0WuAeKNOJ0BYycfiAxtLPnnJr8rJnw58QvCZ0ZF MK26TbIvudgq7V25j37GDFSAUKSfLEhsaFJEPlHPH0eO+OeycXf2dsU4DhLSVSXw59ibyHzwU SEni14uvrS8VhclQLU6h69oKllWXhaY2F+GpDcxxdxPb+KglXhXgMOFZO/IrrjUlZPzx0nDud cf6sj3qJA69QviQTQgygrApzKDiROW/IS1pABbOvyJoMLmyfP4b7ykMmYlWnorrgqwdh0+KSH OU3zPAxbKIWvkr2g+XuRnAa9d9lC005SfdyTJjBwS2PuBjfWJpNBRgISiNe82vigjFLRYl0gP m736lhhI/A7M2uTQBr/PhBhc+UsBteTXBV5ZG+7u/fx7jIRqNVOChl+BElMvlbSrgkbbVKIGq y86Da3naDGq/+sZryHTJZ143Z1/7CHhrrG7g00LrJ7pJoIu7jiyjVVUPIdQVv5LEgAW6HE20B Bjs4+SlMn0PTY8zvXnTC7v+YAPGsRnOWEKL1Y0kMjEc/X2G1vOMH91h1y3J+fc2lVvvHsiFT9 ccvN6lPlR10SMbWu8ROHz45cwbajO7eTSOlrjw== Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: James Morse With CONFIG_PROVE_LOCKING, CONFIG_DEBUG_LOCKDEP and CONFIG_TRACE_IRQFLAGS enabled, lockdep will compare current->hardirqs_enabled with the flags from local_irq_save(). When a debug exception occurs, interrupts are disabled in entry.S, but lockdep isn't told, resulting in: DEBUG_LOCKS_WARN_ON(current->hardirqs_enabled) ------------[ cut here ]------------ WARNING: at ../kernel/locking/lockdep.c:3523 Modules linked in: CPU: 3 PID: 1752 Comm: perf Not tainted 4.5.0-rc4+ #2204 Hardware name: ARM Juno development board (r1) (DT) task: ffffffc974868000 ti: ffffffc975f40000 task.ti: ffffffc975f40000 PC is at check_flags.part.35+0x17c/0x184 LR is at check_flags.part.35+0x17c/0x184 pc : [] lr : [] pstate: 600003c5 [...] ---[ end trace 74631f9305ef5020 ]--- Call trace: [] check_flags.part.35+0x17c/0x184 [] lock_acquire+0xa8/0xc4 [] breakpoint_handler+0x118/0x288 [] do_debug_exception+0x3c/0xa8 [] el1_dbg+0x18/0x6c [] do_filp_open+0x64/0xdc [] do_sys_open+0x140/0x204 [] SyS_openat+0x10/0x18 [] el0_svc_naked+0x24/0x28 possible reason: unannotated irqs-off. irq event stamp: 65857 hardirqs last enabled at (65857): [] lookup_mnt+0xf4/0x1b4 hardirqs last disabled at (65856): [] lookup_mnt+0xbc/0x1b4 softirqs last enabled at (65790): [] __do_softirq+0x1f8/0x290 softirqs last disabled at (65757): [] irq_exit+0x9c/0xd0 This patch adds the annotations to do_debug_exception(), while trying not to call trace_hardirqs_off() if el1_dbg() interrupted a task that already had irqs disabled. Signed-off-by: James Morse Signed-off-by: Will Deacon (cherry picked from commit 6afedcd23cfd7ac56c011069e4a8db37b46e4623) Signed-off-by: Arnd Bergmann --- arch/arm64/mm/fault.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) -- 2.20.0 diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c index be7f8416809f..04c4b88706d8 100644 --- a/arch/arm64/mm/fault.c +++ b/arch/arm64/mm/fault.c @@ -595,20 +595,33 @@ asmlinkage int __exception do_debug_exception(unsigned long addr, { const struct fault_info *inf = debug_fault_info + DBG_ESR_EVT(esr); struct siginfo info; + int rv; - if (!inf->fn(addr, esr, regs)) - return 1; + /* + * Tell lockdep we disabled irqs in entry.S. Do nothing if they were + * already disabled to preserve the last enabled/disabled addresses. + */ + if (interrupts_enabled(regs)) + trace_hardirqs_off(); - pr_alert("Unhandled debug exception: %s (0x%08x) at 0x%016lx\n", - inf->name, esr, addr); + if (!inf->fn(addr, esr, regs)) { + rv = 1; + } else { + pr_alert("Unhandled debug exception: %s (0x%08x) at 0x%016lx\n", + inf->name, esr, addr); + + info.si_signo = inf->sig; + info.si_errno = 0; + info.si_code = inf->code; + info.si_addr = (void __user *)addr; + arm64_notify_die("", regs, &info, 0); + rv = 0; + } - info.si_signo = inf->sig; - info.si_errno = 0; - info.si_code = inf->code; - info.si_addr = (void __user *)addr; - arm64_notify_die("", regs, &info, 0); + if (interrupts_enabled(regs)) + trace_hardirqs_on(); - return 0; + return rv; } #ifdef CONFIG_ARM64_PAN From patchwork Fri Mar 22 15:44:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160928 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp961902jan; Fri, 22 Mar 2019 08:47:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqy1CTgZIw/DXTG4Y8tUwQO2TyBxEGOU821h0ROzeUTSGmsilIHmG+m3DAdm9rOVSf0tojyZ X-Received: by 2002:a17:902:290b:: with SMTP id g11mr10228759plb.269.1553269662998; Fri, 22 Mar 2019 08:47:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553269662; cv=none; d=google.com; s=arc-20160816; b=V8GIHveFccea4pc7yjrVvXI/v96rbyTEyserpuYtINEfG4rIKBqHrHENKA2ovrkHce Yx4DEJOhFuT0BLyABtxzGKhJgn4SSufVM0PRikygiOR99eXLGwdNCbWtDpKOM6bIwhlZ 417k3GPvbmKlNejJQNDpWd5pA1CZcTqSTe2pqcqwHk86JqfCzulolfB2jYusyI473XuF 7pIWtzXVXMmBSqg+yW1HkukRXNMFjID0T0/ezwNDpmC4lO45kddkxnq3Mmo1KJcJYsIX kWKRzgdW0yokq8vZKYSwdXuTzA5l+XlTjA/IkRPjaYKDLnz07VFNSgi9YMx+i+uYtpGW 8ULg== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=IhDNwIOxYiNuMhOLPEts3SuSbShNhJqvzKkXI4ciqCQ=; b=0stdIi8yZPF4XSYqchTnFPP4Pecq6AlZByUACcL67A0b6jfYG6GH9s6V/cWsOGb+Ns SIqtCKhDkd+HWRSCi/sDrrOPH4gYIXgrFOLuKR38LEUw0wrsvSv5tLFG83LuzhSpJeZB vYSnDj4mBfejPRPJMWsTppjqQmcEZdFT6y0M1Smh/O3Elfyneu/PWnf98EKhMU7E0xse uoV/SrrRBIqyGHqgv+cRX6qtetG1DCbKAH9rDDOx2rl9ulYnBOTGYN2XLd2AQ27hh7Ir AtHh7jKekTeT36/kgcKoYm/Woap7zi4cZG8+hap3r/jky6cO+M8QxV9CRpPK5A5PV5UV aggg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 e18si6856099pfn.164.2019.03.22.08.47.42; Fri, 22 Mar 2019 08:47:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727244AbfCVPrm (ORCPT + 14 others); Fri, 22 Mar 2019 11:47:42 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:56459 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725981AbfCVPrl (ORCPT ); Fri, 22 Mar 2019 11:47:41 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1MPosX-1hKuvq2lZj-00Mtqj; Fri, 22 Mar 2019 16:47:13 +0100 From: Arnd Bergmann To: stable@vger.kernel.org, Andrew Morton , "Kirill A. Shutemov" , Mike Kravetz , =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= , Naoya Horiguchi , Mike Rapoport , Andrey Ryabinin , Kirill Tkhai , Christian Borntraeger , Hugh Dickins Cc: Konstantin Khlebnikov , Vasily Averin , Vlastimil Babka , Linus Torvalds , Arnd Bergmann , Matthew Wilcox , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [BACKPORT 4.4.y 12/25] mm/rmap: replace BUG_ON(anon_vma->degree) with VM_WARN_ON Date: Fri, 22 Mar 2019 16:44:03 +0100 Message-Id: <20190322154425.3852517-13-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190322154425.3852517-1-arnd@arndb.de> References: <20190322154425.3852517-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:x9JLVby8r9r7TUxGTqLadFU79q0Pp1coCzkDeRV4r6c3+Dj8drW w3wZyzmVLkCOYTZj7d1rl88zJZduSJcyDx7T15j+BD/3ifn1JSCjet7XYnM20CaSy6N1FqD 7oLYAODBmF5j39idn1uZOpAtb5Pka75NOa5OilzhmcKHyWFj6CykM7EbL/824ma//x/PSon oX+qL1Ko/GgJFwkbg64yQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:Tc+wj3NMZgw=:RU5Wsg8S3mds99gc6a+cXf 24zk4q6XyhTdtuLlc4ogImJLY4QiG24v/yy09Tl/6LHmXdSKfSSz0YHGE29MfuqrdWegfJOkP HARXOKftZgpOMl+c9zVYH0PEzaM8Tif2m3cTj4zkvf1Y2f8q2ma3eHQ+po2nSuoicrIhb9EJS lp2Pe4Ws18R1OVojCdmuEoK4o8x/lOCAkOF4stpcg4PpCzti1AzmQ0ZB5dEcPdRAAhN19JqBv 2qmULxrOYCuIWVcX5tLf5DMlamm5q1llRTPHC2dZkj1fL42dCF8D+NegqIH4gMhOZdqy3dW1l KfFLyp6JOnY9vbztmz3bqyshvyqyogXFd8yivOCzuTmQkItbHHziDVXUR72l0yepI5FAHT4wE clQHva8klOUopNyxz6rK45XmcYuZXe3BgbEfyVqT8H0F1z+0upYceQcNDsgGo/Pnk0L88JPj/ Q2M3FiuLkzN2pXg9ZshcAprVQytMU19AeN8vxAbJ0rbeESp42ZovYrdku5j+ozGN2tMGaGUXY FOdw5kl+ItdZaAy1Bn1RgeiSc0nKsNTkaxQaYJyyOFfjJnJDqun+X2FYIxzQBKspWyKBjRYZn qLA9ma6JXewR4OR+icxH2Dbq/A78inl8+s0rTxu7gP20oapeMz6R5ZkijTrjybWV8mDLCjzUL EBDekinZo6eUHBS6RGHjAtXh0h5mDJ6BaWPIBuiDTr2iAAMkUf3mcAXwwLWLggKUf5zWJzuFQ BEzDhhnnoHNiCvGc7jkiDMBXH3aSJW+lLtm8aA== Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Konstantin Khlebnikov This check effectively catches anon vma hierarchy inconsistence and some vma corruptions. It was effective for catching corner cases in anon vma reusing logic. For now this code seems stable so check could be hidden under CONFIG_DEBUG_VM and replaced with WARN because it's not so fatal. Signed-off-by: Konstantin Khlebnikov Suggested-by: Vasily Averin Acked-by: Vlastimil Babka Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds (cherry picked from commit e4c5800a3991f0c6a766983535dfc10d51802cf6) Signed-off-by: Arnd Bergmann --- mm/rmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.0 diff --git a/mm/rmap.c b/mm/rmap.c index 488dda209431..cf733fab230f 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -408,7 +408,7 @@ void unlink_anon_vmas(struct vm_area_struct *vma) list_for_each_entry_safe(avc, next, &vma->anon_vma_chain, same_vma) { struct anon_vma *anon_vma = avc->anon_vma; - BUG_ON(anon_vma->degree); + VM_WARN_ON(anon_vma->degree); put_anon_vma(anon_vma); list_del(&avc->same_vma); From patchwork Fri Mar 22 15:44:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160929 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp962054jan; Fri, 22 Mar 2019 08:47:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqynzNO4HfNWK9VGro1LPQa47UsM3H8exRi25QaAsNxMSV5yE/dAKXWYJ34CzCauZH7Vqv97 X-Received: by 2002:a17:902:e113:: with SMTP id cc19mr10540207plb.179.1553269673214; Fri, 22 Mar 2019 08:47:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553269673; cv=none; d=google.com; s=arc-20160816; b=EtypxMc1H+mxdG5Q6gKFDc/fGT/az8qmyZdMUn36QALkvcaLVdwgg8mtCMXgdjV7ez 5fGmcm5zIkFkXLP4VGXaLzso2fXMhrfPuxXag6qFsO/gT9LpuBtVk8sGh+2a9uYy+qhr hI9JIRGWh1lygE0fPkA8z8eMvN0HyyQrJiM/8m15H+3AJ8awWSu6s8JIi2jwgtu0x3fy Xz23oLVUYbe+syBFQTd66k8V9dIpyjYRmtNJ4S1LHTm8l9gGpnyPivebKHmAZJ4wGtjq Sgpr61MKqug2eBk0VT08ZdaPWeRPyR94QFnMgvIZYuLrjdeS0LdtHwWzcHDl9ohmUobq 2HhQ== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=n3gm47iQrRnfMZaFz/RppgS8DX70VH/pJUoRLU2/GXM=; b=nAHBG6t6PYQ2fDA0UbBUquvyewR3IvOgyxoNWRJ7wSUIXJjZzvXa5yBo8e7o8nuf/j YSKCkn9FeKBzxAC4l/RIZiKvGN18Y4g9g+InPi5CRjYjkunff6u2rFUdabWqJQX7vIq+ bDATX7n4p3zUR+Axba3lhZPe5szY4W1ahdQgG9o5AC5LU3jJ4s0pY4mGpVSS8C27D0bn QYc82zqGG/jCVEmsqK7rPFa7QGlf9hOFjMUJrOt4+lcVhtFvdHTkRNERA5xLjd5XPLsi KkGavEf3nMELYmjV3UoTl95ZFsnwMwmYLcndUv6vGthfC28Vy9h5GJMDcXRRG9FIVhBr vqTw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 a4si6745015pgq.471.2019.03.22.08.47.52; Fri, 22 Mar 2019 08:47:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727565AbfCVPrw (ORCPT + 14 others); Fri, 22 Mar 2019 11:47:52 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:47809 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727509AbfCVPrw (ORCPT ); Fri, 22 Mar 2019 11:47:52 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1MjjKf-1gjc5b16ZX-00lE5J; Fri, 22 Mar 2019 16:47:44 +0100 From: Arnd Bergmann To: stable@vger.kernel.org, Felipe Balbi , Greg Kroah-Hartman , =?utf-8?q?Micha=C5=82_Mir?= =?utf-8?b?b3PFgmF3?= Cc: Baolin Wang , Felipe Balbi , Arnd Bergmann , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [BACKPORT 4.4.y 16/25] usb: gadget: Add the gserial port checking in gs_start_tx() Date: Fri, 22 Mar 2019 16:44:07 +0100 Message-Id: <20190322154425.3852517-17-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190322154425.3852517-1-arnd@arndb.de> References: <20190322154425.3852517-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:Gosm4FGMsO5444Yg2Rf0+LQ/wGhky3Ep9nyBnNCh3iX2HcC7Jqm QRhr2Wo5HVbg+g+U9ybx4brDFsuOPqV7XrvydvCQnY4KLVEkg7chK9/opsptLw/KnBaK7dT 6Ws8K+2CsaWRWoF8ewFtCYh2/J7Tv6abQ5bCXh8/7zQdFfZ1DtMb9E6UD6ccANR3CXSelrD 05HW0XW+xnWmFMNdqqfMQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:sMKRZ0XQZVQ=:m7r/UvufhblTmUzBYkZa5q p4hpUgO2sRWcQOukcKg1UBbA2a+XFUqXPmjT907LUZO9rvBGleAUvIiWLuWNku+4oOmiAvrx+ Z6FPAmd6D/ctYxYRwXN9azzPSqdW4RrehZxWqlrQduuSSacQbIsSZ1N4AYoyNyJzQYwC6BmQ/ nRJGbdnjoHkec07CiGgZE+6quYmo9y8ccATf54sJTC9r1c1nAliTkEuH0mT4yfZ4UXxjWXjgC TUxQaS85HwprcBwB44xlGNMV9aXMJAedeL1LcPu7giVCooKl2g+nfMKRopj2FyLz7wfmDqzKV Ca8IRLmbHpwhdi8tZP5B4XCYiq1tsbqO88RDbKZfWwo+YuBE35reFZjWZOZkTp5WBcKudH3dC 49sRlU6jVz7hHoqZpBBwFA/7gQ8SYSytHfK8NsDd7XGWCIDhFBM5P5vP2eFhVjoTmzNFR3nS2 fVSYqZUPEAHu3Bl6eB+kD/rTjbNwnHL7MsITEe+5nwiNdMHcUJlXEbfjKiE82TVajMjcue5ty nHwawyh8mHiuyXeXhy43p9lbphOK+oKNHrdbQCFki3meHMdldT+cPIYR6DQTwncAr/mBr/00w QWKQnazP6vBd9EI7zjUInvBQtZ2i6JcYznstgP0Ek7n80nidh8V08N+l/2bkpNTiRdrsmQX9r 6W3UO6Eag30fipuj+mDBp1apgRYQshK22Bcz3U4j3wUMcAkCMR0kKaeGg0EH3DiiYdUwTX2At QQiRhmmFr20T5i6fb5s9N8zMq6yOksSjaC6iRw== Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Baolin Wang When usb gadget is set gadget serial function, it will be crash in below situation. It will clean the 'port->port_usb' pointer in gserial_disconnect() function when usb link is inactive, but it will release lock for disabling the endpoints in this function. Druing the lock release period, it maybe complete one request to issue gs_write_complete()--->gs_start_tx() function, but the 'port->port_usb' pointer had been set NULL, thus it will be crash in gs_start_tx() function. This patch adds the 'port->port_usb' pointer checking in gs_start_tx() function to avoid this situation. Signed-off-by: Baolin Wang Signed-off-by: Felipe Balbi (cherry picked from commit 511a36d2f357724312bb3776d2f6eed3890928b2) Signed-off-by: Arnd Bergmann --- drivers/usb/gadget/function/u_serial.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) -- 2.20.0 diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c index 4ea44f7122ee..d73618475664 100644 --- a/drivers/usb/gadget/function/u_serial.c +++ b/drivers/usb/gadget/function/u_serial.c @@ -361,10 +361,15 @@ __acquires(&port->port_lock) */ { struct list_head *pool = &port->write_pool; - struct usb_ep *in = port->port_usb->in; + struct usb_ep *in; int status = 0; bool do_tty_wake = false; + if (!port->port_usb) + return status; + + in = port->port_usb->in; + while (!port->write_busy && !list_empty(pool)) { struct usb_request *req; int len; From patchwork Fri Mar 22 15:44:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160933 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp962701jan; Fri, 22 Mar 2019 08:48:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqyXgAxKfBW1Ax7nDYki2FjlLeMT/q0tNbVIX4Qx6Lu5Y4MRQfBGt0WTZu+qfe1nhSginhQ1 X-Received: by 2002:a63:c24d:: with SMTP id l13mr9808831pgg.166.1553269716348; Fri, 22 Mar 2019 08:48:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553269716; cv=none; d=google.com; s=arc-20160816; b=X9/RZTK5OC4QoGCE3GnUx4n7Go86B55MwRVCE5hKWsD6V+Fq2XT8zDkn0xFwVXSuUq XNWrOnk50VHaRdcrguPmFlMUa7IVFodDLB5bM29Ggs90VvpM3RDSC3ZBhoNDIsleoK4W jtvEqICGeY7BSjVJQh1Xc1/M3PvBqfTKiSpNYP4SBmIDpARhn/RWM0co/9j67OUh5hJn P2r5O790+9MGGB9NWxjUJdTmH5MpgmxNt3S2IRPXEPuYrWxAf7hJzsQvy2afQhxGylSd 5e/szbfpKOnC0fE2iYL8RVJ93lZy+bioYnwdqW/ED8bDbyFWzhRM1awCjBWm0oyABLDU 0Amg== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=FAq0nVQ8q0+wTxj0ZBkpUddOhSp8RqE0MHpeq3Jd3RU=; b=oUt0VUfd/GnD5dLL2CAIm+8WgtLQKlEj+i+u6g66px2ReDu9YWE2MHo+CPQFZ3cTSa TrWHr7xVtPLi9jVPjf47VqpX+SacWA9Z0fdKlRAxw78C0B/XbzMjYt1BqdArKVIi9aiO XZK+dEUbFkU4r5WTNP+o3V23ZoiB8BVtJ2JyCvz9u+iqN/mjTH9l/aapmAfIz/S0hq94 dozcdBrdRXOQgMZOl0JQ8cksbBZIGdxmRevN8W0+v6oIfeTSAKS+NWmFZzAFls560mLv HwnqjkufBU03SqSlgNelaiBpdLV61yd4Kp3RuTxD5EA3tVWk6x6kJFO0Ys1/d35Ad5uo vILg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 h6si6761586pfc.255.2019.03.22.08.48.35; Fri, 22 Mar 2019 08:48:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727698AbfCVPsf (ORCPT + 14 others); Fri, 22 Mar 2019 11:48:35 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:49005 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727169AbfCVPsf (ORCPT ); Fri, 22 Mar 2019 11:48:35 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1My3Ef-1gmy8v2Jdn-00zXSP; Fri, 22 Mar 2019 16:48:22 +0100 From: Arnd Bergmann To: stable@vger.kernel.org, "David S. Miller" , Gerrit Renker , Eric Dumazet , Alexey Kuznetsov , Hideaki YOSHIFUJI Cc: Neal Cardwell , Yuchung Cheng , Arnd Bergmann , Wei Wang , Ilya Lesokhin , Priyaranjan Jha , Soheil Hassas Yeganeh , Yafang Shao , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, dccp@vger.kernel.org Subject: [BACKPORT 4.4.y 18/25] tcp/dccp: drop SYN packets if accept queue is full Date: Fri, 22 Mar 2019 16:44:09 +0100 Message-Id: <20190322154425.3852517-19-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190322154425.3852517-1-arnd@arndb.de> References: <20190322154425.3852517-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:Clx4QEa8CHf+79ocuFelFxKkv6ZBgct37aKzyZa4h5hcFxZpErA /p4ee3N9oMC9s1WB5dkF17idBT8GVTpwUvpAiwx8aIrpmLwva6sPD27mZyXnodecqODNk5E Q4EZLmiU3X3NAVN1wSql3DT+BF5rHpyWf1vLPm25IIRUMHbuPT2EyY6/wB72eVDuhSzY+zk FCabVacbKEB1rKsKy3vhQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:TD8UNPVaM9A=:tW9VtVmKapwwbgz00NKdcD Tc1KlNsEVKs1or3vGyC6ojkMhDDQdmeb4VS2SUchIy7kYgPP9pSsIHOAVLGQPJtAKmwfeDEvL XzN64Ldt1Ue017tQTzZ/Ar8SD6Bw50LN0gQhJcp66YITEgeuEtpoezlvboB70RU6U0+YjfWfP QDASPhGe5HBWUXWRZFPhWc6s7UIflTIpE33mq02fiSf8C9V2mPtDO1sjGwYHKWoDzx2eBrzsj fxXb+DVT/6XDFVf3xk81UndsTrwtrC1ClyBn85p3kxcSh+eq2dS/zJaX49EKi3lrJRZZeNh2F hCII1onB2qz6EbJIyODq2i7PKWhLkWhgeq+ki9t+Y1Lyrqsh2g2xjExobZiUR1VKvfF0rWp2k 2A966d4p1esXGqX2McyoqQrPTWgUJM2KYL9xLu4exnNVoJC1rJoOiUVtLffdU2L2EYJh5BIGj uDUd6/Ewep9nr3EOTuCPc45NSlbqjgWAUm6vvD8fvqWKpQZ/LuEiuqOJ89dOp0Mt5jEqmoSKY 4K4KdpkSLvEXnKsrovOotELyU6cVifBSayo9Z2ytiJWUUnjSdriZ2FTfNCGSYdu6fpA54H0ke Pnb6zuOlZI6+81EUkxMSv6mOZoczN/ZzALhh6VYe93xgJV6R/eAQ3fgr6eGngi6NzYpdgo65k b8DZ00XpLdg2krjngqNtexxgKTQoIEAUcDKp/DolbXVHQP8GBTs75ssXXsbML9uZsFqWIoCuz JF0L6Ecuj+kOQmha+hO2CSl4/8LARB/fbU2KAA== Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Eric Dumazet Per listen(fd, backlog) rules, there is really no point accepting a SYN, sending a SYNACK, and dropping the following ACK packet if accept queue is full, because application is not draining accept queue fast enough. This behavior is fooling TCP clients that believe they established a flow, while there is nothing at server side. They might then send about 10 MSS (if using IW10) that will be dropped anyway while server is under stress. Signed-off-by: Eric Dumazet Acked-by: Neal Cardwell Acked-by: Yuchung Cheng Signed-off-by: David S. Miller (cherry picked from commit 5ea8ea2cb7f1d0db15762c9b0bb9e7330425a071) Signed-off-by: Arnd Bergmann --- include/net/inet_connection_sock.h | 5 ----- net/dccp/ipv4.c | 8 +------- net/dccp/ipv6.c | 2 +- net/ipv4/tcp_input.c | 8 +------- 4 files changed, 3 insertions(+), 20 deletions(-) -- 2.20.0 diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h index 49dcad4fe99e..72599bbc8255 100644 --- a/include/net/inet_connection_sock.h +++ b/include/net/inet_connection_sock.h @@ -289,11 +289,6 @@ static inline int inet_csk_reqsk_queue_len(const struct sock *sk) return reqsk_queue_len(&inet_csk(sk)->icsk_accept_queue); } -static inline int inet_csk_reqsk_queue_young(const struct sock *sk) -{ - return reqsk_queue_len_young(&inet_csk(sk)->icsk_accept_queue); -} - static inline int inet_csk_reqsk_queue_is_full(const struct sock *sk) { return inet_csk_reqsk_queue_len(sk) >= sk->sk_max_ack_backlog; diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index 45fd82e61e79..b0a577a79a6a 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c @@ -592,13 +592,7 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb) if (inet_csk_reqsk_queue_is_full(sk)) goto drop; - /* - * Accept backlog is full. If we have already queued enough - * of warm entries in syn queue, drop request. It is better than - * clogging syn queue with openreqs with exponentially increasing - * timeout. - */ - if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1) + if (sk_acceptq_is_full(sk)) goto drop; req = inet_reqsk_alloc(&dccp_request_sock_ops, sk, true); diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index 0bf41faeffc4..18bb2a42f0d1 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c @@ -324,7 +324,7 @@ static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb) if (inet_csk_reqsk_queue_is_full(sk)) goto drop; - if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1) + if (sk_acceptq_is_full(sk)) goto drop; req = inet_reqsk_alloc(&dccp6_request_sock_ops, sk, true); diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 1aff93d76f24..b320fa9f834a 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -6305,13 +6305,7 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops, goto drop; } - - /* Accept backlog is full. If we have already queued enough - * of warm entries in syn queue, drop request. It is better than - * clogging syn queue with openreqs with exponentially increasing - * timeout. - */ - if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1) { + if (sk_acceptq_is_full(sk)) { NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENOVERFLOWS); goto drop; } From patchwork Fri Mar 22 15:44:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160934 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp962945jan; Fri, 22 Mar 2019 08:48:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqyL3fIqlEmZtgPr3YdteaiTg7DD4r+BzLIqKquQQQW3XlZbIB+lC5ztE9H7dD08k4c1vUUN X-Received: by 2002:a65:43cc:: with SMTP id n12mr9200448pgp.218.1553269733447; Fri, 22 Mar 2019 08:48:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553269733; cv=none; d=google.com; s=arc-20160816; b=lgFviJiXKEV6wPnAaNR6KeMvdCOJ0KazxRbVgL1xzqFlgnTt19hNCmBZYMhktLeZ3h JUoDIzIJkIRJQXlhVX8rk2J7TOUxXuRIMgH7VOzsIGG97RvWXR6hkivy00sugmj8js56 /ASQpTvc/oKxgefWRTaRoD22GYi2MDp5lUT4p95d/vllmnHo9oyrtvgJFqwEQSi11Ebz xZKBu1vEf3v0KyUzqO+wr2yR+AmOptBsT5FfcTxfR0wZS8MPLF/Y8kAKFqvv87FIXfcv UydCGGeyexocUnmZwCmuKDJJS44LwdgH7Xh1K677wFI8oYb3TlHBsV1Dexf/1+d1mS21 pieg== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=4noY7Nuh+s/BSSVZ6VR1norKp9+TOV1te+aPfu/ertM=; b=SHWb1IKcPSSdTjw82PsU4bM+pfglEXEuDSMFkSfnvJRvwadsiBpCz72iYjMzgzje11 oTCQE9gBts42XzjU3ssCEcYtTCxGvUqUwMbh5L4O75Bg+0I2cIGhTluTZVP9uTm1CZtP Zh48IlYBJtzAyZi4kD+5qFoBXDd4i+vfWo/yVSi/pYIIRN5tseHU0k+1+T9WHvQyAkW1 65aJ13BJOKWZdeZwVD150uGZL/Fo95/J/z2fOKpxIbMSOji1wgEJ/VjNSCCTKzIXxaMl J7g6qz005qPQPaNf8mR4d94iSSEJtxgXCaxU8ut5nZRXHU9JkBbE0sGaLwfOqLY8B9Jn 3knw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 o12si7627094plg.221.2019.03.22.08.48.53; Fri, 22 Mar 2019 08:48:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727419AbfCVPsw (ORCPT + 14 others); Fri, 22 Mar 2019 11:48:52 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:47103 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727169AbfCVPsw (ORCPT ); Fri, 22 Mar 2019 11:48:52 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1MEFrX-1hEp4Q01fp-00AE6h; Fri, 22 Mar 2019 16:48:43 +0100 From: Arnd Bergmann To: stable@vger.kernel.org, Alexander Viro Cc: Al Viro , Arnd Bergmann , Andrew Morton , Roman Gushchin , Waiman Long , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [BACKPORT 4.4.y 20/25] Hang/soft lockup in d_invalidate with simultaneous calls Date: Fri, 22 Mar 2019 16:44:11 +0100 Message-Id: <20190322154425.3852517-21-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190322154425.3852517-1-arnd@arndb.de> References: <20190322154425.3852517-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:d0xlr2K8dEQfJy6mi20uQzl6SrNBL/1a9vz7njWi1W20fXOfw8f GUHCunn54toqlYpKmZF+xbWn2Rb9zfUlYnlvnOB6DM75R1rrzn49oKK/1le/DiOhxaG68zZ qvZOJYAKt4IEkGuvLhENosiVKKpcdULM6Io5PU6pI9Pgeqsdrp1BNMYlb9xlAWy/sXB9cQN bs/inoqlhqiJHdsk1qCPg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:Yq39bHp/YZE=:q+MAwvTwnQSOcoeRAF3q98 PsCIkmtdtFzFVcYkMwg76R7g9q4iuuug4uyDc8N3DTb2T3aPQM9lIsqnJV6DUqjsndCtR5YIT s+PxkL7nYvGQz1e4rgK59SZhrp5z33buPElBD45WbcTKcHM0FbAQSHdpQH202QlQpnONMivfi nr0vmG5hXFPQWsF5iy5h5/waGxiSM6Fxh9s+Xq4Q5RLeXrPrw5MVtaD0qD1/OU7R8mF4eDYdC ySxb+U8dQINIudpPLnbKLtNRuC1lGmVwubX30YxG/zgL0XJhDnve/XWcQfsj9Cqp6tmvEIzKP 6u4n7S28KBir1yAg85+mOE113RuQByb1ecNPO01S4DqOmXpkx3sgAd7whrYD0ubqwLStuG0P9 jKpeZHfr3oM3XBhQLinp26vKLhea+jhStVF/cwLtFXU+XCBIJFLLdZp2RgtNcRdXxb5jlAFs3 JjXsN2gjmG5tXnAXDrmHnXlpixnCCCiSov5F15Hitb7dr+IU816dSUo0+jLev4sgxv2Z5OPcv PRB5VLoPAmkizgHDU+hOk62M1X66Kc9HF3gucww1Rm5VdhtnwpBpP4W/yvExKulmiDgpL7FKP tR2zNFYpY48USqkhOsFeqa0FRnyftBNqJ/pyIRBgrqqgc95pvYJkssj2/Zguj2tfghaqlZys+ 9WSl7XZBUOrkFulcuYKNO1VegmmSPXQZR7g/DHByq5jSgDKBBe8z2PepYZ17ukoNnMWFxww47 +Ug19tpB1N+oQn7AIZn6JbNDH2hYRrb0rh9mlQ== Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Al Viro It's not hard to trigger a bunch of d_invalidate() on the same dentry in parallel. They end up fighting each other - any dentry picked for removal by one will be skipped by the rest and we'll go for the next iteration through the entire subtree, even if everything is being skipped. Morevoer, we immediately go back to scanning the subtree. The only thing we really need is to dissolve all mounts in the subtree and as soon as we've nothing left to do, we can just unhash the dentry and bugger off. Signed-off-by: Al Viro (cherry picked from commit 81be24d263dbeddaba35827036d6f6787a59c2c3) Signed-off-by: Arnd Bergmann --- fs/dcache.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) -- 2.20.0 diff --git a/fs/dcache.c b/fs/dcache.c index 9ffe60702299..cb554e406545 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -1510,7 +1510,7 @@ static void check_and_drop(void *_data) { struct detach_data *data = _data; - if (!data->mountpoint && !data->select.found) + if (!data->mountpoint && list_empty(&data->select.dispose)) __d_drop(data->select.start); } @@ -1552,17 +1552,15 @@ void d_invalidate(struct dentry *dentry) d_walk(dentry, &data, detach_and_collect, check_and_drop); - if (data.select.found) + if (!list_empty(&data.select.dispose)) shrink_dentry_list(&data.select.dispose); + else if (!data.mountpoint) + return; if (data.mountpoint) { detach_mounts(data.mountpoint); dput(data.mountpoint); } - - if (!data.mountpoint && !data.select.found) - break; - cond_resched(); } } From patchwork Fri Mar 22 15:44:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160937 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp963991jan; Fri, 22 Mar 2019 08:50:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqzkd/r2epjsuJguAYd+SXGcSJhRouuwuISNW04/UZ8gITpZv2MXFG/nCl4Xb4TrW4jgSWUu X-Received: by 2002:a63:2f44:: with SMTP id v65mr9470941pgv.141.1553269805069; Fri, 22 Mar 2019 08:50:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553269805; cv=none; d=google.com; s=arc-20160816; b=MuOYRjipc9BavrpU2gYSyKl0ttaUV2YvwIk5cvqBKcqNDOEyFLYB3y7mLIdw9ePoel 73dgq0xnI+tWjOgadJPk2QyIu/KZ0florue3wxrNbpJCyBFYydaS8xeylsKgO1vM5/xb Z+4XIpg+VDqZxl8xE5Tt1MnQHzHAAf5SZu11e4uhCY3cga3RYgzWQs1h26VH5I2JMK+X cGeOpwijuJfv7qKHGo438V48IT+1Iy3xGQF1zr34MLYELzcrAm0FX5ujRvdhUvavMv4K s1gryBKY3ewCj5Hgs0c+bzR/4wjdX3GLBvkJNa8C8NncPSQjvmzXAqXqlaptKjLBNiS3 vIaA== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=7HUvG/+LTNj6cdPLIDP9MMQ1DHLLueeDq7hAsHigG/E=; b=G7Hhpe8HqbANBKK8ECtVQ7AXRBXUYhr0+ANW5Xuur9zX+0Xe00slDi/eLSmJARZ9DQ sC//3loeebZxWl/GJXmaPghQHThUETD44B7AlYjrOEsllUIPnMZx6jHzdfJIeITYWAVL wMKIjggzseFX1U/FNhlokUQS+r3OHaoX1Y/B7J2caVlMp+XSjhJti8Wkt2ZcoywaO+Hq LdsFVOG52wyUgjFc7DZqXb4Cl6hrJY4Xjv9gP9nLMoS2r2fg2m+UInHAxmPMIcD0ZMYi jkwsIQXYMQtjdNKls0EiZUspdLddOAf5BF/65pTByHJnMCHrF6s+aILuQ1trj8Ph7c0c OAWg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 e65si6726403pgc.339.2019.03.22.08.50.04; Fri, 22 Mar 2019 08:50:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727814AbfCVPuE (ORCPT + 14 others); Fri, 22 Mar 2019 11:50:04 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:47715 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725981AbfCVPuE (ORCPT ); Fri, 22 Mar 2019 11:50:04 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1Mhl8Y-1gTv0W3b4S-00djqU; Fri, 22 Mar 2019 16:49:32 +0100 From: Arnd Bergmann To: stable@vger.kernel.org, Greg Kroah-Hartman , "Gustavo A. R. Silva" , Kees Cook Cc: Yoshihiro Shimoda , Felipe Balbi , Arnd Bergmann , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [BACKPORT 4.4.y 22/25] usb: renesas_usbhs: gadget: fix unused-but-set-variable warning Date: Fri, 22 Mar 2019 16:44:13 +0100 Message-Id: <20190322154425.3852517-23-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190322154425.3852517-1-arnd@arndb.de> References: <20190322154425.3852517-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:1zbLgMJ6UdcfbbLrnAhs0F7V3us4vKTcxOwFmyGU0N/10ybZgRE ED53FIXpRAfBiH0ccO5Eu4NWKKW1FG1fcV7qbnsKjkz3rEKK8To833eGkRCIDJ8il+83nKz WeOJIqYfc2n8dB+r24eOPo5mRlXJYKm28MkAL7vF2nI8+H0pFsvuirU5DGCXnsxPoFHlAuD 6xYM7LU5e5oap8/2dt7rg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:Yla2KSO6I3c=:Kh9bpEPu/6xf11vu+oSgdr n+vvitCcc4b1sUH8dDiQNX70t3EzOwA/0QK0qvzdK6Y+qZbPSq/rLUnFnqgKNrUzXokYEjgmV gPBv+yliIQq8ds2TePkdEl9Pmz5eOOiq8N93FUuEvlQbsRn9Y79Z23krIrervGjHBHyv0Lukb cqQ8zQiE1ojm7ev7Jr4jd8AndKEcBAmsBGrBR35byduKUlVVXoU2/iWCIasUuwuSsIA5Xtx6+ kvb5RbfbPE8WJYwBjbmmNmk7Rrwqr+ynGFVbLX9nwW0hw6N5AkwBahu1FUbJ/M0oZ4pnPn2rM 1EjETdjtSiBMFaguUF8WxAuX1U76TfNfzvIbjT06eqKS2hLBlUxsYP4zuPRTCNUjyt9FjucXO mXwWr/bp5SIhM101OdP3j5fpR2snI0fNGYBK+CY8mteaun0QZ6V+R/1skH5woPFVNR4IgGh9I qQHfPzP8iPdXxy0Li8ympIWfbspwedhNmpo0uM7pshOCQk1yxrLgl3HPmHPSdSuISJxZjWsZ2 Xe5guXDv+k4u4ENNqKMLqrM+LpoB0q9/nTdskdsBY5cvTDDzDs9rejocQirvUl/IV+HMrGW6r 6DMe+zTngq+JVRIv9r19wzJ/LeLt54Vx2W82WpX+soJ28BgDrrxFcs86zGJyZ2Eth7SjGrqBP 0gcJTC5hatKT6F88rL5ECfoKoOGMIy9erdCKFuKRiFB+8o7HXBUZQPvO3mu4Tjobc/28pHp65 JvgamV00R9JFwb3XR3ntwc8cithK/9ZLLFjKsw== Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Yoshihiro Shimoda The commit b8b9c974afee ("usb: renesas_usbhs: gadget: disable all eps when the driver stops") causes the unused-but-set-variable warning. But, if the usbhsg_ep_disable() will return non-zero value, udc/core.c doesn't clear the ep->enabled flag. So, this driver should not return non-zero value, if the pipe is zero because this means the pipe is already disabled. Otherwise, the ep->enabled flag is never cleared when the usbhsg_ep_disable() is called by the renesas_usbhs driver first. Fixes: b8b9c974afee ("usb: renesas_usbhs: gadget: disable all eps when the driver stops") Fixes: 11432050f070 ("usb: renesas_usbhs: gadget: fix NULL pointer dereference in ep_disable()") Signed-off-by: Yoshihiro Shimoda Signed-off-by: Felipe Balbi (cherry picked from commit b7d44c36a6f6d956e1539e0dd42f98b26e5a4684) Signed-off-by: Arnd Bergmann --- drivers/usb/renesas_usbhs/mod_gadget.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) -- 2.20.0 diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c index 8647d2c2a8c4..c5553028e616 100644 --- a/drivers/usb/renesas_usbhs/mod_gadget.c +++ b/drivers/usb/renesas_usbhs/mod_gadget.c @@ -641,14 +641,11 @@ static int usbhsg_ep_disable(struct usb_ep *ep) struct usbhsg_uep *uep = usbhsg_ep_to_uep(ep); struct usbhs_pipe *pipe; unsigned long flags; - int ret = 0; spin_lock_irqsave(&uep->lock, flags); pipe = usbhsg_uep_to_pipe(uep); - if (!pipe) { - ret = -EINVAL; + if (!pipe) goto out; - } usbhsg_pipe_disable(uep); usbhs_pipe_free(pipe); From patchwork Fri Mar 22 15:44:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160940 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp964448jan; Fri, 22 Mar 2019 08:50:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqz+xtDrrAwd7wNIrgZgu6AZfR2LuXEDE7KOL3jdZ46me//iSZHeMs79Wx1ZRtR7m4X5bifd X-Received: by 2002:a63:fd10:: with SMTP id d16mr9476112pgh.306.1553269833625; Fri, 22 Mar 2019 08:50:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553269833; cv=none; d=google.com; s=arc-20160816; b=MrCa1ZBj6Sf/xZRi0jdOCCncak8qyjbVyaP/eeGjer3bCdzdiyh29xK8sH8Yzy3eup Qlp9yxd3fWQhw7k45meK0iKCAXWerZfhQfm7UFbCPYpMMrxlJ4Q7+e0xXbhEsd54Ac5k LeAmCnFahtbHe2Fs+lCzuw8CsBnP01rhVQa2rkmK9WDoOkdqWiwjiPqELWnndFaj5QvQ 35KkrUPOY5pUJSSujQD/SBtP85cLdcqwLs7qbQ+vQaBHVCWlGS+/tZfQWsZqdG/tszPy 9C4xXGk2mNSFXoEmv7SxzkUQ4sQGrHHrwIdLgUYV64QqArWB/8uhlBswXUFHKN3DoogO cQoA== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=o0O2AbXfhR8fCBCqvm5iykY2nR7x5d7hc2OH5PW6Q7g=; b=vMl1PKYsqfHJcGGUiQKpSybsNBezeOMLRu7ZW0fY0zDS4wABk7OOGXmy8BMynhlcfB Re2Ct33P7kcPn1UNLdZ997lvaoSYhkmBZSqS5+UtPK3lpbpgvX1Gtnbr4//tRKERvQc2 m4c3Kld++Pn+o8yV6kQ3P97Ox+Q1bD9wHf3jsPPbGyUVXwldZOhegDyOKlzfjNlsuFbT FbKYMjyiE/DFAjVBIU/ynHf/ZpjORIFSUMM7TzyaP0AOaDqFy6Q7ciKDBlv0ZMXw6n37 w4B5wS6wleya+u7YX63Dd3rRA4/g5AsE+OMjhZ9eUtRIn8Lkpi5Ssi2EyQt83VAbpq6F 4dIA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 138si6130086pfa.199.2019.03.22.08.50.33; Fri, 22 Mar 2019 08:50:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728838AbfCVPuc (ORCPT + 14 others); Fri, 22 Mar 2019 11:50:32 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:36815 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727363AbfCVPuc (ORCPT ); Fri, 22 Mar 2019 11:50:32 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1Mekzb-1gWvHE0xEr-00ajAd; Fri, 22 Mar 2019 16:49:41 +0100 From: Arnd Bergmann To: stable@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby , Orson Zhai , Baolin Wang , Chunyan Zhang Cc: Lanqing Liu , Chunyan Zhang , Arnd Bergmann , Lanqing Liu , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [BACKPORT 4.4.y 23/25] serial: sprd: clear timeout interrupt only rather than all interrupts Date: Fri, 22 Mar 2019 16:44:14 +0100 Message-Id: <20190322154425.3852517-24-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190322154425.3852517-1-arnd@arndb.de> References: <20190322154425.3852517-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:PsIPU5iB1xBa5v+WazbuNdzqA4mLLTpIT/uM/wir9xmBeICdEOl UCw4EkoxW5ya6R+rWhfhWa6CrpEV0UXiQ7ozxDNzguNZNFcrZ9IHmtjWiR+X3mChBqXh3sC yEr+wEbKBOpTsK6fFTziPo+iFeeJuFG6n3qDJTjMbOY48FkXw9WY3xKPxmFaSNChy8ONCkV FEGBZd6oxtzWbM5XUlrvQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:UYxcQTad6wk=:G49kiHoDPXJ0UQ2KyQlZlg pIjPzzLMgjXCJbwxZq43V0JrLrHOJ3csPyEAgynOvEa6ujyxBYxECg9K3ywNyJAmRB+86Msdo 3rVYJmQ6H+rqukEri5p+pyTbvBmIZonsxEE46+kmWk2sCZLsKcDBn+3VCoUda7gdqbOWZao/4 gCHj+To9b23s0fXXEym7mj1ufxl0edCObikCWOww8JUQZufQGeI+RVYsLcAej9OIRvAJSEisP d+KVXrpNbw+sw84krKa46QSZqDncqo0q/eaDQNv9ppQjbw0EVxuEX1wp9b7i1du6pCtUIe/2S MinfqZKzM1N4HpZOH7w8zoacAJ/q6QTxH+0epsrk8BKa+GOuqlLQXtj4A9/ZvJ0cWMytpP8OX IH2m+9M8PZzVuLTS9UldI/ZxOtJTZTUIDtQV1TpYZQmfAqizK1pOflm30JnlAJ+AvoaYWpYu5 u7t8hwucKefny0KZYCYXuTBrdEeiK5pf3+o2l0T8WbHLTM89qn9BzosNvjYECoDEi6Ot2lsON U3q5N2Z5q5fNViLRYPD+knySm8te9de/W/FCatnzTbjcNA6SBKZToEqH8aqscstovAL/thoBE n6MCJYmmRG1yCXLSnDmzu/G/csUjpQr7blOlKLSImQkQWp0iL08wDe4r4L+cp2jzs1OLt6So6 riGlPBmBWiR/qrIrurwss4gqsI2Q23ny3c2GDyzxpYgCG54vTAHjbREySL0DSb4tavKPezvAQ 6ru4cLIoC76GiwcZZ7OS0zzAPNU7yLlxy4Sk6Q== Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Lanqing Liu On Spreadtrum's serial device, nearly all of interrupts would be cleared by hardware except timeout interrupt. This patch removed the operation of clearing all interrupt in irq handler, instead added an if statement to check if the timeout interrupt is supposed to be cleared. Wrongly clearing timeout interrupt would lead to uart data stay in rx fifo, that means the driver cannot read them out anymore. Signed-off-by: Lanqing Liu Signed-off-by: Chunyan Zhang Signed-off-by: Greg Kroah-Hartman (cherry picked from commit 4350782570b919f254c1e083261a21c19fcaee90) Signed-off-by: Arnd Bergmann --- drivers/tty/serial/sprd_serial.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.20.0 diff --git a/drivers/tty/serial/sprd_serial.c b/drivers/tty/serial/sprd_serial.c index 176f0a2bf9d9..c894eca57e73 100644 --- a/drivers/tty/serial/sprd_serial.c +++ b/drivers/tty/serial/sprd_serial.c @@ -63,6 +63,7 @@ /* interrupt clear register */ #define SPRD_ICLR 0x0014 +#define SPRD_ICLR_TIMEOUT BIT(13) /* line control register */ #define SPRD_LCR 0x0018 @@ -298,7 +299,8 @@ static irqreturn_t sprd_handle_irq(int irq, void *dev_id) return IRQ_NONE; } - serial_out(port, SPRD_ICLR, ~0); + if (ims & SPRD_IMSR_TIMEOUT) + serial_out(port, SPRD_ICLR, SPRD_ICLR_TIMEOUT); if (ims & (SPRD_IMSR_RX_FIFO_FULL | SPRD_IMSR_BREAK_DETECT | SPRD_IMSR_TIMEOUT))