From patchwork Fri Jan 15 12:27:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 364542 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 82558C433E9 for ; Fri, 15 Jan 2021 13:04:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4446A22473 for ; Fri, 15 Jan 2021 13:04:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387546AbhAONEJ (ORCPT ); Fri, 15 Jan 2021 08:04:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:37326 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732743AbhAOMbj (ORCPT ); Fri, 15 Jan 2021 07:31:39 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 144C3224F9; Fri, 15 Jan 2021 12:31:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610713883; bh=pfMeXNysOzQTPDmCEc+5nOvWKPsqEUx9T2x+yAP5mpo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JWknhZOGYVz+FuR9i7yjl9363RpKCgVY5tIeZz1w7P8g4EbhZ3xUjIuaeCPJlXef8 3JcV1N/Nh82PahevhyygFD92FHxSprinCP2rCR0tCAPTHa0D+eNVtTTDpQmgyvlMSx QkoMU+QlmD7LEkcYu9bBGlWRtUivIfNAY00A1J2g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christian Perle , Florian Westphal , Pablo Neira Ayuso , Jakub Kicinski Subject: [PATCH 4.14 04/28] net: ip: always refragment ip defragmented packets Date: Fri, 15 Jan 2021 13:27:41 +0100 Message-Id: <20210115121956.957845807@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121956.731354372@linuxfoundation.org> References: <20210115121956.731354372@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Florian Westphal [ Upstream commit bb4cc1a18856a73f0ff5137df0c2a31f4c50f6cf ] Conntrack reassembly records the largest fragment size seen in IPCB. However, when this gets forwarded/transmitted, fragmentation will only be forced if one of the fragmented packets had the DF bit set. In that case, a flag in IPCB will force fragmentation even if the MTU is large enough. This should work fine, but this breaks with ip tunnels. Consider client that sends a UDP datagram of size X to another host. The client fragments the datagram, so two packets, of size y and z, are sent. DF bit is not set on any of these packets. Middlebox netfilter reassembles those packets back to single size-X packet, before routing decision. packet-size-vs-mtu checks in ip_forward are irrelevant, because DF bit isn't set. At output time, ip refragmentation is skipped as well because x is still smaller than the mtu of the output device. If ttransmit device is an ip tunnel, the packet size increases to x+overhead. Also, tunnel might be configured to force DF bit on outer header. In this case, packet will be dropped (exceeds MTU) and an ICMP error is generated back to sender. But sender already respects the announced MTU, all the packets that it sent did fit the announced mtu. Force refragmentation as per original sizes unconditionally so ip tunnel will encapsulate the fragments instead. The only other solution I see is to place ip refragmentation in the ip_tunnel code to handle this case. Fixes: d6b915e29f4ad ("ip_fragment: don't forward defragmented DF packet") Reported-by: Christian Perle Signed-off-by: Florian Westphal Acked-by: Pablo Neira Ayuso Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/ipv4/ip_output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c @@ -312,7 +312,7 @@ static int ip_finish_output(struct net * if (skb_is_gso(skb)) return ip_finish_output_gso(net, sk, skb, mtu); - if (skb->len > mtu || (IPCB(skb)->flags & IPSKB_FRAG_PMTU)) + if (skb->len > mtu || IPCB(skb)->frag_max_size) return ip_fragment(net, sk, skb, mtu, ip_finish_output2); return ip_finish_output2(net, sk, skb); From patchwork Fri Jan 15 12:27:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 364543 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 06445C432C3 for ; Fri, 15 Jan 2021 13:04:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DFF342256F for ; Fri, 15 Jan 2021 13:04:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733241AbhAONEC (ORCPT ); Fri, 15 Jan 2021 08:04:02 -0500 Received: from mail.kernel.org ([198.145.29.99]:37364 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732762AbhAOMbl (ORCPT ); Fri, 15 Jan 2021 07:31:41 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 434D8239D0; Fri, 15 Jan 2021 12:31:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610713885; bh=1saCcVLhoLc7kxDg4py+J6DxUvLBCh6SIjzoNJqgJD8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YLyBSxd1CYOIQzfAKx/1tCSV/EoFbHq6x628j9TVrFdJWj4DrKWk3CSm/w/vdV1hW df8KsVTin0toUsxmYAiI2Om4nkGoP661Bvct05DjMN2dS7VGULL/6Xfqo3M0WZa6oW aKfqybPNeEQ0/RpldS05M+xoztIdw9SlDE8eeFaU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefano Brivio , Florian Westphal , Pablo Neira Ayuso , Jakub Kicinski Subject: [PATCH 4.14 05/28] net: fix pmtu check in nopmtudisc mode Date: Fri, 15 Jan 2021 13:27:42 +0100 Message-Id: <20210115121957.006577531@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121956.731354372@linuxfoundation.org> References: <20210115121956.731354372@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Florian Westphal [ Upstream commit 50c661670f6a3908c273503dfa206dfc7aa54c07 ] For some reason ip_tunnel insist on setting the DF bit anyway when the inner header has the DF bit set, EVEN if the tunnel was configured with 'nopmtudisc'. This means that the script added in the previous commit cannot be made to work by adding the 'nopmtudisc' flag to the ip tunnel configuration. Doing so breaks connectivity even for the without-conntrack/netfilter scenario. When nopmtudisc is set, the tunnel will skip the mtu check, so no icmp error is sent to client. Then, because inner header has DF set, the outer header gets added with DF bit set as well. IP stack then sends an error to itself because the packet exceeds the device MTU. Fixes: 23a3647bc4f93 ("ip_tunnels: Use skb-len to PMTU check.") Cc: Stefano Brivio Signed-off-by: Florian Westphal Acked-by: Pablo Neira Ayuso Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/ipv4/ip_tunnel.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/net/ipv4/ip_tunnel.c +++ b/net/ipv4/ip_tunnel.c @@ -752,7 +752,11 @@ void ip_tunnel_xmit(struct sk_buff *skb, goto tx_error; } - if (tnl_update_pmtu(dev, skb, rt, tnl_params->frag_off, inner_iph)) { + df = tnl_params->frag_off; + if (skb->protocol == htons(ETH_P_IP) && !tunnel->ignore_df) + df |= (inner_iph->frag_off & htons(IP_DF)); + + if (tnl_update_pmtu(dev, skb, rt, df, inner_iph)) { ip_rt_put(rt); goto tx_error; } @@ -780,10 +784,6 @@ void ip_tunnel_xmit(struct sk_buff *skb, ttl = ip4_dst_hoplimit(&rt->dst); } - df = tnl_params->frag_off; - if (skb->protocol == htons(ETH_P_IP) && !tunnel->ignore_df) - df |= (inner_iph->frag_off&htons(IP_DF)); - max_headroom = LL_RESERVED_SPACE(rt->dst.dev) + sizeof(struct iphdr) + rt->dst.header_len + ip_encap_hlen(&tunnel->encap); if (max_headroom > dev->needed_headroom) From patchwork Fri Jan 15 12:27:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 364544 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 93D37C4332E for ; Fri, 15 Jan 2021 13:04:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6397F22473 for ; Fri, 15 Jan 2021 13:04:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732801AbhAOMbq (ORCPT ); Fri, 15 Jan 2021 07:31:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:37452 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732787AbhAOMbp (ORCPT ); Fri, 15 Jan 2021 07:31:45 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id A882C23136; Fri, 15 Jan 2021 12:31:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610713890; bh=tC6JJM1vmnXYySKfv9b0mXJx7CTs1lpaCXJ6pG71VEA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zd9q0MD00j7HtiBLIwvzxxSOYv54HMpWh2TQzp04uRJW3dPBUqaG/4z4CtJlooXU0 CdO3VJnaHsdjUwI3KKD3HYtaS0AqB5nY4Anm8T6k/f/YSX7q6mU/CtO8Ggolw+CJOP 8qrr0EzaN1fHElPjv/vd8+/NWcPowljtoIhAs3dw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shakeel Butt , Fenghua Yu , Reinette Chatre , Borislav Petkov , Tony Luck Subject: [PATCH 4.14 07/28] x86/resctrl: Dont move a task to the same resource group Date: Fri, 15 Jan 2021 13:27:44 +0100 Message-Id: <20210115121957.106181858@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121956.731354372@linuxfoundation.org> References: <20210115121956.731354372@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Fenghua Yu commit a0195f314a25582b38993bf30db11c300f4f4611 upstream Shakeel Butt reported in [1] that a user can request a task to be moved to a resource group even if the task is already in the group. It just wastes time to do the move operation which could be costly to send IPI to a different CPU. Add a sanity check to ensure that the move operation only happens when the task is not already in the resource group. [1] https://lore.kernel.org/lkml/CALvZod7E9zzHwenzf7objzGKsdBmVwTgEJ0nPgs0LUFU3SN5Pw@mail.gmail.com/ Backporting notes: Since upstream commit fa7d949337cc ("x86/resctrl: Rename and move rdt files to a separate directory"), the file arch/x86/kernel/cpu/intel_rdt_rdtgroup.c has been renamed and moved to arch/x86/kernel/cpu/resctrl/rdtgroup.c. Apply the change against file arch/x86/kernel/cpu/intel_rdt_rdtgroup.c for older stable trees. Fixes: e02737d5b826 ("x86/intel_rdt: Add tasks files") Reported-by: Shakeel Butt Signed-off-by: Fenghua Yu Signed-off-by: Reinette Chatre Signed-off-by: Borislav Petkov Reviewed-by: Tony Luck Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/962ede65d8e95be793cb61102cca37f7bb018e66.1608243147.git.reinette.chatre@intel.com Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c +++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c @@ -432,6 +432,13 @@ static void update_task_closid_rmid(stru static int __rdtgroup_move_task(struct task_struct *tsk, struct rdtgroup *rdtgrp) { + /* If the task is already in rdtgrp, no need to move the task. */ + if ((rdtgrp->type == RDTCTRL_GROUP && tsk->closid == rdtgrp->closid && + tsk->rmid == rdtgrp->mon.rmid) || + (rdtgrp->type == RDTMON_GROUP && tsk->rmid == rdtgrp->mon.rmid && + tsk->closid == rdtgrp->mon.parent->closid)) + return 0; + /* * Set the task's closid/rmid before the PQR_ASSOC MSR can be * updated by them. From patchwork Fri Jan 15 12:27:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 363611 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp274121jap; Fri, 15 Jan 2021 05:05:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJw1VvqymHjPWmaM6BZ6CaRirx33up5LoMVF6ymDgUd8XN9sCPv5dawy32NGMkcmFh3SXcDW X-Received: by 2002:a17:906:3a99:: with SMTP id y25mr8526775ejd.349.1610715913359; Fri, 15 Jan 2021 05:05:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610715913; cv=none; d=google.com; s=arc-20160816; b=N+f5m8PFOjmEa0+2oR2ZQ2lVgk0dBnxWBokC1QVbhCcM8kQ9KmtxyVLUVP/TaCD+NE 09MU39efoEQ6bSGi1zmstc7PVoc0wav7XoIwAkMr1HEPFmdDaT2xOnXzmsFRU9alZRLc kWZ8Y9u++u2PGr6eNFlc9svxZsKj020UVsmMlVBGhUZbDPihnGmL3CIhALPHrYR23RRA iqQZGQzrMtJjVforeOD/PbJJxxae++vAsPaLUy6lhdeS+XFvFqeg+jEcAkPIx/9f2Qbz uFx2q6hMBAZiYz3lqDL7gemvCyOwQJFrypV2BKTsQVIpOYWpuQEZdulvQU6MjMJdTZwc I4ew== 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=VFgOjYm70R9C4S/gcv43HfZKtShzQURDCdw5EywvmQE=; b=NzaQVH3eKXezKHl0g8WJkvA7x2sWlcaAUX1iO0/2+doVIEYxyOtsqON+epDU9OlIAn S/X2MCTcpZ8mJ1CO2EO5WGC9/xBAEx8ms4PloNatgFnL88GJEAey34i0p9jYj/khWPuS A5KtzavtKr/6eG+AmJMEaEoynW/YOrhh0ekXmCw7l6kHgDIza8U1zm4ldqLkWVvW+FjV y76K6RnLlSbHV2eETQF+CbgWHLb2Cb0Lw1bsXQsPlosj6pdr1INAFfUgRncPuHZsy5KL cTdrn5tQAK6PnRsQZ1tNN0pJBKqKixuAwdtdyBSXWUvsv/L/3B2xQXtAsUc6h0w9OmFf Pw0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aJIWbjFK; 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 f7si4452979edd.343.2021.01.15.05.05.12; Fri, 15 Jan 2021 05:05:13 -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=aJIWbjFK; 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 S1728641AbhAONDq (ORCPT + 13 others); Fri, 15 Jan 2021 08:03:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:36412 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732814AbhAOMbr (ORCPT ); Fri, 15 Jan 2021 07:31:47 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id B4ED6223E0; Fri, 15 Jan 2021 12:31:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610713892; bh=ywoUHKCi0smieEK+SvYseF8rMMCIbmHFRL9jbMC+D4M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aJIWbjFKwlDG/dwVJAxsfYiByB6I0wuI4eEogxDSUuHnQnGzn2j8EDSGSwbWzVo4N DRGqW2GyXR7MBy1+HhMgRZQ/cdRGjRjPyJXMcQP/8FMlW6DdO2GcYc6W828tQKtwA2 uZ4GAUJyzroWciNh3lwdWITG36QVkhRsqbgEDhVA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jian Cai , =?utf-8?b?RsSBbmctcnXDrCBTw7JuZw==?= , Nick Desaulniers , Kees Cook , Ingo Molnar , Luis Lozano , Manoj Gupta , linux-arch@vger.kernel.org, Nathan Chancellor Subject: [PATCH 4.14 08/28] vmlinux.lds.h: Add PGO and AutoFDO input sections Date: Fri, 15 Jan 2021 13:27:45 +0100 Message-Id: <20210115121957.158347707@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121956.731354372@linuxfoundation.org> References: <20210115121956.731354372@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Nick Desaulniers commit eff8728fe69880d3f7983bec3fb6cea4c306261f upstream. Basically, consider .text.{hot|unlikely|unknown}.* part of .text, too. When compiling with profiling information (collected via PGO instrumentations or AutoFDO sampling), Clang will separate code into .text.hot, .text.unlikely, or .text.unknown sections based on profiling information. After D79600 (clang-11), these sections will have a trailing `.` suffix, ie. .text.hot., .text.unlikely., .text.unknown.. When using -ffunction-sections together with profiling infomation, either explicitly (FGKASLR) or implicitly (LTO), code may be placed in sections following the convention: .text.hot., .text.unlikely., .text.unknown. where , , and are functions. (This produces one section per function; we generally try to merge these all back via linker script so that we don't have 50k sections). For the above cases, we need to teach our linker scripts that such sections might exist and that we'd explicitly like them grouped together, otherwise we can wind up with code outside of the _stext/_etext boundaries that might not be mapped properly for some architectures, resulting in boot failures. If the linker script is not told about possible input sections, then where the section is placed as output is a heuristic-laiden mess that's non-portable between linkers (ie. BFD and LLD), and has resulted in many hard to debug bugs. Kees Cook is working on cleaning this up by adding --orphan-handling=warn linker flag used in ARCH=powerpc to additional architectures. In the case of linker scripts, borrowing from the Zen of Python: explicit is better than implicit. Also, ld.bfd's internal linker script considers .text.hot AND .text.hot.* to be part of .text, as well as .text.unlikely and .text.unlikely.*. I didn't see support for .text.unknown.*, and didn't see Clang producing such code in our kernel builds, but I see code in LLVM that can produce such section names if profiling information is missing. That may point to a larger issue with generating or collecting profiles, but I would much rather be safe and explicit than have to debug yet another issue related to orphan section placement. Reported-by: Jian Cai Suggested-by: Fāng-ruì Sòng Signed-off-by: Nick Desaulniers Signed-off-by: Kees Cook Signed-off-by: Ingo Molnar Tested-by: Luis Lozano Tested-by: Manoj Gupta Acked-by: Kees Cook Cc: linux-arch@vger.kernel.org Cc: stable@vger.kernel.org Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=add44f8d5c5c05e08b11e033127a744d61c26aee Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=1de778ed23ce7492c523d5850c6c6dbb34152655 Link: https://reviews.llvm.org/D79600 Link: https://bugs.chromium.org/p/chromium/issues/detail?id=1084760 Link: https://lore.kernel.org/r/20200821194310.3089815-7-keescook@chromium.org Debugged-by: Luis Lozano [nc: Resolve small conflict due to lack of NOINSTR_TEXT] Signed-off-by: Nathan Chancellor Signed-off-by: Greg Kroah-Hartman --- include/asm-generic/vmlinux.lds.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -459,7 +459,10 @@ */ #define TEXT_TEXT \ ALIGN_FUNCTION(); \ - *(.text.hot TEXT_MAIN .text.fixup .text.unlikely) \ + *(.text.hot .text.hot.*) \ + *(TEXT_MAIN .text.fixup) \ + *(.text.unlikely .text.unlikely.*) \ + *(.text.unknown .text.unknown.*) \ *(.text..refcount) \ *(.ref.text) \ MEM_KEEP(init.text) \ From patchwork Fri Jan 15 12:27:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 364536 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 5F24CC43331 for ; Fri, 15 Jan 2021 13:06:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2B5A92256F for ; Fri, 15 Jan 2021 13:06:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733290AbhAONF5 (ORCPT ); Fri, 15 Jan 2021 08:05:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:36246 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732610AbhAOMb0 (ORCPT ); Fri, 15 Jan 2021 07:31:26 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id DAFCA2333E; Fri, 15 Jan 2021 12:30:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610713859; bh=C4QXe8+HEIga6AqCcUTyir1PTpQjRJx+AJkHUyp9Hrk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wm/lns3aie/0Jq4gGZ13kl9JJ1KYRcVylFIgF+oIBlcIcincpV68ecS8kfm1TxppD 9qEhs6v7Xr9QUXG8ZQNrZkKXMdFPKzWf5KjOfeCQj/vVNxDNZSYGILYE68s5usMBai NTQdYmI0Uckvsr5MLlOAP74Om1fRpaEN+7/o/j78= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Richard Weinberger , Zhihao Cheng , Sudip Mukherjee Subject: [PATCH 4.14 10/28] ubifs: wbuf: Dont leak kernel memory to flash Date: Fri, 15 Jan 2021 13:27:47 +0100 Message-Id: <20210115121957.258514238@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121956.731354372@linuxfoundation.org> References: <20210115121956.731354372@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Richard Weinberger commit 20f1431160c6b590cdc269a846fc5a448abf5b98 upstream Write buffers use a kmalloc()'ed buffer, they can leak up to seven bytes of kernel memory to flash if writes are not aligned. So use ubifs_pad() to fill these gaps with padding bytes. This was never a problem while scanning because the scanner logic manually aligns node lengths and skips over these gaps. Cc: Fixes: 1e51764a3c2ac05a2 ("UBIFS: add new flash file system") Signed-off-by: Richard Weinberger Reviewed-by: Zhihao Cheng Signed-off-by: Richard Weinberger [sudip: adjust context] Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- fs/ubifs/io.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) --- a/fs/ubifs/io.c +++ b/fs/ubifs/io.c @@ -331,7 +331,7 @@ void ubifs_pad(const struct ubifs_info * { uint32_t crc; - ubifs_assert(pad >= 0 && !(pad & 7)); + ubifs_assert(pad >= 0); if (pad >= UBIFS_PAD_NODE_SZ) { struct ubifs_ch *ch = buf; @@ -727,6 +727,10 @@ int ubifs_wbuf_write_nolock(struct ubifs * write-buffer. */ memcpy(wbuf->buf + wbuf->used, buf, len); + if (aligned_len > len) { + ubifs_assert(aligned_len - len < 8); + ubifs_pad(c, wbuf->buf + wbuf->used + len, aligned_len - len); + } if (aligned_len == wbuf->avail) { dbg_io("flush jhead %s wbuf to LEB %d:%d", @@ -819,13 +823,18 @@ int ubifs_wbuf_write_nolock(struct ubifs } spin_lock(&wbuf->lock); - if (aligned_len) + if (aligned_len) { /* * And now we have what's left and what does not take whole * max. write unit, so write it to the write-buffer and we are * done. */ memcpy(wbuf->buf, buf + written, len); + if (aligned_len > len) { + ubifs_assert(aligned_len - len < 8); + ubifs_pad(c, wbuf->buf + len, aligned_len - len); + } + } if (c->leb_size - wbuf->offs >= c->max_write_size) wbuf->size = c->max_write_size; From patchwork Fri Jan 15 12:27:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 364538 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 28F25C4332B for ; Fri, 15 Jan 2021 13:05:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 06F07221FA for ; Fri, 15 Jan 2021 13:05:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733036AbhAONFl (ORCPT ); Fri, 15 Jan 2021 08:05:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:36296 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732647AbhAOMba (ORCPT ); Fri, 15 Jan 2021 07:31:30 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 45B1723370; Fri, 15 Jan 2021 12:31:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610713863; bh=nuIHiwNqJXh2xY9skYdyFQFpAYUgosbDWknWX8Xop+Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=07ZESMtFalBz/1TyooNfdSwG3idb4XlTz4FDplTKcmBd7d1ORtWjY6LireNxcjwwR IXiRF0+O8SAeHLsykoFsZmGClC2DTb7S5aGMxRK8mKBBJKlbLkTrIuf8CjMOMmqtQ0 jxiJgKadgpIyZGsAMIlEGSFzSyLGucEfqusH0RSE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Nyekjaer , Jonathan Cameron , Sudip Mukherjee Subject: [PATCH 4.14 12/28] iio: imu: st_lsm6dsx: flip irq return logic Date: Fri, 15 Jan 2021 13:27:49 +0100 Message-Id: <20210115121957.363993114@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121956.731354372@linuxfoundation.org> References: <20210115121956.731354372@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Sean Nyekjaer commit ec76d918f23034f9f662539ca9c64e2ae3ba9fba upstream No need for using reverse logic in the irq return, fix this by flip things around. Signed-off-by: Sean Nyekjaer Signed-off-by: Jonathan Cameron Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c @@ -401,7 +401,7 @@ static irqreturn_t st_lsm6dsx_handler_th count = st_lsm6dsx_read_fifo(hw); mutex_unlock(&hw->fifo_lock); - return !count ? IRQ_NONE : IRQ_HANDLED; + return count ? IRQ_HANDLED : IRQ_NONE; } static int st_lsm6dsx_buffer_preenable(struct iio_dev *iio_dev) From patchwork Fri Jan 15 12:27:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 364654 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 B23B8C43331 for ; Fri, 15 Jan 2021 12:31:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7BF39235F8 for ; Fri, 15 Jan 2021 12:31:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732666AbhAOMbc (ORCPT ); Fri, 15 Jan 2021 07:31:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:36412 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732655AbhAOMbb (ORCPT ); Fri, 15 Jan 2021 07:31:31 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7BAC5235F8; Fri, 15 Jan 2021 12:31:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610713865; bh=T1ZqFLYYqF004QD5vkX34Vl9/pY2PW6cv416TriwQYE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OohF+Zi0Doik54S5g6McjVXzYgDoo3CL9tJo2JYbRHig/51c7dEZ1+Su/1Yqc4ftG jH5redHnmirMf6J+7/VdASU3FmzwLLndiWXrzL2q7AI4hqCUJ5v60gb+/60MMS9Bw7 RTs/dXYCkePbpZLu5wbZxlx7T3+xua2Opk4oxH5k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lorenzo Bianconi , Stable@vger.kernel.org, Jonathan Cameron , Sudip Mukherjee Subject: [PATCH 4.14 13/28] iio: imu: st_lsm6dsx: fix edge-trigger interrupts Date: Fri, 15 Jan 2021 13:27:50 +0100 Message-Id: <20210115121957.413861346@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121956.731354372@linuxfoundation.org> References: <20210115121956.731354372@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Lorenzo Bianconi commit 3f9bce7a22a3f8ac9d885c9d75bc45569f24ac8b upstream If we are using edge IRQs, new samples can arrive while processing current interrupt since there are no hw guarantees the irq line stays "low" long enough to properly detect the new interrupt. In this case the new sample will be missed. Polling FIFO status register in st_lsm6dsx_handler_thread routine allow us to read new samples even if the interrupt arrives while processing previous data and the timeslot where the line is "low" is too short to be properly detected. Fixes: 89ca88a7cdf2 ("iio: imu: st_lsm6dsx: support active-low interrupts") Fixes: 290a6ce11d93 ("iio: imu: add support to lsm6dsx driver") Signed-off-by: Lorenzo Bianconi Link: https://lore.kernel.org/r/5e93cda7dc1e665f5685c53ad8e9ea71dbae782d.1605378871.git.lorenzo@kernel.org Cc: Signed-off-by: Jonathan Cameron [sudip: manual backport to old irq handler path] Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 26 ++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c @@ -395,13 +395,29 @@ static irqreturn_t st_lsm6dsx_handler_ir static irqreturn_t st_lsm6dsx_handler_thread(int irq, void *private) { struct st_lsm6dsx_hw *hw = private; - int count; + int fifo_len = 0, len; - mutex_lock(&hw->fifo_lock); - count = st_lsm6dsx_read_fifo(hw); - mutex_unlock(&hw->fifo_lock); + /* + * If we are using edge IRQs, new samples can arrive while + * processing current interrupt since there are no hw + * guarantees the irq line stays "low" long enough to properly + * detect the new interrupt. In this case the new sample will + * be missed. + * Polling FIFO status register allow us to read new + * samples even if the interrupt arrives while processing + * previous data and the timeslot where the line is "low" is + * too short to be properly detected. + */ + do { + mutex_lock(&hw->fifo_lock); + len = st_lsm6dsx_read_fifo(hw); + mutex_unlock(&hw->fifo_lock); - return count ? IRQ_HANDLED : IRQ_NONE; + if (len > 0) + fifo_len += len; + } while (len > 0); + + return fifo_len ? IRQ_HANDLED : IRQ_NONE; } static int st_lsm6dsx_buffer_preenable(struct iio_dev *iio_dev) From patchwork Fri Jan 15 12:27:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 364540 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 9DAC4C4332B for ; Fri, 15 Jan 2021 13:05:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7A91D2313E for ; Fri, 15 Jan 2021 13:05:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732952AbhAONFX (ORCPT ); Fri, 15 Jan 2021 08:05:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:36440 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732674AbhAOMbd (ORCPT ); Fri, 15 Jan 2021 07:31:33 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 19A2A238E7; Fri, 15 Jan 2021 12:31:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610713872; bh=2lfO5BMhBRCISYYSfisVBIn98GspxvrD9EFkcEhvGtg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SynfEvpPe1LzrzTPbjJPcEh8vaZ9GL6cGc2Gebu/OqcCT2XulbI2S5Rk+mgnDkXtz iCYrCPbq6/Lw/9gxqJIe/3fkvGSGFw+wWPovVXj2yMnNzg14QkoXI14/dsMuLjgSSG XAUjQdcUnYI12GjLeSbgeOJ74D3GaojPfAksz7DI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Viresh Kumar , Colin Ian King , "Rafael J. Wysocki" Subject: [PATCH 4.14 16/28] cpufreq: powernow-k8: pass policy rather than use cpufreq_cpu_get() Date: Fri, 15 Jan 2021 13:27:53 +0100 Message-Id: <20210115121957.564911000@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121956.731354372@linuxfoundation.org> References: <20210115121956.731354372@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Colin Ian King commit 943bdd0cecad06da8392a33093230e30e501eccc upstream. Currently there is an unlikely case where cpufreq_cpu_get() returns a NULL policy and this will cause a NULL pointer dereference later on. Fix this by passing the policy to transition_frequency_fidvid() from the caller and hence eliminating the need for the cpufreq_cpu_get() and cpufreq_cpu_put(). Thanks to Viresh Kumar for suggesting the fix. Addresses-Coverity: ("Dereference null return") Fixes: b43a7ffbf33b ("cpufreq: Notify all policy->cpus in cpufreq_notify_transition()") Suggested-by: Viresh Kumar Signed-off-by: Colin Ian King Acked-by: Viresh Kumar Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman --- drivers/cpufreq/powernow-k8.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) --- a/drivers/cpufreq/powernow-k8.c +++ b/drivers/cpufreq/powernow-k8.c @@ -887,9 +887,9 @@ static int get_transition_latency(struct /* Take a frequency, and issue the fid/vid transition command */ static int transition_frequency_fidvid(struct powernow_k8_data *data, - unsigned int index) + unsigned int index, + struct cpufreq_policy *policy) { - struct cpufreq_policy *policy; u32 fid = 0; u32 vid = 0; int res; @@ -921,9 +921,6 @@ static int transition_frequency_fidvid(s freqs.old = find_khz_freq_from_fid(data->currfid); freqs.new = find_khz_freq_from_fid(fid); - policy = cpufreq_cpu_get(smp_processor_id()); - cpufreq_cpu_put(policy); - cpufreq_freq_transition_begin(policy, &freqs); res = transition_fid_vid(data, fid, vid); cpufreq_freq_transition_end(policy, &freqs, res); @@ -978,7 +975,7 @@ static long powernowk8_target_fn(void *a powernow_k8_acpi_pst_values(data, newstate); - ret = transition_frequency_fidvid(data, newstate); + ret = transition_frequency_fidvid(data, newstate, pol); if (ret) { pr_err("transition frequency failed\n"); From patchwork Fri Jan 15 12:27:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 364541 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 DF8A1C4332B for ; Fri, 15 Jan 2021 13:04:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A5B0022473 for ; Fri, 15 Jan 2021 13:04:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732703AbhAONET (ORCPT ); Fri, 15 Jan 2021 08:04:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:37056 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732700AbhAOMbg (ORCPT ); Fri, 15 Jan 2021 07:31:36 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4A48E238A0; Fri, 15 Jan 2021 12:31:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610713874; bh=NahTOkR+9aPL6JZsWrG55pB7FafAa/JdFnzdbVfWbM8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HCjQeDPebpAtqRx07yiGEaljd0Z6teK1PbiR3UgSTc733PVtLgUo/zr71CJ99pFe8 TnojyzpsYyYosmKt3wG3S+YNty59a4/8DKJm8bT3M0MET30Cjcb+pjiLPK8VpjQsqA R5ayQ7d5br0BX745rXG02/OqrbskNYI/TGe4q+5w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Roman Guskov , Marek Vasut , Mark Brown Subject: [PATCH 4.14 17/28] spi: stm32: FIFO threshold level - fix align packet size Date: Fri, 15 Jan 2021 13:27:54 +0100 Message-Id: <20210115121957.614595194@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121956.731354372@linuxfoundation.org> References: <20210115121956.731354372@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Roman Guskov commit a590370d918fc66c62df6620445791fbe840344a upstream. if cur_bpw <= 8 and xfer_len < 4 then the value of fthlv will be 1 and SPI registers content may have been lost. * If SPI data register is accessed as a 16-bit register and DSIZE <= 8bit, better to select FTHLV = 2, 4, 6 etc * If SPI data register is accessed as a 32-bit register and DSIZE > 8bit, better to select FTHLV = 2, 4, 6 etc, while if DSIZE <= 8bit, better to select FTHLV = 4, 8, 12 etc Signed-off-by: Roman Guskov Fixes: dcbe0d84dfa5 ("spi: add driver for STM32 SPI controller") Reviewed-by: Marek Vasut Link: https://lore.kernel.org/r/20201221123532.27272-1-rguskov@dh-electronics.com Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- drivers/spi/spi-stm32.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/spi/spi-stm32.c +++ b/drivers/spi/spi-stm32.c @@ -299,9 +299,9 @@ static u32 stm32_spi_prepare_fthlv(struc /* align packet size with data registers access */ if (spi->cur_bpw > 8) - fthlv -= (fthlv % 2); /* multiple of 2 */ + fthlv += (fthlv % 2) ? 1 : 0; else - fthlv -= (fthlv % 4); /* multiple of 4 */ + fthlv += (fthlv % 4) ? (4 - (fthlv % 4)) : 0; return fthlv; } From patchwork Fri Jan 15 12:27:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 364549 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 13866C43381 for ; Fri, 15 Jan 2021 13:02:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E4C1B22473 for ; Fri, 15 Jan 2021 13:02:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731288AbhAOMcj (ORCPT ); Fri, 15 Jan 2021 07:32:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:39354 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731075AbhAOMcj (ORCPT ); Fri, 15 Jan 2021 07:32:39 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1FEF52333E; Fri, 15 Jan 2021 12:31:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610713918; bh=aSnKwTyvPSgMuEGzB6MgxvdJEneQ1pXlJJIoOqU/ADE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yx8Nf/AiSfn4M7zIgBdytdP5bBS0z9ih0iq+4szgdVNqKV44me4mu6SlxKKBmO9Nm QuKbpmpDU5IbrTetFdp2kKgKLikXKJYO5+To8XP+Nx4+r73gwKlP6KDa+wwlfN6jM9 kejhrVCwKY5woJYdQAryK2sGFRLCD7dbvSZbalsE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shravya Kumbham , Radhey Shyam Pandey , Vinod Koul Subject: [PATCH 4.14 19/28] dmaengine: xilinx_dma: fix mixed_enum_type coverity warning Date: Fri, 15 Jan 2021 13:27:56 +0100 Message-Id: <20210115121957.711108493@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121956.731354372@linuxfoundation.org> References: <20210115121956.731354372@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Shravya Kumbham commit 2d5efea64472469117dc1a9a39530069e95b21e9 upstream. Typecast the fls(width -1) with (enum dmaengine_alignment) in xilinx_dma_chan_probe function to fix the coverity warning. Addresses-Coverity: Event mixed_enum_type. Fixes: 9cd4360de609 ("dma: Add Xilinx AXI Video Direct Memory Access Engine driver support") Signed-off-by: Shravya Kumbham Signed-off-by: Radhey Shyam Pandey Link: https://lore.kernel.org/r/1608722462-29519-4-git-send-email-radhey.shyam.pandey@xilinx.com Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman --- drivers/dma/xilinx/xilinx_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/dma/xilinx/xilinx_dma.c +++ b/drivers/dma/xilinx/xilinx_dma.c @@ -2360,7 +2360,7 @@ static int xilinx_dma_chan_probe(struct has_dre = false; if (!has_dre) - xdev->common.copy_align = fls(width - 1); + xdev->common.copy_align = (enum dmaengine_alignment)fls(width - 1); if (of_device_is_compatible(node, "xlnx,axi-vdma-mm2s-channel") || of_device_is_compatible(node, "xlnx,axi-dma-mm2s-channel") || From patchwork Fri Jan 15 12:27:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 363610 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp272465jap; Fri, 15 Jan 2021 05:03:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJxykr77Dr6JF2Mzigyer3Q6GJLYVF8phewnC2c4rSpq920fKCwsNSDlY65wuEx1a8YNJt3A X-Received: by 2002:a05:6402:487:: with SMTP id k7mr9532570edv.130.1610715808315; Fri, 15 Jan 2021 05:03:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610715808; cv=none; d=google.com; s=arc-20160816; b=WgU1T8Fwuw3B5EIpZJlPNFXtRZytwRze3Ymm56E14ddZqnzTGTelvIJz7IctvVZmo3 vrCoKAR3vzVuvgbG+pD8gUUCGqz8ZeSlHTXy/5i1Butv8XVeq/TiD+lfPcP8YfDFuTzg FaElkFekFdzswIznwzepI1eF89xgMACgs4qEsDiuvZVii09UC8C9ZtPIW6WJutUdeDsT J3znLBV65HV/dSBXm67CtIVP2lwqT+ZsSNidW9Lhcsi8j+1LZIrtt0MYJYlYhpw88E1a 4GDr7sISiOhhR4BOzwgcFELvFQ+qUTFw3tOwenr76JY107hTiTJe4M30q2TvegL7+4Pq EJog== 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=K+aLa4Lwtw23nHeiF3ghOlPKPHvOdg5oqR0v3xRwTUA=; b=iNpuI7Uy9V/5tncB1rpnyZ6hyznWYhd9fKlxfyUt7YEs6eEoVSt+QL9z3ck2dN8gVf GzevtiSFbdi+uLlB8j1uqT0jaDg9wlXrDZtwAgOnxcOT8MPUOMQIa0AxjqkuIU8PHjCd geZOhXQv5mS1pF9fni/cIPPd9uq9Q2O0RZd3soXIBBxB1vM4qVyECPgcyN45Q6wEIHgQ LcmvNW2marU1uejzi9rAd+DIdJU9cCBvPxuYtX1uv6kv6d0SF/7WOmlqWsOzBXS6mh+B l1eMF4PYpfycbGWS6Qc3Allzl14iS3wrmUZFJIHPlixlx3Cx1vYlOlbPgxYqWYXZd6o4 ZV0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Vt3PNE/u"; 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 i12si4390850edn.0.2021.01.15.05.03.28; Fri, 15 Jan 2021 05:03:28 -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="Vt3PNE/u"; 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 S1732925AbhAONDR (ORCPT + 13 others); Fri, 15 Jan 2021 08:03:17 -0500 Received: from mail.kernel.org ([198.145.29.99]:36470 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729039AbhAOMby (ORCPT ); Fri, 15 Jan 2021 07:31:54 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5C21C22473; Fri, 15 Jan 2021 12:31:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610713898; bh=s5rdMnDuSkDqSsdKS3Kfx41GvoHWbEtG2/DA60iC/qQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vt3PNE/uGE7MXuZCWeAas6aL1p/7M2JUshXvc5vXTcUGCxNP0vn4XGxKlQcmuiC6B wiHeLgQObBlNx7KC45pN2nP2yUx0XL9njuiUEZxoTWVfnLBW9WpfSpyHtZWx48j3VB h4JW15au0iSKnvEjR/wc5VcyjkhdWN2zSKC4v9Mk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , "David S. Miller" Subject: [PATCH 4.14 20/28] wil6210: select CONFIG_CRC32 Date: Fri, 15 Jan 2021 13:27:57 +0100 Message-Id: <20210115121957.760189683@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121956.731354372@linuxfoundation.org> References: <20210115121956.731354372@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 commit e186620d7bf11b274b985b839c38266d7918cc05 upstream. Without crc32, the driver fails to link: arm-linux-gnueabi-ld: drivers/net/wireless/ath/wil6210/fw.o: in function `wil_fw_verify': fw.c:(.text+0x74c): undefined reference to `crc32_le' arm-linux-gnueabi-ld: drivers/net/wireless/ath/wil6210/fw.o:fw.c:(.text+0x758): more undefined references to `crc32_le' follow Fixes: 151a9706503f ("wil6210: firmware download") Signed-off-by: Arnd Bergmann Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/ath/wil6210/Kconfig | 1 + 1 file changed, 1 insertion(+) --- a/drivers/net/wireless/ath/wil6210/Kconfig +++ b/drivers/net/wireless/ath/wil6210/Kconfig @@ -1,6 +1,7 @@ config WIL6210 tristate "Wilocity 60g WiFi card wil6210 support" select WANT_DEV_COREDUMP + select CRC32 depends on CFG80211 depends on PCI default n From patchwork Fri Jan 15 12:27:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 363609 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp272392jap; Fri, 15 Jan 2021 05:03:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJy8STlrO9mTwkDKJPpKJsQH0x8Me4DeRPRbrMaZk6fl4+hAdZUdGUL/22cWYAXGsoE401uc X-Received: by 2002:aa7:c1c6:: with SMTP id d6mr9463032edp.275.1610715804433; Fri, 15 Jan 2021 05:03:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610715804; cv=none; d=google.com; s=arc-20160816; b=x1fmAUbGDJF+aIaG5DZ8+XxK5Sk5/V7jbS3TeIfO0jrgHvhdfLZNo7v/if1OFBgRFA 4J0cGGCJlagctbPInq8NoVzYCygHkPpw63XPegUOZJa3B521w9u8A2niNXyaG8oMVf7l ijnhpKvA5SonhJR9AC+WzlBz5aHYO8u3nbQxN6mKp3kqxrvPh5HdjL5WbS4OYCIIlrPn DJB2pdo6sOZBEmbYKJ92BT8LaMDAszQzDuxuS/ZgEgPoXUjrf5oeMqVMy9aRnJcom1ca FKUvjjr7a45FPf/JT5q0k47RfrVahYoKCMihcMdPhewrltGwVHNCjrAX6zk7VSRRpe/y KQDA== 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=SKEJ8CQndEoOBHI/SbYEK0VI/rM9MaJYcb81A17/Sm0=; b=j+S1K+psX5oLTMckMIAeHw65APHMNiasdFbhgs9fWgGO4QaPhmHLT0GV5dGReNLu05 k5C1CzneFU89f85+Oa0pOheeiPaZnZYjh2WjQTUzzhaeWVYCPl73WJTUVy1mtRfWBWwv +Z0iWodAX3KLa28JulfGqFInMPm/r8yt7taWM0NJpITcJ4M2cbSquEj8tGRFQzyik4oh Opi5QLE5tNE8qXgDskcP0l692eB5aR0xJhRoJAaA+wT0BijBfnAx0NrsqrZ10TQaG3dU lqJmjal/sBE5od1ZUORAIWSuyad4z+JszCqixK1BmxioKQCuEIGwhVR/JgvGgBLxkLFm JefQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XBT7a65i; 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 i12si4390850edn.0.2021.01.15.05.03.24; Fri, 15 Jan 2021 05:03:24 -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=XBT7a65i; 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 S1731501AbhAOMc0 (ORCPT + 13 others); Fri, 15 Jan 2021 07:32:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:38574 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730741AbhAOMcV (ORCPT ); Fri, 15 Jan 2021 07:32:21 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 851D423403; Fri, 15 Jan 2021 12:31:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610713901; bh=xLN9rYuyNDG9+P6Of6Xx9oVOeW5BxrDM7o0vEdrzRyw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XBT7a65ixGCIh00PwfpagpH4rX4DWBE7GWDdN66u7lESreSTPcvdhTS0O8X4lxYu2 1qsvlRJTfSQF5NMbtwK96Yu1TXs6JVbMSm/XQDchYZBvHhNnFUSp1MMTYMPuwCvHRK a8qkk6AtLhmaA4JNzrYmA+A/e1EDpQIF62sRUD6w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Jens Axboe Subject: [PATCH 4.14 21/28] block: rsxx: select CONFIG_CRC32 Date: Fri, 15 Jan 2021 13:27:58 +0100 Message-Id: <20210115121957.810788328@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121956.731354372@linuxfoundation.org> References: <20210115121956.731354372@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 commit 36a106a4c1c100d55ba3d32a21ef748cfcd4fa99 upstream. Without crc32, the driver fails to link: arm-linux-gnueabi-ld: drivers/block/rsxx/config.o: in function `rsxx_load_config': config.c:(.text+0x124): undefined reference to `crc32_le' Fixes: 8722ff8cdbfa ("block: IBM RamSan 70/80 device driver") Signed-off-by: Arnd Bergmann Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- drivers/block/Kconfig | 1 + 1 file changed, 1 insertion(+) --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig @@ -477,6 +477,7 @@ config BLK_DEV_RBD config BLK_DEV_RSXX tristate "IBM Flash Adapter 900GB Full Height PCIe Device Driver" depends on PCI + select CRC32 help Device driver for IBM's high speed PCIe SSD storage device: Flash Adapter 900GB Full Height. From patchwork Fri Jan 15 12:28:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 364545 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 BEE35C4332D for ; Fri, 15 Jan 2021 13:03:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A114D2256F for ; Fri, 15 Jan 2021 13:03:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732908AbhAOMcB (ORCPT ); Fri, 15 Jan 2021 07:32:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:36246 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732902AbhAOMcA (ORCPT ); Fri, 15 Jan 2021 07:32:00 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id E9BD42339D; Fri, 15 Jan 2021 12:31:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610713905; bh=yyKG51TFr5nmyyBWUHygy67mu7D8MjIYdZJXAt2amRw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K4vlsCG986xQT/iGOLIIDIcZPtyyiBZcVgfzsyA+DyZ7oRU6tfVCUVz9v4fm4aG59 rnbNM6lveDS2KO/G+fePGOMgneie4FR1qAF93V6aPo94JU24mg07XjIHqwrc2qmDHQ sMJw9DzB8hGXptSLOdE6NNxB+B4DgttLlavwanDI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dinghao Liu , Leon Romanovsky , Saeed Mahameed Subject: [PATCH 4.14 23/28] net/mlx5e: Fix memleak in mlx5e_create_l2_table_groups Date: Fri, 15 Jan 2021 13:28:00 +0100 Message-Id: <20210115121957.908836920@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121956.731354372@linuxfoundation.org> References: <20210115121956.731354372@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dinghao Liu commit 5b0bb12c58ac7d22e05b5bfdaa30a116c8c32e32 upstream. When mlx5_create_flow_group() fails, ft->g should be freed just like when kvzalloc() fails. The caller of mlx5e_create_l2_table_groups() does not catch this issue on failure, which leads to memleak. Fixes: 33cfaaa8f36f ("net/mlx5e: Split the main flow steering table") Signed-off-by: Dinghao Liu Reviewed-by: Leon Romanovsky Signed-off-by: Saeed Mahameed Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/mellanox/mlx5/core/en_fs.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c @@ -1226,6 +1226,7 @@ err_destroy_groups: ft->g[ft->num_groups] = NULL; mlx5e_destroy_groups(ft); kvfree(in); + kfree(ft->g); return err; } From patchwork Fri Jan 15 12:28:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 364547 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 5F809C433E6 for ; Fri, 15 Jan 2021 13:03:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3B5332313E for ; Fri, 15 Jan 2021 13:03:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732274AbhAONCz (ORCPT ); Fri, 15 Jan 2021 08:02:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:38812 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730547AbhAOMc2 (ORCPT ); Fri, 15 Jan 2021 07:32:28 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1E0C72336F; Fri, 15 Jan 2021 12:31:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610713907; bh=KKI8c2MnX3T8Cm0yAMypUIKdS5rZfUM5pbM2z1a3cWc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Esm9vDJTxF1aHESU0VTrBw7l18C29vTt/j1A+Ndaujgjyy41hwKsujIXDg+1mRaOd DIKDWT9seaHu0/suQcz4yTBDdfX5C+/eRwzCr7NC5Gaa+EAfKBzlTjgQE3QPBrmLL5 Fd8j9zKGw6C6NwOZBUmTjDAaCXrop+kUHKsOLNUI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dinghao Liu , Leon Romanovsky , Saeed Mahameed Subject: [PATCH 4.14 24/28] net/mlx5e: Fix two double free cases Date: Fri, 15 Jan 2021 13:28:01 +0100 Message-Id: <20210115121957.959826861@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121956.731354372@linuxfoundation.org> References: <20210115121956.731354372@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dinghao Liu commit 7a6eb072a9548492ead086f3e820e9aac71c7138 upstream. mlx5e_create_ttc_table_groups() frees ft->g on failure of kvzalloc(), but such failure will be caught by its caller in mlx5e_create_ttc_table() and ft->g will be freed again in mlx5e_destroy_flow_table(). The same issue also occurs in mlx5e_create_ttc_table_groups(). Set ft->g to NULL after kfree() to avoid double free. Fixes: 7b3722fa9ef6 ("net/mlx5e: Support RSS for GRE tunneled packets") Fixes: 33cfaaa8f36f ("net/mlx5e: Split the main flow steering table") Signed-off-by: Dinghao Liu Reviewed-by: Leon Romanovsky Signed-off-by: Saeed Mahameed Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/mellanox/mlx5/core/en_fs.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c @@ -961,6 +961,7 @@ static int mlx5e_create_inner_ttc_table_ in = kvzalloc(inlen, GFP_KERNEL); if (!in) { kfree(ft->g); + ft->g = NULL; return -ENOMEM; } @@ -1181,6 +1182,7 @@ static int mlx5e_create_l2_table_groups( in = kvzalloc(inlen, GFP_KERNEL); if (!in) { kfree(ft->g); + ft->g = NULL; return -ENOMEM; } From patchwork Fri Jan 15 12:28:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 363575 Delivered-To: patch@linaro.org Received: by 2002:a17:906:fb05:0:0:0:0 with SMTP id lz5csp469418ejb; Fri, 15 Jan 2021 04:33:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJyYBcbtNx/pMlIVtznvc6Gw/MgF0MNQtDme1m5mmAB2+hIPDSzrp0zLNKdUbgui3ndXTZ1q X-Received: by 2002:a17:906:cb86:: with SMTP id mf6mr8444831ejb.57.1610714011805; Fri, 15 Jan 2021 04:33:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610714011; cv=none; d=google.com; s=arc-20160816; b=vd2lu8XGnKKNBoJumXYJTp7e6VRwavf2PzC7OosXwbg3ZyyKxdU/EyzEO+9q9UGUVC 0L6hWtVqpxKp1M1t79LJkK3nFQBx/Cq/W19eyyd7Wyfdzvvb4RDqK2zjV2rWIvuXAiSV 8MSUNCV/Mw6dN/4Kt/ohW7jBPiuvQlzo/ygePQ/VUvPFxydgwYJBRYN0zlKaQ9zcl2+B M8nePM2fcYQ9QJ/gFdvoo+BrbFQzmCUgoVl/mSdPMkzgOWCv+f/K2AkrMLjR4QVYMbP2 1laLMbNAU1QsZ027+DgWliLpxPT2AUr8mn1Ms0LP4dCL3Sl8TBF2mND354NJbVjfwlDj hvZw== 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=8V19FoB/3kYTuImn7NMSRUArBF62snp98xo3FAUqQYE=; b=TxFMezb1lrouBozCn1cJ/xu7VIucOkjyUEfYF6acapiydEh6fBxi3x/1+9A4Ji0l0I DP65blHYeyBLIyw+kSgNHdTDuKeXWOXYzs6L6H/px5bR8io6lnykxxWpSvfdwixhjNiB i06BdfmQZeDSnKA/ap0EoBKG+TMo8Q8C2t774ChtwarsjmWR8QuqLclFLFPyU6a1+QXQ jDqm8X5h6hIKO+iFNOwRCoALWNRMeqOsrCtHOFwKiu6/Tm6GxGjMx4CsElSbm6V66nLm 9sRSbbxKd3ChjApxyRF5ZtlJEfurn+CnV+QcbWS4eKfDDEaAS8g5OA2+jgB2Av3axC+k lLAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VyRbTje1; 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 w6si4026762edt.581.2021.01.15.04.33.31; Fri, 15 Jan 2021 04:33:31 -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=VyRbTje1; 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 S1728330AbhAOMcL (ORCPT + 13 others); Fri, 15 Jan 2021 07:32:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:36412 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732952AbhAOMcF (ORCPT ); Fri, 15 Jan 2021 07:32:05 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4903E2371F; Fri, 15 Jan 2021 12:31:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610713909; bh=fA0KTB++A7mRqnSitYulWdbeN4Ebxk5der3k//c7uXg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VyRbTje1FDxJeqAVV05WooD8SHYXnvUsz4ub4mJtDNce3QddmPe+wS92OtzTqbqXT FVSh5460/N/cezq4vMm4JU8t43S9Ah41v6lNB4YFuVeri/p+C1La+7qpK3HoZc9z3k vrHJBJO24SVg93wBuQLtDbUtK+VorCnZ0IxsimIk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , "David S. Miller" Subject: [PATCH 4.14 25/28] wan: ds26522: select CONFIG_BITREVERSE Date: Fri, 15 Jan 2021 13:28:02 +0100 Message-Id: <20210115121958.009046011@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121956.731354372@linuxfoundation.org> References: <20210115121956.731354372@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 commit 69931e11288520c250152180ecf9b6ac5e6e40ed upstream. Without this, the driver runs into a link failure arm-linux-gnueabi-ld: drivers/net/wan/slic_ds26522.o: in function `slic_ds26522_probe': slic_ds26522.c:(.text+0x100c): undefined reference to `byte_rev_table' arm-linux-gnueabi-ld: slic_ds26522.c:(.text+0x1cdc): undefined reference to `byte_rev_table' arm-linux-gnueabi-ld: drivers/net/wan/slic_ds26522.o: in function `slic_write': slic_ds26522.c:(.text+0x1e4c): undefined reference to `byte_rev_table' Fixes: c37d4a0085c5 ("Maxim/driver: Add driver for maxim ds26522") Signed-off-by: Arnd Bergmann Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/wan/Kconfig | 1 + 1 file changed, 1 insertion(+) --- a/drivers/net/wan/Kconfig +++ b/drivers/net/wan/Kconfig @@ -295,6 +295,7 @@ config SLIC_DS26522 tristate "Slic Maxim ds26522 card support" depends on SPI depends on FSL_SOC || ARCH_MXC || ARCH_LAYERSCAPE || COMPILE_TEST + select BITREVERSE help This module initializes and configures the slic maxim card in T1 or E1 mode. From patchwork Fri Jan 15 12:28:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 364548 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 63B0FC4332D for ; Fri, 15 Jan 2021 13:02:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3024723382 for ; Fri, 15 Jan 2021 13:02:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732982AbhAOMcf (ORCPT ); Fri, 15 Jan 2021 07:32:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:39206 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732980AbhAOMce (ORCPT ); Fri, 15 Jan 2021 07:32:34 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id ABF7C223E0; Fri, 15 Jan 2021 12:31:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610713914; bh=NV5wkySH4VnUgK2tzF+GQZE4gy+uyLRbMXb4TMmlVpg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a/esiDNUyxNDkjNefZxdNBPYa5ulF150AZxmASA0zJZ+Q0s2jw9B7bP/aBTaTjmwY IJs4Vfi+cecHWEVuhrNGnYYc2GrMct6lxN+b3iplg8ovTBqyoah+y0AhyfKGzLWpfb j3gnZU1O5D7lzhkWPdj3r4g36wtxs5uE0WJwP3tw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+825f0f9657d4e528046e@syzkaller.appspotmail.com, Ming Lei , Christoph Hellwig , Jens Axboe Subject: [PATCH 4.14 27/28] block: fix use-after-free in disk_part_iter_next Date: Fri, 15 Jan 2021 13:28:04 +0100 Message-Id: <20210115121958.108841875@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121956.731354372@linuxfoundation.org> References: <20210115121956.731354372@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Ming Lei commit aebf5db917055b38f4945ed6d621d9f07a44ff30 upstream. Make sure that bdgrab() is done on the 'block_device' instance before referring to it for avoiding use-after-free. Cc: Reported-by: syzbot+825f0f9657d4e528046e@syzkaller.appspotmail.com Signed-off-by: Ming Lei Reviewed-by: Christoph Hellwig Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- block/genhd.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- a/block/genhd.c +++ b/block/genhd.c @@ -208,14 +208,17 @@ struct hd_struct *disk_part_iter_next(st part = rcu_dereference(ptbl->part[piter->idx]); if (!part) continue; + get_device(part_to_dev(part)); + piter->part = part; if (!part_nr_sects_read(part) && !(piter->flags & DISK_PITER_INCL_EMPTY) && !(piter->flags & DISK_PITER_INCL_EMPTY_PART0 && - piter->idx == 0)) + piter->idx == 0)) { + put_device(part_to_dev(part)); + piter->part = NULL; continue; + } - get_device(part_to_dev(part)); - piter->part = part; piter->idx += inc; break; }