From patchwork Thu Jan 16 23:17:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233741 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 DD5ABC33CAF for ; Thu, 16 Jan 2020 23:39:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B162920661 for ; Thu, 16 Jan 2020 23:39:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217950; bh=K7nuYz1eNgGESYAGCl+dzAzfUti/VATJU0c//XrLoB4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Fc8cNA/vvv4TYIh6Rxh8S/DlEIO36xHSzrLPw3vg+KwvVESHHMMiRbgbood2OmwbR Fl2oHGRPYS/pnT5cdJS+Mo6Vnx8yGivgmgYc5d12Zkw3+3CvW4NnWLeDlJDq5+Esiw EqPWagsw6nrm9ftQ4raZRJQSM6VYhbXJ6LJPMJrw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391106AbgAPX2b (ORCPT ); Thu, 16 Jan 2020 18:28:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:33206 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389402AbgAPX2a (ORCPT ); Thu, 16 Jan 2020 18:28:30 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 154D820684; Thu, 16 Jan 2020 23:28:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217308; bh=K7nuYz1eNgGESYAGCl+dzAzfUti/VATJU0c//XrLoB4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CzUK44a679LmB6FQku9xY9/cArJRLW97tlvvwqSR8JgycF2FZ87dgJyMeHZcQQNvp nzdMbz2kNxijDz2LbCGM0kDog0vV2Cf9Wyp3k6PZ/TCoMTtTVslIWbjidy3PyNnwyl LqOVgx8Cl4X1seFv7lClHfYzRI29btGrejUM7Rcc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Michal Kubecek , "David S. Miller" , Miles Chen Subject: [PATCH 4.19 04/84] ethtool: reduce stack usage with clang Date: Fri, 17 Jan 2020 00:17:38 +0100 Message-Id: <20200116231713.857936861@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Arnd Bergmann commit 3499e87ea0413ee5b2cc028f4c8ed4d424bc7f98 upstream. clang inlines the dev_ethtool() more aggressively than gcc does, leading to a larger amount of used stack space: net/core/ethtool.c:2536:24: error: stack frame size of 1216 bytes in function 'dev_ethtool' [-Werror,-Wframe-larger-than=] Marking the sub-functions that require the most stack space as noinline_for_stack gives us reasonable behavior on all compilers. Signed-off-by: Arnd Bergmann Reviewed-by: Michal Kubecek Signed-off-by: David S. Miller Signed-off-by: Miles Chen Signed-off-by: Greg Kroah-Hartman --- net/core/ethtool.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) --- a/net/core/ethtool.c +++ b/net/core/ethtool.c @@ -2413,9 +2413,10 @@ static int ethtool_set_tunable(struct ne return ret; } -static int ethtool_get_per_queue_coalesce(struct net_device *dev, - void __user *useraddr, - struct ethtool_per_queue_op *per_queue_opt) +static noinline_for_stack int +ethtool_get_per_queue_coalesce(struct net_device *dev, + void __user *useraddr, + struct ethtool_per_queue_op *per_queue_opt) { u32 bit; int ret; @@ -2443,9 +2444,10 @@ static int ethtool_get_per_queue_coalesc return 0; } -static int ethtool_set_per_queue_coalesce(struct net_device *dev, - void __user *useraddr, - struct ethtool_per_queue_op *per_queue_opt) +static noinline_for_stack int +ethtool_set_per_queue_coalesce(struct net_device *dev, + void __user *useraddr, + struct ethtool_per_queue_op *per_queue_opt) { u32 bit; int i, ret = 0; @@ -2499,7 +2501,7 @@ roll_back: return ret; } -static int ethtool_set_per_queue(struct net_device *dev, +static int noinline_for_stack ethtool_set_per_queue(struct net_device *dev, void __user *useraddr, u32 sub_cmd) { struct ethtool_per_queue_op per_queue_opt; From patchwork Thu Jan 16 23:17:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233740 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 BEFB2C33CAF for ; Thu, 16 Jan 2020 23:39:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9200D2072B for ; Thu, 16 Jan 2020 23:39:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217952; bh=K4ZECZq3tAY87oe384WQVJjhJMv+1+sz5kr4mGnvw9o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=vIQeEv0Cdw3Pfy6SXXLBjBKKd9xYQiORSIVAfMaxBB6AmTfzjkl44FaRPGi7ANwzD lCNcea4wUUqqrj5VQD8gq8u5Cz6MxXIetKcvocCO/iInoBVwRxoN0hTCPygD8Qqqq8 Xeq+GCe6JDNL/zweXr/gDGhfeeCMdSE3iIGxFNH8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731324AbgAPXjK (ORCPT ); Thu, 16 Jan 2020 18:39:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:33298 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727015AbgAPX2b (ORCPT ); Thu, 16 Jan 2020 18:28:31 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 57EFC2072B; Thu, 16 Jan 2020 23:28:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217310; bh=K4ZECZq3tAY87oe384WQVJjhJMv+1+sz5kr4mGnvw9o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XiwK3NWOcyi7ChoOxPY2Yda47xF3E4HSVaYRRc+JdR+TL4cqf4GdYhWY5glz5LN7z fzXOr6OmN5/dopKgamPcnFj7KY8EwnM2U5cXR6rQLCtl50zFUoAF+iTysiElt95T8T /7sxWxmEStFdIt3NxMu+2IU29KrQ0V/CmBo61Fkg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Andi Kleen , Nick Desaulniers , Alexander Viro , Christoph Hellwig , Eric Dumazet , "Darrick J. Wong" , Andrew Morton , Linus Torvalds , Miles Chen Subject: [PATCH 4.19 05/84] fs/select: avoid clang stack usage warning Date: Fri, 17 Jan 2020 00:17:39 +0100 Message-Id: <20200116231714.039571209@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Arnd Bergmann commit ad312f95d41c9de19313c51e388c4984451c010f upstream. The select() implementation is carefully tuned to put a sensible amount of data on the stack for holding a copy of the user space fd_set, but not too large to risk overflowing the kernel stack. When building a 32-bit kernel with clang, we need a little more space than with gcc, which often triggers a warning: fs/select.c:619:5: error: stack frame size of 1048 bytes in function 'core_sys_select' [-Werror,-Wframe-larger-than=] int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp, I experimentally found that for 32-bit ARM, reducing the maximum stack usage by 64 bytes keeps us reliably under the warning limit again. Link: http://lkml.kernel.org/r/20190307090146.1874906-1-arnd@arndb.de Signed-off-by: Arnd Bergmann Reviewed-by: Andi Kleen Cc: Nick Desaulniers Cc: Alexander Viro Cc: Christoph Hellwig Cc: Eric Dumazet Cc: "Darrick J. Wong" Cc: Greg Kroah-Hartman Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Miles Chen Signed-off-by: Greg Kroah-Hartman --- include/linux/poll.h | 4 ++++ 1 file changed, 4 insertions(+) --- a/include/linux/poll.h +++ b/include/linux/poll.h @@ -16,7 +16,11 @@ extern struct ctl_table epoll_table[]; /* for sysctl */ /* ~832 bytes of stack space used max in sys_select/sys_poll before allocating additional memory. */ +#ifdef __clang__ +#define MAX_STACK_ALLOC 768 +#else #define MAX_STACK_ALLOC 832 +#endif #define FRONTEND_STACK_ALLOC 256 #define SELECT_STACK_ALLOC FRONTEND_STACK_ALLOC #define POLL_STACK_ALLOC FRONTEND_STACK_ALLOC From patchwork Thu Jan 16 23:17:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233742 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 249F1C33CAF for ; Thu, 16 Jan 2020 23:39:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E974F20661 for ; Thu, 16 Jan 2020 23:39:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217949; bh=LenzYYsMhXncUvj7yaKLXdDbiY3QfJO7IDDKqFn1gek=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=t4oZYLsVzLvWjUcd+2AkRYNuYhfefqMEnjHXJZ45RXa5ekxPaO+hTMUssm8K156FL Om4Q7o7SJ8mlV20+myug0g7PEr0l+JQn/nKJGOa096gHdKwWwfPxG8HkhJwvH8bbVu rPcnLqP891SLP2cNnKJNz4kN2l217FehN9JLF38Y= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391124AbgAPX2g (ORCPT ); Thu, 16 Jan 2020 18:28:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:33456 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390228AbgAPX2g (ORCPT ); Thu, 16 Jan 2020 18:28:36 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2D516206D9; Thu, 16 Jan 2020 23:28:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217315; bh=LenzYYsMhXncUvj7yaKLXdDbiY3QfJO7IDDKqFn1gek=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GYeqZ//6B5LKtYnfLfk8QgVNCcAJN31ZTF1LpMnGKOJFPm2mtXkfUZoQ66xZldUAF OyNMVkVQjlh2sXEMOb2xwowIE6+6I9BYELyorTxG1PhnyP4o4g8+wfsDZVZ/Zsr+zT iUrg7lK41WQRMV6zhwtIIAiFOXro8IoFUrPpuAlc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jouni Malinen , Johannes Berg , "David S. Miller" , Ben Hutchings Subject: [PATCH 4.19 07/84] mac80211: Do not send Layer 2 Update frame before authorization Date: Fri, 17 Jan 2020 00:17:41 +0100 Message-Id: <20200116231714.356117806@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jouni Malinen commit 3e493173b7841259a08c5c8e5cbe90adb349da7e upstream. The Layer 2 Update frame is used to update bridges when a station roams to another AP even if that STA does not transmit any frames after the reassociation. This behavior was described in IEEE Std 802.11F-2003 as something that would happen based on MLME-ASSOCIATE.indication, i.e., before completing 4-way handshake. However, this IEEE trial-use recommended practice document was published before RSN (IEEE Std 802.11i-2004) and as such, did not consider RSN use cases. Furthermore, IEEE Std 802.11F-2003 was withdrawn in 2006 and as such, has not been maintained amd should not be used anymore. Sending out the Layer 2 Update frame immediately after association is fine for open networks (and also when using SAE, FT protocol, or FILS authentication when the station is actually authenticated by the time association completes). However, it is not appropriate for cases where RSN is used with PSK or EAP authentication since the station is actually fully authenticated only once the 4-way handshake completes after authentication and attackers might be able to use the unauthenticated triggering of Layer 2 Update frame transmission to disrupt bridge behavior. Fix this by postponing transmission of the Layer 2 Update frame from station entry addition to the point when the station entry is marked authorized. Similarly, send out the VLAN binding update only if the STA entry has already been authorized. Signed-off-by: Jouni Malinen Reviewed-by: Johannes Berg Signed-off-by: David S. Miller Signed-off-by: Ben Hutchings Signed-off-by: Greg Kroah-Hartman --- net/mac80211/cfg.c | 14 ++++---------- net/mac80211/sta_info.c | 4 ++++ 2 files changed, 8 insertions(+), 10 deletions(-) --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -1410,7 +1410,6 @@ static int ieee80211_add_station(struct struct sta_info *sta; struct ieee80211_sub_if_data *sdata; int err; - int layer2_update; if (params->vlan) { sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); @@ -1454,18 +1453,12 @@ static int ieee80211_add_station(struct test_sta_flag(sta, WLAN_STA_ASSOC)) rate_control_rate_init(sta); - layer2_update = sdata->vif.type == NL80211_IFTYPE_AP_VLAN || - sdata->vif.type == NL80211_IFTYPE_AP; - err = sta_info_insert_rcu(sta); if (err) { rcu_read_unlock(); return err; } - if (layer2_update) - cfg80211_send_layer2_update(sta->sdata->dev, sta->sta.addr); - rcu_read_unlock(); return 0; @@ -1563,10 +1556,11 @@ static int ieee80211_change_station(stru sta->sdata = vlansdata; ieee80211_check_fast_xmit(sta); - if (test_sta_flag(sta, WLAN_STA_AUTHORIZED)) + if (test_sta_flag(sta, WLAN_STA_AUTHORIZED)) { ieee80211_vif_inc_num_mcast(sta->sdata); - - cfg80211_send_layer2_update(sta->sdata->dev, sta->sta.addr); + cfg80211_send_layer2_update(sta->sdata->dev, + sta->sta.addr); + } } err = sta_apply_parameters(local, sta, params); --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -1906,6 +1906,10 @@ int sta_info_move_state(struct sta_info ieee80211_check_fast_xmit(sta); ieee80211_check_fast_rx(sta); } + if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN || + sta->sdata->vif.type == NL80211_IFTYPE_AP) + cfg80211_send_layer2_update(sta->sdata->dev, + sta->sta.addr); break; default: break; From patchwork Thu Jan 16 23:17:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233743 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 E9F97C3F68F for ; Thu, 16 Jan 2020 23:39:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B00DC20661 for ; Thu, 16 Jan 2020 23:39:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217943; bh=bwkaRjRlE85PiGBRvEmaRXUO7pIt+5zFzo7sHow+pbo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=chA4+WMPtwixfKccIwZ7EDKJ4sbKbuYyTj3aOSjhQOMmmyMBIY4v36Nqjbe1vCwJ4 As7DCTltIdjyNKlgjR17BanbsWphiSiWKJJrtFwEuKLN2KrNflfcVGnSw7SWfRW9mM ENxr8E0OZFiReoEAOkucL08SJDOlqNcntApfm/64= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391150AbgAPX2l (ORCPT ); Thu, 16 Jan 2020 18:28:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:33600 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391141AbgAPX2l (ORCPT ); Thu, 16 Jan 2020 18:28:41 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 12D64206D9; Thu, 16 Jan 2020 23:28:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217320; bh=bwkaRjRlE85PiGBRvEmaRXUO7pIt+5zFzo7sHow+pbo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=frEwzrSs4O6b+SjvG3bgpz9XnsBISi5ciPwRpKnt5n6nfiAYS7SHvAMnN1AZB1Ntt Xb4Xj3WBrJjb7HQx0Dwv9HTqLx5GxDcnTvvOdEykJLk2qocm11bK5yAJMrnmv7sJwJ O09nKz55rfYHrshFcxKW5XXaUoLFasCd7R2dZ0OU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Yu , Jaegeuk Kim , Ben Hutchings Subject: [PATCH 4.19 09/84] f2fs: check memory boundary by insane namelen Date: Fri, 17 Jan 2020 00:17:43 +0100 Message-Id: <20200116231714.655118606@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jaegeuk Kim commit 4e240d1bab1ead280ddf5eb05058dba6bbd57d10 upstream. If namelen is corrupted to have very long value, fill_dentries can copy wrong memory area. Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Ben Hutchings Signed-off-by: Greg Kroah-Hartman --- fs/f2fs/dir.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) --- a/fs/f2fs/dir.c +++ b/fs/f2fs/dir.c @@ -806,6 +806,17 @@ int f2fs_fill_dentries(struct dir_contex de_name.name = d->filename[bit_pos]; de_name.len = le16_to_cpu(de->name_len); + /* check memory boundary before moving forward */ + bit_pos += GET_DENTRY_SLOTS(le16_to_cpu(de->name_len)); + if (unlikely(bit_pos > d->max)) { + f2fs_msg(sbi->sb, KERN_WARNING, + "%s: corrupted namelen=%d, run fsck to fix.", + __func__, le16_to_cpu(de->name_len)); + set_sbi_flag(sbi, SBI_NEED_FSCK); + err = -EINVAL; + goto out; + } + if (f2fs_encrypted_inode(d->inode)) { int save_len = fstr->len; @@ -826,7 +837,6 @@ int f2fs_fill_dentries(struct dir_contex if (sbi->readdir_ra == 1) f2fs_ra_node_page(sbi, le32_to_cpu(de->ino)); - bit_pos += GET_DENTRY_SLOTS(le16_to_cpu(de->name_len)); ctx->pos = start_pos + bit_pos; } out: From patchwork Thu Jan 16 23:17:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233734 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 5B024C33CAF for ; Thu, 16 Jan 2020 23:40:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 300B42073A for ; Thu, 16 Jan 2020 23:40:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579218004; bh=M11YPmtxsmk+XesG8cp2Yxwo/AKLCEUpp6AZOst0NJ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=w8dpLaB9tqZ6zwGpXiAHCoFeKELJ5awzNIVJupCoZH7ciQ83iV1dd+niC5pslRaBM CB54xcue2sHZoQQYF+nT6XU7XM+T6drjI3clYlNlWITqPNDg0Uk+90DTCRm/x0Xv5t F8+UNbtPGF0u34oBiQ3ptJgroYizKp4Heje86MZQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389089AbgAPX1o (ORCPT ); Thu, 16 Jan 2020 18:27:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:59740 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390323AbgAPX1n (ORCPT ); Thu, 16 Jan 2020 18:27:43 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 041F2206D9; Thu, 16 Jan 2020 23:27:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217262; bh=M11YPmtxsmk+XesG8cp2Yxwo/AKLCEUpp6AZOst0NJ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e+3uC6EAgy+jaOHffz9YeuFi0J5kaZ9N1jaKA0bpaOo39NSHb1g/BesSsek+4aNrO 6pmGKK5ExMi+ziotle/tscMTo+rpuM9Yy9EK8ARhKPAKdt8N1DQUx8QMvx899DGUgk d2/poHd0Sr7z2b9/OS4Isqht+qSG+dUhuF0Tdnvg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+66010012fd4c531a1a96@syzkaller.appspotmail.com, Vandana BN , Hans Verkuil , Mauro Carvalho Chehab , Ben Hutchings Subject: [PATCH 4.19 11/84] media: usb:zr364xx:Fix KASAN:null-ptr-deref Read in zr364xx_vidioc_querycap Date: Fri, 17 Jan 2020 00:17:45 +0100 Message-Id: <20200116231714.921855815@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Vandana BN commit 5d2e73a5f80a5b5aff3caf1ec6d39b5b3f54b26e upstream. SyzKaller hit the null pointer deref while reading from uninitialized udev->product in zr364xx_vidioc_querycap(). ================================================================== BUG: KASAN: null-ptr-deref in read_word_at_a_time+0xe/0x20 include/linux/compiler.h:274 Read of size 1 at addr 0000000000000000 by task v4l_id/5287 CPU: 1 PID: 5287 Comm: v4l_id Not tainted 5.1.0-rc3-319004-g43151d6 #6 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0xe8/0x16e lib/dump_stack.c:113 kasan_report.cold+0x5/0x3c mm/kasan/report.c:321 read_word_at_a_time+0xe/0x20 include/linux/compiler.h:274 strscpy+0x8a/0x280 lib/string.c:207 zr364xx_vidioc_querycap+0xb5/0x210 drivers/media/usb/zr364xx/zr364xx.c:706 v4l_querycap+0x12b/0x340 drivers/media/v4l2-core/v4l2-ioctl.c:1062 __video_do_ioctl+0x5bb/0xb40 drivers/media/v4l2-core/v4l2-ioctl.c:2874 video_usercopy+0x44e/0xf00 drivers/media/v4l2-core/v4l2-ioctl.c:3056 v4l2_ioctl+0x14e/0x1a0 drivers/media/v4l2-core/v4l2-dev.c:364 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:509 [inline] do_vfs_ioctl+0xced/0x12f0 fs/ioctl.c:696 ksys_ioctl+0xa0/0xc0 fs/ioctl.c:713 __do_sys_ioctl fs/ioctl.c:720 [inline] __se_sys_ioctl fs/ioctl.c:718 [inline] __x64_sys_ioctl+0x74/0xb0 fs/ioctl.c:718 do_syscall_64+0xcf/0x4f0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x7f3b56d8b347 Code: 90 90 90 48 8b 05 f1 fa 2a 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 90 90 90 90 90 90 90 90 90 90 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d c1 fa 2a 00 31 d2 48 29 c2 64 RSP: 002b:00007ffe005d5d68 EFLAGS: 00000202 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007f3b56d8b347 RDX: 00007ffe005d5d70 RSI: 0000000080685600 RDI: 0000000000000003 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000400884 R13: 00007ffe005d5ec0 R14: 0000000000000000 R15: 0000000000000000 ================================================================== For this device udev->product is not initialized and accessing it causes a NULL pointer deref. The fix is to check for NULL before strscpy() and copy empty string, if product is NULL Reported-by: syzbot+66010012fd4c531a1a96@syzkaller.appspotmail.com Signed-off-by: Vandana BN Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab [bwh: Backported to 4.19: This function uses strlcpy() instead of strscpy()] Signed-off-by: Ben Hutchings Signed-off-by: Greg Kroah-Hartman --- drivers/media/usb/zr364xx/zr364xx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/media/usb/zr364xx/zr364xx.c +++ b/drivers/media/usb/zr364xx/zr364xx.c @@ -703,7 +703,8 @@ static int zr364xx_vidioc_querycap(struc struct zr364xx_camera *cam = video_drvdata(file); strlcpy(cap->driver, DRIVER_DESC, sizeof(cap->driver)); - strlcpy(cap->card, cam->udev->product, sizeof(cap->card)); + if (cam->udev->product) + strlcpy(cap->card, cam->udev->product, sizeof(cap->card)); strlcpy(cap->bus_info, dev_name(&cam->udev->dev), sizeof(cap->bus_info)); cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | From patchwork Thu Jan 16 23:17:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233809 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 C3F4EC33CAF for ; Thu, 16 Jan 2020 23:27:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8E920206D9 for ; Thu, 16 Jan 2020 23:27:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217266; bh=N/QN/ij5fYfNnTaD8hmAyebH+F69SGmNtuesq+HI5Qc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=UpKfN1eU5cBQGtCBvJ7t0tspHbnBG2sxBNW0u/ftBV1SG9W0WnFSxRSvvkwwu9gPC WT1ChlTn2UUvzjIfgC6RaLjvZVyei++weLJQ7i0DS9IE2tDS3p9pJ+92DcgrB0/d1n Wk+E9En47iFg34Ruy3eak2YGrXBM/KjpgJbqAgd4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389224AbgAPX1q (ORCPT ); Thu, 16 Jan 2020 18:27:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:59808 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731453AbgAPX1p (ORCPT ); Thu, 16 Jan 2020 18:27:45 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 69F7520684; Thu, 16 Jan 2020 23:27:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217264; bh=N/QN/ij5fYfNnTaD8hmAyebH+F69SGmNtuesq+HI5Qc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ii/fUctgJCnLR9NHjzfMlSM8WWDW6RDBjFmRL3/QOU0xoCb2uBnBT+MjMm4p4MtS6 gP8RMVt6utlAGrYc/4LNpnBNqBnSUyDs4CEYAu8ZpygEvDsCKlSqxIUV8oA6PBZiAu acjxVhcoo19Vk5E4gCR+Dzp9Narui9nXJuN3nq8w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Navid Emamdoost , Luca Coelho , Ben Hutchings Subject: [PATCH 4.19 12/84] iwlwifi: dbg_ini: fix memory leak in alloc_sgtable Date: Fri, 17 Jan 2020 00:17:46 +0100 Message-Id: <20200116231715.043619927@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Navid Emamdoost commit b4b814fec1a5a849383f7b3886b654a13abbda7d upstream. In alloc_sgtable if alloc_page fails, the alocated table should be released. Signed-off-by: Navid Emamdoost Signed-off-by: Luca Coelho Signed-off-by: Ben Hutchings Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c +++ b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c @@ -547,6 +547,7 @@ static struct scatterlist *alloc_sgtable if (new_page) __free_page(new_page); } + kfree(table); return NULL; } alloc_size = min_t(int, size, PAGE_SIZE); From patchwork Thu Jan 16 23:17:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233808 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 CE953C33CAF for ; Thu, 16 Jan 2020 23:27:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9CE3D2072E for ; Thu, 16 Jan 2020 23:27:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217276; bh=JoBAKm2P5KYRaZHWujHHUbJl6+7uf7Ch3XDLnH4jh+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=075lhA3YXkmf3uc95O5MmVKBH77qRC5KNhsYpQpr0caO3o5zLw2JLbNkU+aDLbpxO 2Ii/B5/zhjW/h7CaOuqUqUz4BaBnMREFyEfnD3M2z7Ade/i4WrKfFun1GIAQMFn4DR NCBFclOKCa33fDsEPYZTvxrJOCg2s5Qm0y5qvxQA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389805AbgAPX1y (ORCPT ); Thu, 16 Jan 2020 18:27:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:60106 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389683AbgAPX1w (ORCPT ); Thu, 16 Jan 2020 18:27:52 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A611A206D9; Thu, 16 Jan 2020 23:27:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217272; bh=JoBAKm2P5KYRaZHWujHHUbJl6+7uf7Ch3XDLnH4jh+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NqX+SHcjL0tKvM3UYLcofCvRTMGi98szLhMlBbBx6laqFaykFhZKejQKA/itG5LmZ /7HVpgRj/ippCzIGV13IDMDN3cFnStiWoiGEwDNjd8nbrtTpqVHYmlVM/u0Ll7/jU4 xKGub3kfF+wwhR8kX7Z67Z6770SIVa6HhApXwWkY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Mukesh Ojha , YueHaibing , "David S. Miller" , Ben Hutchings Subject: [PATCH 4.19 15/84] dccp: Fix memleak in __feat_register_sp Date: Fri, 17 Jan 2020 00:17:49 +0100 Message-Id: <20200116231715.417447306@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: YueHaibing commit 1d3ff0950e2b40dc861b1739029649d03f591820 upstream. If dccp_feat_push_change fails, we forget free the mem which is alloced by kmemdup in dccp_feat_clone_sp_val. Reported-by: Hulk Robot Fixes: e8ef967a54f4 ("dccp: Registration routines for changing feature values") Reviewed-by: Mukesh Ojha Signed-off-by: YueHaibing Signed-off-by: David S. Miller Signed-off-by: Ben Hutchings Signed-off-by: Greg Kroah-Hartman --- net/dccp/feat.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/net/dccp/feat.c +++ b/net/dccp/feat.c @@ -738,7 +738,12 @@ static int __feat_register_sp(struct lis if (dccp_feat_clone_sp_val(&fval, sp_val, sp_len)) return -ENOMEM; - return dccp_feat_push_change(fn, feat, is_local, mandatory, &fval); + if (dccp_feat_push_change(fn, feat, is_local, mandatory, &fval)) { + kfree(fval.sp.vec); + return -ENOMEM; + } + + return 0; } /** From patchwork Thu Jan 16 23:17:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233735 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 8C538C33CAF for ; Thu, 16 Jan 2020 23:39:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5286B20748 for ; Thu, 16 Jan 2020 23:39:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217988; bh=BthoY7cBT+8JYlgXSawoQEjQkU4RYH/k7PQnhlSHTLk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=t6XUwtT0FEe9L9gn9TqOFxMw7AkyiabucMvh1WXdZZB2QmVmIdCOtkSvRrwHJUM+I L1kTMMDOLxq1LOvJZ/JCfRNWtVDRHe6T2viij9IOlsauidECo8cRz7bNKdQdusCPG3 vFF0hd1Evwx9BbrWN1DYMxAwyotSV7ege1rkgAA0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390365AbgAPX14 (ORCPT ); Thu, 16 Jan 2020 18:27:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:60210 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390363AbgAPX1z (ORCPT ); Thu, 16 Jan 2020 18:27:55 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 147EC20684; Thu, 16 Jan 2020 23:27:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217274; bh=BthoY7cBT+8JYlgXSawoQEjQkU4RYH/k7PQnhlSHTLk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rw40zoDW3TumsWjPPZlFu5zWhW4ni6tb/gV/4fekUxHA2dzmKqW+7X/vYU4IwCZBZ 80k/tA2hxze4P8r++g7WYHrf7LavwhEEiLuiGLzb37Sr467H4eZ2KHmQ/z+miQ0RdN XCVhu300kQd/zkCQ2lQPyH+pyKgtXTJk++h1afvc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , =?utf-8?b?572X5p2D?= , Chris Wilson , Jon Bloomfield , Tyler Hicks Subject: [PATCH 4.19 16/84] drm/i915: Fix use-after-free when destroying GEM context Date: Fri, 17 Jan 2020 00:17:50 +0100 Message-Id: <20200116231715.550710759@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Tyler Hicks This patch is a simplified fix to address a use-after-free in 4.14.x and 4.19.x stable kernels. The flaw is already fixed upstream, starting in 5.2, by commit 7dc40713618c ("drm/i915: Introduce a mutex for file_priv->context_idr") as part of a more complex patch series that isn't appropriate for backporting to stable kernels. Expand mutex coverage, while destroying the GEM context, to include the GEM context lookup step. This fixes a use-after-free detected by KASAN: ================================================================== BUG: KASAN: use-after-free in i915_ppgtt_close+0x2ca/0x2f0 Write of size 1 at addr ffff8881368a8368 by task i915-poc/3124 CPU: 0 PID: 3124 Comm: i915-poc Not tainted 4.14.164 #1 Hardware name: HP HP Elite x2 1012 G1 /80FC, BIOS N85 Ver. 01.20 04/05/2017 Call Trace: dump_stack+0xcd/0x12e ? _atomic_dec_and_lock+0x1b2/0x1b2 ? i915_ppgtt_close+0x2ca/0x2f0 ? printk+0x8f/0xab ? show_regs_print_info+0x53/0x53 ? i915_ppgtt_close+0x2ca/0x2f0 print_address_description+0x65/0x270 ? i915_ppgtt_close+0x2ca/0x2f0 kasan_report+0x251/0x340 i915_ppgtt_close+0x2ca/0x2f0 ? __radix_tree_insert+0x3f0/0x3f0 ? i915_ppgtt_init_hw+0x7c0/0x7c0 context_close+0x42e/0x680 ? i915_gem_context_release+0x230/0x230 ? kasan_kmalloc+0xa0/0xd0 ? radix_tree_delete_item+0x1d4/0x250 ? radix_tree_lookup+0x10/0x10 ? inet_recvmsg+0x4b0/0x4b0 ? kasan_slab_free+0x88/0xc0 i915_gem_context_destroy_ioctl+0x236/0x300 ? i915_gem_context_create_ioctl+0x360/0x360 ? drm_dev_printk+0x1d0/0x1d0 ? memcpy+0x34/0x50 ? i915_gem_context_create_ioctl+0x360/0x360 drm_ioctl_kernel+0x1b0/0x2b0 ? drm_ioctl_permit+0x2a0/0x2a0 ? avc_ss_reset+0xd0/0xd0 drm_ioctl+0x6fe/0xa20 ? i915_gem_context_create_ioctl+0x360/0x360 ? drm_getstats+0x20/0x20 ? put_unused_fd+0x260/0x260 do_vfs_ioctl+0x189/0x12d0 ? ioctl_preallocate+0x280/0x280 ? selinux_file_ioctl+0x3a7/0x680 ? selinux_bprm_set_creds+0xe30/0xe30 ? security_file_ioctl+0x69/0xa0 ? selinux_bprm_set_creds+0xe30/0xe30 SyS_ioctl+0x6f/0x80 ? __sys_sendmmsg+0x4a0/0x4a0 ? do_vfs_ioctl+0x12d0/0x12d0 do_syscall_64+0x214/0x5f0 ? __switch_to_asm+0x31/0x60 ? __switch_to_asm+0x25/0x60 ? __switch_to_asm+0x31/0x60 ? syscall_return_slowpath+0x2c0/0x2c0 ? copy_overflow+0x20/0x20 ? __switch_to_asm+0x25/0x60 ? syscall_return_via_sysret+0x2a/0x7a ? prepare_exit_to_usermode+0x200/0x200 ? __switch_to_asm+0x31/0x60 ? __switch_to_asm+0x31/0x60 ? __switch_to_asm+0x25/0x60 ? __switch_to_asm+0x25/0x60 ? __switch_to_asm+0x31/0x60 ? __switch_to_asm+0x25/0x60 ? __switch_to_asm+0x31/0x60 ? __switch_to_asm+0x31/0x60 ? __switch_to_asm+0x25/0x60 entry_SYSCALL_64_after_hwframe+0x3d/0xa2 RIP: 0033:0x7f7fda5115d7 RSP: 002b:00007f7eec317ec8 EFLAGS: 00000286 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f7fda5115d7 RDX: 000055b306db9188 RSI: 000000004008646e RDI: 0000000000000003 RBP: 00007f7eec317ef0 R08: 00007f7eec318700 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000286 R12: 00007f7eec317fc0 R13: 0000000000000000 R14: 0000000000000000 R15: 00007ffd8007ade0 Allocated by task 2898: save_stack+0x32/0xb0 kasan_kmalloc+0xa0/0xd0 kmem_cache_alloc_trace+0x5e/0x180 i915_ppgtt_create+0xab/0x2510 i915_gem_create_context+0x981/0xf90 i915_gem_context_create_ioctl+0x1d7/0x360 drm_ioctl_kernel+0x1b0/0x2b0 drm_ioctl+0x6fe/0xa20 do_vfs_ioctl+0x189/0x12d0 SyS_ioctl+0x6f/0x80 do_syscall_64+0x214/0x5f0 entry_SYSCALL_64_after_hwframe+0x3d/0xa2 Freed by task 104: save_stack+0x32/0xb0 kasan_slab_free+0x72/0xc0 kfree+0x88/0x190 i915_ppgtt_release+0x24e/0x460 i915_gem_context_free+0x90/0x480 contexts_free_worker+0x54/0x80 process_one_work+0x876/0x14e0 worker_thread+0x1b8/0xfd0 kthread+0x2f8/0x3c0 ret_from_fork+0x35/0x40 The buggy address belongs to the object at ffff8881368a8000 which belongs to the cache kmalloc-8192 of size 8192 The buggy address is located 872 bytes inside of 8192-byte region [ffff8881368a8000, ffff8881368aa000) The buggy address belongs to the page: page:ffffea0004da2a00 count:1 mapcount:0 mapping: (null) index:0x0 compound_mapcount: 0 flags: 0x200000000008100(slab|head) raw: 0200000000008100 0000000000000000 0000000000000000 0000000100030003 raw: dead000000000100 dead000000000200 ffff88822a002280 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8881368a8200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881368a8280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8881368a8300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881368a8380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881368a8400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== Fixes: 1acfc104cdf8 ("drm/i915: Enable rcu-only context lookups") Reported-by: 罗权 Cc: Chris Wilson Cc: Jon Bloomfield Cc: stable@vger.kernel.org # 4.14.x Cc: stable@vger.kernel.org # 4.19.x Signed-off-by: Tyler Hicks Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/i915_gem_context.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) --- a/drivers/gpu/drm/i915/i915_gem_context.c +++ b/drivers/gpu/drm/i915/i915_gem_context.c @@ -770,18 +770,19 @@ int i915_gem_context_destroy_ioctl(struc if (args->ctx_id == DEFAULT_CONTEXT_HANDLE) return -ENOENT; + ret = i915_mutex_lock_interruptible(dev); + if (ret) + return ret; + ctx = i915_gem_context_lookup(file_priv, args->ctx_id); - if (!ctx) + if (!ctx) { + mutex_unlock(&dev->struct_mutex); return -ENOENT; - - ret = mutex_lock_interruptible(&dev->struct_mutex); - if (ret) - goto out; + } __destroy_hw_context(ctx, file_priv); mutex_unlock(&dev->struct_mutex); -out: i915_gem_context_put(ctx); return 0; } From patchwork Thu Jan 16 23:17:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233736 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 C1638C33CAF for ; Thu, 16 Jan 2020 23:39:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 906792073A for ; Thu, 16 Jan 2020 23:39:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217981; bh=KeMuUU1uohJ1StY+/CmAWDNzajPxBmntrU56E74dvHo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=amX4Uu+nrEybLg/u/3IoP5Y0pQu9qTup7O2gB9OXKPi8QvewT+hrsWK6VDXAPLb/q XtE8vKa3M3KTHqekUzd5PoKThlg8GKp47Y7qCnhXtmZHqJ1BFkFyvjNySSUphFUnzf M2jIFVF7oKS8BAIrA34qMDb0GVgZXBDpIFPRcOLM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389214AbgAPX2A (ORCPT ); Thu, 16 Jan 2020 18:28:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:60308 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390379AbgAPX17 (ORCPT ); Thu, 16 Jan 2020 18:27:59 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 837A4206D9; Thu, 16 Jan 2020 23:27:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217277; bh=KeMuUU1uohJ1StY+/CmAWDNzajPxBmntrU56E74dvHo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j4qzHjHiu8PyMahtfkYQ4FNGO6p3LBfOM/2h6iUzKAD7HObvu06yjPoF4lfVgxgsj D2ZZVQ94s4LCX5cU0rIfhgN1oW161bfKaVgHiwuCkuAiDX9msaDbR5j/MqPTQiyZoF E7dWGup6Kq1GH/jifN83fsielta4sSbXjUqOD9K8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ran Bi , Hsin-Hsiung Wang , Alexandre Belloni Subject: [PATCH 4.19 17/84] rtc: mt6397: fix alarm register overwrite Date: Fri, 17 Jan 2020 00:17:51 +0100 Message-Id: <20200116231715.667078333@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Ran Bi commit 653997eeecef95c3ead4fba1b2d27e6a5854d6cd upstream. Alarm registers high byte was reserved for other functions. This add mask in alarm registers operation functions. This also fix error condition in interrupt handler. Fixes: fc2979118f3f ("rtc: mediatek: Add MT6397 RTC driver") Signed-off-by: Ran Bi Signed-off-by: Hsin-Hsiung Wang Link: https://lore.kernel.org/r/1576057435-3561-6-git-send-email-hsin-hsiung.wang@mediatek.com Signed-off-by: Alexandre Belloni Signed-off-by: Greg Kroah-Hartman --- drivers/rtc/rtc-mt6397.c | 47 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 14 deletions(-) --- a/drivers/rtc/rtc-mt6397.c +++ b/drivers/rtc/rtc-mt6397.c @@ -55,6 +55,14 @@ #define RTC_AL_SEC 0x0018 +#define RTC_AL_SEC_MASK 0x003f +#define RTC_AL_MIN_MASK 0x003f +#define RTC_AL_HOU_MASK 0x001f +#define RTC_AL_DOM_MASK 0x001f +#define RTC_AL_DOW_MASK 0x0007 +#define RTC_AL_MTH_MASK 0x000f +#define RTC_AL_YEA_MASK 0x007f + #define RTC_PDN2 0x002e #define RTC_PDN2_PWRON_ALARM BIT(4) @@ -111,7 +119,7 @@ static irqreturn_t mtk_rtc_irq_handler_t irqen = irqsta & ~RTC_IRQ_EN_AL; mutex_lock(&rtc->lock); if (regmap_write(rtc->regmap, rtc->addr_base + RTC_IRQ_EN, - irqen) < 0) + irqen) == 0) mtk_rtc_write_trigger(rtc); mutex_unlock(&rtc->lock); @@ -233,12 +241,12 @@ static int mtk_rtc_read_alarm(struct dev alm->pending = !!(pdn2 & RTC_PDN2_PWRON_ALARM); mutex_unlock(&rtc->lock); - tm->tm_sec = data[RTC_OFFSET_SEC]; - tm->tm_min = data[RTC_OFFSET_MIN]; - tm->tm_hour = data[RTC_OFFSET_HOUR]; - tm->tm_mday = data[RTC_OFFSET_DOM]; - tm->tm_mon = data[RTC_OFFSET_MTH]; - tm->tm_year = data[RTC_OFFSET_YEAR]; + tm->tm_sec = data[RTC_OFFSET_SEC] & RTC_AL_SEC_MASK; + tm->tm_min = data[RTC_OFFSET_MIN] & RTC_AL_MIN_MASK; + tm->tm_hour = data[RTC_OFFSET_HOUR] & RTC_AL_HOU_MASK; + tm->tm_mday = data[RTC_OFFSET_DOM] & RTC_AL_DOM_MASK; + tm->tm_mon = data[RTC_OFFSET_MTH] & RTC_AL_MTH_MASK; + tm->tm_year = data[RTC_OFFSET_YEAR] & RTC_AL_YEA_MASK; tm->tm_year += RTC_MIN_YEAR_OFFSET; tm->tm_mon--; @@ -259,14 +267,25 @@ static int mtk_rtc_set_alarm(struct devi tm->tm_year -= RTC_MIN_YEAR_OFFSET; tm->tm_mon++; - data[RTC_OFFSET_SEC] = tm->tm_sec; - data[RTC_OFFSET_MIN] = tm->tm_min; - data[RTC_OFFSET_HOUR] = tm->tm_hour; - data[RTC_OFFSET_DOM] = tm->tm_mday; - data[RTC_OFFSET_MTH] = tm->tm_mon; - data[RTC_OFFSET_YEAR] = tm->tm_year; - mutex_lock(&rtc->lock); + ret = regmap_bulk_read(rtc->regmap, rtc->addr_base + RTC_AL_SEC, + data, RTC_OFFSET_COUNT); + if (ret < 0) + goto exit; + + data[RTC_OFFSET_SEC] = ((data[RTC_OFFSET_SEC] & ~(RTC_AL_SEC_MASK)) | + (tm->tm_sec & RTC_AL_SEC_MASK)); + data[RTC_OFFSET_MIN] = ((data[RTC_OFFSET_MIN] & ~(RTC_AL_MIN_MASK)) | + (tm->tm_min & RTC_AL_MIN_MASK)); + data[RTC_OFFSET_HOUR] = ((data[RTC_OFFSET_HOUR] & ~(RTC_AL_HOU_MASK)) | + (tm->tm_hour & RTC_AL_HOU_MASK)); + data[RTC_OFFSET_DOM] = ((data[RTC_OFFSET_DOM] & ~(RTC_AL_DOM_MASK)) | + (tm->tm_mday & RTC_AL_DOM_MASK)); + data[RTC_OFFSET_MTH] = ((data[RTC_OFFSET_MTH] & ~(RTC_AL_MTH_MASK)) | + (tm->tm_mon & RTC_AL_MTH_MASK)); + data[RTC_OFFSET_YEAR] = ((data[RTC_OFFSET_YEAR] & ~(RTC_AL_YEA_MASK)) | + (tm->tm_year & RTC_AL_YEA_MASK)); + if (alm->enabled) { ret = regmap_bulk_write(rtc->regmap, rtc->addr_base + RTC_AL_SEC, From patchwork Thu Jan 16 23:17:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233737 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 ADECAC33CB3 for ; Thu, 16 Jan 2020 23:39:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7E30E20748 for ; Thu, 16 Jan 2020 23:39:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217978; bh=Vv5RyghxI+e62Ubg8liNy/1QrWWU3ugVXiPsjGGf0Sg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=DD+3bZix4q80MdZkwChb843ngOvP3xc50+nZDShAVVZWQUjLluoOkRyLN5vn7JQYu 6JSCJ5VemXO50vYooVEwXNLSMhnUmU56z2lDEK7LSNU+DHG+8BG1KGQSg9L68Jga9r Q7Z9UzonFxspVNJXgw5XhoXWfEu973RX/xkZpHog= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732818AbgAPXje (ORCPT ); Thu, 16 Jan 2020 18:39:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:60730 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389592AbgAPX2J (ORCPT ); Thu, 16 Jan 2020 18:28:09 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 889AE20684; Thu, 16 Jan 2020 23:28:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217289; bh=Vv5RyghxI+e62Ubg8liNy/1QrWWU3ugVXiPsjGGf0Sg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mJveuqFK6izK21HIIp6W8pBQqmNS8zdZ9sXrEJosvS9R6fMBofS5AF13qrXt+agIg Dbjk+Qaevw2jD7ivwXqSPkMK9StFzNjMMawP+vy07bTNHwCINq2kjk12wD5qPUrmJH Zga2LEOg8J4b3uCDYY4NfCXiKSy1s4k6PQ5jemQ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Olivier Moysan , Mark Brown Subject: [PATCH 4.19 21/84] ASoC: stm32: spdifrx: fix inconsistent lock state Date: Fri, 17 Jan 2020 00:17:55 +0100 Message-Id: <20200116231716.172793007@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Olivier Moysan commit 2859b1784031b5709446af8f6039c467f136e67d upstream. In current spdifrx driver locks may be requested as follows: - request lock on iec capture control, when starting synchronization. - request lock in interrupt context, when spdifrx stop is called from IRQ handler. Take lock with IRQs disabled, to avoid the possible deadlock. Lockdep report: [ 74.278059] ================================ [ 74.282306] WARNING: inconsistent lock state [ 74.290120] -------------------------------- ... [ 74.314373] CPU0 [ 74.314377] ---- [ 74.314381] lock(&(&spdifrx->lock)->rlock); [ 74.314396] [ 74.314400] lock(&(&spdifrx->lock)->rlock); Fixes: 03e4d5d56fa5 ("ASoC: stm32: Add SPDIFRX support") Signed-off-by: Olivier Moysan Link: https://lore.kernel.org/r/20191204154333.7152-2-olivier.moysan@st.com Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- sound/soc/stm/stm32_spdifrx.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) --- a/sound/soc/stm/stm32_spdifrx.c +++ b/sound/soc/stm/stm32_spdifrx.c @@ -313,6 +313,7 @@ static void stm32_spdifrx_dma_ctrl_stop( static int stm32_spdifrx_start_sync(struct stm32_spdifrx_data *spdifrx) { int cr, cr_mask, imr, ret; + unsigned long flags; /* Enable IRQs */ imr = SPDIFRX_IMR_IFEIE | SPDIFRX_IMR_SYNCDIE | SPDIFRX_IMR_PERRIE; @@ -320,7 +321,7 @@ static int stm32_spdifrx_start_sync(stru if (ret) return ret; - spin_lock(&spdifrx->lock); + spin_lock_irqsave(&spdifrx->lock, flags); spdifrx->refcount++; @@ -353,7 +354,7 @@ static int stm32_spdifrx_start_sync(stru "Failed to start synchronization\n"); } - spin_unlock(&spdifrx->lock); + spin_unlock_irqrestore(&spdifrx->lock, flags); return ret; } @@ -361,11 +362,12 @@ static int stm32_spdifrx_start_sync(stru static void stm32_spdifrx_stop(struct stm32_spdifrx_data *spdifrx) { int cr, cr_mask, reg; + unsigned long flags; - spin_lock(&spdifrx->lock); + spin_lock_irqsave(&spdifrx->lock, flags); if (--spdifrx->refcount) { - spin_unlock(&spdifrx->lock); + spin_unlock_irqrestore(&spdifrx->lock, flags); return; } @@ -384,7 +386,7 @@ static void stm32_spdifrx_stop(struct st regmap_read(spdifrx->regmap, STM32_SPDIFRX_DR, ®); regmap_read(spdifrx->regmap, STM32_SPDIFRX_CSR, ®); - spin_unlock(&spdifrx->lock); + spin_unlock_irqrestore(&spdifrx->lock, flags); } static int stm32_spdifrx_dma_ctrl_register(struct device *dev, From patchwork Thu Jan 16 23:17:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233738 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 AE09FC33CB3 for ; Thu, 16 Jan 2020 23:39:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7C1EC20661 for ; Thu, 16 Jan 2020 23:39:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217971; bh=yWWbWA/a60bFs6M+W+yu8Q+ZUvBOx7ldAV+THpLEjR8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=viDGwiU4qB3Ix9mYdnztV25QdhqSF2KhwunxnO/w52QojiFvW8yS7Sx+sql5A47rP EC26yv54ayhLVYCHJLdxwlqa18YwpjHu7Z9ywKw61k9OK+1OshhlNx5d5Uwlg6Rmtm E6ID2ZnMkejZq+JbfxdtIjv6bxHCkAVrPBKSvxOs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391070AbgAPX2Q (ORCPT ); Thu, 16 Jan 2020 18:28:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:60862 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389500AbgAPX2O (ORCPT ); Thu, 16 Jan 2020 18:28:14 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2BB50206D9; Thu, 16 Jan 2020 23:28:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217291; bh=yWWbWA/a60bFs6M+W+yu8Q+ZUvBOx7ldAV+THpLEjR8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lmLN5x5T1TpMyc3MatDH2IM6iF+SOEy19mOMmVwaweYe7IQ90B1EzUY4AOKIYspoN PYj6daHS1cexiSxrEUaeFH9d10xeGlYWHzjbacK08JUSjQQmmVT0lhVV6qjdmnKzvV 231O5wvnYjh3+71GHSbRYt9dZCSbhy4IjYyIchyc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Olivier Moysan , Mark Brown Subject: [PATCH 4.19 22/84] ASoC: stm32: spdifrx: fix race condition in irq handler Date: Fri, 17 Jan 2020 00:17:56 +0100 Message-Id: <20200116231716.272428926@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Olivier Moysan commit 86e1956af4c863d653136fd6e5694adf2054dbaa upstream. When snd_pcm_stop() is called in interrupt routine, substream context may have already been released. Add protection on substream context. Fixes: 03e4d5d56fa5 ("ASoC: stm32: Add SPDIFRX support") Signed-off-by: Olivier Moysan Link: https://lore.kernel.org/r/20191204154333.7152-3-olivier.moysan@st.com Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- sound/soc/stm/stm32_spdifrx.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) --- a/sound/soc/stm/stm32_spdifrx.c +++ b/sound/soc/stm/stm32_spdifrx.c @@ -213,6 +213,7 @@ * @slave_config: dma slave channel runtime config pointer * @phys_addr: SPDIFRX registers physical base address * @lock: synchronization enabling lock + * @irq_lock: prevent race condition with IRQ on stream state * @cs: channel status buffer * @ub: user data buffer * @irq: SPDIFRX interrupt line @@ -233,6 +234,7 @@ struct stm32_spdifrx_data { struct dma_slave_config slave_config; dma_addr_t phys_addr; spinlock_t lock; /* Sync enabling lock */ + spinlock_t irq_lock; /* Prevent race condition on stream state */ unsigned char cs[SPDIFRX_CS_BYTES_NB]; unsigned char ub[SPDIFRX_UB_BYTES_NB]; int irq; @@ -645,7 +647,6 @@ static const struct regmap_config stm32_ static irqreturn_t stm32_spdifrx_isr(int irq, void *devid) { struct stm32_spdifrx_data *spdifrx = (struct stm32_spdifrx_data *)devid; - struct snd_pcm_substream *substream = spdifrx->substream; struct platform_device *pdev = spdifrx->pdev; unsigned int cr, mask, sr, imr; unsigned int flags; @@ -713,14 +714,19 @@ static irqreturn_t stm32_spdifrx_isr(int regmap_update_bits(spdifrx->regmap, STM32_SPDIFRX_CR, SPDIFRX_CR_SPDIFEN_MASK, cr); - if (substream) - snd_pcm_stop(substream, SNDRV_PCM_STATE_DISCONNECTED); + spin_lock(&spdifrx->irq_lock); + if (spdifrx->substream) + snd_pcm_stop(spdifrx->substream, + SNDRV_PCM_STATE_DISCONNECTED); + spin_unlock(&spdifrx->irq_lock); return IRQ_HANDLED; } - if (err_xrun && substream) - snd_pcm_stop_xrun(substream); + spin_lock(&spdifrx->irq_lock); + if (err_xrun && spdifrx->substream) + snd_pcm_stop_xrun(spdifrx->substream); + spin_unlock(&spdifrx->irq_lock); return IRQ_HANDLED; } @@ -729,9 +735,12 @@ static int stm32_spdifrx_startup(struct struct snd_soc_dai *cpu_dai) { struct stm32_spdifrx_data *spdifrx = snd_soc_dai_get_drvdata(cpu_dai); + unsigned long flags; int ret; + spin_lock_irqsave(&spdifrx->irq_lock, flags); spdifrx->substream = substream; + spin_unlock_irqrestore(&spdifrx->irq_lock, flags); ret = clk_prepare_enable(spdifrx->kclk); if (ret) @@ -807,8 +816,12 @@ static void stm32_spdifrx_shutdown(struc struct snd_soc_dai *cpu_dai) { struct stm32_spdifrx_data *spdifrx = snd_soc_dai_get_drvdata(cpu_dai); + unsigned long flags; + spin_lock_irqsave(&spdifrx->irq_lock, flags); spdifrx->substream = NULL; + spin_unlock_irqrestore(&spdifrx->irq_lock, flags); + clk_disable_unprepare(spdifrx->kclk); } @@ -912,6 +925,7 @@ static int stm32_spdifrx_probe(struct pl spdifrx->pdev = pdev; init_completion(&spdifrx->cs_completion); spin_lock_init(&spdifrx->lock); + spin_lock_init(&spdifrx->irq_lock); platform_set_drvdata(pdev, spdifrx); From patchwork Thu Jan 16 23:17:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233807 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 9427EC33CAF for ; Thu, 16 Jan 2020 23:28:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 692052072E for ; Thu, 16 Jan 2020 23:28:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217299; bh=zUwbC1w2zhbHABY8M4rwoXqvkrgONGKbYDP+0nH1LKA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=IOzLkbzuPzEwtaJbRIpO8odsPo2R1gOhbhzgUMLRcExTdmj+BNdoME4NZYw+z91C3 v7H1cEGJ3mKb7ln99tU/fTPy5r12E8d2/K6W6pyOwhkkzHrplzQQK9G9tCU2K3gxwe VdA3Km/9oP2QAXTtA8xuIYfsQlgeXMB9EAE/5kQU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391076AbgAPX2R (ORCPT ); Thu, 16 Jan 2020 18:28:17 -0500 Received: from mail.kernel.org ([198.145.29.99]:32784 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391073AbgAPX2R (ORCPT ); Thu, 16 Jan 2020 18:28:17 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 09A80206D9; Thu, 16 Jan 2020 23:28:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217296; bh=zUwbC1w2zhbHABY8M4rwoXqvkrgONGKbYDP+0nH1LKA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Amrd01Wz7vVF0sEpAoVhcqsldrsZZBFk0jocjER6731l9o4XYTkq2PPMdNaHxCEtm Dwa24aMQcfXUUHyfeTZz9L1hhsR1VUE57YfIsjSYtLAceW+TtdXaLNpdGQE4qUMeQ8 jCw1NIHyJtESWOlMZn4DjRquv1GYVAX13E26n250= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Swapna Manupati , Michal Simek , Srinivas Neeli , Linus Walleij Subject: [PATCH 4.19 24/84] gpio: zynq: Fix for bug in zynq_gpio_restore_context API Date: Fri, 17 Jan 2020 00:17:58 +0100 Message-Id: <20200116231716.500899761@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Swapna Manupati commit 36f2e7207f21a83ca0054116191f119ac64583ab upstream. This patch writes the inverse value of Interrupt Mask Status register into the Interrupt Enable register in zynq_gpio_restore_context API to fix the bug. Fixes: e11de4de28c0 ("gpio: zynq: Add support for suspend resume") Signed-off-by: Swapna Manupati Signed-off-by: Michal Simek Signed-off-by: Srinivas Neeli Link: https://lore.kernel.org/r/1577362338-28744-2-git-send-email-srinivas.neeli@xilinx.com Signed-off-by: Linus Walleij Signed-off-by: Greg Kroah-Hartman --- drivers/gpio/gpio-zynq.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/drivers/gpio/gpio-zynq.c +++ b/drivers/gpio/gpio-zynq.c @@ -639,6 +639,8 @@ static void zynq_gpio_restore_context(st unsigned int bank_num; for (bank_num = 0; bank_num < gpio->p_data->max_bank; bank_num++) { + writel_relaxed(ZYNQ_GPIO_IXR_DISABLE_ALL, gpio->base_addr + + ZYNQ_GPIO_INTDIS_OFFSET(bank_num)); writel_relaxed(gpio->context.datalsw[bank_num], gpio->base_addr + ZYNQ_GPIO_DATA_LSW_OFFSET(bank_num)); @@ -648,9 +650,6 @@ static void zynq_gpio_restore_context(st writel_relaxed(gpio->context.dirm[bank_num], gpio->base_addr + ZYNQ_GPIO_DIRM_OFFSET(bank_num)); - writel_relaxed(gpio->context.int_en[bank_num], - gpio->base_addr + - ZYNQ_GPIO_INTEN_OFFSET(bank_num)); writel_relaxed(gpio->context.int_type[bank_num], gpio->base_addr + ZYNQ_GPIO_INTTYPE_OFFSET(bank_num)); @@ -660,6 +659,9 @@ static void zynq_gpio_restore_context(st writel_relaxed(gpio->context.int_any[bank_num], gpio->base_addr + ZYNQ_GPIO_INTANY_OFFSET(bank_num)); + writel_relaxed(~(gpio->context.int_en[bank_num]), + gpio->base_addr + + ZYNQ_GPIO_INTEN_OFFSET(bank_num)); } } From patchwork Thu Jan 16 23:17:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233739 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 9E043C33CAF for ; Thu, 16 Jan 2020 23:39:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6CFBA2073A for ; Thu, 16 Jan 2020 23:39:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217970; bh=zYyQCYQDckUrS/kpMNPDCdFrFdG67epaAPuttfXLJ8c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=vh0VOnUIalzYPrP5VJTlItCtb6zbglsmZW5CWiQWsAen/UBKP99tLN8oqBnMVzaIa 35rt1D2PB+fX7HO2Szha0IYy4jLKjqJjPPb9zpCs50sMnp1HADc680lQUdS+7heecf vfyscIHSAVh2qoKPmObfuwezWgW+8OlSsMtmwRbI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730720AbgAPXjZ (ORCPT ); Thu, 16 Jan 2020 18:39:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:32874 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391079AbgAPX2T (ORCPT ); Thu, 16 Jan 2020 18:28:19 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6E5E520684; Thu, 16 Jan 2020 23:28:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217298; bh=zYyQCYQDckUrS/kpMNPDCdFrFdG67epaAPuttfXLJ8c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kVYn9eh/mZiBb23EWX9JsJPrwIkRcbmVAndLnNEqxNqVj6mIRqsjApDk+OJcl/o6A BK4M0LNC+C1ylEsFbEMKFhGdR4ccGnHB5Z8912+8BvAHqXigSbP+wEdMy0LyrbuRCx dfXsHysC+c5AkqvoFeW5HBL5UTnQ9EwJW7vtv+QM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jon Derrick , Lu Baolu , Joerg Roedel Subject: [PATCH 4.19 25/84] iommu: Remove device link to group on failure Date: Fri, 17 Jan 2020 00:17:59 +0100 Message-Id: <20200116231716.623652200@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jon Derrick commit 7d4e6ccd1fb09dbfbc49746ca82bd5c25ad4bfe4 upstream. This adds the missing teardown step that removes the device link from the group when the device addition fails. Signed-off-by: Jon Derrick Fixes: 797a8b4d768c5 ("iommu: Handle default domain attach failure") Reviewed-by: Lu Baolu Signed-off-by: Joerg Roedel Signed-off-by: Greg Kroah-Hartman --- drivers/iommu/iommu.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -650,6 +650,7 @@ err_put_group: mutex_unlock(&group->mutex); dev->iommu_group = NULL; kobject_put(group->devices_kobj); + sysfs_remove_link(group->devices_kobj, device->name); err_free_name: kfree(device->name); err_remove_link: From patchwork Thu Jan 16 23:18:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233806 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 29151C33CB7 for ; Thu, 16 Jan 2020 23:28:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E8BDB214AF for ; Thu, 16 Jan 2020 23:28:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217331; bh=LLWDbMEtQlHQaEFDZtOJvHJuT8Dp4yXK03QRPw7cZK0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=No7Zgeaf4JX3+Lyw5L/6OeG9KBPDlLgrTyAeXHXGQ35AeL/LR2AyPKm/Sovf2+Fgp ovFq7shQyZsRhqsKeNun4cYxJrgJqBs/Ym7W1z8mZwoao6r5HqnQjCtEIsTWya8SSq lrc6Ci5XG9Ii74xESgcSCXmiRboHvY4mZQZHlKQY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389779AbgAPX2u (ORCPT ); Thu, 16 Jan 2020 18:28:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:33782 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731940AbgAPX2q (ORCPT ); Thu, 16 Jan 2020 18:28:46 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 01DBA2072E; Thu, 16 Jan 2020 23:28:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217325; bh=LLWDbMEtQlHQaEFDZtOJvHJuT8Dp4yXK03QRPw7cZK0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W/aiM66NxrIN0QlsxTR038+PRKsnNofimEWfg9dClCjd3z+0Beha0EldYmWZlAqun bFkp+ujUFRdMQNOWSIp/pio6rETfpIiypzvTD4jvcKtjqyX9Lz3Lo0Iphz+JBbut1S x6HI9713ubzVqPLi8Yl+CeJAMPfzeDBzf8CdSUck= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexandra Winter , Julian Wiedmann , "David S. Miller" Subject: [PATCH 4.19 29/84] s390/qeth: Fix vnicc_is_in_use if rx_bcast not set Date: Fri, 17 Jan 2020 00:18:03 +0100 Message-Id: <20200116231717.121482627@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Alexandra Winter commit e8a66d800471e2df7f0b484e2e46898b21d1fa82 upstream. Symptom: After vnicc/rx_bcast has been manually set to 0, bridge_* sysfs parameters can still be set or written. Only occurs on HiperSockets, as OSA doesn't support changing rx_bcast. Vnic characteristics and bridgeport settings are mutually exclusive. rx_bcast defaults to 1, so manually setting it to 0 should disable bridge_* parameters. Instead it makes sense here to check the supported mask. If the card does not support vnicc at all, bridge commands are always allowed. Fixes: caa1f0b10d18 ("s390/qeth: add VNICC enable/disable support") Signed-off-by: Alexandra Winter Signed-off-by: Julian Wiedmann Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/s390/net/qeth_l2_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/s390/net/qeth_l2_main.c +++ b/drivers/s390/net/qeth_l2_main.c @@ -2285,8 +2285,7 @@ int qeth_l2_vnicc_get_timeout(struct qet /* check if VNICC is currently enabled */ bool qeth_l2_vnicc_is_in_use(struct qeth_card *card) { - /* if everything is turned off, VNICC is not active */ - if (!card->options.vnicc.cur_chars) + if (!card->options.vnicc.sup_chars) return false; /* default values are only OK if rx_bcast was not enabled by user * or the card is offline. From patchwork Thu Jan 16 23:18:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233747 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=-11.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 B6842C33CAF for ; Thu, 16 Jan 2020 23:38:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7F34520661 for ; Thu, 16 Jan 2020 23:38:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217920; bh=AYrrjajashVILVcw4LRRvqc3zeVs4tG/2WfuTQkxp74=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=nPCJDQp/iX9flT+AlihHho+tMMiMm7OsrGS/9dnod0KL40NqE/nh+OiRaKaYW+hJc ChAe+CvcoMDBj8jwSEhiRQrfkinka9KKxn0+0Vzl9LFot+WkhExBR/jP2N7VWs611q S9mc688wbm/okfOWKRXiQ6AoklmvxLr8CzIaeuYE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391238AbgAPX3N (ORCPT ); Thu, 16 Jan 2020 18:29:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:34666 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389191AbgAPX3M (ORCPT ); Thu, 16 Jan 2020 18:29:12 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A02142072E; Thu, 16 Jan 2020 23:29:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217352; bh=AYrrjajashVILVcw4LRRvqc3zeVs4tG/2WfuTQkxp74=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RVr50ibTXadI7DbHWd2A4HsX9iWlE9YiLs8LZIVNkLbz0+rrKwS6aikUuhqsCdmPe mi0tAp0aihK3jkiePaVwHNj6dDieEvOZba2PRt9iBOGNS5x1aF6/J7ti7jvnbkvu5F 47xSRmHHK8Xyt+9IuFK6BCtBXwDTKJTKok4mQsZw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Steve French Subject: [PATCH 4.19 30/84] cifs: Adjust indentation in smb2_open_file Date: Fri, 17 Jan 2020 00:18:04 +0100 Message-Id: <20200116231717.245025122@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Nathan Chancellor commit 7935799e041ae10d380d04ea23868240f082bd11 upstream. Clang warns: ../fs/cifs/smb2file.c:70:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation] if (oparms->tcon->use_resilient) { ^ ../fs/cifs/smb2file.c:66:2: note: previous statement is here if (rc) ^ 1 warning generated. This warning occurs because there is a space after the tab on this line. Remove it so that the indentation is consistent with the Linux kernel coding style and clang no longer warns. Fixes: 592fafe644bf ("Add resilienthandles mount parm") Link: https://github.com/ClangBuiltLinux/linux/issues/826 Signed-off-by: Nathan Chancellor Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/cifs/smb2file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/cifs/smb2file.c +++ b/fs/cifs/smb2file.c @@ -67,7 +67,7 @@ smb2_open_file(const unsigned int xid, s goto out; - if (oparms->tcon->use_resilient) { + if (oparms->tcon->use_resilient) { nr_ioctl_req.Timeout = 0; /* use server default (120 seconds) */ nr_ioctl_req.Reserved = 0; rc = SMB2_ioctl(xid, oparms->tcon, fid->persistent_fid, From patchwork Thu Jan 16 23:18:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233802 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 25D92C33CAF for ; Thu, 16 Jan 2020 23:29:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E869C2073A for ; Thu, 16 Jan 2020 23:29:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217382; bh=crauBlMyJ9CkIEHb5/hCZFFpb1CH0hpS+gwPv5Gr3lM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=AERl1W66I7vxRndIaPFa1FQPt5BxgdvdTOgelcMAffW7YDVMkxkjsAXbwXjkyBvAa SgxMvoipRloPu3vEjPU0UeKvOhminGf60O7ogEV2XB8bNh04/kJyW7EFEGEh3AU2uw +qcHeh2jLBaSiyYn/tkVOBuas7dV1CItsv5ETgDE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391321AbgAPX3k (ORCPT ); Thu, 16 Jan 2020 18:29:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:35520 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391316AbgAPX3j (ORCPT ); Thu, 16 Jan 2020 18:29:39 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6A2B1206D9; Thu, 16 Jan 2020 23:29:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217378; bh=crauBlMyJ9CkIEHb5/hCZFFpb1CH0hpS+gwPv5Gr3lM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A4jQC7noFSc2qlUBmkCTGf009d/e9Gc60MBdz+tzARRKNP7UZvqUsatNW+lNtpDnW eoXEgRPv55+7YpB0dl6G10OpmRMKB16+QOEpc55M4HqifZTnMn+x3NJ+xFyo4l5rVB SzCxNB+ev1k07vNXARJNpR2hf1/5CW9p+2q1VsYU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Christian_K=C3=B6nig?= , =?utf-8?q?Michel_D=C3=A4nzer?= , Junwei Zhang , Huang Rui , Alex Deucher , Zubin Mithra Subject: [PATCH 4.19 32/84] drm/ttm: fix start page for huge page check in ttm_put_pages() Date: Fri, 17 Jan 2020 00:18:06 +0100 Message-Id: <20200116231717.499584577@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Christian König commit ac1e516d5a4c56bf0cb4a3dfc0672f689131cfd4 upstream. The first page entry is always the same with itself. Signed-off-by: Christian König Reviewed-by: Michel Dänzer Reviewed-by: Junwei Zhang Reviewed-by: Huang Rui Signed-off-by: Alex Deucher Cc: Zubin Mithra Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/ttm/ttm_page_alloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/ttm/ttm_page_alloc.c +++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c @@ -732,7 +732,7 @@ static void ttm_put_pages(struct page ** #ifdef CONFIG_TRANSPARENT_HUGEPAGE if (!(flags & TTM_PAGE_FLAG_DMA32) && (npages - i) >= HPAGE_PMD_NR) { - for (j = 0; j < HPAGE_PMD_NR; ++j) + for (j = 1; j < HPAGE_PMD_NR; ++j) if (p++ != pages[i + j]) break; @@ -767,7 +767,7 @@ static void ttm_put_pages(struct page ** if (!p) break; - for (j = 0; j < HPAGE_PMD_NR; ++j) + for (j = 1; j < HPAGE_PMD_NR; ++j) if (p++ != pages[i + j]) break; From patchwork Thu Jan 16 23:18:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233751 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 259C1C33CB3 for ; Thu, 16 Jan 2020 23:38:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E4E612073A for ; Thu, 16 Jan 2020 23:38:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217892; bh=FOFzr0NAm5ktk6Djd9QBwhNzPcrJqu+nWzNrlTcnVL8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Slss5p7xVaVDG38rpa90/qxN9Emx6tQWssSk9kpB+c6T866hsp6Jah2jqh8bWDFzt mKnPDlk4S/qoDaqKbu4XzyIT9+kJwPFlsCbbYz6Wzy6cKUo4Nti5rCx7Q7N1WL6T5m Zu+x5SkUCRx02OdCJAQ86HSXPfLs4Nxt0q4Xjxuk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391328AbgAPX3m (ORCPT ); Thu, 16 Jan 2020 18:29:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:35616 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391323AbgAPX3m (ORCPT ); Thu, 16 Jan 2020 18:29:42 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D54DC2082F; Thu, 16 Jan 2020 23:29:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217381; bh=FOFzr0NAm5ktk6Djd9QBwhNzPcrJqu+nWzNrlTcnVL8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MLp1xBgOVPM4bYhFnPpxafAyMziH3n4HEeCH7jcRGYB1zLyk8750KwV2QjtmUDWej 2JMVfQXv5prD32t4yVAG9EkAtmU9idtTZ1+9MF1nQzYmfuq+q2o3isbMqg+ETMcDFd nJ7MOFsjsychOPjd+LU+DzJllLAn3kFY1Ui0M6bU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Christian_K=C3=B6nig?= , =?utf-8?q?Michel_D=C3=A4nzer?= , Huang Rui , Alex Deucher , Zubin Mithra Subject: [PATCH 4.19 33/84] drm/ttm: fix incrementing the page pointer for huge pages Date: Fri, 17 Jan 2020 00:18:07 +0100 Message-Id: <20200116231717.636874499@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Christian König commit 453393369dc9806d2455151e329c599684762428 upstream. When we increment the counter we need to increment the pointer as well. Signed-off-by: Christian König Fixes: e16858a7e6e7 drm/ttm: fix start page for huge page check in ttm_put_pages() Reviewed-by: Michel Dänzer Acked-by: Huang Rui Signed-off-by: Alex Deucher Cc: Zubin Mithra Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/ttm/ttm_page_alloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/ttm/ttm_page_alloc.c +++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c @@ -733,7 +733,7 @@ static void ttm_put_pages(struct page ** if (!(flags & TTM_PAGE_FLAG_DMA32) && (npages - i) >= HPAGE_PMD_NR) { for (j = 1; j < HPAGE_PMD_NR; ++j) - if (p++ != pages[i + j]) + if (++p != pages[i + j]) break; if (j == HPAGE_PMD_NR) @@ -768,7 +768,7 @@ static void ttm_put_pages(struct page ** break; for (j = 1; j < HPAGE_PMD_NR; ++j) - if (p++ != pages[i + j]) + if (++p != pages[i + j]) break; if (j != HPAGE_PMD_NR) From patchwork Thu Jan 16 23:18:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233801 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 EB9B2C33CAF for ; Thu, 16 Jan 2020 23:29:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BB70D2072E for ; Thu, 16 Jan 2020 23:29:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217391; bh=bRXWIdddXbaSpDKseEkgF8QW4FjBl0fHJoBki22Yous=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=yz+LDemptouHoy2PpKu96fDn4K6D3g2plcy0Ng1vs2GRYOH68TP9p2GQNd7Mi3jtg /YKdmQPfOEZzh/7n6UcwQ4vkWTyESB/QZiuM7QU2vclP+LjVcdoPm2efF1CxARQuxq y/NFAFmI2QSPcvMes5F4Aq06eoHtmoIWI/Z7PoQA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403747AbgAPX3t (ORCPT ); Thu, 16 Jan 2020 18:29:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:35852 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391358AbgAPX3t (ORCPT ); Thu, 16 Jan 2020 18:29:49 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 497BF206D9; Thu, 16 Jan 2020 23:29:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217388; bh=bRXWIdddXbaSpDKseEkgF8QW4FjBl0fHJoBki22Yous=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dVS6UMLWjgcaYeLFYKR/Q1kSHkv2B0xC5kPYYQ4zCN5l/xR312UfHMRqmNV3IT9T4 2HGXdFPjvBQmzfW1ADHmjJjHAQeRJHZ1nBVfhgEsRYJmXmbPA1EaZwogQ/aZa8/EvW K0221Tu0sp32Sxt17yN371IeknwAJpE4us7DPGYM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bart Van Assche , Honggang Li , Jason Gunthorpe Subject: [PATCH 4.19 36/84] RDMA/srpt: Report the SCSI residual to the initiator Date: Fri, 17 Jan 2020 00:18:10 +0100 Message-Id: <20200116231718.035158071@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Bart Van Assche commit e88982ad1bb12db699de96fbc07096359ef6176c upstream. The code added by this patch is similar to the code that already exists in ibmvscsis_determine_resid(). This patch has been tested by running the following command: strace sg_raw -r 1k /dev/sdb 12 00 00 00 60 00 -o inquiry.bin |& grep resid= Link: https://lore.kernel.org/r/20191105214632.183302-1-bvanassche@acm.org Fixes: a42d985bd5b2 ("ib_srpt: Initial SRP Target merge for v3.3-rc1") Signed-off-by: Bart Van Assche Acked-by: Honggang Li Signed-off-by: Jason Gunthorpe Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/ulp/srpt/ib_srpt.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -1324,9 +1324,11 @@ static int srpt_build_cmd_rsp(struct srp struct srpt_send_ioctx *ioctx, u64 tag, int status) { + struct se_cmd *cmd = &ioctx->cmd; struct srp_rsp *srp_rsp; const u8 *sense_data; int sense_data_len, max_sense_len; + u32 resid = cmd->residual_count; /* * The lowest bit of all SAM-3 status codes is zero (see also @@ -1348,6 +1350,28 @@ static int srpt_build_cmd_rsp(struct srp srp_rsp->tag = tag; srp_rsp->status = status; + if (cmd->se_cmd_flags & SCF_UNDERFLOW_BIT) { + if (cmd->data_direction == DMA_TO_DEVICE) { + /* residual data from an underflow write */ + srp_rsp->flags = SRP_RSP_FLAG_DOUNDER; + srp_rsp->data_out_res_cnt = cpu_to_be32(resid); + } else if (cmd->data_direction == DMA_FROM_DEVICE) { + /* residual data from an underflow read */ + srp_rsp->flags = SRP_RSP_FLAG_DIUNDER; + srp_rsp->data_in_res_cnt = cpu_to_be32(resid); + } + } else if (cmd->se_cmd_flags & SCF_OVERFLOW_BIT) { + if (cmd->data_direction == DMA_TO_DEVICE) { + /* residual data from an overflow write */ + srp_rsp->flags = SRP_RSP_FLAG_DOOVER; + srp_rsp->data_out_res_cnt = cpu_to_be32(resid); + } else if (cmd->data_direction == DMA_FROM_DEVICE) { + /* residual data from an overflow read */ + srp_rsp->flags = SRP_RSP_FLAG_DIOVER; + srp_rsp->data_in_res_cnt = cpu_to_be32(resid); + } + } + if (sense_data_len) { BUILD_BUG_ON(MIN_MAX_RSP_SIZE <= sizeof(*srp_rsp)); max_sense_len = ch->max_ti_iu_len - sizeof(*srp_rsp); From patchwork Thu Jan 16 23:18:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233752 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 B18CBC33CAF for ; Thu, 16 Jan 2020 23:38:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 75F8C2072B for ; Thu, 16 Jan 2020 23:38:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217888; bh=2WNeRsDryRBzpXQN44EbufOyKvzcVAspZ6zfgL6yVVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=qBkbAm6wr1VMnqm31dTgNlpMwgynWH0WyMjQsl+JAfWZAXMHOy31jzAnZe2kmOvhw t30R60aS/8oZ5pRSaQ6iQ1cf+4i1lkp5+dg4VFXjxd3fgl5CzTGX1t2XGGcYG5YBeg L71NEtSlO9GPYewjgMwtEIkRg3NPKc1lqcnc7Lwk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391360AbgAPX3w (ORCPT ); Thu, 16 Jan 2020 18:29:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:35988 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403750AbgAPX3w (ORCPT ); Thu, 16 Jan 2020 18:29:52 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BEAB12072B; Thu, 16 Jan 2020 23:29:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217391; bh=2WNeRsDryRBzpXQN44EbufOyKvzcVAspZ6zfgL6yVVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iVUvR4rxX9J18mq0RvWSmKzpmm19jhT36IUZO0OR3Ev2eMviRqGcu4eynIOLsyuyy j6U0rChSmZiscnnJUQr9u6A3AHoKxhCHqd52rsiRZmbkF/bv2U2mtDGZKxIfmKatcj fWuGro8gfANf2kQDleYSSf5t94CWEfxyhp1Aa4/c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, James Bottomley , Luo Jiaxing , John Garry , "Martin K. Petersen" Subject: [PATCH 4.19 37/84] scsi: enclosure: Fix stale device oops with hot replug Date: Fri, 17 Jan 2020 00:18:11 +0100 Message-Id: <20200116231718.132769637@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: James Bottomley commit 529244bd1afc102ab164429d338d310d5d65e60d upstream. Doing an add/remove/add on a SCSI device in an enclosure leads to an oops caused by poisoned values in the enclosure device list pointers. The reason is because we are keeping the enclosure device across the enclosed device add/remove/add but the current code is doing a device_add/device_del/device_add on it. This is the wrong thing to do in sysfs, so fix it by not doing a device_del on the enclosure device simply because of a hot remove of the drive in the slot. [mkp: added missing email addresses] Fixes: 43d8eb9cfd0a ("[SCSI] ses: add support for enclosure component hot removal") Link: https://lore.kernel.org/r/1578532892.3852.10.camel@HansenPartnership.com Signed-off-by: James Bottomley Reported-by: Luo Jiaxing Tested-by: John Garry Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/misc/enclosure.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/misc/enclosure.c +++ b/drivers/misc/enclosure.c @@ -419,10 +419,9 @@ int enclosure_remove_device(struct enclo cdev = &edev->component[i]; if (cdev->dev == dev) { enclosure_remove_links(cdev); - device_del(&cdev->cdev); put_device(dev); cdev->dev = NULL; - return device_add(&cdev->cdev); + return 0; } } return -ENODEV; From patchwork Thu Jan 16 23:18:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233744 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 59297C33CB6 for ; Thu, 16 Jan 2020 23:38:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2CF9720661 for ; Thu, 16 Jan 2020 23:38:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217938; bh=PoxcrDcGEQmUeQXGusjb3WsOfqsZeYJY0WnI1BoaYy0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=HimAm60T0CZ6z1TmEjKJ95X/FeXgHiq4JA7pBiVHNd2ofMNaYxR2EWa4WttdG1nIL DhM8y/uDYF39vSt66TECM6vcJPYlD35iAbGp3WaEEJz4YX8shI3U7zAAuZxrIeI/LR 42S0i/nuJAazBqhd6f/Rwee2iBCdoZidx754OEU0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391179AbgAPX2y (ORCPT ); Thu, 16 Jan 2020 18:28:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:34012 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729762AbgAPX2x (ORCPT ); Thu, 16 Jan 2020 18:28:53 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3C95B20684; Thu, 16 Jan 2020 23:28:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217332; bh=PoxcrDcGEQmUeQXGusjb3WsOfqsZeYJY0WnI1BoaYy0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eGYqx+BMwIdxFNjrgFRn8bhUoAFWf2RhwEsHwtSqno/XfBo8Iky2CLR45jt1MQYc6 rg2tYp81lg9w7ogLbHdy/QBND9UvDKhKoO2QrmvdMIOKLCYvvi8TYIJjPTX/58yhjy 2NJvRI/PThOVYs9EjeVqNj2uHSuk75IrOClBI73E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jason Anderson , Hans de Goede , Andy Shevchenko Subject: [PATCH 4.19 40/84] platform/x86: GPD pocket fan: Use default values when wrong modparams are given Date: Fri, 17 Jan 2020 00:18:14 +0100 Message-Id: <20200116231718.472607590@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Hans de Goede commit 6ae01050e49f0080ae30575d9b45a6d4a3d7ee23 upstream. Use our default values when wrong module-parameters are given, instead of refusing to load. Refusing to load leaves the fan at the BIOS default setting, which is "Off". The CPU's thermal throttling should protect the system from damage, but not-loading is really not the best fallback in this case. This commit fixes this by re-setting module-parameter values to their defaults if they are out of range, instead of failing the probe with -EINVAL. Cc: stable@vger.kernel.org Cc: Jason Anderson Reported-by: Jason Anderson Fixes: 594ce6db326e ("platform/x86: GPD pocket fan: Use a min-speed of 2 while charging") Signed-off-by: Hans de Goede Signed-off-by: Andy Shevchenko Signed-off-by: Greg Kroah-Hartman --- drivers/platform/x86/gpd-pocket-fan.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) --- a/drivers/platform/x86/gpd-pocket-fan.c +++ b/drivers/platform/x86/gpd-pocket-fan.c @@ -16,17 +16,27 @@ #define MAX_SPEED 3 -static int temp_limits[3] = { 55000, 60000, 65000 }; +#define TEMP_LIMIT0_DEFAULT 55000 +#define TEMP_LIMIT1_DEFAULT 60000 +#define TEMP_LIMIT2_DEFAULT 65000 + +#define HYSTERESIS_DEFAULT 3000 + +#define SPEED_ON_AC_DEFAULT 2 + +static int temp_limits[3] = { + TEMP_LIMIT0_DEFAULT, TEMP_LIMIT1_DEFAULT, TEMP_LIMIT2_DEFAULT, +}; module_param_array(temp_limits, int, NULL, 0444); MODULE_PARM_DESC(temp_limits, "Millicelsius values above which the fan speed increases"); -static int hysteresis = 3000; +static int hysteresis = HYSTERESIS_DEFAULT; module_param(hysteresis, int, 0444); MODULE_PARM_DESC(hysteresis, "Hysteresis in millicelsius before lowering the fan speed"); -static int speed_on_ac = 2; +static int speed_on_ac = SPEED_ON_AC_DEFAULT; module_param(speed_on_ac, int, 0444); MODULE_PARM_DESC(speed_on_ac, "minimum fan speed to allow when system is powered by AC"); @@ -120,18 +130,21 @@ static int gpd_pocket_fan_probe(struct p if (temp_limits[i] < 40000 || temp_limits[i] > 70000) { dev_err(&pdev->dev, "Invalid temp-limit %d (must be between 40000 and 70000)\n", temp_limits[i]); - return -EINVAL; + temp_limits[0] = TEMP_LIMIT0_DEFAULT; + temp_limits[1] = TEMP_LIMIT1_DEFAULT; + temp_limits[2] = TEMP_LIMIT2_DEFAULT; + break; } } if (hysteresis < 1000 || hysteresis > 10000) { dev_err(&pdev->dev, "Invalid hysteresis %d (must be between 1000 and 10000)\n", hysteresis); - return -EINVAL; + hysteresis = HYSTERESIS_DEFAULT; } if (speed_on_ac < 0 || speed_on_ac > MAX_SPEED) { dev_err(&pdev->dev, "Invalid speed_on_ac %d (must be between 0 and 3)\n", speed_on_ac); - return -EINVAL; + speed_on_ac = SPEED_ON_AC_DEFAULT; } fan = devm_kzalloc(&pdev->dev, sizeof(*fan), GFP_KERNEL); From patchwork Thu Jan 16 23:18:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233745 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 79461C33CB6 for ; Thu, 16 Jan 2020 23:38:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4101820661 for ; Thu, 16 Jan 2020 23:38:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217933; bh=/nGz56sMA8caDTBApOsOknhSoqaPclZYldLAfPUelVs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=080jA0QkxrYF0QyJFPTzazjTNAOevTBncunVs2011CI6fR0daIwqlBqCnPgJzonjH cYCsqkvtEYkMuMPwxFmKq26K6zodah/XVYXO2pfXtX8fBral8rtEE8kO3CU5CHq5mr ts1M6IMBoKJKaJ/Qvkigfi9aoEZ7kGCvDoOnpGII= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391194AbgAPX24 (ORCPT ); Thu, 16 Jan 2020 18:28:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:34100 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388441AbgAPX2z (ORCPT ); Thu, 16 Jan 2020 18:28:55 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A46B9206D9; Thu, 16 Jan 2020 23:28:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217335; bh=/nGz56sMA8caDTBApOsOknhSoqaPclZYldLAfPUelVs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fY+2gUB0jnQ7jRV3ric8AngJcsJzND/HPgLE1t6wESa6ChPaBcsaPIwes1WVCpGFf IpwwrchCvP94a1uDdfmx1XEvfTV5E13Iqol4MEHKTFgyGdLfOM3DH1HENAQX/kfQlb dB7quDUNMLU2gpxFh8JVs+gxVZX5h47rrR/vsQfc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuck Lever , Anna Schumaker Subject: [PATCH 4.19 41/84] xprtrdma: Fix completion wait during device removal Date: Fri, 17 Jan 2020 00:18:15 +0100 Message-Id: <20200116231718.603428265@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Chuck Lever commit 13cb886c591f341a8759f175292ddf978ef903a1 upstream. I've found that on occasion, "rmmod " will hang while if an NFS is under load. Ensure that ri_remove_done is initialized only just before the transport is woken up to force a close. This avoids the completion possibly getting initialized again while the CM event handler is waiting for a wake-up. Fixes: bebd031866ca ("xprtrdma: Support unplugging an HCA from under an NFS mount") Signed-off-by: Chuck Lever Signed-off-by: Anna Schumaker Signed-off-by: Greg Kroah-Hartman --- net/sunrpc/xprtrdma/verbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/sunrpc/xprtrdma/verbs.c +++ b/net/sunrpc/xprtrdma/verbs.c @@ -248,6 +248,7 @@ rpcrdma_conn_upcall(struct rdma_cm_id *i ia->ri_device->name, rpcrdma_addrstr(xprt), rpcrdma_portstr(xprt)); #endif + init_completion(&ia->ri_remove_done); set_bit(RPCRDMA_IAF_REMOVING, &ia->ri_flags); ep->rep_connected = -ENODEV; xprt_force_disconnect(&xprt->rx_xprt); @@ -306,7 +307,6 @@ rpcrdma_create_id(struct rpcrdma_xprt *x trace_xprtrdma_conn_start(xprt); init_completion(&ia->ri_done); - init_completion(&ia->ri_remove_done); id = rdma_create_id(xprt->rx_xprt.xprt_net, rpcrdma_conn_upcall, xprt, RDMA_PS_TCP, IB_QPT_RC); From patchwork Thu Jan 16 23:18:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233805 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 2EA34C33CB3 for ; Thu, 16 Jan 2020 23:29:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F41CC2075B for ; Thu, 16 Jan 2020 23:29:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217342; bh=0OrMHnukN32l1tTlce+BD7S8E7gNYvNKNM/0qoVDPS8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=MuYmr4Y6/eoZT5l0672DHjVyQJFqnsPE7GBIz9yQcOyCa2+PKBfGV/q01PhCVJoOY X0/s8qg5mssbE0QzR6ChMqyLVqkf5Or2k6pbh7J/kfyRUUpj9zO7aJ/uv6wcHLrgXO 4IjmPN2TAdC4dPjohq66BvwmArEYnbQuSZ5PcSjU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729632AbgAPX3A (ORCPT ); Thu, 16 Jan 2020 18:29:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:34156 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389637AbgAPX26 (ORCPT ); Thu, 16 Jan 2020 18:28:58 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 157FD20684; Thu, 16 Jan 2020 23:28:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217337; bh=0OrMHnukN32l1tTlce+BD7S8E7gNYvNKNM/0qoVDPS8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HSL6+w1KfxfhRHTlLGJ8Fua+xN/fDdY3yOEJeKqubQV/tLkTQM0fqEd4gA3UDu7U1 wnJUFWWhdpHFtXoUpz/9zPpBalYxvZRpu0QCcSRwPuorNh9Pt38somCPguZHxiL8dm 26LG4GTwA7Wn4tL+d4gkudAytpV3+4/Q0xL10UMY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Michael S. Tsirkin" , Jason Wang , Gonglei , virtualization@lists.linux-foundation.org, Ard Biesheuvel , Herbert Xu Subject: [PATCH 4.19 42/84] crypto: virtio - implement missing support for output IVs Date: Fri, 17 Jan 2020 00:18:16 +0100 Message-Id: <20200116231718.728089716@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Ard Biesheuvel commit 500e6807ce93b1fdc7d5b827c5cc167cc35630db upstream. In order to allow for CBC to be chained, which is something that the CTS template relies upon, implementations of CBC need to pass the IV to be used for subsequent invocations via the IV buffer. This was not implemented yet for virtio-crypto so implement it now. Fixes: dbaf0624ffa5 ("crypto: add virtio-crypto driver") Cc: "Michael S. Tsirkin" Cc: Jason Wang Cc: Gonglei Cc: virtualization@lists.linux-foundation.org Signed-off-by: Ard Biesheuvel Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- drivers/crypto/virtio/virtio_crypto_algs.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/drivers/crypto/virtio/virtio_crypto_algs.c +++ b/drivers/crypto/virtio/virtio_crypto_algs.c @@ -449,6 +449,11 @@ __virtio_crypto_ablkcipher_do_req(struct goto free; } memcpy(iv, req->info, ivsize); + if (!vc_sym_req->encrypt) + scatterwalk_map_and_copy(req->info, req->src, + req->nbytes - AES_BLOCK_SIZE, + AES_BLOCK_SIZE, 0); + sg_init_one(&iv_sg, iv, ivsize); sgs[num_out++] = &iv_sg; vc_sym_req->iv = iv; @@ -585,6 +590,10 @@ static void virtio_crypto_ablkcipher_fin struct ablkcipher_request *req, int err) { + if (vc_sym_req->encrypt) + scatterwalk_map_and_copy(req->info, req->dst, + req->nbytes - AES_BLOCK_SIZE, + AES_BLOCK_SIZE, 0); crypto_finalize_ablkcipher_request(vc_sym_req->base.dataq->engine, req, err); kzfree(vc_sym_req->iv); From patchwork Thu Jan 16 23:18:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233746 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 0B3ACC33CAF for ; Thu, 16 Jan 2020 23:38:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C85CF20661 for ; Thu, 16 Jan 2020 23:38:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217925; bh=+vvDOcRdhJp6OiqKi07LAjtkECQRNIemvqgQAgj+pz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=D4LkxYvuVSBOLYPrFNFDeS9m/DoUwEfSaKGS3I8ALNZApqPfS+KVCHwKoSAAqztFI CFwvVxU1qDdNJrfxgNXZsUKMUrbiCcWXd7WOEnzHIQk3ttnwG2h/nF0ftsWwcSiTVz r6Emrwo2UALGRrrefYkP1QotnXGmNBUO/QlldZoI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391205AbgAPX3D (ORCPT ); Thu, 16 Jan 2020 18:29:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:34344 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391035AbgAPX3C (ORCPT ); Thu, 16 Jan 2020 18:29:02 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E941920684; Thu, 16 Jan 2020 23:29:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217342; bh=+vvDOcRdhJp6OiqKi07LAjtkECQRNIemvqgQAgj+pz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hteXR38UXZIa5mpkxLhjL5m7atGwZxudclWxitjsXKXS7mHteMX/H9LFNtZxZrwUm PY/UryKR7mLJUGGvEk9i3m2YhgAobewJnONjBg+vjquv89Bs/is88CCs0Hr3gpnLuf ZJiZMZLx5b/EYNyDP0wEjiMFSissoNdbs7rlXSuE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust Subject: [PATCH 4.19 44/84] NFSv4.x: Drop the slot if nfs4_delegreturn_prepare waits for layoutreturn Date: Fri, 17 Jan 2020 00:18:18 +0100 Message-Id: <20200116231718.983518480@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Trond Myklebust commit 5326de9e94bedcf7366e7e7625d4deb8c1f1ca8a upstream. If nfs4_delegreturn_prepare needs to wait for a layoutreturn to complete then make sure we drop the sequence slot if we hold it. Fixes: 1c5bd76d17cc ("pNFS: Enable layoutreturn operation for return-on-close") Signed-off-by: Trond Myklebust Signed-off-by: Greg Kroah-Hartman --- fs/nfs/nfs4proc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -6103,8 +6103,10 @@ static void nfs4_delegreturn_prepare(str d_data = (struct nfs4_delegreturndata *)data; - if (!d_data->lr.roc && nfs4_wait_on_layoutreturn(d_data->inode, task)) + if (!d_data->lr.roc && nfs4_wait_on_layoutreturn(d_data->inode, task)) { + nfs4_sequence_done(task, &d_data->res.seq_res); return; + } lo = d_data->args.lr_args ? d_data->args.lr_args->layout : NULL; if (lo && !pnfs_layout_is_valid(lo)) { From patchwork Thu Jan 16 23:18:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233804 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 75A32C33CAF for ; Thu, 16 Jan 2020 23:29:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4216B20684 for ; Thu, 16 Jan 2020 23:29:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217353; bh=IqO6GUM5+oe/Wr6novD80hwQbjL+DQlazjx76R8wrGg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=NY5avYTuws1/jhXkH6cvi8JUcsObyRZNlAKO27RuQDfJB+wWtDiymbRwLEXA4rFpt au0waua76+KcJ5dlco806AzzoDXzvska99Yi9ks5wXopnGjzmrocxpL3Tn/HOH2nBN GL7/N8dFlb/fGeyIpL+UCYM3VCXfAJkYInAqLyxU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733276AbgAPX3M (ORCPT ); Thu, 16 Jan 2020 18:29:12 -0500 Received: from mail.kernel.org ([198.145.29.99]:34592 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391231AbgAPX3K (ORCPT ); Thu, 16 Jan 2020 18:29:10 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3626620684; Thu, 16 Jan 2020 23:29:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217349; bh=IqO6GUM5+oe/Wr6novD80hwQbjL+DQlazjx76R8wrGg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EEPKfTDXqf5DnxkMj9YQMphsSUF2re98NLbVjA8p/O3yrAT1j7iBUONI71IoKVLYy Wj1Llg45SHuIl9M5u2LIWv1HlA4F8Z0o5l9hZikaMZf64MlV6myNHWndm9CHLF1Ez7 87BLFGlw1FpfXITS4Br9uosvI7GXE2lGetitvZyY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marian Mihailescu , Sylwester Nawrocki Subject: [PATCH 4.19 47/84] clk: samsung: exynos5420: Preserve CPU clocks configuration during suspend/resume Date: Fri, 17 Jan 2020 00:18:21 +0100 Message-Id: <20200116231719.355968824@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Marian Mihailescu commit e21be0d1d7bd7f78a77613f6bcb6965e72b22fc1 upstream. Save and restore top PLL related configuration registers for big (APLL) and LITTLE (KPLL) cores during suspend/resume cycle. So far, CPU clocks were reset to default values after suspend/resume cycle and performance after system resume was affected when performance governor has been selected. Fixes: 773424326b51 ("clk: samsung: exynos5420: add more registers to restore list") Signed-off-by: Marian Mihailescu Signed-off-by: Sylwester Nawrocki Signed-off-by: Greg Kroah-Hartman --- drivers/clk/samsung/clk-exynos5420.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/clk/samsung/clk-exynos5420.c +++ b/drivers/clk/samsung/clk-exynos5420.c @@ -171,6 +171,8 @@ static const unsigned long exynos5x_clk_ GATE_BUS_CPU, GATE_SCLK_CPU, CLKOUT_CMU_CPU, + APLL_CON0, + KPLL_CON0, CPLL_CON0, DPLL_CON0, EPLL_CON0, From patchwork Thu Jan 16 23:18:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233748 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 DB88FC33CAF for ; Thu, 16 Jan 2020 23:38:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ACF9920748 for ; Thu, 16 Jan 2020 23:38:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217918; bh=zHD7mt4VoObRY4neNvHEq27BL84g2X3hkWMwzQYHW34=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=qNVjCi90WEAZeUlV3LDM+HOf+495bJ2XDPFo/Vo9UxjdIaK00LWdBWzqkwB2SqupY 1OqdXBkeG81p6HNN2pGymajciFX3JVKKtwQQj+57b/JmGQLYaIhCZiNMXw1S4TJyxX CY1z00MhSVkQSJgKVdCn0rP652HcX1JKPmupgL7E= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389830AbgAPX3W (ORCPT ); Thu, 16 Jan 2020 18:29:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:34862 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391256AbgAPX3U (ORCPT ); Thu, 16 Jan 2020 18:29:20 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EB96620684; Thu, 16 Jan 2020 23:29:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217359; bh=zHD7mt4VoObRY4neNvHEq27BL84g2X3hkWMwzQYHW34=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=USx5oAauixdOhgXQEGi0JERra6o9Og2LynvDHNr2Rj2QPy1JiYvbxEnD4PNwur66P kYUA21UHXwT4TH/UpxAsaMxGXboV8jf/o6L7yoc3cJ65r9VVxmf919kkOXSJsI74XF 0RyMjJyw4LMI+wXYbXD8VKlyRcAc582/IpzxrtGY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, linux-scsi@vger.kernel.org, "James E.J. Bottomley" , "Martin K. Petersen" , Arnd Bergmann Subject: [PATCH 4.19 50/84] scsi: sd: enable compat ioctls for sed-opal Date: Fri, 17 Jan 2020 00:18:24 +0100 Message-Id: <20200116231719.690181556@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Arnd Bergmann commit 142b2ac82e31c174936c5719fa12ae28f51a55b7 upstream. The sed_ioctl() function is written to be compatible between 32-bit and 64-bit processes, however compat mode is only wired up for nvme, not for sd. Add the missing call to sed_ioctl() in sd_compat_ioctl(). Fixes: d80210f25ff0 ("sd: add support for TCG OPAL self encrypting disks") Cc: linux-scsi@vger.kernel.org Cc: "James E.J. Bottomley" Cc: "Martin K. Petersen" Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/sd.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1685,20 +1685,30 @@ static void sd_rescan(struct device *dev static int sd_compat_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg) { - struct scsi_device *sdev = scsi_disk(bdev->bd_disk)->device; + struct gendisk *disk = bdev->bd_disk; + struct scsi_disk *sdkp = scsi_disk(disk); + struct scsi_device *sdev = sdkp->device; + void __user *p = compat_ptr(arg); int error; + error = scsi_verify_blk_ioctl(bdev, cmd); + if (error < 0) + return error; + error = scsi_ioctl_block_when_processing_errors(sdev, cmd, (mode & FMODE_NDELAY) != 0); if (error) return error; + + if (is_sed_ioctl(cmd)) + return sed_ioctl(sdkp->opal_dev, cmd, p); /* * Let the static ioctl translation table take care of it. */ if (!sdev->host->hostt->compat_ioctl) return -ENOIOCTLCMD; - return sdev->host->hostt->compat_ioctl(sdev, cmd, (void __user *)arg); + return sdev->host->hostt->compat_ioctl(sdev, cmd, p); } #endif From patchwork Thu Jan 16 23:18:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233749 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 B2660C33CAF for ; Thu, 16 Jan 2020 23:38:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 867E42073A for ; Thu, 16 Jan 2020 23:38:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217910; bh=zFbc9+S/ZEZazNWuHLHoKbSGQPRWWFbewUS9MAVVDD0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=E2PJUZCvzBw14dLWF/NR+1VW6kLEwttPjfcrAbjspzMAYxR9jCNeGWJmAu/STwxt5 eZ6GAl/wtmydmyZ8LXGpXCTrCzKTgEiIX04q3ObFd5QXepcLkUFeswXxzYSNG8ua6o tuKNhQwKi/StfHpod6odu19DrJX5ACfqOS5tj5bI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391272AbgAPXiY (ORCPT ); Thu, 16 Jan 2020 18:38:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:35018 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730156AbgAPX3Z (ORCPT ); Thu, 16 Jan 2020 18:29:25 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BB9482072E; Thu, 16 Jan 2020 23:29:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217364; bh=zFbc9+S/ZEZazNWuHLHoKbSGQPRWWFbewUS9MAVVDD0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2t2Dqs5p63unbBg93dscNo+lfWuWXPCaWAfje7i/Yr8wV3EyhC5jQvTwi7DOqiOLS a1l7TxOWW5Ogb7YJrIxanoBdKrPAsIxYfn0N242g1ryOZIfmhpDuzRxPD1VcW/yj5z 5EWcEeVcyCYdwel+zFd4yqI9/BcYOoH6sVkZHUjM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, netdev@vger.kernel.org, "David S. Miller" , Eric Dumazet , Arnd Bergmann Subject: [PATCH 4.19 52/84] af_unix: add compat_ioctl support Date: Fri, 17 Jan 2020 00:18:26 +0100 Message-Id: <20200116231719.946578178@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Arnd Bergmann commit 5f6beb9e0f633f3cc845cdd67973c506372931b4 upstream. The af_unix protocol family has a custom ioctl command (inexplicibly based on SIOCPROTOPRIVATE), but never had a compat_ioctl handler for 32-bit applications. Since all commands are compatible here, add a trivial wrapper that performs the compat_ptr() conversion for SIOCOUTQ/SIOCINQ. SIOCUNIXFILE does not use the argument, but it doesn't hurt to also use compat_ptr() here. Fixes: ba94f3088b79 ("unix: add ioctl to open a unix socket file with O_PATH") Cc: netdev@vger.kernel.org Cc: "David S. Miller" Cc: Eric Dumazet Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- net/unix/af_unix.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -649,6 +649,9 @@ static __poll_t unix_poll(struct file *, static __poll_t unix_dgram_poll(struct file *, struct socket *, poll_table *); static int unix_ioctl(struct socket *, unsigned int, unsigned long); +#ifdef CONFIG_COMPAT +static int unix_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); +#endif static int unix_shutdown(struct socket *, int); static int unix_stream_sendmsg(struct socket *, struct msghdr *, size_t); static int unix_stream_recvmsg(struct socket *, struct msghdr *, size_t, int); @@ -690,6 +693,9 @@ static const struct proto_ops unix_strea .getname = unix_getname, .poll = unix_poll, .ioctl = unix_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = unix_compat_ioctl, +#endif .listen = unix_listen, .shutdown = unix_shutdown, .setsockopt = sock_no_setsockopt, @@ -713,6 +719,9 @@ static const struct proto_ops unix_dgram .getname = unix_getname, .poll = unix_dgram_poll, .ioctl = unix_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = unix_compat_ioctl, +#endif .listen = sock_no_listen, .shutdown = unix_shutdown, .setsockopt = sock_no_setsockopt, @@ -735,6 +744,9 @@ static const struct proto_ops unix_seqpa .getname = unix_getname, .poll = unix_dgram_poll, .ioctl = unix_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = unix_compat_ioctl, +#endif .listen = unix_listen, .shutdown = unix_shutdown, .setsockopt = sock_no_setsockopt, @@ -2646,6 +2658,13 @@ static int unix_ioctl(struct socket *soc return err; } +#ifdef CONFIG_COMPAT +static int unix_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) +{ + return unix_ioctl(sock, cmd, (unsigned long)compat_ptr(arg)); +} +#endif + static __poll_t unix_poll(struct file *file, struct socket *sock, poll_table *wait) { struct sock *sk = sock->sk; From patchwork Thu Jan 16 23:18:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233750 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 905F1C33CAF for ; Thu, 16 Jan 2020 23:38:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6446E20748 for ; Thu, 16 Jan 2020 23:38:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217900; bh=CS1XRDACWBXXeycLKvho87XDFgutnA8XGJnE6lEdYBg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Ywzkw656EuFz00SNPgxgmgPx1eplptR6HC+WZ6F2BKpTwXFCLGS96uqxT9/QEHdIF DxGoDVUIL9xME3jWO8TFwJn0fGOv5rAOhFxsr28M5JhXOYBHkNr0lAlAHbYS2KQ3vo IpTSRMawzkYQZcdUZxfluenLca2HF9UQhjBtjZ7E= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403877AbgAPXiT (ORCPT ); Thu, 16 Jan 2020 18:38:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:35198 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391272AbgAPX33 (ORCPT ); Thu, 16 Jan 2020 18:29:29 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AA60F2082F; Thu, 16 Jan 2020 23:29:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217369; bh=CS1XRDACWBXXeycLKvho87XDFgutnA8XGJnE6lEdYBg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NhyNopf76GBSL2K6yTZbdxGtQTFKI/5gA61g81YuIysvqLOy8yOcUJFBkG0/Jhske INuFNZoa7AK4fdAMk37LKShvzQ1iLv2WcZqM6ICrGtM/OTHXw1sgjGeMmBy/kzQDVd aSila0Byoe9YZKxQiTmcL5SNWO5ENJz+y+0Wnfnc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bjorn Andersson , Niklas Cassel , Lorenzo Pieralisi , Andrew Murray , Gustavo Pimentel Subject: [PATCH 4.19 54/84] PCI: dwc: Fix find_next_bit() usage Date: Fri, 17 Jan 2020 00:18:28 +0100 Message-Id: <20200116231720.175036407@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Niklas Cassel commit 1137e61dcb99f7f8b54e77ed83f68b5b485a3e34 upstream. find_next_bit() takes a parameter of size long, and performs arithmetic that assumes that the argument is of size long. Therefore we cannot pass a u32, since this will cause find_next_bit() to read outside the stack buffer and will produce the following print: BUG: KASAN: stack-out-of-bounds in find_next_bit+0x38/0xb0 Fixes: 1b497e6493c4 ("PCI: dwc: Fix uninitialized variable in dw_handle_msi_irq()") Tested-by: Bjorn Andersson Signed-off-by: Niklas Cassel Signed-off-by: Lorenzo Pieralisi Reviewed-by: Andrew Murray Acked-by: Gustavo Pimentel Signed-off-by: Greg Kroah-Hartman --- drivers/pci/controller/dwc/pcie-designware-host.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -78,7 +78,8 @@ static struct msi_domain_info dw_pcie_ms irqreturn_t dw_handle_msi_irq(struct pcie_port *pp) { int i, pos, irq; - u32 val, num_ctrls; + unsigned long val; + u32 status, num_ctrls; irqreturn_t ret = IRQ_NONE; num_ctrls = pp->num_vectors / MAX_MSI_IRQS_PER_CTRL; @@ -86,14 +87,14 @@ irqreturn_t dw_handle_msi_irq(struct pci for (i = 0; i < num_ctrls; i++) { dw_pcie_rd_own_conf(pp, PCIE_MSI_INTR0_STATUS + (i * MSI_REG_CTRL_BLOCK_SIZE), - 4, &val); - if (!val) + 4, &status); + if (!status) continue; ret = IRQ_HANDLED; + val = status; pos = 0; - while ((pos = find_next_bit((unsigned long *) &val, - MAX_MSI_IRQS_PER_CTRL, + while ((pos = find_next_bit(&val, MAX_MSI_IRQS_PER_CTRL, pos)) != MAX_MSI_IRQS_PER_CTRL) { irq = irq_find_mapping(pp->irq_domain, (i * MAX_MSI_IRQS_PER_CTRL) + From patchwork Thu Jan 16 23:18:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233803 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 B8D69C33CAF for ; Thu, 16 Jan 2020 23:29:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7E8CA2072E for ; Thu, 16 Jan 2020 23:29:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217377; bh=prQ0q8gvC79NNbn3+0ntZWUuhxJax8zUKx2jk+josZQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=vvbvi+xj0Hc2PdOaie+YV05VT+IfzkJO4B2lPDNtiLJXAMRaGedASgekKxuOPb8wy vHNWyimJifHet5tNaTLGarGwL2ncC1V6xzTm4Onuu0npGBWFIKi5RnCExK8uU4Bvj1 nMbdL3hZelWcYhvwOTWaTm6B5l+o1fCWgSGSY2QM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391297AbgAPX3e (ORCPT ); Thu, 16 Jan 2020 18:29:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:35288 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391266AbgAPX3d (ORCPT ); Thu, 16 Jan 2020 18:29:33 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2B5A52072E; Thu, 16 Jan 2020 23:29:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217371; bh=prQ0q8gvC79NNbn3+0ntZWUuhxJax8zUKx2jk+josZQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LQuEJ69zGQQRfCgGhFb71LvejpxQj5CucYwLS7KVPL4qvGmVXTmm2xBCHAOMsaBbN m4hH7PbBageI/m44KCn2a6BD3mZK5mU34Y85ep5vIKVhEzZfz+T9aExf+u4ViX+JFN ooARh2m7KVTvzJnW9ehtxhuMuACa9/6SCvhxlUsc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bjorn Helgaas , Andrew Murray , Jonathan Yong Subject: [PATCH 4.19 55/84] PCI/PTM: Remove spurious "d" from granularity message Date: Fri, 17 Jan 2020 00:18:29 +0100 Message-Id: <20200116231720.275767106@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Bjorn Helgaas commit 127a7709495db52a41012deaebbb7afc231dad91 upstream. The granularity message has an extra "d": pci 0000:02:00.0: PTM enabled, 4dns granularity Remove the "d" so the message is simply "PTM enabled, 4ns granularity". Fixes: 8b2ec318eece ("PCI: Add PTM clock granularity information") Link: https://lore.kernel.org/r/20191106222420.10216-2-helgaas@kernel.org Signed-off-by: Bjorn Helgaas Reviewed-by: Andrew Murray Cc: Jonathan Yong Signed-off-by: Greg Kroah-Hartman --- drivers/pci/pcie/ptm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/pci/pcie/ptm.c +++ b/drivers/pci/pcie/ptm.c @@ -21,7 +21,7 @@ static void pci_ptm_info(struct pci_dev snprintf(clock_desc, sizeof(clock_desc), ">254ns"); break; default: - snprintf(clock_desc, sizeof(clock_desc), "%udns", + snprintf(clock_desc, sizeof(clock_desc), "%uns", dev->ptm_granularity); break; } From patchwork Thu Jan 16 23:18:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233760 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 63DE0C33CB3 for ; Thu, 16 Jan 2020 23:37:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2F7182072E for ; Thu, 16 Jan 2020 23:37:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217840; bh=iXjNYfPsujbaV8I/FUUKm6HN4IOhTK91Z7tHbR3EyTc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=FhqmyHrFakq3KLvISz4VaA/IbogMrexQOjplWCFIdadV668FheCDpiovJ5ldnX+y2 BQISwH1iyk3ul9PJzdcfTqxNPlaqQLda59SL/YO8Xt63JjkSti6wyuWarI1lPtCzW1 FFhDFbHDy6ozXcqYDMhId06CnXewxSRJtJS2rBjw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391460AbgAPXbD (ORCPT ); Thu, 16 Jan 2020 18:31:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:38668 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391087AbgAPXbC (ORCPT ); Thu, 16 Jan 2020 18:31:02 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C88D720661; Thu, 16 Jan 2020 23:31:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217461; bh=iXjNYfPsujbaV8I/FUUKm6HN4IOhTK91Z7tHbR3EyTc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wOIiM7t78T9RFPJgr1skg8GZhsFrCEQoOAB4Buqku4IZAZmo0KDF0zoKGD+4XYzMc dCKdCXgfqtg7aRJPVulM7lYMqt042Hlo3KSPGp63iclUwFNhlYwsT6/sKyVATUd2IC bs4L9TYSzlGbC6EGQ88DlXXkxNbM68rUHfrbOm/0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peng Fan Subject: [PATCH 4.19 57/84] tty: serial: imx: use the sg count from dma_map_sg Date: Fri, 17 Jan 2020 00:18:31 +0100 Message-Id: <20200116231720.490934190@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Peng Fan commit 596fd8dffb745afcebc0ec6968e17fe29f02044c upstream. The dmaengine_prep_slave_sg needs to use sg count returned by dma_map_sg, not use sport->dma_tx_nents, because the return value of dma_map_sg is not always same with "nents". Fixes: b4cdc8f61beb ("serial: imx: add DMA support for imx6q") Signed-off-by: Peng Fan Link: https://lore.kernel.org/r/1573108875-26530-1-git-send-email-peng.fan@nxp.com Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/imx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -624,7 +624,7 @@ static void imx_uart_dma_tx(struct imx_p dev_err(dev, "DMA mapping error for TX.\n"); return; } - desc = dmaengine_prep_slave_sg(chan, sgl, sport->dma_tx_nents, + desc = dmaengine_prep_slave_sg(chan, sgl, ret, DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT); if (!desc) { dma_unmap_sg(dev, sgl, sport->dma_tx_nents, From patchwork Thu Jan 16 23:18:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233753 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 A0278C33CAF for ; Thu, 16 Jan 2020 23:38:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 73FFB2073A for ; Thu, 16 Jan 2020 23:38:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217886; bh=VohqL72ye30HD11diAwJbn0CodlwueOSD4EQKGbCZt4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=tSGBtT2EO4Lt7XmrY64qxXG2alZdahAR/lafkZMjp7OjOX2Y+xhidZXCM6cWT0kW0 zy3VDK1q+4Gj2ucSP5Bf4ns4mIsr4JyrbT2RR4DtQ8EkQ+9KFI1oLAEAH7/z+Ufy1R 8x/MYzbtkwE44tsn/4W35hHg3Z4bYnislk/Ddyvs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391684AbgAPXiC (ORCPT ); Thu, 16 Jan 2020 18:38:02 -0500 Received: from mail.kernel.org ([198.145.29.99]:36172 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391379AbgAPX34 (ORCPT ); Thu, 16 Jan 2020 18:29:56 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7CE4C206D9; Thu, 16 Jan 2020 23:29:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217396; bh=VohqL72ye30HD11diAwJbn0CodlwueOSD4EQKGbCZt4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EdHk33mU+W7BJ2CdRB0/XE6AjucQ1u2FBnZHwv69svGxgYdwKc66skLwPh3tKF8tS HE2toVdxDH04IUhyFAoclG5namI838Q5YUeyeYV3n15zIzS1tA3YLI1rneQP2VciRD tp7TtdXTwioEvHL33BCo0FCz+553mCuLWLGDk+xA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peng Fan Subject: [PATCH 4.19 58/84] tty: serial: pch_uart: correct usage of dma_unmap_sg Date: Fri, 17 Jan 2020 00:18:32 +0100 Message-Id: <20200116231720.590211332@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Peng Fan commit 74887542fdcc92ad06a48c0cca17cdf09fc8aa00 upstream. Per Documentation/DMA-API-HOWTO.txt, To unmap a scatterlist, just call: dma_unmap_sg(dev, sglist, nents, direction); .. note:: The 'nents' argument to the dma_unmap_sg call must be the _same_ one you passed into the dma_map_sg call, it should _NOT_ be the 'count' value _returned_ from the dma_map_sg call. However in the driver, priv->nent is directly assigned with value returned from dma_map_sg, and dma_unmap_sg use priv->nent for unmap, this breaks the API usage. So introduce a new entry orig_nent to remember 'nents'. Fixes: da3564ee027e ("pch_uart: add multi-scatter processing") Signed-off-by: Peng Fan Link: https://lore.kernel.org/r/1573623259-6339-1-git-send-email-peng.fan@nxp.com Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/pch_uart.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/drivers/tty/serial/pch_uart.c +++ b/drivers/tty/serial/pch_uart.c @@ -235,6 +235,7 @@ struct eg20t_port { struct dma_chan *chan_rx; struct scatterlist *sg_tx_p; int nent; + int orig_nent; struct scatterlist sg_rx; int tx_dma_use; void *rx_buf_virt; @@ -789,9 +790,10 @@ static void pch_dma_tx_complete(void *ar } xmit->tail &= UART_XMIT_SIZE - 1; async_tx_ack(priv->desc_tx); - dma_unmap_sg(port->dev, sg, priv->nent, DMA_TO_DEVICE); + dma_unmap_sg(port->dev, sg, priv->orig_nent, DMA_TO_DEVICE); priv->tx_dma_use = 0; priv->nent = 0; + priv->orig_nent = 0; kfree(priv->sg_tx_p); pch_uart_hal_enable_interrupt(priv, PCH_UART_HAL_TX_INT); } @@ -1015,6 +1017,7 @@ static unsigned int dma_handle_tx(struct dev_err(priv->port.dev, "%s:dma_map_sg Failed\n", __func__); return 0; } + priv->orig_nent = num; priv->nent = nent; for (i = 0; i < nent; i++, sg++) { From patchwork Thu Jan 16 23:18:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233798 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 501BBC33CAF for ; Thu, 16 Jan 2020 23:30:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 202DD206D9 for ; Thu, 16 Jan 2020 23:30:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217438; bh=POtcQZukDa4ON6a4yKVTu2ZMOXl8kr2LgtdiFXwapgY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=e8K/dE2KI3SRpvnDPV76Om0qM9Z5soRhbqE/MU+//k8jyxmGkhYk/hrKpOsMjuGr0 OslWGH2cXYK6pdYKlIAQuZVg2EGqOKv1DsgYi6cEK7gUSyFxd5lpCnJN6bge5HQKC9 ML1WAUxnJXVXGW1Phrdz307lZgTd83vdMKfZ7wjI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403873AbgAPXaY (ORCPT ); Thu, 16 Jan 2020 18:30:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:37134 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403863AbgAPXaX (ORCPT ); Thu, 16 Jan 2020 18:30:23 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EA60D21582; Thu, 16 Jan 2020 23:30:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217422; bh=POtcQZukDa4ON6a4yKVTu2ZMOXl8kr2LgtdiFXwapgY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HG+PSf8Zd15pMKQDzgSDcnnNNqB7qz4V5idgUwJ+NhjMjoCGmOmnY3xvyV0VDR/cV hRUyNzspgLSe2bk575SVE2i8vvvX5PPiwK6ZMNfjwb7EiMlOJjqq1453sc65O2oMBR oLJyDPed2hjR4zoiBYQ1g7o9HNsbR9f0SL05r/FY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Janusz Krzysztofik , Sakari Ailus , Mauro Carvalho Chehab Subject: [PATCH 4.19 59/84] media: ov6650: Fix incorrect use of JPEG colorspace Date: Fri, 17 Jan 2020 00:18:33 +0100 Message-Id: <20200116231720.687606474@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Janusz Krzysztofik commit 12500731895ef09afc5b66b86b76c0884fb9c7bf upstream. Since its initial submission, the driver selects V4L2_COLORSPACE_JPEG for supported formats other than V4L2_MBUS_FMT_SBGGR8_1X8. According to v4l2-compliance test program, V4L2_COLORSPACE_JPEG applies exclusively to V4L2_PIX_FMT_JPEG. Since the sensor does not support JPEG format, fix it to always select V4L2_COLORSPACE_SRGB. Fixes: 2f6e2404799a ("[media] SoC Camera: add driver for OV6650 sensor") Signed-off-by: Janusz Krzysztofik Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/media/i2c/ov6650.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) --- a/drivers/media/i2c/ov6650.c +++ b/drivers/media/i2c/ov6650.c @@ -203,7 +203,6 @@ struct ov6650 { unsigned long pclk_max; /* from resolution and format */ struct v4l2_fract tpf; /* as requested with s_frame_interval */ u32 code; - enum v4l2_colorspace colorspace; }; @@ -520,7 +519,7 @@ static int ov6650_get_fmt(struct v4l2_su mf->width = priv->rect.width >> priv->half_scale; mf->height = priv->rect.height >> priv->half_scale; mf->code = priv->code; - mf->colorspace = priv->colorspace; + mf->colorspace = V4L2_COLORSPACE_SRGB; mf->field = V4L2_FIELD_NONE; return 0; @@ -627,11 +626,6 @@ static int ov6650_s_fmt(struct v4l2_subd priv->pclk_max = 8000000; } - if (code == MEDIA_BUS_FMT_SBGGR8_1X8) - priv->colorspace = V4L2_COLORSPACE_SRGB; - else if (code != 0) - priv->colorspace = V4L2_COLORSPACE_JPEG; - if (half_scale) { dev_dbg(&client->dev, "max resolution: QCIF\n"); coma_set |= COMA_QCIF; @@ -666,7 +660,6 @@ static int ov6650_s_fmt(struct v4l2_subd priv->code = code; if (!ret) { - mf->colorspace = priv->colorspace; mf->width = priv->rect.width >> half_scale; mf->height = priv->rect.height >> half_scale; } @@ -689,6 +682,7 @@ static int ov6650_set_fmt(struct v4l2_su &mf->height, 2, H_CIF, 1, 0); mf->field = V4L2_FIELD_NONE; + mf->colorspace = V4L2_COLORSPACE_SRGB; switch (mf->code) { case MEDIA_BUS_FMT_Y10_1X10: @@ -699,13 +693,11 @@ static int ov6650_set_fmt(struct v4l2_su case MEDIA_BUS_FMT_YUYV8_2X8: case MEDIA_BUS_FMT_VYUY8_2X8: case MEDIA_BUS_FMT_UYVY8_2X8: - mf->colorspace = V4L2_COLORSPACE_JPEG; break; default: mf->code = MEDIA_BUS_FMT_SBGGR8_1X8; /* fall through */ case MEDIA_BUS_FMT_SBGGR8_1X8: - mf->colorspace = V4L2_COLORSPACE_SRGB; break; } @@ -1006,7 +998,6 @@ static int ov6650_probe(struct i2c_clien priv->rect.height = H_CIF; priv->half_scale = false; priv->code = MEDIA_BUS_FMT_YUYV8_2X8; - priv->colorspace = V4L2_COLORSPACE_JPEG; ret = ov6650_video_probe(client); if (ret) From patchwork Thu Jan 16 23:18:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233756 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 F2B2CC33CAF for ; Thu, 16 Jan 2020 23:37:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C207120661 for ; Thu, 16 Jan 2020 23:37:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217869; bh=5KDrKj1M5O3zZvLmsVdi7oVZ6QM5dpT4Ve2OnYrKyCM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=CorZ7hKANkJmNL/WYyeskqumh/fV8eS+Ad8cm5SoYRlOGFs1AXkoFqdVmfAOxtVTy cZgHOYOhHRQKq8OWEyc4vcUxHDjgy1vixOgkyessIDTq4h4woNQSVZ7pagyjxFI4Sj R+4GagrWxPsS0zGMi7fnZnzlasbY2+6yqTOm1z2U= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404539AbgAPXhl (ORCPT ); Thu, 16 Jan 2020 18:37:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:38022 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404167AbgAPXap (ORCPT ); Thu, 16 Jan 2020 18:30:45 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C6B2520661; Thu, 16 Jan 2020 23:30:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217444; bh=5KDrKj1M5O3zZvLmsVdi7oVZ6QM5dpT4Ve2OnYrKyCM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HVPKpkNFbTqtiX48r/7FJN7kxndlIKOnX37P023baeKxDna174jRWe2M/6GGX6R36 8tP3IihG2vt9jKopY7ud8Wn/+WLyzQpASFWWPfzqpEaEcJ3EhL5do9zHZEPZih1LFw 0EZoZ0RK3o/Rj7D9fIQSj9efyjrqk5ZFFm3x+M84= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Janusz Krzysztofik , Sakari Ailus , Mauro Carvalho Chehab Subject: [PATCH 4.19 60/84] media: ov6650: Fix some format attributes not under control Date: Fri, 17 Jan 2020 00:18:34 +0100 Message-Id: <20200116231720.781108135@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Janusz Krzysztofik commit 1c6a2b63095154bbf9e8f38d79487a728331bf65 upstream. User arguments passed to .get/set_fmt() pad operation callbacks may contain unsupported values. The driver takes control over frame size and pixel code as well as colorspace and field attributes but has never cared for remainig format attributes, i.e., ycbcr_enc, quantization and xfer_func, introduced by commit 11ff030c7365 ("[media] v4l2-mediabus: improve colorspace support"). Fix it. Set up a static v4l2_mbus_framefmt structure with attributes initialized to reasonable defaults and use it for updating content of user provided arguments. In case of V4L2_SUBDEV_FORMAT_ACTIVE, postpone frame size update, now performed from inside ov6650_s_fmt() helper, util the user argument is first updated in ov6650_set_fmt() with default frame format content. For V4L2_SUBDEV_FORMAT_TRY, don't copy all attributes to pad config, only those handled by the driver, then fill the response with the default frame format updated with resulting pad config format code and frame size. Fixes: 11ff030c7365 ("[media] v4l2-mediabus: improve colorspace support") Signed-off-by: Janusz Krzysztofik Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/media/i2c/ov6650.c | 51 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 12 deletions(-) --- a/drivers/media/i2c/ov6650.c +++ b/drivers/media/i2c/ov6650.c @@ -215,6 +215,17 @@ static u32 ov6650_codes[] = { MEDIA_BUS_FMT_Y8_1X8, }; +static const struct v4l2_mbus_framefmt ov6650_def_fmt = { + .width = W_CIF, + .height = H_CIF, + .code = MEDIA_BUS_FMT_SBGGR8_1X8, + .colorspace = V4L2_COLORSPACE_SRGB, + .field = V4L2_FIELD_NONE, + .ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT, + .quantization = V4L2_QUANTIZATION_DEFAULT, + .xfer_func = V4L2_XFER_FUNC_DEFAULT, +}; + /* read a register */ static int ov6650_reg_read(struct i2c_client *client, u8 reg, u8 *val) { @@ -516,11 +527,13 @@ static int ov6650_get_fmt(struct v4l2_su if (format->pad) return -EINVAL; + /* initialize response with default media bus frame format */ + *mf = ov6650_def_fmt; + + /* update media bus format code and frame size */ mf->width = priv->rect.width >> priv->half_scale; mf->height = priv->rect.height >> priv->half_scale; mf->code = priv->code; - mf->colorspace = V4L2_COLORSPACE_SRGB; - mf->field = V4L2_FIELD_NONE; return 0; } @@ -659,10 +672,6 @@ static int ov6650_s_fmt(struct v4l2_subd if (!ret) priv->code = code; - if (!ret) { - mf->width = priv->rect.width >> half_scale; - mf->height = priv->rect.height >> half_scale; - } return ret; } @@ -681,9 +690,6 @@ static int ov6650_set_fmt(struct v4l2_su v4l_bound_align_image(&mf->width, 2, W_CIF, 1, &mf->height, 2, H_CIF, 1, 0); - mf->field = V4L2_FIELD_NONE; - mf->colorspace = V4L2_COLORSPACE_SRGB; - switch (mf->code) { case MEDIA_BUS_FMT_Y10_1X10: mf->code = MEDIA_BUS_FMT_Y8_1X8; @@ -701,10 +707,31 @@ static int ov6650_set_fmt(struct v4l2_su break; } - if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE) - return ov6650_s_fmt(sd, mf); - cfg->try_fmt = *mf; + if (format->which == V4L2_SUBDEV_FORMAT_TRY) { + /* store media bus format code and frame size in pad config */ + cfg->try_fmt.width = mf->width; + cfg->try_fmt.height = mf->height; + cfg->try_fmt.code = mf->code; + + /* return default mbus frame format updated with pad config */ + *mf = ov6650_def_fmt; + mf->width = cfg->try_fmt.width; + mf->height = cfg->try_fmt.height; + mf->code = cfg->try_fmt.code; + + } else { + /* apply new media bus format code and frame size */ + int ret = ov6650_s_fmt(sd, mf); + if (ret) + return ret; + + /* return default format updated with active size and code */ + *mf = ov6650_def_fmt; + mf->width = priv->rect.width >> priv->half_scale; + mf->height = priv->rect.height >> priv->half_scale; + mf->code = priv->code; + } return 0; } From patchwork Thu Jan 16 23:18:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233796 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 BA597C33CAF for ; Thu, 16 Jan 2020 23:30:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8C98E2073A for ; Thu, 16 Jan 2020 23:30:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217449; bh=qU0crJkjUsiWg2s1LzViuusnKuh8XR8514gpeOXXGK8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Erq/jjQ0uyBqfS0oAiCfHbG2laryRRARwfeVoX/lnepxQV+SLh+EwiAMZ6ybz2wC7 Gw3esMjetxNuH40TzP8nSzw+nWPUUbwKOsCHiJYaFkR5q5lRLsLC6sCGoAyZdIfrtX uaDgz7+iQANmp7T6ybB/dYNRtjQFDY6jKJk+GNsI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391413AbgAPXas (ORCPT ); Thu, 16 Jan 2020 18:30:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:38126 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391409AbgAPXar (ORCPT ); Thu, 16 Jan 2020 18:30:47 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3EBCE2073A; Thu, 16 Jan 2020 23:30:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217446; bh=qU0crJkjUsiWg2s1LzViuusnKuh8XR8514gpeOXXGK8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LkS7w93chAj0r2LH4UFnkxGPGC4Qlkdf7Vte4RUtOd9wZvGt4QmTpsm90XmjiRZ/P rFO7U1pc9sDwM/3buUXHp1KyYCS1Up6t6tJy5ru3ivqEoI4UcD9ouRqxmMkhviErV/ J8lzZpPmFUFmpJtnaiL6UDczHrw4uuDHDpc8jkHw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Janusz Krzysztofik , Sakari Ailus , Mauro Carvalho Chehab Subject: [PATCH 4.19 61/84] media: ov6650: Fix .get_fmt() V4L2_SUBDEV_FORMAT_TRY support Date: Fri, 17 Jan 2020 00:18:35 +0100 Message-Id: <20200116231720.884020396@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Janusz Krzysztofik commit 39034bb0c26b76a2c3abc54aa28c185f18b40c2f upstream. Commit da298c6d98d5 ("[media] v4l2: replace video op g_mbus_fmt by pad op get_fmt") converted a former ov6650_g_fmt() video operation callback to an ov6650_get_fmt() pad operation callback. However, the converted function disregards a format->which flag that pad operations should obey and always returns active frame format settings. That can be fixed by always responding to V4L2_SUBDEV_FORMAT_TRY with -EINVAL, or providing the response from a pad config argument, likely updated by a former user call to V4L2_SUBDEV_FORMAT_TRY .set_fmt(). Since implementation of the latter is trivial, go for it. Fixes: da298c6d98d5 ("[media] v4l2: replace video op g_mbus_fmt by pad op get_fmt") Signed-off-by: Janusz Krzysztofik Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/media/i2c/ov6650.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) --- a/drivers/media/i2c/ov6650.c +++ b/drivers/media/i2c/ov6650.c @@ -531,10 +531,16 @@ static int ov6650_get_fmt(struct v4l2_su *mf = ov6650_def_fmt; /* update media bus format code and frame size */ - mf->width = priv->rect.width >> priv->half_scale; - mf->height = priv->rect.height >> priv->half_scale; - mf->code = priv->code; + if (format->which == V4L2_SUBDEV_FORMAT_TRY) { + mf->width = cfg->try_fmt.width; + mf->height = cfg->try_fmt.height; + mf->code = cfg->try_fmt.code; + } else { + mf->width = priv->rect.width >> priv->half_scale; + mf->height = priv->rect.height >> priv->half_scale; + mf->code = priv->code; + } return 0; } From patchwork Thu Jan 16 23:18:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233758 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 BB0ACC33CB3 for ; Thu, 16 Jan 2020 23:37:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 904D020748 for ; Thu, 16 Jan 2020 23:37:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217853; bh=CzXFhGf1ZajCXWtNKPJugt7XNNQ9VS0dodzo8nUu4fA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=qxcGxx4Wlj7b74B7dQvladGedGoSXlU+gvPQwjzVU28RyRiH0VaWFmU2Zr87czPAt zPO8f7PAUzSv0b6HIQT1O6mRGz2R84HX1iHdvfCvZj4aKc228UfHEalc4Du2UgMjXS KoK5BDFwCOby3x/ZcHTn47grtRpZXur08OcypTPE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391424AbgAPXax (ORCPT ); Thu, 16 Jan 2020 18:30:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:38192 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391415AbgAPXau (ORCPT ); Thu, 16 Jan 2020 18:30:50 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A32FC20661; Thu, 16 Jan 2020 23:30:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217449; bh=CzXFhGf1ZajCXWtNKPJugt7XNNQ9VS0dodzo8nUu4fA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w3SCKomVsJ11L3+yXMV94nlFQy7SeXVLTa8L+s05qEn6t2WpIoN6i8Q7T+Cpz4s2Y L+6YcFa32zSmvydO3g+o38OPJWaChg6KqkwVckI+mBOTG55vkfDyut8dFZ2FSfeveA 0is+2quIZD12j/DCTUTOXS682tX295qcIr0A3hME= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kieran Bingham , =?utf-8?q?Niklas_S=C3=B6de?= =?utf-8?q?rlund?= , Laurent Pinchart , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 4.19 62/84] media: rcar-vin: Fix incorrect return statement in rvin_try_format() Date: Fri, 17 Jan 2020 00:18:36 +0100 Message-Id: <20200116231720.985507322@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Niklas Söderlund commit a0862a40364e2f87109317e31c51c9d7bc89e33f upstream. While refactoring code the return statement became corrupted, fix it by returning the correct return code. Reported-by: Kieran Bingham Fixes: 897e371389e77514 ("media: rcar-vin: simplify how formats are set and reset" Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/media/platform/rcar-vin/rcar-v4l2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -196,6 +196,7 @@ static int rvin_try_format(struct rvin_d ret = v4l2_subdev_call(sd, pad, set_fmt, pad_cfg, &format); if (ret < 0 && ret != -ENOIOCTLCMD) goto done; + ret = 0; v4l2_fill_pix_format(pix, &format.format); @@ -230,7 +231,7 @@ static int rvin_try_format(struct rvin_d done: v4l2_subdev_free_pad_config(pad_cfg); - return 0; + return ret; } static int rvin_querycap(struct file *file, void *priv, From patchwork Thu Jan 16 23:18:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233759 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 A53AEC33CAF for ; Thu, 16 Jan 2020 23:37:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6C30D2081E for ; Thu, 16 Jan 2020 23:37:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217841; bh=lBs3M/eBQtkKAyTVaibiBB5vy5u2wHu0dqS51LQrUZE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=nGlIwBlBMDPg+AWZUY85Ea0aDiQFKkhdFyjJvwr4AptuVftXnftrbFWoEbPfzotmk kPfwKw2PJgpIc03ruNgqUZx16p7l+1NOVx11a2RbWCz6CkAF2y7oyUM4PElfA28Vvb XxS7Tq4qCAYnKB/Xln5Ej0mkXafQCi0wW9HFo2nY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391454AbgAPXbC (ORCPT ); Thu, 16 Jan 2020 18:31:02 -0500 Received: from mail.kernel.org ([198.145.29.99]:38490 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391446AbgAPXa5 (ORCPT ); Thu, 16 Jan 2020 18:30:57 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 03A642072E; Thu, 16 Jan 2020 23:30:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217456; bh=lBs3M/eBQtkKAyTVaibiBB5vy5u2wHu0dqS51LQrUZE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c57CERprLlbjFvFPEpJiQ+kASWSVkVPC+TJuyumNZc0jQ9MD4kq671T3nq9knM10V YY5xNO+TEKCyahSdYeCsKMmG9O2UabasVTGcI2ZIEpFMVak+BbbO4wCEtL/ayljZEe Wzzt2IEAQoU4KYNFKABX4hXRu7sdfWP5b7Cyzeec= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yong Wu , Robin Murphy , Joerg Roedel Subject: [PATCH 4.19 65/84] iommu/mediatek: Correct the flush_iotlb_all callback Date: Fri, 17 Jan 2020 00:18:39 +0100 Message-Id: <20200116231721.261515162@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Yong Wu commit 2009122f1d83dd8375572661961eab1e7e86bffe upstream. Use the correct tlb_flush_all instead of the original one. Fixes: 4d689b619445 ("iommu/io-pgtable-arm-v7s: Convert to IOMMU API TLB sync") Signed-off-by: Yong Wu Reviewed-by: Robin Murphy Signed-off-by: Joerg Roedel Signed-off-by: Greg Kroah-Hartman --- drivers/iommu/mtk_iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -394,7 +394,7 @@ static size_t mtk_iommu_unmap(struct iom static void mtk_iommu_iotlb_sync(struct iommu_domain *domain) { - mtk_iommu_tlb_sync(mtk_iommu_get_m4u_data()); + mtk_iommu_tlb_flush_all(mtk_iommu_get_m4u_data()); } static phys_addr_t mtk_iommu_iova_to_phys(struct iommu_domain *domain, From patchwork Thu Jan 16 23:18:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233800 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 15385C33CAF for ; Thu, 16 Jan 2020 23:30:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D7A172072E for ; Thu, 16 Jan 2020 23:30:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217403; bh=QylFq5XFvl0jRh43q85g/TCPfAigdwqScWo9ariAJGg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=YQRtFKsuAi+50GAJ/tLcDj5yjWUNV7s06Yx32HM5k/A3SnLK75HFgycsEVyPxV8V4 vnkb+Zoy5rcWtqNRM8zVdRHjbGgHIkSyVK/tZmr/60qZPvza0jweBobFUfnzxkwSGe 7MjtyuZIWoHoQGn1gOZKk5lPObs2vUsUd7IRADok= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403778AbgAPXaC (ORCPT ); Thu, 16 Jan 2020 18:30:02 -0500 Received: from mail.kernel.org ([198.145.29.99]:36340 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403771AbgAPXaB (ORCPT ); Thu, 16 Jan 2020 18:30:01 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4081E2072E; Thu, 16 Jan 2020 23:30:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217400; bh=QylFq5XFvl0jRh43q85g/TCPfAigdwqScWo9ariAJGg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sjrbRyT+lSktGznOQ7EX5+XpYUaf7e9uROeMbANL9YaBTnkHyv/8gh5xp2Uh5O0ZE lbcSOxUydKGxIEUj1uek2Rjxk7bhXlY974TpFsguB9RPX4+uU02BTHWbzqK7IVPkfy SY/kUsbyRZbmNbCK1juRZQcJ4uyHwor6v7uvWmII= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mans Rullgard , Nicolas Ferre , Gregory CLEMENT , Mark Brown Subject: [PATCH 4.19 68/84] spi: atmel: fix handling of cs_change set on non-last xfer Date: Fri, 17 Jan 2020 00:18:42 +0100 Message-Id: <20200116231721.609879676@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Mans Rullgard commit fed8d8c7a6dc2a76d7764842853d81c770b0788e upstream. The driver does the wrong thing when cs_change is set on a non-last xfer in a message. When cs_change is set, the driver deactivates the CS and leaves it off until a later xfer again has cs_change set whereas it should be briefly toggling CS off and on again. This patch brings the behaviour of the driver back in line with the documentation and common sense. The delay of 10 us is the same as is used by the default spi_transfer_one_message() function in spi.c. [gregory: rebased on for-5.5 from spi tree] Fixes: 8090d6d1a415 ("spi: atmel: Refactor spi-atmel to use SPI framework queue") Signed-off-by: Mans Rullgard Acked-by: Nicolas Ferre Signed-off-by: Gregory CLEMENT Link: https://lore.kernel.org/r/20191018153504.4249-1-gregory.clement@bootlin.com Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- drivers/spi/spi-atmel.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c @@ -305,7 +305,6 @@ struct atmel_spi { bool use_cs_gpios; bool keep_cs; - bool cs_active; u32 fifo_size; }; @@ -1381,11 +1380,9 @@ static int atmel_spi_one_transfer(struct &msg->transfers)) { as->keep_cs = true; } else { - as->cs_active = !as->cs_active; - if (as->cs_active) - cs_activate(as, msg->spi); - else - cs_deactivate(as, msg->spi); + cs_deactivate(as, msg->spi); + udelay(10); + cs_activate(as, msg->spi); } } @@ -1408,7 +1405,6 @@ static int atmel_spi_transfer_one_messag atmel_spi_lock(as); cs_activate(as, spi); - as->cs_active = true; as->keep_cs = false; msg->status = 0; From patchwork Thu Jan 16 23:18:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233755 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=-11.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 89033C33CAF for ; Thu, 16 Jan 2020 23:37:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4DB982072B for ; Thu, 16 Jan 2020 23:37:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217873; bh=uxoYdEa1YMvd4QmddYEXwU+ZoyC4hc6YNpLE/Vn6OP4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=hR+bHi1LD8HCW+YFH+XKw4Gv+H2djDW2hi67o0dsIOXGRiXbJTMBJdyC3UXWoHPBw q4rScsTh4Xv+MUo0pn1T3SCfOKioKaAqpQhdzNufLhOm46+GxMHv3Od4g6p+krB8iU GSqKGA67cCAHBVy9/xbQ4jYAtwBnP4z15pRxkIpk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391390AbgAPXaE (ORCPT ); Thu, 16 Jan 2020 18:30:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:36486 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391384AbgAPXaD (ORCPT ); Thu, 16 Jan 2020 18:30:03 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B5AEA214AF; Thu, 16 Jan 2020 23:30:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217403; bh=uxoYdEa1YMvd4QmddYEXwU+ZoyC4hc6YNpLE/Vn6OP4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YxGvcuplotiqP2vFSy0innAHUepsbb4BQlW7AwbQXC+RvKTKCJergyjCtrxJJx+LO XgOAtK0yQfm/k4uPZ7DsaihYijxUdVIJNzeDuO+MLW7fWzSxzXu571zXBBjKXjW1hx VHMNASux1QBIN89Y5tS799dLLXrZIeO8mUzIDGVM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Ping-Ke Shih , Kalle Valo Subject: [PATCH 4.19 69/84] rtlwifi: Remove unnecessary NULL check in rtl_regd_init Date: Fri, 17 Jan 2020 00:18:43 +0100 Message-Id: <20200116231721.704400580@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Nathan Chancellor commit 091c6e9c083f7ebaff00b37ad13562d51464d175 upstream. When building with Clang + -Wtautological-pointer-compare: drivers/net/wireless/realtek/rtlwifi/regd.c:389:33: warning: comparison of address of 'rtlpriv->regd' equal to a null pointer is always false [-Wtautological-pointer-compare] if (wiphy == NULL || &rtlpriv->regd == NULL) ~~~~~~~~~^~~~ ~~~~ 1 warning generated. The address of an array member is never NULL unless it is the first struct member so remove the unnecessary check. This was addressed in the staging version of the driver in commit f986978b32b3 ("Staging: rtlwifi: remove unnecessary NULL check"). While we are here, fix the following checkpatch warning: CHECK: Comparison to NULL could be written "!wiphy" 35: FILE: drivers/net/wireless/realtek/rtlwifi/regd.c:389: + if (wiphy == NULL) Fixes: 0c8173385e54 ("rtl8192ce: Add new driver") Link:https://github.com/ClangBuiltLinux/linux/issues/750 Signed-off-by: Nathan Chancellor Acked-by: Ping-Ke Shih Signed-off-by: Kalle Valo Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/realtek/rtlwifi/regd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/wireless/realtek/rtlwifi/regd.c +++ b/drivers/net/wireless/realtek/rtlwifi/regd.c @@ -427,7 +427,7 @@ int rtl_regd_init(struct ieee80211_hw *h struct wiphy *wiphy = hw->wiphy; struct country_code_to_enum_rd *country = NULL; - if (wiphy == NULL || &rtlpriv->regd == NULL) + if (!wiphy) return -EINVAL; /* init country_code from efuse channel plan */ From patchwork Thu Jan 16 23:18:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233799 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 28543C33CAF for ; Thu, 16 Jan 2020 23:30:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E6FF22082F for ; Thu, 16 Jan 2020 23:30:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217415; bh=g6zQrEQnchlPBkNT7HLvg3TWp3rkuyvuXY9e8M2F708=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Gmk7pQJSOFGAg02h9dbtIezSDaCBDBv04naYmsPs9J8VibuYLVfAdOokp6rBBOUh0 a3Z0xUwbuYXLASX8Qcd1XWEYJOwQxKT9vzoV4dBWsvnrlcwC4i/ZSeW0NGp7/UqZE2 OO/3WGWHvlW7K+b+s9/298KjhXrBJrX6wQDGhbMU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403795AbgAPXaM (ORCPT ); Thu, 16 Jan 2020 18:30:12 -0500 Received: from mail.kernel.org ([198.145.29.99]:36726 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403789AbgAPXaK (ORCPT ); Thu, 16 Jan 2020 18:30:10 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DD9A7214AF; Thu, 16 Jan 2020 23:30:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217410; bh=g6zQrEQnchlPBkNT7HLvg3TWp3rkuyvuXY9e8M2F708=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p9jQ5jgWPdVkgcW4nXHAI8u1xet+lrkwoCKrXsYnLYUTkhG1Q3iiK9WaNaH/Por9I nIaP30xFiSMIofe21x+ofziLPNBAYoQcB6uv1JHNIDpXMbPQ2/65cwQIDgg+clhIsf IIOUideKrjQVeUXp3bsLCQ5U/fuFKdjo+FZYc4KM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuhong Yuan , Florian Fainelli , Alexandre Belloni Subject: [PATCH 4.19 72/84] rtc: brcmstb-waketimer: add missed clk_disable_unprepare Date: Fri, 17 Jan 2020 00:18:46 +0100 Message-Id: <20200116231722.032232143@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Chuhong Yuan commit 94303f8930ed78aea0f189b703c9d79fff9555d7 upstream. This driver forgets to disable and unprepare clock when remove. Add a call to clk_disable_unprepare to fix it. Fixes: c4f07ecee22e ("rtc: brcmstb-waketimer: Add Broadcom STB wake-timer") Signed-off-by: Chuhong Yuan Acked-by: Florian Fainelli Link: https://lore.kernel.org/r/20191105160043.20018-1-hslester96@gmail.com Signed-off-by: Alexandre Belloni Signed-off-by: Greg Kroah-Hartman --- drivers/rtc/rtc-brcmstb-waketimer.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/rtc/rtc-brcmstb-waketimer.c +++ b/drivers/rtc/rtc-brcmstb-waketimer.c @@ -287,6 +287,7 @@ static int brcmstb_waketmr_remove(struct struct brcmstb_waketmr *timer = dev_get_drvdata(&pdev->dev); unregister_reboot_notifier(&timer->reboot_notifier); + clk_disable_unprepare(timer->clk); return 0; } From patchwork Thu Jan 16 23:18:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233795 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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 A1706C33CB6 for ; Thu, 16 Jan 2020 23:31:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6BE2624653 for ; Thu, 16 Jan 2020 23:31:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217488; bh=5Yo15wUtY4GrEG5p7ZLwqs+m6oyTVZUgg2cKeRyUZ5s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=AmoclbH7XuPuVVERvLBYrz3pIDLhdi/wvzqXBszvV5ar0YAJ0e8iITxErvTbOddno jeUaUvZADoA4eWgU8WIC4NjFWj+7Xt1JcUVVWH34tQ62HIQvU9eXAIWA+bCCUwWNf0 C+Buazx34OPeLGe5aBR0LGy9oJRXhztI2eK3cn8Y= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403803AbgAPXaP (ORCPT ); Thu, 16 Jan 2020 18:30:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:36836 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403798AbgAPXaN (ORCPT ); Thu, 16 Jan 2020 18:30:13 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5819F2072E; Thu, 16 Jan 2020 23:30:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217412; bh=5Yo15wUtY4GrEG5p7ZLwqs+m6oyTVZUgg2cKeRyUZ5s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CXx6Z2jTZJTmRPVi6E+WU3u+aII31Vrug0rtH5bRXj52gyPkByD+hNIHaNcZSFzW9 CvuNxVE5w4T9d8TNk7FVi3xIJQvCuk0u3yRNk2UA6vIbvJt80M4X9GeGUS7/H6jYPU 5PMR2OtCeRt3tJyRa8Hd1i6gqy8xyJvEuXT78Mx4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johnson Chen , Linus Walleij , Sasha Levin Subject: [PATCH 4.19 73/84] gpio: mpc8xxx: Add platform device to gpiochip->parent Date: Fri, 17 Jan 2020 00:18:47 +0100 Message-Id: <20200116231722.139540483@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Johnson CH Chen (陳昭勳) [ Upstream commit 322f6a3182d42df18059a89c53b09d33919f755e ] Dear Linus Walleij, In old kernels, some APIs still try to use parent->of_node from struct gpio_chip, and it could be resulted in kernel panic because parent is NULL. Adding platform device to gpiochip->parent can fix this problem. Signed-off-by: Johnson Chen Link: https://patchwork.kernel.org/patch/11234609 Link: https://lore.kernel.org/r/HK0PR01MB3521489269F76467DFD7843FFA450@HK0PR01MB3521.apcprd01.prod.exchangelabs.com Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin --- drivers/gpio/gpio-mpc8xxx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c index 3f10f9599f2c..1899d172590b 100644 --- a/drivers/gpio/gpio-mpc8xxx.c +++ b/drivers/gpio/gpio-mpc8xxx.c @@ -317,6 +317,7 @@ static int mpc8xxx_probe(struct platform_device *pdev) return -ENOMEM; gc = &mpc8xxx_gc->gc; + gc->parent = &pdev->dev; if (of_property_read_bool(np, "little-endian")) { ret = bgpio_init(gc, &pdev->dev, 4, From patchwork Thu Jan 16 23:18:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233797 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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,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 15B7DC33CB3 for ; Thu, 16 Jan 2020 23:30:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D3F712075B for ; Thu, 16 Jan 2020 23:30:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217441; bh=7SrXtY3zhTAIs5OpgjwMMDDZzdGmV1xifK4ax0OnMDI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=QrXwoQQlLYpkOVSKqkHJBHDFZDA4jdJ35c5lY+EmZZnUgizBUavj7rq5NFH4Ww159 co3R30Ur7pFP8t6SRd31SrD2OF+OeaZmGQBDYhftdQjVHkxl1lGVKESKCEuFm05ebn 0vl/d5N4xZWFAKuae3lmdZ70mpKUOOuU4YxZSCbI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404149AbgAPXak (ORCPT ); Thu, 16 Jan 2020 18:30:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:37316 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403924AbgAPXa1 (ORCPT ); Thu, 16 Jan 2020 18:30:27 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F1F372072B; Thu, 16 Jan 2020 23:30:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217427; bh=7SrXtY3zhTAIs5OpgjwMMDDZzdGmV1xifK4ax0OnMDI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DQoCpW/x9fREcrz7GcKC33WwKl/plsl5S123mapuGSVtJFTe4SalJt9jkFTumy3De 29TRAloAvrcW5hMvownm8zaX/q0tAaRBjWrLsh5zKr1SeabZ8mfIB7kXF/7YLMPgLT oyqTTEVAZH1AulSNMzzUGekMYs9zY3jZxdG4Gpe4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jouni Hogander , Paul Burton , Lukas Bulwahn , linux-mips@vger.kernel.org, Sasha Levin Subject: [PATCH 4.19 78/84] MIPS: Prevent link failure with kcov instrumentation Date: Fri, 17 Jan 2020 00:18:52 +0100 Message-Id: <20200116231722.693197398@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jouni Hogander [ Upstream commit a4a3893114a41e365274d5fab5d9ff5acc235ff0 ] __sanitizer_cov_trace_pc() is not linked in and causing link failure if KCOV_INSTRUMENT is enabled. Fix this by disabling instrumentation for compressed image. Signed-off-by: Jouni Hogander Signed-off-by: Paul Burton Cc: Lukas Bulwahn Cc: linux-mips@vger.kernel.org Signed-off-by: Sasha Levin --- arch/mips/boot/compressed/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile index 172801ed35b8..d859f079b771 100644 --- a/arch/mips/boot/compressed/Makefile +++ b/arch/mips/boot/compressed/Makefile @@ -29,6 +29,9 @@ KBUILD_AFLAGS := $(KBUILD_AFLAGS) -D__ASSEMBLY__ \ -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) \ -DKERNEL_ENTRY=$(VMLINUX_ENTRY_ADDRESS) +# Prevents link failures: __sanitizer_cov_trace_pc() is not linked in. +KCOV_INSTRUMENT := n + # decompressor objects (linked with vmlinuz) vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/string.o From patchwork Thu Jan 16 23:18:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233764 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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 86406C33CB3 for ; Thu, 16 Jan 2020 23:36:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 518392465A for ; Thu, 16 Jan 2020 23:36:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217816; bh=kAOaVjnWMYC/RpKKbmuTL0WR4dJhxwrxKVKAogktUJ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=JrTFO2dkBDR8zDKBOIr/HqthOWfkNZ9WDd+RP+tfrOpighoaNsrRojBVuoSE9ALBK cEAp/yRhIKfiOHjSwQvRiRWg+g0r2DbR2lIju/qPM3q/dqA8s1dULiAQ3670AmHXU+ bX7wV3lnGgu0j6pO9TTY2eWSIjLT3TzbJiuwyHtM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403912AbgAPXb2 (ORCPT ); Thu, 16 Jan 2020 18:31:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:37398 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403989AbgAPXaa (ORCPT ); Thu, 16 Jan 2020 18:30:30 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3C77220684; Thu, 16 Jan 2020 23:30:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217429; bh=kAOaVjnWMYC/RpKKbmuTL0WR4dJhxwrxKVKAogktUJ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IWJd1ifoBSXf0XPrptx/XFKOuxAmU4hvVSEtvN9Mie4DYahIgM9shjciwMoy09m/b JU/vBqOK3Mf6K9/EXrFeZE+JWdNwKravHX2q+PW8x8N+jBqpQtx1wesgIkd8ZEXOt2 hT8/jiwmOEDTJwgrspagaVraOrtwACpMd5KEHCj4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Ben Dooks (Codethink)" , Liviu Dudau , Sasha Levin Subject: [PATCH 4.19 79/84] drm/arm/mali: make malidp_mw_connector_helper_funcs static Date: Fri, 17 Jan 2020 00:18:53 +0100 Message-Id: <20200116231722.790733579@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Ben Dooks (Codethink) [ Upstream commit ac2917b01992c098b8d4e6837115e3ca347fdd90 ] The malidp_mw_connector_helper_funcs is not referenced by name outside of the file it is in, so make it static to avoid the following warning: drivers/gpu/drm/arm/malidp_mw.c:59:41: warning: symbol 'malidp_mw_connector_helper_funcs' was not declared. Should it be static? Signed-off-by: Ben Dooks (Codethink) Signed-off-by: Liviu Dudau Link: https://patchwork.freedesktop.org/patch/msgid/20191217115309.2133503-1-ben.dooks@codethink.co.uk Signed-off-by: Sasha Levin --- drivers/gpu/drm/arm/malidp_mw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/arm/malidp_mw.c b/drivers/gpu/drm/arm/malidp_mw.c index 91472e5e0c8b..7266d3c8b8f4 100644 --- a/drivers/gpu/drm/arm/malidp_mw.c +++ b/drivers/gpu/drm/arm/malidp_mw.c @@ -55,7 +55,7 @@ malidp_mw_connector_mode_valid(struct drm_connector *connector, return MODE_OK; } -const struct drm_connector_helper_funcs malidp_mw_connector_helper_funcs = { +static const struct drm_connector_helper_funcs malidp_mw_connector_helper_funcs = { .get_modes = malidp_mw_connector_get_modes, .mode_valid = malidp_mw_connector_mode_valid, }; From patchwork Thu Jan 16 23:18:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233765 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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 ECA1AC33CAF for ; Thu, 16 Jan 2020 23:36:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BB5162072E for ; Thu, 16 Jan 2020 23:36:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217811; bh=f4TxQLy3Mhny7mtPzUFHT8lgsurK/XC2ANZvQ3SRims=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=CbMdzTCRIJoQYdm4gG3x53VBV6lYqIH8wSgLCASBhyZmcRR1YA+Jf8iKDTCNbPouB UFqE//+zhCCGm+C/bn73pIgbueLzmjF7xbseBFF97jT7BNmFi/99b0dHSUu1u3mxl1 NgB3Q4Pmri2wZIVeATzbkNgzjgToOLmYLutlkuis= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403920AbgAPXb2 (ORCPT ); Thu, 16 Jan 2020 18:31:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:37546 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404103AbgAPXaf (ORCPT ); Thu, 16 Jan 2020 18:30:35 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3E639206D9; Thu, 16 Jan 2020 23:30:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217434; bh=f4TxQLy3Mhny7mtPzUFHT8lgsurK/XC2ANZvQ3SRims=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lI72m9lq7UBDVaqMJiRL0GB44XW3WLVhOp5eateLFSofSDq8NGl0f0B4t4qA42HFd tpn3XIAOrWtL7MUO0ClQvKxjhd0aPJl/OMfc6mCuJYENyPp0P6VDNTk59Ki9dd7XyS eEOV5gXND+7SdpScS7rblRFim4d+8OVXzGnK8Iyo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Barabash , Dave Jiang , Vinod Koul , Sasha Levin Subject: [PATCH 4.19 81/84] ioat: ioat_alloc_ring() failure handling. Date: Fri, 17 Jan 2020 00:18:55 +0100 Message-Id: <20200116231722.980630735@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Alexander.Barabash@dell.com [ Upstream commit b0b5ce1010ffc50015eaec72b0028aaae3f526bb ] If dma_alloc_coherent() returns NULL in ioat_alloc_ring(), ring allocation must not proceed. Until now, if the first call to dma_alloc_coherent() in ioat_alloc_ring() returned NULL, the processing could proceed, failing with NULL-pointer dereferencing further down the line. Signed-off-by: Alexander Barabash Acked-by: Dave Jiang Link: https://lore.kernel.org/r/75e9c0e84c3345d693c606c64f8b9ab5@x13pwhopdag1307.AMER.DELL.COM Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/ioat/dma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c index 23fb2fa04000..b94cece58b98 100644 --- a/drivers/dma/ioat/dma.c +++ b/drivers/dma/ioat/dma.c @@ -388,10 +388,11 @@ ioat_alloc_ring(struct dma_chan *c, int order, gfp_t flags) descs->virt = dma_alloc_coherent(to_dev(ioat_chan), SZ_2M, &descs->hw, flags); - if (!descs->virt && (i > 0)) { + if (!descs->virt) { int idx; for (idx = 0; idx < i; idx++) { + descs = &ioat_chan->descs[idx]; dma_free_coherent(to_dev(ioat_chan), SZ_2M, descs->virt, descs->hw); descs->virt = NULL; From patchwork Thu Jan 16 23:18:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233754 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=-12.0 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY, 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 C1FB9C33CB6 for ; Thu, 16 Jan 2020 23:37:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 836B32072B for ; Thu, 16 Jan 2020 23:37:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217874; bh=LGB0bWKs8rdTYI4lO4muv1+hmcHlS4IlpxsxCtbSh2A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=axwqAtKlbkpsjH5ZqVzOYAEp8QIIAQpWCzUChSZp3anKI36e9ldZCCw7k8WQN3f/p PzgcjTMF0RYyH8nEqDThNzzEO83UBaMIu0y0J8EbHgXqqBiJufZUifYPoMsh33TPbO ILgOazactOTTiXfZFYGPiDkrN+rwJaDDhRzhnFvw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391255AbgAPXhw (ORCPT ); Thu, 16 Jan 2020 18:37:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:37630 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404136AbgAPXai (ORCPT ); Thu, 16 Jan 2020 18:30:38 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 995CE20684; Thu, 16 Jan 2020 23:30:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217437; bh=LGB0bWKs8rdTYI4lO4muv1+hmcHlS4IlpxsxCtbSh2A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bKviF4TSFUF2Y2/HDNdbx1/4Ot7+ECTofBb5bcPX3W15j02HjrRL9/crqqxAzDdfr 44nV7JJMedyaHedbeE3fkTkrx3PeExMTL0n4b1V1oqIYO5w3tIrm5HWarrlcaJUS/e JIcw9fDRxqWyh61mRbBpbH5ldCmv8ErBsKpvJ7qs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nick Desaulniers , Sid Manning , Brian Cain , Lee Jones , Andy Shevchenko , Tuowen Zhao , Mika Westerberg , Luis Chamberlain , Alexios Zavras , Allison Randal , Will Deacon , Richard Fontana , Thomas Gleixner , Peter Zijlstra , Boqun Feng , Ingo Molnar , Geert Uytterhoeven , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH 4.19 82/84] hexagon: parenthesize registers in asm predicates Date: Fri, 17 Jan 2020 00:18:56 +0100 Message-Id: <20200116231723.075782714@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Nick Desaulniers [ Upstream commit 780a0cfda9006a9a22d6473c2d4c527f5c68eb2e ] Hexagon requires that register predicates in assembly be parenthesized. Link: https://github.com/ClangBuiltLinux/linux/issues/754 Link: http://lkml.kernel.org/r/20191209222956.239798-3-ndesaulniers@google.com Signed-off-by: Nick Desaulniers Suggested-by: Sid Manning Acked-by: Brian Cain Cc: Lee Jones Cc: Andy Shevchenko Cc: Tuowen Zhao Cc: Mika Westerberg Cc: Luis Chamberlain Cc: Greg Kroah-Hartman Cc: Alexios Zavras Cc: Allison Randal Cc: Will Deacon Cc: Richard Fontana Cc: Thomas Gleixner Cc: Peter Zijlstra Cc: Boqun Feng Cc: Ingo Molnar Cc: Geert Uytterhoeven Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- arch/hexagon/include/asm/atomic.h | 8 ++++---- arch/hexagon/include/asm/bitops.h | 8 ++++---- arch/hexagon/include/asm/cmpxchg.h | 2 +- arch/hexagon/include/asm/futex.h | 6 +++--- arch/hexagon/include/asm/spinlock.h | 20 ++++++++++---------- arch/hexagon/kernel/vm_entry.S | 2 +- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/arch/hexagon/include/asm/atomic.h b/arch/hexagon/include/asm/atomic.h index 311b9894ccc8..15cca7f1fded 100644 --- a/arch/hexagon/include/asm/atomic.h +++ b/arch/hexagon/include/asm/atomic.h @@ -105,7 +105,7 @@ static inline void atomic_##op(int i, atomic_t *v) \ "1: %0 = memw_locked(%1);\n" \ " %0 = "#op "(%0,%2);\n" \ " memw_locked(%1,P3)=%0;\n" \ - " if !P3 jump 1b;\n" \ + " if (!P3) jump 1b;\n" \ : "=&r" (output) \ : "r" (&v->counter), "r" (i) \ : "memory", "p3" \ @@ -121,7 +121,7 @@ static inline int atomic_##op##_return(int i, atomic_t *v) \ "1: %0 = memw_locked(%1);\n" \ " %0 = "#op "(%0,%2);\n" \ " memw_locked(%1,P3)=%0;\n" \ - " if !P3 jump 1b;\n" \ + " if (!P3) jump 1b;\n" \ : "=&r" (output) \ : "r" (&v->counter), "r" (i) \ : "memory", "p3" \ @@ -138,7 +138,7 @@ static inline int atomic_fetch_##op(int i, atomic_t *v) \ "1: %0 = memw_locked(%2);\n" \ " %1 = "#op "(%0,%3);\n" \ " memw_locked(%2,P3)=%1;\n" \ - " if !P3 jump 1b;\n" \ + " if (!P3) jump 1b;\n" \ : "=&r" (output), "=&r" (val) \ : "r" (&v->counter), "r" (i) \ : "memory", "p3" \ @@ -187,7 +187,7 @@ static inline int atomic_fetch_add_unless(atomic_t *v, int a, int u) " }" " memw_locked(%2, p3) = %1;" " {" - " if !p3 jump 1b;" + " if (!p3) jump 1b;" " }" "2:" : "=&r" (__oldval), "=&r" (tmp) diff --git a/arch/hexagon/include/asm/bitops.h b/arch/hexagon/include/asm/bitops.h index 2691a1857d20..634306cda006 100644 --- a/arch/hexagon/include/asm/bitops.h +++ b/arch/hexagon/include/asm/bitops.h @@ -52,7 +52,7 @@ static inline int test_and_clear_bit(int nr, volatile void *addr) "1: R12 = memw_locked(R10);\n" " { P0 = tstbit(R12,R11); R12 = clrbit(R12,R11); }\n" " memw_locked(R10,P1) = R12;\n" - " {if !P1 jump 1b; %0 = mux(P0,#1,#0);}\n" + " {if (!P1) jump 1b; %0 = mux(P0,#1,#0);}\n" : "=&r" (oldval) : "r" (addr), "r" (nr) : "r10", "r11", "r12", "p0", "p1", "memory" @@ -76,7 +76,7 @@ static inline int test_and_set_bit(int nr, volatile void *addr) "1: R12 = memw_locked(R10);\n" " { P0 = tstbit(R12,R11); R12 = setbit(R12,R11); }\n" " memw_locked(R10,P1) = R12;\n" - " {if !P1 jump 1b; %0 = mux(P0,#1,#0);}\n" + " {if (!P1) jump 1b; %0 = mux(P0,#1,#0);}\n" : "=&r" (oldval) : "r" (addr), "r" (nr) : "r10", "r11", "r12", "p0", "p1", "memory" @@ -102,7 +102,7 @@ static inline int test_and_change_bit(int nr, volatile void *addr) "1: R12 = memw_locked(R10);\n" " { P0 = tstbit(R12,R11); R12 = togglebit(R12,R11); }\n" " memw_locked(R10,P1) = R12;\n" - " {if !P1 jump 1b; %0 = mux(P0,#1,#0);}\n" + " {if (!P1) jump 1b; %0 = mux(P0,#1,#0);}\n" : "=&r" (oldval) : "r" (addr), "r" (nr) : "r10", "r11", "r12", "p0", "p1", "memory" @@ -237,7 +237,7 @@ static inline int ffs(int x) int r; asm("{ P0 = cmp.eq(%1,#0); %0 = ct0(%1);}\n" - "{ if P0 %0 = #0; if !P0 %0 = add(%0,#1);}\n" + "{ if (P0) %0 = #0; if (!P0) %0 = add(%0,#1);}\n" : "=&r" (r) : "r" (x) : "p0"); diff --git a/arch/hexagon/include/asm/cmpxchg.h b/arch/hexagon/include/asm/cmpxchg.h index a6e34e2acbba..db258424059f 100644 --- a/arch/hexagon/include/asm/cmpxchg.h +++ b/arch/hexagon/include/asm/cmpxchg.h @@ -44,7 +44,7 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, __asm__ __volatile__ ( "1: %0 = memw_locked(%1);\n" /* load into retval */ " memw_locked(%1,P0) = %2;\n" /* store into memory */ - " if !P0 jump 1b;\n" + " if (!P0) jump 1b;\n" : "=&r" (retval) : "r" (ptr), "r" (x) : "memory", "p0" diff --git a/arch/hexagon/include/asm/futex.h b/arch/hexagon/include/asm/futex.h index c889f5993ecd..e8e5e47afb37 100644 --- a/arch/hexagon/include/asm/futex.h +++ b/arch/hexagon/include/asm/futex.h @@ -16,7 +16,7 @@ /* For example: %1 = %4 */ \ insn \ "2: memw_locked(%3,p2) = %1;\n" \ - " if !p2 jump 1b;\n" \ + " if (!p2) jump 1b;\n" \ " %1 = #0;\n" \ "3:\n" \ ".section .fixup,\"ax\"\n" \ @@ -84,10 +84,10 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, u32 oldval, "1: %1 = memw_locked(%3)\n" " {\n" " p2 = cmp.eq(%1,%4)\n" - " if !p2.new jump:NT 3f\n" + " if (!p2.new) jump:NT 3f\n" " }\n" "2: memw_locked(%3,p2) = %5\n" - " if !p2 jump 1b\n" + " if (!p2) jump 1b\n" "3:\n" ".section .fixup,\"ax\"\n" "4: %0 = #%6\n" diff --git a/arch/hexagon/include/asm/spinlock.h b/arch/hexagon/include/asm/spinlock.h index 48020863f53a..e090f6a151c2 100644 --- a/arch/hexagon/include/asm/spinlock.h +++ b/arch/hexagon/include/asm/spinlock.h @@ -44,9 +44,9 @@ static inline void arch_read_lock(arch_rwlock_t *lock) __asm__ __volatile__( "1: R6 = memw_locked(%0);\n" " { P3 = cmp.ge(R6,#0); R6 = add(R6,#1);}\n" - " { if !P3 jump 1b; }\n" + " { if (!P3) jump 1b; }\n" " memw_locked(%0,P3) = R6;\n" - " { if !P3 jump 1b; }\n" + " { if (!P3) jump 1b; }\n" : : "r" (&lock->lock) : "memory", "r6", "p3" @@ -60,7 +60,7 @@ static inline void arch_read_unlock(arch_rwlock_t *lock) "1: R6 = memw_locked(%0);\n" " R6 = add(R6,#-1);\n" " memw_locked(%0,P3) = R6\n" - " if !P3 jump 1b;\n" + " if (!P3) jump 1b;\n" : : "r" (&lock->lock) : "memory", "r6", "p3" @@ -75,7 +75,7 @@ static inline int arch_read_trylock(arch_rwlock_t *lock) __asm__ __volatile__( " R6 = memw_locked(%1);\n" " { %0 = #0; P3 = cmp.ge(R6,#0); R6 = add(R6,#1);}\n" - " { if !P3 jump 1f; }\n" + " { if (!P3) jump 1f; }\n" " memw_locked(%1,P3) = R6;\n" " { %0 = P3 }\n" "1:\n" @@ -92,9 +92,9 @@ static inline void arch_write_lock(arch_rwlock_t *lock) __asm__ __volatile__( "1: R6 = memw_locked(%0)\n" " { P3 = cmp.eq(R6,#0); R6 = #-1;}\n" - " { if !P3 jump 1b; }\n" + " { if (!P3) jump 1b; }\n" " memw_locked(%0,P3) = R6;\n" - " { if !P3 jump 1b; }\n" + " { if (!P3) jump 1b; }\n" : : "r" (&lock->lock) : "memory", "r6", "p3" @@ -108,7 +108,7 @@ static inline int arch_write_trylock(arch_rwlock_t *lock) __asm__ __volatile__( " R6 = memw_locked(%1)\n" " { %0 = #0; P3 = cmp.eq(R6,#0); R6 = #-1;}\n" - " { if !P3 jump 1f; }\n" + " { if (!P3) jump 1f; }\n" " memw_locked(%1,P3) = R6;\n" " %0 = P3;\n" "1:\n" @@ -131,9 +131,9 @@ static inline void arch_spin_lock(arch_spinlock_t *lock) __asm__ __volatile__( "1: R6 = memw_locked(%0);\n" " P3 = cmp.eq(R6,#0);\n" - " { if !P3 jump 1b; R6 = #1; }\n" + " { if (!P3) jump 1b; R6 = #1; }\n" " memw_locked(%0,P3) = R6;\n" - " { if !P3 jump 1b; }\n" + " { if (!P3) jump 1b; }\n" : : "r" (&lock->lock) : "memory", "r6", "p3" @@ -153,7 +153,7 @@ static inline unsigned int arch_spin_trylock(arch_spinlock_t *lock) __asm__ __volatile__( " R6 = memw_locked(%1);\n" " P3 = cmp.eq(R6,#0);\n" - " { if !P3 jump 1f; R6 = #1; %0 = #0; }\n" + " { if (!P3) jump 1f; R6 = #1; %0 = #0; }\n" " memw_locked(%1,P3) = R6;\n" " %0 = P3;\n" "1:\n" diff --git a/arch/hexagon/kernel/vm_entry.S b/arch/hexagon/kernel/vm_entry.S index 67c6ccc14770..9f4a73ff7203 100644 --- a/arch/hexagon/kernel/vm_entry.S +++ b/arch/hexagon/kernel/vm_entry.S @@ -382,7 +382,7 @@ ret_from_fork: R26.L = #LO(do_work_pending); R0 = #VM_INT_DISABLE; } - if P0 jump check_work_pending + if (P0) jump check_work_pending { R0 = R25; callr R24 From patchwork Thu Jan 16 23:18:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233757 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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 440A8C33CAF for ; Thu, 16 Jan 2020 23:37:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 176A120661 for ; Thu, 16 Jan 2020 23:37:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217860; bh=hBwaXTVVLpAFd8JxQdJ267fOsT2qaYNUu7tSiP+LIwI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=R6v0uJ0eMiRUhhFnIu+TkWlFgHN2cpxlcEcoGzKcupfctuGXw6kN4kMRc76xlhayH lJjby4YvO4Y+4OlluiX29bfJ8D5P8DZ8ik92czkCB/Hp1mC4edXlf4jnzgLIp1bfvI D/SAH2fqeAkwspPXiSbQjpeSMoDxQo/X6Jq9ta0A= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404169AbgAPXaq (ORCPT ); Thu, 16 Jan 2020 18:30:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:37928 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404158AbgAPXan (ORCPT ); Thu, 16 Jan 2020 18:30:43 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3B823206D9; Thu, 16 Jan 2020 23:30:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217441; bh=hBwaXTVVLpAFd8JxQdJ267fOsT2qaYNUu7tSiP+LIwI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dM8nlN1VqsR96jB0NEwtBiyb82owXzr5L9uFUSOUa2Ll4woxkrJojwFs5zSRf16aI X56L/ed0cdTR36y8eQjnjrMd8l1m/tq+hQS7E45Y9yC1nvPU+LpLZGC5/bXUKXe5uQ s1dJ1JPnwmPUGdk0BsH2CibNEbJpmJiUDexi/Inc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kai Li , Joseph Qi , Changwei Ge , Mark Fasheh , Joel Becker , Junxiao Bi , Gang He , Jun Piao , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH 4.19 84/84] ocfs2: call journal flush to mark journal as empty after journal recovery when mount Date: Fri, 17 Jan 2020 00:18:58 +0100 Message-Id: <20200116231723.253163756@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231713.087649517@linuxfoundation.org> References: <20200116231713.087649517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Kai Li [ Upstream commit 397eac17f86f404f5ba31d8c3e39ec3124b39fd3 ] If journal is dirty when mount, it will be replayed but jbd2 sb log tail cannot be updated to mark a new start because journal->j_flag has already been set with JBD2_ABORT first in journal_init_common. When a new transaction is committed, it will be recored in block 1 first(journal->j_tail is set to 1 in journal_reset). If emergency restart happens again before journal super block is updated unfortunately, the new recorded trans will not be replayed in the next mount. The following steps describe this procedure in detail. 1. mount and touch some files 2. these transactions are committed to journal area but not checkpointed 3. emergency restart 4. mount again and its journals are replayed 5. journal super block's first s_start is 1, but its s_seq is not updated 6. touch a new file and its trans is committed but not checkpointed 7. emergency restart again 8. mount and journal is dirty, but trans committed in 6 will not be replayed. This exception happens easily when this lun is used by only one node. If it is used by multi-nodes, other node will replay its journal and its journal super block will be updated after recovery like what this patch does. ocfs2_recover_node->ocfs2_replay_journal. The following jbd2 journal can be generated by touching a new file after journal is replayed, and seq 15 is the first valid commit, but first seq is 13 in journal super block. logdump: Block 0: Journal Superblock Seq: 0 Type: 4 (JBD2_SUPERBLOCK_V2) Blocksize: 4096 Total Blocks: 32768 First Block: 1 First Commit ID: 13 Start Log Blknum: 1 Error: 0 Feature Compat: 0 Feature Incompat: 2 block64 Feature RO compat: 0 Journal UUID: 4ED3822C54294467A4F8E87D2BA4BC36 FS Share Cnt: 1 Dynamic Superblk Blknum: 0 Per Txn Block Limit Journal: 0 Data: 0 Block 1: Journal Commit Block Seq: 14 Type: 2 (JBD2_COMMIT_BLOCK) Block 2: Journal Descriptor Seq: 15 Type: 1 (JBD2_DESCRIPTOR_BLOCK) No. Blocknum Flags 0. 587 none UUID: 00000000000000000000000000000000 1. 8257792 JBD2_FLAG_SAME_UUID 2. 619 JBD2_FLAG_SAME_UUID 3. 24772864 JBD2_FLAG_SAME_UUID 4. 8257802 JBD2_FLAG_SAME_UUID 5. 513 JBD2_FLAG_SAME_UUID JBD2_FLAG_LAST_TAG ... Block 7: Inode Inode: 8257802 Mode: 0640 Generation: 57157641 (0x3682809) FS Generation: 2839773110 (0xa9437fb6) CRC32: 00000000 ECC: 0000 Type: Regular Attr: 0x0 Flags: Valid Dynamic Features: (0x1) InlineData User: 0 (root) Group: 0 (root) Size: 7 Links: 1 Clusters: 0 ctime: 0x5de5d870 0x11104c61 -- Tue Dec 3 11:37:20.286280801 2019 atime: 0x5de5d870 0x113181a1 -- Tue Dec 3 11:37:20.288457121 2019 mtime: 0x5de5d870 0x11104c61 -- Tue Dec 3 11:37:20.286280801 2019 dtime: 0x0 -- Thu Jan 1 08:00:00 1970 ... Block 9: Journal Commit Block Seq: 15 Type: 2 (JBD2_COMMIT_BLOCK) The following is journal recovery log when recovering the upper jbd2 journal when mount again. syslog: ocfs2: File system on device (252,1) was not unmounted cleanly, recovering it. fs/jbd2/recovery.c:(do_one_pass, 449): Starting recovery pass 0 fs/jbd2/recovery.c:(do_one_pass, 449): Starting recovery pass 1 fs/jbd2/recovery.c:(do_one_pass, 449): Starting recovery pass 2 fs/jbd2/recovery.c:(jbd2_journal_recover, 278): JBD2: recovery, exit status 0, recovered transactions 13 to 13 Due to first commit seq 13 recorded in journal super is not consistent with the value recorded in block 1(seq is 14), journal recovery will be terminated before seq 15 even though it is an unbroken commit, inode 8257802 is a new file and it will be lost. Link: http://lkml.kernel.org/r/20191217020140.2197-1-li.kai4@h3c.com Signed-off-by: Kai Li Reviewed-by: Joseph Qi Reviewed-by: Changwei Ge Cc: Mark Fasheh Cc: Joel Becker Cc: Junxiao Bi Cc: Gang He Cc: Jun Piao Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- fs/ocfs2/journal.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index fc1f209e5db0..c27d8ef47392 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c @@ -1080,6 +1080,14 @@ int ocfs2_journal_load(struct ocfs2_journal *journal, int local, int replayed) ocfs2_clear_journal_error(osb->sb, journal->j_journal, osb->slot_num); + if (replayed) { + jbd2_journal_lock_updates(journal->j_journal); + status = jbd2_journal_flush(journal->j_journal); + jbd2_journal_unlock_updates(journal->j_journal); + if (status < 0) + mlog_errno(status); + } + status = ocfs2_journal_toggle_dirty(osb, 1, replayed); if (status < 0) { mlog_errno(status);