From patchwork Fri Jan 22 14:10:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 369352 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7E0BC4360C for ; Fri, 22 Jan 2021 19:59:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B501523AFC for ; Fri, 22 Jan 2021 19:59:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730770AbhAVT6q (ORCPT ); Fri, 22 Jan 2021 14:58:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:34630 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728281AbhAVOOF (ORCPT ); Fri, 22 Jan 2021 09:14:05 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id CA0CD23AFC; Fri, 22 Jan 2021 14:11:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1611324675; bh=fV0iDRVrMGtQYDtd/ql9LA/wBJZHRY4wKgd9k3vp0dw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bh20kNRUT8bo220S9zjALPo1BpIkRuKwuVASRZLYw8ogkLIZjvOLbPIdfTGUhfRMx gp4UCap+EFP7Qxs5WPtvp+fbRdD7nkDv9lHoanAzmaRsrrNfByzVGrOTDdcq3CZ1At rvSGNdYvYPtQwmtq0O+M3fpDeKoVmfSstn2BLg7Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Al Viro , Thomas Bogendoerfer , stable@kernel.org Subject: [PATCH 4.9 03/35] MIPS: Fix malformed NT_FILE and NT_SIGINFO in 32bit coredumps Date: Fri, 22 Jan 2021 15:10:05 +0100 Message-Id: <20210122135732.489413612@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210122135732.357969201@linuxfoundation.org> References: <20210122135732.357969201@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Al Viro commit 698222457465ce343443be81c5512edda86e5914 upstream. Patches that introduced NT_FILE and NT_SIGINFO notes back in 2012 had taken care of native (fs/binfmt_elf.c) and compat (fs/compat_binfmt_elf.c) coredumps; unfortunately, compat on mips (which does not go through the usual compat_binfmt_elf.c) had not been noticed. As the result, both N32 and O32 coredumps on 64bit mips kernels have those sections malformed enough to confuse the living hell out of all gdb and readelf versions (up to and including the tip of binutils-gdb.git). Longer term solution is to make both O32 and N32 compat use the regular compat_binfmt_elf.c, but that's too much for backports. The minimal solution is to do in arch/mips/kernel/binfmt_elf[on]32.c the same thing those patches have done in fs/compat_binfmt_elf.c Cc: stable@kernel.org # v3.7+ Signed-off-by: Al Viro Signed-off-by: Thomas Bogendoerfer Signed-off-by: Greg Kroah-Hartman --- arch/mips/kernel/binfmt_elfn32.c | 7 +++++++ arch/mips/kernel/binfmt_elfo32.c | 7 +++++++ 2 files changed, 14 insertions(+) --- a/arch/mips/kernel/binfmt_elfn32.c +++ b/arch/mips/kernel/binfmt_elfn32.c @@ -110,4 +110,11 @@ cputime_to_compat_timeval(const cputime_ value->tv_sec = jiffies / HZ; } +/* + * Some data types as stored in coredump. + */ +#define user_long_t compat_long_t +#define user_siginfo_t compat_siginfo_t +#define copy_siginfo_to_external copy_siginfo_to_external32 + #include "../../../fs/binfmt_elf.c" --- a/arch/mips/kernel/binfmt_elfo32.c +++ b/arch/mips/kernel/binfmt_elfo32.c @@ -113,4 +113,11 @@ cputime_to_compat_timeval(const cputime_ value->tv_sec = jiffies / HZ; } +/* + * Some data types as stored in coredump. + */ +#define user_long_t compat_long_t +#define user_siginfo_t compat_siginfo_t +#define copy_siginfo_to_external copy_siginfo_to_external32 + #include "../../../fs/binfmt_elf.c" From patchwork Fri Jan 22 14:10:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 369350 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45505C43142 for ; Fri, 22 Jan 2021 19:59:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 183A223B08 for ; Fri, 22 Jan 2021 19:59:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730788AbhAVT6s (ORCPT ); Fri, 22 Jan 2021 14:58:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:35774 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728293AbhAVOOG (ORCPT ); Fri, 22 Jan 2021 09:14:06 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4082523AC6; Fri, 22 Jan 2021 14:11:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1611324677; bh=xuse8mD2fn4+OxDh5gK8LjZ2y3Ni6AKx2FxEklsL1Fo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=np02vADBNdFd6mBr8tjyoHWWe39U/Ul4vGd1+X4NcIrjVT4aHgLFEC4oUBZ7DXXrx sN0PuBRi40BUlwmgwRDQYz6rOiN563mHXWveDHm5eOzGYQqADy+Kwikvcf/Mo5ZsbI w6tbU32/dEulYkMtr+mKFru22JxLYX0UkZWd2SdQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Lobakin , Nathan Chancellor , Kees Cook , Thomas Bogendoerfer Subject: [PATCH 4.9 04/35] MIPS: relocatable: fix possible boot hangup with KASLR enabled Date: Fri, 22 Jan 2021 15:10:06 +0100 Message-Id: <20210122135732.522243955@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210122135732.357969201@linuxfoundation.org> References: <20210122135732.357969201@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Alexander Lobakin commit 69e976831cd53f9ba304fd20305b2025ecc78eab upstream. LLVM-built Linux triggered a boot hangup with KASLR enabled. arch/mips/kernel/relocate.c:get_random_boot() uses linux_banner, which is a string constant, as a random seed, but accesses it as an array of unsigned long (in rotate_xor()). When the address of linux_banner is not aligned to sizeof(long), such access emits unaligned access exception and hangs the kernel. Use PTR_ALIGN() to align input address to sizeof(long) and also align down the input length to prevent possible access-beyond-end. Fixes: 405bc8fd12f5 ("MIPS: Kernel: Implement KASLR using CONFIG_RELOCATABLE") Cc: stable@vger.kernel.org # 4.7+ Signed-off-by: Alexander Lobakin Tested-by: Nathan Chancellor Reviewed-by: Kees Cook Signed-off-by: Thomas Bogendoerfer Signed-off-by: Greg Kroah-Hartman --- arch/mips/kernel/relocate.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) --- a/arch/mips/kernel/relocate.c +++ b/arch/mips/kernel/relocate.c @@ -175,8 +175,14 @@ static int __init relocate_exception_tab static inline __init unsigned long rotate_xor(unsigned long hash, const void *area, size_t size) { - size_t i; - unsigned long *ptr = (unsigned long *)area; + const typeof(hash) *ptr = PTR_ALIGN(area, sizeof(hash)); + size_t diff, i; + + diff = (void *)ptr - area; + if (unlikely(size < diff + sizeof(hash))) + return hash; + + size = ALIGN_DOWN(size - diff, sizeof(hash)); for (i = 0; i < size / sizeof(hash); i++) { /* Rotate by odd number of bits and XOR. */ From patchwork Fri Jan 22 14:10:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 369426 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDD1CC433DB for ; Fri, 22 Jan 2021 14:15:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9331923AC0 for ; Fri, 22 Jan 2021 14:15:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728180AbhAVOO5 (ORCPT ); Fri, 22 Jan 2021 09:14:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:35858 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728358AbhAVON2 (ORCPT ); Fri, 22 Jan 2021 09:13:28 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5364E23AA3; Fri, 22 Jan 2021 14:10:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1611324646; bh=zPb3uoCMpMg0zIdBDDDosH3CoWb00JMVhzJ0D614Sfo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u83cQdirnwFeD9/ilIBOM6VMOBOesrM++RGq45UGlM8dl4Cs0PsMUNWKcWWMdjIDy 7HpOe+X+zuGvV+lPjHPePjD7dm1Cegb0f/hdywddkJlUkEaehyb9VI2R/rah0gndIY jK9XPJRg5YwsDCNhfyQ769+Xm8dCS+vIqahFb18A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Randy Dunlap , Vineet Gupta , linux-snps-arc@lists.infradead.org, Dan Williams , Andrew Morton , Matthew Wilcox , Jan Kara , linux-fsdevel@vger.kernel.org, linux-nvdimm@lists.01.org, Sasha Levin Subject: [PATCH 4.9 10/35] arch/arc: add copy_user_page() to to fix build error on ARC Date: Fri, 22 Jan 2021 15:10:12 +0100 Message-Id: <20210122135732.747017067@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210122135732.357969201@linuxfoundation.org> References: <20210122135732.357969201@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Randy Dunlap [ Upstream commit 8a48c0a3360bf2bf4f40c980d0ec216e770e58ee ] fs/dax.c uses copy_user_page() but ARC does not provide that interface, resulting in a build error. Provide copy_user_page() in . ../fs/dax.c: In function 'copy_cow_page_dax': ../fs/dax.c:702:2: error: implicit declaration of function 'copy_user_page'; did you mean 'copy_to_user_page'? [-Werror=implicit-function-declaration] Reported-by: kernel test robot Signed-off-by: Randy Dunlap Cc: Vineet Gupta Cc: linux-snps-arc@lists.infradead.org Cc: Dan Williams #Acked-by: Vineet Gupta # v1 Cc: Andrew Morton Cc: Matthew Wilcox Cc: Jan Kara Cc: linux-fsdevel@vger.kernel.org Cc: linux-nvdimm@lists.01.org #Reviewed-by: Ira Weiny # v2 Signed-off-by: Vineet Gupta Signed-off-by: Sasha Levin --- arch/arc/include/asm/page.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arc/include/asm/page.h b/arch/arc/include/asm/page.h index ffb5f33475f19..f0f43eb709d2f 100644 --- a/arch/arc/include/asm/page.h +++ b/arch/arc/include/asm/page.h @@ -13,6 +13,7 @@ #ifndef __ASSEMBLY__ #define clear_page(paddr) memset((paddr), 0, PAGE_SIZE) +#define copy_user_page(to, from, vaddr, pg) copy_page(to, from) #define copy_page(to, from) memcpy((to), (from), PAGE_SIZE) struct vm_area_struct; From patchwork Fri Jan 22 14:10:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 368668 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp1808805jam; Fri, 22 Jan 2021 11:59:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJx2Bw5Gx+XNRtJBBvWQbJsNfDGlooMWO3uUolgHr+4wNmj5cDoCslKIMDnr6fHDYKs0DIgx X-Received: by 2002:a17:906:a20e:: with SMTP id r14mr4023664ejy.404.1611345549202; Fri, 22 Jan 2021 11:59:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611345549; cv=none; d=google.com; s=arc-20160816; b=ul65mKMGLUSzGipqjE2wmdiYmOdwf9tcKyIiliHC6rn3jlAy6hK6FXEIs3vkLlRfzY lmdCuXLecukrgxsPXB5yzsfsN52yDTvusmo11o62ONgQLwsUDuMfnakmR/+FRGmZ/Y6w gewrZkUxvOuFrxO5UsIQm9KKm283Tfal0jSu6LGlVZ3io8Gsb9fsxltJjDoeShmmV2Pe bH/JTQA0mj5vSLzJTyfM7fjQarsertZP02YAKyx+OyJ5z8bejdtH3IN/7tqMc8UVQfGM Ke61K4Xn2CKgl8Usv/oyx28ftLHLRRP+ExralZA6xbwem6mtPEfeMQapqJ28JcFBV9Mi U3mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QrGS2J4RzcXdWWqKw1/kaJ+kc0Yq4hkk+cIyL+6Ghxo=; b=IMtF6f9YKaOECDyZg6wNPx+OwaSqbugffhw769VP3qGs1+jkG91QAcFb6xRqdIB38+ XOzkCSDClfglRh3WOun3iMNevwEqJzI/2mSajHJv/CMnjgAt+0Pg+oU8mMKlH1J5tX0U DvXzceSV6Xgq5ZQWjsBOL74as2SQuiGMHhcIobdpH1G3Xjmt6+08tStASClNubWK3DQd OqjFJ+oQOSMaprCrPE30L4V5mAXwSxKy4IuL4TwcC8Ivf7lWpNsohJHjjTKf/Ja/RytP bplp+Bz+93XGVkQ9Fbp5NfBZ9EYdeYX1+AFubJJ+z5WS9UUuCy3rIKDNuWIheH55ZtQ0 N6dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="QPR/G+qr"; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b1si3610227ejb.314.2021.01.22.11.59.09; Fri, 22 Jan 2021 11:59:09 -0800 (PST) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="QPR/G+qr"; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730738AbhAVT6k (ORCPT + 13 others); Fri, 22 Jan 2021 14:58:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:34362 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728341AbhAVONH (ORCPT ); Fri, 22 Jan 2021 09:13:07 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0928F23AA7; Fri, 22 Jan 2021 14:10:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1611324648; bh=K5UVOAFSVMpxnx58cB+TImbkULMojURm5Eon9UXNVrI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QPR/G+qr2jMWJ0t3yKlWllh8BWSreUuv7FEtUrOGWHgpCFF+SxrqqckRVg/2Z3fkm Pp4yKr5EGjiseh2y2HyhEiT8yhUSpjKNg6Y8dMIyGzRJpjbbYkAb7kSZcamt6PL+vC 5nFZUBSLuMDMv9V7aulitAaere3ArpqHDn7bF45k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , "David S. Miller" , Sasha Levin Subject: [PATCH 4.9 11/35] misdn: dsp: select CONFIG_BITREVERSE Date: Fri, 22 Jan 2021 15:10:13 +0100 Message-Id: <20210122135732.784925911@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210122135732.357969201@linuxfoundation.org> References: <20210122135732.357969201@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Arnd Bergmann [ Upstream commit 51049bd903a81307f751babe15a1df8d197884e8 ] Without this, we run into a link error arm-linux-gnueabi-ld: drivers/isdn/mISDN/dsp_audio.o: in function `dsp_audio_generate_law_tables': (.text+0x30c): undefined reference to `byte_rev_table' arm-linux-gnueabi-ld: drivers/isdn/mISDN/dsp_audio.o:(.text+0x5e4): more undefined references to `byte_rev_table' follow Signed-off-by: Arnd Bergmann Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/isdn/mISDN/Kconfig | 1 + 1 file changed, 1 insertion(+) -- 2.27.0 diff --git a/drivers/isdn/mISDN/Kconfig b/drivers/isdn/mISDN/Kconfig index c0730d5c734d6..fb61181a5c4f7 100644 --- a/drivers/isdn/mISDN/Kconfig +++ b/drivers/isdn/mISDN/Kconfig @@ -12,6 +12,7 @@ if MISDN != n config MISDN_DSP tristate "Digital Audio Processing of transparent data" depends on MISDN + select BITREVERSE help Enable support for digital audio processing capability. From patchwork Fri Jan 22 14:10:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 368644 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp1552742jam; Fri, 22 Jan 2021 06:15:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJyFnUvlveVQ4Bm5uVzLTp+VhFnC6H5PgRQN11ulDBW7fdnJX9T13dxrr6Sm56ntgowo/NxC X-Received: by 2002:a17:906:4b48:: with SMTP id j8mr3069129ejv.112.1611324948083; Fri, 22 Jan 2021 06:15:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611324948; cv=none; d=google.com; s=arc-20160816; b=a6srwa/h8+E66T2gJnACckFuwouRAAjOfncJgV3kb+/iY0uesjSHazqjY9RmM4iO7q pGVjGAIrS22CAWVh8TOhufErM0h042sPBbVsCm2h+ilOvNMwrKrcaY4E/3TO0lQhPTJT /2DU8PosvgULDWIg9hN5x1Op319fgKE2pF47128Q3aWFcaO0oMcG9+AbcrUU5vRUOJMU yeTJApzhZpun/V2/93ZSlPjVIr1Tzn6OS0/TyOsQQc92ASX0qz/rFrt6iVk1EGO/76Zh dmTYqve1LFIbNcpUcHH44HewGfwO9rYg90M8hkgPIE+KLz83SDua5QuBj/viVW+8ZQHv fvCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=baASubQWI4RmvIYWz3q14mpPScMdoE2eOs3LMUcn/+k=; b=aP8JmNVnAjb20bN+Q5R+pf2tdTAgbLfKzpXIeT0MDLLifbJ8S+bLxXooh4CfHi8oBf FO4FNwlRfKm+uKEgIFFjOl0kfX9NwRmF6ju0L8hhWZzh6z8HCfxyi+GmgyPbYcFjvnUu 1Ef+VjHRVbAUMgzOGCAPaSVVKY7wMU/w6zLmUTiGFKvgbEidt/CNlyTk2gVVeieMZTt7 FN4e1vY2Vbwv8oIdWdPv4Hq4lhqJz38P21pzLvGBNlWQygqmzts+tTznFZRGLn1+kUir iHBfL4nbiuOmOUy7ZCYmH8XweOP9tHrsC7yZ+LoXG39Q/qwLNG28YjCel7yqNWTvV3OM 6+9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HIijDS0d; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kw25si2061969ejc.150.2021.01.22.06.15.47; Fri, 22 Jan 2021 06:15:48 -0800 (PST) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HIijDS0d; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728391AbhAVOOd (ORCPT + 13 others); Fri, 22 Jan 2021 09:14:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:34940 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728342AbhAVONI (ORCPT ); Fri, 22 Jan 2021 09:13:08 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8301123AAC; Fri, 22 Jan 2021 14:10:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1611324654; bh=wSiP5Yy3ak9NSXoHC+m4cI2NMDPxDip38q1+sFbQ5dU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HIijDS0dmOM2MM42x3j9moF5tmaNRhKKAwhliNHHjCjpiJQp5RBecgUsGg2G4UzV/ W0/iqWEmKECqhT2OrsSJNCMRle5lK9SmpIdXlEjiS2cSAMMOS1yEtLpv+rTPOg3jIz DxNPs8vnVjVt3zvYZj70yNa2YdIt5uc0VgFCRzao= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Shawn Guo , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 4.9 13/35] ACPI: scan: add stub acpi_create_platform_device() for !CONFIG_ACPI Date: Fri, 22 Jan 2021 15:10:15 +0100 Message-Id: <20210122135732.865260300@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210122135732.357969201@linuxfoundation.org> References: <20210122135732.357969201@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Shawn Guo [ Upstream commit ee61cfd955a64a58ed35cbcfc54068fcbd486945 ] It adds a stub acpi_create_platform_device() for !CONFIG_ACPI build, so that caller doesn't have to deal with !CONFIG_ACPI build issue. Reported-by: kernel test robot Signed-off-by: Shawn Guo Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- include/linux/acpi.h | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.27.0 diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 5670bb9788bb4..192b045cc56ec 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -734,6 +734,13 @@ static inline int acpi_device_modalias(struct device *dev, return -ENODEV; } +static inline struct platform_device * +acpi_create_platform_device(struct acpi_device *adev, + struct property_entry *properties) +{ + return NULL; +} + static inline bool acpi_dma_supported(struct acpi_device *adev) { return false; From patchwork Fri Jan 22 14:10:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 368670 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp1808823jam; Fri, 22 Jan 2021 11:59:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJynHbS7i+EAR504pT+WF5BGbKQTiCM3mlKqErFyCYC5esBW+kcSzDIrCrXMezBeDd7UZVev X-Received: by 2002:a17:907:7346:: with SMTP id dq6mr4356882ejc.237.1611345550472; Fri, 22 Jan 2021 11:59:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611345550; cv=none; d=google.com; s=arc-20160816; b=UvizXmAXhENl/v4fRX4TdSzGD0cgoO1B47/myjHfQzGMPBv6iL9XQAxf4/88cbRei8 rZ4l0koOWFKPwCHG0el2eA7hSKEUCkrY7sT7bnBKme/SeGJwZf0IQ3SR3CFIAAmoAEWW 1FDbNLsUbjhgAvaRar/Txg0FEWj9J8PB8+3P8iyvJ1/Vq0jTQgVqA7RE+07u3a3mDaw5 MJ6uLOJiBQAuPC+c6mK98xrVHSjOSfJ++Q1CBjJghDjmE/AdFqnrDRSgLbr/g1RwpJDP ZJNUj55aMOUAtB7eDOuABiHLCWRs95BhNpWzJXYwbJnC19A7hBhavtq6Nw1U7omNSgnL +dIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IOWfOvEedUOAuVxMChUMdxk52UmgQ6TSKzEtd4z6aLA=; b=MtYhWhHg89Nk0rpCmDrKAWYXizgo/qgcn3Pp0V7mRimZoNlSOeyuji8UsN09EdGsy8 ytJck5RoOCbwPufePOakJa/7IY+fYWXW2I+tMhwLZLUMiuQCyvVtPcKQ263mDrAJKY/Y klhyPvJ1U1YarzePyFHbDmYFWVgc5cQGxN5fRbEGSDVBCpXgTzQWEAPZXS2x824coK6t w0WWNNdFiP1g3jXlNMCXrJuqpRP8l/wZ4sbhonk5Un507Qt41e3y224lNRCkY1jh14as ehpbSd/XPKU5nsW6lcSOKAKAqsafl/D5L8k8L2AzgzqJbiZLnLX0TdSpuPlkqwoOouLf qRVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sBzvpUg9; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b1si3610227ejb.314.2021.01.22.11.59.10; Fri, 22 Jan 2021 11:59:10 -0800 (PST) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sBzvpUg9; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730755AbhAVT6o (ORCPT + 13 others); Fri, 22 Jan 2021 14:58:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:34950 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728411AbhAVONy (ORCPT ); Fri, 22 Jan 2021 09:13:54 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id F166623ABA; Fri, 22 Jan 2021 14:10:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1611324656; bh=i4Nmwe5miPe3Gw6FrnUEcFoxmdlKxZr3pmtpSqvRZP8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sBzvpUg933cNNfA0BYFvpHWsFUo9qhpQNerxQB4REiuh8P7AP00qzA4XnHwmcnGLh cZLad0wl8ppvkbsO+GXArT6QP4xKKvtDh5A6Hm+PNjMFqAsCw1CLbCYFaFVp0KqByA TdEHyZJHslc8wBAoOb/zOaRXH9DdG0hzG2qXzjOs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jamie Iles , Arnd Bergmann , Sasha Levin Subject: [PATCH 4.9 14/35] ARM: picoxcell: fix missing interrupt-parent properties Date: Fri, 22 Jan 2021 15:10:16 +0100 Message-Id: <20210122135732.901519809@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210122135732.357969201@linuxfoundation.org> References: <20210122135732.357969201@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Arnd Bergmann [ Upstream commit bac717171971176b78c72d15a8b6961764ab197f ] dtc points out that the interrupts for some devices are not parsable: picoxcell-pc3x2.dtsi:45.19-49.5: Warning (interrupts_property): /paxi/gem@30000: Missing interrupt-parent picoxcell-pc3x2.dtsi:51.21-55.5: Warning (interrupts_property): /paxi/dmac@40000: Missing interrupt-parent picoxcell-pc3x2.dtsi:57.21-61.5: Warning (interrupts_property): /paxi/dmac@50000: Missing interrupt-parent picoxcell-pc3x2.dtsi:233.21-237.5: Warning (interrupts_property): /rwid-axi/axi2pico@c0000000: Missing interrupt-parent There are two VIC instances, so it's not clear which one needs to be used. I found the BSP sources that reference VIC0, so use that: https://github.com/r1mikey/meta-picoxcell/blob/master/recipes-kernel/linux/linux-picochip-3.0/0001-picoxcell-support-for-Picochip-picoXcell-SoC.patch Acked-by: Jamie Iles Link: https://lore.kernel.org/r/20201230152010.3914962-1-arnd@kernel.org' Signed-off-by: Arnd Bergmann Signed-off-by: Sasha Levin --- arch/arm/boot/dts/picoxcell-pc3x2.dtsi | 4 ++++ 1 file changed, 4 insertions(+) -- 2.27.0 diff --git a/arch/arm/boot/dts/picoxcell-pc3x2.dtsi b/arch/arm/boot/dts/picoxcell-pc3x2.dtsi index 533919e96eaee..f22a6b4363177 100644 --- a/arch/arm/boot/dts/picoxcell-pc3x2.dtsi +++ b/arch/arm/boot/dts/picoxcell-pc3x2.dtsi @@ -54,18 +54,21 @@ emac: gem@30000 { compatible = "cadence,gem"; reg = <0x30000 0x10000>; + interrupt-parent = <&vic0>; interrupts = <31>; }; dmac1: dmac@40000 { compatible = "snps,dw-dmac"; reg = <0x40000 0x10000>; + interrupt-parent = <&vic0>; interrupts = <25>; }; dmac2: dmac@50000 { compatible = "snps,dw-dmac"; reg = <0x50000 0x10000>; + interrupt-parent = <&vic0>; interrupts = <26>; }; @@ -243,6 +246,7 @@ axi2pico@c0000000 { compatible = "picochip,axi2pico-pc3x2"; reg = <0xc0000000 0x10000>; + interrupt-parent = <&vic0>; interrupts = <13 14 15 16 17 18 19 20 21>; }; }; From patchwork Fri Jan 22 14:10:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 369424 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E32B4C433E0 for ; Fri, 22 Jan 2021 14:16:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AD95623B54 for ; Fri, 22 Jan 2021 14:16:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728433AbhAVOPs (ORCPT ); Fri, 22 Jan 2021 09:15:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:34366 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728183AbhAVOOD (ORCPT ); Fri, 22 Jan 2021 09:14:03 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9EEEE23AC1; Fri, 22 Jan 2021 14:10:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1611324659; bh=RfXmZ9Gx+ULMjintZ0Lsyrle7fyHNHloyqVyW5RFdtc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NnMW5hpMG4xCsTFByukOoT+9u57eqoHdcUnJN7pVx5vGgHyAqNiDwXa7vnQOsSgEi 9w9aSRsvizhIKzrSCyrdXH2z9j7H3NdW0kN2jqrSeuN+5xBindrlzbhlVgKHSCEO/W duPgP0WwQ/d9jQHhNRFKcPcS+QZBndAIJmWMbOhA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rodrigo Rivas Costa , =?utf-8?q?Cl=C3=A9ment_VUCHENER?= , Dmitry Torokhov Subject: [PATCH 4.9 15/35] Input: uinput - avoid FF flush when destroying device Date: Fri, 22 Jan 2021 15:10:17 +0100 Message-Id: <20210122135732.941351562@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210122135732.357969201@linuxfoundation.org> References: <20210122135732.357969201@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dmitry Torokhov commit e8b95728f724797f958912fd9b765a695595d3a6 upstream. Normally, when input device supporting force feedback effects is being destroyed, we try to "flush" currently playing effects, so that the physical device does not continue vibrating (or executing other effects). Unfortunately this does not work well for uinput as flushing of the effects deadlocks with the destroy action: - if device is being destroyed because the file descriptor is being closed, then there is noone to even service FF requests; - if device is being destroyed because userspace sent UI_DEV_DESTROY, while theoretically it could be possible to service FF requests, userspace is unlikely to do so (they'd need to make sure FF handling happens on a separate thread) even if kernel solves the issue with FF ioctls deadlocking with UI_DEV_DESTROY ioctl on udev->mutex. To avoid lockups like the one below, let's install a custom input device flush handler, and avoid trying to flush force feedback effects when we destroying the device, and instead rely on uinput to shut off the device properly. NMI watchdog: Watchdog detected hard LOCKUP on cpu 3 ... <> [] _raw_spin_lock_irqsave+0x37/0x40 [] complete+0x1d/0x50 [] uinput_request_done+0x3c/0x40 [uinput] [] uinput_request_submit.part.7+0x47/0xb0 [uinput] [] uinput_dev_erase_effect+0x5b/0x76 [uinput] [] erase_effect+0xad/0xf0 [] flush_effects+0x4d/0x90 [] input_flush_device+0x40/0x60 [] evdev_cleanup+0xac/0xc0 [] evdev_disconnect+0x2b/0x60 [] __input_unregister_device+0xac/0x150 [] input_unregister_device+0x47/0x70 [] uinput_destroy_device+0xb5/0xc0 [uinput] [] uinput_ioctl_handler.isra.9+0x65e/0x740 [uinput] [] ? do_futex+0x12b/0xad0 [] uinput_ioctl+0x18/0x20 [uinput] [] do_vfs_ioctl+0x298/0x480 [] ? security_file_ioctl+0x43/0x60 [] SyS_ioctl+0x79/0x90 [] entry_SYSCALL_64_fastpath+0x12/0x71 Reported-by: Rodrigo Rivas Costa Reported-by: Clément VUCHENER Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=193741 Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/ff-core.c | 13 ++++++++++--- drivers/input/misc/uinput.c | 18 ++++++++++++++++++ include/linux/input.h | 1 + 3 files changed, 29 insertions(+), 3 deletions(-) --- a/drivers/input/ff-core.c +++ b/drivers/input/ff-core.c @@ -237,9 +237,15 @@ int input_ff_erase(struct input_dev *dev EXPORT_SYMBOL_GPL(input_ff_erase); /* - * flush_effects - erase all effects owned by a file handle + * input_ff_flush - erase all effects owned by a file handle + * @dev: input device to erase effect from + * @file: purported owner of the effects + * + * This function erases all force-feedback effects associated with + * the given owner from specified device. Note that @file may be %NULL, + * in which case all effects will be erased. */ -static int flush_effects(struct input_dev *dev, struct file *file) +int input_ff_flush(struct input_dev *dev, struct file *file) { struct ff_device *ff = dev->ff; int i; @@ -255,6 +261,7 @@ static int flush_effects(struct input_de return 0; } +EXPORT_SYMBOL_GPL(input_ff_flush); /** * input_ff_event() - generic handler for force-feedback events @@ -343,7 +350,7 @@ int input_ff_create(struct input_dev *de mutex_init(&ff->mutex); dev->ff = ff; - dev->flush = flush_effects; + dev->flush = input_ff_flush; dev->event = input_ff_event; __set_bit(EV_FF, dev->evbit); --- a/drivers/input/misc/uinput.c +++ b/drivers/input/misc/uinput.c @@ -231,6 +231,18 @@ static int uinput_dev_erase_effect(struc return uinput_request_submit(udev, &request); } +static int uinput_dev_flush(struct input_dev *dev, struct file *file) +{ + /* + * If we are called with file == NULL that means we are tearing + * down the device, and therefore we can not handle FF erase + * requests: either we are handling UI_DEV_DESTROY (and holding + * the udev->mutex), or the file descriptor is closed and there is + * nobody on the other side anymore. + */ + return file ? input_ff_flush(dev, file) : 0; +} + static void uinput_destroy_device(struct uinput_device *udev) { const char *name, *phys; @@ -298,6 +310,12 @@ static int uinput_create_device(struct u dev->ff->playback = uinput_dev_playback; dev->ff->set_gain = uinput_dev_set_gain; dev->ff->set_autocenter = uinput_dev_set_autocenter; + /* + * The standard input_ff_flush() implementation does + * not quite work for uinput as we can't reasonably + * handle FF requests during device teardown. + */ + dev->flush = uinput_dev_flush; } error = input_register_device(udev->dev); --- a/include/linux/input.h +++ b/include/linux/input.h @@ -529,6 +529,7 @@ int input_ff_event(struct input_dev *dev int input_ff_upload(struct input_dev *dev, struct ff_effect *effect, struct file *file); int input_ff_erase(struct input_dev *dev, int effect_id, struct file *file); +int input_ff_flush(struct input_dev *dev, struct file *file); int input_ff_create_memless(struct input_dev *dev, void *data, int (*play_effect)(struct input_dev *, void *, struct ff_effect *)); From patchwork Fri Jan 22 14:10:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 369354 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6EE2EC43219 for ; Fri, 22 Jan 2021 19:59:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 48CF623AFC for ; Fri, 22 Jan 2021 19:59:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730760AbhAVT6p (ORCPT ); Fri, 22 Jan 2021 14:58:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:34412 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728203AbhAVOOD (ORCPT ); Fri, 22 Jan 2021 09:14:03 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4452523A5F; Fri, 22 Jan 2021 14:11:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1611324664; bh=9q3kSDHOt1IVp/diBP4F39WtWudxppLFmPDFRhZz48Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TD2roMyYaT/78A5/ABwPEBd9qE4bSG4b4s9APMuUF6BgB2rEb6GkjQmvvo93Q9+ZW gMadDTcxLdpFWQ3l0jocGmn1OIKhGQyAmEmhziBsCB4yJ/BUFoMlUtBNPeYfNascYV YAV/n7Vt970wu5tk7+UYUhLc3+bc1MTwPBvUfC9Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust Subject: [PATCH 4.9 17/35] NFS: nfs_igrab_and_active must first reference the superblock Date: Fri, 22 Jan 2021 15:10:19 +0100 Message-Id: <20210122135733.017925650@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210122135732.357969201@linuxfoundation.org> References: <20210122135732.357969201@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Trond Myklebust commit 896567ee7f17a8a736cda8a28cc987228410a2ac upstream. Before referencing the inode, we must ensure that the superblock can be referenced. Otherwise, we can end up with iput() calling superblock operations that are no longer valid or accessible. Fixes: ea7c38fef0b7 ("NFSv4: Ensure we reference the inode for return-on-close in delegreturn") Signed-off-by: Trond Myklebust Signed-off-by: Greg Kroah-Hartman --- fs/nfs/internal.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h @@ -572,12 +572,14 @@ extern int nfs4_test_session_trunk(struc static inline struct inode *nfs_igrab_and_active(struct inode *inode) { - inode = igrab(inode); - if (inode != NULL && !nfs_sb_active(inode->i_sb)) { - iput(inode); - inode = NULL; + struct super_block *sb = inode->i_sb; + + if (sb && nfs_sb_active(sb)) { + if (igrab(inode)) + return inode; + nfs_sb_deactive(sb); } - return inode; + return NULL; } static inline void nfs_iput_and_deactive(struct inode *inode) From patchwork Fri Jan 22 14:10:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 369346 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9818AC433DB for ; Fri, 22 Jan 2021 19:59:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7474323AFC for ; Fri, 22 Jan 2021 19:59:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730763AbhAVT6p (ORCPT ); Fri, 22 Jan 2021 14:58:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:34410 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727923AbhAVOOD (ORCPT ); Fri, 22 Jan 2021 09:14:03 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id CDA5723AC0; Fri, 22 Jan 2021 14:11:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1611324667; bh=JgT2rUZRDAwot5wINmvAgpRBDucaRvu6wRSr/gjU3u0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y1aj9oA1hMbwC/MfR5sqVuLGt3kVoEIktJXtSNbhvOtyVMjA2sjqAA2BIAcXhg8Dk YcGOBKzDT7e0bZJwoFsYF6HP+YW/1efXRwzz8w0HmvilRYq001jnOLMJgHF5uzA55j XprJISSmGGs0/3MzlRIKgQtOf08fvzMX10h4o7SM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Halcrow , Andreas Dilger , Jan Kara , Theodore Tso Subject: [PATCH 4.9 18/35] ext4: fix superblock checksum failure when setting password salt Date: Fri, 22 Jan 2021 15:10:20 +0100 Message-Id: <20210122135733.057654705@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210122135732.357969201@linuxfoundation.org> References: <20210122135732.357969201@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jan Kara commit dfd56c2c0c0dbb11be939b804ddc8d5395ab3432 upstream. When setting password salt in the superblock, we forget to recompute the superblock checksum so it will not match until the next superblock modification which recomputes the checksum. Fix it. CC: Michael Halcrow Reported-by: Andreas Dilger Fixes: 9bd8212f981e ("ext4 crypto: add encryption policy and password salt support") Signed-off-by: Jan Kara Link: https://lore.kernel.org/r/20201216101844.22917-8-jack@suse.cz Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/ioctl.c | 3 +++ 1 file changed, 3 insertions(+) --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c @@ -799,7 +799,10 @@ resizefs_out: err = ext4_journal_get_write_access(handle, sbi->s_sbh); if (err) goto pwsalt_err_journal; + lock_buffer(sbi->s_sbh); generate_random_uuid(sbi->s_es->s_encrypt_pw_salt); + ext4_superblock_csum_set(sb); + unlock_buffer(sbi->s_sbh); err = ext4_handle_dirty_metadata(handle, NULL, sbi->s_sbh); pwsalt_err_journal: From patchwork Fri Jan 22 14:10:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 369422 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E38DBC433DB for ; Fri, 22 Jan 2021 14:19:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A8A0623BC7 for ; Fri, 22 Jan 2021 14:19:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728115AbhAVORz (ORCPT ); Fri, 22 Jan 2021 09:17:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:36980 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728112AbhAVOPn (ORCPT ); Fri, 22 Jan 2021 09:15:43 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4667523A7A; Fri, 22 Jan 2021 14:11:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1611324714; bh=/hfVk+/9NG141MWjpQIIHq6Ylqb4wuV3STjtiEH0Q5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XqV0FqdN5zEODyOK9wzJr+ZtElFV3OV+4kruGR9vR3PrT1MOe2Xy70sb1YZ9idA9m HYZYG5qjC1ehwpGkgd+P67ME/y3IXnBXyJjWNuHpV2/iHMIe+nNeLEYseAPobueyFO aJtN+GxzbvzGXs8Yb1Na/FjFyIXxUs2XE/SC9Tn4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yoel Caspersen , Jesper Dangaard Brouer , Florian Westphal , Pablo Neira Ayuso Subject: [PATCH 4.9 22/35] netfilter: conntrack: fix reading nf_conntrack_buckets Date: Fri, 22 Jan 2021 15:10:24 +0100 Message-Id: <20210122135733.212990149@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210122135732.357969201@linuxfoundation.org> References: <20210122135732.357969201@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jesper Dangaard Brouer commit f6351c3f1c27c80535d76cac2299aec44c36291e upstream. The old way of changing the conntrack hashsize runtime was through changing the module param via file /sys/module/nf_conntrack/parameters/hashsize. This was extended to sysctl change in commit 3183ab8997a4 ("netfilter: conntrack: allow increasing bucket size via sysctl too"). The commit introduced second "user" variable nf_conntrack_htable_size_user which shadow actual variable nf_conntrack_htable_size. When hashsize is changed via module param this "user" variable isn't updated. This results in sysctl net/netfilter/nf_conntrack_buckets shows the wrong value when users update via the old way. This patch fix the issue by always updating "user" variable when reading the proc file. This will take care of changes to the actual variable without sysctl need to be aware. Fixes: 3183ab8997a4 ("netfilter: conntrack: allow increasing bucket size via sysctl too") Reported-by: Yoel Caspersen Signed-off-by: Jesper Dangaard Brouer Acked-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman --- net/netfilter/nf_conntrack_standalone.c | 3 +++ 1 file changed, 3 insertions(+) --- a/net/netfilter/nf_conntrack_standalone.c +++ b/net/netfilter/nf_conntrack_standalone.c @@ -458,6 +458,9 @@ nf_conntrack_hash_sysctl(struct ctl_tabl { int ret; + /* module_param hashsize could have changed value */ + nf_conntrack_htable_size_user = nf_conntrack_htable_size; + ret = proc_dointvec(table, write, buffer, lenp, ppos); if (ret < 0 || !write) return ret; From patchwork Fri Jan 22 14:10:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 369334 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06F65C433E0 for ; Fri, 22 Jan 2021 22:17:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CB3BB23B17 for ; Fri, 22 Jan 2021 22:17:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730886AbhAVT64 (ORCPT ); Fri, 22 Jan 2021 14:58:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:36982 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727946AbhAVOPn (ORCPT ); Fri, 22 Jan 2021 09:15:43 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id E149323A79; Fri, 22 Jan 2021 14:11:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1611324717; bh=Ge+tDihmPcNRoUH8T1P/bGAPMI/jWJ6KUqb5A+9xJGE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2fn8DcaRxM2Eq9s+sLGmJLkNeutK99X8fgM4cbcaILCyM8antje636mDiwVCy6PS7 JYuLLmhbq6tUJNfaKio5kL1KFIfWpzI0549T5mG+auCDauwVqZf09QZyC7Ul9ZFl5F WvzWjjW0UUZsh+jU8BMiYJ890BFoet4HvyHTnfQw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Stern , Hamish Martin Subject: [PATCH 4.9 23/35] usb: ohci: Make distrust_firmware param default to false Date: Fri, 22 Jan 2021 15:10:25 +0100 Message-Id: <20210122135733.250332147@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210122135732.357969201@linuxfoundation.org> References: <20210122135732.357969201@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Hamish Martin commit c4005a8f65edc55fb1700dfc5c1c3dc58be80209 upstream. The 'distrust_firmware' module parameter dates from 2004 and the USB subsystem is a lot more mature and reliable now than it was then. Alter the default to false now. Suggested-by: Alan Stern Acked-by: Alan Stern Signed-off-by: Hamish Martin Link: https://lore.kernel.org/r/20200910212512.16670-2-hamish.martin@alliedtelesis.co.nz Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/ohci-hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c @@ -100,7 +100,7 @@ static void io_watchdog_func(unsigned lo /* Some boards misreport power switching/overcurrent */ -static bool distrust_firmware = true; +static bool distrust_firmware; module_param (distrust_firmware, bool, 0); MODULE_PARM_DESC (distrust_firmware, "true to distrust firmware power/overcurrent setup"); From patchwork Fri Jan 22 14:10:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 369335 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43109C4332B for ; Fri, 22 Jan 2021 22:17:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1652623B3E for ; Fri, 22 Jan 2021 22:17:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730889AbhAVT65 (ORCPT ); Fri, 22 Jan 2021 14:58:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:36978 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727095AbhAVOPn (ORCPT ); Fri, 22 Jan 2021 09:15:43 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3C58F23B06; Fri, 22 Jan 2021 14:11:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1611324719; bh=X+DZ+fM7wZtI5dMsVocTCJ0dPwP6G9Bldkj+sxRzR6g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zVyF7YOpy8zt0us50iqN9XIO1XFZr75BoXZu7yED4adHbePFyXrqytMz7iqoKVD1x L5quPn3V7hpUGK1I8Wf6ewCPBJdqxbTm2ZsW0w1agrT2ddysc/o/6QekAl7u3bM/sL t8JS7NlETqi6yEZJkR5zhOrXZutGHG13gkAI8I8I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Russell King , Arnd Bergmann , Will Deacon , Nathan Chancellor , Nick Desaulniers , Linus Torvalds , Theodore Tso , Florian Weimer , Peter Zijlstra , Catalin Marinas Subject: [PATCH 4.9 24/35] compiler.h: Raise minimum version of GCC to 5.1 for arm64 Date: Fri, 22 Jan 2021 15:10:26 +0100 Message-Id: <20210122135733.287240739@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210122135732.357969201@linuxfoundation.org> References: <20210122135732.357969201@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Will Deacon commit dca5244d2f5b94f1809f0c02a549edf41ccd5493 upstream. GCC versions >= 4.9 and < 5.1 have been shown to emit memory references beyond the stack pointer, resulting in memory corruption if an interrupt is taken after the stack pointer has been adjusted but before the reference has been executed. This leads to subtle, infrequent data corruption such as the EXT4 problems reported by Russell King at the link below. Life is too short for buggy compilers, so raise the minimum GCC version required by arm64 to 5.1. Reported-by: Russell King Suggested-by: Arnd Bergmann Signed-off-by: Will Deacon Tested-by: Nathan Chancellor Reviewed-by: Nick Desaulniers Reviewed-by: Nathan Chancellor Acked-by: Linus Torvalds Cc: Cc: Theodore Ts'o Cc: Florian Weimer Cc: Peter Zijlstra Cc: Nick Desaulniers Link: https://lore.kernel.org/r/20210105154726.GD1551@shell.armlinux.org.uk Link: https://lore.kernel.org/r/20210112224832.10980-1-will@kernel.org Signed-off-by: Catalin Marinas [will: backport to 4.4.y/4.9.y/4.14.y] Signed-off-by: Will Deacon Signed-off-by: Greg Kroah-Hartman --- include/linux/compiler-gcc.h | 6 ++++++ 1 file changed, 6 insertions(+) --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h @@ -149,6 +149,12 @@ #if GCC_VERSION < 30200 # error Sorry, your compiler is too old - please upgrade it. +#elif defined(CONFIG_ARM64) && GCC_VERSION < 50100 +/* + * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63293 + * https://lore.kernel.org/r/20210107111841.GN1551@shell.armlinux.org.uk + */ +# error Sorry, your version of GCC is too old - please use 5.1 or newer. #endif #if GCC_VERSION < 30300 From patchwork Fri Jan 22 14:10:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 369423 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E31C9C433E0 for ; Fri, 22 Jan 2021 14:18:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AE71B23B05 for ; Fri, 22 Jan 2021 14:18:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728452AbhAVORU (ORCPT ); Fri, 22 Jan 2021 09:17:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:34614 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728430AbhAVOPM (ORCPT ); Fri, 22 Jan 2021 09:15:12 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id F319923B00; Fri, 22 Jan 2021 14:12:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1611324722; bh=0doCHyUAtKsddt6o4vk0yN3v95hQPF9YtGyxDACoySs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cEXh8+GzJmNmGxPT0nvPMr+RFFXpxSsbvJYfxVtyHuJPMmnvXhXJJr/K1kfNi6bAn nuTx6KYwVCOjE/P5j26KGjiJD5AK4bp4wu0pAGd/3B/95+IOFkAFDM5kP+U4N2FpAn wqnNZDHtKWEFlcnHB6l/pvb41Fxt22pwyEYm+CbY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Youjipeng , "J. Bruce Fields" , Chuck Lever Subject: [PATCH 4.9 25/35] nfsd4: readdirplus shouldnt return parent of export Date: Fri, 22 Jan 2021 15:10:27 +0100 Message-Id: <20210122135733.324059563@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210122135732.357969201@linuxfoundation.org> References: <20210122135732.357969201@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: J. Bruce Fields commit 51b2ee7d006a736a9126e8111d1f24e4fd0afaa6 upstream. If you export a subdirectory of a filesystem, a READDIRPLUS on the root of that export will return the filehandle of the parent with the ".." entry. The filehandle is optional, so let's just not return the filehandle for ".." if we're at the root of an export. Note that once the client learns one filehandle outside of the export, they can trivially access the rest of the export using further lookups. However, it is also not very difficult to guess filehandles outside of the export. So exporting a subdirectory of a filesystem should considered equivalent to providing access to the entire filesystem. To avoid confusion, we recommend only exporting entire filesystems. Reported-by: Youjipeng Signed-off-by: J. Bruce Fields Cc: stable@vger.kernel.org Signed-off-by: Chuck Lever Signed-off-by: Greg Kroah-Hartman --- fs/nfsd/nfs3xdr.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/fs/nfsd/nfs3xdr.c +++ b/fs/nfsd/nfs3xdr.c @@ -822,9 +822,14 @@ compose_entry_fh(struct nfsd3_readdirres if (isdotent(name, namlen)) { if (namlen == 2) { dchild = dget_parent(dparent); - /* filesystem root - cannot return filehandle for ".." */ + /* + * Don't return filehandle for ".." if we're at + * the filesystem or export root: + */ if (dchild == dparent) goto out; + if (dparent == exp->ex_path.dentry) + goto out; } else dchild = dget(dparent); } else From patchwork Fri Jan 22 14:10:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 369345 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE241C10F04 for ; Fri, 22 Jan 2021 19:59:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B2DEB23AFC for ; Fri, 22 Jan 2021 19:59:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730899AbhAVT66 (ORCPT ); Fri, 22 Jan 2021 14:58:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:37470 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728151AbhAVOQ2 (ORCPT ); Fri, 22 Jan 2021 09:16:28 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7856F23B01; Fri, 22 Jan 2021 14:12:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1611324725; bh=ZvZNMDkt5S3AT8vIgAiQB6edKyT1ygA10foDWxZPcgU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MVdNTbPVr+UfUixGnQMdOe69S9rqPezx4NpTiA2gpMCIHsj3hm0p9oWEMEyvqLy7X QZxhntdlyb0ZVAUzlkTqN77o8Qturvuss+7fKlkqcORSE4Nw5m1dbGCszEHvtXQ2Iw jAkAGr3AtqsffAuHyS8swBzjxoOdU9ufAOxSEHHE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "=?UTF-8?q?Jouni=20K . =20Sepp=C3=A4nen?=" , kernel test robot , =?utf-8?q?Bj=C3=B8rn_Mork?= , "David S. Miller" Subject: [PATCH 4.9 26/35] net: cdc_ncm: correct overhead in delayed_ndp_size Date: Fri, 22 Jan 2021 15:10:28 +0100 Message-Id: <20210122135733.360598619@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210122135732.357969201@linuxfoundation.org> References: <20210122135732.357969201@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jouni K. Seppänen commit 7a68d725e4ea384977445e0bcaed3d7de83ab5b3 upstream. Aligning to tx_ndp_modulus is not sufficient because the next align call can be cdc_ncm_align_tail, which can add up to ctx->tx_modulus + ctx->tx_remainder - 1 bytes. This used to lead to occasional crashes on a Huawei 909s-120 LTE module as follows: - the condition marked /* if there is a remaining skb [...] */ is true so the swaps happen - skb_out is set from ctx->tx_curr_skb - skb_out->len is exactly 0x3f52 - ctx->tx_curr_size is 0x4000 and delayed_ndp_size is 0xac (note that the sum of skb_out->len and delayed_ndp_size is 0x3ffe) - the for loop over n is executed once - the cdc_ncm_align_tail call marked /* align beginning of next frame */ increases skb_out->len to 0x3f56 (the sum is now 0x4002) - the condition marked /* check if we had enough room left [...] */ is false so we break out of the loop - the condition marked /* If requested, put NDP at end of frame. */ is true so the NDP is written into skb_out - now skb_out->len is 0x4002, so padding_count is minus two interpreted as an unsigned number, which is used as the length argument to memset, leading to a crash with various symptoms but usually including > Call Trace: > > cdc_ncm_fill_tx_frame+0x83a/0x970 [cdc_ncm] > cdc_mbim_tx_fixup+0x1d9/0x240 [cdc_mbim] > usbnet_start_xmit+0x5d/0x720 [usbnet] The cdc_ncm_align_tail call first aligns on a ctx->tx_modulus boundary (adding at most ctx->tx_modulus-1 bytes), then adds ctx->tx_remainder bytes. Alternatively, the next alignment call can occur in cdc_ncm_ndp16 or cdc_ncm_ndp32, in which case at most ctx->tx_ndp_modulus-1 bytes are added. A similar problem has occurred before, and the code is nontrivial to reason about, so add a guard before the crashing call. By that time it is too late to prevent any memory corruption (we'll have written past the end of the buffer already) but we can at least try to get a warning written into an on-disk log by avoiding the hard crash caused by padding past the buffer with a huge number of zeros. Signed-off-by: Jouni K. Seppänen Fixes: 4a0e3e989d66 ("cdc_ncm: Add support for moving NDP to end of NCM frame") Link: https://bugzilla.kernel.org/show_bug.cgi?id=209407 Reported-by: kernel test robot Reviewed-by: Bjørn Mork Signed-off-by: David S. Miller [jks@iki.fi: backport to 4.4.y, 4.9.y] Signed-off-by: Jouni K. Seppänen Signed-off-by: Greg Kroah-Hartman --- drivers/net/usb/cdc_ncm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c @@ -1128,7 +1128,10 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev * accordingly. Otherwise, we should check here. */ if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END) - delayed_ndp_size = ALIGN(ctx->max_ndp_size, ctx->tx_ndp_modulus); + delayed_ndp_size = ctx->max_ndp_size + + max_t(u32, + ctx->tx_ndp_modulus, + ctx->tx_modulus + ctx->tx_remainder) - 1; else delayed_ndp_size = 0; @@ -1281,7 +1284,8 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev if (!(dev->driver_info->flags & FLAG_SEND_ZLP) && skb_out->len > ctx->min_tx_pkt) { padding_count = ctx->tx_max - skb_out->len; - memset(skb_put(skb_out, padding_count), 0, padding_count); + if (!WARN_ON(padding_count > ctx->tx_max)) + memset(skb_put(skb_out, padding_count), 0, padding_count); } else if (skb_out->len < ctx->tx_max && (skb_out->len % dev->maxpacket) == 0) { *skb_put(skb_out, 1) = 0; /* force short packet */ From patchwork Fri Jan 22 14:10:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 369344 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FD96C433E9 for ; Fri, 22 Jan 2021 19:59:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6BDC423B00 for ; Fri, 22 Jan 2021 19:59:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727095AbhAVT7B (ORCPT ); Fri, 22 Jan 2021 14:59:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:37506 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728377AbhAVOQc (ORCPT ); Fri, 22 Jan 2021 09:16:32 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3EFA923B02; Fri, 22 Jan 2021 14:12:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1611324727; bh=ldwoMgTZQm8WXVNZ8e5I0+jYp/z/sOwVzf0fCgPzcLQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KZSeTNVHS6//oDnS5mE8e92QHGhRmQo7XGThcmt+3ylQ7F8ygovMqDZUbDFjnHlM2 Ez4rZRrj+s4u8D8adtvgM0bGJOeZiGnVpfp47Lf8ePGKkdp0H3cjYlXz/mDop5vqX7 OuxNFPKJgmImYoFTT8a040z1kC3zryYPjh5b7BKc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manish Chopra , Igor Russkikh , Jakub Kicinski Subject: [PATCH 4.9 27/35] netxen_nic: fix MSI/MSI-x interrupts Date: Fri, 22 Jan 2021 15:10:29 +0100 Message-Id: <20210122135733.395949586@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210122135732.357969201@linuxfoundation.org> References: <20210122135732.357969201@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Manish Chopra [ Upstream commit a2bc221b972db91e4be1970e776e98f16aa87904 ] For all PCI functions on the netxen_nic adapter, interrupt mode (INTx or MSI) configuration is dependent on what has been configured by the PCI function zero in the shared interrupt register, as these adapters do not support mixed mode interrupts among the functions of a given adapter. Logic for setting MSI/MSI-x interrupt mode in the shared interrupt register based on PCI function id zero check is not appropriate for all family of netxen adapters, as for some of the netxen family adapters PCI function zero is not really meant to be probed/loaded in the host but rather just act as a management function on the device, which caused all the other PCI functions on the adapter to always use legacy interrupt (INTx) mode instead of choosing MSI/MSI-x interrupt mode. This patch replaces that check with port number so that for all type of adapters driver attempts for MSI/MSI-x interrupt modes. Fixes: b37eb210c076 ("netxen_nic: Avoid mixed mode interrupts") Signed-off-by: Manish Chopra Signed-off-by: Igor Russkikh Link: https://lore.kernel.org/r/20210107101520.6735-1-manishc@marvell.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c @@ -586,11 +586,6 @@ static const struct net_device_ops netxe #endif }; -static inline bool netxen_function_zero(struct pci_dev *pdev) -{ - return (PCI_FUNC(pdev->devfn) == 0) ? true : false; -} - static inline void netxen_set_interrupt_mode(struct netxen_adapter *adapter, u32 mode) { @@ -686,7 +681,7 @@ static int netxen_setup_intr(struct netx netxen_initialize_interrupt_registers(adapter); netxen_set_msix_bit(pdev, 0); - if (netxen_function_zero(pdev)) { + if (adapter->portnum == 0) { if (!netxen_setup_msi_interrupts(adapter, num_msix)) netxen_set_interrupt_mode(adapter, NETXEN_MSI_MODE); else From patchwork Fri Jan 22 14:10:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 369349 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9599DC4161F for ; Fri, 22 Jan 2021 19:59:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7775E23B01 for ; Fri, 22 Jan 2021 19:59:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730867AbhAVT6y (ORCPT ); Fri, 22 Jan 2021 14:58:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:35832 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728288AbhAVOO4 (ORCPT ); Fri, 22 Jan 2021 09:14:56 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id A3783230FC; Fri, 22 Jan 2021 14:11:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1611324701; bh=bZsiuPmfi7KWa/GpnRG+iYnBMwTaxuQa03ihihKz9sk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x1ndjS8cgxH5O8MVTzAjYIgeRNKlND9ANHslIr9RKXmYKvNDALf7voJweKtDS5Tp1 oh5i1lifGWu6XYI1KKij72crcEs8HEyxLkfNhIC5soRg/UC5GaMKj3mzaXZa1vfdFP 9u9UOuZvZUOPcPb2DMTcD4sMY1/+kGEqJNVelX9M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicolas Dichtel , Jakub Kicinski , syzbot+2393580080a2da190f04@syzkaller.appspotmail.com Subject: [PATCH 4.9 31/35] net: sit: unregister_netdevice on newlinks error path Date: Fri, 22 Jan 2021 15:10:33 +0100 Message-Id: <20210122135733.560582188@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210122135732.357969201@linuxfoundation.org> References: <20210122135732.357969201@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jakub Kicinski [ Upstream commit 47e4bb147a96f1c9b4e7691e7e994e53838bfff8 ] We need to unregister the netdevice if config failed. .ndo_uninit takes care of most of the heavy lifting. This was uncovered by recent commit c269a24ce057 ("net: make free_netdev() more lenient with unregistering devices"). Previously the partially-initialized device would be left in the system. Reported-and-tested-by: syzbot+2393580080a2da190f04@syzkaller.appspotmail.com Fixes: e2f1f072db8d ("sit: allow to configure 6rd tunnels via netlink") Acked-by: Nicolas Dichtel Link: https://lore.kernel.org/r/20210114012947.2515313-1-kuba@kernel.org Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/ipv6/sit.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c @@ -1583,8 +1583,11 @@ static int ipip6_newlink(struct net *src } #ifdef CONFIG_IPV6_SIT_6RD - if (ipip6_netlink_6rd_parms(data, &ip6rd)) + if (ipip6_netlink_6rd_parms(data, &ip6rd)) { err = ipip6_tunnel_update_6rd(nt, &ip6rd); + if (err < 0) + unregister_netdevice_queue(dev, NULL); + } #endif return err; From patchwork Fri Jan 22 14:10:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 369348 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21204C10F00 for ; Fri, 22 Jan 2021 19:59:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EE60B23B04 for ; Fri, 22 Jan 2021 19:59:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730876AbhAVT6y (ORCPT ); Fri, 22 Jan 2021 14:58:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:35858 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728424AbhAVOPB (ORCPT ); Fri, 22 Jan 2021 09:15:01 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 61CE623A03; Fri, 22 Jan 2021 14:11:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1611324703; bh=fUct/ptdIsRDW3F6vkIA88Tpst9C6BJj0l/F8UjFbMo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=urQhs68VUnjzYryWOMgqxvgkm12DXj00CKg2m5ubL5IR01U9YqOKyLrWSzBP+MSga plGb0cwCWyO4zPbtbu6xl3PkqIWCu8xL3T/b0wU9vW/HACL5sUIwvuA+GiW3d0iZzq pzBTNN1TPvAgVgLA40+4xWJCJ+jpNOnWQERpLMaM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , Paolo Abeni , Greg Thelen , Alexander Duyck , "Michael S. Tsirkin" , Jakub Kicinski Subject: [PATCH 4.9 32/35] net: avoid 32 x truesize under-estimation for tiny skbs Date: Fri, 22 Jan 2021 15:10:34 +0100 Message-Id: <20210122135733.607863127@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210122135732.357969201@linuxfoundation.org> References: <20210122135732.357969201@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Eric Dumazet [ Upstream commit 3226b158e67cfaa677fd180152bfb28989cb2fac ] Both virtio net and napi_get_frags() allocate skbs with a very small skb->head While using page fragments instead of a kmalloc backed skb->head might give a small performance improvement in some cases, there is a huge risk of under estimating memory usage. For both GOOD_COPY_LEN and GRO_MAX_HEAD, we can fit at least 32 allocations per page (order-3 page in x86), or even 64 on PowerPC We have been tracking OOM issues on GKE hosts hitting tcp_mem limits but consuming far more memory for TCP buffers than instructed in tcp_mem[2] Even if we force napi_alloc_skb() to only use order-0 pages, the issue would still be there on arches with PAGE_SIZE >= 32768 This patch makes sure that small skb head are kmalloc backed, so that other objects in the slab page can be reused instead of being held as long as skbs are sitting in socket queues. Note that we might in the future use the sk_buff napi cache, instead of going through a more expensive __alloc_skb() Another idea would be to use separate page sizes depending on the allocated length (to never have more than 4 frags per page) I would like to thank Greg Thelen for his precious help on this matter, analysing crash dumps is always a time consuming task. Fixes: fd11a83dd363 ("net: Pull out core bits of __netdev_alloc_skb and add __napi_alloc_skb") Signed-off-by: Eric Dumazet Cc: Paolo Abeni Cc: Greg Thelen Reviewed-by: Alexander Duyck Acked-by: Michael S. Tsirkin Link: https://lore.kernel.org/r/20210113161819.1155526-1-eric.dumazet@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/core/skbuff.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -489,13 +489,17 @@ EXPORT_SYMBOL(__netdev_alloc_skb); struct sk_buff *__napi_alloc_skb(struct napi_struct *napi, unsigned int len, gfp_t gfp_mask) { - struct napi_alloc_cache *nc = this_cpu_ptr(&napi_alloc_cache); + struct napi_alloc_cache *nc; struct sk_buff *skb; void *data; len += NET_SKB_PAD + NET_IP_ALIGN; - if ((len > SKB_WITH_OVERHEAD(PAGE_SIZE)) || + /* If requested length is either too small or too big, + * we use kmalloc() for skb->head allocation. + */ + if (len <= SKB_WITH_OVERHEAD(1024) || + len > SKB_WITH_OVERHEAD(PAGE_SIZE) || (gfp_mask & (__GFP_DIRECT_RECLAIM | GFP_DMA))) { skb = __alloc_skb(len, gfp_mask, SKB_ALLOC_RX, NUMA_NO_NODE); if (!skb) @@ -503,6 +507,7 @@ struct sk_buff *__napi_alloc_skb(struct goto skb_success; } + nc = this_cpu_ptr(&napi_alloc_cache); len += SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); len = SKB_DATA_ALIGN(len); From patchwork Fri Jan 22 14:10:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 369347 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BDCCC41621 for ; Fri, 22 Jan 2021 19:59:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1236923B08 for ; Fri, 22 Jan 2021 19:59:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730883AbhAVT64 (ORCPT ); Fri, 22 Jan 2021 14:58:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:36984 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728088AbhAVOPn (ORCPT ); Fri, 22 Jan 2021 09:15:43 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5E57023A56; Fri, 22 Jan 2021 14:11:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1611324712; bh=XIP+1FvC3uLb1PAkKAZzm+OiRsmgPBMplCnOMwCwfw4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tlFfUsy8yG7EZAGqC8GMOMkmhLj0v3pLC2itT977Rq2Bnc/D5ASVvdOTfg3r9Gk6B 2EGfANNo3/WYnPqKhqvlHC346hU7p4Q4huTrgHsbnRLGjOMWr6Npp1s0Q0qzreA+ZN L78RF2OU4I6LY5kNBYU2Vzx/hYa1Hk7OCsnbdqXw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Hennerich , Alexandru Ardelean , Mark Brown Subject: [PATCH 4.9 35/35] spi: cadence: cache reference clock rate during probe Date: Fri, 22 Jan 2021 15:10:37 +0100 Message-Id: <20210122135733.745952182@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210122135732.357969201@linuxfoundation.org> References: <20210122135732.357969201@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Michael Hennerich commit 4d163ad79b155c71bf30366dc38f8d2502f78844 upstream. The issue is that using SPI from a callback under the CCF lock will deadlock, since this code uses clk_get_rate(). Fixes: c474b38665463 ("spi: Add driver for Cadence SPI controller") Signed-off-by: Michael Hennerich Signed-off-by: Alexandru Ardelean Link: https://lore.kernel.org/r/20210114154217.51996-1-alexandru.ardelean@analog.com Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- drivers/spi/spi-cadence.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/spi/spi-cadence.c +++ b/drivers/spi/spi-cadence.c @@ -118,6 +118,7 @@ struct cdns_spi { void __iomem *regs; struct clk *ref_clk; struct clk *pclk; + unsigned int clk_rate; u32 speed_hz; const u8 *txbuf; u8 *rxbuf; @@ -253,7 +254,7 @@ static void cdns_spi_config_clock_freq(s u32 ctrl_reg, baud_rate_val; unsigned long frequency; - frequency = clk_get_rate(xspi->ref_clk); + frequency = xspi->clk_rate; ctrl_reg = cdns_spi_read(xspi, CDNS_SPI_CR); @@ -558,8 +559,9 @@ static int cdns_spi_probe(struct platfor master->auto_runtime_pm = true; master->mode_bits = SPI_CPOL | SPI_CPHA; + xspi->clk_rate = clk_get_rate(xspi->ref_clk); /* Set to default valid value */ - master->max_speed_hz = clk_get_rate(xspi->ref_clk) / 4; + master->max_speed_hz = xspi->clk_rate / 4; xspi->speed_hz = master->max_speed_hz; master->bits_per_word_mask = SPI_BPW_MASK(8);