From patchwork Fri Jan 15 12:27: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: 364563 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 480DBC43333 for ; Fri, 15 Jan 2021 12:58:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 248BD22473 for ; Fri, 15 Jan 2021 12:58:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732330AbhAOM54 (ORCPT ); Fri, 15 Jan 2021 07:57:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:39612 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733284AbhAOMd5 (ORCPT ); Fri, 15 Jan 2021 07:33:57 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2DF7923339; Fri, 15 Jan 2021 12:33:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714021; bh=QdGBz/Vky3oN2/OTnll2QfPUiJqMytbFuaokbv5SXiY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zC57HeNnnGwz2MmmRS9v7tgBrBfYI21aQ4qR9tUA/2HtftFMBZ0TkBVRC/vxReCBP amGkW9z2FfPozP1J4BqE4fB1MYcMbBUjgvptdiO+XQ38gJEf9KOMb7LEqRmUIan/fw K+mIDVBG/Ke22irTYAiq9PHe6E/2IWbm+kepydh8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matthew Rosato , Sasha Levin Subject: [PATCH 5.4 02/62] vfio iommu: Add dma available capability Date: Fri, 15 Jan 2021 13:27:24 +0100 Message-Id: <20210115121958.517746065@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Matthew Rosato [ Upstream commit 7d6e1329652ed971d1b6e0e7bea66fba5044e271 ] The following functional changes were needed for backport: - vfio_iommu_type1_get_info doesn't exist, call vfio_iommu_dma_avail_build_caps from vfio_iommu_type1_ioctl. - As further fallout from this, vfio_iommu_dma_avail_build_caps must acquire and release the iommu mutex lock. To do so, the return value is stored in a local variable as in vfio_iommu_iova_build_caps. Upstream commit description: Commit 492855939bdb ("vfio/type1: Limit DMA mappings per container") added the ability to limit the number of memory backed DMA mappings. However on s390x, when lazy mapping is in use, we use a very large number of concurrent mappings. Let's provide the current allowable number of DMA mappings to userspace via the IOMMU info chain so that userspace can take appropriate mitigation. Signed-off-by: Matthew Rosato Signed-off-by: Sasha Levin --- drivers/vfio/vfio_iommu_type1.c | 22 ++++++++++++++++++++++ include/uapi/linux/vfio.h | 15 +++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c index 3b31e83a92155..bc6ba41686fa3 100644 --- a/drivers/vfio/vfio_iommu_type1.c +++ b/drivers/vfio/vfio_iommu_type1.c @@ -2303,6 +2303,24 @@ static int vfio_iommu_iova_build_caps(struct vfio_iommu *iommu, return ret; } +static int vfio_iommu_dma_avail_build_caps(struct vfio_iommu *iommu, + struct vfio_info_cap *caps) +{ + struct vfio_iommu_type1_info_dma_avail cap_dma_avail; + int ret; + + mutex_lock(&iommu->lock); + cap_dma_avail.header.id = VFIO_IOMMU_TYPE1_INFO_DMA_AVAIL; + cap_dma_avail.header.version = 1; + + cap_dma_avail.avail = iommu->dma_avail; + + ret = vfio_info_add_capability(caps, &cap_dma_avail.header, + sizeof(cap_dma_avail)); + mutex_unlock(&iommu->lock); + return ret; +} + static long vfio_iommu_type1_ioctl(void *iommu_data, unsigned int cmd, unsigned long arg) { @@ -2349,6 +2367,10 @@ static long vfio_iommu_type1_ioctl(void *iommu_data, info.iova_pgsizes = vfio_pgsize_bitmap(iommu); ret = vfio_iommu_iova_build_caps(iommu, &caps); + + if (!ret) + ret = vfio_iommu_dma_avail_build_caps(iommu, &caps); + if (ret) return ret; diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h index 9e843a147ead0..cabc93118f9c8 100644 --- a/include/uapi/linux/vfio.h +++ b/include/uapi/linux/vfio.h @@ -748,6 +748,21 @@ struct vfio_iommu_type1_info_cap_iova_range { struct vfio_iova_range iova_ranges[]; }; +/* + * The DMA available capability allows to report the current number of + * simultaneously outstanding DMA mappings that are allowed. + * + * The structure below defines version 1 of this capability. + * + * avail: specifies the current number of outstanding DMA mappings allowed. + */ +#define VFIO_IOMMU_TYPE1_INFO_DMA_AVAIL 3 + +struct vfio_iommu_type1_info_dma_avail { + struct vfio_info_cap_header header; + __u32 avail; +}; + #define VFIO_IOMMU_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12) /** From patchwork Fri Jan 15 12:27:28 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: 364564 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 0FA44C43217 for ; Fri, 15 Jan 2021 12:57:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D004722473 for ; Fri, 15 Jan 2021 12:57:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387415AbhAOMeH (ORCPT ); Fri, 15 Jan 2021 07:34:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:40776 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387403AbhAOMeG (ORCPT ); Fri, 15 Jan 2021 07:34:06 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0299F235F9; Fri, 15 Jan 2021 12:33:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714030; bh=FTMobUVduluWZNTAB/xCqcTBSLOxKrQF28PrROB1VKU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x3/4PczrO9WLHQgjjnEYxetgNvnUJpXODuGlGABDNTGxIRYYzV1nStCnmJp4eH9B9 05Ebll852PUJiF3yyY8FhtlKkAlY7oeG9ARa35UxwqPnwV9bUKw4DSMcntZS108CXr bEGQ8D2kfxDZEaGDKuUtgWlQGy7FudcOJCZnHy7M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Samuel Holland , Chen-Yu Tsai , "David S. Miller" Subject: [PATCH 5.4 06/62] net: stmmac: dwmac-sun8i: Balance internal PHY resource references Date: Fri, 15 Jan 2021 13:27:28 +0100 Message-Id: <20210115121958.712079897@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Samuel Holland [ Upstream commit 529254216773acd5039c07aa18cf06fd1f9fccdd ] While stmmac_pltfr_remove calls sun8i_dwmac_exit, the sun8i_dwmac_init and sun8i_dwmac_exit functions are also called by the stmmac_platform suspend/resume callbacks. They may be called many times during the device's lifetime and should not release resources used by the driver. Furthermore, there was no error handling in case registering the MDIO mux failed during probe, and the EPHY clock was never released at all. Fix all of these issues by moving the deinitialization code to a driver removal callback. Also ensure the EPHY is powered down before removal. Fixes: 634db83b8265 ("net: stmmac: dwmac-sun8i: Handle integrated/external MDIOs") Signed-off-by: Samuel Holland Reviewed-by: Chen-Yu Tsai Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 27 +++++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c @@ -988,17 +988,12 @@ static void sun8i_dwmac_exit(struct plat struct sunxi_priv_data *gmac = priv; if (gmac->variant->soc_has_internal_phy) { - /* sun8i_dwmac_exit could be called with mdiomux uninit */ - if (gmac->mux_handle) - mdio_mux_uninit(gmac->mux_handle); if (gmac->internal_phy_powered) sun8i_dwmac_unpower_internal_phy(gmac); } sun8i_dwmac_unset_syscon(gmac); - reset_control_put(gmac->rst_ephy); - clk_disable_unprepare(gmac->tx_clk); if (gmac->regulator) @@ -1227,12 +1222,32 @@ static int sun8i_dwmac_probe(struct plat return ret; dwmac_mux: + reset_control_put(gmac->rst_ephy); + clk_put(gmac->ephy_clk); sun8i_dwmac_unset_syscon(gmac); dwmac_exit: stmmac_pltfr_remove(pdev); return ret; } +static int sun8i_dwmac_remove(struct platform_device *pdev) +{ + struct net_device *ndev = platform_get_drvdata(pdev); + struct stmmac_priv *priv = netdev_priv(ndev); + struct sunxi_priv_data *gmac = priv->plat->bsp_priv; + + if (gmac->variant->soc_has_internal_phy) { + mdio_mux_uninit(gmac->mux_handle); + sun8i_dwmac_unpower_internal_phy(gmac); + reset_control_put(gmac->rst_ephy); + clk_put(gmac->ephy_clk); + } + + stmmac_pltfr_remove(pdev); + + return 0; +} + static const struct of_device_id sun8i_dwmac_match[] = { { .compatible = "allwinner,sun8i-h3-emac", .data = &emac_variant_h3 }, @@ -1252,7 +1267,7 @@ MODULE_DEVICE_TABLE(of, sun8i_dwmac_matc static struct platform_driver sun8i_dwmac_driver = { .probe = sun8i_dwmac_probe, - .remove = stmmac_pltfr_remove, + .remove = sun8i_dwmac_remove, .driver = { .name = "dwmac-sun8i", .pm = &stmmac_pltfr_pm_ops, From patchwork Fri Jan 15 12:27: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: 364570 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 BE5F4C43381 for ; Fri, 15 Jan 2021 12:57:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8B8C02256F for ; Fri, 15 Jan 2021 12:57:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387690AbhAOM4o (ORCPT ); Fri, 15 Jan 2021 07:56:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:41400 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387498AbhAOMed (ORCPT ); Fri, 15 Jan 2021 07:34:33 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 37F1D236FB; Fri, 15 Jan 2021 12:33:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714032; bh=tKjmPvrJtGuMC86HPIICeVL3ZxQuL0r9JL3fIUc6SUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gdtrrfHVE0wnRmXLl2NBL60PAUX6GrYEdyBJ//umpHff1WeBNw7IALTrQX0o4YjOH P/9Jp95whzpY39JEPVq/VUsnZJUeTMuW6gSWsH+1VyXF5E+foQ0tdK6QtWswYPExaU Ui0WW6AY8srsiMmnT7V5w6/LL33nqIMLVgHJCDbg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Samuel Holland , "David S. Miller" Subject: [PATCH 5.4 07/62] net: stmmac: dwmac-sun8i: Balance internal PHY power Date: Fri, 15 Jan 2021 13:27:29 +0100 Message-Id: <20210115121958.751738424@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Samuel Holland [ Upstream commit b8239638853e3e37b287e4bd4d57b41f14c78550 ] sun8i_dwmac_exit calls sun8i_dwmac_unpower_internal_phy, but sun8i_dwmac_init did not call sun8i_dwmac_power_internal_phy. This caused PHY power to remain off after a suspend/resume cycle. Fix this by recording if PHY power should be restored, and if so, restoring it. Fixes: 634db83b8265 ("net: stmmac: dwmac-sun8i: Handle integrated/external MDIOs") Signed-off-by: Samuel Holland Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 31 ++++++++++++++++------ 1 file changed, 23 insertions(+), 8 deletions(-) --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c @@ -64,6 +64,7 @@ struct emac_variant { * @variant: reference to the current board variant * @regmap: regmap for using the syscon * @internal_phy_powered: Does the internal PHY is enabled + * @use_internal_phy: Is the internal PHY selected for use * @mux_handle: Internal pointer used by mdio-mux lib */ struct sunxi_priv_data { @@ -74,6 +75,7 @@ struct sunxi_priv_data { const struct emac_variant *variant; struct regmap_field *regmap_field; bool internal_phy_powered; + bool use_internal_phy; void *mux_handle; }; @@ -523,8 +525,11 @@ static const struct stmmac_dma_ops sun8i .dma_interrupt = sun8i_dwmac_dma_interrupt, }; +static int sun8i_dwmac_power_internal_phy(struct stmmac_priv *priv); + static int sun8i_dwmac_init(struct platform_device *pdev, void *priv) { + struct net_device *ndev = platform_get_drvdata(pdev); struct sunxi_priv_data *gmac = priv; int ret; @@ -538,13 +543,25 @@ static int sun8i_dwmac_init(struct platf ret = clk_prepare_enable(gmac->tx_clk); if (ret) { - if (gmac->regulator) - regulator_disable(gmac->regulator); dev_err(&pdev->dev, "Could not enable AHB clock\n"); - return ret; + goto err_disable_regulator; + } + + if (gmac->use_internal_phy) { + ret = sun8i_dwmac_power_internal_phy(netdev_priv(ndev)); + if (ret) + goto err_disable_clk; } return 0; + +err_disable_clk: + clk_disable_unprepare(gmac->tx_clk); +err_disable_regulator: + if (gmac->regulator) + regulator_disable(gmac->regulator); + + return ret; } static void sun8i_dwmac_core_init(struct mac_device_info *hw, @@ -815,7 +832,6 @@ static int mdio_mux_syscon_switch_fn(int struct sunxi_priv_data *gmac = priv->plat->bsp_priv; u32 reg, val; int ret = 0; - bool need_power_ephy = false; if (current_child ^ desired_child) { regmap_field_read(gmac->regmap_field, ®); @@ -823,13 +839,12 @@ static int mdio_mux_syscon_switch_fn(int case DWMAC_SUN8I_MDIO_MUX_INTERNAL_ID: dev_info(priv->device, "Switch mux to internal PHY"); val = (reg & ~H3_EPHY_MUX_MASK) | H3_EPHY_SELECT; - - need_power_ephy = true; + gmac->use_internal_phy = true; break; case DWMAC_SUN8I_MDIO_MUX_EXTERNAL_ID: dev_info(priv->device, "Switch mux to external PHY"); val = (reg & ~H3_EPHY_MUX_MASK) | H3_EPHY_SHUTDOWN; - need_power_ephy = false; + gmac->use_internal_phy = false; break; default: dev_err(priv->device, "Invalid child ID %x\n", @@ -837,7 +852,7 @@ static int mdio_mux_syscon_switch_fn(int return -EINVAL; } regmap_field_write(gmac->regmap_field, val); - if (need_power_ephy) { + if (gmac->use_internal_phy) { ret = sun8i_dwmac_power_internal_phy(priv); if (ret) return ret; From patchwork Fri Jan 15 12:27:30 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: 364569 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 D8C25C4332B for ; Fri, 15 Jan 2021 12:57:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A2BD022473 for ; Fri, 15 Jan 2021 12:57:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733255AbhAOM4o (ORCPT ); Fri, 15 Jan 2021 07:56:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:41466 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732079AbhAOMef (ORCPT ); Fri, 15 Jan 2021 07:34:35 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 769672389B; Fri, 15 Jan 2021 12:33:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714034; bh=l/nbjSbORLmGViyj3t9CdQfuvI62Sk4S7BDeyEKBqoQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZVPUkXkPQa4qCu6Kac0J3cryyfY+iVVgcOK4jeV6FQbRrP40g0ouKyWyqZtCxbvv7 W3jXMLs2H9dj5vis0vWiosc8xdG3qnUwNkyqKTYKVOoNMllm8jYcHE/qCbrRfFBi+0 jT555X8ndOOtTnO5X5COutUucXttayQPC1hPSEDs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jakub Kicinski , "David S. Miller" Subject: [PATCH 5.4 08/62] net: vlan: avoid leaks on register_vlan_dev() failures Date: Fri, 15 Jan 2021 13:27:30 +0100 Message-Id: <20210115121958.800341440@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@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 55b7ab1178cbf41f979ff83236d3321ad35ed2ad ] VLAN checks for NETREG_UNINITIALIZED to distinguish between registration failure and unregistration in progress. Since commit cb626bf566eb ("net-sysfs: Fix reference count leak") registration failure may, however, result in NETREG_UNREGISTERED as well as NETREG_UNINITIALIZED. This fix is similer to cebb69754f37 ("rtnetlink: Fix memory(net_device) leak when ->newlink fails") Fixes: cb626bf566eb ("net-sysfs: Fix reference count leak") Signed-off-by: Jakub Kicinski Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/8021q/vlan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c @@ -280,7 +280,8 @@ static int register_vlan_device(struct n return 0; out_free_newdev: - if (new_dev->reg_state == NETREG_UNINITIALIZED) + if (new_dev->reg_state == NETREG_UNINITIALIZED || + new_dev->reg_state == NETREG_UNREGISTERED) free_netdev(new_dev); return err; } From patchwork Fri Jan 15 12:27:32 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: 364650 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 034EDC433E0 for ; Fri, 15 Jan 2021 12:34:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AC96522473 for ; Fri, 15 Jan 2021 12:34:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733275AbhAOMdz (ORCPT ); Fri, 15 Jan 2021 07:33:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:39960 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733274AbhAOMdy (ORCPT ); Fri, 15 Jan 2021 07:33:54 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id EF08D235F8; Fri, 15 Jan 2021 12:33:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714019; bh=kaQy7ys6rWfXfo9e5oLIgJe9emh7z0yyBBYl+dFUjME=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XIASEfc/JU4DEZqz0W7mu4u3CaWDZmAkq/H6gprAbz1OAoMw4yVjjq6SwbHCuksOe KPdtyQJOM+qwhLS1PTlip+qb0jTRm3PDu2hR3pVLiq6qPtbQcRfarWCI8rBKabX4Lo OChOQjnoH5Ywib0Lu7CN1Jse+gcxD8ivjfbZ4EKo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Tranchetti , David Ahern , Jakub Kicinski Subject: [PATCH 5.4 10/62] net: ipv6: fib: flush exceptions when purging route Date: Fri, 15 Jan 2021 13:27:32 +0100 Message-Id: <20210115121958.899390981@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Sean Tranchetti [ Upstream commit d8f5c29653c3f6995e8979be5623d263e92f6b86 ] Route removal is handled by two code paths. The main removal path is via fib6_del_route() which will handle purging any PMTU exceptions from the cache, removing all per-cpu copies of the DST entry used by the route, and releasing the fib6_info struct. The second removal location is during fib6_add_rt2node() during a route replacement operation. This path also calls fib6_purge_rt() to handle cleaning up the per-cpu copies of the DST entries and releasing the fib6_info associated with the older route, but it does not flush any PMTU exceptions that the older route had. Since the older route is removed from the tree during the replacement, we lose any way of accessing it again. As these lingering DSTs and the fib6_info struct are holding references to the underlying netdevice struct as well, unregistering that device from the kernel can never complete. Fixes: 2b760fcf5cfb3 ("ipv6: hook up exception table to store dst cache") Signed-off-by: Sean Tranchetti Reviewed-by: David Ahern Link: https://lore.kernel.org/r/1609892546-11389-1-git-send-email-stranche@quicinc.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/ipv6/ip6_fib.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c @@ -973,6 +973,8 @@ static void fib6_purge_rt(struct fib6_in { struct fib6_table *table = rt->fib6_table; + /* Flush all cached dst in exception table */ + rt6_flush_exceptions(rt); fib6_drop_pcpu_from(rt, table); if (rt->nh && !list_empty(&rt->nh_list)) @@ -1839,9 +1841,6 @@ static void fib6_del_route(struct fib6_t net->ipv6.rt6_stats->fib_rt_entries--; net->ipv6.rt6_stats->fib_discarded_routes++; - /* Flush all cached dst in exception table */ - rt6_flush_exceptions(rt); - /* Reset round-robin state, if necessary */ if (rcu_access_pointer(fn->rr_ptr) == rt) fn->rr_ptr = NULL; From patchwork Fri Jan 15 12:27:36 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: 364578 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 62555C4332E for ; Fri, 15 Jan 2021 12:54:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2C27A221F7 for ; Fri, 15 Jan 2021 12:54:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387695AbhAOMfc (ORCPT ); Fri, 15 Jan 2021 07:35:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:42574 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726370AbhAOMfa (ORCPT ); Fri, 15 Jan 2021 07:35:30 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 972352339D; Fri, 15 Jan 2021 12:34:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714090; bh=6OZyMcU+zl2kq58WqMVWZUBKCu7pBODU2jmb9OsoJfw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hFnn0kWEE2xwB0kgAbIzkmJImQ4FtArCzP6k6aoqUTma7lEmgL0F/x3JzVz7ffEBz wUfebfCOmxfpehVbG6WU5b62t4yvv/b1I6yVVs9OQBBeVLoS/23YsJTFL9qXHmmGS5 CdGSf0stW183V5Mv0cz6QA93PDI0X0vWGTiFvf0Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Ian King , Jakub Kicinski Subject: [PATCH 5.4 14/62] octeontx2-af: fix memory leak of lmac and lmac->name Date: Fri, 15 Jan 2021 13:27:36 +0100 Message-Id: <20210115121959.093997021@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@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 [ Upstream commit ac7996d680d8b4a51bb99bbdcee3dc838b985498 ] Currently the error return paths don't kfree lmac and lmac->name leading to some memory leaks. Fix this by adding two error return paths that kfree these objects Addresses-Coverity: ("Resource leak") Fixes: 1463f382f58d ("octeontx2-af: Add support for CGX link management") Signed-off-by: Colin Ian King Link: https://lore.kernel.org/r/20210107123916.189748-1-colin.king@canonical.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) --- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c @@ -725,8 +725,10 @@ static int cgx_lmac_init(struct cgx *cgx if (!lmac) return -ENOMEM; lmac->name = kcalloc(1, sizeof("cgx_fwi_xxx_yyy"), GFP_KERNEL); - if (!lmac->name) - return -ENOMEM; + if (!lmac->name) { + err = -ENOMEM; + goto err_lmac_free; + } sprintf(lmac->name, "cgx_fwi_%d_%d", cgx->cgx_id, i); lmac->lmac_id = i; lmac->cgx = cgx; @@ -737,7 +739,7 @@ static int cgx_lmac_init(struct cgx *cgx CGX_LMAC_FWI + i * 9), cgx_fwi_event_handler, 0, lmac->name, lmac); if (err) - return err; + goto err_irq; /* Enable interrupt */ cgx_write(cgx, lmac->lmac_id, CGXX_CMRX_INT_ENA_W1S, @@ -748,6 +750,12 @@ static int cgx_lmac_init(struct cgx *cgx } return cgx_lmac_verify_fwi_version(cgx); + +err_irq: + kfree(lmac->name); +err_lmac_free: + kfree(lmac); + return err; } static int cgx_lmac_exit(struct cgx *cgx) From patchwork Fri Jan 15 12:27:39 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: 364580 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 9A9B8C433E9 for ; Fri, 15 Jan 2021 12:54:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 699B0221F7 for ; Fri, 15 Jan 2021 12:54:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731104AbhAOMxr (ORCPT ); Fri, 15 Jan 2021 07:53:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:42884 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387736AbhAOMfn (ORCPT ); Fri, 15 Jan 2021 07:35:43 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id BED6D2371F; Fri, 15 Jan 2021 12:35:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714103; bh=l5VtkXtMu9krPHv6MBjrU/BJhCHUV69z+qQ4LPpChyE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=me35RYdH/Ncg0jl0OP3e3+oetykIkdkdhhTd6EdTj36JHnShJ+sb2Ox/QKbAoFugP +CpJ+1R9CpwtT/xubUTVbTdZ1Q/BbjiNNK8/SS69x88HR2BEyWIJS+ROGdc5pgF5s7 tSsIbx6qYFPPX7+aYg96uVaALQ6X5KkbWqJVQX9M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Julian Wiedmann , Jakub Kicinski Subject: [PATCH 5.4 17/62] s390/qeth: fix L2 header access in qeth_l3_osa_features_check() Date: Fri, 15 Jan 2021 13:27:39 +0100 Message-Id: <20210115121959.239459241@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Julian Wiedmann [ Upstream commit f9c4845385c8f6631ebd5dddfb019ea7a285fba4 ] ip_finish_output_gso() may call .ndo_features_check() even before the skb has a L2 header. This conflicts with qeth_get_ip_version()'s attempt to inspect the L2 header via vlan_eth_hdr(). Switch to vlan_get_protocol(), as already used further down in the common qeth_features_check() path. Fixes: f13ade199391 ("s390/qeth: run non-offload L3 traffic over common xmit path") Signed-off-by: Julian Wiedmann Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/s390/net/qeth_l3_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c @@ -2114,7 +2114,7 @@ static netdev_features_t qeth_l3_osa_fea struct net_device *dev, netdev_features_t features) { - if (qeth_get_ip_version(skb) != 4) + if (vlan_get_protocol(skb) != htons(ETH_P_IP)) features &= ~NETIF_F_HW_VLAN_CTAG_TX; return qeth_features_check(skb, dev, features); } From patchwork Fri Jan 15 12:27:40 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: 364575 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 B3991C433DB for ; Fri, 15 Jan 2021 12:55:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 74CC022473 for ; Fri, 15 Jan 2021 12:55:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387639AbhAOMzR (ORCPT ); Fri, 15 Jan 2021 07:55:17 -0500 Received: from mail.kernel.org ([198.145.29.99]:41338 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387640AbhAOMfU (ORCPT ); Fri, 15 Jan 2021 07:35:20 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 00644223E0; Fri, 15 Jan 2021 12:35:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714105; bh=Qe4Gq1BiktvxjL/ZaekxISO/O3xNb6cvTOm77gyAm74=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v7RY86qbKJF9QPaKX8IZBHPaq/gR0b++N2FQxn+nseBdv9RCytlfMjkqGnhBkph46 7WZfipB/MUkhRbd+Bn4rwNktFpyvYVpf+JSNNhho/RvR9K0LQbmGUpXoz2iigjxXoM c+f8SHzScgkLwZvqmJzgXSMoUV9rsUwC8wdWFp6o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aleksander Jan Bajkowski , Florian Fainelli , Jakub Kicinski Subject: [PATCH 5.4 18/62] net: dsa: lantiq_gswip: Exclude RMII from modes that report 1 GbE Date: Fri, 15 Jan 2021 13:27:40 +0100 Message-Id: <20210115121959.282968059@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Aleksander Jan Bajkowski [ Upstream commit 3545454c7801e391b0d966f82c98614d45394770 ] Exclude RMII from modes that report 1 GbE support. Reduced MII supports up to 100 MbE. Fixes: 14fceff4771e ("net: dsa: Add Lantiq / Intel DSA driver for vrx200") Signed-off-by: Aleksander Jan Bajkowski Reviewed-by: Florian Fainelli Link: https://lore.kernel.org/r/20210107195818.3878-1-olek2@wp.pl Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/dsa/lantiq_gswip.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/drivers/net/dsa/lantiq_gswip.c +++ b/drivers/net/dsa/lantiq_gswip.c @@ -1419,11 +1419,12 @@ static void gswip_phylink_validate(struc phylink_set(mask, Pause); phylink_set(mask, Asym_Pause); - /* With the exclusion of MII and Reverse MII, we support Gigabit, - * including Half duplex + /* With the exclusion of MII, Reverse MII and Reduced MII, we + * support Gigabit, including Half duplex */ if (state->interface != PHY_INTERFACE_MODE_MII && - state->interface != PHY_INTERFACE_MODE_REVMII) { + state->interface != PHY_INTERFACE_MODE_REVMII && + state->interface != PHY_INTERFACE_MODE_RMII) { phylink_set(mask, 1000baseT_Full); phylink_set(mask, 1000baseT_Half); } 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 Kroah-Hartman X-Patchwork-Id: 364644 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 DDA2CC43381 for ; Fri, 15 Jan 2021 12:35:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B952723339 for ; Fri, 15 Jan 2021 12:35:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387740AbhAOMft (ORCPT ); Fri, 15 Jan 2021 07:35:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:42934 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387738AbhAOMfs (ORCPT ); Fri, 15 Jan 2021 07:35:48 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 32631224F9; Fri, 15 Jan 2021 12:35:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714107; bh=abM/FdqvRGvXSce0XqSOJVe7ENalMwRf16m13G9y+bs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=thOhImtgbqxk4wcaXoNyJNOkzHVcccD+6PhTjjehXKBZwimLIkUIi2IrwaSPtdG+K 1x16ONzghfsAU66C0ZpUvjBWJ9J6s0/Yqo1CJASYv4qDTPsZ40KkUryUFRsE+uTmE3 CuhV2E4h8JbmIsMIxWuRjVK1JFMqhf0oME4gREJs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Zhang , Maor Gottlieb , Saeed Mahameed Subject: [PATCH 5.4 19/62] net/mlx5: Use port_num 1 instead of 0 when delete a RoCE address Date: Fri, 15 Jan 2021 13:27:41 +0100 Message-Id: <20210115121959.332308387@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Mark Zhang [ Upstream commit 0f2dcade69f2af56b74bce432e48ff3957830ce2 ] In multi-port mode, FW reports syndrome 0x2ea48 (invalid vhca_port_number) if the port_num is not 1 or 2. Fixes: 80f09dfc237f ("net/mlx5: Eswitch, enable RoCE loopback traffic") Signed-off-by: Mark Zhang Reviewed-by: Maor Gottlieb Signed-off-by: Saeed Mahameed Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/mellanox/mlx5/core/rdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/ethernet/mellanox/mlx5/core/rdma.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/rdma.c @@ -116,7 +116,7 @@ free: static void mlx5_rdma_del_roce_addr(struct mlx5_core_dev *dev) { mlx5_core_roce_gid_set(dev, 0, 0, 0, - NULL, NULL, false, 0, 0); + NULL, NULL, false, 0, 1); } static void mlx5_rdma_make_default_gid(struct mlx5_core_dev *dev, union ib_gid *gid) From patchwork Fri Jan 15 12:27:43 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: 364648 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 E5721C433E9 for ; Fri, 15 Jan 2021 12:34:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A15CE2371F for ; Fri, 15 Jan 2021 12:34:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387524AbhAOMep (ORCPT ); Fri, 15 Jan 2021 07:34:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:41758 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387517AbhAOMeo (ORCPT ); Fri, 15 Jan 2021 07:34:44 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2B75E23339; Fri, 15 Jan 2021 12:34:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714043; bh=k8S64b0wGE0CoK+4B8j03894/8mWYmuq6azR1OqCu9o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fzSlQ3l+0hIoetFutkdvGh6PXe+UKaZiM+TdUWOi77CHNxKJPFhKCL06HmShQUJs6 UZ4Ek3zxoI2xeKmYIPjbdlHQztAm6LMX+pGSDR+2ooGQrzZE2ziqfm9he8O2/Qa4yT hna2X7CdD6y/3H2cnZEesaI9ko06+tmA2/68+GI0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rohit Maheshwari , Ayush Sawal , Jakub Kicinski Subject: [PATCH 5.4 21/62] chtls: Fix hardware tid leak Date: Fri, 15 Jan 2021 13:27:43 +0100 Message-Id: <20210115121959.431107821@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Ayush Sawal [ Upstream commit 717df0f4cdc9044c415431a3522b3e9ccca5b4a3 ] send_abort_rpl() is not calculating cpl_abort_req_rss offset and ends up sending wrong TID with abort_rpl WR causng tid leaks. Replaced send_abort_rpl() with chtls_send_abort_rpl() as it is redundant. Fixes: cc35c88ae4db ("crypto : chtls - CPL handler definition") Signed-off-by: Rohit Maheshwari Signed-off-by: Ayush Sawal Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/crypto/chelsio/chtls/chtls_cm.c | 39 ++------------------------------ 1 file changed, 3 insertions(+), 36 deletions(-) --- a/drivers/crypto/chelsio/chtls/chtls_cm.c +++ b/drivers/crypto/chelsio/chtls/chtls_cm.c @@ -1828,39 +1828,6 @@ static void send_defer_abort_rpl(struct kfree_skb(skb); } -static void send_abort_rpl(struct sock *sk, struct sk_buff *skb, - struct chtls_dev *cdev, int status, int queue) -{ - struct cpl_abort_req_rss *req = cplhdr(skb); - struct sk_buff *reply_skb; - struct chtls_sock *csk; - - csk = rcu_dereference_sk_user_data(sk); - - reply_skb = alloc_skb(sizeof(struct cpl_abort_rpl), - GFP_KERNEL); - - if (!reply_skb) { - req->status = (queue << 1); - send_defer_abort_rpl(cdev, skb); - return; - } - - set_abort_rpl_wr(reply_skb, GET_TID(req), status); - kfree_skb(skb); - - set_wr_txq(reply_skb, CPL_PRIORITY_DATA, queue); - if (csk_conn_inline(csk)) { - struct l2t_entry *e = csk->l2t_entry; - - if (e && sk->sk_state != TCP_SYN_RECV) { - cxgb4_l2t_send(csk->egress_dev, reply_skb, e); - return; - } - } - cxgb4_ofld_send(cdev->lldi->ports[0], reply_skb); -} - /* * Add an skb to the deferred skb queue for processing from process context. */ @@ -1924,8 +1891,8 @@ static void bl_abort_syn_rcv(struct sock skb->sk = NULL; do_abort_syn_rcv(child, lsk); - send_abort_rpl(child, skb, BLOG_SKB_CB(skb)->cdev, - CPL_ABORT_NO_RST, queue); + chtls_send_abort_rpl(child, skb, BLOG_SKB_CB(skb)->cdev, + CPL_ABORT_NO_RST, queue); } static int abort_syn_rcv(struct sock *sk, struct sk_buff *skb) @@ -1956,7 +1923,7 @@ static int abort_syn_rcv(struct sock *sk int queue = csk->txq_idx; do_abort_syn_rcv(sk, psk); - send_abort_rpl(sk, skb, cdev, CPL_ABORT_NO_RST, queue); + chtls_send_abort_rpl(sk, skb, cdev, CPL_ABORT_NO_RST, queue); } else { skb->sk = sk; BLOG_SKB_CB(skb)->backlog_rcv = bl_abort_syn_rcv; From patchwork Fri Jan 15 12:27:45 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: 364568 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 7DCE5C432C3 for ; Fri, 15 Jan 2021 12:57:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5701C2256F for ; Fri, 15 Jan 2021 12:57:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387654AbhAOM5J (ORCPT ); Fri, 15 Jan 2021 07:57:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:40776 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387444AbhAOMeX (ORCPT ); Fri, 15 Jan 2021 07:34:23 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8E11B23136; Fri, 15 Jan 2021 12:34:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714047; bh=FOF83rE0CsDT5m7dDfLkq5nxSueUVP1YTUqnm0XU+6U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EXz+/S1y7Z7lMFEIhuk9mMKMTBZjOMuD5kKfJNV8dv2tb4Gv4odcQnWcd0I5fA2ts cB1f3Ntozk3CtMFIez7sdBRDjaSr+1VNCXA/ffwfyIP1AlVCzzIs8AMp0GHqav0Jyn CLXyvKP25eH1iPnEBoZJrTxuqRT5NXnInNE64vLg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rohit Maheshwari , Ayush Sawal , Jakub Kicinski Subject: [PATCH 5.4 23/62] chtls: Fix panic when route to peer not configured Date: Fri, 15 Jan 2021 13:27:45 +0100 Message-Id: <20210115121959.532751577@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Ayush Sawal [ Upstream commit 5a5fac9966bb6d513198634b0b1357be7e8447d2 ] If route to peer is not configured, we might get non tls devices from dst_neigh_lookup() which is invalid, adding a check to avoid it. Fixes: cc35c88ae4db ("crypto : chtls - CPL handler definition") Signed-off-by: Rohit Maheshwari Signed-off-by: Ayush Sawal Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/crypto/chelsio/chtls/chtls_cm.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) --- a/drivers/crypto/chelsio/chtls/chtls_cm.c +++ b/drivers/crypto/chelsio/chtls/chtls_cm.c @@ -1021,6 +1021,7 @@ static struct sock *chtls_recv_sock(stru const struct cpl_pass_accept_req *req, struct chtls_dev *cdev) { + struct adapter *adap = pci_get_drvdata(cdev->pdev); struct inet_sock *newinet; const struct iphdr *iph; struct tls_context *ctx; @@ -1030,9 +1031,10 @@ static struct sock *chtls_recv_sock(stru struct neighbour *n; struct tcp_sock *tp; struct sock *newsk; + bool found = false; u16 port_id; int rxq_idx; - int step; + int step, i; iph = (const struct iphdr *)network_hdr; newsk = tcp_create_openreq_child(lsk, oreq, cdev->askb); @@ -1044,7 +1046,7 @@ static struct sock *chtls_recv_sock(stru goto free_sk; n = dst_neigh_lookup(dst, &iph->saddr); - if (!n) + if (!n || !n->dev) goto free_sk; ndev = n->dev; @@ -1053,6 +1055,13 @@ static struct sock *chtls_recv_sock(stru if (is_vlan_dev(ndev)) ndev = vlan_dev_real_dev(ndev); + for_each_port(adap, i) + if (cdev->ports[i] == ndev) + found = true; + + if (!found) + goto free_dst; + port_id = cxgb4_port_idx(ndev); csk = chtls_sock_create(cdev); @@ -1108,6 +1117,7 @@ static struct sock *chtls_recv_sock(stru free_csk: chtls_sock_release(&csk->kref); free_dst: + neigh_release(n); dst_release(dst); free_sk: inet_csk_prepare_forced_close(newsk); From patchwork Fri Jan 15 12:27:46 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: 364647 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 2425EC4332E for ; Fri, 15 Jan 2021 12:34:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EEE402388B for ; Fri, 15 Jan 2021 12:34:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387532AbhAOMev (ORCPT ); Fri, 15 Jan 2021 07:34:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:41822 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732695AbhAOMeu (ORCPT ); Fri, 15 Jan 2021 07:34:50 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id A58232371F; Fri, 15 Jan 2021 12:34:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714050; bh=eHE+4f8yv+aIe/aLgbZCEplSOPWmDuu68fNLidD6xTg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xXrtXXgu+IFlFzJj77vnmDQhZE6TsJc1Kq8MGrt+Y7tytpmmHtg3h3sa0Ds2ZGTrN LLCf1dGC6aR3DqyVXm9x0HgWbmQ1gRhNitSDveoQ4YtkqzAEAvR9wlgZou9wlop95y pimwKXK3lJjUPx5KtbeueYq1KWbONsnP6mSYxX3I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vinay Kumar Yadav , Ayush Sawal , Jakub Kicinski Subject: [PATCH 5.4 24/62] chtls: Replace skb_dequeue with skb_peek Date: Fri, 15 Jan 2021 13:27:46 +0100 Message-Id: <20210115121959.574186525@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Ayush Sawal [ Upstream commit a84b2c0d5fa23da6d6c8c0d5f5c93184a2744d3e ] The skb is unlinked twice, one in __skb_dequeue in function chtls_reset_synq() and another in cleanup_syn_rcv_conn(). So in this patch using skb_peek() instead of __skb_dequeue(), so that unlink will be handled only in cleanup_syn_rcv_conn(). Fixes: cc35c88ae4db ("crypto : chtls - CPL handler definition") Signed-off-by: Vinay Kumar Yadav Signed-off-by: Ayush Sawal Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/crypto/chelsio/chtls/chtls_cm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/crypto/chelsio/chtls/chtls_cm.c +++ b/drivers/crypto/chelsio/chtls/chtls_cm.c @@ -577,7 +577,7 @@ static void chtls_reset_synq(struct list while (!skb_queue_empty(&listen_ctx->synq)) { struct chtls_sock *csk = - container_of((struct synq *)__skb_dequeue + container_of((struct synq *)skb_peek (&listen_ctx->synq), struct chtls_sock, synq); struct sock *child = csk->sk; From patchwork Fri Jan 15 12:27:48 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: 364649 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 E707CC4332B for ; Fri, 15 Jan 2021 12:34:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1320D2339D for ; Fri, 15 Jan 2021 12:34:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731797AbhAOMeb (ORCPT ); Fri, 15 Jan 2021 07:34:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:41120 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387494AbhAOMea (ORCPT ); Fri, 15 Jan 2021 07:34:30 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 19D192339D; Fri, 15 Jan 2021 12:34:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714054; bh=wArVPqu7u4jdsB9XswA5aIzFktyXZOVFPjwD+o/DLG4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PaJxwOf0vP4JW3IyCqeTeWbR1mtmnr8R/iDz9eWs9ZbwtpY9rf+rZHwl0MGGzLEI5 RyROwzNNZXZCOzpub4OC5tYT5z+TD9/a1BN1iBuwh6KoNPKd1AdqJCTUlwBfG4ECED 7ryQSNnnc50n3Kcy/FObySKi7uURza30ZiabI27g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vinay Kumar Yadav , Ayush Sawal , Jakub Kicinski Subject: [PATCH 5.4 26/62] chtls: Fix chtls resources release sequence Date: Fri, 15 Jan 2021 13:27:48 +0100 Message-Id: <20210115121959.667437476@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Ayush Sawal [ Upstream commit 15ef6b0e30b354253e2c10b3836bc59767eb162b ] CPL_ABORT_RPL is sent after releasing the resources by calling chtls_release_resources(sk); and chtls_conn_done(sk); eventually causing kernel panic. Fixing it by calling release in appropriate order. Fixes: cc35c88ae4db ("crypto : chtls - CPL handler definition") Signed-off-by: Vinay Kumar Yadav Signed-off-by: Ayush Sawal Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/crypto/chelsio/chtls/chtls_cm.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) --- a/drivers/crypto/chelsio/chtls/chtls_cm.c +++ b/drivers/crypto/chelsio/chtls/chtls_cm.c @@ -1905,9 +1905,9 @@ static void bl_abort_syn_rcv(struct sock queue = csk->txq_idx; skb->sk = NULL; - do_abort_syn_rcv(child, lsk); chtls_send_abort_rpl(child, skb, BLOG_SKB_CB(skb)->cdev, CPL_ABORT_NO_RST, queue); + do_abort_syn_rcv(child, lsk); } static int abort_syn_rcv(struct sock *sk, struct sk_buff *skb) @@ -1937,8 +1937,8 @@ static int abort_syn_rcv(struct sock *sk if (!sock_owned_by_user(psk)) { int queue = csk->txq_idx; - do_abort_syn_rcv(sk, psk); chtls_send_abort_rpl(sk, skb, cdev, CPL_ABORT_NO_RST, queue); + do_abort_syn_rcv(sk, psk); } else { skb->sk = sk; BLOG_SKB_CB(skb)->backlog_rcv = bl_abort_syn_rcv; @@ -1981,12 +1981,11 @@ static void chtls_abort_req_rss(struct s if (sk->sk_state == TCP_SYN_RECV && !abort_syn_rcv(sk, skb)) return; - - chtls_release_resources(sk); - chtls_conn_done(sk); } chtls_send_abort_rpl(sk, skb, csk->cdev, rst_status, queue); + chtls_release_resources(sk); + chtls_conn_done(sk); } static void chtls_abort_rpl_rss(struct sock *sk, struct sk_buff *skb) 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 Kroah-Hartman X-Patchwork-Id: 364572 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 3F041C4332E for ; Fri, 15 Jan 2021 12:56:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 22CB62256F for ; Fri, 15 Jan 2021 12:56:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733285AbhAOM4R (ORCPT ); Fri, 15 Jan 2021 07:56:17 -0500 Received: from mail.kernel.org ([198.145.29.99]:41896 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387544AbhAOMe5 (ORCPT ); Fri, 15 Jan 2021 07:34:57 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4578122473; Fri, 15 Jan 2021 12:34:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714056; bh=ODdq/ssN88ALrtdV1NdOuf+KVUBD5b8BS01k47GNRrQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fGAe+mXNDAvenFO6nxZ17xR/SY4m+rI75NRBCZWBJGaITBQ8tzmbHacb7G/xAuKnq bRWHJhAQDcg4/8pBPsfNf3qTfaaVeU/ZOzjFwhWwhd/q1Td6AAmmWXbI1WqBfmLALx yJx3jMysdzHcKr6bFEA+Mx5P9vtOlIMmlu8wv7LE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shakeel Butt , Valentin Schneider , Fenghua Yu , Reinette Chatre , Borislav Petkov , Tony Luck , James Morse Subject: [PATCH 5.4 27/62] x86/resctrl: Use an IPI instead of task_work_add() to update PQR_ASSOC MSR Date: Fri, 15 Jan 2021 13:27:49 +0100 Message-Id: <20210115121959.716207910@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@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 ae28d1aae48a1258bd09a6f707ebb4231d79a761 upstream Currently, when moving a task to a resource group the PQR_ASSOC MSR is updated with the new closid and rmid in an added task callback. If the task is running, the work is run as soon as possible. If the task is not running, the work is executed later in the kernel exit path when the kernel returns to the task again. Updating the PQR_ASSOC MSR as soon as possible on the CPU a moved task is running is the right thing to do. Queueing work for a task that is not running is unnecessary (the PQR_ASSOC MSR is already updated when the task is scheduled in) and causing system resource waste with the way in which it is implemented: Work to update the PQR_ASSOC register is queued every time the user writes a task id to the "tasks" file, even if the task already belongs to the resource group. This could result in multiple pending work items associated with a single task even if they are all identical and even though only a single update with most recent values is needed. Specifically, even if a task is moved between different resource groups while it is sleeping then it is only the last move that is relevant but yet a work item is queued during each move. This unnecessary queueing of work items could result in significant system resource waste, especially on tasks sleeping for a long time. For example, as demonstrated by Shakeel Butt in [1] writing the same task id to the "tasks" file can quickly consume significant memory. The same problem (wasted system resources) occurs when moving a task between different resource groups. As pointed out by Valentin Schneider in [2] there is an additional issue with the way in which the queueing of work is done in that the task_struct update is currently done after the work is queued, resulting in a race with the register update possibly done before the data needed by the update is available. To solve these issues, update the PQR_ASSOC MSR in a synchronous way right after the new closid and rmid are ready during the task movement, only if the task is running. If a moved task is not running nothing is done since the PQR_ASSOC MSR will be updated next time the task is scheduled. This is the same way used to update the register when tasks are moved as part of resource group removal. [1] https://lore.kernel.org/lkml/CALvZod7E9zzHwenzf7objzGKsdBmVwTgEJ0nPgs0LUFU3SN5Pw@mail.gmail.com/ [2] https://lore.kernel.org/lkml/20201123022433.17905-1-valentin.schneider@arm.com [ bp: Massage commit message and drop the two update_task_closid_rmid() variants. ] Fixes: e02737d5b826 ("x86/intel_rdt: Add tasks files") Reported-by: Shakeel Butt Reported-by: Valentin Schneider Signed-off-by: Fenghua Yu Signed-off-by: Reinette Chatre Signed-off-by: Borislav Petkov Reviewed-by: Tony Luck Reviewed-by: James Morse Reviewed-by: Valentin Schneider Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/17aa2fb38fc12ce7bb710106b3e7c7b45acb9e94.1608243147.git.reinette.chatre@intel.com Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 108 +++++++++++++-------------------- 1 file changed, 43 insertions(+), 65 deletions(-) --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -525,85 +525,63 @@ static void rdtgroup_remove(struct rdtgr kfree(rdtgrp); } -struct task_move_callback { - struct callback_head work; - struct rdtgroup *rdtgrp; -}; - -static void move_myself(struct callback_head *head) +static void _update_task_closid_rmid(void *task) { - struct task_move_callback *callback; - struct rdtgroup *rdtgrp; - - callback = container_of(head, struct task_move_callback, work); - rdtgrp = callback->rdtgrp; - /* - * If resource group was deleted before this task work callback - * was invoked, then assign the task to root group and free the - * resource group. + * If the task is still current on this CPU, update PQR_ASSOC MSR. + * Otherwise, the MSR is updated when the task is scheduled in. */ - if (atomic_dec_and_test(&rdtgrp->waitcount) && - (rdtgrp->flags & RDT_DELETED)) { - current->closid = 0; - current->rmid = 0; - rdtgroup_remove(rdtgrp); - } - - preempt_disable(); - /* update PQR_ASSOC MSR to make resource group go into effect */ - resctrl_sched_in(); - preempt_enable(); + if (task == current) + resctrl_sched_in(); +} - kfree(callback); +static void update_task_closid_rmid(struct task_struct *t) +{ + if (IS_ENABLED(CONFIG_SMP) && task_curr(t)) + smp_call_function_single(task_cpu(t), _update_task_closid_rmid, t, 1); + else + _update_task_closid_rmid(t); } static int __rdtgroup_move_task(struct task_struct *tsk, struct rdtgroup *rdtgrp) { - struct task_move_callback *callback; - int ret; - - callback = kzalloc(sizeof(*callback), GFP_KERNEL); - if (!callback) - return -ENOMEM; - callback->work.func = move_myself; - callback->rdtgrp = rdtgrp; - /* - * Take a refcount, so rdtgrp cannot be freed before the - * callback has been invoked. + * Set the task's closid/rmid before the PQR_ASSOC MSR can be + * updated by them. + * + * For ctrl_mon groups, move both closid and rmid. + * For monitor groups, can move the tasks only from + * their parent CTRL group. */ - atomic_inc(&rdtgrp->waitcount); - ret = task_work_add(tsk, &callback->work, true); - if (ret) { - /* - * Task is exiting. Drop the refcount and free the callback. - * No need to check the refcount as the group cannot be - * deleted before the write function unlocks rdtgroup_mutex. - */ - atomic_dec(&rdtgrp->waitcount); - kfree(callback); - rdt_last_cmd_puts("Task exited\n"); - } else { - /* - * For ctrl_mon groups move both closid and rmid. - * For monitor groups, can move the tasks only from - * their parent CTRL group. - */ - if (rdtgrp->type == RDTCTRL_GROUP) { - tsk->closid = rdtgrp->closid; + + if (rdtgrp->type == RDTCTRL_GROUP) { + tsk->closid = rdtgrp->closid; + tsk->rmid = rdtgrp->mon.rmid; + } else if (rdtgrp->type == RDTMON_GROUP) { + if (rdtgrp->mon.parent->closid == tsk->closid) { tsk->rmid = rdtgrp->mon.rmid; - } else if (rdtgrp->type == RDTMON_GROUP) { - if (rdtgrp->mon.parent->closid == tsk->closid) { - tsk->rmid = rdtgrp->mon.rmid; - } else { - rdt_last_cmd_puts("Can't move task to different control group\n"); - ret = -EINVAL; - } + } else { + rdt_last_cmd_puts("Can't move task to different control group\n"); + return -EINVAL; } } - return ret; + + /* + * Ensure the task's closid and rmid are written before determining if + * the task is current that will decide if it will be interrupted. + */ + barrier(); + + /* + * By now, the task's closid and rmid are set. If the task is current + * on a CPU, the PQR_ASSOC MSR needs to be updated to make the resource + * group go into effect. If the task is not current, the MSR will be + * updated when the task is scheduled in. + */ + update_task_closid_rmid(tsk); + + return 0; } /** 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 Kroah-Hartman X-Patchwork-Id: 364573 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 B6AB1C433DB for ; Fri, 15 Jan 2021 12:56:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 81D512256F for ; Fri, 15 Jan 2021 12:56:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733194AbhAOM4E (ORCPT ); Fri, 15 Jan 2021 07:56:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:41940 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387552AbhAOMe7 (ORCPT ); Fri, 15 Jan 2021 07:34:59 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6F0F0235F9; Fri, 15 Jan 2021 12:34:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714058; bh=Yc2Cx4Cs0jYWHCPDiwsTGl/dGXIh1X6W1zdM4ZZuelE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=12ht4WfZMc9WWzaKrkpgG4d/zf5Uw1dVLN4wrxpiDpf5lNo22L4qJvEg6nYehJBJj H3NVWxisjOx9O/7iGwYu8bnrWdF34Xpm7dyW363RwdsRgcHHHGtRfdL8cpwa0pY/do 3+s6Bm+svA83zZS+Dolo1h8tjBRmfpLlvMSBvymo= 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 5.4 28/62] x86/resctrl: Dont move a task to the same resource group Date: Fri, 15 Jan 2021 13:27:50 +0100 Message-Id: <20210115121959.764359870@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@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/ 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/resctrl/rdtgroup.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -546,6 +546,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:52 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: 363602 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp266937jap; Fri, 15 Jan 2021 04:56:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJw9VjJ4pGdEnSmfR/4AWHKMLuw3SzSGDVhcyV0BiJfK7+AfODbXz+eFqWbSpf9JlQhIFkZn X-Received: by 2002:a17:906:c18:: with SMTP id s24mr8460943ejf.419.1610715378955; Fri, 15 Jan 2021 04:56:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610715378; cv=none; d=google.com; s=arc-20160816; b=I4Oi55TBPECub9a4u8OOZtruR0xqXojEXl9vZL7fd2dTC8JuMLzrpLJu/UhzJxpB1l 04palHUxiD/U5ZqgOcyHcN3axDUBdZp48KyqH7qYcnCCHXcFxwOuvd2z4N/yVZESeAWG JYy2aUTbVEMwyxB7Zh/jD12eMrMRQU2AS/57uvkHGgXHqs6jN9c/OGis6xLxhpS28+0m opxn4KHaEa6v+RVhtfkwz9iHwgrC7MVFD5jouyUzdUcdBzKGT2GMX7XNOaPpCb3e6H9P 93rqF1PWPLnTO/8j08BltfpVxqCzQbqKb3p+RAjt0/V9FrgiC+c3Ab9aKcbEOEXZCpZF zGvg== 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=/RKw9bgzEe9je94nbdntR4vmzQEw+4wx+XOCy0vWFz4=; b=OCrpNclVEZZaC6JjSeDYTfhqddwnw4qurfo4GBl77krHJ1UrD2DORtUEZV4VnWIHAJ dGa3E35aPCZXVXCKy7DtYuHqA+zsINroE3XQ5k1NqYBFNN3LLzxSOruLv92isq7WBxUe ayoL1Fb8YKWUGgGidnOicGsBjIkO7CSU3wX1cZ6twr/wHhvrjC/ZTtfZmCVEh58zqSIK a3LIL008VG+RTRX20Kw1plBoyea5x9ya4IRVt5uIkoeMs7YtUOs7h292PawIgfl1hi1w A4E8x3uMzqTpRDmsZWu+n/87PDXo9ir9mABYmzv5BAzpV8kA8PZUrnhV6n7Q8g61Zhvk 4DjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UZngWchf; 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 p10si2597650eds.81.2021.01.15.04.56.18; Fri, 15 Jan 2021 04:56:18 -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=UZngWchf; 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 S1731144AbhAOMzw (ORCPT + 13 others); Fri, 15 Jan 2021 07:55:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:42102 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732781AbhAOMfE (ORCPT ); Fri, 15 Jan 2021 07:35:04 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id B359B224F9; Fri, 15 Jan 2021 12:34:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714063; bh=hbXflcAwCfGlGFDIuYza+mAeumJjY6f6/gdmRuITY2U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UZngWchfotmDjmzY3d+D3774JTE/GNxF7joJfz6CAu/BxQ7v0RvNqNa3KtpxYozVQ QkS1YdNhWSpCqV4HPzh26b3mrG/i51DGWePRVEjkJhwBE1bISNrKzrcurPAJPpVdHq 4KOrrtCS0BQlt3guv7sfKJwgvwPPl2KrjqIEruk4= 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 5.4 30/62] vmlinux.lds.h: Add PGO and AutoFDO input sections Date: Fri, 15 Jan 2021 13:27:52 +0100 Message-Id: <20210115121959.863207004@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@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 @@ -520,7 +520,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:53 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: 364571 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 5B233C43381 for ; Fri, 15 Jan 2021 12:56:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3B4AB2256F for ; Fri, 15 Jan 2021 12:56:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731808AbhAOM4c (ORCPT ); Fri, 15 Jan 2021 07:56:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:41310 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387474AbhAOMen (ORCPT ); Fri, 15 Jan 2021 07:34:43 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4099F207C4; Fri, 15 Jan 2021 12:34:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714067; bh=qD8t3yfuxRe1FK7vPwW1t7d8isOLIsh2qYREjRYkVAA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WF0h0uxtF45YlHp2Bi5A46tp0uLzE2aChUzZO+WMUF33KdafUqHvgZP0egpkBU9ZA UW1xjiN+XwA71nh7Kx87pnRZX6x2zAhHdmTCfZIsr9a5HcNE9u/1moaHWYyO2hc+oS WT+ygFcvgNCFlk8oYQaTup2v9dhXzSNQhVnACFP4= 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 5.4 31/62] iio: imu: st_lsm6dsx: fix edge-trigger interrupts Date: Fri, 15 Jan 2021 13:27:53 +0100 Message-Id: <20210115121959.912680991@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@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 @@ -664,13 +664,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 = hw->settings->fifo_ops.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 = hw->settings->fifo_ops.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:55 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: 364646 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 1100EC43381 for ; Fri, 15 Jan 2021 12:35:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DE9AC239A4 for ; Fri, 15 Jan 2021 12:35:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387625AbhAOMfN (ORCPT ); Fri, 15 Jan 2021 07:35:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:42222 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387621AbhAOMfM (ORCPT ); Fri, 15 Jan 2021 07:35:12 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id AF363221FA; Fri, 15 Jan 2021 12:34:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714072; bh=BBgb+EzVSy9WxI43W5rBRkyiuIU4rJHI/+N66qL+4ok=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kYHRTL068B1VsyEKd5pJgTzf9omaFEMJUygAyxhI0Lzn/ycZTaSD/BXExZNp8AzKi NttdW4gLY+4lg8ZsyGN8dMY4c651TVkvBPEyeD1gImnud0Hpu41AteUUqLu4aWGry7 PKyp3sqKIbgcQ/YACqdTppfqCFcEeYSqy/QrBRB8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ulf Hansson , Andreas Kemnade , Tony Lindgren Subject: [PATCH 5.4 33/62] ARM: OMAP2+: omap_device: fix idling of devices during probe Date: Fri, 15 Jan 2021 13:27:55 +0100 Message-Id: <20210115122000.001600417@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Andreas Kemnade commit ec76c2eea903947202098090bbe07a739b5246e9 upstream. On the GTA04A5 od->_driver_status was not set to BUS_NOTIFY_BIND_DRIVER during probe of the second mmc used for wifi. Therefore omap_device_late_idle idled the device during probing causing oopses when accessing the registers. It was not set because od->_state was set to OMAP_DEVICE_STATE_IDLE in the notifier callback. Therefore set od->_driver_status also in that case. This came apparent after commit 21b2cec61c04 ("mmc: Set PROBE_PREFER_ASYNCHRONOUS for drivers that existed in v4.4") causing this oops: omap_hsmmc 480b4000.mmc: omap_device_late_idle: enabled but no driver. Idling 8<--- cut here --- Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa0b402c ... (omap_hsmmc_set_bus_width) from [] (omap_hsmmc_set_ios+0x11c/0x258) (omap_hsmmc_set_ios) from [] (mmc_power_up.part.8+0x3c/0xd0) (mmc_power_up.part.8) from [] (mmc_start_host+0x88/0x9c) (mmc_start_host) from [] (mmc_add_host+0x58/0x84) (mmc_add_host) from [] (omap_hsmmc_probe+0x5fc/0x8c0) (omap_hsmmc_probe) from [] (platform_drv_probe+0x48/0x98) (platform_drv_probe) from [] (really_probe+0x1dc/0x3b4) Fixes: 04abaf07f6d5 ("ARM: OMAP2+: omap_device: Sync omap_device and pm_runtime after probe defer") Fixes: 21b2cec61c04 ("mmc: Set PROBE_PREFER_ASYNCHRONOUS for drivers that existed in v4.4") Acked-by: Ulf Hansson Signed-off-by: Andreas Kemnade [tony@atomide.com: left out extra parens, trimmed description stack trace] Signed-off-by: Tony Lindgren Signed-off-by: Greg Kroah-Hartman --- arch/arm/mach-omap2/omap_device.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/arch/arm/mach-omap2/omap_device.c +++ b/arch/arm/mach-omap2/omap_device.c @@ -234,10 +234,12 @@ static int _omap_device_notifier_call(st break; case BUS_NOTIFY_BIND_DRIVER: od = to_omap_device(pdev); - if (od && (od->_state == OMAP_DEVICE_STATE_ENABLED) && - pm_runtime_status_suspended(dev)) { + if (od) { od->_driver_status = BUS_NOTIFY_BIND_DRIVER; - pm_runtime_set_active(dev); + if (od->_state == OMAP_DEVICE_STATE_ENABLED && + pm_runtime_status_suspended(dev)) { + pm_runtime_set_active(dev); + } } break; case BUS_NOTIFY_ADD_DEVICE: 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 Kroah-Hartman X-Patchwork-Id: 364645 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 B4431C433E0 for ; Fri, 15 Jan 2021 12:35:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8336D2333E for ; Fri, 15 Jan 2021 12:35:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732014AbhAOMfT (ORCPT ); Fri, 15 Jan 2021 07:35:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:42246 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387630AbhAOMfO (ORCPT ); Fri, 15 Jan 2021 07:35:14 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id DCF442333E; Fri, 15 Jan 2021 12:34:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714074; bh=os7dohcj4+JctHTLwnzDesgBjZRrYjO2vXdt/AByoF4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E2BjGDEF896uNVTPC5++D8gMt4Q7VDZdOOyx98/3gt0cDHVilxfPb5F6kUb9bVpuZ n3w+wep9ve4+/Xg06cqbsMB+mQ9TLA6o3mZFQN7igzbvO20x9c8KNMczOj5ITc5QXa XF4EFrbRJtr9xBu3hbin5ilW4DAkHYIOjcbtYFrs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linhua Xu , Chunyan Zhang , Wolfram Sang Subject: [PATCH 5.4 34/62] i2c: sprd: use a specific timeout to avoid system hang up issue Date: Fri, 15 Jan 2021 13:27:56 +0100 Message-Id: <20210115122000.049519779@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Chunyan Zhang commit 0b884fe71f9ee6a5df35e677154256ea2099ebb8 upstream. If the i2c device SCL bus being pulled up due to some exception before message transfer done, the system cannot receive the completing interrupt signal any more, it would not exit waiting loop until MAX_SCHEDULE_TIMEOUT jiffies eclipse, that would make the system seemed hang up. To avoid that happen, this patch adds a specific timeout for message transfer. Fixes: 8b9ec0719834 ("i2c: Add Spreadtrum I2C controller driver") Signed-off-by: Linhua Xu Signed-off-by: Chunyan Zhang [wsa: changed errno to ETIMEDOUT] Signed-off-by: Wolfram Sang Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/busses/i2c-sprd.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/drivers/i2c/busses/i2c-sprd.c +++ b/drivers/i2c/busses/i2c-sprd.c @@ -72,6 +72,8 @@ /* timeout (ms) for pm runtime autosuspend */ #define SPRD_I2C_PM_TIMEOUT 1000 +/* timeout (ms) for transfer message */ +#define I2C_XFER_TIMEOUT 1000 /* SPRD i2c data structure */ struct sprd_i2c { @@ -244,6 +246,7 @@ static int sprd_i2c_handle_msg(struct i2 struct i2c_msg *msg, bool is_last_msg) { struct sprd_i2c *i2c_dev = i2c_adap->algo_data; + unsigned long time_left; i2c_dev->msg = msg; i2c_dev->buf = msg->buf; @@ -273,7 +276,10 @@ static int sprd_i2c_handle_msg(struct i2 sprd_i2c_opt_start(i2c_dev); - wait_for_completion(&i2c_dev->complete); + time_left = wait_for_completion_timeout(&i2c_dev->complete, + msecs_to_jiffies(I2C_XFER_TIMEOUT)); + if (!time_left) + return -ETIMEDOUT; return i2c_dev->err; } 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 Kroah-Hartman X-Patchwork-Id: 363601 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp266870jap; Fri, 15 Jan 2021 04:56:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJxAwKAlCFIdsf9tDrWpYzWc75D932yEhsIvq7sIylx6mNrwTQvssKREfT34sLmSjpKaVKUN X-Received: by 2002:a17:906:1a14:: with SMTP id i20mr9050896ejf.548.1610715373060; Fri, 15 Jan 2021 04:56:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610715373; cv=none; d=google.com; s=arc-20160816; b=DICNQCkNhDZUG5p36wpzOXd0CiCbr55JuDPZtz5f7HpKYU/tVtE8FIysSO4gPRfi/e 3LdAmmDpA6J9orniV4CuDgPhlYs3RItL57ceZCP3GOihRFkUW4DoOF9MK9iGgYmmP1BI Yd56OHMhebxJ1N3ah5rcqcD4qwpXm4AkRdkQiFmAXdNwlvzhnrE9fCOsghSMBnftsQxG 7RpAMBHARzy0VDZwz15MDXW61z6dTydzdx8i3EOfDdccpofkD/9/xH3p5wz9fqpjAEOE hd2ekqsFUouc5aIb34tT8BBVyZB5A3zXja0/sn7DDG2cnfoM3F2OyzKK2qGJfKHGadsX FzOA== 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=zuPs0MbbzMhq/k+rhrGMeQr8XIgj/FULeM40LUGHGOU=; b=Js3n2bAriv3XEAAw6rzfBwqHgojRvHIKFv/zuTDpbsBWJ9eoqOs1V23EBcWDNJqMEU Mg5b0xq5c9m3kHdeSqlf9wqUF94yh8+SwkHT3gyWVfMGG19M4DghubkZtuQ0MZrFLCTq aZog6CNmdnx75nedR0TRmBGfMfCK796tsonjbmWYn3v7iKy7tXQuodBPCSukafIdJTy/ jJ3m2YhpQ1dB5nG7j2KkRH3OtujEsA1mfuHYnqu0j9Ggx1NwPc/3ECG1hbnxXB63CoqX v/cUQ7JOVkdn3iKR2k34QJFwBMYvrepbIegmthNmpBj1ujpJIMkPnDMsEk5FBoh4NO0A 1LiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1C3Mu9Go; 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 p10si2597650eds.81.2021.01.15.04.56.12; Fri, 15 Jan 2021 04:56: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=1C3Mu9Go; 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 S2387605AbhAOMzL (ORCPT + 13 others); Fri, 15 Jan 2021 07:55:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:42498 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387642AbhAOMfX (ORCPT ); Fri, 15 Jan 2021 07:35:23 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id D22482336F; Fri, 15 Jan 2021 12:34:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714083; bh=fip9LsIw/fuTpb8HCUU2MKHFkHvdDURgaJVNA8Hvq0M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1C3Mu9GouGzKlNBdHR0z4SZc9XNQmm3As0A1MCcB5+O6w/psUNmybnaJVloXXUsae 7QLiED/oycexX9QH2tV636s7wGzE+lt4eU2oOZV9jvBmmoM14iyH5s0H0y2g8Htdvd wdzJEyLKSUkm71I/gHpcAIIwSmh2FhO3PuUEx0uE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Marc Kleine-Budde , "David S. Miller" Subject: [PATCH 5.4 38/62] can: kvaser_pciefd: select CONFIG_CRC32 Date: Fri, 15 Jan 2021 13:28:00 +0100 Message-Id: <20210115122000.236610955@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@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 1d48595c786b1b9dc6be301e8d7f6fc74e9882aa upstream. Without crc32, this driver fails to link: arm-linux-gnueabi-ld: drivers/net/can/kvaser_pciefd.o: in function `kvaser_pciefd_probe': kvaser_pciefd.c:(.text+0x2b0): undefined reference to `crc32_be' Fixes: 26ad340e582d ("can: kvaser_pciefd: Add driver for Kvaser PCIEcan devices") Signed-off-by: Arnd Bergmann Acked-by: Marc Kleine-Budde Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/can/Kconfig | 1 + 1 file changed, 1 insertion(+) --- a/drivers/net/can/Kconfig +++ b/drivers/net/can/Kconfig @@ -123,6 +123,7 @@ config CAN_JANZ_ICAN3 config CAN_KVASER_PCIEFD depends on PCI tristate "Kvaser PCIe FD cards" + select CRC32 help This is a driver for the Kvaser PCI Express CAN FD family. 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 Kroah-Hartman X-Patchwork-Id: 364574 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 7A2A8C4332B for ; Fri, 15 Jan 2021 12:56:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 55E3522473 for ; Fri, 15 Jan 2021 12:56:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387587AbhAOMfE (ORCPT ); Fri, 15 Jan 2021 07:35:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:41338 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387586AbhAOMfD (ORCPT ); Fri, 15 Jan 2021 07:35:03 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5E64C2256F; Fri, 15 Jan 2021 12:34:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714087; bh=e+Ad1xVCP6360ODNJ3AXbV2DBzNaz5/GhxxnnKuCGgw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vh46HN7mZGcDbts5wPRWAjVkzi1gl+zzUowT1NFCnPa1w9lA4T4lNGNoMqS8J5Qc3 0PfgZbhV4k6RP1pV2dfaUagMKlL6uXRzc8wHAAmTinWPpcV1umBATad/s2E0+Ze0WY J/DXBZhR4WZpvS6jNCoGhRmigT7DfvM5q3n3ZXGQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Douglas Anderson , Stephen Boyd , Mark Brown Subject: [PATCH 5.4 40/62] spi: spi-geni-qcom: Fix geni_spi_isr() NULL dereference in timeout case Date: Fri, 15 Jan 2021 13:28:02 +0100 Message-Id: <20210115122000.333323971@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Douglas Anderson commit 4aa1464acbe3697710279a4bd65cb4801ed30425 upstream. In commit 7ba9bdcb91f6 ("spi: spi-geni-qcom: Don't keep a local state variable") we changed handle_fifo_timeout() so that we set "mas->cur_xfer" to NULL to make absolutely sure that we don't mess with the buffers from the previous transfer in the timeout case. Unfortunately, this caused the IRQ handler to dereference NULL in some cases. One case: CPU0 CPU1 ---- ---- setup_fifo_xfer() geni_se_setup_m_cmd() ... handle_fifo_timeout() spin_lock_irq(mas->lock) mas->cur_xfer = NULL geni_se_cancel_m_cmd() spin_unlock_irq(mas->lock) geni_spi_isr() spin_lock(mas->lock) if (m_irq & M_RX_FIFO_WATERMARK_EN) geni_spi_handle_rx() mas->cur_xfer NULL dereference! tl;dr: Seriously delayed interrupts for RX/TX can lead to timeout handling setting mas->cur_xfer to NULL. Let's check for the NULL transfer in the TX and RX cases and reset the watermark or clear out the fifo respectively to put the hardware back into a sane state. NOTE: things still could get confused if we get timeouts all the way through handle_fifo_timeout() and then start a new transfer because interrupts from the old transfer / cancel / abort could still be pending. A future patch will help this corner case. Fixes: 561de45f72bd ("spi: spi-geni-qcom: Add SPI driver support for GENI based QUP") Signed-off-by: Douglas Anderson Reviewed-by: Stephen Boyd Link: https://lore.kernel.org/r/20201217142842.v3.1.I99ee04f0cb823415df59bd4f550d6ff5756e43d6@changeid Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- drivers/spi/spi-geni-qcom.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) --- a/drivers/spi/spi-geni-qcom.c +++ b/drivers/spi/spi-geni-qcom.c @@ -415,6 +415,12 @@ static void geni_spi_handle_tx(struct sp unsigned int bytes_per_fifo_word = geni_byte_per_fifo_word(mas); unsigned int i = 0; + /* Stop the watermark IRQ if nothing to send */ + if (!mas->cur_xfer) { + writel(0, se->base + SE_GENI_TX_WATERMARK_REG); + return false; + } + max_bytes = (mas->tx_fifo_depth - mas->tx_wm) * bytes_per_fifo_word; if (mas->tx_rem_bytes < max_bytes) max_bytes = mas->tx_rem_bytes; @@ -454,6 +460,14 @@ static void geni_spi_handle_rx(struct sp if (rx_last_byte_valid && rx_last_byte_valid < 4) rx_bytes -= bytes_per_fifo_word - rx_last_byte_valid; } + + /* Clear out the FIFO and bail if nowhere to put it */ + if (!mas->cur_xfer) { + for (i = 0; i < DIV_ROUND_UP(rx_bytes, bytes_per_fifo_word); i++) + readl(se->base + SE_GENI_RX_FIFOn); + return; + } + if (mas->rx_rem_bytes < rx_bytes) rx_bytes = mas->rx_rem_bytes; From patchwork Fri Jan 15 12:28: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: 364588 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 456CBC433E6 for ; Fri, 15 Jan 2021 12:50:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0428A2184D for ; Fri, 15 Jan 2021 12:50:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387844AbhAOMgK (ORCPT ); Fri, 15 Jan 2021 07:36:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:42974 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387838AbhAOMgJ (ORCPT ); Fri, 15 Jan 2021 07:36:09 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 84588224F9; Fri, 15 Jan 2021 12:35:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714154; bh=d/iWsEUdnlQTdGh+bo7yZVe5IG3Yg4H7fcE/Trb2zaI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yonjiQi2Rhoid3Utf7zxnFxNzSKDqYmnBLg485vXT8nd+rYvG5lKq91D8sowmO97q cZ9aIkj0FFzmhJzyvgxidMju9e1UvITP7GLbomeocCk0qR4dARCme++JJobrgXk2Fm f7sszm2mI+TlKcm50UNQ2joTdIDzRD7ZC9CjvnqA= 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 5.4 44/62] dmaengine: xilinx_dma: check dma_async_device_register return value Date: Fri, 15 Jan 2021 13:28:06 +0100 Message-Id: <20210115122000.529002889@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@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 99974aedbd73523969afb09f33c6e3047cd0ddae upstream. dma_async_device_register() can return non-zero error code. Add condition to check the return value of dma_async_device_register function and handle the error path. Addresses-Coverity: Event check_return. 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-2-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 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/drivers/dma/xilinx/xilinx_dma.c +++ b/drivers/dma/xilinx/xilinx_dma.c @@ -2742,7 +2742,11 @@ static int xilinx_dma_probe(struct platf } /* Register the DMA engine with the core */ - dma_async_device_register(&xdev->common); + err = dma_async_device_register(&xdev->common); + if (err) { + dev_err(xdev->dev, "failed to register the dma device\n"); + goto error; + } err = of_dma_controller_register(node, of_dma_xilinx_xlate, xdev); From patchwork Fri Jan 15 12:28:08 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: 364643 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 12CFEC4332E for ; Fri, 15 Jan 2021 12:35:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E606323339 for ; Fri, 15 Jan 2021 12:35:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387750AbhAOMfw (ORCPT ); Fri, 15 Jan 2021 07:35:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:42628 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732197AbhAOMfv (ORCPT ); Fri, 15 Jan 2021 07:35:51 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id D2E8423339; Fri, 15 Jan 2021 12:35:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714136; bh=cIprcDPH7zjpR2EyWKCr0skt57I5LATyo8ftbF9ssT8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ziwiy6WqKjL0lFqkSJ/CPir+JHVY1PYu9Z+qgIUapKAK+rUCGmXPXSXkjU/TNdcI1 1KCPsSaWyHYHa+m2ELPYKn+DVM1eAt2KYzZz4Hrvwr0iBi/QJFGwpuEqX2VMyN4gHH VvPMpxEGZSJD6NRKrrjVBWfejUBZ056D8VVR3cbc= 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 5.4 46/62] dmaengine: xilinx_dma: fix mixed_enum_type coverity warning Date: Fri, 15 Jan 2021 13:28:08 +0100 Message-Id: <20210115122000.616874406@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@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 @@ -2431,7 +2431,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:28:09 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: 363576 Delivered-To: patch@linaro.org Received: by 2002:a17:906:fb05:0:0:0:0 with SMTP id lz5csp471952ejb; Fri, 15 Jan 2021 04:36:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJycJXTwwHKEBglfXcaFbmwbACjzurKzPwLmUqJRa+B+VSHQTkLReId0Eoepyhr44dPQs0gS X-Received: by 2002:a05:6402:1646:: with SMTP id s6mr9372533edx.319.1610714209825; Fri, 15 Jan 2021 04:36:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610714209; cv=none; d=google.com; s=arc-20160816; b=M4CZSedd1SCj6HRjgiQqFMxXdSfls7mX+SYtaF3VZ5rhVgSEu7Zn7rWFq4Ogst6rA5 2fiLqIZrqRuKu6AV6S9v/auAoDBcOAMp3JjSt7CHLCe467mvyUfK67aB/gvqdokZFhuL LEZa11fu82iEuGinr0jYRJXFcb/HdH3/KgvZXn4pMeKxK0nP9Ymv1sJBxnRIrqO28cpA Z4Ij7ZDuv4dSUVZt79bsFgOZcvJdyFba1mTHzwnv1+NE1E1JnsSMcOxOMqyR1J6zodUW o9i+mgZJniZ1HQSn6+YsrAh8oxenSSZxGrCCTGT9+RPRVprpgiww/bsNhAgDPGvJSJ3Z z7cA== 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=8Kd20Yh5Ecq0M6sSKFunuqxzDpV5exbs2BAmu5vHrd0=; b=td2IvoWY0Xm+SiTGiiZ23fsMY4cPP8BAApBdLhtu4hWnZMpvlKlLeu0iEs7SLfX3EM 4fZPOPv3gpJW1m/pTLATX9YV3gPrvaeotXj26hPu8a4lb9kbRKdSyWhX7tPdoOxnMEbt c9U021Vcr7KFr0qkIs0nASWt9KISaqpH8FuGNym4C2gQUzSu9/FcCSvXdsU8EPfFcuEL h6+rRGWirvFGPLm/I7++x6lGL04oZRBk4ifE+HuK28zNqhTvXatZcC+x/PlAfYjKvn3I DqBqGqtn1j5GIFFCOTojm2UvgyVdLYygL/Sql7Sc3EeA5TpKzku1IAMNJt/ex+XfPpAr GZ7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DTdcIXBo; 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 a67si1789770edf.198.2021.01.15.04.36.49; Fri, 15 Jan 2021 04:36:49 -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=DTdcIXBo; 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 S2387767AbhAOMfy (ORCPT + 13 others); Fri, 15 Jan 2021 07:35:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:42672 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387758AbhAOMfx (ORCPT ); Fri, 15 Jan 2021 07:35:53 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 108172333E; Fri, 15 Jan 2021 12:35:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714138; bh=tiZRqQqqRYsKhI2Q+Djp4m0IuCXeiO6+kz5AmiXWPW8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DTdcIXBofLCkbUgUJSo8TJ7jOrw8t5e/eIz/ugw52/W6cinrMZ/AJrw4A7R8j/7+u inclh1JQs99/KnUjZRi+7QQH7gD7rj/bAcRaKijcscwtIfzeGM/2erNkycgg1//Lpv Vth+vcQ3O1liUWsY78zafJT3klRoJSjvsgjIAyWU= 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 5.4 47/62] qed: select CONFIG_CRC32 Date: Fri, 15 Jan 2021 13:28:09 +0100 Message-Id: <20210115122000.665472491@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@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 2860d45a589818dd8ffd90cdc4bcf77f36a5a6be upstream. Without this, the driver fails to link: lpc_eth.c:(.text+0x1934): undefined reference to `crc32_le' arm-linux-gnueabi-ld: drivers/net/ethernet/qlogic/qed/qed_debug.o: in function `qed_grc_dump': qed_debug.c:(.text+0x4068): undefined reference to `crc32_le' arm-linux-gnueabi-ld: drivers/net/ethernet/qlogic/qed/qed_debug.o: in function `qed_idle_chk_dump': qed_debug.c:(.text+0x51fc): undefined reference to `crc32_le' arm-linux-gnueabi-ld: drivers/net/ethernet/qlogic/qed/qed_debug.o: in function `qed_mcp_trace_dump': qed_debug.c:(.text+0x6000): undefined reference to `crc32_le' arm-linux-gnueabi-ld: drivers/net/ethernet/qlogic/qed/qed_debug.o: in function `qed_dbg_reg_fifo_dump': qed_debug.c:(.text+0x66cc): undefined reference to `crc32_le' arm-linux-gnueabi-ld: drivers/net/ethernet/qlogic/qed/qed_debug.o:qed_debug.c:(.text+0x6aa4): more undefined references to `crc32_le' follow Fixes: 7a4b21b7d1f0 ("qed: Add nvram selftest") Signed-off-by: Arnd Bergmann Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/qlogic/Kconfig | 1 + 1 file changed, 1 insertion(+) --- a/drivers/net/ethernet/qlogic/Kconfig +++ b/drivers/net/ethernet/qlogic/Kconfig @@ -78,6 +78,7 @@ config QED depends on PCI select ZLIB_INFLATE select CRC8 + select CRC32 select NET_DEVLINK ---help--- This enables the support for ... From patchwork Fri Jan 15 12:28:10 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: 363590 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp264644jap; Fri, 15 Jan 2021 04:52:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJwBKxNKoqYNBm4ELxr6jeA6FHTG9/572iGmx/3l7N7yhxG+dGxY/FvgYhqgjTfSHDdq7HPj X-Received: by 2002:a17:906:af89:: with SMTP id mj9mr7787325ejb.528.1610715164352; Fri, 15 Jan 2021 04:52:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610715164; cv=none; d=google.com; s=arc-20160816; b=KIj43lDEJxqgzA2Ot0jTKtbputNDfsLxsRcCGPQTKYHRKx4w8OgK1CHx7jhda5CKYc 2/XgCch0hkFaDcRlddHxvUrti7voL3lLnbvaG1iimBlGLU91C1pO5JseGTK3yt9BL9rZ 3HVDN4eI12Rpd8cVxIflxP60z6HPNjfaeJ/CvebFOpAfiH2JGspdbRoIuJlPXhkn6VF0 t9pOiD/LLEr07OsDrw/9fkUpi2hEZkRVKTzukCzx7zE8/2wD1Ob0u+ohCmYcWNPgZpyj rtJF/gSROyIewD/2+u+urFI/SOP2e5B8zP1OKpKWHGA4R01Qo50deD5q9OEavkiKYey0 EIFw== 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=AtQ9OT/Ehdqz0avODneNVtEZ6zejDIOlPeII3GUQ2gc=; b=MpyiSbKTb/4xdd3eQ+YKrlcx0D/ZUvWvE16DNeue0tDfcSLVO10Hs7RlUDqWMyp59e QLeS7J7I16RxGrENmgx1jfbfPKixJZlm6DRW8u6rGJ/oR1la/fu0I1RqUlkr/9ogaIy9 V/1hKsX8JpoRbtx0MGvWxWkxjz5fe45BZHH1FXrJ0ZbHf/rC7vSQCyno835a3Rd/8EmG rMM9bq1icERex4aFpbcNqs/FRwoQVXQDlRhlXWd5rPl96YYnEhrbJRY8LNm4Ek1cYSHh LG/Ape880akSG5gPaPtkpHcrQDlIpXtCyPNB5/taO9bSxCJzaYTWFcLgtB/FFo3juG1s yy3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Hh/im58j"; 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 dp16si3572351ejc.564.2021.01.15.04.52.44; Fri, 15 Jan 2021 04:52:44 -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="Hh/im58j"; 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 S2387783AbhAOMf4 (ORCPT + 13 others); Fri, 15 Jan 2021 07:35:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:42702 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387777AbhAOMf4 (ORCPT ); Fri, 15 Jan 2021 07:35:56 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4621723403; Fri, 15 Jan 2021 12:35:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714140; bh=GazcSFtBD+4KIXKegw41jIiB/HPVPLouzSiRmbzdq6g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hh/im58jHEb9FyuWtJ7RUhOnBPIM4ZHN6edog1fDURCtec8BxFd5uAPhz77Ju2eRx 2rAfp0iXSoaOigcufnd5ZZKG6K4emXOjel3QajX7WOG/NGqJf0D5cYd6pLH6quo0eV qVzsaD1H6Gvq1OBNMBmrxwst2kTs/J/qAi36/iNE= 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 5.4 48/62] wil6210: select CONFIG_CRC32 Date: Fri, 15 Jan 2021 13:28:10 +0100 Message-Id: <20210115122000.713244875@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@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 @@ -2,6 +2,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:28:11 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: 363589 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp263428jap; Fri, 15 Jan 2021 04:50:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJzR+M0nGL9IiL8dDrUBUvd9BN/ZLyqoGVI6cUZxSVaOCYdzTH0lW9azTsOSrCoigqwTiJpT X-Received: by 2002:a17:906:94c5:: with SMTP id d5mr8374886ejy.427.1610715053675; Fri, 15 Jan 2021 04:50:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610715053; cv=none; d=google.com; s=arc-20160816; b=F0FZXXiSWMXTrT6ZXUt1K9UBAU59m4aDGnyesWanhwr6sCCRqgryv04qN3ZGG5lLdF kM+efPD27tgPK6AOXtw3UsIRmKsZsyTYqQnp+WSPZ8CiSRpoplRyYR0NSSSz9etbIN+M F30Pn6W5duQb4OEXLaBS5ZreKymjeHABVd+dOIgHjlFwdRgwAJ6ClnGdzkRBJsUn1+vF 4GIlTIeQx8vO6/REC0mKKNj6QcujOOnFXYwFtIXmY/BsFzkz/738vzFyg8WNipwUYce0 hc9sWraG+cH+mS63jRXPyrKHS9MKCcSo3CBIAfhVZOaWBMPWAES31+PNyba5c36nnN7Q 78bQ== 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=ZS19stzZQrsKIzTDyflmYA7Ym5DNUxksVcudAdEtW+0=; b=w/YrAKlIfBg2WAWWu1WmB0gheh7zuBNsILpSXKVFjKxRIGdCKKh8lz5TYfBD2Yxz4M d7QPgeuPtzfRuk2xE/EjUFlfJYnHKMb39lTI/xytbLA7WLo+UnUOHweDX71LGlrHkz7A cfoACUa4mzCzaHa5SCuMiZqzdYOlR3o2HSxGI+ZvBSJn4UIxypprRzVxvM1OUtHkFHYe 1/45rlM7wzD/0S2fTCSM/Rt5IDhl75gthnYSME4pxUvM3qM+usmdP13WD9UouZXrbsMR YJbRCQBMtbCVUwoCDSziZkZ3RNmchO2cRq/ua7ZsLZichn4BfwSP9xSS3su7AdHslUwr NCrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hu5+qlb4; 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 yj16si2475376ejb.561.2021.01.15.04.50.53; Fri, 15 Jan 2021 04:50:53 -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=hu5+qlb4; 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 S1729011AbhAOMtr (ORCPT + 13 others); Fri, 15 Jan 2021 07:49:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:43604 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732459AbhAOMgX (ORCPT ); Fri, 15 Jan 2021 07:36:23 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7B56023884; Fri, 15 Jan 2021 12:35:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714143; bh=waAsZ4MKkYqNu+lCbaMvO1fKdOJNoyQJSMdZT95USng=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hu5+qlb4ypcybBfxdnZSyJLuT37Gk9CxPsbhKDVo7lPHVkb0xCRrytLEU0U6cAvcX y1oOqKQO/U+ISOedxQIqMxdmS0eHTxwog2Atl0SUyXoou9MXKdmdvT9bQ/ENDXj89e ehhTdZrXRwZjP6tXSaBYz26iI72gVjBaGSKkvuQI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Jens Axboe Subject: [PATCH 5.4 49/62] block: rsxx: select CONFIG_CRC32 Date: Fri, 15 Jan 2021 13:28:11 +0100 Message-Id: <20210115122000.760483504@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@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 @@ -461,6 +461,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: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: 363592 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp264702jap; Fri, 15 Jan 2021 04:52:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJy/FwBzRD5CDVlZRoo0RRzIJ5bbyOeKqUWTZLhwAjSbXtwAZwNGJQPpE/wnxPjEKU0Mp9ip X-Received: by 2002:a17:906:2648:: with SMTP id i8mr3349574ejc.262.1610715168077; Fri, 15 Jan 2021 04:52:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610715168; cv=none; d=google.com; s=arc-20160816; b=ofllZiqOMX023pWZg/XGOfB8LGMxo0EDBx8wg/Ns4wt2FIPxYjy62Jlp/zJI62Nl9D pRxAexCqg7skQiAFhSe2Szy/9f+yhEXcbJVB+zmOktRvnyHactNwrTTcGqLNTtVf/WI/ vdMFVfPquoQM+/dX9tv6WwTooHZg8d0aVTnsDg9NnfJPj/ZFotxzprbPPy5UrzOYvq1l WkRV4QW5E/inzD//ZHJvX/OBMpse1zNAsO6CJPLIevOipe6EJvS6wgatWVITDvbB7gXW oEWUHaU6YnTVmTELiI07GaqDaxVJdqEGj/uWze8eavNLjjtcUul+V+YD64IbY2FQoSsN fC0A== 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=gIMgE5oDWasEkw1tdKp3AWuJsVtxjgQB5mfrhN4XnaI=; b=WFTDQuyjKoIq4Fne6QIILZF2v0D57r4fJvTokLB7qi4D+cf29ZhAYOIn7lUvwpd11p 2MMNujn52/LF3JIq/zQWswDFm7oLec3N1KBL8Ol97F8BFIqRkSZvEmrH6422HQ2EPnPQ 1nT2QjpgrQfp/+VdH0V54tHnuUcV4LAsF4mpeIyW4pOmxb33ei413dKv4cHrUb8bOAab hRzzEGCKI0MI3RZ7YsiuJnSL6etMgH/jg9pvX0llCN0nyi5f/e0i9sebRtkCxxShK6KH ayuXq4Iiy15284Du96dY+UEbN9Rxk1wY2V6953kr0pV6x5HOTw3NIBpkSDvp+3OtnD++ yEiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CYsWm8NK; 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 dp16si3572351ejc.564.2021.01.15.04.52.47; Fri, 15 Jan 2021 04:52: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=CYsWm8NK; 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 S2387636AbhAOMvL (ORCPT + 13 others); Fri, 15 Jan 2021 07:51:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:42884 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387790AbhAOMgA (ORCPT ); Fri, 15 Jan 2021 07:36:00 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id BDB18223E0; Fri, 15 Jan 2021 12:35:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714145; bh=w/CCngwlvQXfR6R9z2V8zA7OSINpshvyHzofDEeKu5M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CYsWm8NKp6FzqKBTJSBxHIXdUtetVYS+pDRws9kQ3v8A7o45JFEYIP8GW7tLb1AmT V49ru03U+n1Gr5IE9Zjbihvaxeq/9HyCrd4IexcDQ68SgFVD1fhCU09+k7HO+EOttN +lc23JKgQ5cwcR/XXNlFnyqypSk0ibpCYZcEL8r0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Jens Axboe Subject: [PATCH 5.4 50/62] lightnvm: select CONFIG_CRC32 Date: Fri, 15 Jan 2021 13:28:12 +0100 Message-Id: <20210115122000.806755044@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@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 19cd3403cb0d522dd5e10188eef85817de29e26e upstream. Without CRC32 support, this fails to link: arm-linux-gnueabi-ld: drivers/lightnvm/pblk-init.o: in function `pblk_init': pblk-init.c:(.text+0x2654): undefined reference to `crc32_le' arm-linux-gnueabi-ld: drivers/lightnvm/pblk-init.o: in function `pblk_exit': pblk-init.c:(.text+0x2a7c): undefined reference to `crc32_le' Fixes: a4bd217b4326 ("lightnvm: physical block device (pblk) target") Signed-off-by: Arnd Bergmann Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- drivers/lightnvm/Kconfig | 1 + 1 file changed, 1 insertion(+) --- a/drivers/lightnvm/Kconfig +++ b/drivers/lightnvm/Kconfig @@ -19,6 +19,7 @@ if NVM config NVM_PBLK tristate "Physical Block Device Open-Channel SSD target" + select CRC32 help Allows an open-channel SSD to be exposed as a block device to the host. The target assumes the device exposes raw flash and must be From patchwork Fri Jan 15 12:28: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: 364587 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 0A777C433E0 for ; Fri, 15 Jan 2021 12:51:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D55CF221F7 for ; Fri, 15 Jan 2021 12:51:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732847AbhAOMum (ORCPT ); Fri, 15 Jan 2021 07:50:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:42952 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387823AbhAOMgH (ORCPT ); Fri, 15 Jan 2021 07:36:07 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 56A00207C4; Fri, 15 Jan 2021 12:35:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714151; bh=DI5UL3pn0UfozUlu804hzO6HXm4kw6L72vj/b0BHaxA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iJcU0l7mGO3hV2YL8Vhvtnb/aszROTq20G4Zm+lBGB4wdubDnOb2SETzjzt373NxE GVeGT/kj/2eQCJf8f0bx1PavGRQgSY65B80MeoD3mbqeVEvN1ZJmCisa9DM+HyqaSi +8XLDRNWv7rJ8bNp0vD9kAmdxQW5sZ5wcK6YO6YI= 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 5.4 53/62] net/mlx5e: Fix memleak in mlx5e_create_l2_table_groups Date: Fri, 15 Jan 2021 13:28:15 +0100 Message-Id: <20210115122000.953360322@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@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 @@ -1346,6 +1346,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: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: 364577 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 9AF88C433E9 for ; Fri, 15 Jan 2021 12:55:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 630CC224F9 for ; Fri, 15 Jan 2021 12:55:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732080AbhAOMyn (ORCPT ); Fri, 15 Jan 2021 07:54:43 -0500 Received: from mail.kernel.org ([198.145.29.99]:42246 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387670AbhAOMfb (ORCPT ); Fri, 15 Jan 2021 07:35:31 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id E60742333E; Fri, 15 Jan 2021 12:35:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714116; bh=3qj1XT4JF/OLljUzGJPB1ccTlERMnieAxKgwnFFaGKE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NXHyMLOk/TjkagMUAcodXJLBVEjvNrGwlt5kswuNM2fCcT7Oc0dhuu+RZceHf7QMV 9bkY+nx35/bUIbXBysA5LfA8ZHrjd7O64H+dv3MIv6I9BvWm7VIqVRTGmaFIMxu9oJ +yELRedRCJ87AbFvvhRiw1CZvqoECeSEwnh46gJE= 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 5.4 54/62] net/mlx5e: Fix two double free cases Date: Fri, 15 Jan 2021 13:28:16 +0100 Message-Id: <20210115122001.001805010@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@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 @@ -927,6 +927,7 @@ static int mlx5e_create_ttc_table_groups in = kvzalloc(inlen, GFP_KERNEL); if (!in) { kfree(ft->g); + ft->g = NULL; return -ENOMEM; } @@ -1067,6 +1068,7 @@ static int mlx5e_create_inner_ttc_table_ in = kvzalloc(inlen, GFP_KERNEL); if (!in) { kfree(ft->g); + ft->g = NULL; return -ENOMEM; } From patchwork Fri Jan 15 12:28:18 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: 363603 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp267073jap; Fri, 15 Jan 2021 04:56:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJzWXmrwPpuiuIYegk2UDDr5DIAo4b9z88BrA1BPoRJ4kH0ljDGWEJCBFHLy5D6jBGpfnOhv X-Received: by 2002:aa7:d7d8:: with SMTP id e24mr9224357eds.135.1610715275613; Fri, 15 Jan 2021 04:54:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610715275; cv=none; d=google.com; s=arc-20160816; b=Pg3NHSvVtEi66T72BQEpzplGFovaOvzeNrkptUq3J3H/6dVQ1oVv0kTccuxVHrWY0i A4gyu0gbFA8NhCj09DoeAp995VVmhugdZ9x0MZVeIRIFh3qgLIuRKiM5yBouubydUYrz SqzgNgP9ZMw5XKVEdlCZ77QRuvtf3WhyW9QEEqMI15BY8r8vxFtt5grJKXHBMfmrU7o4 /HM0MAgi/8okjCnGs++au4XsF++wrW4FDtxol5Fm0Apzcqb6JG0jm9lNb5DzRteAJPgr gu+VF8ZG6YUG2/siGe2aMSI366yHMCeB2e+3jTWHEFsUiXN/H2aqdsWMMS97rHtfyHYM A1hQ== 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=ap0brolEnyOyOzTYuZRZFnLI/fS8jXgM+CnFoL6TjrM=; b=Re9hjwJ7zFFPJzaT2DBTG6pu2sbM0sJLoj/uh9/QQ1v8FlbEiJX1QWSckXPttYVKFP K2vW6hWg7qrt7Dlr3/RkorIPhtHAt+oNUgseDhvGIEKgl5+sinb+plbhViGL6feBX5ng cxl8mXHrdt8P5N/9uWkgmpB+yyfqv8THOsMzJqGCIgMtXuaMMbxUrVJwHpEmpsV4nqSN jR/HEPDul+h4yIdv5MSYf4ahClxTKLk+tyae5I7OmJUKqPys2etcdlQwCllXtpsc1fFf LT9X2ep8watTwRkQMdAHAfbtPi4FTgswtth+p8vf5HG+0LdshwwSvTv4B77Ux/8TuKat VJpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DmJ98PSo; 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 a5si3624718ejr.334.2021.01.15.04.54.35; Fri, 15 Jan 2021 04:54:35 -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=DmJ98PSo; 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 S2387699AbhAOMyK (ORCPT + 13 others); Fri, 15 Jan 2021 07:54:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:42316 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729225AbhAOMfg (ORCPT ); Fri, 15 Jan 2021 07:35:36 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6BD122388B; Fri, 15 Jan 2021 12:35:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714120; bh=OfHwcpKeF5C1319OmThlbPWXSa63NkVHz8FSKR2z9AM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DmJ98PSo1MMsqc3xVaaHWovX2LB19OqEZVcXC04YkOigtfoLdQRIndcXvm2R5lute W0WCb0HJ6sMP42MF0jeE+0cB2jqOAm1BVJ3qISODlVG78To+ikhZYGDmOOZ2lnInaY AVaxDp+HUuW+nS5L5SMJBFE2cWblAZdguRkCdjzM= 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 5.4 56/62] wan: ds26522: select CONFIG_BITREVERSE Date: Fri, 15 Jan 2021 13:28:18 +0100 Message-Id: <20210115122001.098824242@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@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 @@ -282,6 +282,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: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: 363591 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp264681jap; Fri, 15 Jan 2021 04:52:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJy+MT2vXvNUcHizAtzGolFjkAcjXVIOZPlgHFR5iI17+RoJeq3bquPywEKxnylghZ4vWWxS X-Received: by 2002:a50:c8c3:: with SMTP id k3mr3743080edh.302.1610715166477; Fri, 15 Jan 2021 04:52:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610715166; cv=none; d=google.com; s=arc-20160816; b=t31zs62iPhkWT1nNxNpsko/usCKFCkx2o3+JogE8COvM9K+BWbUj/4A06S/lJhrbQL C70q/MtmFhyQxNNCBrDFSgJCrFsbOItovf562P7SOMS+DM1YjfXiUHnpxkPEdRj/wtG2 2f6c0IP/2hVUkgZ05Qxy6FH2lXoHCQaDNwT8EKtjXPhgRD9Yp8DkfL9gl1pdKeex0mH5 PPh6QyFKzAxFX9N7F9VNboWXcOboQ7R6J7u2opoUN0aupxhHD9QpToS1+xtbL24HULwN LQHlMOZzYBf+vQPEBCdphQufVHgxMCGJRoEwARJBGotnIqp6V9B8buKh0vywtyF2PtgJ fC9A== 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=qtFfD3odHyrTHFUrkNYC1tRHK4bj7GCZ1jX+Pm0GQNA=; b=o1EWoXMSvQ9s4ds11Zfd9biYBA/kZj65doCa81bldXrQtmTNmJiU5MbScanAxZJzGr wZjrapzkZwjqSH60uD0UVKwXyieo3SdNCYP5u4Z7/92xUZp0pdJYGTlxLY2CLioO5vxr CeYQynjmmZQP+TrxmUA0rYrSSyYln0VTXtyEcCO8hQqVYveLPmofBVeZBqKXbCPi3Y6T 6W2blIFPH/9QWbWO7L+Mp/xxKYxk9jDb4V6ovcSO8FRfeboRoB4QAOghHGBr55zxmqJi ELdkBLm6bLJ6slx6sCX98IOw8tnqMI5lC5pCT9TxiFtpl1F4Qd2G+tC0+C06gzD3Wg79 w74A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=L+txIebm; 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 dp16si3572351ejc.564.2021.01.15.04.52.46; Fri, 15 Jan 2021 04:52:46 -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=L+txIebm; 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 S2387808AbhAOMgE (ORCPT + 13 others); Fri, 15 Jan 2021 07:36:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:43198 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728878AbhAOMgD (ORCPT ); Fri, 15 Jan 2021 07:36:03 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9EA1123356; Fri, 15 Jan 2021 12:35:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714123; bh=SVqLzJthz+vIMjPwp9FB7tdXTohbTXyxEVY+5fW2Wqg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L+txIebmr79JMwEbpuBwE1sP7no0auUEtnW+SdMU836lEz5KgP5daVEm2gVAbMACt Yn7q66mnSwqfEOR39YQ08sz5oXNg6iEjnOBATp14aIq1SEBD0dnJSywLiwTUYYNdWy UhZL9d+C+vDQ9HLBjzBpgq9Wz2Ca1zYDqx+9m1a8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Baryshkov , Vinod Koul , Mark Brown Subject: [PATCH 5.4 57/62] regulator: qcom-rpmh-regulator: correct hfsmps515 definition Date: Fri, 15 Jan 2021 13:28:19 +0100 Message-Id: <20210115122001.146147961@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dmitry Baryshkov commit df6b92fa40050e59ea89784294bf6d04c0c47705 upstream. According to the datasheet pm8009's HFS515 regulators have 16mV resolution rather than declared 1.6 mV. Correct the resolution. Signed-off-by: Dmitry Baryshkov Fixes: 06369bcc15a1 ("regulator: qcom-rpmh: Add support for SM8150") Reviewed-by: Vinod Koul Link: https://lore.kernel.org/r/20201231122348.637917-3-dmitry.baryshkov@linaro.org Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- drivers/regulator/qcom-rpmh-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/regulator/qcom-rpmh-regulator.c +++ b/drivers/regulator/qcom-rpmh-regulator.c @@ -726,7 +726,7 @@ static const struct rpmh_vreg_hw_data pm static const struct rpmh_vreg_hw_data pmic5_hfsmps515 = { .regulator_type = VRM, .ops = &rpmh_regulator_vrm_ops, - .voltage_range = REGULATOR_LINEAR_RANGE(2800000, 0, 4, 1600), + .voltage_range = REGULATOR_LINEAR_RANGE(2800000, 0, 4, 16000), .n_voltages = 5, .pmic_mode_map = pmic_mode_map_pmic5_smps, .of_map_mode = rpmh_regulator_pmic4_smps_of_map_mode, From patchwork Fri Jan 15 12:28:21 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: 364642 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 BC993C433E9 for ; Fri, 15 Jan 2021 12:36:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 949D92336F for ; Fri, 15 Jan 2021 12:36:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387834AbhAOMgI (ORCPT ); Fri, 15 Jan 2021 07:36:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:43256 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387828AbhAOMgH (ORCPT ); Fri, 15 Jan 2021 07:36:07 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id F0BE52336F; Fri, 15 Jan 2021 12:35:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714127; bh=f0uF12iWYdWqVFfYSAYT6oY8N3u3USLCdiO3LCSqxd0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UN1CAjrbUbCZ8tUlMwxUfrjYvr2KWQgUIk6ZTcQOuO//hodKvz2GURPTOb18ReSs7 euZgcVZzILanqEHJwNFUtZOWdA1UGkim0LDGjSb3w7e+iJmmuiSL+ul9vmKLaj5xYo +WNCBPxmdcUPrqCGBRDTwpyDgbe84MQnSCfAhDXs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexandru Elisei , Marc Zyngier Subject: [PATCH 5.4 59/62] KVM: arm64: Dont access PMCR_EL0 when no PMU is available Date: Fri, 15 Jan 2021 13:28:21 +0100 Message-Id: <20210115122001.241016765@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Marc Zyngier commit 2a5f1b67ec577fb1544b563086e0377f095f88e2 upstream. We reset the guest's view of PMCR_EL0 unconditionally, based on the host's view of this register. It is however legal for an implementation not to provide any PMU, resulting in an UNDEF. The obvious fix is to skip the reset of this shadow register when no PMU is available, sidestepping the issue entirely. If no PMU is available, the guest is not able to request a virtual PMU anyway, so not doing nothing is the right thing to do! It is unlikely that this bug can hit any HW implementation though, as they all provide a PMU. It has been found using nested virt with the host KVM not implementing the PMU itself. Fixes: ab9468340d2bc ("arm64: KVM: Add access handler for PMCR register") Reviewed-by: Alexandru Elisei Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20201210083059.1277162-1-maz@kernel.org Signed-off-by: Greg Kroah-Hartman --- arch/arm64/kvm/sys_regs.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c @@ -625,6 +625,10 @@ static void reset_pmcr(struct kvm_vcpu * { u64 pmcr, val; + /* No PMU available, PMCR_EL0 may UNDEF... */ + if (!kvm_arm_support_pmu_v3()) + return; + pmcr = read_sysreg(pmcr_el0); /* * Writable bits of PMCR_EL0 (ARMV8_PMU_PMCR_MASK) are reset to UNKNOWN From patchwork Fri Jan 15 12:28:23 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: 364583 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 A4C30C43333 for ; Fri, 15 Jan 2021 12:51:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 73B2D223E0 for ; Fri, 15 Jan 2021 12:51:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732264AbhAOMfr (ORCPT ); Fri, 15 Jan 2021 07:35:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:42222 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731983AbhAOMfr (ORCPT ); Fri, 15 Jan 2021 07:35:47 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 65464221FA; Fri, 15 Jan 2021 12:35:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714131; bh=Vokdy7CPJ1s6Q5gBU9BWmbfUgah+fdIFlIN7+nHC5y0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JbGkzi+E2h984prr5JvPhgHGV2voHuUdRoW/1FMpsJPfMJ2kfJ/U8x2lzwE8CBEeP /6eTZcYC0mNzdcz1EbV/M+K55U2XgPcmQuKfRLl8XKZtv2NgyAK0Ir8WXqGJk9zku+ nUvTcziu72RYQXBcyUYyc8nviMJ/3AHGFgoVFX8U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+7010af67ced6105e5ab6@syzkaller.appspotmail.com, Vasily Averin , Willem de Bruijn , Jakub Kicinski Subject: [PATCH 5.4 61/62] net: drop bogus skb with CHECKSUM_PARTIAL and offset beyond end of trimmed packet Date: Fri, 15 Jan 2021 13:28:23 +0100 Message-Id: <20210115122001.337957379@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Vasily Averin commit 54970a2fbb673f090b7f02d7f57b10b2e0707155 upstream. syzbot reproduces BUG_ON in skb_checksum_help(): tun creates (bogus) skb with huge partial-checksummed area and small ip packet inside. Then ip_rcv trims the skb based on size of internal ip packet, after that csum offset points beyond of trimmed skb. Then checksum_tg() called via netfilter hook triggers BUG_ON: offset = skb_checksum_start_offset(skb); BUG_ON(offset >= skb_headlen(skb)); To work around the problem this patch forces pskb_trim_rcsum_slow() to return -EINVAL in described scenario. It allows its callers to drop such kind of packets. Link: https://syzkaller.appspot.com/bug?id=b419a5ca95062664fe1a60b764621eb4526e2cd0 Reported-by: syzbot+7010af67ced6105e5ab6@syzkaller.appspotmail.com Signed-off-by: Vasily Averin Acked-by: Willem de Bruijn Link: https://lore.kernel.org/r/1b2494af-2c56-8ee2-7bc0-923fcad1cdf8@virtuozzo.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/core/skbuff.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -2017,6 +2017,12 @@ int pskb_trim_rcsum_slow(struct sk_buff skb->csum = csum_block_sub(skb->csum, skb_checksum(skb, len, delta, 0), len); + } else if (skb->ip_summed == CHECKSUM_PARTIAL) { + int hdlen = (len > skb_headlen(skb)) ? skb_headlen(skb) : len; + int offset = skb_checksum_start_offset(skb) + skb->csum_offset; + + if (offset + sizeof(__sum16) > hdlen) + return -EINVAL; } return __pskb_trim(skb, len); } From patchwork Fri Jan 15 12:28: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: 364589 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 ECC5AC433E0 for ; Fri, 15 Jan 2021 12:50:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B3A082184D for ; Fri, 15 Jan 2021 12:50:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733209AbhAOMuX (ORCPT ); Fri, 15 Jan 2021 07:50:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:43340 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387858AbhAOMgO (ORCPT ); Fri, 15 Jan 2021 07:36:14 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 958CE2339D; Fri, 15 Jan 2021 12:35:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714134; bh=oFSGIXMlyZru2J8N4EfZLjSXyH9mwZLVMkgDcu4YNmY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tPcRmlduWcwBwPgjQEsY8oa9COw8d0vYxVelGycPplv6CReai7OXNZPZfUHrTwKe2 UdlbB8YReEVTYixabnhTAdncYIz7TjQLIA6bK88I75eJJE/BzGhqEyM1y7cdgIWgbt Ocbh+3vpgkGPsEZWqd/C46JcJE5tjxU1DEdbI9Jc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Mark Brown Subject: [PATCH 5.4 62/62] regmap: debugfs: Fix a reversed if statement in regmap_debugfs_init() Date: Fri, 15 Jan 2021 13:28:24 +0100 Message-Id: <20210115122001.378145241@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dan Carpenter commit f6bcb4c7f366905b66ce8ffca7190118244bb642 upstream. This code will leak "map->debugfs_name" because the if statement is reversed so it only frees NULL pointers instead of non-NULL. In fact the if statement is not required and should just be removed because kfree() accepts NULL pointers. Fixes: cffa4b2122f5 ("regmap: debugfs: Fix a memory leak when calling regmap_attach_dev") Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/X/RQpfAwRdLg0GqQ@mwanda Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- drivers/base/regmap/regmap-debugfs.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) --- a/drivers/base/regmap/regmap-debugfs.c +++ b/drivers/base/regmap/regmap-debugfs.c @@ -595,9 +595,7 @@ void regmap_debugfs_init(struct regmap * } if (!strcmp(name, "dummy")) { - if (!map->debugfs_name) - kfree(map->debugfs_name); - + kfree(map->debugfs_name); map->debugfs_name = kasprintf(GFP_KERNEL, "dummy%d", dummy_index); if (!map->debugfs_name)