From patchwork Fri Mar 22 15:43:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160921 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp960936jan; Fri, 22 Mar 2019 08:46:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqx4dxsO6+hIdxSn5jqtLGeWaSxdP1wu+q/FIpCN1J2wf+Jq5m7gnNTzunOCiMyJGw/H+5S8 X-Received: by 2002:aa7:938b:: with SMTP id t11mr2754992pfe.67.1553269603633; Fri, 22 Mar 2019 08:46:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553269603; cv=none; d=google.com; s=arc-20160816; b=xIMTJi7fkeFCVWNezZgSJs4kqTOWCAsWd+qmvzwuXGEo7PMMFn1V2MJgSkLUn0WJZc aNCemPm7ceYOwwfVyf9X/TiG5g/2DueJLMhR2DUNNdhJPj7e4X06dhixXBOVJ+oEmwgB fYuuRN1E+rnOM6Anpv/pCvEQ9tr0ikCWPU0+QblI27DhqmPyBIlpwe9oEJ2lfDJvozL7 xdo06if4QQIL5eCaKoptkRTXFQID6wXN05AySFx3PB8L+5zSw7m2beFFdximMB23Dttz EXUz3f/flWGJwBSePIDl3Xunkleq4AKJKh8ge2rf+ATGEmQ49IreFhA9XwEHTIEWqnV1 CTOw== 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=t4LrdMcGGiBcX7Q01YJM/2R+cdRqWLXLHLgf8G2RcjM=; b=UAyPX0cWLxAQRuGVEpvPIQ1MIIL271DKIgaWEe2OtmG2gMYITVzTy893uorT8gjkGJ Zx+TQWjsr7VHEVsFJfzm9kVYJNvZz4msO65Oqu3UMCWulbSN3d74EBNLMlZUAGe5TNJk VEzkl++47EWb1sykrR5KiOpqkTwwQEz3Hr7Pyd1PuxTTIHWYCw8oEpSy7ljYaocLMFu5 FeBDeHBv3j2I0OqyBgrbNdYFPwLBN5JCg9Q+fHT1/re2O/2v9G+hTjrPLlOvZueBfCgJ ey6z8uJkr+uoP2QSG62gSlJPZRHOcfzLjJ5TG1CtDJiQe/Vvk6wCXt/oY5XNu8vxCJWH LF8w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e4si7183434pfe.4.2019.03.22.08.46.43; Fri, 22 Mar 2019 08:46:43 -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; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727764AbfCVPql (ORCPT + 31 others); Fri, 22 Mar 2019 11:46:41 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:45691 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727251AbfCVPqk (ORCPT ); Fri, 22 Mar 2019 11:46:40 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1MnpwC-1gfVXC0zBS-00pKgq; Fri, 22 Mar 2019 16:45:08 +0100 From: Arnd Bergmann To: stable@vger.kernel.org, Vinod Koul , Jaroslav Kysela , Takashi Iwai Cc: Ravindra Lokhande , Vinod Koul , Takashi Iwai , Arnd Bergmann , Mark Brown , Srinivas Kandagatla , Joe Perches , Dan Carpenter , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [BACKPORT 4.4.y 02/25] ALSA: compress: add support for 32bit calls in a 64bit kernel Date: Fri, 22 Mar 2019 16:43:53 +0100 Message-Id: <20190322154425.3852517-3-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:qdmoVgn5qRBXiX0rd6Jjr6hDFLSAzZ7K8GEgzOoBTJ7z24e4UWD RjKLEBCA6OW0mDWPPMZuNQ0nofk8g9w/lw97NF0CYfqxbdatuEs1E/WFUeMImyuAmTRweg8 VS7I91GhVWgKkiLqm740IaYAOQU3cFPKM+JkraWNkzIt5H0WbCXp6os0vwagWMGQNljHAdb p/Z2CFCmOWedlw7LF25tQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:Ctb8eMkV2xI=:Q7CpqNFjF8sfLZetR/lwPI dIAMil0TxiU1g3D27dOwhRGZ6fHDZRML4J32+m4sRNxFGQWtIQMf96SsXVxx0VuqrGdV3RVBu 3FXGN2+HmJDkSOx/YaAP5tjLVSj1ZWO0YSgFDg/McX61rwyn9XA7YBMv7NVNvLh+ev26NKoff DdLXd6WiT7F2pcs4JPkg/sQNfYM9ej71b7TH26P7CpiR7RSpm6wXDVXmmgYOeb8otUosJOcAF 9TJlnQLIvmBQETigdnHcOePeKKtccrkDWE4qXryEezqE51gFnTZ0WGqPF3xVqK+RtD6FXMOPD QIABs0JOPdNubjvuzSwl46x/VumGHJa8NN35aAHS/lnNAOgTi4fAQ+e0JHRqxnPKQ6p/wqh1V tkAVJOaiMKq0GMr8ZnCfQXqY3vyjqTO8bn/6JhL2qZw47NmgNxf0OMUyigubdBZLQKSTKf4zT UK4wulxOvRCttye8f8O5fNUR8h1Tbb1gVwA+xnwL2PgnYtnRjHY845QAJVYEjn/nleEG7zAHw EKiURZvOJj4GwFYKj3cyCJTW3nFg35TNwelxaT+yueAgbKScTBcIoZEsCeyUahqhat5hhWIge HLcQo7dkK/gZ38Z1uMD04o2z5OHO9++iBEkvWWeutqCoS3CcxGyrHHLRTCDTXw/a/OHTUZvN4 kleH6Yae12LIR7P0/9S7h4df+Fu30EioWPAYnN86hglLv5wXh/d8ZeFZRd5+IOYoQeYcKIqam SuC83ORPZKj5YF7OBWsWcMmR2EHnq+EBpwlZPw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ravindra Lokhande Compress offload does not support ioctl calls from a 32bit userspace in a 64 bit kernel. This patch adds support for ioctls from a 32bit userspace in a 64bit kernel Signed-off-by: Ravindra Lokhande Acked-by: Vinod Koul Signed-off-by: Takashi Iwai (cherry picked from commit c10368897e104c008c610915a218f0fe5fa4ec96) Signed-off-by: Arnd Bergmann --- sound/core/compress_offload.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) -- 2.20.0 diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c index 6163bf3e8177..33d40d6fa3f1 100644 --- a/sound/core/compress_offload.c +++ b/sound/core/compress_offload.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -858,6 +859,15 @@ static long snd_compr_ioctl(struct file *f, unsigned int cmd, unsigned long arg) return retval; } +/* support of 32bit userspace on 64bit platforms */ +#ifdef CONFIG_COMPAT +static long snd_compr_ioctl_compat(struct file *file, unsigned int cmd, + unsigned long arg) +{ + return snd_compr_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); +} +#endif + static const struct file_operations snd_compr_file_ops = { .owner = THIS_MODULE, .open = snd_compr_open, @@ -865,6 +875,9 @@ static const struct file_operations snd_compr_file_ops = { .write = snd_compr_write, .read = snd_compr_read, .unlocked_ioctl = snd_compr_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = snd_compr_ioctl_compat, +#endif .mmap = snd_compr_mmap, .poll = snd_compr_poll, }; From patchwork Fri Mar 22 15:43:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160919 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp960825jan; Fri, 22 Mar 2019 08:46:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqwWo/6ALQvokoWuzw3nM8KnAKbHElgc9qPTgt1sIvY0xmADksNlRRMKQcVEbVnpHh8L0gaK X-Received: by 2002:a17:902:bd97:: with SMTP id q23mr10047984pls.94.1553269595919; Fri, 22 Mar 2019 08:46:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553269595; cv=none; d=google.com; s=arc-20160816; b=FObLGwQHZWxL0tJGmxAPGOP3Z1Da9QAgixaSTXn5LyPpJQf3KHFl/ZDQ2pK13cmVHI 4D7rGgOXExph/yxJJliOQI2EqcHuoezF1L1AcVaWekFlv8Ak2nZhsabjPOhcxv+7HBLl iYj68bks9NNH+z+DBA+4OjNT1vbex9XNRjeNV0iG4KB/J4QxWr2teMwQXCOxWu8grCQX oa9VKQcbq7X/8BmeqKawXaEkuVz2kxDGiUqVxPULKbcYuNmSHidBCuPoVcBID3M2/a5X sNmH1ehbRlVQsxRB9iR8lpq4ck42pPvXH3HteJB1+CxtGS5r+O/34cSqVTvrmjfO6eZX tYRw== 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=iHpmuZgDmvgfGvYU1MpxCv9KM815GPaZphUjzl8oS/M=; b=BAvg7r5DtcV8Y/pHEXZhYZMHYywNQeVvYDx/7fsQ/Plq7ScmmvoktRF3jO4N/v5u36 tl+ZqQij+hczVfhaMk5JjHuYMSAZNEYT3xWO3rQtPsFOrr7BdyUKUpxNYjlomMaF3uUF gX4xrKnPh76YuAgwbiglOJnG0AONSSVzifRk9qXB/oPfMPeSayTiK4IhKuJHECa6IVRi COIuCSVZwm/sLhr6LcokyYaw2XQyIueChV0UHOwzlzfigZfGYnp4ppHx0zf/GtfF8cf3 Y42Y0pNMKsRHIZ+4/gZ5G6bPyWWtftpqtJ5lbJ4kMiYd09uor1WA+UQARwU+yhZYI3sq gQzw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x6si6811326pgr.372.2019.03.22.08.46.35; Fri, 22 Mar 2019 08:46:35 -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; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727668AbfCVPqe (ORCPT + 31 others); Fri, 22 Mar 2019 11:46:34 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:53763 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727231AbfCVPqd (ORCPT ); Fri, 22 Mar 2019 11:46:33 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1MPGNn-1hLTwE0CPV-00PeTX; Fri, 22 Mar 2019 16:45:47 +0100 From: Arnd Bergmann To: stable@vger.kernel.org, Greg Kroah-Hartman , Kees Cook , Sebastian Andrzej Siewior , "Gustavo A. R. Silva" Cc: Josh Boyer , Ralf Spenneberg , Arnd Bergmann , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [BACKPORT 4.4.y 04/25] USB: iowarrior: fix oops with malicious USB descriptors Date: Fri, 22 Mar 2019 16:43:55 +0100 Message-Id: <20190322154425.3852517-5-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:qmHMR6/bLkiLAr6Eh2kVU9pjqymM3CZ//BPIzKS9tQMm0ixAiTF UDcP/qFX/IfUNIqGdzDcm3t6cYrK1TzuehVrLBWoIPwmi4QCd79Ub21akCYkHMBqwgaB+ak B2e6Y0ZRK1u/4/qljIYX+imdGR6mUAiKfBTsE+mqTpMSXTgyENA5PtP2Ax4XSCgmAfjTTrS 5tn1Y0+gG5FBJsQHdJNHw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:cNE/gt7wInI=:X1hTqeX42BmVm0QmBW7HVM gVZtXD1fAtJajFgUOweHQIUvZnoZL/bhdW4cs8FRpVwEJ6TmJqm8cylXOp9S1qjIPMjLL5J3z Dyu1KubI313MMSs6M/hlMdZRqwcTU8T7T69C2kvNMJFetHZdprrQgerbJF0NT1Q5bPPM5Kkn1 /9A+c9mX+U06ixiHxSAQqKD9GgCBu0iaATVNsxQswp2o+fBbpEhvZE4gy/T5pjhZuzONeXPsk zcT1QaXS+wosEnUdW4K4nQt1iVXrM8GlJBBNnlYJH+9SlQ2BeWY6AKsxSDG0Ng4F4JhH2E946 r2ZkIgF3eE7VUKjtcgTZ3x66RoToNXULPU3KDh49rXEZMxwhqLvvdC6tGWkAUXrPhFV7cO7YI VT5mmijaXuQw8pOuXRsha7wXpuUdqvFZMBYRL7UDVVFIEtMbyn/FAnm6RSSxVyND9gR8XCdgb tTelA15LWI0ypLdoAi67uhWOiF7u0wHQ/UXDgI6FfhICF/4EGZYtwCpTSQQMrLi5Jngj8ED01 Gd5c/KmzwgPlrdv/SAUk0V/i1PCG2X2XQ8azqVLWwriPxA5Klt+h8H+gy5skj4s2TQBayq3yL a0k56Yt0kdAaiG5SfXBVw/1hexum9pgLAx2CA51pPLBwoevmtSmWCanKNgYnBE1Xg9l97e93v jWiiBcWNmDlDZD2GV2R+ShHRji0HLKHKS0FRWJEv3ZZlDHFxYn1PkoTwvO9AiaDCGcnTpNmYm MrqHgTRWq0fHjh/EpZlP2jaxZ9ZbZX2u7tAFNQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Josh Boyer The iowarrior driver expects at least one valid endpoint. If given malicious descriptors that specify 0 for the number of endpoints, it will crash in the probe function. Ensure there is at least one endpoint on the interface before using it. The full report of this issue can be found here: http://seclists.org/bugtraq/2016/Mar/87 Reported-by: Ralf Spenneberg Cc: stable Signed-off-by: Josh Boyer Signed-off-by: Greg Kroah-Hartman (cherry picked from commit 4ec0ef3a82125efc36173062a50624550a900ae0) Signed-off-by: Arnd Bergmann --- drivers/usb/misc/iowarrior.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.20.0 diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c index 5e43fd881a9c..381a92a0ebb6 100644 --- a/drivers/usb/misc/iowarrior.c +++ b/drivers/usb/misc/iowarrior.c @@ -787,6 +787,12 @@ static int iowarrior_probe(struct usb_interface *interface, iface_desc = interface->cur_altsetting; dev->product_id = le16_to_cpu(udev->descriptor.idProduct); + if (iface_desc->desc.bNumEndpoints < 1) { + dev_err(&interface->dev, "Invalid number of endpoints\n"); + retval = -EINVAL; + goto error; + } + /* set up the endpoint information */ for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { endpoint = &iface_desc->endpoint[i].desc; From patchwork Fri Mar 22 15:43:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160920 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp960881jan; Fri, 22 Mar 2019 08:46:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqxM6ZaoQBVcfdjTYYTVmf2rP95xRBVAwUuf4Uvae8VshnHSd5rrbrKSN9b7X8Vmc0NF4gu5 X-Received: by 2002:a17:902:a7:: with SMTP id a36mr10304862pla.267.1553269599545; Fri, 22 Mar 2019 08:46:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553269599; cv=none; d=google.com; s=arc-20160816; b=owA7N5beqPM0u7G+jIsMpoSfH9h1G320hGAa/WvB1OmgkT1OaMUOMryhMB82eBfvgq V9ervfSQfBVdlzzBZzOEdjjoeFp8eLsPA0xJHcI04rPwIRpmkZiPtqwPXYkRcAUnfRde nlJgMmDp1hwxhhwodp4dqJwMUuEDolBTfGMRANEkkEQ0bfPXhYwzOukUmDlyRM9SwHHC azEW5+1lVzF/nWKzp08JMCVxIF+FCcGIJT+6+vmbwl1E6EVrNdqxp1eiYqFM4zMYfZJV AXMGZa6XTQ5SxXc2fKYcE/IporNaxKKHoSdI0PbOW6qVJ6HYIHKBG9YVVQz59o6qu3Un eYhg== 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=on2rSIPySH2arH/HKhMRyF1V+i9akxCooCJ7WuqSsag=; b=KYQEQoZWlkRUWasB1LJ7LJfT00V1MpG6Lsu7EJXbKPYiQ7MVkbFXOm5Pf5IPwTciaS hM4L/glCvDGC+LXHzhrxWb0fx/DeH5U6gefShv2jLF4Zy0Y2Yu0ydaO0D+IZbm8Mgu+i RCxVLONNa/UkOoP0RQiX7BVWaoYqO8IIUC+g5bYCoFCLkrPligfQ0mMxpVOCEtzYNj0h QihXOCpOMLC0Al8NlYYZediThJOqcBNWsTd8lRW5FGWn3jG21VRii5e+K2M7LwbIKiU0 6fPUOQ7/yrKPNlp6MkkWojvUDBGgQmi0Jcm0yJk6Jjm4lxSWe/0vBP7LdNr/AmTgS70g xauQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e4si7183434pfe.4.2019.03.22.08.46.39; Fri, 22 Mar 2019 08:46:39 -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; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727723AbfCVPqi (ORCPT + 31 others); Fri, 22 Mar 2019 11:46:38 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:39051 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727251AbfCVPqe (ORCPT ); Fri, 22 Mar 2019 11:46:34 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1M1Hi8-1hA7Fs3q1K-002mWu; Fri, 22 Mar 2019 16:46:07 +0100 From: Arnd Bergmann To: stable@vger.kernel.org, Ulf Hansson , hongjiefang , Simon Horman , Jennifer Dahm , Yinbo Zhu , Avri Altman , Kyle Roeschley Cc: Wolfram Sang , Arnd Bergmann , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [BACKPORT 4.4.y 06/25] mmc: make MAN_BKOPS_EN message a debug Date: Fri, 22 Mar 2019 16:43:57 +0100 Message-Id: <20190322154425.3852517-7-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:RWCkPDa1RfODQ0CZQuzMTOyyy2eIm16NST7+OZno7XSgnPYCTH4 /y/qoDARhKGdcdXUcBB4gtsDxCKATndrYjVgnud2zIa+wI3TUMYa1jKjZXOOctVijd/vINm cY1kv17brk0/njzjWlJdCJMo2RTliVmdF15KW8BkgZKGk81Bzo42F/6GkMIp1ufgmyrgOSU 1Z4jmvQdJrKbgjk8xMz1g== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:YgBfrG/uq1c=:I4UntfcZItaVU6X37yNOeT dywgzQnJK7DWuALu/7Mq0b4nDZRwmHqmWMvtbM5g9zG6RzdOd72CrO7W6A7FNqDniazvCfhYu 1mvkBe0gIMRUT2+WVM89yxmZC7YWK/wcAN1ugXXa02CwA19EiHV0AcLBsd/tEKZlPaBbfahhB rNUXoW0pKvQNPsBf5+kuMMHRBdsF+sEOCCTg5S2YSnhWg8rPX1ReAtOTbAJA3y0zIZos0CyNt gM2Zo5kevM8l9CkWsBU88mZzskgjuO02MsjXu8MA6CgJOPvdax+NPVlib3ZX9hVPs8j4qAsVD M6w987t8L4+17ECIexEWIrRrtdJ8cAA7NvEJ201sM7faZ+VkZ+8QloGmj4jRCYj6QRMslffcI GfXp1DEUs+mfkZ2QT8PCfORkJTZvNvUWuUVWazE8N+YSK8t7aKLrq5bjYeAB1j1ZzJ7VkiH1D f+IEszEdJMMuRZYOMPrGV2NWVU+BFFJi0f8qg9GSlYTKEILMlNmVs932F3d4gJ24Vgvk4S2iI wISMmt2bz87uVEIZKgUCE19VA9QMAG7uQNUpi4bywERe2kqubghIQSMXBzCnP35a+5UgQgdGM SnqVOXGZTeBNldMqiQSWRYcmYlAhi1icivNYN/BmTDBsNz8yQMgJXyT+gyl9JmfK7dFmG13D5 vEjV7T1Z70sPPZOySMfDvxm4R/p5l0vQxpy9NIsux4rUylT50rAAC6wjPegoyGaPS4ORgnTPa +BdjwTWxlsyi/mzDtyf4T4KiwRJRL6fI1vbT4w== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wolfram Sang IMO this info is only useful for developers. Most users won't need this information, since there is not much they can do about it. Signed-off-by: Wolfram Sang Signed-off-by: Ulf Hansson (cherry picked from commit 4ec96b4cbde8d5714a4477b5a2562c3dd40bc5fa) Signed-off-by: Arnd Bergmann --- drivers/mmc/core/mmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.0 diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index a31789be0840..adc3291e9d6a 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -508,7 +508,7 @@ static int mmc_decode_ext_csd(struct mmc_card *card, u8 *ext_csd) card->ext_csd.raw_bkops_status = ext_csd[EXT_CSD_BKOPS_STATUS]; if (!card->ext_csd.man_bkops_en) - pr_info("%s: MAN_BKOPS_EN bit is not set\n", + pr_debug("%s: MAN_BKOPS_EN bit is not set\n", mmc_hostname(card->host)); } From patchwork Fri Mar 22 15:43:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160923 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp961201jan; Fri, 22 Mar 2019 08:46:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqym+FRbgT9/Yv4b8gbNPEEZNK/QzjAf9De/RcUKOPjtRL5IpHZpuDUzX4mrTRh4nbxa7jJZ X-Received: by 2002:a63:e14e:: with SMTP id h14mr9361400pgk.184.1553269618545; Fri, 22 Mar 2019 08:46:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553269618; cv=none; d=google.com; s=arc-20160816; b=Hbqeoc6fNrV280uyXvw5Q3fQ2vp7khXuTuZt0fRvzO3DfCLZe3jGlojJvm08xFIdWk PvVi8dhCbBvDZ8/097/iEev0SdcyqPnUGtqh4uEiSWBD5BkmpqpkGhGxnN8jtZNZgUyl CMxUjuNBVi0GZOXStXcT4f8WDLBZwQcKI1QIPWDudbeFbFC5DKLHmv8POuEm8ZsvJgB2 cqvmzNCQHiCoOVUyv+R72tlioiSPq4SYfHNA/A5dm3KtKxfZ/YT9Z3EwEnEiEa6B55iy X1k4sc+G9mXHoSVoBX/jg37++wBJR0waaQ/1ubZOBVinQuEIvHZB0du9I1pdp3Ht1BwZ q7nA== 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=LwlWtvw3mSZmz7DfG+n1f/tygamI0iJSKOTVGs2j12k=; b=I6DZHkYA+GTofyuZEokvaRNgbrv1WifiwhJLgkWvV8YJwxcOYdQkssyxVTs1mVcsIF Q/+wuiTQ07I+jPigCVF2REdCis13MN4qdnyLj4yVm5G2YpI14bjVSqRROFgTpb8lHOlN JmxjRmVuuK2l4anq08ao0vnt6NHvgqwa4Yncyj/epM94dGvOcWC2J1YqaXREhuUKgDWk 3j3HqL14d1FNHuV4YATS2JcddAkCgPNdSOvlC6wsT1pdqllSa63xo3kZpbEy/0ZosZMX 8MGz6I19j6cgshtCun0USugy0B7aXIO5B0dbXUJa8OWy60UrcRv5aQs+BwqxY9AufIbC anUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w10si7235057plp.329.2019.03.22.08.46.58; Fri, 22 Mar 2019 08:46:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727839AbfCVPq5 (ORCPT + 31 others); Fri, 22 Mar 2019 11:46:57 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:52233 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727363AbfCVPqy (ORCPT ); Fri, 22 Mar 2019 11:46:54 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1N1whr-1h0jYs2B7R-012LGN; Fri, 22 Mar 2019 16:46:39 +0100 From: Arnd Bergmann To: stable@vger.kernel.org, Ulf Hansson , Avri Altman , Shawn Lin Cc: Russell King , Arnd Bergmann , Ritesh Harjani , =?utf-8?q?Niklas_S=C3=B6derl?= =?utf-8?q?und?= , Jiong Wu , Martin Hicks , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [BACKPORT 4.4.y 08/25] mmc: core: shut up "voltage-ranges unspecified" pr_info() Date: Fri, 22 Mar 2019 16:43:59 +0100 Message-Id: <20190322154425.3852517-9-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:xKzkjcZ9sdwnDMJpHCbZubw9iVQy1Q+3iwt6jMNhxhxj57MfM1U KRwERkSOzuQyLrMuc4JjyBHg6PY1SETZcdz+006q7Dc70RQE1RiwoOtEQGGXuDaAfz7mky2 mZeRU+KuQZel2C+oRNwwEdzxN/C5X0WLsn63h3lX6tvI+A43BgcHGqEoaPimxWyspzoS/x9 jYrL+tBnVbxtFEYisI4Xg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:8UOTv7lvoss=:sYhAnRI77z0j8XUghrTEtS LJz3BkBZP4wJHmpsn4c0dIw7NeC4IKcR/UzN86DL9VkqWHu+seWOfst8bslpwRsD23LcWx3f/ NBZATyxs9JP9mdJp8G3dGa98HbopsnUlz6cjpEHarLKpyPJLWwMxv6NStlTkSdm/N9pnqwiSL oTVGmbfHgKTNWZvTRgIKSriRrMSBMLtH07NllhK/3lFXermaL+5E7gGp/Iexc4YDVeJaLSqnC bG+qztu94rEqhtDdVfnCxaPmozC77OHkOBlWKPYKdnLyRThlSz2zdBPPdRkJ9JwRDSvCNhtqP w38LeYAQHiX/fvztDnwA6GV9Q9d7apT4py6dURXQuX6AIX+8/MGSSgNjUO9UzS5TiRlS59yEt i/u4/L1vmQXKxeXwNy3VH9ANbMdrvMAQygA5NZHr1lh3OHgIqyQli6oWQbEnPLcC0gVmw0MvI VgTZ1AAcYbg+/uwFmChajj5evzLDVfNHRhz6t9V+Gc6D/WOwQglH2RGpRj5hDNBBffKA869gb JbYKJ6XS3nMyqgyEdyBos66HAdBPCiQ7EGq3lQNw5b811FRHpqmcfSk0W/knzaEXyPs3exvbi 8XmnaDq5vlfHK4gmJDJr3OLfmfYQoz/LI4QrF7Za6el4Hz2Ta/j3lZZAlZpRRc80iIpIvvg6u 8Ds6gcbpemgYDltBjj2U07LAZVD9LArwXGgqdspyUvTWn8quxi6Rkk5llHqGgchDwVZzWfN2v 1NibpG3Z0TF80gjUSH8itOi0UFeloxhliU3k/Q== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Russell King Each time a driver such as sdhci-esdhc-imx is probed, we get a info printk complaining that the DT voltage-ranges property has not been specified. However, the DT binding specifically says that the voltage-ranges property is optional. That means we should not be complaining that DT hasn't specified this property: by indicating that it's optional, it is valid not to have the property in DT. Silence the warning if the property is missing. Signed-off-by: Russell King Signed-off-by: Ulf Hansson (cherry picked from commit 10a16a01d8f72e80f4780e40cf3122f4caffa411) Signed-off-by: Arnd Bergmann --- drivers/mmc/core/core.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) -- 2.20.0 diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index e2e927d1f7e4..df074f8c7cb7 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1220,8 +1220,12 @@ int mmc_of_parse_voltage(struct device_node *np, u32 *mask) voltage_ranges = of_get_property(np, "voltage-ranges", &num_ranges); num_ranges = num_ranges / sizeof(*voltage_ranges) / 2; - if (!voltage_ranges || !num_ranges) { - pr_info("%s: voltage-ranges unspecified\n", np->full_name); + if (!voltage_ranges) { + pr_debug("%s: voltage-ranges unspecified\n", np->full_name); + return -EINVAL; + } + if (!num_ranges) { + pr_err("%s: voltage-ranges empty\n", np->full_name); return -EINVAL; } From patchwork Fri Mar 22 15:44:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160926 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp961695jan; Fri, 22 Mar 2019 08:47:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqyP//6XxA8DeeFT9hm/Koft7392HULAHaFl7pHxXq0T4q817CO48V0ktD63UEnnJNYWOvSS X-Received: by 2002:a63:b902:: with SMTP id z2mr9861960pge.428.1553269649987; Fri, 22 Mar 2019 08:47:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553269649; cv=none; d=google.com; s=arc-20160816; b=IT3IuS0VxIcmQLJTjnvirQnGeaG4sWIueO7qtSLs0anmMvakbbhy3zwENcdm7V6hxn i57pucQufpxm3Wknia98W7n7g+g8wPTm3z9Sk8ZoEqNav5MFnTdMCT0Nup1YEGkAVukw LxiVdTqcxqaXyBeYRsPgH5jceaHvdItkw+zZ+auMZPDpb/mVTQmrRVg8HjfD31oWipk5 gyXDEjxZ4sR2DJzXFA6pgKSKVQF74Hs07aiP7JvIVFw0lzfasYCJ9FvYLtf04ZcAlkHS EKhm1mUqZnbJOibDfaKjX7ARFGDLUPY+01TL97fHLiMNCgA2LZAALrACzFxSUitxkhjj RgdA== 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=U0Ii9dg7jik6HSGUUcB1O7/fJjd2pdcevZKm7NMjIxo=; b=lZvbYYQ0wKxMta63HufXKxFiRYf7AvP4MPdklG3tb9ozxIabKZgGDsC4E/qZeYfXcV +EdoCJbKt8H+a2yP0rIUYBZazDTlQxRCSvA2P72N4WT5ZKPi+LFnogOFBQnWeHhU1ZSx oUocikuuFclS3cpkFOHU+vZ2sEjyu6fLEZVK+SE1vrCNoYibgap0tB5EolowN8poe/bu jtm+6/uULhB9OQEkuXO11Qxdj+YTowXO5yg4SdfbraWFRR+9X8beEWIje1zKM9634OoV MSOPFUnF8YJXEbcopI/YzYTSMNDDRYTZY7jYESQz7jIAhv6hQApQuGHqzRTkZBEUw6u0 cyuA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cb2si7759875plb.201.2019.03.22.08.47.29; Fri, 22 Mar 2019 08:47:29 -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; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728042AbfCVPr2 (ORCPT + 31 others); Fri, 22 Mar 2019 11:47:28 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:37727 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727504AbfCVPr1 (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 1MXY6b-1hUrZP1Wvv-00Z2OT; Fri, 22 Mar 2019 16:47:04 +0100 From: Arnd Bergmann To: stable@vger.kernel.org, Ulf Hansson , hongjiefang , Simon Horman , Kyle Roeschley , Jennifer Dahm , Yinbo Zhu , Avri Altman Cc: Dong Aisheng , Arnd Bergmann , Shawn Lin , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [BACKPORT 4.4.y 11/25] mmc: core: fix using wrong io voltage if mmc_select_hs200 fails Date: Fri, 22 Mar 2019 16:44:02 +0100 Message-Id: <20190322154425.3852517-12-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:AUdmkZ5z4T+73YX5eDFD7nmt0VVn8VFjTyPcIjAgXkBryoY38Sj KEcTEgx2j4b1CAowPC21uD6NWeJPhVix5lXJxvPisKKZMMLTRUE+GzTDFNAGLXmNC8CW03q hA9kqPKM+DHGYRHZj4/ktdzzz1eL9xENAZSY5XspO741kft7ouFaXIbZ8zfzPdrUBfZPUA1 FuaD1Hf2yB4JzAoLOtEdg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:h6UQKPJz7PE=:vYowmL9ByE7hVEvss4ayn1 woXB+qzcoNA4PzL6YY12oOviTzsKDgsrlF34hj39WmZUFmSY6On06LDxDrPDOKCBIfDkMAFtq HLJSFNaiA2hOdOSewbr2iwec/BeWTm9kPHClLEV+f+c7Q701UFG7LbZqkG2ZKmMEeKs4QpgUz exfXn1hgSeC4MgoaBmcL+MjJtNkdnuef75gmhAP1yiAdAGHy5YMCzRzVcEgOFHIOim8FOd1/4 xMiykaSEwBU3rRAffLXAHHxbE/jveSdkvTdWXIc2Blo8pd+8fTk/UOHEzoTta0Lqw8YMMvFuN OVeqbyXS5F/TPP9hY1Dk5BtfCxFdD6F6ZhidQuz9RoywmB2iebJnD0Rdej6NRT6YJv9wKpTqQ hqCpId7RBpXo79BJmMpFb4GJQZMUiev4zYKwUcWY+78KLGydZekwr2X6BRbpr44yrY+W8+8OA p91HpFRUM+1SqFKeGY6VpZZskmPa2UVOMrBF3mm1hITPng52DP3ae1feG01mwMkVogwBMLMID g2kdgPOzp1WB7RqrulQ6EvhoCny8JjZF9APCS6M13VJjwTdVLTriswhrOYR/8YdgvVsrKxX2k vle3P1ivlGvmfwSDvIyX/CKvE8C9Sd2ONVQPzrBlS+aPLHYtD2qi6NRatqAXEolm/IPkioaMf qY+YxXeLpfQzhUvR5tViimndJoFOa6whKUyUea+irh/yxewFbP+xmDYJKDZRSdC/sQqDyH6pp OshfE9+T4JLKngiDterlyd3CkYuTG8mAMtUE5g== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dong Aisheng Currently MMC core will keep going if HS200/HS timing switch failed with -EBADMSG error by the assumption that the old timing is still valid. However, for mmc_select_hs200 case, the signal voltage may have already been switched. If the timing switch failed, we should fall back to the old voltage in case the card is continue run with legacy timing. If fall back signal voltage failed, we explicitly report an EIO error to force retry during the next power cycle. Signed-off-by: Dong Aisheng Signed-off-by: Ulf Hansson (cherry picked from commit e51534c806609c806d81bfb034f02737461f855c) Signed-off-by: Arnd Bergmann --- drivers/mmc/core/mmc.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) -- 2.20.0 diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 7286d0d324e1..7844baecf306 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1251,10 +1251,11 @@ static int mmc_select_hs200(struct mmc_card *card) { struct mmc_host *host = card->host; bool send_status = true; - unsigned int old_timing; + unsigned int old_timing, old_signal_voltage; int err = -EINVAL; u8 val; + old_signal_voltage = host->ios.signal_voltage; if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS200_1_2V) err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120); @@ -1263,7 +1264,7 @@ static int mmc_select_hs200(struct mmc_card *card) /* If fails try again during next card power cycle */ if (err) - goto err; + return err; mmc_select_driver_type(card); @@ -1297,9 +1298,14 @@ static int mmc_select_hs200(struct mmc_card *card) } } err: - if (err) + if (err) { + /* fall back to the old signal voltage, if fails report error */ + if (__mmc_set_signal_voltage(host, old_signal_voltage)) + err = -EIO; + pr_err("%s: %s failed, error %d\n", mmc_hostname(card->host), __func__, err); + } return err; } From patchwork Fri Mar 22 15:44:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160927 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp961745jan; Fri, 22 Mar 2019 08:47:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqx2qpmtFwF9nuukvM1sVe2iY0Ob18mffCSyoaplQ+xRHK4vANc9SPL8+HEOyrKsF5Kc/wBZ X-Received: by 2002:a17:902:b201:: with SMTP id t1mr10375048plr.55.1553269653368; Fri, 22 Mar 2019 08:47:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553269653; cv=none; d=google.com; s=arc-20160816; b=D1S7yOJ09wBX0BVOeC2YPDGc5VQsEt0i5DSKxf7eSXTO1EVKv6ltmgsq61p7oBIzsz mFyKMb81RerUp2hSwJ5gmPFjhCEn2PnDp5TSlRTmWStPCPIgoKktiJQIbs5NuqAp4Bxc t14iwA5zcLCZvQOlTaNqQzMcAQbtrd2bxTuN0ejK23XepDIPs8UDmR3ekKLnt8fg0eIU 5LAMqAAlpYnrzHmy0sGMldD3rDfXR0t6DYnEKNJ+HB0+aPIKmQd8mQzbQ2YPUNfVW/Fn 3erleYQSes2mU6JU+hprck1m2A4P5O/EYSCmDwr7m6QYDT1HFqnpX80QO29YIs8K9AZx /Gqw== 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=thl0NvrNbK2zROahGJa34RyZhCcNN79tUModlb9gOQY=; b=YerHhcf0+Bw/3ALHk2pDMJXAM2IKHkhWt8WJwgqZ1o38I1gq9CijVLG8qpQPR1xGqE V5OHY4OMBbrrBGUYE9zOf/QQIu9sEjS15vHg+A4jyt9EG1S5+aCSXtYnNL+X4966RLsc LXzVd7Tygq2GdnxLZ/EAZR6jD6DqiWijYrHJ8ITxD3aCGYptaU5hrSm7NjuRwfflGD2T MNVPOLbw7Xp4Ao2D7HhXNtovjJMYVhJMlrIPx9HsGnFc2K8LGaiWDDXHrB6BipoXkYyZ QUyNIfuaJ+ldRtoBBDsZLX2UQqVAXFpLFLxsdwcZHwTT8qKRH4GYLH5ARKdredsP8OXM Wnmg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cb2si7759875plb.201.2019.03.22.08.47.33; Fri, 22 Mar 2019 08:47:33 -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; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728075AbfCVPrc (ORCPT + 31 others); Fri, 22 Mar 2019 11:47:32 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:48467 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727252AbfCVPrb (ORCPT ); Fri, 22 Mar 2019 11:47:31 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1MvJwN-1gpguc31aT-00rIeJ; Fri, 22 Mar 2019 16:47:19 +0100 From: Arnd Bergmann To: stable@vger.kernel.org, MyungJoo Ham , Chanwoo Choi Cc: Roger Quadros , Arnd Bergmann , linux-kernel@vger.kernel.org Subject: [BACKPORT 4.4.y 13/25] extcon: usb-gpio: Don't miss event during suspend/resume Date: Fri, 22 Mar 2019 16:44:04 +0100 Message-Id: <20190322154425.3852517-14-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:DTY19u7ixviVkwcIrPn8cBZZRnu8fU/loRhzQrdCkzn+qRXeCdU GmNu3KUD74TsqT53s5yUyjULtO8m0P9eqUICwpICc4tTzMIBU/SaRAYF41fYozL5wVHIRpm xKjot+/B9QoZCtaaGrxZMCjUBH186LDVwdPg5CSuL9DFhX8X2SPSvko5uAx5gV0P9YIrNl6 xF3e4BhB7jBXoaUh6B/jA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:MYBvXZ7PdYM=:NffINcQs07xaEGqDq5dHHD 1rR676+OBVxd3M43p4jdluDJ1eNb2C6ORVxrK3BHuAkusTGK1uzjZjyoD2v/OLWAtTaFWT0y+ /sfbTuOLpe8aXuQI6cqZ0wWmdqzMFxu+yTsqgXdYpYlwLq6sFHkIhuGp/7wJe9ZiOk3LiXQSP rsul4fah9j/EaxbGRzNItcfu2I8RwmGsTTKeKCgo6dOJ/U4W+oLjeoAyGeUA/0kiTRS7iXS06 4lutrXHknx57+b7+KtxmF2C3GBQP0RO89klRSAdapLK9ZzpjcSBBzkiITJSTVzhRI2v12g+FX prfGUWAVzxlvHqRv27Y5mLWdRwVCbevU3EcH4speV5sEZ04RUzy66AE0zhxKx4TPZmetx4m6D CBnhkq2Qh08FMBrAGs0LylfDHC3U/x0qGydKTc2mcIquFQFZm9y1e5Kj+RGKW6lUyjURL/TKE mg2wMJhZBtCQzHNjydT5onG6OFM2KCdSc+zMIA0d81/aFapZHpX5tMdX+/VXJJhtGLrcfHwom TNR2XB2SAR64CZ6WIUt29O/+X0lhiKJp2m1XHVv0h47FyaKJD/1rybLK2LHoLnf+q32aVwnvg FAcaQ6MGX5XriN43//M/WaMcuFaEi3QkEyQtIZcjyklU7NmTi2EoCVKn1f/v1Y1rvRC3Lq00R oUSeoUl4yuMLKiQ+caynE4v6ym4JVseFIhEf1Rc8FHwOB+DszBLGlHUrmbIt8oYYxKw19NDaa dW/H/sE77Fq5Vb3ZVvN3SgDxTffTf+KMqWoNMg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Roger Quadros Pin state might have changed during suspend/resume while our interrupts were disabled and if device doesn't support wakeup. Scan for change during resume for such case. Signed-off-by: Roger Quadros Signed-off-by: Chanwoo Choi (cherry picked from commit 04c080080855ce84dcd490a2e04805608a21085d) Signed-off-by: Arnd Bergmann --- drivers/extcon/extcon-usb-gpio.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.20.0 diff --git a/drivers/extcon/extcon-usb-gpio.c b/drivers/extcon/extcon-usb-gpio.c index 2b2fecffb1ad..c6a7c9ddf0ac 100644 --- a/drivers/extcon/extcon-usb-gpio.c +++ b/drivers/extcon/extcon-usb-gpio.c @@ -192,6 +192,9 @@ static int usb_extcon_resume(struct device *dev) } enable_irq(info->id_irq); + if (!device_may_wakeup(dev)) + queue_delayed_work(system_power_efficient_wq, + &info->wq_detcable, 0); return ret; } From patchwork Fri Mar 22 15:44:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160931 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp962202jan; Fri, 22 Mar 2019 08:48:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqzV80IzFNDzeasdy1eXw8opPeLmKc92IeCNVFDqHzIxwx+w9yOgqDRwkQP4cWESrBTze2+M X-Received: by 2002:a62:174c:: with SMTP id 73mr9891377pfx.33.1553269683532; Fri, 22 Mar 2019 08:48:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553269683; cv=none; d=google.com; s=arc-20160816; b=dwvs9MJsPVD+kvBqGxPHbAdygWGfDuuEdi9C2smpShEUF9eSZrUs/mA2oavJOqOARa +SfdHBjZeqwu/i+1+UFClPhV7LgEVmwKj90bKk+7Nu7Rfh72J6Ica2oayP7L0S7G9GbV 38HkxBr17r+mxT3y15VgukZ5tPvLWNwF/+ZhfwYdyCCCvy46xixXzbSwEpkVRIgbtbPb dsq7f6sDyVW/BPBK0voqEva+YUEeN8tRm9CjyFtk6Fyi9jStTgemnsTN7P2AHykFtCTI blSQQ9STkyTqqAGS6+MAn7mJIKQDZV5o40tcmR7EgPl/tYDAk5SHvijOadQBS1dhIJG5 egcg== 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=tYXm6LX6zlH71PAMzcAiE9zfLwlHWbLblOJKcPJ6qUo=; b=YFY9h1HqVP8XrQJBiBChJLhmIQTcy0SrrAcFxp02EmB0utzg0+mpPlslAfzInnyyoq sHATN4BmtwDaBp8x/0+j0vSzYnHlVdDk+fNp1OmYXlNLGxPOdFKtt+0Me0/xZrWJKjD1 U0MGA2+scV/WDTYgmGC+vbiGvcldXDyhleOifF/Pb6ZVnuDCsT//X9l/2qCEAj0PNKBN oGmxA/VvZy97zQxegy0GahGY8uJRCuIafXuOQTlIp5Cv4lS9tJCOQfR7c8SGpB6kQVzH yIX/OM6vc8Wh1SC0+0ZM/rj+9ugWT9Uy1ZvQhk4hMMMwsWW5J20KrRFVDAnKJ8pJEAR2 KAuA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u22si7216580plq.145.2019.03.22.08.48.02; Fri, 22 Mar 2019 08:48:03 -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; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728437AbfCVPsB (ORCPT + 31 others); Fri, 22 Mar 2019 11:48:01 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:35457 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727473AbfCVPsA (ORCPT ); Fri, 22 Mar 2019 11:48:00 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1MEV7U-1hEZGU3J8M-00FzwG; Fri, 22 Mar 2019 16:47:28 +0100 From: Arnd Bergmann To: stable@vger.kernel.org, Masahiro Yamada , Brian Norris , Guenter Roeck , Genki Sky Cc: Wolfram Sang , Michal Marek , Arnd Bergmann , linux-kernel@vger.kernel.org Subject: [BACKPORT 4.4.y 14/25] kbuild: setlocalversion: print error to STDERR Date: Fri, 22 Mar 2019 16:44:05 +0100 Message-Id: <20190322154425.3852517-15-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:8f/kvwj3Nxe00/rXmyCTb8V8PTLXRNRu2GUKDuTqRIqv4f1GfwR STVR7OwyYEBXKqtR5c0e5pVQhX4RLdkBaJouCnkFandHBpug8rhuvQH1Rmms7QbiWHAKX0o 8box7D/Jl1D9QVrAYQf54jKJXvZD2v5PYjzxjTkS5b7NS3+r6LNFrRcA96ja1jegD+QKOri 5lBoPoz930duwUOYETXhg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:8tvzb9R3BCI=:/kOyQLYDkp5XX6T5OIkDiN Nvay+FMZ0WMK1GHoYZajpvrKZGY0hSy+MC0bHsSdJHgErEAe+bT8AoMoiL68HxRsWV8Z5EHru VB4B/yW0VxPtdHKhAXPCGg1rH9ta7faZqDV0mqN08t6d1buzXz6/QYFnHrPkItGTVBhN6rqKL EGTloAgJeZLAHqAdLAcoWIgEiXB3Uxb7yok3UtfyfODPGb8BAMvmTuubaZjUPZ9/r46lhEuZ3 pyGcWO2fUk2MBH1dbmHKNAxecFTLTVJBYPZXbdhnYLuEIdkqenwnr1JtVC6tCDmJJBYU3qFM2 EyrUb+56tLaPCUm1LgcsFemAhnVDeedlZ/786rS6oWnBn6riV2zInjrAvokmRWPTt1NjsFRy/ iw2TNLy+H/CHc3NWdCbfchno4W8kYtk7/z6QK50C0t6bEiu353PO5FyMMQd9XgjgQgnyEJfkK XSDMR/kvhfo5U0kvDYHVRtuG9PbAKzCOXo99Qfv9qbX9AkmQ3wWZeCm6Pba3kO3MUM+WLeROf o2vTXtr9jMMfsuq73mR8rT2zJTLsHcFtbYvUjVBE+/sI4dpH/FlRH3VtTX4hDQbNnyt+SRseV a0BPo2h4B8sPZayPWU0wLRoq/f+MB9LL1XXbWfqZQAIV3UZmi3G9Zxe8N7xSiFUoW5VUBV6Ix bsNTOrv4CS41ErlMqMGHmdpbvWPX0gc6/t6+fvqQhqR9DZ4Zs4xhVsNR1DcwUebUCY/+7x3Ma OFXOabFu9mA2CgkiJhRyphOy2KgKJDsa+AdDMQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wolfram Sang I tried to use 'make O=...' from an unclean source tree. This triggered the error path of setlocalversion. But by printing to STDOUT, it created a broken localversion which then caused another (unrelated) error: "4.7.0-rc2Error: kernelrelease not valid - run make prepare to update it" exceeds 64 characters After printing to STDERR, the true build error gets displayed later: /home/wsa/Kernel/linux is not clean, please run 'make mrproper' in the '/home/wsa/Kernel/linux' directory. Signed-off-by: Wolfram Sang Signed-off-by: Michal Marek (cherry picked from commit 78283edf2c01c38eb840a3de5ffd18fe2992ab64) Signed-off-by: Arnd Bergmann --- scripts/setlocalversion | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.0 diff --git a/scripts/setlocalversion b/scripts/setlocalversion index 63d91e22ed7c..966dd3924ea9 100755 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion @@ -143,7 +143,7 @@ fi if test -e include/config/auto.conf; then . include/config/auto.conf else - echo "Error: kernelrelease not valid - run 'make prepare' to update it" + echo "Error: kernelrelease not valid - run 'make prepare' to update it" >&2 exit 1 fi From patchwork Fri Mar 22 15:44:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160930 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp962138jan; Fri, 22 Mar 2019 08:47:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqzwiopWSNgsrR1XITD/j+na0MXxWRDgZGRQUBlUKDwGUbhJMzKSKQWWbiMIBOwPI74oDU+D X-Received: by 2002:a62:204b:: with SMTP id g72mr6460152pfg.51.1553269679054; Fri, 22 Mar 2019 08:47:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553269679; cv=none; d=google.com; s=arc-20160816; b=xuurgduxwwkCATYVbgaRPtFAvzVBapxWQfHNU+/GxPbsZ2uOs9MNihA1d5dp+1zthv axOWu1AJWEjSxXBDKSrJwm3hSUBVd7W6sGRXSCMyGCnXAYf+cl+yPGUoCHQHO+adJhiC 2rHCQl+7uW/MU4JZ3u1+7/5N+grtqp2AkA2vvjgAeImbbDgJcuN/NEIewku2gbKHXGT/ r7Bknej0HdrgLRX9sK42anq8ov2epTvptIQrlEIEp/o2ut4pBHPU4m13dwu6VkuAhV7k N6zyiVinFKMGmv8CIn1B2+Rb1aiXntMF6gKJ1uXaztK1NwzVw+/ZyoYxBvhZUMm/rhZl RakQ== 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=Ioy9Q/oc6H0hEeQFC/lhOQXJnjsI7vMtB5m/9GAoov4=; b=0a8NMJMMROn2xuACKKbJmoF2+UoXGYCRgKhEoDobeRqvoBuktLE2MI/558M0sCtplE pLIIKbrrVKYlJYpt2KcV79Ij8h2E/5M/osAg+HOIra9ye2YkjvCcQDqczENP9ruXzHWJ ICQOq4Y/RKQ9MGFlr+YFW6+1HYcHXGuC30E1m7SfW+5lo4PEDMHtb5Q+08uFxW8dAR3j HKc3BFo3GOQ/o0go1rchrr1VQ0ScoWx6Bg3GgsqoEKbOKnl2SYhAUS4bDhntOYn6qYIG jDRLzuTxoSG6BHBsrHO+1Nl7J1xPfITehWkFqHaUJz8gvQlo3ey6eydIHaII+ErS5+vX FWQA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n20si6768330pfi.226.2019.03.22.08.47.58; Fri, 22 Mar 2019 08:47:59 -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; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728220AbfCVPr5 (ORCPT + 31 others); Fri, 22 Mar 2019 11:47:57 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:57763 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727473AbfCVPr4 (ORCPT ); Fri, 22 Mar 2019 11:47:56 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1MIdaF-1hARKf0n1p-00EbpP; Fri, 22 Mar 2019 16:47:36 +0100 From: Arnd Bergmann To: stable@vger.kernel.org, Felipe Balbi , Greg Kroah-Hartman Cc: Peter Chen , Felipe Balbi , Arnd Bergmann , Benjamin Herrenschmidt , Chunfeng Yun , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [BACKPORT 4.4.y 15/25] usb: gadget: composite: fix dereference after null check coverify warning Date: Fri, 22 Mar 2019 16:44:06 +0100 Message-Id: <20190322154425.3852517-16-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:UHzL1C8wGGWp8Z6rjDkjmcHGnCq4ZND0jlzDxvJEFDcI4QzSMpX dsftbYeAGsMIFPD3UOU5TnyF8SXJLoet5YoGqms2eDMcAbOsUXpW4yNA5pRGqiOk0rbsZLX 5D2zbCjflsuGo9WxH+hGNkOkmS9hj+qWw3upfwWO8h/HExl2fLpZWc7ZcXE6JHsQ8uRH4fE OIe92it/gkA8w2+2FL1Rw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:v5QA9vpxahI=:qJY+RRUd76611b6rhteEig AsQOUp5bSnEEEzkTdVW9NLcXJ5Cq8jB02RvZYy2O0FEFm60pPUsWk0HP4gHBHTehIW+HMAfBy AFO84IxV+HvBB+ju/QocvQPTE0nboh4Lk226699EBvWpPMO522ULxsZ8q0zcdCgDh+anExwMt +fEk7FN2FKE8FFTvyuyfVLn1HH2xIrm5j0EJUtEq7QVSKCg87HbBzpSB0lBG39gqG3LSlVkc7 VLcf/9POgw3Ee8TmH6QpPHtz2kzEEiwzWOt8ayKALq9+AjQccqS2zZd59jjXmN+KyJ0eVlwdO fMCAPmYmwbp54/xSa9rd4gqTzzPem1W3kVe1zbYso+mutniDwUomwHLYaOiYjAYdj3CSPQQZX FQqAoy4zlNCerzTp0cGrfQ8C6suDk/mumdzBu5Ahzo/FKLcM10+kH1/T9R9FL8KeWjRPmEkYK o/S7V/RCO8izxzeSE84tMkw1couiEVonzKsUsgKY7ajMrHXp/kAoKoxbsaSmblXpLDjuwD7HL mgdj5Gn0hEwp2WHqPHjwLOQXQzyPH/uQH1DC9CjvGZxwWlJb/UyCDUM4y76B7hPEITZLXBKDp j+gx9NHB78d7YbNt/QREUwN+tMhxYw07DUhSeb0wfO4wuqGdb4dZHZE301FjRxPa+a6Sy0/hr oWHRMlHzgGaJuh7/xSWREO4g1vaeZjEXecO9dmDvbnVjLC2bATUujRZ1jK6huBFaJENLIEsw1 R+EO3OqdzB67zjhLnWcsvtenpGK96csHQFvcrg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peter Chen cdev->config is checked for null pointer at above code, so cdev->config might be null, fix it by adding null pointer check. Signed-off-by: Peter Chen Signed-off-by: Felipe Balbi (cherry picked from commit c526c62d565ea5a5bba9433f28756079734f430d) Signed-off-by: Arnd Bergmann --- drivers/usb/gadget/composite.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.20.0 diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 58f5fbdb6959..8bf54477f472 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -1819,6 +1819,8 @@ unknown: break; case USB_RECIP_ENDPOINT: + if (!cdev->config) + break; endp = ((w_index & 0x80) >> 3) | (w_index & 0x0f); list_for_each_entry(f, &cdev->config->functions, list) { if (test_bit(endp, f->endpoints)) From patchwork Fri Mar 22 15:44:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160936 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp963863jan; Fri, 22 Mar 2019 08:49:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqyNVA5Ao6jv7iZCK+vf8E+KXwRsQs6eA89tDTmfJ4+ClYlIAkWpuXGm4NzkWqWMClUDHAIi X-Received: by 2002:a17:902:10d:: with SMTP id 13mr10486982plb.230.1553269797785; Fri, 22 Mar 2019 08:49:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553269797; cv=none; d=google.com; s=arc-20160816; b=upppi3778vym43MZpF3bi7xSkxzFP1j3FooBS4qFwRF+1BkX+oE3gRWiKTpBktRuga LQ86bv0PC/0mFLmhqN3ol07qZqFAhYYerf3jVlphsw+YVeR3/v/sFrK01w+6o3mklRQZ Fhy7M0yt9kYvKpU+Swj8bR6xwjVfgH5ptbU9VzBIzW5dARyy4NgN7S13uyetsOPtmqV2 qoLAvTpaxd+Yaa1vaLGflWj++FnUEOajKiwjjrgyIsbrtzqGqRbSb6qbgXO3SLOvZmgZ JZcAe1om0f0td3b5IiWKbr0lIuH1Tjch0oF764gp1e1vmOuF0zy+P0RQBiSWux6CaAwr HYRQ== 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=xaCS74E8r/tvOFvSakTM4krToKDvkt8sYK91i3lQ7uQ=; b=e0iQ84UqDp1apxVY1jRCd9vRwXYZLBSMvj4STeNZ1hRwsKYzg3km13++1rB21pTkqu USbdDJuaLEOw6HnvEEIKrnHf+h2GrlxXXlZVVfxXSnEGMtXAxQTNZTWmebR+KrUl6Z2f 4VqqhZ2QN12BsSIvzD3eNdXXuMHTTWqVj7jNOu3zO7oCfqSCOfKxjO4xICIswGN4wBo0 QYhr7NA31vopwEtTfkN73nR/A23GcITkzADeIiU+3SFEu1WMzMsmqtpuUn4/d1vErkpQ czUGWLK4852LQcA2Xz+Au6wDrvxzFrxtswV5ze99xHKFm1kGepEtlJqUjFc5qH0YGdby H8tw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h9si7327936pfj.70.2019.03.22.08.49.57; Fri, 22 Mar 2019 08:49: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; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727907AbfCVPt4 (ORCPT + 31 others); Fri, 22 Mar 2019 11:49:56 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:59885 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725981AbfCVPtz (ORCPT ); Fri, 22 Mar 2019 11:49:55 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1MUXh8-1hXrXA13M8-00QWTC; Fri, 22 Mar 2019 16:49:24 +0100 From: Arnd Bergmann To: stable@vger.kernel.org, Catalin Marinas , Will Deacon , Mark Rutland , "Eric W. Biederman" , Marc Zyngier , Anshuman Khandual , Andrey Konovalov Cc: Qiao Zhou , Arnd Bergmann , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [BACKPORT 4.4.y 21/25] arm64: traps: disable irq in die() Date: Fri, 22 Mar 2019 16:44:12 +0100 Message-Id: <20190322154425.3852517-22-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:3h0I8WSBNcOUW2oBof6q4Zhu/MkBQ6JfTTEKDc7C3t0ARWbsWDW LpKGcnzl45jHUFU9EP6rpjw/bhSVoXTjFVkix+HREzEV0D6h29XjIBciuqjvbl5ioglPyhZ o09rVRymoVQv97+wPo7JbUcvIqc+YXMps+5gOFwSUMbgnrjZ60/CJxMhUelO3jFDPtnRZnA qwT+QalE3JUyoRCgW6ApA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:OyNCwkcqWVk=:fnMCXM6qGiqalwHEgD8Iu2 pdyteGzjvepTLU+a3gAQMbqAZA+7QMp2r6Duc6ZGbHyBsvLRqjmRyEa8RPuMCpy4zJg8nSt2q 9NZRKRPGRykTQCCVwky0x4qJZ6zhOJXjP+z9dlHqcxrywdgoAcMOPrGibkrMEQhxCNC+/Xwvl S1TJ3gfoefECcdTdnEtUg8CUVdGEPTa5eaaOiUlneggP0hVD6RYYE/fPg9OVCpBICv0YqxfRb TshicGNuaCMyxlndntEGftdpt/cQCLNbKzlyNxSnwIXGST2AxFEn2+e4Koi+zrLAgx3yq8tEK AXigKZZr7JElicNSnXOAAq9uDVWMk9EV6l0wN5zZmOMqYPkDAbBZ+LscXN4B8UGUQRrNOHsjZ ZAt+2niyO+5EWFq4Zs+Ui5zONBpbxw4MiDOchKYerKvLuyr6RPMOIt+vyPbxzA9JNCr28IZrC S7b82gW4MQE359l+cI5RidYzYbMaDt4GteSbccTGYgIW5xa5PLYMY98/4thvelGEzNYBjbnRy VxQ0q1+sN/sRtpHEfx9YEte8Fjhs5Vx8cL1ThvWJf7PxnmXWqin//WwhlYAscLw+ZT1OQ5SIF FmC0A1Fxrzjdbofrt1Bo74vw8VdKyD7g4xMjxXlMPjjB5cHJoqAyI2uxcZzbjth40ZfxtY08X HVNXqZ3TNYDPmIFPcUo81haz7hCLWZR3/DWLQinW4+VRyS9nWS0sb7mK9yZ2ntWlrLZjByeCf GYKkMLUnW8IRzldjnvyioNNCGZVG2KYUfaCl3w== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Qiao Zhou In current die(), the irq is disabled for __die() handle, not including the possible panic() handling. Since the log in __die() can take several hundreds ms, new irq might come and interrupt current die(). If the process calling die() holds some critical resource, and some other process scheduled later also needs it, then it would deadlock. The first panic will not be executed. So here disable irq for the whole flow of die(). Signed-off-by: Qiao Zhou Signed-off-by: Will Deacon (cherry picked from commit 6f44a0bacb79a03972c83759711832b382b1b8ac) Signed-off-by: Arnd Bergmann --- arch/arm64/kernel/traps.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) -- 2.20.0 diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c index 5d270ca76aec..6b4579e07aa2 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -239,10 +239,12 @@ void die(const char *str, struct pt_regs *regs, int err) { struct thread_info *thread = current_thread_info(); int ret; + unsigned long flags; + + raw_spin_lock_irqsave(&die_lock, flags); oops_enter(); - raw_spin_lock_irq(&die_lock); console_verbose(); bust_spinlocks(1); ret = __die(str, err, thread, regs); @@ -252,13 +254,15 @@ void die(const char *str, struct pt_regs *regs, int err) bust_spinlocks(0); add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE); - raw_spin_unlock_irq(&die_lock); oops_exit(); if (in_interrupt()) panic("Fatal exception in interrupt"); if (panic_on_oops) panic("Fatal exception"); + + raw_spin_unlock_irqrestore(&die_lock, flags); + if (ret != NOTIFY_STOP) do_exit(SIGSEGV); } From patchwork Fri Mar 22 15:44:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160938 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp964222jan; Fri, 22 Mar 2019 08:50:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqxWAXhLKCT3DXVFsRkP6iXiIgxodfSVAEsC1alu+NCZgnUcGsvPsL+E/SHA1N3jVxY7XStn X-Received: by 2002:a63:2158:: with SMTP id s24mr1684369pgm.156.1553269820704; Fri, 22 Mar 2019 08:50:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553269820; cv=none; d=google.com; s=arc-20160816; b=Bq2rsZe1UTLgfNFqZvboLjt/enb1WrIlO2QZvV1hzOrzpdG2toIkTKbVN+2RDXxKp2 mJYY9rL1RvU72EpLx/vVGaYS+kkJUEsXpnJcBcWsJRRtjSKWNZ33w6AF/aio4+GtK4z6 z3+bRd/f7t8sKbAK5shHPYdAzz5jKNawWT+byf8piuUKFbC7j7YngIqvzKqHjckI4dBP 5+o7Bxpeb06YbFU4fAZFZWN4Wr+Egi1+WxGOf/NV8Bh/JfUVbeRPUOEw+ekzt69QMlu6 epR3Bt/J8Yzu+BBrBu7bJG9IAG9V6l5PlTKU6ZGADE5dRp+MqL15rN61l5hW7RLVFLMh 8SYw== 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=ADd/WlX24cMYXST+eM5ecQSFrL8rYUZAcSMyeV6d0fI=; b=SEWvuu7ppARVg7lsbYpHcsimXW3Nz+dzVVVHXT22EMnyP2Zxzkwr0oKgEJtbyJi77P yyltcgCF8bHwtZXrzhr+hyya0A13UndVbjAZl0vdsb/bDJG2rRv25M5TtqUj1Wms7PKU 9/Njs0qfJB5ElGwRJD0WdUBGIm3L4j7zFcHxiEMFsNH6StKfOWYkvj4SsJOcvXJPVk4Z R75/n+M52BSosFxq7Qi5YLlcVnjk80mpzo9gKXDNueer4hOmst2fgoQKhBdoG/1lOcGh bH8B74jfIBldcMKz2tiwANsx10WYa490mA+p70bKj3stjC228UkOox16MyEC6wsUQZG/ sRcQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o188si7021641pga.297.2019.03.22.08.50.20; Fri, 22 Mar 2019 08:50:20 -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; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728480AbfCVPuT (ORCPT + 31 others); Fri, 22 Mar 2019 11:50:19 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:45707 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727843AbfCVPuR (ORCPT ); Fri, 22 Mar 2019 11:50:17 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1MbRbr-1gaEfE3zyb-00bqAN; Fri, 22 Mar 2019 16:49:50 +0100 From: Arnd Bergmann To: stable@vger.kernel.org, Will Deacon , Florian La Roche Cc: Peter Zijlstra , Anshul Garg , Linus Torvalds , Davidlohr Bueso , Thomas Gleixner , Ingo Molnar , Joe Perches , David Miller , Matthew Wilcox , Kees Cook , Michael Davidson , Andrew Morton , Arnd Bergmann , linux-kernel@vger.kernel.org Subject: [BACKPORT 4.4.y 24/25] lib/int_sqrt: optimize small argument Date: Fri, 22 Mar 2019 16:44:15 +0100 Message-Id: <20190322154425.3852517-25-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:ihhiFo5aEMgWh25D9Bhc7/1vpeO4x1oikMd7eBfRIzsE2G0q9Gr hIr6QmP9RMez6Ix4DFFMIQDzR3YaedPi3Pz/K1W8ErI+BdhZVywglbZcwR6f+6SJT27oNm8 g1lGrthhnwWUDhmA10q3KnEkYDrWCtlwdZ320LWQYbCb/IEQT/+zYeBzFZsmA/cbli652aU JgBDPkDU+yn7METUKJ6wA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:qJH3pP5UbgI=:5C8uo+IYJWNbuNNH4ebN7V n+nS75jqFZYRqIoFCQJuhd0TKUszs2S1oxLhtAZZ2qw1FAGKe+PHCsAUkAj+pWLRZbwTy9oMO 1zjhMB6R4xJ27YZ+aiMCGtzxKTsu/hvRCKdfPQhq83Sj2ruvf6VmWAqypgwwolJDxWRXzi3QZ 0nz6xh65GlJfbrNJSbYL764ctj/c1X9NtyW/OUcqlxWWMGOPL67fErX6VNiQSpv1Q7VwnzSse pBodOqvkkOiNKioaSB3+SERQyrEAzMFI7VVA1vAoo5Mb2CGpkpM6dyX7DcaAk1FsbcDZHLum/ 5eHtD3DIDfsQDyXg63QDDIt+cBdFqFt8OBi/rZSAmotk700OJP3NmWnEtGJZl7P6vHW9dOeDC XBgDvomnu0vW2pmAwKle5/xZz2R/jlwBthWjnqXhpm2QPud/mMtvs2hX6zvuuFwew7+SAFI6a gGHNijLlQjhb6lC6QYRKaSSmt+Q7s6yMbcvrCO4lUA5QMhkfVMz086ERooqoCqc9GyG6xk6+F 6GmbJoOrolBgua1CPxiKQMtqUUiV7bkjrTXWXadJNkK+B+W8FrSUITKfmLH5BcIp7cREVQeLT HMc2bKZCYn8/b/7OJ/bcZaBbUurg+tg5pMDvBM90HjS+zPez3e2RkwUxcJSjm6jpsh/Eh2QCr aHhlGBFFYreiAceCa3bQBzjSYHbM3A7yHLqFWHaquOAXJK0FvtylFK0poLwjwGimBcYPOEiTZ Jq1hnSGHJTGHTBpUP3EVCwv+7F0ytysK1XPMZA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peter Zijlstra The current int_sqrt() computation is sub-optimal for the case of small @x. Which is the interesting case when we're going to do cumulative distribution functions on idle times, which we assume to be a random variable, where the target residency of the deepest idle state gives an upper bound on the variable (5e6ns on recent Intel chips). In the case of small @x, the compute loop: while (m != 0) { b = y + m; y >>= 1; if (x >= b) { x -= b; y += m; } m >>= 2; } can be reduced to: while (m > x) m >>= 2; Because y==0, b==m and until x>=m y will remain 0. And while this is computationally equivalent, it runs much faster because there's less code, in particular less branches. cycles: branches: branch-misses: OLD: hot: 45.109444 +- 0.044117 44.333392 +- 0.002254 0.018723 +- 0.000593 cold: 187.737379 +- 0.156678 44.333407 +- 0.002254 6.272844 +- 0.004305 PRE: hot: 67.937492 +- 0.064124 66.999535 +- 0.000488 0.066720 +- 0.001113 cold: 232.004379 +- 0.332811 66.999527 +- 0.000488 6.914634 +- 0.006568 POST: hot: 43.633557 +- 0.034373 45.333132 +- 0.002277 0.023529 +- 0.000681 cold: 207.438411 +- 0.125840 45.333132 +- 0.002277 6.976486 +- 0.004219 Averages computed over all values <128k using a LFSR to generate order. Cold numbers have a LFSR based branch trace buffer 'confuser' ran between each int_sqrt() invocation. Link: http://lkml.kernel.org/r/20171020164644.876503355@infradead.org Fixes: 30493cc9dddb ("lib/int_sqrt.c: optimize square root algorithm") Signed-off-by: Peter Zijlstra (Intel) Suggested-by: Anshul Garg Acked-by: Linus Torvalds Cc: Davidlohr Bueso Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Will Deacon Cc: Joe Perches Cc: David Miller Cc: Matthew Wilcox Cc: Kees Cook Cc: Michael Davidson Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds (cherry picked from commit 3f3295709edea6268ff1609855f498035286af73) Signed-off-by: Arnd Bergmann --- lib/int_sqrt.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.20.0 diff --git a/lib/int_sqrt.c b/lib/int_sqrt.c index 1ef4cc344977..1afb545a37c5 100644 --- a/lib/int_sqrt.c +++ b/lib/int_sqrt.c @@ -22,6 +22,9 @@ unsigned long int_sqrt(unsigned long x) return x; m = 1UL << (BITS_PER_LONG - 2); + while (m > x) + m >>= 2; + while (m != 0) { b = y + m; y >>= 1; From patchwork Fri Mar 22 15:44:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160939 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp964300jan; Fri, 22 Mar 2019 08:50:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqzepzI9OrUVUAzCzaYrve3wUjSK9TP3TiACuYrPttRbiltZC/Y1+uChK1MfrClzKc2hajfh X-Received: by 2002:a65:4342:: with SMTP id k2mr9717579pgq.445.1553269824456; Fri, 22 Mar 2019 08:50:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553269824; cv=none; d=google.com; s=arc-20160816; b=ePtUC8f/KL1nCtHty4BtZXClbqjU9Zh6cA7xiYCXq4jnAafmJ1FwO6HcxHsrb5gkF4 XdswAKogN7y1PcU2EAR3k8zVAaKhOkbYkYps9fa3mbvFOn8QQuK+nJdRQK7uW9unomco 8NjSCMUvp0kiF+K2RXLAYgWrAEos5pvumg08sovnijUzMJ7YwntYtmyBQX86tMoVhv6K O7HJuF2XtMSCQyTRcfQ/VzqqvWH7cQ8QTYg2TMoTJWY/E8j303vTGeUfrYOAvaiB4Oia 6ZrFACbWyOXNtCqcIWQEdfjb+pU15x4utttFDSxGYaWQ2DZNlISltlwTcbbvGBLPDKv1 oMaQ== 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=u03V/k9CCib2fY1K/DbNm63eicf3FNTMCG4j640J+y0=; b=SMFF2RWhutA63Hwv0RmbYHkIY1fmvcwcLd9twh1R/ZDEU6q4hFVrOZjll+AfPqbyR0 MXk2uuOzfm1RiMQRyCezamQ5xa1fLNC8Q7NaFUSkd2ZVUcYvfslTCxQgMRltYkHayOk0 bzyBPX3K3VfqTxNoEE6a/veoshmH2fDZsbW5TlHeTkd2StS3ICiQiqDBlsE4iDLWHAld u/O7x6bGd9XxQrlLjwLq0rZ9zOKW1R+fkqXYSmANxajpHSrCg0cW2YOX7OvX4x0Yfxce DG0OmZdG8qGILpJNSY91IuPrG4Mam7blddLrw9hv+jyiahtc4EMz2hoPeSv9IHlbD/Se lq7g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c22si7093101pgj.405.2019.03.22.08.50.24; Fri, 22 Mar 2019 08:50:24 -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; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728129AbfCVPuS (ORCPT + 31 others); Fri, 22 Mar 2019 11:50:18 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:40055 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727696AbfCVPuR (ORCPT ); Fri, 22 Mar 2019 11:50:17 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1N8XLj-1gu9844C3d-014W3f; Fri, 22 Mar 2019 16:50:02 +0100 From: Arnd Bergmann To: stable@vger.kernel.org, Greg Kroah-Hartman , Alan Stern , Suwan Kim , "Gustavo A. R. Silva" Cc: Andrey Konovalov , Arnd Bergmann , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [BACKPORT 4.4.y 25/25] USB: core: only clean up what we allocated Date: Fri, 22 Mar 2019 16:44:16 +0100 Message-Id: <20190322154425.3852517-26-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:wMbSPcHeSmT84A30VtzrJGakHf9ZFJmOTa7BcDHtx3x+ETBZjeh g1H/1BcB1LCrojY2Jz+mQUWSKoezbqp0L5g+iL2aDa/1oYctHJsCCJTDKta7kganqTUCiGT WbKhG6iBsGx1g/hvksxHEEYIHbL42951pU922HTHUGc825K3zatuFLlhqb1fV0TgtqHMmz0 C55FXJMdjpfPIcCx2UNvg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:lwFKb9FP7Ag=:jlGQtNhVji5W71GscMmPXR tuf4mA//DTvfP3p2NjiHpVVvxrCE43li+qSBjKknSL06/G4ocjZE62mANptUCT/+CjP6ut8qZ lY59K8HuRhWsQAkqlLHPC5FdpABgBZKLrOWOcWPG+NLeWrhxldZcBsZECpNavRZmjHMLY6IfH 67E6f597G988MU9VtO4ixky/jn/W1ty6xApNpFVBvF7QsHCc3EN9fQ8XRXVdlwCYh3eKs5sh8 b2LsR+Ja4vHZoArcvWQ0S44Y3tRMyXfs01slU1tncNrjkbCxu5mBgFxdRJY2t9+we50ZGgo71 py9ka778ry8OF1EsAM+b7Cu3/EKg+ZA9Pk4Chj9RO4M7vWFhVI0plzVrd4RtOgmyQXC9/cG5R BsI3nWY0BmtBTltL6dTrxJWj8E/PkORh8t6YEpWNhJB4AbrbfWUS5OzuhZKE2Gio93X0Fwhk4 YHZy0QHTkf8uS8hJWlO51Ykg3QPAcDfXmohlPUtnzMMhlNMkccie8korS0q2qeHlL9VnMeTF6 VowTtsmbW+2wjQEZegYRtgOItZlwI2JqBa0mtJEMhGilHeKMsDdoee8xaW2GamKoabh5rzb3V rkFfg3GgOOmxE3Tur9jkqaSuRkYqo7Ou8yTBVHybhSNQbOwGvf9VAV3yyxNuDxrzXa3Dw4cSA xWhM4DWZupT3PiVVp4tjgV4ER23WtTgsSUGaIo7tofDdeVErCeZzQJFftBaFjpIikxX7u10mG VqfYIeF6jZgR0EO0itBKLSK7IWaxe30qqnBYeA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrey Konovalov When cleaning up the configurations, make sure we only free the number of configurations and interfaces that we could have allocated. Reported-by: Andrey Konovalov Cc: stable Signed-off-by: Greg Kroah-Hartman (cherry picked from commit 32fd87b3bbf5f7a045546401dfe2894dbbf4d8c3) Signed-off-by: Arnd Bergmann --- drivers/usb/core/config.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- 2.20.0 diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index 6a287c81a7be..b8eb289e0b17 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c @@ -734,18 +734,21 @@ void usb_destroy_configuration(struct usb_device *dev) return; if (dev->rawdescriptors) { - for (i = 0; i < dev->descriptor.bNumConfigurations; i++) + for (i = 0; i < dev->descriptor.bNumConfigurations && + i < USB_MAXCONFIG; i++) kfree(dev->rawdescriptors[i]); kfree(dev->rawdescriptors); dev->rawdescriptors = NULL; } - for (c = 0; c < dev->descriptor.bNumConfigurations; c++) { + for (c = 0; c < dev->descriptor.bNumConfigurations && + c < USB_MAXCONFIG; c++) { struct usb_host_config *cf = &dev->config[c]; kfree(cf->string); - for (i = 0; i < cf->desc.bNumInterfaces; i++) { + for (i = 0; i < cf->desc.bNumInterfaces && + i < USB_MAXINTERFACES; i++) { if (cf->intf_cache[i]) kref_put(&cf->intf_cache[i]->ref, usb_release_interface_cache);