From patchwork Mon Oct 24 11:28:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8549 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp417063wru; Mon, 24 Oct 2022 05:12:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM65Tl21VsDRFOp+cslM0XCW/rJ1vzFOItY7xl/F1+NDoJX7FMKFYQ6gghnB9Qqy9xoZ2JaC X-Received: by 2002:a17:906:a4a:b0:782:686d:a1b6 with SMTP id x10-20020a1709060a4a00b00782686da1b6mr27061844ejf.232.1666613554334; Mon, 24 Oct 2022 05:12:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613554; cv=none; d=google.com; s=arc-20160816; b=XWHVvVx9bRax+ipBEdV1DzMUA4h8OLSGavCIguuPBh6f9F1gr7tMOYixciD877Nnv9 HsCsgHjNRPBZf22wbprSSelONWkQ3Xbx91OJmhlN0fIGRdE/w1q+/+cM5jbUUQuLXXjm GMTuX//2dhzCofR0le4tz7jVKpoEOoTb2bqWYfqcnECyTcLnvDIbCI3M2nm8oEsC9+mP +1W14cmFTpDIfBcMoM3OMluGfjVHFY4nLxzMAgL1DHSCD5/Gk1PVnOAE0Xj7dO/Jjx1n l1EHwMA2GJifNCgS5Bg0mtDd1iCjvSXcxv+3jwDlpbrnoq316wLIQBQ7sN+BvybHXDrV cpBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2xPDsIt+Ao/LoywEAsWG/tUQz9y9QuPAQju764Ol+xc=; b=Od+WwOPZVUjyKQlJ8jbGCDDGSs4OkSk7x95rtKAuZ9xMNqJLf2fp0JlyFIABWdtN4Y vlpmltoVGj+jhQSKPwsKEFNMTODlPZ0sL3U1pwihGV0r/danWBd5AUpqsZmsE2R36CuY QygCjuAY2H3s/yqlI7+LNnz3czd0JXLQw/GpU4mCPnNi41lxQB7DTBsoadzIggBSzmLb 9XsdZfIN/PcAQaZVtXvyFDj9bdLTUsQe/KfZom09g7grK0BHUHvro8//onBw9auTwyTl U0yjEJYk3wXvTmsExn9TlGUnXQiUGBai3bB1lDIMNXYbCGkQh5hUSr0gSsUscFAJJ9hG yU1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="SWI1y/lM"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wt6-20020a170906ee8600b007aae0b30283si433237ejb.691.2022.10.24.05.12.08; Mon, 24 Oct 2022 05:12:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="SWI1y/lM"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232449AbiJXMAz (ORCPT + 99 others); Mon, 24 Oct 2022 08:00:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232431AbiJXL6w (ORCPT ); Mon, 24 Oct 2022 07:58:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A11EB7A747; Mon, 24 Oct 2022 04:47:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DE064612A1; Mon, 24 Oct 2022 11:46:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00CA2C433C1; Mon, 24 Oct 2022 11:46:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611967; bh=WBnd2eNBW/mUz+GKBeaLTmL2wQBXursKCCUI3t17eqk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SWI1y/lMF0pFIVGhUsxwrdLQAT1Dh0UISeZ9wCP/1CLVB0gPWXLTn1CwIFjata/gw 5b5wAj1M7JJGX2lZ3T7nceddmWuGw3qqiL+InjmAmJb2MN1aNzyXcBjmZMPTYt17LA TaqiNdL/0o78KXv9Fu1MvHK3gz1/qwwrSv5hFzs0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Stern , stable , Hongling Zeng Subject: [PATCH 4.14 002/210] usb-storage: Add Hiksemi USB3-FW to IGNORE_UAS Date: Mon, 24 Oct 2022 13:28:39 +0200 Message-Id: <20221024112956.907522003@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747570974637923534?= X-GMAIL-MSGID: =?utf-8?q?1747570974637923534?= From: Hongling Zeng commit e00b488e813f0f1ad9f778e771b7cd2fe2877023 upstream. The UAS mode of Hiksemi USB_HDD is reported to fail to work on several platforms with the following error message, then after re-connecting the device will be offlined and not working at all. [ 592.518442][ 2] sd 8:0:0:0: [sda] tag#17 uas_eh_abort_handler 0 uas-tag 18 inflight: CMD [ 592.527575][ 2] sd 8:0:0:0: [sda] tag#17 CDB: Write(10) 2a 00 03 6f 88 00 00 04 00 00 [ 592.536330][ 2] sd 8:0:0:0: [sda] tag#0 uas_eh_abort_handler 0 uas-tag 1 inflight: CMD [ 592.545266][ 2] sd 8:0:0:0: [sda] tag#0 CDB: Write(10) 2a 00 07 44 1a 88 00 00 08 00 These disks have a broken uas implementation, the tag field of the status iu-s is not set properly,so we need to fall-back to usb-storage. Acked-by: Alan Stern Cc: stable Signed-off-by: Hongling Zeng Link: https://lore.kernel.org/r/1663901185-21067-1-git-send-email-zenghongling@kylinos.cn Signed-off-by: Greg Kroah-Hartman --- drivers/usb/storage/unusual_uas.h | 7 +++++++ 1 file changed, 7 insertions(+) --- a/drivers/usb/storage/unusual_uas.h +++ b/drivers/usb/storage/unusual_uas.h @@ -152,6 +152,13 @@ UNUSUAL_DEV(0x0bc2, 0xab2a, 0x0000, 0x99 USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_NO_ATA_1X), +/* Reported-by: Hongling Zeng */ +UNUSUAL_DEV(0x0bda, 0x9210, 0x0000, 0x9999, + "Hiksemi", + "External HDD", + USB_SC_DEVICE, USB_PR_DEVICE, NULL, + US_FL_IGNORE_UAS), + /* Reported-by: Benjamin Tissoires */ UNUSUAL_DEV(0x13fd, 0x3940, 0x0000, 0x9999, "Initio Corporation", From patchwork Mon Oct 24 11:28:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8529 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp407254wru; Mon, 24 Oct 2022 05:00:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5CtOmQrWpfEbwuIk6vyiv2NFW5d+Iz+wKk4Xpa+5BcMRVZM3nn8PuYZphSZJhweQelgrdV X-Received: by 2002:a63:4384:0:b0:43a:18ce:f98a with SMTP id q126-20020a634384000000b0043a18cef98amr27553034pga.273.1666612851875; Mon, 24 Oct 2022 05:00:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612851; cv=none; d=google.com; s=arc-20160816; b=ZjMsoibuAuc23hquHDsUCuLp7B8ORlliqseIXZmL4AsLd3bO0FNppj0wSCeGl9Cbq0 yyT8GvnqhmjKoLXw1NP0B/Wv11JTWO77vVGXQujTa04b7Po+uBwJxZy5lHUj8sv6C1Vh 1K59KJhsd9r8wrkNLTKyVi/8B3lj1Y+QYMztooXHk9BbvRLU3YllotmdBrpcoK5SmN5b PGhhEBi6H1VsKZaeoOKRVHnIWJ5eS8HdtobKOY18TgRyqtpMHfoFsr88sPT7k46J5MQu Vz8iPtqa5Ry29T1/lKKBOaAyrHPoQI0iY7jvsF/RrmNLrunGh5CqwB5OEDRC4h5l4XsI NzPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=b2vw60hTwtl0juR/YHg71uIm0oiq7ogGARyt/sljfn8=; b=Actt+873/PoE5t4h5K0kBy+MKPeT2r+Tv3a0EKqwcse7Rq/owPmC8GqnYkOESzScEZ 7dpSrcgxWRVzDBmhl0bhDMdMxdC4upuPNvURZsjh7yFCGeZEFmNx//RVcowoQjnsflnf xJ/1Uhrx+MBXqgQa3RNnwTUfLbkXsxp2J7hzL/pIqAkQwa5KlehWH2AnLERvDmIXhl3w AVhI+LjMmdcT+TjbSV50IiToDRbmrKHQysQ/FQhJpoft4VuPxtNUyJFsFyQ7pa64Zg4R D/LkP4Eu/amSKcEOutoO01igmawh/U3cy+rfZCihegXkwcdLkd6tTvsTYqPYuV+Cj3N6 jguw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=E4v3Le2S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b8-20020a170902b60800b001789faa628fsi31803425pls.395.2022.10.24.05.00.37; Mon, 24 Oct 2022 05:00:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=E4v3Le2S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232273AbiJXL5z (ORCPT + 99 others); Mon, 24 Oct 2022 07:57:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232272AbiJXL4U (ORCPT ); Mon, 24 Oct 2022 07:56:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A4D0753B9; Mon, 24 Oct 2022 04:46:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A442F612A8; Mon, 24 Oct 2022 11:46:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6B5DC433C1; Mon, 24 Oct 2022 11:46:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611996; bh=bGsZF3J1Px/N5/y/h70j0EcZc93RsYKBguiOqZV5QVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E4v3Le2SSentTpk/bzXQ9/Yww4Mvt3PoK0r3QXuAfqZTno0aFDCGGZeLB4y96gEjG 8MBVoK20TSz8jck99knrI6xr/BWcg8A7sPVo67J6q97R9hwHGM4g6bSGg3Fq7ExXGp uW+LsptquHPpbLJCWDf5GVIVAiJhlJl6QYZZgttI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Stern , stable , Hongling Zeng Subject: [PATCH 4.14 003/210] uas: ignore UAS for Thinkplus chips Date: Mon, 24 Oct 2022 13:28:40 +0200 Message-Id: <20221024112956.942995048@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747570237989139672?= X-GMAIL-MSGID: =?utf-8?q?1747570237989139672?= From: Hongling Zeng commit 0fb9703a3eade0bb84c635705d9c795345e55053 upstream. The UAS mode of Thinkplus(0x17ef, 0x3899) is reported to influence performance and trigger kernel panic on several platforms with the following error message: [ 39.702439] xhci_hcd 0000:0c:00.3: ERROR Transfer event for disabled endpoint or incorrect stream ring [ 39.702442] xhci_hcd 0000:0c:00.3: @000000026c61f810 00000000 00000000 1b000000 05038000 [ 720.545894][13] Workqueue: usb_hub_wq hub_event [ 720.550971][13] ffff88026c143c38 0000000000016300 ffff8802755bb900 ffff880 26cb80000 [ 720.559673][13] ffff88026c144000 ffff88026ca88100 0000000000000000 ffff880 26cb80000 [ 720.568374][13] ffff88026cb80000 ffff88026c143c50 ffffffff8186ae25 ffff880 26ca880f8 [ 720.577076][13] Call Trace: [ 720.580201][13] [] schedule+0x35/0x80 [ 720.586137][13] [] schedule_preempt_disabled+0xe/0x10 [ 720.593623][13] [] __mutex_lock_slowpath+0x164/0x1e0 [ 720.601012][13] [] mutex_lock+0x2f/0x40 [ 720.607141][13] [] usb_disconnect+0x59/0x290 Falling back to USB mass storage can solve this problem, so ignore UAS function of this chip. Acked-by: Alan Stern Cc: stable Signed-off-by: Hongling Zeng Link: https://lore.kernel.org/r/1663902249837086.19.seg@mailgw Signed-off-by: Greg Kroah-Hartman --- drivers/usb/storage/unusual_uas.h | 7 +++++++ 1 file changed, 7 insertions(+) --- a/drivers/usb/storage/unusual_uas.h +++ b/drivers/usb/storage/unusual_uas.h @@ -201,6 +201,13 @@ UNUSUAL_DEV(0x154b, 0xf00d, 0x0000, 0x99 USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_NO_ATA_1X), +/* Reported-by: Hongling Zeng */ +UNUSUAL_DEV(0x17ef, 0x3899, 0x0000, 0x9999, + "Thinkplus", + "External HDD", + USB_SC_DEVICE, USB_PR_DEVICE, NULL, + US_FL_IGNORE_UAS), + /* Reported-by: Hans de Goede */ UNUSUAL_DEV(0x2109, 0x0711, 0x0000, 0x9999, "VIA", From patchwork Mon Oct 24 11:28:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8527 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp405966wru; Mon, 24 Oct 2022 04:58:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM73xjzwyouRUf+SFk7JSgVplmueBjZJkI14SQF6c4IADio1fkHhnyJtPDjNycvRVIHX2Q4a X-Received: by 2002:a17:90b:1982:b0:212:fe7f:4a49 with SMTP id mv2-20020a17090b198200b00212fe7f4a49mr8389805pjb.156.1666612682668; Mon, 24 Oct 2022 04:58:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612682; cv=none; d=google.com; s=arc-20160816; b=fUyfgeK6CdyuIMOGjCfmPW30cnwYdhTchpZm1O9cPlnaHB2tLgooKC6vbKAPNu7Etz 37hrK3ITFatgYbg2Fl7KFT0u8eARg2LclYe1VXnQBiTBfvtf5KJ8L+ZoAV6n8sI2CGFP JOOrpf33bn3mqo9U/KQbz2QmpwV6StkWkU1pYCeIlTzpLOUaFnr43lpsaZP67vHHGjW0 WUK25iHZjaqstDj2JjVl4OFgTAVGnsvFpJXVLlYkjCvKpdcIOa8Y0nMIL4aLKdSBp6CK rVtS6flo4lNcsWS5pY63m+iUub5e5F+gzTT3NniagKuWtACSGlAgVoM5IUYxyfxMtifn tvhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2me7RYp2bepZaTXW9r4MTWonU8FVEqjhMl+/+N0eWxQ=; b=fdswZpgeD7zWZ1QDZnhRcLwrEvLxjnhoIj+64o2eH1+sePEuYdyqEgn3465VJUlHs/ DAeyMoUSAhlXDnkThh1JtrD+e3DqsiVlPI/NqJ2TEiyhSIgB0g0E+GQybzKHAvAvFtvO JGas3wghGMQpe07ApJTsfLhSicwUcm/1a0cntDLjdzloi442lvSQ0DMI0uJv2yb2uZrp W/FXgn4svH9N3zGWMkiDBvwkF2Dg5wGggFvpNnrfdm7GR9nckqyKtlobjCTgFr0kEfeJ kLLAKqD8LSQtmOsd0h3/iphmTd+JUSx6cXdEeEs4iOV4gjZ0bL5DYYkdhRy8p9dZo3ze q9QQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xITE+kti; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z11-20020a170903018b00b00178a9b343f5si35871542plg.16.2022.10.24.04.57.49; Mon, 24 Oct 2022 04:58:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xITE+kti; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232355AbiJXL50 (ORCPT + 99 others); Mon, 24 Oct 2022 07:57:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232207AbiJXLzt (ORCPT ); Mon, 24 Oct 2022 07:55:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE4B57B1C9; Mon, 24 Oct 2022 04:46:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9D608B8117D; Mon, 24 Oct 2022 11:46:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFCDEC433C1; Mon, 24 Oct 2022 11:46:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612001; bh=EACdsKkfqOHS9TuJKgWPXhDWXT25RRhsq3BWdNiZNXk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xITE+ktiv90r+9VJ0ZSuncoKmr7BPDlJjPzEqBKfFa06mZ2BtQKsYiT6/ITFhCPYb C25ADVSB4KuMFPWpuCUoJCs/GwsnVR2bG3wNGvRcpaZNnzTrwDAvN4rYgqC3r0D9Bf /qA4YfasZJk1lcWO2m7WrvR8hYymPTO7wkkbZDHs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Frank Wunderlich , =?utf-8?q?Bj=C3=B8rn_Mork?= , Jakub Kicinski Subject: [PATCH 4.14 004/210] net: usb: qmi_wwan: Add new usb-id for Dell branded EM7455 Date: Mon, 24 Oct 2022 13:28:41 +0200 Message-Id: <20221024112956.990107334@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747570060381269367?= X-GMAIL-MSGID: =?utf-8?q?1747570060381269367?= From: Frank Wunderlich commit 797666cd5af041ffb66642fff62f7389f08566a2 upstream. Add support for Dell 5811e (EM7455) with USB-id 0x413c:0x81c2. Signed-off-by: Frank Wunderlich Cc: stable@vger.kernel.org Acked-by: Bjørn Mork Link: https://lore.kernel.org/r/20220926150740.6684-3-linux@fw-web.de Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/usb/qmi_wwan.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c @@ -1346,6 +1346,7 @@ static const struct usb_device_id produc {QMI_FIXED_INTF(0x413c, 0x81b3, 8)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card (rev3) */ {QMI_FIXED_INTF(0x413c, 0x81b6, 8)}, /* Dell Wireless 5811e */ {QMI_FIXED_INTF(0x413c, 0x81b6, 10)}, /* Dell Wireless 5811e */ + {QMI_FIXED_INTF(0x413c, 0x81c2, 8)}, /* Dell Wireless 5811e */ {QMI_FIXED_INTF(0x413c, 0x81cc, 8)}, /* Dell Wireless 5816e */ {QMI_FIXED_INTF(0x413c, 0x81d7, 0)}, /* Dell Wireless 5821e */ {QMI_FIXED_INTF(0x413c, 0x81d7, 1)}, /* Dell Wireless 5821e preproduction config */ From patchwork Mon Oct 24 11:28:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8525 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp405895wru; Mon, 24 Oct 2022 04:57:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Rf5Cj5mew8UShLi9jbx2kF9UuKe+PeEK1/tEMrMu1zQawGSPhf6TVEOCw+FpD6zne4AYT X-Received: by 2002:a17:902:c7c4:b0:186:5ebe:38e with SMTP id r4-20020a170902c7c400b001865ebe038emr24446339pla.33.1666612672493; Mon, 24 Oct 2022 04:57:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612672; cv=none; d=google.com; s=arc-20160816; b=aFSvVtilq+DMY5AfNz0O0d+AmjeWMm+z1HNGudRRO4tulZ+K4HtBSr1hu3pEx/JdLL 3CeWg6XMcWGnfzg1EYxJmmRmstloVhS1BhjrO792jNthtHZb+9EL3VNOqM7wfTjhxBgm kKvBMMGVbPaOWeT128Qf/PkXFipqIEsKiBSZCS5nmsvzJWbVMsLgl5EStztbinxmG12J ioCXYAZ7YIf4WNn3nDkllTgBPFMyunnAjd8SNT+xhJucQT2NWle7Efcp2ySnJjcv4Hzl c9wELkI9SfB0bDIDkxeSsu31MbMqy/Zk0CnorTlS6qRFqzyn1WkSkmDmcc4LDxS9p3Jb QLmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dp75aIKniN0n7zlVp/LfuBBKFip2G3YuLFUlMB2dRO8=; b=MCK/jmJ2movNd1NVeR68N86lnP/c8aM4IOehJPAjRxNsB86Hqrt9nJJHZUpVy3VkCx IF3Pj/YvpCbmoef1AYi+ivijyTXZpUB4CjpEzLReorfffl1uw2Z9CGJGUw5FmxcxbY2U l/AJ8DuUKOzuL44N7x8aCzrdeWZ701jB06cgNewj80cheUAiGHHYc3uFkoIVsAxA7pKs 4p8qOP6Br0AOu3s1HUbzfHn2+HiBTAqwwjhTK1k2rSfK1nnaRhm7+8qfH0ToLun01FpD WqWRQ4BENFXcRvYWXQb2GTOiBhO4eZ9SwXkXM+nBFG7DwTbO3B+BjvyOkiSHzhfWuPTo RX+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EsVxHkRW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y2-20020a655282000000b00469e1f7dcbesi34579414pgp.603.2022.10.24.04.57.38; Mon, 24 Oct 2022 04:57:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EsVxHkRW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232344AbiJXL5S (ORCPT + 99 others); Mon, 24 Oct 2022 07:57:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232152AbiJXLzg (ORCPT ); Mon, 24 Oct 2022 07:55:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B44C47B1DB; Mon, 24 Oct 2022 04:46:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4714FB8119F; Mon, 24 Oct 2022 11:46:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94C72C433C1; Mon, 24 Oct 2022 11:46:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612003; bh=V3WpwRAWt5cAB2K6+gSEMiz3McF42UPgqUC/ragvIrw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EsVxHkRWNLKf4Tp3laRn7/Qv3BXOVSfc0c8BEkE89mTb1iOwXGSa4m9fEoJ0vgWva Zc7DWhgSDdanGp9k2NnkMVDfZlKw9pY7DPzjCZAxP051ijJ9taVdF5JO/cyiPzmo5x 7iF6M0qgSRfEk8CNSiIk8zOQJ7yaGWvrYY5MERLY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, ChenXiaoSong , Anton Altaparmakov , Andrew Morton Subject: [PATCH 4.14 005/210] ntfs: fix BUG_ON in ntfs_lookup_inode_by_name() Date: Mon, 24 Oct 2022 13:28:42 +0200 Message-Id: <20221024112957.026155074@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747570049648531193?= X-GMAIL-MSGID: =?utf-8?q?1747570049648531193?= From: ChenXiaoSong commit 1b513f613731e2afc05550e8070d79fac80c661e upstream. Syzkaller reported BUG_ON as follows: ------------[ cut here ]------------ kernel BUG at fs/ntfs/dir.c:86! invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI CPU: 3 PID: 758 Comm: a.out Not tainted 5.19.0-next-20220808 #5 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014 RIP: 0010:ntfs_lookup_inode_by_name+0xd11/0x2d10 Code: ff e9 b9 01 00 00 e8 1e fe d6 fe 48 8b 7d 98 49 8d 5d 07 e8 91 85 29 ff 48 c7 45 98 00 00 00 00 e9 5a fb ff ff e8 ff fd d6 fe <0f> 0b e8 f8 fd d6 fe 0f 0b e8 f1 fd d6 fe 48 8b b5 50 ff ff ff 4c RSP: 0018:ffff888079607978 EFLAGS: 00010293 RAX: 0000000000000000 RBX: 0000000000008000 RCX: 0000000000000000 RDX: ffff88807cf10000 RSI: ffffffff82a4a081 RDI: 0000000000000003 RBP: ffff888079607a70 R08: 0000000000000001 R09: ffff88807a6d01d7 R10: ffffed100f4da03a R11: 0000000000000000 R12: ffff88800f0fb110 R13: ffff88800f0ee000 R14: ffff88800f0fb000 R15: 0000000000000001 FS: 00007f33b63c7540(0000) GS:ffff888108580000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f33b635c090 CR3: 000000000f39e005 CR4: 0000000000770ee0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: load_system_files+0x1f7f/0x3620 ntfs_fill_super+0xa01/0x1be0 mount_bdev+0x36a/0x440 ntfs_mount+0x3a/0x50 legacy_get_tree+0xfb/0x210 vfs_get_tree+0x8f/0x2f0 do_new_mount+0x30a/0x760 path_mount+0x4de/0x1880 __x64_sys_mount+0x2b3/0x340 do_syscall_64+0x38/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f33b62ff9ea Code: 48 8b 0d a9 f4 0b 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 76 f4 0b 00 f7 d8 64 89 01 48 RSP: 002b:00007ffd0c471aa8 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f33b62ff9ea RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007ffd0c471be0 RBP: 00007ffd0c471c60 R08: 00007ffd0c471ae0 R09: 00007ffd0c471c24 R10: 0000000000000000 R11: 0000000000000202 R12: 000055bac5afc160 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Modules linked in: ---[ end trace 0000000000000000 ]--- Fix this by adding sanity check on extended system files' directory inode to ensure that it is directory, just like ntfs_extend_init() when mounting ntfs3. Link: https://lkml.kernel.org/r/20220809064730.2316892-1-chenxiaosong2@huawei.com Signed-off-by: ChenXiaoSong Cc: Anton Altaparmakov Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- fs/ntfs/super.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c @@ -2106,7 +2106,8 @@ get_ctx_vol_failed: // TODO: Initialize security. /* Get the extended system files' directory inode. */ vol->extend_ino = ntfs_iget(sb, FILE_Extend); - if (IS_ERR(vol->extend_ino) || is_bad_inode(vol->extend_ino)) { + if (IS_ERR(vol->extend_ino) || is_bad_inode(vol->extend_ino) || + !S_ISDIR(vol->extend_ino->i_mode)) { if (!IS_ERR(vol->extend_ino)) iput(vol->extend_ino); ntfs_error(sb, "Failed to load $Extend."); From patchwork Mon Oct 24 11:28:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8530 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp407268wru; Mon, 24 Oct 2022 05:00:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7i3d5O3zdDi/m4YJf03/1empZFN7zVNIPN3SQKHyJUeK6J4+HYGuwQReHYnmbrD1jijvcK X-Received: by 2002:a63:6942:0:b0:41c:9261:54fd with SMTP id e63-20020a636942000000b0041c926154fdmr28656929pgc.34.1666612853213; Mon, 24 Oct 2022 05:00:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612853; cv=none; d=google.com; s=arc-20160816; b=Npg/JtxrUB77hAFE16PZxV4V6lWFmyWJmLudXDj5b+7upx/fTI2p0WDVpOfvWNObmY tcuksxvxcP0CvJLQehrLqT2dWsEArTEBjxA44nMD5LFZJ6OWNORlLB19Bepw0rzzYYNI 3E/2UTVHEGY3H34aylzDescOQ2XMUbv7tPrInNAbo0f2QMVmWyD8qVwarWrF/UMAATAo LXNxOkEH8YzTBn/yadnN4iDkqcFl5Hbrxm/cYozmPY2roBfPTHGbd4Xz9m4M856XZd1z sghuCBTBJ9/svnRlXkIaS0Va8he4ylNziXRRAoUNAYIg9bKx3qrlyEp+YK6UU32qn8Lz 2XTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JVZvYkE0QtHSedCf4H5oWeuPwBSfXdl+mZqucKUhdeI=; b=JFkTCyFgWoEcBgDXJTh1fHtYUsAamEYsIGq2eSZL6qym9kBz3rZcbI57OOj9d32Zei NkNjBd/3ZwW40BlTf3nhqTSrVl8+SDbSDWrYi8l+hSlAyE5rKTI1gH4uayQsFe/HofEN k9Sqeuiu7c44xWRq6afQ8l5hNqBgUgkquYlTuJIeI5zsKTBlQwOjz3Ozq8c/LTAEja9C jjRtHj/WZ5p0nqj+ioH+FQ0CGWx0JkT+NSa6WyDVXvrAeTndFMtfjRA85AlM0Dh/n0Jq x2FqgPPzetR1AyFuRxKY5xsqP6kWnUQvNQ/6ZdlU7qx0UzMg3eoG0y8y15K74Q3ZULmj 8/kQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PJNyvUXr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mh1-20020a17090b4ac100b00202b78e2adasi17148493pjb.102.2022.10.24.05.00.39; Mon, 24 Oct 2022 05:00:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PJNyvUXr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232243AbiJXL5r (ORCPT + 99 others); Mon, 24 Oct 2022 07:57:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232231AbiJXL4B (ORCPT ); Mon, 24 Oct 2022 07:56:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F5E21B1C2; Mon, 24 Oct 2022 04:46:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D5A87B810F5; Mon, 24 Oct 2022 11:46:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38DBCC4314A; Mon, 24 Oct 2022 11:46:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612006; bh=q0My1NRdS5ALMXpoYH2Fi1xX8qrY9UD0s3A2OdbcL/w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PJNyvUXrnaKiSVwi/BhOzUm+7JCs0+dIJrnkPt9vYXUJ8hKPVb37wdBnbP0aQ34uI C0YxeD+vRHFPrL5ZrkIiEI1mJ2hOSPwL6dW0jWX1ZNdtu5SGjem6F5JxEDZQeplwj+ CZnUvzDmrpv5TGPvx5RaMXNDCbucUPnZg4VxiN9I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergei Antonov , Jonas Jensen , Ulf Hansson Subject: [PATCH 4.14 006/210] mmc: moxart: fix 4-bit bus width and remove 8-bit bus width Date: Mon, 24 Oct 2022 13:28:43 +0200 Message-Id: <20221024112957.066576791@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,URIBL_SBL_A autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747570239076368421?= X-GMAIL-MSGID: =?utf-8?q?1747570239076368421?= From: Sergei Antonov commit 35ca91d1338ae158f6dcc0de5d1e86197924ffda upstream. According to the datasheet [1] at page 377, 4-bit bus width is turned on by bit 2 of the Bus Width Register. Thus the current bitmask is wrong: define BUS_WIDTH_4 BIT(1) BIT(1) does not work but BIT(2) works. This has been verified on real MOXA hardware with FTSDC010 controller revision 1_6_0. The corrected value of BUS_WIDTH_4 mask collides with: define BUS_WIDTH_8 BIT(2). Additionally, 8-bit bus width mode isn't supported according to the datasheet, so let's remove the corresponding code. [1] https://bitbucket.org/Kasreyn/mkrom-uc7112lx/src/master/documents/FIC8120_DS_v1.2.pdf Fixes: 1b66e94e6b99 ("mmc: moxart: Add MOXA ART SD/MMC driver") Signed-off-by: Sergei Antonov Cc: Jonas Jensen Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220907205753.1577434-1-saproj@gmail.com Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/host/moxart-mmc.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) --- a/drivers/mmc/host/moxart-mmc.c +++ b/drivers/mmc/host/moxart-mmc.c @@ -111,8 +111,8 @@ #define CLK_DIV_MASK 0x7f /* REG_BUS_WIDTH */ -#define BUS_WIDTH_8 BIT(2) -#define BUS_WIDTH_4 BIT(1) +#define BUS_WIDTH_4_SUPPORT BIT(3) +#define BUS_WIDTH_4 BIT(2) #define BUS_WIDTH_1 BIT(0) #define MMC_VDD_360 23 @@ -527,9 +527,6 @@ static void moxart_set_ios(struct mmc_ho case MMC_BUS_WIDTH_4: writel(BUS_WIDTH_4, host->base + REG_BUS_WIDTH); break; - case MMC_BUS_WIDTH_8: - writel(BUS_WIDTH_8, host->base + REG_BUS_WIDTH); - break; default: writel(BUS_WIDTH_1, host->base + REG_BUS_WIDTH); break; @@ -646,16 +643,8 @@ static int moxart_probe(struct platform_ dmaengine_slave_config(host->dma_chan_rx, &cfg); } - switch ((readl(host->base + REG_BUS_WIDTH) >> 3) & 3) { - case 1: + if (readl(host->base + REG_BUS_WIDTH) & BUS_WIDTH_4_SUPPORT) mmc->caps |= MMC_CAP_4_BIT_DATA; - break; - case 2: - mmc->caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA; - break; - default: - break; - } writel(0, host->base + REG_INTERRUPT_MASK); From patchwork Mon Oct 24 11:28:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8536 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp416561wru; Mon, 24 Oct 2022 05:11:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5WYJrYKL9lvybipmCPihu/YRZEZoj3jS666hnX+lRuXcGVOuNUvQqeCp+mFq+5Cyfez2Oa X-Received: by 2002:a17:906:9c83:b0:779:c14c:55e4 with SMTP id fj3-20020a1709069c8300b00779c14c55e4mr26560803ejc.619.1666613513670; Mon, 24 Oct 2022 05:11:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613513; cv=none; d=google.com; s=arc-20160816; b=Rnp3LqMoacdBg7Jhyn8TbdNDsF8Rcq4IFK8n21B3NDmcjZcldm4D3G4u2gxZWlPPG+ MW/YjXzOaif4Ufy8bbB5bheCnZOF/gI6lzmrsNj+SOPRolnayEbTbnfyu1xcvIEPQKeY WAr/0Q+5xDg6CuxtaZ4VnFRrBSWeMjmnGUPqMQSYqxYSX50IcDZXxwsmSm91C3gBLFdv sEEdox4fFRT2xxCw+e/xRkQCxdStyxivLGeTSRn4TE9cZ0R2/9AVPR1CFjxRCux514ZD VfJ/prtjukoNMIdHKmAAjjdatz/gxr6t29kAKNOOy4kVo+baAKVCK2u/RLr0cRikJoT3 h8Gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=b/FK18Y46e1j7LY1mfoxyazWgaugW1Q17GCl3JgwCsY=; b=l20/aH+EDw9sOkKY7eaXJyO5CDbGpKi4eFxo+zYGjNovwfuC0C3ioQe5YFEMrcKzTq 6kwV1KTOKgRO+XPoQ0G8b8Vw/R/CBx6PO1GewMmTIUr4u/gM3Bz0wCo1+zNVnhUKjfOh GVFwXuN4viuCU94RHI+VeM2uFVDdmCpg3h2shpnDcKY4Fj8o2LlYPcKZfLSf4f2kpCl1 8k5cE6Hm0a2XZ8mId21QkrHRWQstS6T+7TjqBNWor3CVaeXLmRUUJ3RxB0Y13jaLozLD nz6YUi/QwSfTFohxBuKwqU0PVMjcDKMTNOvPYSBiE3zYzcfJcsEQ7YDF3bcwU2xunlWu AzXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vOZSiTBW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j11-20020aa7de8b000000b004593fb0c125si23460993edv.103.2022.10.24.05.11.29; Mon, 24 Oct 2022 05:11:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vOZSiTBW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232249AbiJXL6g (ORCPT + 99 others); Mon, 24 Oct 2022 07:58:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232329AbiJXL5H (ORCPT ); Mon, 24 Oct 2022 07:57:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DC317B291; Mon, 24 Oct 2022 04:46:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B613F6127C; Mon, 24 Oct 2022 11:46:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CEEB9C433D6; Mon, 24 Oct 2022 11:46:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612009; bh=K/c6XQ+gFvyQ0ATbI42PrHcCDyBqGeoD3Q9VPyxm/AA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vOZSiTBWO+jsS6p27NZUk+k63TQC1TO2cXVRtq/irVcdiwhVbn4LkOCZo4wTOLtnj 9fDEzhhDdxlvgcHWdOS8la2IlKPOvkn+/VFjmmajTYz4N9yJtCn17x5K+YhIEqzdUx +mhf6lmCfJxys3OuhVIaiN0OMPf2gJ5cJQnRov2s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mel Gorman , Patrick Daly , Michal Hocko , David Hildenbrand , Andrew Morton Subject: [PATCH 4.14 007/210] mm/page_alloc: fix race condition between build_all_zonelists and page allocation Date: Mon, 24 Oct 2022 13:28:44 +0200 Message-Id: <20221024112957.107712342@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747570931486170261?= X-GMAIL-MSGID: =?utf-8?q?1747570931486170261?= From: Mel Gorman commit 3d36424b3b5850bd92f3e89b953a430d7cfc88ef upstream. Patrick Daly reported the following problem; NODE_DATA(nid)->node_zonelists[ZONELIST_FALLBACK] - before offline operation [0] - ZONE_MOVABLE [1] - ZONE_NORMAL [2] - NULL For a GFP_KERNEL allocation, alloc_pages_slowpath() will save the offset of ZONE_NORMAL in ac->preferred_zoneref. If a concurrent memory_offline operation removes the last page from ZONE_MOVABLE, build_all_zonelists() & build_zonerefs_node() will update node_zonelists as shown below. Only populated zones are added. NODE_DATA(nid)->node_zonelists[ZONELIST_FALLBACK] - after offline operation [0] - ZONE_NORMAL [1] - NULL [2] - NULL The race is simple -- page allocation could be in progress when a memory hot-remove operation triggers a zonelist rebuild that removes zones. The allocation request will still have a valid ac->preferred_zoneref that is now pointing to NULL and triggers an OOM kill. This problem probably always existed but may be slightly easier to trigger due to 6aa303defb74 ("mm, vmscan: only allocate and reclaim from zones with pages managed by the buddy allocator") which distinguishes between zones that are completely unpopulated versus zones that have valid pages not managed by the buddy allocator (e.g. reserved, memblock, ballooning etc). Memory hotplug had multiple stages with timing considerations around managed/present page updates, the zonelist rebuild and the zone span updates. As David Hildenbrand puts it memory offlining adjusts managed+present pages of the zone essentially in one go. If after the adjustments, the zone is no longer populated (present==0), we rebuild the zone lists. Once that's done, we try shrinking the zone (start+spanned pages) -- which results in zone_start_pfn == 0 if there are no more pages. That happens *after* rebuilding the zonelists via remove_pfn_range_from_zone(). The only requirement to fix the race is that a page allocation request identifies when a zonelist rebuild has happened since the allocation request started and no page has yet been allocated. Use a seqlock_t to track zonelist updates with a lockless read-side of the zonelist and protecting the rebuild and update of the counter with a spinlock. [akpm@linux-foundation.org: make zonelist_update_seq static] Link: https://lkml.kernel.org/r/20220824110900.vh674ltxmzb3proq@techsingularity.net Fixes: 6aa303defb74 ("mm, vmscan: only allocate and reclaim from zones with pages managed by the buddy allocator") Signed-off-by: Mel Gorman Reported-by: Patrick Daly Acked-by: Michal Hocko Reviewed-by: David Hildenbrand Cc: [4.9+] Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- mm/page_alloc.c | 53 +++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 43 insertions(+), 10 deletions(-) --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3567,6 +3567,30 @@ void fs_reclaim_release(gfp_t gfp_mask) EXPORT_SYMBOL_GPL(fs_reclaim_release); #endif +/* + * Zonelists may change due to hotplug during allocation. Detect when zonelists + * have been rebuilt so allocation retries. Reader side does not lock and + * retries the allocation if zonelist changes. Writer side is protected by the + * embedded spin_lock. + */ +static DEFINE_SEQLOCK(zonelist_update_seq); + +static unsigned int zonelist_iter_begin(void) +{ + if (IS_ENABLED(CONFIG_MEMORY_HOTREMOVE)) + return read_seqbegin(&zonelist_update_seq); + + return 0; +} + +static unsigned int check_retry_zonelist(unsigned int seq) +{ + if (IS_ENABLED(CONFIG_MEMORY_HOTREMOVE)) + return read_seqretry(&zonelist_update_seq, seq); + + return seq; +} + /* Perform direct synchronous page reclaim */ static int __perform_reclaim(gfp_t gfp_mask, unsigned int order, @@ -3870,6 +3894,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, u int compaction_retries; int no_progress_loops; unsigned int cpuset_mems_cookie; + unsigned int zonelist_iter_cookie; int reserve_flags; /* @@ -3880,11 +3905,12 @@ __alloc_pages_slowpath(gfp_t gfp_mask, u (__GFP_ATOMIC|__GFP_DIRECT_RECLAIM))) gfp_mask &= ~__GFP_ATOMIC; -retry_cpuset: +restart: compaction_retries = 0; no_progress_loops = 0; compact_priority = DEF_COMPACT_PRIORITY; cpuset_mems_cookie = read_mems_allowed_begin(); + zonelist_iter_cookie = zonelist_iter_begin(); /* * The fast path uses conservative alloc_flags to succeed only until @@ -4032,9 +4058,13 @@ retry: goto retry; - /* Deal with possible cpuset update races before we start OOM killing */ - if (check_retry_cpuset(cpuset_mems_cookie, ac)) - goto retry_cpuset; + /* + * Deal with possible cpuset update races or zonelist updates to avoid + * a unnecessary OOM kill. + */ + if (check_retry_cpuset(cpuset_mems_cookie, ac) || + check_retry_zonelist(zonelist_iter_cookie)) + goto restart; /* Reclaim has failed us, start killing things */ page = __alloc_pages_may_oom(gfp_mask, order, ac, &did_some_progress); @@ -4054,9 +4084,13 @@ retry: } nopage: - /* Deal with possible cpuset update races before we fail */ - if (check_retry_cpuset(cpuset_mems_cookie, ac)) - goto retry_cpuset; + /* + * Deal with possible cpuset update races or zonelist updates to avoid + * a unnecessary OOM kill. + */ + if (check_retry_cpuset(cpuset_mems_cookie, ac) || + check_retry_zonelist(zonelist_iter_cookie)) + goto restart; /* * Make sure that __GFP_NOFAIL request doesn't leak out and make sure @@ -5167,9 +5201,8 @@ static void __build_all_zonelists(void * int nid; int __maybe_unused cpu; pg_data_t *self = data; - static DEFINE_SPINLOCK(lock); - spin_lock(&lock); + write_seqlock(&zonelist_update_seq); #ifdef CONFIG_NUMA memset(node_load, 0, sizeof(node_load)); @@ -5202,7 +5235,7 @@ static void __build_all_zonelists(void * #endif } - spin_unlock(&lock); + write_sequnlock(&zonelist_update_seq); } static noinline void __init From patchwork Mon Oct 24 11:28:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8574 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp418227wru; Mon, 24 Oct 2022 05:14:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7jbipeyxcovJmqAqQ12eZ3Ca2jQkNd0IxNm3xmd0Yo8qIralWIEmiBM3pQtxlb+qorFJz+ X-Received: by 2002:a17:907:d93:b0:78d:fe7a:f1fe with SMTP id go19-20020a1709070d9300b0078dfe7af1femr28054950ejc.721.1666613657740; Mon, 24 Oct 2022 05:14:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613657; cv=none; d=google.com; s=arc-20160816; b=JbLU0k6CTulJPX5Rp40QNGcEJ303xFcr8zrZqjNFpqvOoeMiE5872qw7K1aZBfzYD9 Mw/58GdPnI7g4fIiXyYjeJTfgY2CpI43ShNjR9TZ6sYRc0TykYMipga05BYI8Le6CGoC MEItn2iBWvLfZJtYsTRhxBEIlcTO55PPUElGkXy2D57/2g0jCnBE4eEs9Pbjrx0Q1wrZ 4MXk3rmAJ/ufS8OR6HlHCS4TB/FXTIBNHcCPNRBWVVBICLoV4gl7IGs0uy+dcsASCD3Q nLleW+lDRFVuwcU27IHEbuxIYcovQ5mbMWGpyQXwKfB2wwHBMyIk/y9HQbizPgfgyuRT fmAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HYgl/d2ndUncucSaa/sBDtMeBdn5gZa0kPfjGDjmtxc=; b=tkSuJFX5QZkpczzAJ2Xbq1wTdZjZ7QenW5zMybW5rtkpXNBRUmUSb6DwlxXQOoMImA wSCo1L8Kke3x0ghI5fN+19GI4FlbdXrYG7fe/+uON/kSAiIgenaVLC6NXoInFcKUz7He ibsoT72vaYKpe5JWRqEuTmY8blDrm92o+kc7K7p0OaGo/dX9QhjfVDzc61wxH5d+Duwu NasWMPv0UiawRDeChtcafvHqi6Sb60HF0ketYqorIYJjlU0S+7g0qZYzdFcBjlMraPrX SrjelN/Z+hFa8HqqIvdeNl3Xp5QtI3IQ6lkqHzG03ZknA/GBnbNA2MkCoHzj40bnKqQM Z0AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OSTTq83w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dp21-20020a170906c15500b0078df1c345dcsi34064598ejc.535.2022.10.24.05.13.52; Mon, 24 Oct 2022 05:14:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OSTTq83w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232554AbiJXMC5 (ORCPT + 99 others); Mon, 24 Oct 2022 08:02:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232784AbiJXL7w (ORCPT ); Mon, 24 Oct 2022 07:59:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 281957CA8B; Mon, 24 Oct 2022 04:48:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5C5C1612A4; Mon, 24 Oct 2022 11:46:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B07BC433C1; Mon, 24 Oct 2022 11:46:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612011; bh=bqt6m1xLhtyg7igUxTT0mC5o4h7myk1GVhOnPHbzFAE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OSTTq83wf82BsAi0l+uWAh59MPwsxiSOX44wWHhZ72p61mr/FgqONDDK0HxNjA/vD cl79YFqMKfOhl+ysA+YA+eNT6E7yYHYp6Il5CmemiWuizKouLbxbgEbwbvYxFGkxXd 1QhbgZyznnGVledpsrSiyCt16iiK/26WVPRPrpPY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maurizio Lombardi , Alexander Duyck , Chen Lin , Jakub Kicinski , Andrew Morton Subject: [PATCH 4.14 008/210] mm: prevent page_frag_alloc() from corrupting the memory Date: Mon, 24 Oct 2022 13:28:45 +0200 Message-Id: <20221024112957.152189709@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571083013328222?= X-GMAIL-MSGID: =?utf-8?q?1747571083013328222?= From: Maurizio Lombardi commit dac22531bbd4af2426c4e29e05594415ccfa365d upstream. A number of drivers call page_frag_alloc() with a fragment's size > PAGE_SIZE. In low memory conditions, __page_frag_cache_refill() may fail the order 3 cache allocation and fall back to order 0; In this case, the cache will be smaller than the fragment, causing memory corruptions. Prevent this from happening by checking if the newly allocated cache is large enough for the fragment; if not, the allocation will fail and page_frag_alloc() will return NULL. Link: https://lkml.kernel.org/r/20220715125013.247085-1-mlombard@redhat.com Fixes: b63ae8ca096d ("mm/net: Rename and move page fragment handling from net/ to mm/") Signed-off-by: Maurizio Lombardi Reviewed-by: Alexander Duyck Cc: Chen Lin Cc: Jakub Kicinski Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- mm/page_alloc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4391,6 +4391,18 @@ refill: /* reset page count bias and offset to start of new frag */ nc->pagecnt_bias = PAGE_FRAG_CACHE_MAX_SIZE + 1; offset = size - fragsz; + if (unlikely(offset < 0)) { + /* + * The caller is trying to allocate a fragment + * with fragsz > PAGE_SIZE but the cache isn't big + * enough to satisfy the request, this may + * happen in low memory conditions. + * We don't release the cache page because + * it could make memory pressure worse + * so we simply return NULL here. + */ + return NULL; + } } nc->pagecnt_bias--; From patchwork Mon Oct 24 11:28:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8571 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp418130wru; Mon, 24 Oct 2022 05:14:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Ag0va0H/OfV+hnn6ZE1h3/r7O1uueRRuS4sSutvpDRrW5+jq7qfyl9WRmNQs+ACgNZ1AE X-Received: by 2002:a17:907:1c9b:b0:78d:af10:1a80 with SMTP id nb27-20020a1709071c9b00b0078daf101a80mr27187747ejc.582.1666613649700; Mon, 24 Oct 2022 05:14:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613649; cv=none; d=google.com; s=arc-20160816; b=n+M5J2K6dYWoGlGfnORjwxJKEQEkOfbzfLt0SIkebjcV5fMp2q4/SlBCE3Hz7t5YMj A3KRXjSw7k733UV4dtrgVmPPwG3pgSYD9QxHrgyDzQ+GaytMJaD9ae16TqUGaWzBBa8W NUVbIdMuPyGLnb3/PjNitjR4GpK/2GltliKf4cxCjVjpoCvjjC0pOXsuKttny5CWplMi 8MEfkWlakl56DeYAnJ4Sc//JSTvV5Mt+7kAzXhEAp1yeetGkchqZFKOWwoKYMJYc/K+k ldv/MZ+/uO2oLSmcQ+jlDNC/9P4mgm+On2IvPZVb1B19qvuV5XFiePaR53HWtU0LC4VA TG+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NquElzENuAN1w5XKH9Awsp20RFq3RlH9Nu6YqGR+CWg=; b=vNY4mXRSPLjAgc8z4XsQlHObL5toAyCDhR15dKKFM1zBLpi5a89mpB7szHx4/HqttP pqcxPsMAbruqbA0tAn29qJ+FOVleLbc+4zsIpjrU+JfQtj3TT8PflbCnl0ZqgGpzjDew s+GjYZxqTZVbVWaA1mOlPen9ulw77hR/p1KozU3SNcJuJXDt8czB5VcodwS3aKpwnZdo VkiPHLo47dx4pV7BCr7MHlS/uHu4Fuf9wnt3SkGHMMu3JcCGX6HI9BSutMFZyb3wgxTo 4WuOqe/8bZBDdUpjnWfqG9v/KN6Oj82IturoFrGqmwME6vPclKmARMelIlcee6PV5rPI ycLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wstHEply; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b8-20020a0564021f0800b00461b0566a29si3529649edb.137.2022.10.24.05.13.44; Mon, 24 Oct 2022 05:14:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wstHEply; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232545AbiJXMFf (ORCPT + 99 others); Mon, 24 Oct 2022 08:05:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232498AbiJXMDn (ORCPT ); Mon, 24 Oct 2022 08:03:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D95B82529A; Mon, 24 Oct 2022 04:49:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 160E661297; Mon, 24 Oct 2022 11:46:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC2F4C433C1; Mon, 24 Oct 2022 11:46:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612014; bh=jhLDQTT4TMT/PEN5WFUx8lDz+PpXY7GMiLZ2aEmsCXc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wstHEplyTeePBHY9czhAmpdBhzlSqpqglyEk3AC068+HhOGl7CVt5ZfpXrwwFP1AV 2CGkSUrJBrT2R1sjGtJZt7m1Y7wOe0/vB2zSvgeAghGh47JbmToQg572FMWTQb9oYI 7PKuWKeeBLzd+It7hsYD+61Yf5ScLqOWoSDw/JWc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alistair Popple , Nadav Amit , "Huang, Ying" , David Hildenbrand , Peter Xu , Alex Sierra , Ben Skeggs , Felix Kuehling , huang ying , Jason Gunthorpe , John Hubbard , Karol Herbst , Logan Gunthorpe , Lyude Paul , Matthew Wilcox , Paul Mackerras , Ralph Campbell , Andrew Morton Subject: [PATCH 4.14 009/210] mm/migrate_device.c: flush TLB while holding PTL Date: Mon, 24 Oct 2022 13:28:46 +0200 Message-Id: <20221024112957.183720272@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571074154197151?= X-GMAIL-MSGID: =?utf-8?q?1747571074154197151?= From: Alistair Popple commit 60bae73708963de4a17231077285bd9ff2f41c44 upstream. When clearing a PTE the TLB should be flushed whilst still holding the PTL to avoid a potential race with madvise/munmap/etc. For example consider the following sequence: CPU0 CPU1 ---- ---- migrate_vma_collect_pmd() pte_unmap_unlock() madvise(MADV_DONTNEED) -> zap_pte_range() pte_offset_map_lock() [ PTE not present, TLB not flushed ] pte_unmap_unlock() [ page is still accessible via stale TLB ] flush_tlb_range() In this case the page may still be accessed via the stale TLB entry after madvise returns. Fix this by flushing the TLB while holding the PTL. Fixes: 8c3328f1f36a ("mm/migrate: migrate_vma() unmap page from vma while collecting pages") Link: https://lkml.kernel.org/r/9f801e9d8d830408f2ca27821f606e09aa856899.1662078528.git-series.apopple@nvidia.com Signed-off-by: Alistair Popple Reported-by: Nadav Amit Reviewed-by: "Huang, Ying" Acked-by: David Hildenbrand Acked-by: Peter Xu Cc: Alex Sierra Cc: Ben Skeggs Cc: Felix Kuehling Cc: huang ying Cc: Jason Gunthorpe Cc: John Hubbard Cc: Karol Herbst Cc: Logan Gunthorpe Cc: Lyude Paul Cc: Matthew Wilcox Cc: Paul Mackerras Cc: Ralph Campbell Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- mm/migrate.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/mm/migrate.c +++ b/mm/migrate.c @@ -2349,13 +2349,14 @@ next: migrate->dst[migrate->npages] = 0; migrate->src[migrate->npages++] = mpfn; } - arch_leave_lazy_mmu_mode(); - pte_unmap_unlock(ptep - 1, ptl); /* Only flush the TLB if we actually modified any entries */ if (unmapped) flush_tlb_range(walk->vma, start, end); + arch_leave_lazy_mmu_mode(); + pte_unmap_unlock(ptep - 1, ptl); + return 0; } From patchwork Mon Oct 24 11:28:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8552 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp417097wru; Mon, 24 Oct 2022 05:12:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6C/RzocyG1rpptImhuR34BoLGg3L2AcpSzkdrkO1zkmCd2Qg8PvtnChOITrVufsE+EEmLJ X-Received: by 2002:a05:6402:540d:b0:450:bda7:f76e with SMTP id ev13-20020a056402540d00b00450bda7f76emr30641276edb.249.1666613557259; Mon, 24 Oct 2022 05:12:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613557; cv=none; d=google.com; s=arc-20160816; b=q1ZGOdHxBQYB96CZAXXTgQsqieURKsBv2LXP2oVavJ5N+iiswmbrD4Erxu/molT/fP 3UPfkNIzmwnCY1K9QUi6NOuw6zLY0YhQQW+J8wMBdFE9Hz326+f1/1pt3CuSFR69z/xu /VZ0R/wA8fLwk51ilOUKeToc0rxvBtzrFIdn3z6civ+6qFOAnH8VslscbsxWMP5dv38x nJ7ntvEVp9piXMPEfydMVI/sG+BojE79yKCNAVCpsaosH6b9Y8/3JjCBug4CSFh8n0xK XGJPLENb27NAwk9rj5rvbOU/7WG08FC5PjorHB0DIyptkmtkceXj4879l5IxssyjFTaz 6YlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Mff6Wq2CHDJjuHXooZbjA5R9abR1cVLwkQ6ZvK/C0iI=; b=ZJacfrZmPjSZmuKB6GfDryor3PKuZWUyAksxm4aYBi+btLHadKkvngwgi2iSGrz+3K qeP0poyKqKUBFxvDVVU69pI295+v8uicficFuTxjGt1mewc2FrK2kMq7qP2chus9tbFO MaXycEf4duDADSIm/7WJKWavOCRPtRfOd7+1ed5BeN5TYNG6Hwv+H1hmPN0mtl8IDCmr ZRCmBRjgWsFw1PUz5hqcLRn/RiVcB2idTEH/ZTWOr9Pxi2VD5axTEC1iomxzRo992Vx4 IRLA3CWwCT8EbLntTrY5Uwu3zCnlwupb3xsgl3mk3mmR3P7PoelcxHxCrvNiq1gyT4rI kDnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=15Xvcaeg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z14-20020a05640240ce00b00461b8e2c7f4si3814959edb.548.2022.10.24.05.12.13; Mon, 24 Oct 2022 05:12:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=15Xvcaeg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232276AbiJXMAV (ORCPT + 99 others); Mon, 24 Oct 2022 08:00:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230372AbiJXL62 (ORCPT ); Mon, 24 Oct 2022 07:58:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 286D67C1BB; Mon, 24 Oct 2022 04:47:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7820EB8113A; Mon, 24 Oct 2022 11:45:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE9EBC433D6; Mon, 24 Oct 2022 11:45:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611941; bh=bv+YjerPCNsSGuoXywI9SmTXpCLVVrrMngsjwcsVIM0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=15Xvcaegzk2rwwH57XeJT3iqaqfx7qLd3rALYTmgwX3hH0F8uhhxef24vcMRoSL60 JXKML8p7POrv9szbZD5yX9rur6ejLnbuPNXZRnM6GAyD1f5KnVGoy1mXMMXh4wqbcp LCo0VS1mVbluvm3g6EZlczHdC1fXPDU4Ty2KpPgA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jernej Skrabec , Samuel Holland , Heiko Stuebner , Sasha Levin Subject: [PATCH 4.14 010/210] soc: sunxi: sram: Actually claim SRAM regions Date: Mon, 24 Oct 2022 13:28:47 +0200 Message-Id: <20221024112957.223383204@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747570977585784204?= X-GMAIL-MSGID: =?utf-8?q?1747570977585784204?= From: Samuel Holland [ Upstream commit fd362baad2e659ef0fb5652f023a606b248f1781 ] sunxi_sram_claim() checks the sram_desc->claimed flag before updating the register, with the intent that only one device can claim a region. However, this was ineffective because the flag was never set. Fixes: 4af34b572a85 ("drivers: soc: sunxi: Introduce SoC driver to map SRAMs") Reviewed-by: Jernej Skrabec Signed-off-by: Samuel Holland Reviewed-by: Heiko Stuebner Tested-by: Heiko Stuebner Signed-off-by: Jernej Skrabec Link: https://lore.kernel.org/r/20220815041248.53268-4-samuel@sholland.org Signed-off-by: Sasha Levin --- drivers/soc/sunxi/sunxi_sram.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/soc/sunxi/sunxi_sram.c b/drivers/soc/sunxi/sunxi_sram.c index 882be5ed7e84..97bb4d8007ff 100644 --- a/drivers/soc/sunxi/sunxi_sram.c +++ b/drivers/soc/sunxi/sunxi_sram.c @@ -253,6 +253,7 @@ int sunxi_sram_claim(struct device *dev) writel(val | ((device << sram_data->offset) & mask), base + sram_data->reg); + sram_desc->claimed = true; spin_unlock(&sram_lock); return 0; From patchwork Mon Oct 24 11:28:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8539 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp416675wru; Mon, 24 Oct 2022 05:12:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Wi2Iw+dAki6cM01Qu6CV2rwcc7XMQvqcblBl21kCygRClu1c4o1kcV8ssuWPJ/O5gxQjU X-Received: by 2002:a05:6402:40c7:b0:461:ecdb:1c41 with SMTP id z7-20020a05640240c700b00461ecdb1c41mr1465072edb.288.1666613525795; Mon, 24 Oct 2022 05:12:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613525; cv=none; d=google.com; s=arc-20160816; b=PtKtqrQ6Rn1C2R6HnN1psS1CJjHvXVARnGYv6dRr2nddFikCfUvQ09g+JAJN3U8CuT oHMtVKhNRZ8mFYl8WT/xq7TRQDqLb1uwnKJcWtXkYyp0hMkfAZewigr5fujhSgFbQk6V EpvGXq7ev/u2dcYcxl52WWlS5uAUi5dxUl9mvSLzlLYpOMs2qDg5pqlN+S2xiIANK17V 72PggHZnCNHUJSgzItQBU8oglhbNQN17urqbGnHbghu+UDE6UXx9Y6AFyxYBnSOfBAcq VKnzuHa+TZgE3OnNAUnrGXyWVKrjTw1xPdesWcAuzJ6d2PC541/FsSKmY235M48stxht 4xPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SQPrH7pdTTRcmshdHd52+RTo/glKDq3LPlynRpSyF2Q=; b=pwHR2dS1TNiIiTQm+EDU8NgXtD6Fsl+wvwcfvjI6F1xPurCYaRn3LC+Nw4d30yfohG 4Zg948KjyswkCuNDGhTywpWUdywpgAZYVnQ6YeeHscgG/Sp+fyhnBM3pM6ZqF/9mCeon fOGfnnqeadwflkuLbHF8wZG0T7KX8xrVZSl80pgHsQehE4q0fdWw4uc1Qpr5tv3w2esR mnqfBUAzpYqPUkDzjz27iSmDBYN7l4/oKjreH9zH/DK6Pv9cUEd1DY9vAq+DqXAmSfiP C0nVmic3bBnag0x/ImF35b9XE+bVrCDumPpJJTam3gIqxun8EZNnuaFYVyt0+l9ApDMr oTiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dakrno5R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l26-20020a17090615da00b00741a18d4a5asi22645022ejd.994.2022.10.24.05.11.41; Mon, 24 Oct 2022 05:12:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dakrno5R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230243AbiJXMAG (ORCPT + 99 others); Mon, 24 Oct 2022 08:00:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232382AbiJXL6F (ORCPT ); Mon, 24 Oct 2022 07:58:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FE626705D; Mon, 24 Oct 2022 04:47:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 583A761259; Mon, 24 Oct 2022 11:45:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C5EDC433D6; Mon, 24 Oct 2022 11:45:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611943; bh=Ps87XqJ8mTOOkz04phuBnhuydhHkO87uQG18sIDCFtU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dakrno5RGnm8ZYoxS/HCH1FHZbz3BD4l0ALY8rJVgiEfZ4/dHVKeuOSLfH8mCE6Dd Bv4FFG/aU6evEu6syPvjqpFNih3dWfmVS+O8wxbqJt6ukz0U8fWo7xBEGaE8txO/fF LFXKUvAn5Nt/T3NzannB7BXmq0F+MjcU6pLL7VDM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jernej Skrabec , Samuel Holland , Sasha Levin Subject: [PATCH 4.14 011/210] soc: sunxi: sram: Fix debugfs info for A64 SRAM C Date: Mon, 24 Oct 2022 13:28:48 +0200 Message-Id: <20221024112957.263749971@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747570944474453044?= X-GMAIL-MSGID: =?utf-8?q?1747570944474453044?= From: Samuel Holland [ Upstream commit e3c95edb1bd8b9c2cb0caa6ae382fc8080f6a0ed ] The labels were backward with respect to the register values. The SRAM is mapped to the CPU when the register value is 1. Fixes: 5e4fb6429761 ("drivers: soc: sunxi: add support for A64 and its SRAM C") Acked-by: Jernej Skrabec Signed-off-by: Samuel Holland Signed-off-by: Jernej Skrabec Link: https://lore.kernel.org/r/20220815041248.53268-7-samuel@sholland.org Signed-off-by: Sasha Levin --- drivers/soc/sunxi/sunxi_sram.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/soc/sunxi/sunxi_sram.c b/drivers/soc/sunxi/sunxi_sram.c index 97bb4d8007ff..3a0396395e70 100644 --- a/drivers/soc/sunxi/sunxi_sram.c +++ b/drivers/soc/sunxi/sunxi_sram.c @@ -71,8 +71,8 @@ static struct sunxi_sram_desc sun4i_a10_sram_d = { static struct sunxi_sram_desc sun50i_a64_sram_c = { .data = SUNXI_SRAM_DATA("C", 0x4, 24, 1, - SUNXI_SRAM_MAP(0, 1, "cpu"), - SUNXI_SRAM_MAP(1, 0, "de2")), + SUNXI_SRAM_MAP(1, 0, "cpu"), + SUNXI_SRAM_MAP(0, 1, "de2")), }; static const struct of_device_id sunxi_sram_dt_ids[] = { From patchwork Mon Oct 24 11:28:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8570 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp418127wru; Mon, 24 Oct 2022 05:14:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6b31dlE+cR3b6HHP8dIlVi9KVO0cL5IJHtAQLRvAN7aae5PegpdNdX4O63sHN8CH11fCar X-Received: by 2002:a05:6402:27d4:b0:45d:a69e:336d with SMTP id c20-20020a05640227d400b0045da69e336dmr30205267ede.298.1666613649446; Mon, 24 Oct 2022 05:14:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613649; cv=none; d=google.com; s=arc-20160816; b=j2TvR9ZJ8Yc5VZ8rsW7abiMovcm+hMltmFMYlQRtAwUR+jiTBeOyEUskI1G9WQMVhI b4c50Zup5xK6m/Gmzg5sofLESxB5zuVHAKv9E7KlKu3btpQS1yvgcOvYXxxs+Pdomhj5 t9ign9nXc0RjBK5itoEyzyBCGAphRUwiH3Qb/3Bo9a29gT+pM2eNPPGokaD9Lho5cXxj otKGuSPNagvgEQW7gIINFin3dLhbUSMvuWh+8BFmCOI9PY55duZCCzo7UDZuCmXbLJoo 52HA11ta1ppiHv8elwni4Q8LB2IYyLP4Q+XVFEM9GRrW2hGR02OngQ8cRIedpQ2my4ie PftQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uoS/6oczMVGHQdwNJ7amyCw34AmpXyZ+8lSmHv88iKA=; b=Di9gYLTTOYa6kS9XZEHpLNpBJArbr0D9YJ5Q+p23flNJyz4y002M+ocT+kUw9Rqe/b +Pbubdv9QlDFAcAO/8PI7u36xh6+IcfE3MyEdbXY0tCvXO8v1e30bBmGQIXv/JJzey7c +TMwuSYi5YI/5po8R+WS4uAtCzHg5BvhIPilAGVrEw1sUZHwWc+jbXJTgxtJZtHbVCTl xnfllVJhXHMEk8SG/LWfPWqFAmSZnZTu3uxVz//uONSsBzWzwbwKyWdU4ioglcnETMkE 6S7n4VOZOgaeNT1xSitQfY6Wsg62FXHlIpsaSoFVa8Pl6lH1RawHXoxvVtjdKSwZpYU9 Bc7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GGwfbzzB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g11-20020a1709065d0b00b007a4feae7adesi4294211ejt.837.2022.10.24.05.13.44; Mon, 24 Oct 2022 05:14:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GGwfbzzB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232537AbiJXMCg (ORCPT + 99 others); Mon, 24 Oct 2022 08:02:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232679AbiJXL7f (ORCPT ); Mon, 24 Oct 2022 07:59:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C4D3760DD; Mon, 24 Oct 2022 04:48:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F27CF61254; Mon, 24 Oct 2022 11:45:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11C62C433D6; Mon, 24 Oct 2022 11:45:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611946; bh=0r9yXMGtHSXuCCuQ4goaoaQXrHdS/+jB9HWLemhsNQo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GGwfbzzB0TYTNBqzWyEEV5t3EzbDhPhr321M/yIUDYd3Sf70uEef8f3nq3TyIDl8w XpfS7bzDClVwN0R6hzD57fdUnodeozWHaNYm5QjWNKLL90HjJwV85TvdEMsqczSrWn uCrWZ/vlhiWTsNplpEI+ZMkEossAAJ6uWnlWKygw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Norris , Douglas Anderson , Sasha Levin Subject: [PATCH 4.14 012/210] Revert "drm: bridge: analogix/dp: add panel prepare/unprepare in suspend/resume time" Date: Mon, 24 Oct 2022 13:28:49 +0200 Message-Id: <20221024112957.299670862@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571074059947075?= X-GMAIL-MSGID: =?utf-8?q?1747571074059947075?= From: Brian Norris [ Upstream commit cc62d98bd56d45de4531844ca23913a15136c05b ] This reverts commit 211f276ed3d96e964d2d1106a198c7f4a4b3f4c0. For quite some time, core DRM helpers already ensure that any relevant connectors/CRTCs/etc. are disabled, as well as their associated components (e.g., bridges) when suspending the system. Thus, analogix_dp_bridge_{enable,disable}() already get called, which in turn call drm_panel_{prepare,unprepare}(). This makes these drm_panel_*() calls redundant. Besides redundancy, there are a few problems with this handling: (1) drm_panel_{prepare,unprepare}() are *not* reference-counted APIs and are not in general designed to be handled by multiple callers -- although some panel drivers have a coarse 'prepared' flag that mitigates some damage, at least. So at a minimum this is redundant and confusing, but in some cases, this could be actively harmful. (2) The error-handling is a bit non-standard. We ignored errors in suspend(), but handled errors in resume(). And recently, people noticed that the clk handling is unbalanced in error paths, and getting *that* right is not actually trivial, given the current way errors are mostly ignored. (3) In the particular way analogix_dp_{suspend,resume}() get used (e.g., in rockchip_dp_*(), as a late/early callback), we don't necessarily have a proper PM relationship between the DP/bridge device and the panel device. So while the DP bridge gets resumed, the panel's parent device (e.g., platform_device) may still be suspended, and so any prepare() calls may fail. So remove the superfluous, possibly-harmful suspend()/resume() handling of panel state. Fixes: 211f276ed3d9 ("drm: bridge: analogix/dp: add panel prepare/unprepare in suspend/resume time") Link: https://lore.kernel.org/all/Yv2CPBD3Picg%2FgVe@google.com/ Signed-off-by: Brian Norris Reviewed-by: Douglas Anderson Signed-off-by: Douglas Anderson Link: https://patchwork.freedesktop.org/patch/msgid/20220822180729.1.I8ac5abe3a4c1c6fd5c061686c6e883c22f69022c@changeid Signed-off-by: Sasha Levin --- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index 5855f17caf16..3a462240198a 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -1473,12 +1473,6 @@ int analogix_dp_suspend(struct device *dev) struct analogix_dp_device *dp = dev_get_drvdata(dev); clk_disable_unprepare(dp->clock); - - if (dp->plat_data->panel) { - if (drm_panel_unprepare(dp->plat_data->panel)) - DRM_ERROR("failed to turnoff the panel\n"); - } - return 0; } EXPORT_SYMBOL_GPL(analogix_dp_suspend); @@ -1494,13 +1488,6 @@ int analogix_dp_resume(struct device *dev) return ret; } - if (dp->plat_data->panel) { - if (drm_panel_prepare(dp->plat_data->panel)) { - DRM_ERROR("failed to setup the panel\n"); - return -EBUSY; - } - } - return 0; } EXPORT_SYMBOL_GPL(analogix_dp_resume); From patchwork Mon Oct 24 11:28:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8516 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp405553wru; Mon, 24 Oct 2022 04:57:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5DL3wlGNPeC0kngRehMeQnvoRjpyk75pFpeTNfMWWPFmMvzUlodzDi1ugCzhJaW0iJEk1v X-Received: by 2002:a17:902:ec83:b0:17c:afb3:d1ec with SMTP id x3-20020a170902ec8300b0017cafb3d1ecmr32893376plg.172.1666612625011; Mon, 24 Oct 2022 04:57:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612625; cv=none; d=google.com; s=arc-20160816; b=huKH5aRWcI/Xpa9MNTy89JxFqwK9jiYW2ZdbCrJzT3DAOPqPvSlYE0jtZv85n94wwA ypJyCpqztDJ0Iv5pDXrKD5xS35jCgPcHLbds9NuG9cytIA/0B1ICClpn/tj4vwTdwlRD XXhwPtyyvY3p2RElwFd/uM5BC71YlktJNiEmFGnXwXzoeDQQN8baaVZtKgmGMaZCh92P FEH93saXkAeNJgl4DI3Hk2dkMBbCFfjFC67/TCI7Sf23LUz/qDMXf26ozIm4ZpVl9Zf9 3VuYsxxM6Xrunx1a7w/OgHiTf7ZYyKTsi9tl6Fo7UxNX1g1LLMossKPe+fp5HN6j4I7t 6MKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Hul2CTZhC61tJSyLLkhgvL6h8RAA2//lM7gTXPP5Vuo=; b=SeC0vU0GG571MyPq5NoJB3kOb1U79tBFUpwsxsS6/WZzSpPA74BtKkUKywUwltE7mB MXGmbJjeMe389y3kW2Mlw4QXAb3YQNuZBp00dSsdQKu6G7tBRTGEwZSSVYQWYQcDLyHz TlVZi+FN3o0m+NLF7tS+OMeqQ0wK4WdyDYD7MJ/5GPPjEgUE8zRA+8euzSC3z/3LGSMx NzRvGXEoefIg4yHO+G5QEACQqjBovYTpQFRrwZWT9yqP4wUFT+0GRRh64O0upCUEVbtr 7XbQI97e8NtP9vsNDwuQMlQ9s6Iric+W+Eu7JCfz1d87JL9+4Gk0gdlGUVnoZytft11b 0gUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AaAVAT0n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h64-20020a638343000000b0046ef67cbb02si5151351pge.282.2022.10.24.04.56.51; Mon, 24 Oct 2022 04:57:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AaAVAT0n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232180AbiJXL41 (ORCPT + 99 others); Mon, 24 Oct 2022 07:56:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232453AbiJXLyq (ORCPT ); Mon, 24 Oct 2022 07:54:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BD8D792EA; Mon, 24 Oct 2022 04:45:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5DA5AB81147; Mon, 24 Oct 2022 11:45:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA1A0C433D6; Mon, 24 Oct 2022 11:45:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611949; bh=If2haa2kx6bY4bNNHjk4aARkFQXvhLrsziM+tWJAtCo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AaAVAT0njlsSwVwzUj0rNui1wuhRLODiST2P6hLy2V+LQDgBnEAPbvxypubr4Wy0k YVHCeZD/DgnSb1C8tSczry6jThehyRvkPwlMetFM8jChV2+GAgA5HNWrbWLAiJUCPd R/q3+LhyDZExnl3XPdgh5UsEDKL9zaFQpvhs3hTY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yang Yingliang , Dmitry Torokhov , Sasha Levin Subject: [PATCH 4.14 013/210] Input: melfas_mip4 - fix return value check in mip4_probe() Date: Mon, 24 Oct 2022 13:28:50 +0200 Message-Id: <20221024112957.346870488@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747570000186802858?= X-GMAIL-MSGID: =?utf-8?q?1747570000186802858?= From: Yang Yingliang [ Upstream commit a54dc27bd25f20ee3ea2009584b3166d25178243 ] devm_gpiod_get_optional() may return ERR_PTR(-EPROBE_DEFER), add a minus sign to fix it. Fixes: 6ccb1d8f78bd ("Input: add MELFAS MIP4 Touchscreen driver") Signed-off-by: Yang Yingliang Link: https://lore.kernel.org/r/20220924030715.1653538-1-yangyingliang@huawei.com Signed-off-by: Dmitry Torokhov Signed-off-by: Sasha Levin --- drivers/input/touchscreen/melfas_mip4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/melfas_mip4.c b/drivers/input/touchscreen/melfas_mip4.c index 05108c2fea93..633d7e1dc7d6 100644 --- a/drivers/input/touchscreen/melfas_mip4.c +++ b/drivers/input/touchscreen/melfas_mip4.c @@ -1469,7 +1469,7 @@ static int mip4_probe(struct i2c_client *client, const struct i2c_device_id *id) "ce", GPIOD_OUT_LOW); if (IS_ERR(ts->gpio_ce)) { error = PTR_ERR(ts->gpio_ce); - if (error != EPROBE_DEFER) + if (error != -EPROBE_DEFER) dev_err(&client->dev, "Failed to get gpio: %d\n", error); return error; From patchwork Mon Oct 24 11:28:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8903 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433960wru; Mon, 24 Oct 2022 05:51:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4P0Eqtza0365M3ALUJpT9/TQ0Jjk/qegzWT0C4whmdC+KFywX7i34BtFZFtLe80nLTMw64 X-Received: by 2002:a17:906:5a5b:b0:7a6:cbc7:4ca1 with SMTP id my27-20020a1709065a5b00b007a6cbc74ca1mr5365075ejc.544.1666615860340; Mon, 24 Oct 2022 05:51:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615860; cv=none; d=google.com; s=arc-20160816; b=jf8oC69OK0er2589exbqdKxCU2+jQI7NQI2yeUxgt/Q51LDddNdBFAma8D4BIKPXzN OzD0XaqG8TH5MO2PsWoob1oIBde0/Twv5BfyLbDeJktDexH1ymc/NRc3c81X9E3txlY4 5OzQekwuVfJf9941hzObfOW47gCg+hBfTIDo0eZL/HjyfnGI2daace2QpeBfhT3qpCxJ Z2LHMGfRkJzDL9SD/2gFPwhQYOPaty5C0ahf/LS4Bz30Cb8h1lMJ7755ymNTb9RaxKPm ZpVuUEVgzvh8+EpqVtqblag5F5/chBm9b+XbCV9bCDmRtsyANa/UjUW4Ka/dAus18Kym nLlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3vFOkGmUbFh+wjE2aJMnui6YA0VnbtpNliiUQjIAS+0=; b=VmTu+hWFU09Bra4K+EweNRake7//RxFNAk4sSSF/EC+9fAHd87iQg3Xi76ccx4ETXn xevtSpCh4chJnhGz5JJ6x2u0OI6igeY7ev4gWCA3dI7a3IMVWfeLmO8VFa0HigRuGljh nsgfYAsTGjdVop8WPfKGeU/Aev3vNw5RtuBveUrwtnPcpCWuJ1euLGGKkYNJJyZVRaz3 dSYb9DIKS/H7s1THSYNT/6Y+WQvtNOKXHJ1mXgVKv039dHBBeCFwfkkiYq6bnpwcpGaK 413xAdUq7lVTmIfcWJfqKZvvfKnXyZDp7zHkgPj+PwqlmfXecuW5VDc3njpqastLrX5I ptPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Fo5yRuJZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hd15-20020a170907968f00b007a7d37e4681si3281007ejc.845.2022.10.24.05.50.33; Mon, 24 Oct 2022 05:51:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Fo5yRuJZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234791AbiJXMt2 (ORCPT + 99 others); Mon, 24 Oct 2022 08:49:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234462AbiJXMox (ORCPT ); Mon, 24 Oct 2022 08:44:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EA848D0F8; Mon, 24 Oct 2022 05:09:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3489D612B7; Mon, 24 Oct 2022 11:45:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4994AC433C1; Mon, 24 Oct 2022 11:45:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611951; bh=Pn7N0lDbqubT2jqOC+Riwc4YjEZ/kjT5mCm8lUm7QKI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fo5yRuJZHWAGbrfDmRTtu7chlxQx86upJ4bfEt0YIvvZNnSZ6Ft07R5U5Yv9fcU15 CllOm85aTVxSskXPyCfYCsy5BIb5Qsz4AMuAfqp+rXbd5m4KcXmPXAa2Q4vHsW8l2A OKqCRog0ukusQFUoCrtaUeTT1WpLOexx1pJCjk1w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peilin Ye , Jakub Kicinski , Sasha Levin , syzbot+dcd3e13cf4472f2e0ba1@syzkaller.appspotmail.com Subject: [PATCH 4.14 014/210] usbnet: Fix memory leak in usbnet_disconnect() Date: Mon, 24 Oct 2022 13:28:51 +0200 Message-Id: <20221024112957.386708469@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573392624795350?= X-GMAIL-MSGID: =?utf-8?q?1747573392624795350?= From: Peilin Ye [ Upstream commit a43206156263fbaf1f2b7f96257441f331e91bb7 ] Currently usbnet_disconnect() unanchors and frees all deferred URBs using usb_scuttle_anchored_urbs(), which does not free urb->context, causing a memory leak as reported by syzbot. Use a usb_get_from_anchor() while loop instead, similar to what we did in commit 19cfe912c37b ("Bluetooth: btusb: Fix memory leak in play_deferred"). Also free urb->sg. Reported-and-tested-by: syzbot+dcd3e13cf4472f2e0ba1@syzkaller.appspotmail.com Fixes: 69ee472f2706 ("usbnet & cdc-ether: Autosuspend for online devices") Fixes: 638c5115a794 ("USBNET: support DMA SG") Signed-off-by: Peilin Ye Link: https://lore.kernel.org/r/20220923042551.2745-1-yepeilin.cs@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/usb/usbnet.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 69be3593bc0e..71b026277b30 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -1598,6 +1598,7 @@ void usbnet_disconnect (struct usb_interface *intf) struct usbnet *dev; struct usb_device *xdev; struct net_device *net; + struct urb *urb; dev = usb_get_intfdata(intf); usb_set_intfdata(intf, NULL); @@ -1614,7 +1615,11 @@ void usbnet_disconnect (struct usb_interface *intf) net = dev->net; unregister_netdev (net); - usb_scuttle_anchored_urbs(&dev->deferred); + while ((urb = usb_get_from_anchor(&dev->deferred))) { + dev_kfree_skb(urb->context); + kfree(urb->sg); + usb_free_urb(urb); + } if (dev->driver_info->unbind) dev->driver_info->unbind (dev, intf); From patchwork Mon Oct 24 11:28:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10315 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp657226wru; Mon, 24 Oct 2022 14:20:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5hPI67ne5NjNE41Vn976qgq7T2/lyhzQ/0Br9LMnT707LCA5hR02WzLWbvNJjcO/mLvcQt X-Received: by 2002:a17:90b:4c48:b0:20d:5c55:b8a8 with SMTP id np8-20020a17090b4c4800b0020d5c55b8a8mr41365975pjb.207.1666646430950; Mon, 24 Oct 2022 14:20:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666646430; cv=none; d=google.com; s=arc-20160816; b=kriZ5el4dFOnw4k4fI+RNAc5cQp2QYZGW42koyNAo+YXd7xe8FCWm4hhAUjLspNEQ0 /FX8k2bV0AIrE1D6CoQZFKM6WjpvyOxYzYttSF1Tfvw4qiaiVOWmUcboOKSjSBK4Mcrr 9n1YUOOauIweAwuEWpqAiUSRQDipvnK8LgPgZ5uwG2u9GpP7yYysW/Gc161KCZUYPUYl ZX6Fd6NuLpCdIT7WB8XJpv0HseNZagMiHqG8wbqMRRHq1fzJB3rNe2J1EHXbE/7Nzlum wJw45ZDVTRTC4JDszfFr909BNFLZqDUYa+QTKgy4ONJhA52fP6ERlhvyAZtSyj9K6/u4 RwFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OOc+easw/YpbBvbE++wvvs+xR8Doh9uyy+7JitDaMfw=; b=eu91lH7DW7Hq/k9s+IiO1cud9wnrKFooNvRqyEO4V976DJ9UjIMhe20fkQC9AfQ0wY woSNXxYeCB2jXngMCAfCTuj/RWLdTuv1vz0yTt+1jE6rvtqTSGsq2svXuXlfJvlVqto0 BYam7PVeDAEV27oRtzUNXTOxVOaAKvBYPvVU1pyinadvAEHKtn78eJ8m6IL5tw3t1tp2 Q8XYvWw32g18s57Y4xutpLg2Cl+KStzKdduwq5k2EbSYN5hEuXiUJNTcHIuwzM06wWdP RXl8UDqRcSC6gws5brBWdetF8d/dsfDKMKamvVk88PYp3WqRH2R7CFddy+HWzmqyv/Ts w/AA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2hsT4EGm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pf14-20020a17090b1d8e00b00212de1542cesi1200598pjb.92.2022.10.24.14.20.17; Mon, 24 Oct 2022 14:20:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2hsT4EGm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231869AbiJXVQD (ORCPT + 99 others); Mon, 24 Oct 2022 17:16:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232812AbiJXVPl (ORCPT ); Mon, 24 Oct 2022 17:15:41 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90D99153E34; Mon, 24 Oct 2022 12:21:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id D6282CE1331; Mon, 24 Oct 2022 11:45:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E27D4C433C1; Mon, 24 Oct 2022 11:45:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611954; bh=j8D/KeJTXJxe8JNBywbRj9NUB4PG3noMKhqa5JgyQlI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2hsT4EGmP8noBEkpFE3KXDiLKfW/IYg6A0rSCcvcE3oUc5s18kz7Z8S0o+nOgZuWA sXLppNXgygWHKia9u9B9ssnpXo8C8ev+mQlMoJB7F81nzjSu4SEy2QPlfbhLTi3p41 SeK8EKEVBhfMGACizzjd4udO22LmD+0IOaTWlOyU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chaitanya Kulkarni , Christoph Hellwig , Sasha Levin Subject: [PATCH 4.14 015/210] nvme: add new line after variable declatation Date: Mon, 24 Oct 2022 13:28:52 +0200 Message-Id: <20221024112957.418380442@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747605447868977364?= X-GMAIL-MSGID: =?utf-8?q?1747605447868977364?= From: Chaitanya Kulkarni [ Upstream commit f1c772d581843e3a14bbd62ef7e40b56fc307f27 ] Add a new line in functions nvme_pr_preempt(), nvme_pr_clear(), and nvme_pr_release() after variable declaration which follows the rest of the code in the nvme/host/core.c. No functional change(s) in this patch. Signed-off-by: Chaitanya Kulkarni Signed-off-by: Christoph Hellwig Stable-dep-of: c292a337d0e4 ("nvme: Fix IOC_PR_CLEAR and IOC_PR_RELEASE ioctls for nvme devices") Signed-off-by: Sasha Levin --- drivers/nvme/host/core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 2d95755092e3..487226531a7d 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1345,18 +1345,21 @@ static int nvme_pr_preempt(struct block_device *bdev, u64 old, u64 new, enum pr_type type, bool abort) { u32 cdw10 = nvme_pr_type(type) << 8 | (abort ? 2 : 1); + return nvme_pr_command(bdev, cdw10, old, new, nvme_cmd_resv_acquire); } static int nvme_pr_clear(struct block_device *bdev, u64 key) { u32 cdw10 = 1 | (key ? 1 << 3 : 0); + return nvme_pr_command(bdev, cdw10, key, 0, nvme_cmd_resv_register); } static int nvme_pr_release(struct block_device *bdev, u64 key, enum pr_type type) { u32 cdw10 = nvme_pr_type(type) << 8 | (key ? 1 << 3 : 0); + return nvme_pr_command(bdev, cdw10, key, 0, nvme_cmd_resv_release); } From patchwork Mon Oct 24 11:28:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8512 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp405361wru; Mon, 24 Oct 2022 04:56:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4tbnENPlvumnrF+1ag1uLLxbJG2UN9IDXiuerXTRlA10SI0XWd8aHXbJSSz8lWyWnJNVPp X-Received: by 2002:a17:90b:1e46:b0:20a:f9d8:1ff7 with SMTP id pi6-20020a17090b1e4600b0020af9d81ff7mr75557852pjb.34.1666612612957; Mon, 24 Oct 2022 04:56:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612612; cv=none; d=google.com; s=arc-20160816; b=g5Xf2Sdn0OGjh1RlB5qn0LRmfDrQjXuyd4Su00UW645kzYhOSsAuK75pPtPow54o76 pTfHyVKA3HVm2MKjjKSxPHlwniFLeXVGdLpKFmAcQtSzftaPMl1TTf2TTI6mEpTNeKOT zN07/EifjfpLv8QOHDHOusuTarjKkczMbkSsWu1eX20MCa3tjZoDLYbEgzudr6QrRuIx yQJwR4YYWnRxR9iMtQ01DnrhlaNxAnsHETuiS3pZ7g7F7LuFMHmAzhrzPrPrp0OStGM+ 0HPtEWuLWhqRJfnbQnI+RISRZwm52fVk5yRXpmu6Vy9iJuzP5E5TyAZbsFk9FdS7KTGK ivqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VoIMJXu2pgCsyfpLqLL0ZPh7IhlbnaC3yhta1oiMK7w=; b=CHz/qSOyQL8gv5o6H6UF2i31omZ3y9h5YoSpT2tbYeTMALMt263PIZL1PQeVAW+8YK IPO/kxv9Bw4TZsTNywjaaVKlD2/FJEhKnL6szSh+Dgfc02PBQrgWEFw7hK/Gxc0bOMnN B4bnLt0BkqZTNhbPsqCHjnC04skxQSM+D6MmJNW0MLeUtj4R//rNsmI9O5qSYEt6Tw6Y 93//33qhN9/zlDUVOaTAMflwG5TZcwRV5K27LDA+a6GWLyDKSfqy7tR4M9dFCfwAbpzB gMTbjp69zpLE6F0I8Qwg70Jd0mA+4eHvnYU7MKQsl4ENgmMsssybfZtZh/8Q++Y4lqZz JwtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="i7WNBwQ/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h13-20020a170902f54d00b00179f3da346bsi39552560plf.39.2022.10.24.04.56.39; Mon, 24 Oct 2022 04:56:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="i7WNBwQ/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231853AbiJXL4P (ORCPT + 99 others); Mon, 24 Oct 2022 07:56:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232435AbiJXLyp (ORCPT ); Mon, 24 Oct 2022 07:54:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBBF6DF63; Mon, 24 Oct 2022 04:45:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7099A6125A; Mon, 24 Oct 2022 11:45:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83822C433D6; Mon, 24 Oct 2022 11:45:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611956; bh=95LMK2FHYuR8VaWLz6tOG2RAGmB64KKoFO2DUTDnvdw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i7WNBwQ/jbxvkqyqpzkBTU65yEtvX6TB1q/XWmthC1V8yPE/tJBLduFwwNcGGBF9+ bKRJQEyuPINuHmp5g97Tywf5J7SzpNDWO1LJTH1nAwJj9zI6CzRqY1WGjJ2/7fZ8tV D7xr3m67HQed4g2jdFLULbVj2KudbBWM9t2uPhIU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Kelley , Christoph Hellwig , Sasha Levin Subject: [PATCH 4.14 016/210] nvme: Fix IOC_PR_CLEAR and IOC_PR_RELEASE ioctls for nvme devices Date: Mon, 24 Oct 2022 13:28:53 +0200 Message-Id: <20221024112957.457544589@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747569987399201835?= X-GMAIL-MSGID: =?utf-8?q?1747569987399201835?= From: Michael Kelley [ Upstream commit c292a337d0e45a292c301e3cd51c35aa0ae91e95 ] The IOC_PR_CLEAR and IOC_PR_RELEASE ioctls are non-functional on NVMe devices because the nvme_pr_clear() and nvme_pr_release() functions set the IEKEY field incorrectly. The IEKEY field should be set only when the key is zero (i.e, not specified). The current code does it backwards. Furthermore, the NVMe spec describes the persistent reservation "clear" function as an option on the reservation release command. The current implementation of nvme_pr_clear() erroneously uses the reservation register command. Fix these errors. Note that NVMe version 1.3 and later specify that setting the IEKEY field will return an error of Invalid Field in Command. The fix will set IEKEY when the key is zero, which is appropriate as these ioctls consider a zero key to be "unspecified", and the intention of the spec change is to require a valid key. Tested on a version 1.4 PCI NVMe device in an Azure VM. Fixes: 1673f1f08c88 ("nvme: move block_device_operations and ns/ctrl freeing to common code") Fixes: 1d277a637a71 ("NVMe: Add persistent reservation ops") Signed-off-by: Michael Kelley Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/host/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 487226531a7d..8e136867180a 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1351,14 +1351,14 @@ static int nvme_pr_preempt(struct block_device *bdev, u64 old, u64 new, static int nvme_pr_clear(struct block_device *bdev, u64 key) { - u32 cdw10 = 1 | (key ? 1 << 3 : 0); + u32 cdw10 = 1 | (key ? 0 : 1 << 3); - return nvme_pr_command(bdev, cdw10, key, 0, nvme_cmd_resv_register); + return nvme_pr_command(bdev, cdw10, key, 0, nvme_cmd_resv_release); } static int nvme_pr_release(struct block_device *bdev, u64 key, enum pr_type type) { - u32 cdw10 = nvme_pr_type(type) << 8 | (key ? 1 << 3 : 0); + u32 cdw10 = nvme_pr_type(type) << 8 | (key ? 0 : 1 << 3); return nvme_pr_command(bdev, cdw10, key, 0, nvme_cmd_resv_release); } From patchwork Mon Oct 24 11:28:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9607 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp529753wru; Mon, 24 Oct 2022 09:04:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM71pUAGxAgp8RRVAoPxf7nqv9kX1OpQ2Ecyq5XtL17XlL4W9UrdZMJ+AQCGaIqDSdhxGfBb X-Received: by 2002:a63:4904:0:b0:439:e6a4:a3b5 with SMTP id w4-20020a634904000000b00439e6a4a3b5mr27747064pga.182.1666627445751; Mon, 24 Oct 2022 09:04:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627445; cv=none; d=google.com; s=arc-20160816; b=mVf+AtfjwZWirML/sRwGWaSbnawrbOw+GI2SGqkeJuquc7qMuiAqv6Niz9n7nOOxk7 bviy99oLuOeamNFJzZnuLtx0RNCW8+Tl1MInMbAyzuUY6F3U120X6C50wSABNczcyOCF cfETVoZVYQDctcsobOjSm/QPO7CUo/CwABkFOhgujGqER7n9P6cr8SqVWHE/mikkTtrl V9L83002p8VBY8dtRi9tdMpP9niLiBvYi9gfYHjsgSa2+T6MtJfhBzeeji9JTgfzH6/J FeZ2wHpSlPJ9y69KppJaGAROZu5yU6Nt5RRLaZi35RgnXFvbcEGJppKRq9t6kLnlQ3gR NqIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7bspsmd9IMRuwGaeUz23LCgtyhfeTfDTOPOqx0F87ns=; b=EW3/KLZbHlwOE43KfGEcMeLhV3kJrvB/OJHc/V6VHfMZ2mp8mjSmKorTsN8EYFSnZN msf86ya/g6GMsQ+cIVzPx/cIWtKwiE8C2+Bf1XpA0e1H9JAKvs8WAD2kNwT18FjE2obu C+jn3QwNlK9FMN1RwUAt7YhaxnOXhkzHWbMVdgDcPvTGVZCTi0LVmx1YH4HZKf5QJCDD UPq6Pb8lOtmYMBJqhL//L2I8qYiEOchER9jbWcByRfZ8mNEvr+1VIY6Q4WJnwu67mRvT YYQAKAmbPsLXawYBFQp0kUj9JgwvNVRWdobWZ4cBc6hMCtF7BWcymJCqKY2FZX1OyOjh 9t5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ELWA4Ha6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l3-20020a170902f68300b001865f96f6f7si18100142plg.104.2022.10.24.09.03.49; Mon, 24 Oct 2022 09:04:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ELWA4Ha6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230510AbiJXQCh (ORCPT + 99 others); Mon, 24 Oct 2022 12:02:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232465AbiJXQBW (ORCPT ); Mon, 24 Oct 2022 12:01:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E360F111B8A; Mon, 24 Oct 2022 07:55:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B5E88B8117A; Mon, 24 Oct 2022 11:46:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FBA1C433C1; Mon, 24 Oct 2022 11:45:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611959; bh=HzWNp5YyPkS2fPfnmk/Ug6wOXveeiRA34eO/DWm4nXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ELWA4Ha6abEBOyxhxgjeaVsVuH1Lfi8y7ygCG0Gfr9qwnQCcoXZxgJtEHvbhqOw+A Bxl9m01hGCaEqjG/vWPYroIGSWe+oGmVF1UC2ndSfJgTk4uaU6bUpf3W7eTbrIe8P/ aeIb8scTrusiyyR8UWRJ/hSekqvef1b2TZzd4dik= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wang Yufen , Paolo Abeni , Sasha Levin Subject: [PATCH 4.14 017/210] selftests: Fix the if conditions of in test_extra_filter() Date: Mon, 24 Oct 2022 13:28:54 +0200 Message-Id: <20221024112957.496846444@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585540307153664?= X-GMAIL-MSGID: =?utf-8?q?1747585540307153664?= From: Wang Yufen [ Upstream commit bc7a319844891746135dc1f34ab9df78d636a3ac ] The socket 2 bind the addr in use, bind should fail with EADDRINUSE. So if bind success or errno != EADDRINUSE, testcase should be failed. Fixes: 3ca8e4029969 ("soreuseport: BPF selection functional test") Signed-off-by: Wang Yufen Link: https://lore.kernel.org/r/1663916557-10730-1-git-send-email-wangyufen@huawei.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- tools/testing/selftests/net/reuseport_bpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/reuseport_bpf.c b/tools/testing/selftests/net/reuseport_bpf.c index b5277106df1f..b0cc082fbb84 100644 --- a/tools/testing/selftests/net/reuseport_bpf.c +++ b/tools/testing/selftests/net/reuseport_bpf.c @@ -330,7 +330,7 @@ static void test_extra_filter(const struct test_params p) if (bind(fd1, addr, sockaddr_size())) error(1, errno, "failed to bind recv socket 1"); - if (!bind(fd2, addr, sockaddr_size()) && errno != EADDRINUSE) + if (!bind(fd2, addr, sockaddr_size()) || errno != EADDRINUSE) error(1, errno, "bind socket 2 should fail with EADDRINUSE"); free(addr); From patchwork Mon Oct 24 11:28:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8563 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp417746wru; Mon, 24 Oct 2022 05:13:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5M5loOv9CqjejVHY8fzi78as8vRLfxFE1Dsjh6NHLOKpUyzQAEv0V6FLJFLs73fxi8ENF1 X-Received: by 2002:a17:907:75d2:b0:7a0:72b8:236a with SMTP id jl18-20020a17090775d200b007a072b8236amr10341897ejc.47.1666613616124; Mon, 24 Oct 2022 05:13:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613616; cv=none; d=google.com; s=arc-20160816; b=X3ZDp4HsQNk0rDjtYUNssP0Bw6sS6Cv1qLI6LBGUQwb7w1+l2fcbva84RbZI8j21ym 3ClbpbQkoyI5OH3q9/nd91eUT/LM5nmlID13Tpyi0OfYti6pfmu1u2gPpTdtl/kOxzgi DdFaNjzslEys4cz+ZTWCy3aNQTl4M1vxQAKD+FPHh78WQA7PaJEnZ93/gDNrDi3vd4s+ lAZVo8mG8BREbXE7kZ0pN03rYaSiplUBrl1SsXPsChgjzIJ+bL0B+bf2R+cq7kOE2XRX 49zPWpoWCcyKHs22PTdI2i5wDaNIruPwn5B5H7GD6rJVRDSImrlyXZCyMyjfzkHit1CF kjmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Za1YqQIUwxj5dA7I2cQ4Ytn+hrLvfn/tvhTb0DlR6KU=; b=Hm6qzXkIVTBM1q+e3EXFCuqThK4GaK5BzI1iqE4Pr7bDvHZsXtT5j95i/Kecb/JC/P sZwEQtNhaJahmouhEhgUndPc2mvNPpO8PGzuw7z6EYg+JxqZRjUU/HU65el5+obOY/fz OfTqlIg7yMGvrssrGcGPe+fxuUJac3YGeaO6EeoFxnuQk/75ZRrZmZkB5QLU3hhNetYj i6Ot8ea9IJwfVpXeO3GX+qZsVUR1O1sUY2cTWT4kMDdCnmARUqfOFGSG8HzI5+msfQ3w addmu+7iIuHrsPwz5c26s0MIF9LZcyfDc6TZFNnyhbCVLKpNs3xJbCGNcmXqfCFUF4zK OSWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=R5CN6sUD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w16-20020a056402269000b004618ed2dfe2si6578050edd.6.2022.10.24.05.13.10; Mon, 24 Oct 2022 05:13:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=R5CN6sUD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232542AbiJXMCk (ORCPT + 99 others); Mon, 24 Oct 2022 08:02:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232706AbiJXL7m (ORCPT ); Mon, 24 Oct 2022 07:59:42 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 556057C32A; Mon, 24 Oct 2022 04:48:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 9B649CE1345; Mon, 24 Oct 2022 11:46:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6CFBC43470; Mon, 24 Oct 2022 11:46:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611962; bh=sZfDOB834hhSVuiDo3MCa/tqco0ZuFkXP+70BfAQrcg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R5CN6sUDsFGZWr+H3V6AfKJuY/GF4/0NNPXsZmkGXI7bKOhVAY6qkWxyLU+A4AS8I iKYXg66MkMqTyuyXX/+gKvkaMcOxN1rTcClqnON2exZqPtQxdweEXAzaDVkYL1q5A0 FN1du+Z8TETzVG8ZGdoG0ZYu6z9E+5bzfBflKS2E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lori Hikichi , Stephen Boyd , Sasha Levin Subject: [PATCH 4.14 018/210] clk: iproc: Minor tidy up of iproc pll data structures Date: Mon, 24 Oct 2022 13:28:55 +0200 Message-Id: <20221024112957.542806389@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571038822973687?= X-GMAIL-MSGID: =?utf-8?q?1747571038822973687?= From: Lori Hikichi [ Upstream commit b33db49783763e1b2a63b12fbe0e91fb7147a987 ] There were a few fields in the iproc pll data structures that were holding information that was not true state information. Using stack variables is sufficient and simplifies the structure. There are not any functional changes in this commit. Signed-off-by: Lori Hikichi Signed-off-by: Stephen Boyd Stable-dep-of: 1b24a132eba7 ("clk: iproc: Do not rely on node name for correct PLL setup") Signed-off-by: Sasha Levin --- drivers/clk/bcm/clk-iproc-pll.c | 83 ++++++++++++++------------------- 1 file changed, 36 insertions(+), 47 deletions(-) diff --git a/drivers/clk/bcm/clk-iproc-pll.c b/drivers/clk/bcm/clk-iproc-pll.c index 375d8dd80d45..0e858dbf2505 100644 --- a/drivers/clk/bcm/clk-iproc-pll.c +++ b/drivers/clk/bcm/clk-iproc-pll.c @@ -69,16 +69,6 @@ enum vco_freq_range { VCO_MAX = 4000000000U, }; -struct iproc_pll; - -struct iproc_clk { - struct clk_hw hw; - const char *name; - struct iproc_pll *pll; - unsigned long rate; - const struct iproc_clk_ctrl *ctrl; -}; - struct iproc_pll { void __iomem *status_base; void __iomem *control_base; @@ -88,9 +78,12 @@ struct iproc_pll { const struct iproc_pll_ctrl *ctrl; const struct iproc_pll_vco_param *vco_param; unsigned int num_vco_entries; +}; - struct clk_hw_onecell_data *clk_data; - struct iproc_clk *clks; +struct iproc_clk { + struct clk_hw hw; + struct iproc_pll *pll; + const struct iproc_clk_ctrl *ctrl; }; #define to_iproc_clk(hw) container_of(hw, struct iproc_clk, hw) @@ -263,6 +256,7 @@ static int pll_set_rate(struct iproc_clk *clk, unsigned int rate_index, u32 val; enum kp_band kp_index; unsigned long ref_freq; + const char *clk_name = clk_hw_get_name(&clk->hw); /* * reference frequency = parent frequency / PDIV @@ -285,19 +279,19 @@ static int pll_set_rate(struct iproc_clk *clk, unsigned int rate_index, kp_index = KP_BAND_HIGH_HIGH; } else { pr_err("%s: pll: %s has invalid rate: %lu\n", __func__, - clk->name, rate); + clk_name, rate); return -EINVAL; } kp = get_kp(ref_freq, kp_index); if (kp < 0) { - pr_err("%s: pll: %s has invalid kp\n", __func__, clk->name); + pr_err("%s: pll: %s has invalid kp\n", __func__, clk_name); return kp; } ret = __pll_enable(pll); if (ret) { - pr_err("%s: pll: %s fails to enable\n", __func__, clk->name); + pr_err("%s: pll: %s fails to enable\n", __func__, clk_name); return ret; } @@ -354,7 +348,7 @@ static int pll_set_rate(struct iproc_clk *clk, unsigned int rate_index, ret = pll_wait_for_lock(pll); if (ret < 0) { - pr_err("%s: pll: %s failed to lock\n", __func__, clk->name); + pr_err("%s: pll: %s failed to lock\n", __func__, clk_name); return ret; } @@ -390,16 +384,15 @@ static unsigned long iproc_pll_recalc_rate(struct clk_hw *hw, u32 val; u64 ndiv, ndiv_int, ndiv_frac; unsigned int pdiv; + unsigned long rate; if (parent_rate == 0) return 0; /* PLL needs to be locked */ val = readl(pll->status_base + ctrl->status.offset); - if ((val & (1 << ctrl->status.shift)) == 0) { - clk->rate = 0; + if ((val & (1 << ctrl->status.shift)) == 0) return 0; - } /* * PLL output frequency = @@ -421,14 +414,14 @@ static unsigned long iproc_pll_recalc_rate(struct clk_hw *hw, val = readl(pll->control_base + ctrl->pdiv.offset); pdiv = (val >> ctrl->pdiv.shift) & bit_mask(ctrl->pdiv.width); - clk->rate = (ndiv * parent_rate) >> 20; + rate = (ndiv * parent_rate) >> 20; if (pdiv == 0) - clk->rate *= 2; + rate *= 2; else - clk->rate /= pdiv; + rate /= pdiv; - return clk->rate; + return rate; } static long iproc_pll_round_rate(struct clk_hw *hw, unsigned long rate, @@ -518,6 +511,7 @@ static unsigned long iproc_clk_recalc_rate(struct clk_hw *hw, struct iproc_pll *pll = clk->pll; u32 val; unsigned int mdiv; + unsigned long rate; if (parent_rate == 0) return 0; @@ -528,11 +522,11 @@ static unsigned long iproc_clk_recalc_rate(struct clk_hw *hw, mdiv = 256; if (ctrl->flags & IPROC_CLK_MCLK_DIV_BY_2) - clk->rate = parent_rate / (mdiv * 2); + rate = parent_rate / (mdiv * 2); else - clk->rate = parent_rate / mdiv; + rate = parent_rate / mdiv; - return clk->rate; + return rate; } static long iproc_clk_round_rate(struct clk_hw *hw, unsigned long rate, @@ -583,10 +577,6 @@ static int iproc_clk_set_rate(struct clk_hw *hw, unsigned long rate, val |= div << ctrl->mdiv.shift; } iproc_pll_write(pll, pll->control_base, ctrl->mdiv.offset, val); - if (ctrl->flags & IPROC_CLK_MCLK_DIV_BY_2) - clk->rate = parent_rate / (div * 2); - else - clk->rate = parent_rate / div; return 0; } @@ -629,6 +619,8 @@ void iproc_pll_clk_setup(struct device_node *node, struct iproc_clk *iclk; struct clk_init_data init; const char *parent_name; + struct iproc_clk *iclk_array; + struct clk_hw_onecell_data *clk_data; if (WARN_ON(!pll_ctrl) || WARN_ON(!clk_ctrl)) return; @@ -637,14 +629,14 @@ void iproc_pll_clk_setup(struct device_node *node, if (WARN_ON(!pll)) return; - pll->clk_data = kzalloc(sizeof(*pll->clk_data->hws) * num_clks + - sizeof(*pll->clk_data), GFP_KERNEL); - if (WARN_ON(!pll->clk_data)) + clk_data = kzalloc(sizeof(*clk_data->hws) * num_clks + + sizeof(*clk_data), GFP_KERNEL); + if (WARN_ON(!clk_data)) goto err_clk_data; - pll->clk_data->num = num_clks; + clk_data->num = num_clks; - pll->clks = kcalloc(num_clks, sizeof(*pll->clks), GFP_KERNEL); - if (WARN_ON(!pll->clks)) + iclk_array = kcalloc(num_clks, sizeof(struct iproc_clk), GFP_KERNEL); + if (WARN_ON(!iclk_array)) goto err_clks; pll->control_base = of_iomap(node, 0); @@ -674,9 +666,8 @@ void iproc_pll_clk_setup(struct device_node *node, /* initialize and register the PLL itself */ pll->ctrl = pll_ctrl; - iclk = &pll->clks[0]; + iclk = &iclk_array[0]; iclk->pll = pll; - iclk->name = node->name; init.name = node->name; init.ops = &iproc_pll_ops; @@ -697,7 +688,7 @@ void iproc_pll_clk_setup(struct device_node *node, if (WARN_ON(ret)) goto err_pll_register; - pll->clk_data->hws[0] = &iclk->hw; + clk_data->hws[0] = &iclk->hw; /* now initialize and register all leaf clocks */ for (i = 1; i < num_clks; i++) { @@ -711,8 +702,7 @@ void iproc_pll_clk_setup(struct device_node *node, if (WARN_ON(ret)) goto err_clk_register; - iclk = &pll->clks[i]; - iclk->name = clk_name; + iclk = &iclk_array[i]; iclk->pll = pll; iclk->ctrl = &clk_ctrl[i]; @@ -727,11 +717,10 @@ void iproc_pll_clk_setup(struct device_node *node, if (WARN_ON(ret)) goto err_clk_register; - pll->clk_data->hws[i] = &iclk->hw; + clk_data->hws[i] = &iclk->hw; } - ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, - pll->clk_data); + ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data); if (WARN_ON(ret)) goto err_clk_register; @@ -739,7 +728,7 @@ void iproc_pll_clk_setup(struct device_node *node, err_clk_register: while (--i >= 0) - clk_hw_unregister(pll->clk_data->hws[i]); + clk_hw_unregister(clk_data->hws[i]); err_pll_register: if (pll->status_base != pll->control_base) @@ -756,10 +745,10 @@ void iproc_pll_clk_setup(struct device_node *node, iounmap(pll->control_base); err_pll_iomap: - kfree(pll->clks); + kfree(iclk_array); err_clks: - kfree(pll->clk_data); + kfree(clk_data); err_clk_data: kfree(pll); From patchwork Mon Oct 24 11:28:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8551 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp417070wru; Mon, 24 Oct 2022 05:12:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6l5DHYF1bbxHxNXa3lfw2WQCYy0vm4p+gHSgi50ZZ00dl3dZmUhAiO1vHLUUH9rENxNDuL X-Received: by 2002:a05:6402:5114:b0:45d:b850:a4e2 with SMTP id m20-20020a056402511400b0045db850a4e2mr29782125edd.316.1666613554788; Mon, 24 Oct 2022 05:12:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613554; cv=none; d=google.com; s=arc-20160816; b=H1/lkwiWrdYgnRlX7LjQ4DscOrU/btbA2BB5Aenvg7VO3rTvN56KH2RnMUM6WIlGjF WFb62sRAJOguOYDnxl5O+nFLOJ2VLN2nDEqNkcPgi5WBJIXaFjFnBSg4uC+ycUVXr6Ok sKNYHHEEz9s8YtsOwDsx1TWb/+xyc/cylvYitbHVmlndPb6f/ci/EkVt1Pz6FCMFcnfu HBSOYCHuD9o8S7aHQ+UUGCHfeBmEI2B66AUXWdp07oUU9LlccDvjSUzOc2EpRtpaEnf8 SHJT5+sfzSIi3mD/9RkEAhfBfukZzyDhnRbonSZXQOeN5J4G9KFyZicvcCrwKtmOLs9m BVFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EyKsbCRXhvavq8CHsNqJMK8wL0swR13JtvgRNc+jgC8=; b=H0ZcEnYRcfscN6pqj/BXx5AnT27znjRS3IriMImkCCv1T/pGkEM3s/sg9cZL9FWXGG x/uINZmhlNtP/BQRl5wmRm+20dQA/07KKtzxJ82NLfd+zJDHfdH1hoELOOjUZmbPrwMN SFKKlFJALKWZtrD/LHV2EwzEQe+1cjtT8LCvaTB8qbLucFclYt6QGPS0oK0qsoLTenbN onMOKhWncnHQRF6C50tmD/63DxA5bUNfqEbGGjs+OzRrHFWnMK+WaIczS4A8gLRMExAr YY5i7XyXUhXWCKbtAGX4m6mUDqYm23BoQNfhw/TsQMP2vRfGQuRAqoOAxhgqouLSQgmz P3Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WLFP1AGU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b18-20020a056402279200b00457137b2571si31011324ede.346.2022.10.24.05.12.10; Mon, 24 Oct 2022 05:12:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WLFP1AGU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232461AbiJXMBF (ORCPT + 99 others); Mon, 24 Oct 2022 08:01:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232460AbiJXL7A (ORCPT ); Mon, 24 Oct 2022 07:59:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6045E76477; Mon, 24 Oct 2022 04:47:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4B7C36125D; Mon, 24 Oct 2022 11:46:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F193C433D6; Mon, 24 Oct 2022 11:46:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611964; bh=d/xpHVEVIyaWlHQDxxHGdkYh53L4gC3suwuiCWj92YY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WLFP1AGUIeqYbA8FqVUSNEcQJ7VXAAcyznCbFo+t/NAK43zCieaduUM0zHECn+iQa zqCbQNURiOc4Pw1GFogXgGesH+GZC/elhv/+EG5vP00MqgaD3Dhl/+1jsSNqZqxJ/7 8ZGgqu3t5KI1jCv1yyLEwxfBC5TSKA6tiy5oO5Aw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= , Stephen Boyd , Sasha Levin Subject: [PATCH 4.14 019/210] clk: iproc: Do not rely on node name for correct PLL setup Date: Mon, 24 Oct 2022 13:28:56 +0200 Message-Id: <20221024112957.581294171@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747570975151974388?= X-GMAIL-MSGID: =?utf-8?q?1747570975151974388?= From: Florian Fainelli [ Upstream commit 1b24a132eba7a1c19475ba2510ec1c00af3ff914 ] After commit 31fd9b79dc58 ("ARM: dts: BCM5301X: update CRU block description") a warning from clk-iproc-pll.c was generated due to a duplicate PLL name as well as the console stopped working. Upon closer inspection it became clear that iproc_pll_clk_setup() used the Device Tree node unit name as an unique identifier as well as a parent name to parent all clocks under the PLL. BCM5301X was the first platform on which that got noticed because of the DT node unit name renaming but the same assumptions hold true for any user of the iproc_pll_clk_setup() function. The first 'clock-output-names' property is always guaranteed to be unique as well as providing the actual desired PLL clock name, so we utilize that to register the PLL and as a parent name of all children clock. Fixes: 5fe225c105fd ("clk: iproc: add initial common clock support") Signed-off-by: Florian Fainelli Acked-by: Rafał Miłecki Link: https://lore.kernel.org/r/20220905161504.1526-1-f.fainelli@gmail.com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/bcm/clk-iproc-pll.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/clk/bcm/clk-iproc-pll.c b/drivers/clk/bcm/clk-iproc-pll.c index 0e858dbf2505..2e59314522dd 100644 --- a/drivers/clk/bcm/clk-iproc-pll.c +++ b/drivers/clk/bcm/clk-iproc-pll.c @@ -621,6 +621,7 @@ void iproc_pll_clk_setup(struct device_node *node, const char *parent_name; struct iproc_clk *iclk_array; struct clk_hw_onecell_data *clk_data; + const char *clk_name; if (WARN_ON(!pll_ctrl) || WARN_ON(!clk_ctrl)) return; @@ -669,7 +670,12 @@ void iproc_pll_clk_setup(struct device_node *node, iclk = &iclk_array[0]; iclk->pll = pll; - init.name = node->name; + ret = of_property_read_string_index(node, "clock-output-names", + 0, &clk_name); + if (WARN_ON(ret)) + goto err_pll_register; + + init.name = clk_name; init.ops = &iproc_pll_ops; init.flags = 0; parent_name = of_clk_get_parent_name(node, 0); @@ -689,13 +695,11 @@ void iproc_pll_clk_setup(struct device_node *node, goto err_pll_register; clk_data->hws[0] = &iclk->hw; + parent_name = clk_name; /* now initialize and register all leaf clocks */ for (i = 1; i < num_clks; i++) { - const char *clk_name; - memset(&init, 0, sizeof(init)); - parent_name = node->name; ret = of_property_read_string_index(node, "clock-output-names", i, &clk_name); From patchwork Mon Oct 24 11:28:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9899 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp573404wru; Mon, 24 Oct 2022 10:38:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4PWiL80Fut2KHzL3pVNonQb1YGLTNTyD2qwZfboKbgTrJnDx4FJcSEm9LuWqcIduGZQpcb X-Received: by 2002:a63:2a8b:0:b0:46e:9fda:2171 with SMTP id q133-20020a632a8b000000b0046e9fda2171mr19668287pgq.106.1666633085143; Mon, 24 Oct 2022 10:38:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666633085; cv=none; d=google.com; s=arc-20160816; b=z/h7AOKEackTxxePSb3DdL3fx8QkvveVL15WNCMhszZvd54iZhNL7nZtlnnFU8X9TD hsYkf5tF7vlj3jGfkPWSP6Hv/wuLK272KjtZ9WRf9O185+JGDyB2+omYUgV1gGmKiktt hCjfJxYjF8TXc2W4HAWn8xfgyUMLHnHGVy8cxrYsDZB0SBqmIOBY8R00E0PRsWn32JLm DbpdPtQR4BGJFA9+OnZJXOXSx9LlAnMT+AFwMt1gOIUd8MgtfaA4UEtesvHbMwnUjTpE gQ0N/uGqBSNSIzUI4hD6+fz3EBL4ebx6t9zPXWxGkNUMaFIxrfVPRaOGvvyGaobbeIQ3 q+hQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Y41uHaWMfdqamAq84NIXaFQXBn/La0NcAlcnYskG0ZQ=; b=Pak8Uo+yAB11BbekwIicBDFb0XcQYE1qyCDxS7ctPWFOmBgwfLkAFL6GlseRmFPJGR 7ZzM/nXb6OoPHKknGnI2kYUIHdG+Nx9s1i64oHFZwBeKJ20koTplv4Ujrsxly4pxBwYU A3IEPc5Ub+7Uuwe1F8ZgtWEf7hxUgpgCrf0gRhLfilrktEB8MpNhqvhFCH9LggYUQbRc KdE3a/ftT/aMHQuKknKxCOond1XJnV7FzTZSWbKDhZdslruFuYOD4phOwKylH2SRBZ8q +fnkjc9k5aIBcbZJ70pPCUvXGfgjLQjwZd2OQJlXcInECgk2GDMhVj6RdiIrLKNyfFQv yFpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="p+TTl//k"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g190-20020a636bc7000000b004498b9c8d34si43753pgc.682.2022.10.24.10.37.52; Mon, 24 Oct 2022 10:38:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="p+TTl//k"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231130AbiJXRgu (ORCPT + 99 others); Mon, 24 Oct 2022 13:36:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233156AbiJXRg0 (ORCPT ); Mon, 24 Oct 2022 13:36:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F6001EEF28; Mon, 24 Oct 2022 09:11:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 31135B8119A; Mon, 24 Oct 2022 11:46:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FCA9C433D7; Mon, 24 Oct 2022 11:46:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611969; bh=fUXui3hNiQJBFOrbrz2xSQ/YsqpV42/0c9IkyRDduHY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p+TTl//keN4X9JAk7awoVUlw3mvo9VblBqD9lq46gBsEq3dYjQG8bpxwETyjt9kow D3TThEAmWeyGJp5yoQehAfwfDE8Z5S2OYbM4tadJTyBdYCRFQf82OHjljSoMr7raU9 /j6P7gM6XFoQj8TDuEGDLTN8kZR8MfSZLtZPUkSI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Sami Tolvanen , Kees Cook Subject: [PATCH 4.14 020/210] Makefile.extrawarn: Move -Wcast-function-type-strict to W=1 Date: Mon, 24 Oct 2022 13:28:57 +0200 Message-Id: <20221024112957.612369058@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747591453902838691?= X-GMAIL-MSGID: =?utf-8?q?1747591453902838691?= From: Sami Tolvanen commit 2120635108b35ecad9c59c8b44f6cbdf4f98214e upstream. We enable -Wcast-function-type globally in the kernel to warn about mismatching types in function pointer casts. Compilers currently warn only about ABI incompability with this flag, but Clang 16 will enable a stricter version of the check by default that checks for an exact type match. This will be very noisy in the kernel, so disable -Wcast-function-type-strict without W=1 until the new warnings have been addressed. Cc: stable@vger.kernel.org Link: https://reviews.llvm.org/D134831 Link: https://github.com/ClangBuiltLinux/linux/issues/1724 Suggested-by: Nathan Chancellor Signed-off-by: Sami Tolvanen Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/20220930203310.4010564-1-samitolvanen@google.com Signed-off-by: Greg Kroah-Hartman --- scripts/Makefile.extrawarn | 1 + 1 file changed, 1 insertion(+) --- a/scripts/Makefile.extrawarn +++ b/scripts/Makefile.extrawarn @@ -74,5 +74,6 @@ KBUILD_CFLAGS += $(call cc-disable-warni KBUILD_CFLAGS += $(call cc-disable-warning, uninitialized) KBUILD_CFLAGS += $(call cc-disable-warning, pointer-to-enum-cast) KBUILD_CFLAGS += $(call cc-disable-warning, unaligned-access) +KBUILD_CFLAGS += $(call cc-disable-warning, cast-function-type-strict) endif endif From patchwork Mon Oct 24 11:28:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8625 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp420391wru; Mon, 24 Oct 2022 05:18:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4HoFRov1auqe8WglSnIPzKyntDyb8X7ikLcPT7sf+mk5BN5XdTztQD4D2lKUBybF8OytjX X-Received: by 2002:a17:907:7da5:b0:78e:2c3b:55a2 with SMTP id oz37-20020a1709077da500b0078e2c3b55a2mr26944841ejc.96.1666613887001; Mon, 24 Oct 2022 05:18:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613886; cv=none; d=google.com; s=arc-20160816; b=BPrbJGiC8tdAbDMMDymLXD2HFgVl5wpGgRTDPQ8DI85VNFH763AfU60zIgjh1kNjL8 tlBfdxiHHa9gEWkS/qHf2URc/HYlS/HVXhQSZcx2/AG8HekTjhHvBAQPs267XaOJSnaf u50Vbo+BJWRzqyf5GvP/Vhh5Zv3YjGOyGILEdD04SMsGuRV7BM8ZHmd56X1LYb2buEo6 KMK8JYuKn5RpDI5VqellrQ1coEPh8cjNcFnlOEMADnzSdvdjtgPzr1dyB0MtHosEfgAA Hygpq6mthJyLr1swa6RWOUVrJeEE3OhFKXlyynRP2Q1uhFRtxN/cGd76iQBVBSwu6vvy 5q7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=m0ZCf/o+MNFXZEJA67CKj7lO7OLEvb/SOMwCUTLtyuc=; b=MG8Hoe7b9qL31GXsD8krK043DMEvyMslh8ayfbfn/hTLG1FCWnChdzT+0aI09T3ed6 V3GuSJklbYaShCQN+GR9yF3oDTxP9fzVOccJjqnIFU4PkzTa6laQbbhyzeh0PdkEfyIj UYJdKBN+u8iyXFlkT8BHv+yukziGBPqklty6S+5PEdJWtYrKh3U7EyHdIXOkgcZJI6u8 9Qcokm+hPySc2T4G3qu+Blbg1reMSnGsdNxMJ1kMBTjwxRJSzmNiykrwDehoeSREHQ/q eGPXO/P7Z85fh9Nyan1hT+lgHo7UmYzpVhe8Y7LFphCvW9uX/JdE4EW5d6HkX3RwLePc z+cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=l8tpyBib; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wu13-20020a170906eecd00b00780636887fesi31731916ejb.797.2022.10.24.05.17.43; Mon, 24 Oct 2022 05:18:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=l8tpyBib; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232711AbiJXMLg (ORCPT + 99 others); Mon, 24 Oct 2022 08:11:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229782AbiJXMKD (ORCPT ); Mon, 24 Oct 2022 08:10:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CAD12BB0A; Mon, 24 Oct 2022 04:53:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 29C516129E; Mon, 24 Oct 2022 11:46:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37632C433D6; Mon, 24 Oct 2022 11:46:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611972; bh=iafMQX0LLGAsrS6c7Ds92V5u8tPAuViCsplCLjBiFQs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l8tpyBib/eObZuC/jQB6lR2lLm8XFJGAIYMhB1b2UJ6Zo/89GV3IdLQu/H47YsJw9 8I25WGivDCfCoaGnGxnovfKe5mC5nHJrwHQ+tx/Rm0WNdHLzY0R4CDgU8pu9S9VQF1 m9GJcLL3RjnbfLG+wiCl9Oe5wJ8eYMuuqtlpHulk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Popov , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Wolfram Sang , Harshit Mogalapalli Subject: [PATCH 4.14 021/210] i2c: dev: prevent ZERO_SIZE_PTR deref in i2cdev_ioctl_rdwr() Date: Mon, 24 Oct 2022 13:28:58 +0200 Message-Id: <20221024112957.648694176@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571323620748402?= X-GMAIL-MSGID: =?utf-8?q?1747571323620748402?= From: Alexander Popov commit 23a27722b5292ef0b27403c87a109feea8296a5c upstream. i2cdev_ioctl_rdwr() allocates i2c_msg.buf using memdup_user(), which returns ZERO_SIZE_PTR if i2c_msg.len is zero. Currently i2cdev_ioctl_rdwr() always dereferences the buf pointer in case of I2C_M_RD | I2C_M_RECV_LEN transfer. That causes a kernel oops in case of zero len. Let's check the len against zero before dereferencing buf pointer. This issue was triggered by syzkaller. Signed-off-by: Alexander Popov Reviewed-by: Uwe Kleine-König [wsa: use '< 1' instead of '!' for easier readability] Signed-off-by: Wolfram Sang [Harshit: backport to 4.14.y, use rdwr_pa[i].len instead of msgs[i].len as the 4.14.y code uses rdwr_pa.] Signed-off-by: Harshit Mogalapalli Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/i2c-dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/i2c/i2c-dev.c +++ b/drivers/i2c/i2c-dev.c @@ -297,7 +297,7 @@ static noinline int i2cdev_ioctl_rdwr(st */ if (rdwr_pa[i].flags & I2C_M_RECV_LEN) { if (!(rdwr_pa[i].flags & I2C_M_RD) || - rdwr_pa[i].buf[0] < 1 || + rdwr_pa[i].len < 1 || rdwr_pa[i].buf[0] < 1 || rdwr_pa[i].len < rdwr_pa[i].buf[0] + I2C_SMBUS_BLOCK_MAX) { i++; From patchwork Mon Oct 24 11:28:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8520 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp405669wru; Mon, 24 Oct 2022 04:57:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7d0pqQehAO+iUZ8fU4aiRWwq2FwMk3ILgo1hdv7HSfVLjjeLsqENxnozGYqU1VNwcIZcqZ X-Received: by 2002:a17:90b:1e0c:b0:20f:bcbf:ab5 with SMTP id pg12-20020a17090b1e0c00b0020fbcbf0ab5mr36514903pjb.187.1666612647662; Mon, 24 Oct 2022 04:57:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612647; cv=none; d=google.com; s=arc-20160816; b=oTahjx42GGKlMZ4RICltyLUiEsLxurEdjjZ4gKFKk43MiIsHgxL+eqs5hEMAiQSB3Q 1VE+nGnbS9r579hRbYdEehQy/AeqNt1eO+svM8JIqCSHjHaPXUZotZNUgAHEnrib+ZPq FUoAw4+IvI9naGFW5w4cAy/EQzjKtCMIBUBm+WNYLo0YdPbzAZmG/Gh7/PXC9IRkNGI4 XKqeMMBg8t3w6ntoVvb1Yzi2auuibbI2+837Mv0PSadsV8U/YNue4iaVg3XnBp5kQYCs /HOyfgMNBqba6S9Sejs1m7dIZQdiPIb0BAbacbHY8N47nn0OLpLFM82UTJvCylTeqa8S JA+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xWrSDPC1xEscBQqnV403HYe1yFu5wdD3G04sxiBoY6A=; b=DlSkdOj0o/Dt4gGqPFyEDXWhZZ0GtjDJutl7pbwgACFtsTzsOrBz8L3T1yCnG5U8EN BMVst0QQc9YH9A4ZpxylOJsX+lpjaWmCsYQFU1FdYhE4tplVrK+g7URi9XtntcL8lljV 9YljaUkUAggv8NPJIVYTS8nHY9OUseVL3T5Od2EfVRcjkVa3UFHNq+l517K0GqIuIn9Y Q3TaNxQ0MMsSTkoqPDWbueI2dOi8W96WUEJievcddrjN2zk1JhE3Q6qLua0xGMR3o4v1 8MFhpqfxZGHm794pB27hGTrpHbppb+pgRtcQqRUJv5py80+YQuzBzK7ofY0B6ImSL+Ck vd6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="S/0eHq+s"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s6-20020a63b406000000b0043aa67c7d8esi32406278pgf.738.2022.10.24.04.57.13; Mon, 24 Oct 2022 04:57:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="S/0eHq+s"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232312AbiJXL4w (ORCPT + 99 others); Mon, 24 Oct 2022 07:56:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231975AbiJXLzT (ORCPT ); Mon, 24 Oct 2022 07:55:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 228AA79EF9; Mon, 24 Oct 2022 04:46:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7F01AB8117D; Mon, 24 Oct 2022 11:46:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2046C43470; Mon, 24 Oct 2022 11:46:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611975; bh=+900UaONJT/K41STI5zOtc2KJLQApWN4BewdicxVIWc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S/0eHq+sc1C25YI39pQL88TUpI9M+eeaTC1M929JcCVw3oJBpzBGIKDOYmO1HXmSp yRH6E9zgUlJTpoZsOXYcDk3gxp8dq1kcZwUehRkeh9khRcXNlGPx4rD80K8qW6xLqf 2iFpbHLFhOn8If8By2kStQy1/hOa+OH2a2y97IYA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masami Hiramatsu , Russell King , Sebastian Andrzej Siewior , Danilo Cezar Zanella Subject: [PATCH 4.14 022/210] ARM: fix function graph tracer and unwinder dependencies Date: Mon, 24 Oct 2022 13:28:59 +0200 Message-Id: <20221024112957.688929913@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747570023399802969?= X-GMAIL-MSGID: =?utf-8?q?1747570023399802969?= From: Russell King commit 503621628b32782a07b2318e4112bd4372aa3401 upstream. Naresh Kamboju recently reported that the function-graph tracer crashes on ARM. The function-graph tracer assumes that the kernel is built with frame pointers. We explicitly disabled the function-graph tracer when building Thumb2, since the Thumb2 ABI doesn't have frame pointers. We recently changed the way the unwinder method was selected, which seems to have made it more likely that we can end up with the function- graph tracer enabled but without the kernel built with frame pointers. Fix up the function graph tracer dependencies so the option is not available when we have no possibility of having frame pointers, and adjust the dependencies on the unwinder option to hide the non-frame pointer unwinder options if the function-graph tracer is enabled. Reviewed-by: Masami Hiramatsu Tested-by: Masami Hiramatsu Signed-off-by: Russell King Signed-off-by: Sebastian Andrzej Siewior Reported-by: Danilo Cezar Zanella Signed-off-by: Greg Kroah-Hartman --- arch/arm/Kconfig | 2 +- arch/arm/Kconfig.debug | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -63,7 +63,7 @@ config ARM select HAVE_EFFICIENT_UNALIGNED_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && MMU select HAVE_EXIT_THREAD select HAVE_FTRACE_MCOUNT_RECORD if (!XIP_KERNEL) - select HAVE_FUNCTION_GRAPH_TRACER if (!THUMB2_KERNEL) + select HAVE_FUNCTION_GRAPH_TRACER if (!THUMB2_KERNEL && !CC_IS_CLANG) select HAVE_FUNCTION_TRACER if (!XIP_KERNEL) select HAVE_FUTEX_CMPXCHG if FUTEX select HAVE_GCC_PLUGINS --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug @@ -18,8 +18,8 @@ config ARM_PTDUMP choice prompt "Choose kernel unwinder" - default UNWINDER_ARM if AEABI && !FUNCTION_GRAPH_TRACER - default UNWINDER_FRAME_POINTER if !AEABI || FUNCTION_GRAPH_TRACER + default UNWINDER_ARM if AEABI + default UNWINDER_FRAME_POINTER if !AEABI help This determines which method will be used for unwinding kernel stack traces for panics, oopses, bugs, warnings, perf, /proc//stack, @@ -36,7 +36,7 @@ config UNWINDER_FRAME_POINTER config UNWINDER_ARM bool "ARM EABI stack unwinder" - depends on AEABI + depends on AEABI && !FUNCTION_GRAPH_TRACER select ARM_UNWIND help This option enables stack unwinding support in the kernel From patchwork Mon Oct 24 11:29:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8742 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp427176wru; Mon, 24 Oct 2022 05:32:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7/rLj276VjUyB91ScyKFfMbmMFXPfCGqn6BOR0miNYHvhfvasCyp++TFN/Z8nOeGXFsZnU X-Received: by 2002:a05:6402:2947:b0:451:32a:2222 with SMTP id ed7-20020a056402294700b00451032a2222mr30171532edb.376.1666614777276; Mon, 24 Oct 2022 05:32:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614777; cv=none; d=google.com; s=arc-20160816; b=ljdo/+YAnQWNdg9bQqV54pNzH2m9F9PNfvyypKfw1a9LiWR2IMsrwyaaCTH/d7ml1e S6tst6Wp+T1jjrlWBe+DvrRZhZzRZ+lJdlKwYe8wo9U6OEZkKwXyCJluql8swpR0OuWq wa02MPgu+dUTr+wg81ruIvCqdGEyFzN/pECQf7GyOct4TWWeBl0p+cxiMT2IqXYIQ1a8 sgAqn9YIYbg85GIfWNr58x7/143WYSWJfFGToHHtQU31nZpsWEevY1gd6tWhL0XPKNhV 2ii8pBH3iYtBARBDzYzVvt7u4rDF6H/xfEi2zHvm6BNpAuT2ftX0xNYJJXuqHRv3yJOJ BXEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cdEeemcQPWRYp52IVJQkTdS4ZBGC+i/9stMn/yqQ9IQ=; b=VlpsCBgyGkMsbSo21zGBNkC2V0t1bNtLd+nOvvpOpRyLWTT8Ki5F/lCgffPdYeYc1k pCkmpbqfWnmmZsSQqSEi8Q13iqJMzv0ikosMKSHdq4gSS0AM7E1IaFLK8q0g+WvcKWZn 1KWOL3Axmdp3YCWl8DQss+zFwO5gULYY6q/17pbj12qZS9AVWRIQ2YBIEynzbmOspT7n L0ifj1brbRVN6Y/0283Oe+rAlGhtFZrl6o8aXAOR1jCBHMpV/NLoqRoUZ1MNb0cfvjKt Z0mwzaAxM6f+95P5GYTXVXrknHEv5gw9QwkMjFzfB5MYdBT9xKXkpAZNiRxq7KHxJLUG jAcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nxaYOUH8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t11-20020a1709067c0b00b0078a3ef9f092si25462767ejo.998.2022.10.24.05.32.23; Mon, 24 Oct 2022 05:32:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nxaYOUH8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233730AbiJXM2K (ORCPT + 99 others); Mon, 24 Oct 2022 08:28:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233742AbiJXM1G (ORCPT ); Mon, 24 Oct 2022 08:27:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D0A2857D0; Mon, 24 Oct 2022 05:01:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 20225B81031; Mon, 24 Oct 2022 11:46:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 762D6C433D7; Mon, 24 Oct 2022 11:46:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611977; bh=Cp7+DWlpUZah8k86BOmAXEwfQ215gZeltIl98Wd2g/c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nxaYOUH8vnpY3j2vEHT1rhGbpdubRHBUS/0zf8j7rUJN8ry1reXe+m0mhWTa0CPEQ aMEG/k6GnNm2qvr8Gs0t/ezEschSCDMJpF9QOC507UliCzYKMLMXqZkzxs6Zjq2gye c9lYrySmRChlJoa177CzaJBCzBDWFMOFWJNGpnj0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, butt3rflyh4ck , Hao Sun , Jiacheng Xu , "Christian Brauner (Microsoft)" , Dongliang Mu , Al Viro Subject: [PATCH 4.14 023/210] fs: fix UAF/GPF bug in nilfs_mdt_destroy Date: Mon, 24 Oct 2022 13:29:00 +0200 Message-Id: <20221024112957.719455844@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572256278891655?= X-GMAIL-MSGID: =?utf-8?q?1747572256278891655?= From: Dongliang Mu commit 2e488f13755ffbb60f307e991b27024716a33b29 upstream. In alloc_inode, inode_init_always() could return -ENOMEM if security_inode_alloc() fails, which causes inode->i_private uninitialized. Then nilfs_is_metadata_file_inode() returns true and nilfs_free_inode() wrongly calls nilfs_mdt_destroy(), which frees the uninitialized inode->i_private and leads to crashes(e.g., UAF/GPF). Fix this by moving security_inode_alloc just prior to this_cpu_inc(nr_inodes) Link: https://lkml.kernel.org/r/CAFcO6XOcf1Jj2SeGt=jJV59wmhESeSKpfR0omdFRq+J9nD1vfQ@mail.gmail.com Reported-by: butt3rflyh4ck Reported-by: Hao Sun Reported-by: Jiacheng Xu Reviewed-by: Christian Brauner (Microsoft) Signed-off-by: Dongliang Mu Cc: Al Viro Cc: stable@vger.kernel.org Signed-off-by: Al Viro Signed-off-by: Greg Kroah-Hartman --- fs/inode.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) --- a/fs/inode.c +++ b/fs/inode.c @@ -165,8 +165,6 @@ int inode_init_always(struct super_block inode->i_wb_frn_history = 0; #endif - if (security_inode_alloc(inode)) - goto out; spin_lock_init(&inode->i_lock); lockdep_set_class(&inode->i_lock, &sb->s_type->i_lock_key); @@ -194,11 +192,12 @@ int inode_init_always(struct super_block inode->i_fsnotify_mask = 0; #endif inode->i_flctx = NULL; + + if (unlikely(security_inode_alloc(inode))) + return -ENOMEM; this_cpu_inc(nr_inodes); return 0; -out: - return -ENOMEM; } EXPORT_SYMBOL(inode_init_always); From patchwork Mon Oct 24 11:29:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8556 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp417297wru; Mon, 24 Oct 2022 05:12:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5DptJFFz0qhReg5GyOoK5Gg+y1v3mQr614Zem7xqqFopKCm72VjGMhsRrmF5rswPV3wZJ5 X-Received: by 2002:aa7:cb87:0:b0:43b:e650:6036 with SMTP id r7-20020aa7cb87000000b0043be6506036mr31007066edt.350.1666613575022; Mon, 24 Oct 2022 05:12:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613575; cv=none; d=google.com; s=arc-20160816; b=thb4/6qvK84mhIvp246ezJaPIcqxIHHziQaPIStn1ts8E+9E48gbd6M+MQXi7LVxPi IVS5fyF8S28CYhdeL7olWUcmT1begmJbmMnZnEg3GE/P+sEoThTLZcMFcvZJYUCOx1ng mfeYr8+0biwg22DqTOLsxCwmTjGQ1TiL3PEj9Az8RX6IQLvbkb3ktIDPJocUpmQnPLF9 IassyXlpH9ESqEqJaa+HjOa/MeWUqTS21hghbCRDSl2lohLDJLepicjIJMd1/j0Dr6kG s+vIOKrgecwCnM+MPBml73G2lIZU+BAuZYnlsha5F+FojmvWEXAnRpWOipxkRXEqvQG+ Rhug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=11NUN6jEexHCNTPp9yBI0Q4zfXzDYibTGlhuYOAxiJk=; b=sjftF1mCB2y0/2ZLiRhLComI+QhUkiRjDOlafmX1IqKZB4g9LG/c/G8mGQy2ly1P2J 8kfPL5kchSDeuWTDml9SxS8Xf4CZc3AQJHVaMY6gkHZyL7uyK77kVqA2qKus8VbRMYIb uJH30p0PhWLq/dq0kZEFN7JiQaflAFh+VBOQdpQ7wxwroHLffjOOukXbrHLCFdEhMg7F ySzY6nCb1kwwORsJeMQ/nawp5swylyRTHGjAznOmaN4UgKM22eJpkfT80B8FG7JfQylb jw9wXFitGdBsuO+843NRinrjPp9hVo3eRIRe30hLiioWmqv98tlBX35UZtrF7jI4KsuH CwFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Yp8KJlFv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sb36-20020a1709076da400b0078dd22dd569si29398261ejc.121.2022.10.24.05.12.27; Mon, 24 Oct 2022 05:12:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Yp8KJlFv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232218AbiJXMCN (ORCPT + 99 others); Mon, 24 Oct 2022 08:02:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232642AbiJXL71 (ORCPT ); Mon, 24 Oct 2022 07:59:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45DD07C752; Mon, 24 Oct 2022 04:48:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 049096127D; Mon, 24 Oct 2022 11:46:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 166A0C433D6; Mon, 24 Oct 2022 11:46:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611980; bh=JMY2yHIJQoF20ytPxniJHlxxD17968IV8wAg1htep04=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yp8KJlFv6KQGcqVctKAmhFCp1eFKXQ64mlwpiQ3GYjHRw5MLCjy+jU4Fe7sRzlV7M JhG1F/OtOCXKlvBkmRfTMCB0hgg1JbFT7z7SBEcqKr3laXPO7VReZrbzOIv/QP1V7S Ptp00NHCPTiTV095R1BnKFixjcvpmBzlxkE2hjhk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Swati Agarwal , Vinod Koul , Sasha Levin Subject: [PATCH 4.14 024/210] dmaengine: xilinx_dma: cleanup for fetching xlnx,num-fstores property Date: Mon, 24 Oct 2022 13:29:01 +0200 Message-Id: <20221024112957.750056464@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747570995829561081?= X-GMAIL-MSGID: =?utf-8?q?1747570995829561081?= From: Swati Agarwal [ Upstream commit 462bce790e6a7e68620a4ce260cc38f7ed0255d5 ] Free the allocated resources for missing xlnx,num-fstores property. Signed-off-by: Swati Agarwal Link: https://lore.kernel.org/r/20220817061125.4720-3-swati.agarwal@xilinx.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/xilinx/xilinx_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c index 3c2084766a31..9319349e69d2 100644 --- a/drivers/dma/xilinx/xilinx_dma.c +++ b/drivers/dma/xilinx/xilinx_dma.c @@ -2565,7 +2565,7 @@ static int xilinx_dma_probe(struct platform_device *pdev) if (err < 0) { dev_err(xdev->dev, "missing xlnx,num-fstores property\n"); - return err; + goto disable_clks; } err = of_property_read_u32(node, "xlnx,flush-fsync", From patchwork Mon Oct 24 11:29:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8823 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431274wru; Mon, 24 Oct 2022 05:43:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5HALXcM3eNpTUWNPY4EISthWKYkIaNAr6QpMrpkiM8VsFyw6qheVZjbBK6mxjrVTr7OzW8 X-Received: by 2002:a17:907:7f20:b0:7aa:acf9:c07f with SMTP id qf32-20020a1709077f2000b007aaacf9c07fmr1193653ejc.559.1666615403080; Mon, 24 Oct 2022 05:43:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615403; cv=none; d=google.com; s=arc-20160816; b=CQrKGAv5jagNZvWVo0fW7lbDuIEAR6snY9Z5pUIgR1IUBzmiu+zX/EG/uSisgGT8Vi 3EVJFZqMAz2jSOmddF5HY8HI+Di0ckmakXXrkuPjVfUcnoN0OpBFkQHoF+btlthY2eaW vAyD9d7M6SHar4q9xwpQj0xQBilyUEnOwHr+kTYyS8MLLpuOBenIn83mATvgMcx5lVh6 Ncw4cNMX/jo6jX4U7LJR/HBCmR2kazsmP2S9bxe0vfd3pZCn5kHCeGKzwaumQZKPpyRB 1PpqkbZKlxKMMRFi5Leshc/SjcZriOwCWAEUnBTHEhV+f0gEbKma9M4J3k4/GCXJR7ww 6DaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=R3RiossygA40w9O9uKZDg18URhruYXLYQttWw6JjPn0=; b=zkqQinBzydLhSVShIJGB6ElS9gk5/hatsiaZgozfDHSmEg3ryoKmtqravGhFvxmZma pVcn8lSdemHiA2jr/2JbLWgJxPZipzBfhJZgr7Q1HUtutFDyo9CHbi6b32NcHjfjlNXF wNDiXEQ7fT/wo+iz2+/TcMTg2v9QcwM7AH7fnv7SPQTlijtlzCgSiR+4xbZyArNbdzMS NYOFRgWi3WFJfl5FzpnBl9vcm8D3Fudmp2QYv4CZZ5bGj4krw5r+pI9RqEwL+AOzb4xO owo8LpIby3GVNwD79jcnBcDOAQx6eCN+KzduQxCa5LN4kSDY1QOkmnSha002H4RHTIIn EvUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tSJ3IOrt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dr4-20020a170907720400b00782393c36cfsi3401023ejc.336.2022.10.24.05.42.48; Mon, 24 Oct 2022 05:43:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tSJ3IOrt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230432AbiJXMg3 (ORCPT + 99 others); Mon, 24 Oct 2022 08:36:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234344AbiJXMaF (ORCPT ); Mon, 24 Oct 2022 08:30:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16CB631EF6; Mon, 24 Oct 2022 05:03:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4CDB6B81147; Mon, 24 Oct 2022 11:46:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA6F3C433C1; Mon, 24 Oct 2022 11:46:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611983; bh=MLYHlpHej6WatiXz/o2H6bBtG1Sl1y9g5508EWQT3AE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tSJ3IOrtDzEZvQBbwx9rJcNxfYfjGlV9H95S64Ja0Qv2MJEZtYon4y/qAV7NTTVAC PueHDq44VSt57bhukZiy2QgzqBO9bhRSzhNI/QG/kLjjVR8aXcDUwUW+f6UlkHVVZv jnimvtUmhwY9ukAgETvfbaEruOK4JtLS/MoCsmQw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Swati Agarwal , Radhey Shyam Pandey , Vinod Koul , Sasha Levin Subject: [PATCH 4.14 025/210] dmaengine: xilinx_dma: Report error in case of dma_set_mask_and_coherent API failure Date: Mon, 24 Oct 2022 13:29:02 +0200 Message-Id: <20221024112957.780094879@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572913333046513?= X-GMAIL-MSGID: =?utf-8?q?1747572913333046513?= From: Swati Agarwal [ Upstream commit 8f2b6bc79c32f0fa60df000ae387a790ec80eae9 ] The driver does not handle the failure case while calling dma_set_mask_and_coherent API. In case of failure, capture the return value of API and then report an error. Addresses-coverity: Unchecked return value (CHECKED_RETURN) Signed-off-by: Swati Agarwal Reviewed-by: Radhey Shyam Pandey Link: https://lore.kernel.org/r/20220817061125.4720-4-swati.agarwal@xilinx.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/xilinx/xilinx_dma.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c index 9319349e69d2..b4d00bc461db 100644 --- a/drivers/dma/xilinx/xilinx_dma.c +++ b/drivers/dma/xilinx/xilinx_dma.c @@ -2585,7 +2585,11 @@ static int xilinx_dma_probe(struct platform_device *pdev) xdev->ext_addr = false; /* Set the dma mask bits */ - dma_set_mask_and_coherent(xdev->dev, DMA_BIT_MASK(addr_width)); + err = dma_set_mask_and_coherent(xdev->dev, DMA_BIT_MASK(addr_width)); + if (err < 0) { + dev_err(xdev->dev, "DMA mask error %d\n", err); + goto disable_clks; + } /* Initialize the DMA engine */ xdev->common.dev = &pdev->dev; From patchwork Mon Oct 24 11:29:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10172 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp640817wru; Mon, 24 Oct 2022 13:33:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5NBw6Nl+DYcHvcW9URe7ak0poAQlFrPx3p+olTJ2KKJq1+NA0mSGu/XxZng3w5HEtzNJj0 X-Received: by 2002:a05:6402:3509:b0:45d:c25b:b80e with SMTP id b9-20020a056402350900b0045dc25bb80emr32435686edd.250.1666643618499; Mon, 24 Oct 2022 13:33:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643618; cv=none; d=google.com; s=arc-20160816; b=x75px/Xj3YDHDe2L4BOhfTu/tKH0mNkE5YK0iT9wxaE/KG5b8E/zAWN2XiFfaan8WS THdMf3TjGtiaeXit2727MVxxsvZ9xhWa0JpxdZ0/nG+74VbMUZLAcH8ftmgJOvsrGdGP t7EzXyo5P8RlwHLySObRpj5tEVGKr9H7WaNqcjtx8S6hV6ufijcXIm5NN7SlCKUh81QR GoFCVNTYM4vaJkAEqc5pOoi2WiV7YqjPSbhSPuxNaqsBuQN6cg9nZsXN8i8VRTQCxelh iiCjYc76wus+5ZDeCE8YfQDrIPDmlhkOWFKRgvA0TmjcAkNkgvaDlKmausxcpDB+hg/v 3rVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RAYN8+oZmpVhDqq+MDPqGhdHYQGe7GpH1LSpCKg/oGg=; b=ddMWLZqwSCv2V8q1vAfMce/6kZdNNMbHMr5xdZw2U62b2qU7kaxybMFmfcm8sa63sk KxVS5pBeoBdNEbV7kmbeXhU+kLSVOPiqUPiFU6qaCpU26/1FSjjmqPO3U9Ai1w6YQGTU cg1TCAQJnKC07c7yvJoX4dNgmUu/3nTu9saJAt7zOhJeCiWmIVX0EFaKJH5f+M7Y5FzT ln4cLe3kaJmQS6pxa1ZSrHulk1lZfaJg8GHbZ4hSemUOQDZiXduWJbnlaoSufAUKeLgu vtagyJqWNmoO7T574WAEoiBy+FgWNx7LRlcO5jXOnquEkD+9/xMDsrY6twJFbcWxN/JN lhcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HaqDwC6o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm4-20020a170907948400b00787b0b0a96esi798833ejc.131.2022.10.24.13.33.13; Mon, 24 Oct 2022 13:33:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HaqDwC6o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231132AbiJXUXM (ORCPT + 99 others); Mon, 24 Oct 2022 16:23:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232785AbiJXUWX (ORCPT ); Mon, 24 Oct 2022 16:22:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24F2B9AC33; Mon, 24 Oct 2022 11:38:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 02887B8119D; Mon, 24 Oct 2022 11:46:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E922C433D7; Mon, 24 Oct 2022 11:46:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611985; bh=baATQorB7E7tji15g54jQol3I3flzO4pwiVl9pgM6Bk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HaqDwC6oHoj+3OgLNBxQVoPu6+0siuuvX6f7XfFvzb/wnR4W6XQQhReB1q1/nAbuh QVBABXegQBKC7WYtLSiCTSHvN9GE9JDs5+QJ6nqBWV/K/MrxDoShA1JEgBAQi411fL 76phOvzDXn3fnItbLi+dDCwf3QvtPBYB4VCJBTBk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Sergei Antonov , Jonas Jensen , Sasha Levin Subject: [PATCH 4.14 026/210] ARM: dts: fix Moxa SDIO compatible, remove sdhci misnomer Date: Mon, 24 Oct 2022 13:29:03 +0200 Message-Id: <20221024112957.815210976@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602499161339456?= X-GMAIL-MSGID: =?utf-8?q?1747602499161339456?= From: Sergei Antonov [ Upstream commit 02181e68275d28cab3c3f755852770367f1bc229 ] Driver moxart-mmc.c has .compatible = "moxa,moxart-mmc". But moxart .dts/.dtsi and the documentation file moxa,moxart-dma.txt contain compatible = "moxa,moxart-sdhci". Change moxart .dts/.dtsi files and moxa,moxart-dma.txt to match the driver. Replace 'sdhci' with 'mmc' in names too, since SDHCI is a different controller from FTSDC010. Suggested-by: Arnd Bergmann Signed-off-by: Sergei Antonov Cc: Jonas Jensen Link: https://lore.kernel.org/r/20220907175341.1477383-1-saproj@gmail.com' Signed-off-by: Arnd Bergmann Signed-off-by: Sasha Levin --- Documentation/devicetree/bindings/dma/moxa,moxart-dma.txt | 4 ++-- arch/arm/boot/dts/moxart-uc7112lx.dts | 2 +- arch/arm/boot/dts/moxart.dtsi | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/dma/moxa,moxart-dma.txt b/Documentation/devicetree/bindings/dma/moxa,moxart-dma.txt index 8a9f3559335b..7e14e26676ec 100644 --- a/Documentation/devicetree/bindings/dma/moxa,moxart-dma.txt +++ b/Documentation/devicetree/bindings/dma/moxa,moxart-dma.txt @@ -34,8 +34,8 @@ Example: Use specific request line passing from dma For example, MMC request line is 5 - sdhci: sdhci@98e00000 { - compatible = "moxa,moxart-sdhci"; + mmc: mmc@98e00000 { + compatible = "moxa,moxart-mmc"; reg = <0x98e00000 0x5C>; interrupts = <5 0>; clocks = <&clk_apb>; diff --git a/arch/arm/boot/dts/moxart-uc7112lx.dts b/arch/arm/boot/dts/moxart-uc7112lx.dts index 4a962a26482d..59d8775a3a93 100644 --- a/arch/arm/boot/dts/moxart-uc7112lx.dts +++ b/arch/arm/boot/dts/moxart-uc7112lx.dts @@ -80,7 +80,7 @@ &clk_pll { clocks = <&ref12>; }; -&sdhci { +&mmc { status = "okay"; }; diff --git a/arch/arm/boot/dts/moxart.dtsi b/arch/arm/boot/dts/moxart.dtsi index da7b3237bfe9..804a2bc6ec82 100644 --- a/arch/arm/boot/dts/moxart.dtsi +++ b/arch/arm/boot/dts/moxart.dtsi @@ -93,8 +93,8 @@ watchdog: watchdog@98500000 { clock-names = "PCLK"; }; - sdhci: sdhci@98e00000 { - compatible = "moxa,moxart-sdhci"; + mmc: mmc@98e00000 { + compatible = "moxa,moxart-mmc"; reg = <0x98e00000 0x5C>; interrupts = <5 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clk_apb>; From patchwork Mon Oct 24 11:29:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8581 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419097wru; Mon, 24 Oct 2022 05:15:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5/dv2sVjbQdboBQIIPn54t6MNpbWhoplNxyuRwyr9+l206GErcj0PnMVc5Z/XCW667iy+m X-Received: by 2002:a05:6402:35d1:b0:45d:3661:567e with SMTP id z17-20020a05640235d100b0045d3661567emr31101195edc.343.1666613745225; Mon, 24 Oct 2022 05:15:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613745; cv=none; d=google.com; s=arc-20160816; b=vqAYFaAOWJ6PNQoTkznQLXstR8wQbUrTvIQ1QuWmKMvBVdgtl261as61I5Bb6Wmzmh AQfV5KcW6kf4cV4NpDIIyfBJfwDA2aexZYCwRJhDRUonwR3Ck9BOpSBRAHK2walDOHQp 7HOXHr01qVc/nt9aUZ/Z7xrZUiZhxDDhUm+xqPd+DPqZp4eSMDqQKZT95a3MVIFFLmM8 4zoQuMABp5nxBz2g5zETresj2pH8GSrrZKPZoThs+425FpkMrVZNOnGGNrk3i52k436c nEPfT5N1JvqCLrtef7PQmDT8IZzlWyyrqacYWigWusWKRdnf0h/bd0NXi3I79cR8EL4n 8T2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+9a/1+LAIAr5fkBMtmx1gGYn0VeIo7VU2Q6iUJxxh6M=; b=bBKCxcX7/FFMz3HZXA/Uu0lkwbZZj9K5Gw+UMilXG9Pyw3TO7RlNSXgJyfH6SAMSlg bTau+XY9/gQBGbLOjKV5seHzB0lXcPf0QXxkLF/YJ1+1oVyHzCZWIHLcKthcl6D5Pa1U ALFLbmHvJARk98nU9CGC2KAtalm7TWWYwf7OKMMO/0qnbS+sxaxE3pDtVg1TRXndOsYV sci3xGd2Ozn+zJwvpCu7mQvAe6GDOO+EC2CWCfc8PboQZtITgK71tfXdQChrgwYQLXGW bJuYmkz1fSaJlYMXv4kW3ULK3Jw6+RCtAPogPolackK6lnr1tG46taCeUgkaNNWq1Qqv 4l5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="XV8bsce/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nc23-20020a1709071c1700b00783a0e64f86si31573612ejc.7.2022.10.24.05.15.21; Mon, 24 Oct 2022 05:15:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="XV8bsce/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229970AbiJXMCA (ORCPT + 99 others); Mon, 24 Oct 2022 08:02:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232625AbiJXL7Y (ORCPT ); Mon, 24 Oct 2022 07:59:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D51EA7C31E; Mon, 24 Oct 2022 04:48:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C9887612BF; Mon, 24 Oct 2022 11:46:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDB03C433D6; Mon, 24 Oct 2022 11:46:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611988; bh=aLpzcmGw+xh91LI5DF8GAuLQ5FcqslRiUykBg1d/GkU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XV8bsce/lWQiX6az6bRBt4u3n+jwuMXgR69OjTyd5ovYkI1OVYJqbvIBSUJLkIEIl 0Ifhjs06Nw9RWCiW9KxlrWvEAbtGDGyeH9/6D7h2g1vjy0oNYroeANHgwgdjD18m8x 88cqJLid1phr00+0hlzBUlkQaVMNUCeP65wfraaU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Haimin Zhang , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 027/210] net/ieee802154: fix uninit value bug in dgram_sendmsg Date: Mon, 24 Oct 2022 13:29:04 +0200 Message-Id: <20221024112957.846087624@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571174596667869?= X-GMAIL-MSGID: =?utf-8?q?1747571174596667869?= From: Haimin Zhang [ Upstream commit 94160108a70c8af17fa1484a37e05181c0e094af ] There is uninit value bug in dgram_sendmsg function in net/ieee802154/socket.c when the length of valid data pointed by the msg->msg_name isn't verified. We introducing a helper function ieee802154_sockaddr_check_size to check namelen. First we check there is addr_type in ieee802154_addr_sa. Then, we check namelen according to addr_type. Also fixed in raw_bind, dgram_bind, dgram_connect. Signed-off-by: Haimin Zhang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- include/net/ieee802154_netdev.h | 37 +++++++++++++++++++++++++++++ net/ieee802154/socket.c | 42 ++++++++++++++++++--------------- 2 files changed, 60 insertions(+), 19 deletions(-) diff --git a/include/net/ieee802154_netdev.h b/include/net/ieee802154_netdev.h index c4b31601cd53..fd1665baa179 100644 --- a/include/net/ieee802154_netdev.h +++ b/include/net/ieee802154_netdev.h @@ -23,6 +23,22 @@ #ifndef IEEE802154_NETDEVICE_H #define IEEE802154_NETDEVICE_H +#define IEEE802154_REQUIRED_SIZE(struct_type, member) \ + (offsetof(typeof(struct_type), member) + \ + sizeof(((typeof(struct_type) *)(NULL))->member)) + +#define IEEE802154_ADDR_OFFSET \ + offsetof(typeof(struct sockaddr_ieee802154), addr) + +#define IEEE802154_MIN_NAMELEN (IEEE802154_ADDR_OFFSET + \ + IEEE802154_REQUIRED_SIZE(struct ieee802154_addr_sa, addr_type)) + +#define IEEE802154_NAMELEN_SHORT (IEEE802154_ADDR_OFFSET + \ + IEEE802154_REQUIRED_SIZE(struct ieee802154_addr_sa, short_addr)) + +#define IEEE802154_NAMELEN_LONG (IEEE802154_ADDR_OFFSET + \ + IEEE802154_REQUIRED_SIZE(struct ieee802154_addr_sa, hwaddr)) + #include #include #include @@ -173,6 +189,27 @@ static inline void ieee802154_devaddr_to_raw(void *raw, __le64 addr) memcpy(raw, &temp, IEEE802154_ADDR_LEN); } +static inline int +ieee802154_sockaddr_check_size(struct sockaddr_ieee802154 *daddr, int len) +{ + struct ieee802154_addr_sa *sa; + + sa = &daddr->addr; + if (len < IEEE802154_MIN_NAMELEN) + return -EINVAL; + switch (sa->addr_type) { + case IEEE802154_ADDR_SHORT: + if (len < IEEE802154_NAMELEN_SHORT) + return -EINVAL; + break; + case IEEE802154_ADDR_LONG: + if (len < IEEE802154_NAMELEN_LONG) + return -EINVAL; + break; + } + return 0; +} + static inline void ieee802154_addr_from_sa(struct ieee802154_addr *a, const struct ieee802154_addr_sa *sa) { diff --git a/net/ieee802154/socket.c b/net/ieee802154/socket.c index 9d46d9462129..16bf114118c3 100644 --- a/net/ieee802154/socket.c +++ b/net/ieee802154/socket.c @@ -212,8 +212,9 @@ static int raw_bind(struct sock *sk, struct sockaddr *_uaddr, int len) int err = 0; struct net_device *dev = NULL; - if (len < sizeof(*uaddr)) - return -EINVAL; + err = ieee802154_sockaddr_check_size(uaddr, len); + if (err < 0) + return err; uaddr = (struct sockaddr_ieee802154 *)_uaddr; if (uaddr->family != AF_IEEE802154) @@ -506,7 +507,8 @@ static int dgram_bind(struct sock *sk, struct sockaddr *uaddr, int len) ro->bound = 0; - if (len < sizeof(*addr)) + err = ieee802154_sockaddr_check_size(addr, len); + if (err < 0) goto out; if (addr->family != AF_IEEE802154) @@ -577,8 +579,9 @@ static int dgram_connect(struct sock *sk, struct sockaddr *uaddr, struct dgram_sock *ro = dgram_sk(sk); int err = 0; - if (len < sizeof(*addr)) - return -EINVAL; + err = ieee802154_sockaddr_check_size(addr, len); + if (err < 0) + return err; if (addr->family != AF_IEEE802154) return -EINVAL; @@ -617,6 +620,7 @@ static int dgram_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) struct ieee802154_mac_cb *cb; struct dgram_sock *ro = dgram_sk(sk); struct ieee802154_addr dst_addr; + DECLARE_SOCKADDR(struct sockaddr_ieee802154*, daddr, msg->msg_name); int hlen, tlen; int err; @@ -625,10 +629,20 @@ static int dgram_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) return -EOPNOTSUPP; } - if (!ro->connected && !msg->msg_name) - return -EDESTADDRREQ; - else if (ro->connected && msg->msg_name) - return -EISCONN; + if (msg->msg_name) { + if (ro->connected) + return -EISCONN; + if (msg->msg_namelen < IEEE802154_MIN_NAMELEN) + return -EINVAL; + err = ieee802154_sockaddr_check_size(daddr, msg->msg_namelen); + if (err < 0) + return err; + ieee802154_addr_from_sa(&dst_addr, &daddr->addr); + } else { + if (!ro->connected) + return -EDESTADDRREQ; + dst_addr = ro->dst_addr; + } if (!ro->bound) dev = dev_getfirstbyhwtype(sock_net(sk), ARPHRD_IEEE802154); @@ -664,16 +678,6 @@ static int dgram_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) cb = mac_cb_init(skb); cb->type = IEEE802154_FC_TYPE_DATA; cb->ackreq = ro->want_ack; - - if (msg->msg_name) { - DECLARE_SOCKADDR(struct sockaddr_ieee802154*, - daddr, msg->msg_name); - - ieee802154_addr_from_sa(&dst_addr, &daddr->addr); - } else { - dst_addr = ro->dst_addr; - } - cb->secen = ro->secen; cb->secen_override = ro->secen_override; cb->seclevel = ro->seclevel; From patchwork Mon Oct 24 11:29:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8522 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp405735wru; Mon, 24 Oct 2022 04:57:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7oQfrsPUxFxvNgcw/4q2CFfqwfd/wZSgLd4CQgw6m+CKPjsBnp7aQPsiaXVksIeGPy00oK X-Received: by 2002:a63:220a:0:b0:463:7c92:ef9d with SMTP id i10-20020a63220a000000b004637c92ef9dmr27682250pgi.42.1666612654796; Mon, 24 Oct 2022 04:57:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612654; cv=none; d=google.com; s=arc-20160816; b=ADkJ5bvQT6hnqlI2YL/qCABPFjkQ25ygMQH5WmAQjjHibZQnR8olJVoVSL3yTBOKAk c/E4P8wskwg1A+LSVHrzeqe25BycEiFV1uLk/GxUxcgeIsqRVBxd6DEOKPoJcqDH/smh Eoh/SINMmJC/DOrDD6KrDRmwc7tT4FIW8DMJib6OapJmhyCAAZytArBSIHdquRfHi2qV R4Yor+pZaBZgJo+x69amf0az6NCuJalhF4iWA8OGKnfv/tZzX+Yf2x7JR+FDW+hfIBhj ohX/RgX+qpoG4uoX6QnjwGJe/uciTKq+4BRjfMRfMDs2so1yTau3zTVQSYIEl/KrrKfT cqtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dJDs24JJyfkZtcB06WpgN5odIe0hQNCVeW1Sj9XLBNg=; b=GMmFFCHuvYplv2HZQ4XRJ/AyLD/0jib7KslyBt8Yxxc4sN7JzbKIwackmYh2cAPHPP O4aUIJ2grbL9bGt2aiEQZU1n3KxOPimQ8NOTz7IAO2LH75OZiSYZuvfAWR22WrAsycIk 6b2iqrRa7wnLntrlbvXx+VrBH56vMj7JdLslK57Cgqmg0urkQLDjlgkzRwoWu8WPcBvg q10+NeqBeN5+yWVe/XarEJR5YN6klAIMf9G/b6PbJZt1udH2hKqW/wWQvyu/6Rctf259 kmoV2BmUHIxUYP44BRoiBV33x5Qr/u6SUwexXyeM4Rh9q7NwN7uIhXpkcb90Vsyp999g D9ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FnxPxRZQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o15-20020a17090a3d4f00b0020addb2c6e7si8828939pjf.85.2022.10.24.04.57.21; Mon, 24 Oct 2022 04:57:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FnxPxRZQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232209AbiJXL5D (ORCPT + 99 others); Mon, 24 Oct 2022 07:57:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232065AbiJXLz0 (ORCPT ); Mon, 24 Oct 2022 07:55:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3D607AC36; Mon, 24 Oct 2022 04:46:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 23C06B8119E; Mon, 24 Oct 2022 11:46:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80BB3C433D7; Mon, 24 Oct 2022 11:46:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611990; bh=Oo5dzfgUvi7RFuvhID2RTEtBjZh0y9xtz/tZcCFnyi8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FnxPxRZQ/doYAU4WVl8X8OylTTxJzXpQdcXt970sbOaBiO4qCZLJAo2sawo2Vh4cl B7Y+4TQ0kew2WQ5GdWH+iTbGw65WakXLaLpd9cP1vKUM1iPA2LoX2M7voqlmJzZ6GJ lJCaqg4578vnFVbFYIBTjsGb91QGBWNJEhiG4oSI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Straub , Richard Weinberger , Sasha Levin , Randy Dunlap Subject: [PATCH 4.14 028/210] um: Cleanup syscall_handler_t cast in syscalls_32.h Date: Mon, 24 Oct 2022 13:29:05 +0200 Message-Id: <20221024112957.875836331@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747570030987784465?= X-GMAIL-MSGID: =?utf-8?q?1747570030987784465?= From: Lukas Straub [ Upstream commit 61670b4d270c71219def1fbc9441debc2ac2e6e9 ] Like in f4f03f299a56ce4d73c5431e0327b3b6cb55ebb9 "um: Cleanup syscall_handler_t definition/cast, fix warning", remove the cast to to fix the compiler warning. Signed-off-by: Lukas Straub Acked-by: Randy Dunlap # build-tested Signed-off-by: Richard Weinberger Signed-off-by: Sasha Levin --- arch/x86/um/shared/sysdep/syscalls_32.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/x86/um/shared/sysdep/syscalls_32.h b/arch/x86/um/shared/sysdep/syscalls_32.h index 68fd2cf526fd..f6e9f84397e7 100644 --- a/arch/x86/um/shared/sysdep/syscalls_32.h +++ b/arch/x86/um/shared/sysdep/syscalls_32.h @@ -6,10 +6,9 @@ #include #include -typedef long syscall_handler_t(struct pt_regs); +typedef long syscall_handler_t(struct syscall_args); extern syscall_handler_t *sys_call_table[]; #define EXECUTE_SYSCALL(syscall, regs) \ - ((long (*)(struct syscall_args)) \ - (*sys_call_table[syscall]))(SYSCALL_ARGS(®s->regs)) + ((*sys_call_table[syscall]))(SYSCALL_ARGS(®s->regs)) From patchwork Mon Oct 24 11:29:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8573 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp418226wru; Mon, 24 Oct 2022 05:14:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4S9vodsDRBspk8gLAAOMyY7tTB76fSGFleDJln3D6IqvdTqYlpYdX9l380y10EDdx5IEUS X-Received: by 2002:a05:6402:e87:b0:456:c93c:5361 with SMTP id h7-20020a0564020e8700b00456c93c5361mr29687706eda.88.1666613657643; Mon, 24 Oct 2022 05:14:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613657; cv=none; d=google.com; s=arc-20160816; b=f/JSE1PmpJjT+lXxiv6lx5m4x4dHX15AjnGWBdPhOPMEezPseTh6BZMwb1vBtWUVn9 oMKezTqIqL7bkobedKoE0nqfRtO2BdMR7/pLhEJ2u8Q6dVqWMTbyckx1dFOxXS09i2/o hKLKV+YzXKhBBi1RGcpM1+un5czHCfx99969WoyFMl41BVr1LGjrqxRIAzXOzICjUymF tdhq+eu24ndbUJEilo18/d5TobPaasVbek5CMyC0d8tKdzcbHvAaw0L0DERKJ15Q2D6y osZt+ycOC2ZhuKFl3H0ANbYNfykmDiHzCbLDJRuzP1rsRn6/BP4lTZ7N+hWAah9p28pc UDDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Kvf1wUbNwSVSBWwIV5fL8bkIuY3EWSCL26/lalVKqzk=; b=LCCmxo2wAw0073LWLYtyN+19yyIdh25xS2EWjN/nQSS1UV29VVfjohCMNzEW2Nno8e rwNimt3SFZOntGvneqmMJyABcQEVKaZFK9s8bLH7d99Zbmv9kkjDnEBWrePSgQC1tGLS WKrElnT3LT9+qI0j5oi5DUJjypxnpe2E11ylp18Q4JGD/GP9loDI56BulKRvcghuciL2 fv3/TZkbrt8ekOxw8+GcOcHoiqYjecMpqiSpfpY+z4k3s/6Fzf4MFHoFNk6yzFxLFL/I tHa4nLZmn8knKKlVbZ9tlstEDceHLLzAxVLzab823+0S45iWbtmT6dRuUSqPTnHkJNTM vXDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Xx7t/ysN"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g24-20020a056402115800b00446fdce2a62si24712109edw.420.2022.10.24.05.13.52; Mon, 24 Oct 2022 05:14:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Xx7t/ysN"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230097AbiJXMCw (ORCPT + 99 others); Mon, 24 Oct 2022 08:02:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232747AbiJXL7r (ORCPT ); Mon, 24 Oct 2022 07:59:47 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F0597C1D3; Mon, 24 Oct 2022 04:49:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 0EDCDCE131E; Mon, 24 Oct 2022 11:46:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 252E9C433D6; Mon, 24 Oct 2022 11:46:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611993; bh=H6SVqnoMJtqjUi9uRgeMH0tCUlsjckGSZG/7dl6Ssrk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xx7t/ysNByAmnPx6/oj8uGp+46OBAHGx0Dpfoj0Spt2SiCjf8QgpDVwE3nHsUX7BA 0R0brQkLYZerVVXIOyFbHeCkC43DwBONvMno6yJxs1+g8D/odT/de1bDM3uJ9b32sP E1ECNYicggRxDmxZS6OwbDuXaEiPfQ9r9MOxO7h8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Straub , Richard Weinberger , Sasha Levin , Randy Dunlap Subject: [PATCH 4.14 029/210] um: Cleanup compiler warning in arch/x86/um/tls_32.c Date: Mon, 24 Oct 2022 13:29:06 +0200 Message-Id: <20221024112957.908052740@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571082739977596?= X-GMAIL-MSGID: =?utf-8?q?1747571082739977596?= From: Lukas Straub [ Upstream commit d27fff3499671dc23a08efd01cdb8b3764a391c4 ] arch.tls_array is statically allocated so checking for NULL doesn't make sense. This causes the compiler warning below. Remove the checks to silence these warnings. ../arch/x86/um/tls_32.c: In function 'get_free_idx': ../arch/x86/um/tls_32.c:68:13: warning: the comparison will always evaluate as 'true' for the address of 'tls_array' will never be NULL [-Waddress] 68 | if (!t->arch.tls_array) | ^ In file included from ../arch/x86/um/asm/processor.h:10, from ../include/linux/rcupdate.h:30, from ../include/linux/rculist.h:11, from ../include/linux/pid.h:5, from ../include/linux/sched.h:14, from ../arch/x86/um/tls_32.c:7: ../arch/x86/um/asm/processor_32.h:22:31: note: 'tls_array' declared here 22 | struct uml_tls_struct tls_array[GDT_ENTRY_TLS_ENTRIES]; | ^~~~~~~~~ ../arch/x86/um/tls_32.c: In function 'get_tls_entry': ../arch/x86/um/tls_32.c:243:13: warning: the comparison will always evaluate as 'true' for the address of 'tls_array' will never be NULL [-Waddress] 243 | if (!t->arch.tls_array) | ^ ../arch/x86/um/asm/processor_32.h:22:31: note: 'tls_array' declared here 22 | struct uml_tls_struct tls_array[GDT_ENTRY_TLS_ENTRIES]; | ^~~~~~~~~ Signed-off-by: Lukas Straub Acked-by: Randy Dunlap # build-tested Signed-off-by: Richard Weinberger Signed-off-by: Sasha Levin --- arch/x86/um/tls_32.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/arch/x86/um/tls_32.c b/arch/x86/um/tls_32.c index 5bd949da7a4a..b69ab2409430 100644 --- a/arch/x86/um/tls_32.c +++ b/arch/x86/um/tls_32.c @@ -65,9 +65,6 @@ static int get_free_idx(struct task_struct* task) struct thread_struct *t = &task->thread; int idx; - if (!t->arch.tls_array) - return GDT_ENTRY_TLS_MIN; - for (idx = 0; idx < GDT_ENTRY_TLS_ENTRIES; idx++) if (!t->arch.tls_array[idx].present) return idx + GDT_ENTRY_TLS_MIN; @@ -242,9 +239,6 @@ static int get_tls_entry(struct task_struct *task, struct user_desc *info, { struct thread_struct *t = &task->thread; - if (!t->arch.tls_array) - goto clear; - if (idx < GDT_ENTRY_TLS_MIN || idx > GDT_ENTRY_TLS_MAX) return -EINVAL; From patchwork Mon Oct 24 11:29:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8567 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp418005wru; Mon, 24 Oct 2022 05:13:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6T/jGjMaya64c1dEh5Lsov4rgtUCHFNUXAWdc4DuUwcM9vCxrs0Ve83OujblOYYVRJ6g1T X-Received: by 2002:aa7:cc13:0:b0:453:52dc:1bbf with SMTP id q19-20020aa7cc13000000b0045352dc1bbfmr30851423edt.30.1666613638619; Mon, 24 Oct 2022 05:13:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613638; cv=none; d=google.com; s=arc-20160816; b=zsBqduaS29FhkBpOCebV0IZs0Rmw2PeDxeFrYfjXxaz6+KdTh2WOSKoypM64ZmKxLX wMj9GYD/emD3EyqEJtBMTRbsa8sX9XRJMWda8F74rDw9HyYP+5+dLCQElhpaSEJSRIQ7 iQ52Zpkeu82vuFl7xAABefcMkVc8+K8x2JO9ED61nmJP15YVVHYJThQrcQGxBCi4Kdin p6TidZ+V3Vq5tQBk3l+s81+VQGgvr72fFUVy7Q4lSKlon0C2+wa708TD52o77M3NjIKb 81vWa4v2pW+BAQHqVuwbG7U0S3fi9wvpQA+Tprh91ah7gW7mYh7ui7pIezkD+OBdNgXZ thng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=F8ox9Wu+RF/nLBnyZrSC09S6EScztHAHmH0KKFvMPuY=; b=d1wtywqYayySa3yCRwzz0k4+IaANGMTaZ9lLfNpZs6c6iG4pkrLtFezLRMOQES9zCh vikAWtcjhQ1odTFh+Z1XQ9Oy3vCpfIZyYneM/FHfIVlBtRmA6UNcK4gSJez3Yvfq7DfV oct7amLqRBvTamY60u8Y55gct6jVhcPgWNa0mFKXDO4mOIADJQHW4AjBvCArA2zs/2rx ZY7SotlxRROtro8yji98+5zEe6u8KtGvQ5c9eXDoJr5LbfqpEebCS57qTzWXLlgxNyhd aKiRX3UBL0eI12EiwHr+0CQVAdNz0rOa0/nuZScLZ7M3nwOyWlF17F+DjuYKFjvxk8Z4 q4uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MVGIaP64; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sg10-20020a170907a40a00b0079b40c09982si9204664ejc.340.2022.10.24.05.13.32; Mon, 24 Oct 2022 05:13:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MVGIaP64; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232263AbiJXMFR (ORCPT + 99 others); Mon, 24 Oct 2022 08:05:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232286AbiJXMCU (ORCPT ); Mon, 24 Oct 2022 08:02:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EEE32495B; Mon, 24 Oct 2022 04:49:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4D4A6612C9; Mon, 24 Oct 2022 11:46:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5CACCC433D7; Mon, 24 Oct 2022 11:46:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611998; bh=qRqcUUTGz48ylilhA9AgVfT7w9HHuLUTCmZjZVP6zcQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MVGIaP64f15RCwlyI38wVCDZ8zr0316twfNnAnQ3wk066eDjUsWpU9yp5BiMT2bHX hlUYPnvleVQc04w6sl+BlISAllTUXOt54BCJQAG4r+Fu7P4sFvV5TJMLuzQ4b/dxo9 oWMs46EhtthhvzfR+cebjdr0vbIpTAzcKGFjXphs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Dmitry Vyukov" , stable , syzbot+23f57c5ae902429285d7@syzkaller.appspotmail.com, Tadeusz Struk , PaX Team Subject: [PATCH 4.14 030/210] usb: mon: make mmapped memory read only Date: Mon, 24 Oct 2022 13:29:07 +0200 Message-Id: <20221024112957.939635963@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571062338547519?= X-GMAIL-MSGID: =?utf-8?q?1747571062338547519?= From: Tadeusz Struk commit a659daf63d16aa883be42f3f34ff84235c302198 upstream. Syzbot found an issue in usbmon module, where the user space client can corrupt the monitor's internal memory, causing the usbmon module to crash the kernel with segfault, UAF, etc. The reproducer mmaps the /dev/usbmon memory to user space, and overwrites it with arbitrary data, which causes all kinds of issues. Return an -EPERM error from mon_bin_mmap() if the flag VM_WRTIE is set. Also clear VM_MAYWRITE to make it impossible to change it to writable later. Cc: "Dmitry Vyukov" Cc: stable Fixes: 6f23ee1fefdc ("USB: add binary API to usbmon") Suggested-by: PaX Team # for the VM_MAYRITE portion Link: https://syzkaller.appspot.com/bug?id=2eb1f35d6525fa4a74d75b4244971e5b1411c95a Reported-by: syzbot+23f57c5ae902429285d7@syzkaller.appspotmail.com Signed-off-by: Tadeusz Struk Link: https://lore.kernel.org/r/20220919215957.205681-1-tadeusz.struk@linaro.org Signed-off-by: Greg Kroah-Hartman --- drivers/usb/mon/mon_bin.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/usb/mon/mon_bin.c +++ b/drivers/usb/mon/mon_bin.c @@ -1267,6 +1267,11 @@ static int mon_bin_mmap(struct file *fil { /* don't do anything here: "fault" will set up page table entries */ vma->vm_ops = &mon_bin_vm_ops; + + if (vma->vm_flags & VM_WRITE) + return -EPERM; + + vma->vm_flags &= ~VM_MAYWRITE; vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP; vma->vm_private_data = filp->private_data; mon_bin_vma_open(vma); From patchwork Mon Oct 24 11:29:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8575 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp418228wru; Mon, 24 Oct 2022 05:14:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM50dvtmMIDecTMK0FhofMtvqPYxRNCJGeFDYdMtruOoujy1AaEhTTcQUKySgVqF3wtQsd1I X-Received: by 2002:a17:907:75c8:b0:78d:b646:e768 with SMTP id jl8-20020a17090775c800b0078db646e768mr27021797ejc.432.1666613657737; Mon, 24 Oct 2022 05:14:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613657; cv=none; d=google.com; s=arc-20160816; b=oTZwH9ij+hFU+iefLtXf+pG2kQ2xoYsS5A3ZD1bre44zri0V2Ca0aBmP75OwnyPKIj jUHF8g0AFhVJ3r64AW9Vp4FS1OKtvlKY0WaHDOhGoR+GqI0mcGtSLCUYxF5EZPCeX/Lm ElkY0A8scVrcnKuemK9FFPwDwLygtFLSqlntPZimFM2BhaMxXLGO283E8kdkWgTBj/OC R+2B4V6LWG8wd9rmvBr4KKO65HdRttQtmGsSm35Fegd4eNUf1OL/tbNLnGDmWCfe/XUl iXxhEnykfOg8GxiXcWuP3GPPgj/equYEFdeFJoCCl/HDwbeUP9UAAbhqaTbfwPY5O7Ba wLzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DaU3fU9X915XWbfFDYmdgDtMx9quPLZBPJtwUhamsCo=; b=uBxwbf67FH9UUCiPVE+q2TR4iOI6VQwLAkbUshLYgnsij9O/rih49nYcSkFkXVPbk+ LGPcwy7JmbHCOAfIPcW59UQeDJKWPZuZJzmAYX8IdmlpgMMvbWgGvOnZknMwvHBZEauJ myXXtunvHljeKmE8zmfG7gEKlXzIHUS0mTjSAl/WlpebMQ6e2eOuBALqyN3nwnQrdCZL HVB+F46Y6kP47KUZ4bKshw4vUkbHA3OZS42UXXy4j8xFXma4mNwaFbakCZ2MzB6LBE/Q lIqLZB6MOCtfnaZhsfxvl2IpvKdxWrhQHD8dLIhSZ7i6kkMRtHNtVcQxuMW5YBA2TaZb p7mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zcTcoqwH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xg14-20020a170907320e00b0072a6c18f1fasi30470650ejb.639.2022.10.24.05.13.52; Mon, 24 Oct 2022 05:14:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zcTcoqwH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232590AbiJXMFp (ORCPT + 99 others); Mon, 24 Oct 2022 08:05:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232586AbiJXMDv (ORCPT ); Mon, 24 Oct 2022 08:03:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C0BB356EA; Mon, 24 Oct 2022 04:50:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 59ADCB811AB; Mon, 24 Oct 2022 11:48:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8440C433C1; Mon, 24 Oct 2022 11:48:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612107; bh=a7PnIGvopb4QKsMeyez/yTomLe0JNasOnQjCXOfD6PA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zcTcoqwHZ9SQuT4bnkwkMWwAPypis/GCdc5EFbpOxNXwQwhiW+POHAcREJqeW94XK EHDMrC6KlFO/mYPtem4DZQL7/tv9HI93Fdf9NUtpzAQT1c5LiJtztQiiCJz01qQllP glRVrn69GbL77aMXPvBLZmADw6klviDpFmXTlqUI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold Subject: [PATCH 4.14 031/210] USB: serial: ftdi_sio: fix 300 bps rate for SIO Date: Mon, 24 Oct 2022 13:29:08 +0200 Message-Id: <20221024112957.971464744@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571083055192028?= X-GMAIL-MSGID: =?utf-8?q?1747571083055192028?= From: Johan Hovold commit 7bd7ad3c310cd6766f170927381eea0aa6f46c69 upstream. The 300 bps rate of SIO devices has been mapped to 9600 bps since 2003... Let's fix the regression. Cc: stable@vger.kernel.org Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/ftdi_sio.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -1309,8 +1309,7 @@ static __u32 get_ftdi_divisor(struct tty case 38400: div_value = ftdi_sio_b38400; break; case 57600: div_value = ftdi_sio_b57600; break; case 115200: div_value = ftdi_sio_b115200; break; - } /* baud */ - if (div_value == 0) { + default: dev_dbg(dev, "%s - Baudrate (%d) requested is not supported\n", __func__, baud); div_value = ftdi_sio_b9600; From patchwork Mon Oct 24 11:29:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8533 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp416542wru; Mon, 24 Oct 2022 05:11:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM547JDhZxRX8Xp7JzUzDXZWVTJvIzn/V3jx7L4kcTkJ7y+nqRKIf8Vj9tlO4nqm0T1Uyh2a X-Received: by 2002:a17:907:a059:b0:7a5:587d:d315 with SMTP id gz25-20020a170907a05900b007a5587dd315mr6178659ejc.631.1666613511859; Mon, 24 Oct 2022 05:11:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613511; cv=none; d=google.com; s=arc-20160816; b=n7rIB59W4H33Y9eF9c1wKXxsifRLTX4jG3bkZZG7ykFCKsrk46SFiPQ2VmDYLgJRAM hk2LiY+8hi175WZOeus547vVnlYqMkSVES1UcB9ybcSQ9FBGkavlCoteDvzl9xjzdeAo 889//zefkDa3fNTR8oJu3XJzjeyQOigRYYetZSp+edLZfXJ8i3HZWQOrCQWPnpeYBZGd BXiRT+XRzpAournBrWFXdHahnIip5tmW3fRQbUlWkJXpv9DG8IJTgtWsC7/LA26qgDKc qdHs69Ga1qGt4xereLAzqFWwPJHTx4rB+/5j06Yy3AqU3YDMAUy5EsXMcEw5s3UjO1pg 1+NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xs5oOZew1vcpTbLCO9iFwo/FqhmybszJcAkAqA6gXIk=; b=sCmBwvAbGtjoxcZ1bgAwB7Mf2fhvk5NcewmTnn06JsJ4QrskpvVfgRUjmQLFatMCUJ HqSvfmx0gNDaVLnVc8H2fSOLbP/MHjVXeN68E5KsOdEOSnAi+kRqDqg+WM8SunbdblyR 9EIA+g0iJMs7uBnRUF0MeF9kXWgNJRR0jrOX2FBqRqCq2qE1fTvkbgVlp62nypH2TAKZ npMGpgnVeMKYnpPXKuJtzmUs57XhEgm9My0J8KopN/uqGl4pOSz1ODXpTlWSjLlWMaku /YvvT4rDsNvYBs+0hUdAbXD2FkCdKGhpjOOf6ZHpHO+iK0Ij6VgZYUoY1DWKSiGqZR2O KV8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=v+0AVUKX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y6-20020a50e606000000b004573c1ae3fasi23722856edm.285.2022.10.24.05.11.23; Mon, 24 Oct 2022 05:11:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=v+0AVUKX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230208AbiJXL6N (ORCPT + 99 others); Mon, 24 Oct 2022 07:58:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232111AbiJXL4q (ORCPT ); Mon, 24 Oct 2022 07:56:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B89D17A50C; Mon, 24 Oct 2022 04:47:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2C682B8117E; Mon, 24 Oct 2022 11:47:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82563C433D6; Mon, 24 Oct 2022 11:46:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612019; bh=TkptbBExfBRLdyiwMro7nVDIibC8wLql2SnkRMFzZd0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v+0AVUKXTSAKZG8g/VA9MCwQTS03py3EGuPd5LZD2PM5RGJZEGJMqaWIHvx8EXuNu BK9haJqvM1MRpG8oOhoVDzYtCEar4xIFoR/VjNXsi3xbrh0DuRotVmA0iCCwOoLxS1 TAnj2b4Uo00DHqflL6Pv3vMK2G7laYrMheN4/r/g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, ChanWoo Lee , Linus Walleij , Ulf Hansson , Brian Norris Subject: [PATCH 4.14 032/210] mmc: core: Replace with already defined values for readability Date: Mon, 24 Oct 2022 13:29:09 +0200 Message-Id: <20221024112958.007222166@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747570929745074210?= X-GMAIL-MSGID: =?utf-8?q?1747570929745074210?= From: ChanWoo Lee commit e427266460826bea21b70f9b2bb29decfb2c2620 upstream. SD_ROCR_S18A is already defined and is used to check the rocr value, so let's replace with already defined values for readability. Signed-off-by: ChanWoo Lee Reviewed-by: Linus Walleij Link: https://lore.kernel.org/r/20220706004840.24812-1-cw9316.lee@samsung.com Signed-off-by: Ulf Hansson Signed-off-by: Brian Norris Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/core/sd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -793,7 +793,7 @@ try_again: * the CCS bit is set as well. We deliberately deviate from the spec in * regards to this, which allows UHS-I to be supported for SDSC cards. */ - if (!mmc_host_is_spi(host) && rocr && (*rocr & 0x01000000)) { + if (!mmc_host_is_spi(host) && rocr && (*rocr & SD_ROCR_S18A)) { err = mmc_set_uhs_voltage(host, pocr); if (err == -EAGAIN) { retries--; From patchwork Mon Oct 24 11:29:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10077 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp624874wru; Mon, 24 Oct 2022 12:52:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6L7O0C26rxVKj2xz4BQO0sanfA11vXNuNil1zGDt26kqyHoRNfeQ/law2eyfw0LDJ/ed98 X-Received: by 2002:a63:2a08:0:b0:46a:e2a8:4ead with SMTP id q8-20020a632a08000000b0046ae2a84eadmr30207114pgq.132.1666641173124; Mon, 24 Oct 2022 12:52:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666641173; cv=none; d=google.com; s=arc-20160816; b=g//uG50rUAAE7XZJZPoapHUuI792bIf/s9xxpAVlkVU8A5Lq/793pp98vakilSDL7J KfOCAB2Ug1LUXN/WqkG42ldLh2bapBpIKDso5cGY9I4fWCDuvl1xcydUT74MCVpBA12x Npkk3glxGxszMhgW+H57dqC9oenhPCj1riZ07sTNjXeJBnPABRTgWc0moDCb54IdrHWP BFd7NGMHxuywfWwlhwgfxIgu5uDQzEgZQ1/xcMBrGlwYZlGXX+s7JA3jd4C85e1y97HG 3a5Ii8op8OvZjhJ67kbsQXg0SwT3vgp1RuK0E7B47oPbDCCMKOwRCb1kYPHcMzCe2zOt KLBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uxyJr9lsdoPWP5cf3oL4fX1m3W/ZP2SpkHYLR2qjw2w=; b=WZLLBvmUDwQ4abfdU03KIhNeuKPrLxe/0JXBJ6ULfa8eGlVA14rNZy+aLLtruE8ptd E9Wk/KtXhyWAyVGL3yQj2Kb34W/bdkQtiYFDZbnlj6clg5/+J5SbUlMroyWIdgtK4iSj RQrJi4T98Q0OPL8K/RAPX9SzJ0vnOXMSBQk+g0JPZzBg58M/4FXukPqNfOW8PwzLGHFa FFJI0uIKcS/DwxSafreHZbGrgAS+I+DYL25DBLIAsSgw9dEYRAHNE3Jza9G5HyAI2BaY DmeFXwDEFxjTvotkWvGTxlUEAMHxPDFRWypwHK2WTrBOt/KbD1W2V1tWqwMmi6lJJHSM eCkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="wXBp99J/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i190-20020a6387c7000000b004430face459si401815pge.95.2022.10.24.12.52.39; Mon, 24 Oct 2022 12:52:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="wXBp99J/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233666AbiJXTwL (ORCPT + 99 others); Mon, 24 Oct 2022 15:52:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233459AbiJXTvc (ORCPT ); Mon, 24 Oct 2022 15:51:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98C3D68CF7; Mon, 24 Oct 2022 11:17:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 32284B8113E; Mon, 24 Oct 2022 11:47:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 881ACC433D6; Mon, 24 Oct 2022 11:47:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612048; bh=fmEfxgR2XiP4itflL2YB4yqVWS0agT7IBfMJR4Hzlro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wXBp99J/8X/ESOp/53QuKkxEWT63+P/1JDW0kUOOdYMCfHla9NGlsgSJtR3GxTXzR r3rRRfZNpF8SwcXsc/dmobXkXO2032Pl5mXvzhHPVRzsuU8Sz9N8XpsfYxrOSiX5/+ 1V4z4LCPVo7OreDJkRiRcuznMKOyfgRMmRYoQtCY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Norris , Guenter Roeck , Ulf Hansson Subject: [PATCH 4.14 033/210] mmc: core: Terminate infinite loop in SD-UHS voltage switch Date: Mon, 24 Oct 2022 13:29:10 +0200 Message-Id: <20221024112958.037368570@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747599934656335679?= X-GMAIL-MSGID: =?utf-8?q?1747599934656335679?= From: Brian Norris commit e9233917a7e53980664efbc565888163c0a33c3f upstream. This loop intends to retry a max of 10 times, with some implicit termination based on the SD_{R,}OCR_S18A bit. Unfortunately, the termination condition depends on the value reported by the SD card (*rocr), which may or may not correctly reflect what we asked it to do. Needless to say, it's not wise to rely on the card doing what we expect; we should at least terminate the loop regardless. So, check both the input and output values, so we ensure we will terminate regardless of the SD card behavior. Note that SDIO learned a similar retry loop in commit 0797e5f1453b ("mmc: core: Fixup signal voltage switch"), but that used the 'ocr' result, and so the current pre-terminating condition looks like: rocr & ocr & R4_18V_PRESENT (i.e., it doesn't have the same bug.) This addresses a number of crash reports seen on ChromeOS that look like the following: ... // lots of repeated: ... <4>[13142.846061] mmc1: Skipping voltage switch <4>[13143.406087] mmc1: Skipping voltage switch <4>[13143.964724] mmc1: Skipping voltage switch <4>[13144.526089] mmc1: Skipping voltage switch <4>[13145.086088] mmc1: Skipping voltage switch <4>[13145.645941] mmc1: Skipping voltage switch <3>[13146.153969] INFO: task halt:30352 blocked for more than 122 seconds. ... Fixes: f2119df6b764 ("mmc: sd: add support for signal voltage switch procedure") Cc: Signed-off-by: Brian Norris Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20220914014010.2076169-1-briannorris@chromium.org Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/core/sd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -793,7 +793,8 @@ try_again: * the CCS bit is set as well. We deliberately deviate from the spec in * regards to this, which allows UHS-I to be supported for SDSC cards. */ - if (!mmc_host_is_spi(host) && rocr && (*rocr & SD_ROCR_S18A)) { + if (!mmc_host_is_spi(host) && (ocr & SD_OCR_S18R) && + rocr && (*rocr & SD_ROCR_S18A)) { err = mmc_set_uhs_voltage(host, pocr); if (err == -EAGAIN) { retries--; From patchwork Mon Oct 24 11:29:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8550 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp417055wru; Mon, 24 Oct 2022 05:12:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5U4iEL7sFd0zOKnkpdsxKdzcYKu3lmHBa1d/bPnZuLibPGsMO17SdntkptvJS1kKgNxjO3 X-Received: by 2002:a05:6a00:234d:b0:561:f0c3:cde1 with SMTP id j13-20020a056a00234d00b00561f0c3cde1mr33340510pfj.34.1666613553674; Mon, 24 Oct 2022 05:12:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613553; cv=none; d=google.com; s=arc-20160816; b=ECFPOIbgkyILOh6CQiF3d6nrGesO3sWZWsaVZ+A+GVBRqLoQL9LFWE8k8c8sfeBSTM Go+BFPmX/8vw66jwf/JYFfgnT7JjPh0tWqlTJhMkNCzU8OhmRsh1knB12YxWtjDSs+4W L22Tn9SCWqwPlwF1j8qEgSdT5XcN/Y6VAYmv6v62kqu9mpqsL4UHPn3xHl38T0uYmDqr 8kO9Fwv+0iDaTAd67A3XhyrXY7S+4OP8H3tLlFdceTCPdVyT9hUnn+NJMc+mfKWJfBKA 02hNkbvCyS6KzeSa2qy8Eg5KcITbczapzisvSrcEGHPnGONXZFAMjYvN+D8OEOnwrcYT Uqug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=y5yHALwoKnh4Om2eOF003SEYMGpg5VhD5QMcTpB+TLI=; b=pfDHWnbBE0UtBE3V49fYPXy+6cnH4E0sfXFksU+j5RnnnnBmUSdY7oBby28qgePcAT 2rST6+dInX6WQAyBXFfX3Bi7lOMSe6U+4NaiPNBXJvWZovU9q2raJwp9Hx1xAYYeLNCW 92K3ebanyDI0UOehHlNIMlvgYJ3+JgxIfCWd/wmwlg0xhXcyBe+URU2sOI4S31XfJxxp 8/ln1+k4XXd7BHThLyszOPAdo819V8MqpfJpJm+0P5uU16z3IrYTz0krXAsnrc+bHDVO o+3nwhb8NvObJIxkN4gY8vYiNOszELNHCeqz+CA3rImg6fCRVCryYRbe/Ih0+rn4K5uk gCGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LN8WMaNC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s138-20020a632c90000000b0044db77667ebsi34832165pgs.3.2022.10.24.05.12.20; Mon, 24 Oct 2022 05:12:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LN8WMaNC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232484AbiJXMBi (ORCPT + 99 others); Mon, 24 Oct 2022 08:01:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232543AbiJXL7P (ORCPT ); Mon, 24 Oct 2022 07:59:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6073E7C1E8; Mon, 24 Oct 2022 04:48:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AF9A36128E; Mon, 24 Oct 2022 11:47:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFAD6C433C1; Mon, 24 Oct 2022 11:47:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612078; bh=PXpipTnBrRLPqsNN64DZFWvxTM737PnWfsW5sg9ZY+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LN8WMaNCCi7KFXAY/V1XaiaHhofeOI8JAxLDenexJp5QR4qZzXCr/1RC8zChm3otJ uyIZDcy8MkHosRqwD1UuVZCB2rCt0YwjaUJxzFnGdUPVs3Ivx4hcgHKnrVw4zNHG1E ms7U0rFsvMIawf+Yowi8cfl/MKHKD6b8lR2Mf5IY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Stephen Boyd , Bjorn Andersson , Andrew Chernyakov Subject: [PATCH 4.14 034/210] rpmsg: qcom: glink: replace strncpy() with strscpy_pad() Date: Mon, 24 Oct 2022 13:29:11 +0200 Message-Id: <20221024112958.072393418@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747570973412898299?= X-GMAIL-MSGID: =?utf-8?q?1747570973412898299?= From: Krzysztof Kozlowski commit 766279a8f85df32345dbda03b102ca1ee3d5ddea upstream. The use of strncpy() is considered deprecated for NUL-terminated strings[1]. Replace strncpy() with strscpy_pad(), to keep existing pad-behavior of strncpy, similarly to commit 08de420a8014 ("rpmsg: glink: Replace strncpy() with strscpy_pad()"). This fixes W=1 warning: In function ‘qcom_glink_rx_close’, inlined from ‘qcom_glink_work’ at ../drivers/rpmsg/qcom_glink_native.c:1638:4: drivers/rpmsg/qcom_glink_native.c:1549:17: warning: ‘strncpy’ specified bound 32 equals destination size [-Wstringop-truncation] 1549 | strncpy(chinfo.name, channel->name, sizeof(chinfo.name)); [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings Signed-off-by: Krzysztof Kozlowski Reviewed-by: Stephen Boyd Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220519073330.7187-1-krzysztof.kozlowski@linaro.org Signed-off-by: Andrew Chernyakov Signed-off-by: Greg Kroah-Hartman --- drivers/rpmsg/qcom_glink_native.c | 2 +- drivers/rpmsg/qcom_smd.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) --- a/drivers/rpmsg/qcom_glink_native.c +++ b/drivers/rpmsg/qcom_glink_native.c @@ -1447,7 +1447,7 @@ static void qcom_glink_rx_close(struct q cancel_work_sync(&channel->intent_work); if (channel->rpdev) { - strncpy(chinfo.name, channel->name, sizeof(chinfo.name)); + strscpy_pad(chinfo.name, channel->name, sizeof(chinfo.name)); chinfo.src = RPMSG_ADDR_ANY; chinfo.dst = RPMSG_ADDR_ANY; --- a/drivers/rpmsg/qcom_smd.c +++ b/drivers/rpmsg/qcom_smd.c @@ -1000,7 +1000,7 @@ static int qcom_smd_create_device(struct /* Assign public information to the rpmsg_device */ rpdev = &qsdev->rpdev; - strncpy(rpdev->id.name, channel->name, RPMSG_NAME_SIZE); + strscpy_pad(rpdev->id.name, channel->name, RPMSG_NAME_SIZE); rpdev->src = RPMSG_ADDR_ANY; rpdev->dst = RPMSG_ADDR_ANY; @@ -1230,7 +1230,7 @@ static void qcom_channel_state_worker(st spin_unlock_irqrestore(&edge->channels_lock, flags); - strncpy(chinfo.name, channel->name, sizeof(chinfo.name)); + strscpy_pad(chinfo.name, channel->name, sizeof(chinfo.name)); chinfo.src = RPMSG_ADDR_ANY; chinfo.dst = RPMSG_ADDR_ANY; rpmsg_unregister_device(&edge->dev, &chinfo); From patchwork Mon Oct 24 11:29:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8568 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp418044wru; Mon, 24 Oct 2022 05:14:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5QtFTog2iHMnAz3i/tyr6KILmIbV3GyEwb5gkfsHGBS3agw/7MYjI53sRpU/u+cnJ4rMFo X-Received: by 2002:a17:906:8451:b0:78d:d467:55a4 with SMTP id e17-20020a170906845100b0078dd46755a4mr27025846ejy.352.1666613641825; Mon, 24 Oct 2022 05:14:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613641; cv=none; d=google.com; s=arc-20160816; b=xPL1XGpfZ35hVPdq5BQJ2ChCk1uTsrFpq3S+LH1/DhBIoiSKdCrT57SfpDVf1MV2wP gCVXDESgwINP4SoM+HNiRmjVb8Ho1rnLdtr0yCBQnj1ZOQn52TOFF1zjRfsgNnAmu2/n 7dOHO0U0DNgYcX7K8XErzDKUF9o3kGTTlzfecuE2xsuIxce4ks6Uw0pqcvWieN+EvdPA COTRLCdPQTZxSjqDjbwq0NHZEbRQjj1ntYMeMPTAq/3mV3JgvKAJPepMHKPc8iPrQqp9 dCZDaqZYq8U5Oa5agPMJ4YmUfLpNsamhHWu8cdGHWSsazQlCs3MOk3WNy/90MLldlc61 YE3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qfgTcnZKFZZJTGpSGImM+5zOql8T6No8AYNSY1VULUE=; b=A4IQa4lY/AXb7Tn+JePph5/IEEbjUWPcZ8INO3A/vCqV6UaNRpQcUuImo1kYxCL9x9 lxrXmUwH48dccWMYSLzdInyzElIfiJ7bmK4pFcbf9VFPYT+fKQzDM8VGFVyzIKrWJxAE 9ZleK9l5+rh/EbCxNNpYBOR8FhnOY4W6zUo3AufRbSWidAlLRg3Ds8px2mSO+GGDkSL/ EimGHsBKdhcwG2NDEb4b0t/b6iN4ltjmNdatBFdPVq45Y6oofjykIlXFJhplyQi3iAdq gYR7s37CBWOzSjlCOzmmLKZ874cyIOoICKO6FP6G0KLWHvuA/CwXH3hJOlbIP6tPiA4c NPdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rWdKEX8m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id di17-20020a170906731100b0078d8f2658e3si30829547ejc.833.2022.10.24.05.13.35; Mon, 24 Oct 2022 05:14:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rWdKEX8m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232405AbiJXMCb (ORCPT + 99 others); Mon, 24 Oct 2022 08:02:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232671AbiJXL7c (ORCPT ); Mon, 24 Oct 2022 07:59:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A46A7C324; Mon, 24 Oct 2022 04:48:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E963061290; Mon, 24 Oct 2022 11:48:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05CB8C433D6; Mon, 24 Oct 2022 11:48:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612091; bh=31mqhKt9Gn0j2CERCn74MGBZCFxUFX+32ob2F+G9/y8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rWdKEX8mYUfeGOn7NAjKix1fuqrEvaD4+kLZePuehEeCLEmFrCrQPW56l60TNzJst ikt2ZFTdbKzYURhhLGBxdNklbKOlahhoR6CAinsVtRcA09jp9xi1RJSXXq/4W6/5Wb X1N/Vbyqky9sAblxYXc7r+HQfE4L4qByhyzdmbGA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , "fw@strlen.de, avimalin@gmail.com, Vimal Agrawal" , Florian Westphal , Vimal Agrawal Subject: [PATCH 4.14 035/210] netfilter: nf_queue: fix socket leak Date: Mon, 24 Oct 2022 13:29:12 +0200 Message-Id: <20221024112958.115275475@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571066377329421?= X-GMAIL-MSGID: =?utf-8?q?1747571066377329421?= From: Vimal Agrawal Removal of the sock_hold got lost when backporting commit 4d05239203fa ("netfilter: nf_queue: fix possible use-after-free") to 4.14 This was causing a socket leak and was caught by kmemleak. Tested by running kmemleak again with this fix. Fixes: ef97921ccdc2 ("netfilter: nf_queue: fix possible use-after-free") in 4.14 Signed-off-by: Vimal Agrawal Reviewed-by: Florian Westphal --- net/netfilter/nf_queue.c | 2 -- 1 file changed, 2 deletions(-) --- a/net/netfilter/nf_queue.c +++ b/net/netfilter/nf_queue.c @@ -91,8 +91,6 @@ bool nf_queue_entry_get_refs(struct nf_q dev_hold(state->in); if (state->out) dev_hold(state->out); - if (state->sk) - sock_hold(state->sk); #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) if (entry->skb->nf_bridge) { struct net_device *physdev; From patchwork Mon Oct 24 11:29:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8559 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp417566wru; Mon, 24 Oct 2022 05:13:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6sCN+YvasEgd0RYRgWWj03kIankdgcQYxDJEkQLSgDrhq4dUUWoxHwcfi99JQF7p7fnhjX X-Received: by 2002:a17:907:9627:b0:78d:a7d8:9407 with SMTP id gb39-20020a170907962700b0078da7d89407mr27086745ejc.675.1666613599170; Mon, 24 Oct 2022 05:13:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613599; cv=none; d=google.com; s=arc-20160816; b=mwFYmCwCOuOrXEqm2o2feMBu0afpXowwEN6JXGeyT5h1GIDNHq4SDq6nbai3RvOKMy 78dAwx9yhOvvyZWY/raMfxF0N8nogMarLO+VT8tq6wIYRqZSAtiiCVAKLDMYPtWhXjs+ lMuBR9ZwmkGpTXLES2wCXHvHzvrvY8x2CYmtqcu821SX0rFfejg1ep4ySQIqExaWZDK7 Q+YBu0Lf7FN8Rgl1qieQD53fWbq5PnxTn2y75hzwGLsjp8ggpFB4B/0T2S2gVDcFWLs9 30y9slmYNWesZEGH9lwcQehvgMr1T98m0flfYqieLxjf4K56diE2cx046jidw/Y2bqNZ W6fQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rxnKb43PVueR95OuJku2w86yxCaPJHaugoFRDHBApWM=; b=CFD59vrBlqHWKkGCxFvIxvEbXJ/JO2VwYrkiDKIUT15AVcZZ57jrq20gsY9NB/47A5 7LhGXsY2fMBtileSm1SAcbPMHeE0uqwOK03OAdpPz3DERG5PDs9CinarMs8A4xxk3EFD NytOed5eLAARsmcX/H6+V9XJWnyeLb4kCIPzQDVoraRd1ZccIpqwAtKT4gG52qEAZ4pK rtMzZn8BfN174SXYEDCemaDzvROp1unQg6KHs2kZWLGOlVVFqmMe/Ay6MxByfm7uzvhs ZGuoAPNIjf0WWMRpQGlD4EBomr45+uoKeX0uMbOIRaH6Jw973L/V6zNANDBAz9FBk0Y7 Z5Mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ChASDfRQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hw8-20020a170907a0c800b0073d8830e4c7si26342708ejc.954.2022.10.24.05.12.51; Mon, 24 Oct 2022 05:13:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ChASDfRQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231234AbiJXMB4 (ORCPT + 99 others); Mon, 24 Oct 2022 08:01:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232616AbiJXL7X (ORCPT ); Mon, 24 Oct 2022 07:59:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B86E7C333; Mon, 24 Oct 2022 04:48:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8ADBD61252; Mon, 24 Oct 2022 11:48:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C542C433D6; Mon, 24 Oct 2022 11:48:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612094; bh=5bSnUp5dX34XQ99c1SQZmiSSKHcGvqw4nlmJQKpbDSk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ChASDfRQ3cezodCy6I3Y1VplWqK6hy+HSvbBzRNC3YoXKMQQyjNhuXCNHTAAzUOF5 lWbawIDtpu1GL79xj+UPa8zmzNX2O7sY6/7NXloK1nTg/tgG4tYkrddsOaVQlhWo9m C1s+l/qsCthU1MUzNXhWVGPDJH7bg63o/qmsb+QE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ryusuke Konishi , syzbot+2b32eb36c1a825b7a74c@syzkaller.appspotmail.com, Tetsuo Handa , Andrew Morton Subject: [PATCH 4.14 036/210] nilfs2: fix NULL pointer dereference at nilfs_bmap_lookup_at_level() Date: Mon, 24 Oct 2022 13:29:13 +0200 Message-Id: <20221024112958.154110294@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571021207805997?= X-GMAIL-MSGID: =?utf-8?q?1747571021207805997?= From: Ryusuke Konishi commit 21a87d88c2253350e115029f14fe2a10a7e6c856 upstream. If the i_mode field in inode of metadata files is corrupted on disk, it can cause the initialization of bmap structure, which should have been called from nilfs_read_inode_common(), not to be called. This causes a lockdep warning followed by a NULL pointer dereference at nilfs_bmap_lookup_at_level(). This patch fixes these issues by adding a missing sanitiy check for the i_mode field of metadata file's inode. Link: https://lkml.kernel.org/r/20221002030804.29978-1-konishi.ryusuke@gmail.com Signed-off-by: Ryusuke Konishi Reported-by: syzbot+2b32eb36c1a825b7a74c@syzkaller.appspotmail.com Reported-by: Tetsuo Handa Tested-by: Ryusuke Konishi Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- fs/nilfs2/inode.c | 2 ++ 1 file changed, 2 insertions(+) --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c @@ -455,6 +455,8 @@ int nilfs_read_inode_common(struct inode inode->i_atime.tv_nsec = le32_to_cpu(raw_inode->i_mtime_nsec); inode->i_ctime.tv_nsec = le32_to_cpu(raw_inode->i_ctime_nsec); inode->i_mtime.tv_nsec = le32_to_cpu(raw_inode->i_mtime_nsec); + if (nilfs_is_metadata_file_inode(inode) && !S_ISREG(inode->i_mode)) + return -EIO; /* this inode is for metadata and corrupted */ if (inode->i_nlink == 0) return -ESTALE; /* this inode is deleted */ From patchwork Mon Oct 24 11:29:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8595 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419398wru; Mon, 24 Oct 2022 05:16:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM69i9fY1NH5zjzhez71LXSpZh3q6ozj8s1DndcwIVLp89KxAeBULohLlEAsFkTGVZA0gBdp X-Received: by 2002:a05:6402:2994:b0:453:4c5c:d31c with SMTP id eq20-20020a056402299400b004534c5cd31cmr31044883edb.412.1666613773839; Mon, 24 Oct 2022 05:16:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613773; cv=none; d=google.com; s=arc-20160816; b=XqEOidHRVEH5ECA/emix8YOIAchu9b/hEQoNL34CU28MhA79VF8e3EewvSD20ifmRu jWRYKDNw00cdxcGHqmlluaM1PmObtMwJBNNrNLN41rW1HgPBKBomBQgNguXlUtzUNG82 fk+XmH1PR43Kf8IRy3/oBREfBNtwQ1AARD1IOfZktYvEMKMFpVGZlI+6epif7yhSejKe QxqRgB5XjFHnR5dqUlLC7DX09pxjekkIFVY58ISx2atO+VrTrYs/r2S9MM+aNly4Y1KS 7tHHcdZAef1Cumg/qzoyaR3yE6TcoIRuLyz+2+V4IObHi3D5uy7L15a31WvdWJZ1BOAw 629Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lyiAZO3SAm8PCa0UBN8nZxoF4SXWKIJzgi5/pFVwS4k=; b=UkRKj/ZVnXYXGosAuvr2mo36/mraVStkpM3JDcfGvAYRpDESpiC69/nezsvNj6C1Qx DUDKlyg9QUj06WSn2mUaLg6up3ZR1WFZlku9hbSwLoKJ7NS6R6TFAKM9TFKVF3u8GdKU rCZbM6z48UnMaz7PzFmxtScXLt3DVtdBGiPU1VVEgjVvTVx6g3sEkRs9JOXfhMydb/1n KDmyTpTEWm0xUVAuIKXTx2wI6OQ22rX5q0mqqMG6rb/8WhAACnHFPTOLeTyxpH77eRgY uUHHQH+tVc/UWyb8dvog970kqwVoapDEgzkxOeSpoG506Bk8XUdTRWxaf5ZSNDPOpNWD +MWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="WWr/U3+X"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y9-20020a056402270900b0045bc5ea5334si17094581edd.115.2022.10.24.05.15.48; Mon, 24 Oct 2022 05:16:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="WWr/U3+X"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232663AbiJXMGb (ORCPT + 99 others); Mon, 24 Oct 2022 08:06:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232822AbiJXMEX (ORCPT ); Mon, 24 Oct 2022 08:04:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 680C2645EC; Mon, 24 Oct 2022 04:50:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 24DA06129A; Mon, 24 Oct 2022 11:48:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3551FC433C1; Mon, 24 Oct 2022 11:48:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612096; bh=TUiPWq/VBBBaKB6AnHuiVoU+P31Rh8GRZ3nIWlDm40E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WWr/U3+XWViTayeBraGEKYB6+jSd/rpHXjtysnOYkgJEUDXa5IiSE0wqpJFkXKesC MXirQg6u7fKZoONnzNE93Owr4V2xODUJhcPgVUYg0PXJpQPUdP8PPP3zyWbNSb7SdE nGx5JUCqqMWmcdeHjss9UewWRtz513Xwd6PURZ0s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ryusuke Konishi , syzbot+7381dc4ad60658ca4c05@syzkaller.appspotmail.com, Andrew Morton Subject: [PATCH 4.14 037/210] nilfs2: fix leak of nilfs_root in case of writer thread creation failure Date: Mon, 24 Oct 2022 13:29:14 +0200 Message-Id: <20221024112958.183474754@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571204745892064?= X-GMAIL-MSGID: =?utf-8?q?1747571204745892064?= From: Ryusuke Konishi commit d0d51a97063db4704a5ef6bc978dddab1636a306 upstream. If nilfs_attach_log_writer() failed to create a log writer thread, it frees a data structure of the log writer without any cleanup. After commit e912a5b66837 ("nilfs2: use root object to get ifile"), this causes a leak of struct nilfs_root, which started to leak an ifile metadata inode and a kobject on that struct. In addition, if the kernel is booted with panic_on_warn, the above ifile metadata inode leak will cause the following panic when the nilfs2 kernel module is removed: kmem_cache_destroy nilfs2_inode_cache: Slab cache still has objects when called from nilfs_destroy_cachep+0x16/0x3a [nilfs2] WARNING: CPU: 8 PID: 1464 at mm/slab_common.c:494 kmem_cache_destroy+0x138/0x140 ... RIP: 0010:kmem_cache_destroy+0x138/0x140 Code: 00 20 00 00 e8 a9 55 d8 ff e9 76 ff ff ff 48 8b 53 60 48 c7 c6 20 70 65 86 48 c7 c7 d8 69 9c 86 48 8b 4c 24 28 e8 ef 71 c7 00 <0f> 0b e9 53 ff ff ff c3 48 81 ff ff 0f 00 00 77 03 31 c0 c3 53 48 ... Call Trace: ? nilfs_palloc_freev.cold.24+0x58/0x58 [nilfs2] nilfs_destroy_cachep+0x16/0x3a [nilfs2] exit_nilfs_fs+0xa/0x1b [nilfs2] __x64_sys_delete_module+0x1d9/0x3a0 ? __sanitizer_cov_trace_pc+0x1a/0x50 ? syscall_trace_enter.isra.19+0x119/0x190 do_syscall_64+0x34/0x80 entry_SYSCALL_64_after_hwframe+0x63/0xcd ... Kernel panic - not syncing: panic_on_warn set ... This patch fixes these issues by calling nilfs_detach_log_writer() cleanup function if spawning the log writer thread fails. Link: https://lkml.kernel.org/r/20221007085226.57667-1-konishi.ryusuke@gmail.com Fixes: e912a5b66837 ("nilfs2: use root object to get ifile") Signed-off-by: Ryusuke Konishi Reported-by: syzbot+7381dc4ad60658ca4c05@syzkaller.appspotmail.com Tested-by: Ryusuke Konishi Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- fs/nilfs2/segment.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c @@ -2797,10 +2797,9 @@ int nilfs_attach_log_writer(struct super inode_attach_wb(nilfs->ns_bdev->bd_inode, NULL); err = nilfs_segctor_start_thread(nilfs->ns_writer); - if (err) { - kfree(nilfs->ns_writer); - nilfs->ns_writer = NULL; - } + if (unlikely(err)) + nilfs_detach_log_writer(sb); + return err; } From patchwork Mon Oct 24 11:29:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8557 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp417299wru; Mon, 24 Oct 2022 05:12:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7ZKQawzId+e1BBv7CGM/iygMLMlwSjwxiffOyMJ1GH8vZSJQHjJLfOQZLV2TmCsbWtanlS X-Received: by 2002:a17:907:60c8:b0:78d:bc56:8f04 with SMTP id hv8-20020a17090760c800b0078dbc568f04mr26146722ejc.560.1666613575080; Mon, 24 Oct 2022 05:12:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613575; cv=none; d=google.com; s=arc-20160816; b=NTIGrXamMknOiY1NOmus6tyIkMet+P0IAWA8W6K03n3qgtnaIfebfA/NcrbBLQehU9 4+frGAuem+/PxZQTCEXHXUs/oMBEvQQnszfBEwbnulBPe1ajKQG5LOhzSpDZDkcdfoa+ n/X4IZicACreWLLJz5iGO0yQ8A6mtbUJAKRqF1O0kI9mzy7A/JSzOyHNto459NjYM0sx X5Vo0WsfIGimMXu0REj/Mbdw4D5wTt4L2BMweHL45FsDFCR1w4cdOIiosJ5Tjqs7zZ7/ lJrqgdRQAlhoBrtNmX9cl4BJhQ8fwwgxhKZDuBl3IHLGIvbmok63CIA6pCYOJ4cLRWlh /+rQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VqkD/nkhMGhudOfeJeix208hJTZvfukAfhg3TtWawxU=; b=vb8yDJ9SvRQZmb7+gYQ5f08hfpXUMukJ7b8SzzkhxF5HE3ET0v4e0iehOiZ8lFYjbo UgRtMLvi+SFyDxpwyH914XF3NkPBCEiFHVNFhp59+fKhE/2OJbaYcvZEvVJoOREuE663 r1ZD47aYiyk8EBM3YSwlKiaRSCs+gjA9ShHIaWloSSjU4+jcDm8jiTodmlLuQOgsRvZ2 dpn1U16bvmDIH7iz7DRxakNAlrPA9No84QLC7q9WB6VO48DNp9zKOLgJsWYzmtreFfab r+hfGzCcc/er9+07tLsqDR6M2O/OBNExYRMDKK+cCDOGw9PFOyh9wY1NiVksj5tjZffS 6miQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=it0mRzUA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r23-20020a056402019700b00460ff7dc801si10221188edv.445.2022.10.24.05.12.29; Mon, 24 Oct 2022 05:12:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=it0mRzUA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232529AbiJXMCZ (ORCPT + 99 others); Mon, 24 Oct 2022 08:02:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232670AbiJXL7c (ORCPT ); Mon, 24 Oct 2022 07:59:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C08787C1B6; Mon, 24 Oct 2022 04:48:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BBC336122D; Mon, 24 Oct 2022 11:48:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7B2AC433D6; Mon, 24 Oct 2022 11:48:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612099; bh=UMm37vhx2Pm1xPMwjWbO6ZLH1cF6XvpSLwvokmNXpfE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=it0mRzUAeDhB6etket/FKuDDKgt42F7aX4gP7X9WWiHmhfLVklRCxQYY4gL7HAkQt spl5b6/Gk8n5YuGzTEBVmoQKX3NarpehHfrk9rPnPpkCuEyjMk0fLuXLQiyUtnwQq6 xcyLPwBhZDc2FUItJvlcaiJTyIUV5A0Qn6/5m1/4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ryusuke Konishi , syzbot+fbb3e0b24e8dae5a16ee@syzkaller.appspotmail.com, Andrew Morton Subject: [PATCH 4.14 038/210] nilfs2: replace WARN_ONs by nilfs_error for checkpoint acquisition failure Date: Mon, 24 Oct 2022 13:29:15 +0200 Message-Id: <20221024112958.222143094@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747570995938977871?= X-GMAIL-MSGID: =?utf-8?q?1747570995938977871?= From: Ryusuke Konishi commit 723ac751208f6d6540191689cfbf6c77135a7a1b upstream. If creation or finalization of a checkpoint fails due to anomalies in the checkpoint metadata on disk, a kernel warning is generated. This patch replaces the WARN_ONs by nilfs_error, so that a kernel, booted with panic_on_warn, does not panic. A nilfs_error is appropriate here to handle the abnormal filesystem condition. This also replaces the detected error codes with an I/O error so that neither of the internal error codes is returned to callers. Link: https://lkml.kernel.org/r/20220929123330.19658-1-konishi.ryusuke@gmail.com Signed-off-by: Ryusuke Konishi Reported-by: syzbot+fbb3e0b24e8dae5a16ee@syzkaller.appspotmail.com Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- fs/nilfs2/segment.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c @@ -890,9 +890,11 @@ static int nilfs_segctor_create_checkpoi nilfs_mdt_mark_dirty(nilfs->ns_cpfile); nilfs_cpfile_put_checkpoint( nilfs->ns_cpfile, nilfs->ns_cno, bh_cp); - } else - WARN_ON(err == -EINVAL || err == -ENOENT); - + } else if (err == -EINVAL || err == -ENOENT) { + nilfs_error(sci->sc_super, + "checkpoint creation failed due to metadata corruption."); + err = -EIO; + } return err; } @@ -906,7 +908,11 @@ static int nilfs_segctor_fill_in_checkpo err = nilfs_cpfile_get_checkpoint(nilfs->ns_cpfile, nilfs->ns_cno, 0, &raw_cp, &bh_cp); if (unlikely(err)) { - WARN_ON(err == -EINVAL || err == -ENOENT); + if (err == -EINVAL || err == -ENOENT) { + nilfs_error(sci->sc_super, + "checkpoint finalization failed due to metadata corruption."); + err = -EIO; + } goto failed_ibh; } raw_cp->cp_snapshot_list.ssl_next = 0; From patchwork Mon Oct 24 11:29:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8572 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp418129wru; Mon, 24 Oct 2022 05:14:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM479BUbMzSQSWz2ry8YPaYR4xj9xxvRhNWUERuwjb7ENiLxPxO2sZou5QmMDpQSoDZmkqE9 X-Received: by 2002:a63:f056:0:b0:46e:99bb:166d with SMTP id s22-20020a63f056000000b0046e99bb166dmr18788706pgj.480.1666613649518; Mon, 24 Oct 2022 05:14:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613649; cv=none; d=google.com; s=arc-20160816; b=L/xnFEu3OINlsDTuEWobWNrPyjMCNfDI2F7KCBl3gMTvQOReqFdeuzYKCnjp2ow9n5 C4J2bf+mFmJhxgTJURQZbiX0YMONxK16df4GRj49MFP/2r6Pv2lYzDHwTRSYB19oDv16 G/pksk8AOQib4E32z91z/+myxN8Uy50U499U5jcUHZDZuKc/SciJOGLAEaE4mIRbp8a0 CbEjXKRUy9Ab2s31jZSY+BIcne93jqUy8dCm7Ta6dWWFCqEhk/5Y9w2kAFExOmBcCvd3 5DN8dRxwuUod1y3EIKteCsPiFw8r6euvc0foWuawWxBlbkEBQRtiFareFI633gCHReld EDxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YaNOmbuA2W/42y9DLb3m4ngj90Rey4ddTCF9+cXOp4U=; b=N4ShidntQL8SouP/qCbfZj0L3PGHtauPFMu6Z466MnjbWOK/FXIThb5X4/qfpiRIin wKA0fGF8DjG2VyOFAB8CpBN6MYmOFqMl2gDZOUYe5UH0EZhrfJdvMSfXQT0b1f7Rst99 Yv74vz2z8lR67UkiYl6m/H0SqaEEnxwN8C5sOrx5s/rrqA1JqLsBOTLEKG+3BgBB7fyX bzNq9znZDNNqG3ZIaoH+1qRzbYe7n9CwNKqYwyqeSREjT9W1OMcNe5Qi7Ll6cXzOug77 J5nCO1HQAlxR7mT8F9tvRChqHZACuOBpOyLQ57sl2KpUjZUPrvgKFk3IAbcsCHcW+Q27 uxcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="m7OQka/b"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b6-20020a170903228600b0017f75ce8a2esi38313101plh.575.2022.10.24.05.13.54; Mon, 24 Oct 2022 05:14:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="m7OQka/b"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232604AbiJXMFy (ORCPT + 99 others); Mon, 24 Oct 2022 08:05:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232608AbiJXMDz (ORCPT ); Mon, 24 Oct 2022 08:03:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5684D2F649; Mon, 24 Oct 2022 04:49:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 23B20B811A6; Mon, 24 Oct 2022 11:48:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E5DBC433C1; Mon, 24 Oct 2022 11:48:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612101; bh=TMvR2MeejFZ+Q3PY0N79YCpGWHa+6Q5n9P36TzDFrTQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m7OQka/bJGqW3Kqewqd8J/NvhTu2hASYZbIh+s7auPwHwxNMV88Asn4VUoSR9JKtH fCurSwy6tY72lQk0IcahVrRsz+PI7xyJLiR0NOwNfMPc7KyvkxSmfSmPObE4DAku7u YINyr4mO+7K4d+KhPPtbwNmsDRo8rwyvZxBsN8zA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hu Weiwen , Xiubo Li , Ilya Dryomov Subject: [PATCH 4.14 039/210] ceph: dont truncate file in atomic_open Date: Mon, 24 Oct 2022 13:29:16 +0200 Message-Id: <20221024112958.258391812@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571074327477568?= X-GMAIL-MSGID: =?utf-8?q?1747571074327477568?= From: Hu Weiwen commit 7cb9994754f8a36ae9e5ec4597c5c4c2d6c03832 upstream. Clear O_TRUNC from the flags sent in the MDS create request. `atomic_open' is called before permission check. We should not do any modification to the file here. The caller will do the truncation afterward. Fixes: 124e68e74099 ("ceph: file operations") Signed-off-by: Hu Weiwen Reviewed-by: Xiubo Li Signed-off-by: Ilya Dryomov [Xiubo: fixed a trivial conflict for 5.10 backport] Signed-off-by: Xiubo Li Signed-off-by: Greg Kroah-Hartman --- fs/ceph/file.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -381,6 +381,12 @@ int ceph_atomic_open(struct inode *dir, if (dentry->d_name.len > NAME_MAX) return -ENAMETOOLONG; + /* + * Do not truncate the file, since atomic_open is called before the + * permission check. The caller will do the truncation afterward. + */ + flags &= ~O_TRUNC; + if (flags & O_CREAT) { err = ceph_pre_init_acls(dir, &mode, &acls); if (err < 0) @@ -411,9 +417,7 @@ int ceph_atomic_open(struct inode *dir, req->r_parent = dir; set_bit(CEPH_MDS_R_PARENT_LOCKED, &req->r_req_flags); - err = ceph_mdsc_do_request(mdsc, - (flags & (O_CREAT|O_TRUNC)) ? dir : NULL, - req); + err = ceph_mdsc_do_request(mdsc, (flags & O_CREAT) ? dir : NULL, req); err = ceph_handle_snapdir(req, dentry, err); if (err) goto out_req; From patchwork Mon Oct 24 11:29:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8751 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430099wru; Mon, 24 Oct 2022 05:40:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM76p5nelDPyoJlAfQa7lS39fq0Fo9oi82JvI0XjJtAGLrmdRSt8BXe/Q+sbihskbU8xW1xW X-Received: by 2002:a62:1e83:0:b0:545:6896:188 with SMTP id e125-20020a621e83000000b0054568960188mr33172102pfe.51.1666615243710; Mon, 24 Oct 2022 05:40:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615243; cv=none; d=google.com; s=arc-20160816; b=SRQFk1djjA+op61Yl4g+WHH2Ruq7J4wnytEbxTrPOEeiHNdLfh6BR6wmGMlkU1KeNC bGbfghkvmkplXMRSeG+lVG832kqkBP1o7WAP/7TKjCDwExDHOCgz7ZhkPPBouv+Zlffh HZss22Lkd0nt3mjNAeV+ZriPhODYbPk4qicicj5RPdPYSIP5mJCl2rN58ZzoffW2hXij 7b3FkI8dYYCUrDsR9mPbN44RvpXF2IUi3mIQ0iNWh7Kao/Wvm21PEtzwJYFozhxPjlsN j+588jzTcEcr/rJwXrmYcDkdPsFCRSDJ7kgQjGh+F1ksDQ+YTa5eBXGF6dDzhz516vi5 5b5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pmf6mzXEJEilQdJUZRxaNdE4ILcO7NZa149O8jke8BI=; b=U2xQXoPt+FX2SBD4bYKwM4aDsYYo64oanVm+mOHTsnf6Uvj/6sUMh81I5or/ww8gVX RpkGKfDAIaGbWYxi03/VyUEw9kBdBtbrTgtr819agc2MPwEQ0Q6CID3rT/Z2GkjVXfcz ucJcWVjIiTRWzd5ZlSlc7VQb29DJeOiddSE5Nujoht6EY34dmJw8X+SK0Mv3CuyD65/u 5h2/3EHGgOS0pLKbAZ1ffyI+xhutIR7X2xtgVLXTh3uNvC9Xs8w/8+KnkCG/CsOYe+IQ u4y642oshO97yobBnJJL05Nsg2lN897444V4hIg9hWtal4k7OEmquWFJW8TEyo4qwbFT Dx2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vi1rAUrh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u12-20020a17090341cc00b0017486813f81si590676ple.528.2022.10.24.05.40.29; Mon, 24 Oct 2022 05:40:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vi1rAUrh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233639AbiJXM0r (ORCPT + 99 others); Mon, 24 Oct 2022 08:26:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230472AbiJXMZb (ORCPT ); Mon, 24 Oct 2022 08:25:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFB5258140; Mon, 24 Oct 2022 05:00:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B6FA6B8118A; Mon, 24 Oct 2022 11:48:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 111AFC433D6; Mon, 24 Oct 2022 11:48:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612104; bh=Sf4p/I5+I0rasfxMUpNRv3gda7JlSUROFiBRNveWqCk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vi1rAUrhZfxizR3g36tsgkkye98QnJztEKh1rqMN81XdOfKOk9r9du9NSTnyVJIyw k4Wwnaio3ARfTwy23AMkyj1Lvk1UREycdQJsoeTfESCLBqQfztDjfDHR1DFbZyFkCM uvTJgEoW0ZGeffb//xIQ2MXUkU8Ma6+zJ3dV+t1I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Jason A. Donenfeld" Subject: [PATCH 4.14 040/210] random: clamp credited irq bits to maximum mixed Date: Mon, 24 Oct 2022 13:29:17 +0200 Message-Id: <20221024112958.289237020@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572745486144461?= X-GMAIL-MSGID: =?utf-8?q?1747572745486144461?= From: Jason A. Donenfeld commit e78a802a7b4febf53f2a92842f494b01062d85a8 upstream. Since the most that's mixed into the pool is sizeof(long)*2, don't credit more than that many bytes of entropy. Fixes: e3e33fc2ea7f ("random: do not use input pool from hard IRQs") Cc: stable@vger.kernel.org Signed-off-by: Jason A. Donenfeld Signed-off-by: Greg Kroah-Hartman --- drivers/char/random.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -976,7 +976,7 @@ static void mix_interrupt_randomness(str local_irq_enable(); mix_pool_bytes(pool, sizeof(pool)); - credit_init_bits(max(1u, (count & U16_MAX) / 64)); + credit_init_bits(clamp_t(unsigned int, (count & U16_MAX) / 64, 1, sizeof(pool) * 8)); memzero_explicit(pool, sizeof(pool)); } From patchwork Mon Oct 24 11:29:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8535 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp416557wru; Mon, 24 Oct 2022 05:11:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4W9DBC2h/riK24BvZ0MXIusd8pHMR6S395x54fqNpT7GBXd3rqrSv7Nl7KzsQ7aXfA6MUB X-Received: by 2002:a17:907:a065:b0:78d:c5dd:45cf with SMTP id ia5-20020a170907a06500b0078dc5dd45cfmr27842566ejc.117.1666613513053; Mon, 24 Oct 2022 05:11:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613513; cv=none; d=google.com; s=arc-20160816; b=yuko9XenlEq+NN/zBlCr2WwMhNrt5PHHvUivVBc7hGqr0Rmv+/tXiCaQxyy0Jqn7z1 WJ92qBOkGAH2pc72iEJoRWlsKaPL/LL+Q15pNmle/OKfEq3jsD/d/LYMIB1Dz9lqh+3e j/NRQS3W7LjqZbA8QhjtowRIhnTJMJsMWWrUIQVAV8R3gd7MyjOWUHsVvUGx2OWBiB5A 7+DpIuKSyBidDu1OHP11WI+2dDbj8UXHqPALOk6jyT+5e2yNTn+gQrFQOScCIvjHqMMg Fy3wsT6EDAxVm6WM2BvKyp3S4FIyDCPrIjrkhgusKSSJqNMsCIHtcsgOuVAmn9WRg1zi ufBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=I+ANAJpr+8wMKEpFCB+xk6Qe+OXZhGL2J1jehRPDRjw=; b=KbY9etOZSTHR+5IwcXZ4uvM8/UIXKs4nDLCWQZlakpzLjLqqDpc2kpY4nv9+UQsi7a Zw45ixMqiERuBG1dx5cjltre5V8Rq1OKvB9lHxmcH4XtHLwaV8IduS8zqQ3aFz6OXNhi 8wgnIpZogAfV8OYR4+YrYOMyBYDVuXA+QJpaZUIgNtLrWIoj5JwTzoL7PMjPPr29T1m/ tx8LhptjCxAQqQsqDl64RHBCoFU3qSpaE3gIzkgJ/ePfEyO3GRQ0KNbMyHhEjfLQ2Rcb eOhHQSBgPAriVbjIWI152lH9Yam5JaMUUdcNop3eAnPxeIPQG7zPAEvBNSAQbo1Bk3i1 1o0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mbct1K4V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l22-20020a17090612d600b007836bd283a5si26165154ejb.678.2022.10.24.05.11.24; Mon, 24 Oct 2022 05:11:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mbct1K4V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232392AbiJXL6W (ORCPT + 99 others); Mon, 24 Oct 2022 07:58:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232156AbiJXL4r (ORCPT ); Mon, 24 Oct 2022 07:56:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F10A7B29E; Mon, 24 Oct 2022 04:47:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B9F12B8119F; Mon, 24 Oct 2022 11:47:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C6E1C433C1; Mon, 24 Oct 2022 11:47:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612022; bh=HcpGPCOEX3wCd/MN7AXOwedC+Kl55GIaCX/bTzIOc+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mbct1K4VR9qd1EaMv8x71mfEl9J1qHvUahqEikOWK1pJqTCn5Gu0VMvDWPp8Skeeq DD+PMyUE3d+8TMefQ/Felj5paAOJWkFMWM4hIxRL9TMqzb7ppP+9B1xEOUyKq6r1ZU 6OtlJcAABUwI/+kVjSluGlMVlFAPNyq6704ZANbI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai , Hans de Goede Subject: [PATCH 4.14 041/210] ALSA: hda: Fix position reporting on Poulsbo Date: Mon, 24 Oct 2022 13:29:18 +0200 Message-Id: <20221024112958.323821272@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747570931078291200?= X-GMAIL-MSGID: =?utf-8?q?1747570931078291200?= From: Takashi Iwai commit 56e696c0f0c71b77fff921fc94b58a02f0445b2c upstream. Hans reported that his Sony VAIO VPX11S1E showed the broken sound behavior at the start of the stream for a couple of seconds, and it turned out that the position_fix=1 option fixes the issue. It implies that the position reporting is inaccurate, and very likely hitting on all Poulsbo devices. The patch applies the workaround for Poulsbo generically to switch to LPIB mode instead of the default position buffer. Reported-and-tested-by: Hans de Goede Cc: Link: https://lore.kernel.org/r/3e8697e1-87c6-7a7b-d2e8-b21f1d2f181b@redhat.com Link: https://lore.kernel.org/r/20221001142124.7241-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/pci/hda/hda_intel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -2571,7 +2571,8 @@ static const struct pci_device_id azx_id .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_NOPM }, /* Poulsbo */ { PCI_DEVICE(0x8086, 0x811b), - .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_BASE }, + .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_BASE | + AZX_DCAPS_POSFIX_LPIB }, /* Oaktrail */ { PCI_DEVICE(0x8086, 0x080a), .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_BASE }, From patchwork Mon Oct 24 11:29:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8540 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp416722wru; Mon, 24 Oct 2022 05:12:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6xS18a9s+d5Q+w3H97aoARLLhv0fl5LYz7BvfqoasDIcHYDx9FFutectvtADhnj9W2KMKl X-Received: by 2002:a17:906:7952:b0:787:a14d:65a7 with SMTP id l18-20020a170906795200b00787a14d65a7mr27470180ejo.108.1666613529103; Mon, 24 Oct 2022 05:12:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613529; cv=none; d=google.com; s=arc-20160816; b=CVyVGjoT22CnBFmFuY8zjlR4Fh7dxFShoQbXp6beAFh9rkAXGVn4Hcic2HUBDCF+dg yNQSia4UCW8ilTaw+Xzwckw1KaKic4hl/hEFp4K695IbktzXHAT5lV9HDVv+RWANITfP g2qxTq1H9qVMb6NRn9b+Q2dgBMhTAAXW/LIoX+zz8TcEWz5qsGS+5Z/EdBzYRLNcI3LI ZPNowj2oqkgl6YJV6dqXwxIu64i9k32nluus9V8BUwHjL/O3HlxPvXltOj58dYuVsQUu LE+4CvxOTT0ws8GWGsuSILXA0MIRQCYsC483XY1oohDBej5/yajf09zUWUOsMXUPIt5r rvWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nIMtQacSyHIJRf/VgOtA6Ci9qDw8rW2tiZek/UPp+fM=; b=VEYVvT9fdZkZrbHqIcDjxW0OMXyQBrwpro4tkZDFhtdmgxRX9xCiZToQGUrw5QJSAz UGmpR3RDjAsbhIXn2Axx9tOddDy+qFkSkJdPbF5DS8FK03+yfBuYIwJDGTfKiTTe5ZuW dkT5l+yKMW2xnQaNF5mjwCB8fMEhFNcx/GPIRYmZbZ5i8bLw6BjBF8cs28ENo63VkUFO OIncQ76UJDOKaYmggjtrg24ZDZF8z15HzDiw24hWABveHXIECSj91G2uXXc/tqaTMwfZ XB8LPrmprTO69g5cP11YoOj0o6a4x3xU94uBkg7Nip1DZJCDkfYoiiM8R0LV6cSUv0/S Naqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JeCo3H+P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sg10-20020a170907a40a00b0079b40c09982si9204664ejc.340.2022.10.24.05.11.45; Mon, 24 Oct 2022 05:12:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JeCo3H+P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232109AbiJXL6K (ORCPT + 99 others); Mon, 24 Oct 2022 07:58:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232300AbiJXL4p (ORCPT ); Mon, 24 Oct 2022 07:56:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CF467B59B; Mon, 24 Oct 2022 04:47:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 99D63612C4; Mon, 24 Oct 2022 11:47:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC842C433C1; Mon, 24 Oct 2022 11:47:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612025; bh=8QijUqrZkNGn8CSBqyXrNCQH2/o5uhewWiu4+YkLQb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JeCo3H+P5Lx2YeYhtWWAoWoJuFzPzYZm6mtCaOZ892KI8kSxXmfiHLxhE58ajW/6s vQKnidtF1TgvCFoTbh5q0RB6iaOTh1o6xTmvoZ1iHEc39548KgDuAUDXaN9Tnrzuxw sfTiX4EPUhydHml+nk1lGzUUMhQ+T5gXc3znyFwQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, "James E.J. Bottomley" , "Martin K. Petersen" , Dan Carpenter , hdthky , Linus Torvalds Subject: [PATCH 4.14 042/210] scsi: stex: Properly zero out the passthrough command structure Date: Mon, 24 Oct 2022 13:29:19 +0200 Message-Id: <20221024112958.359182596@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747570947948996599?= X-GMAIL-MSGID: =?utf-8?q?1747570947948996599?= From: Linus Torvalds commit 6022f210461fef67e6e676fd8544ca02d1bcfa7a upstream. The passthrough structure is declared off of the stack, so it needs to be set to zero before copied back to userspace to prevent any unintentional data leakage. Switch things to be statically allocated which will fill the unused fields with 0 automatically. Link: https://lore.kernel.org/r/YxrjN3OOw2HHl9tx@kroah.com Cc: stable@kernel.org Cc: "James E.J. Bottomley" Cc: "Martin K. Petersen" Cc: Dan Carpenter Reported-by: hdthky Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/stex.c | 17 +++++++++-------- include/scsi/scsi_cmnd.h | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) --- a/drivers/scsi/stex.c +++ b/drivers/scsi/stex.c @@ -673,16 +673,17 @@ stex_queuecommand_lck(struct scsi_cmnd * return 0; case PASSTHRU_CMD: if (cmd->cmnd[1] == PASSTHRU_GET_DRVVER) { - struct st_drvver ver; + const struct st_drvver ver = { + .major = ST_VER_MAJOR, + .minor = ST_VER_MINOR, + .oem = ST_OEM, + .build = ST_BUILD_VER, + .signature[0] = PASSTHRU_SIGNATURE, + .console_id = host->max_id - 1, + .host_no = hba->host->host_no, + }; size_t cp_len = sizeof(ver); - ver.major = ST_VER_MAJOR; - ver.minor = ST_VER_MINOR; - ver.oem = ST_OEM; - ver.build = ST_BUILD_VER; - ver.signature[0] = PASSTHRU_SIGNATURE; - ver.console_id = host->max_id - 1; - ver.host_no = hba->host->host_no; cp_len = scsi_sg_copy_from_buffer(cmd, &ver, cp_len); cmd->result = sizeof(ver) == cp_len ? DID_OK << 16 | COMMAND_COMPLETE << 8 : --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -225,7 +225,7 @@ static inline struct scsi_data_buffer *s } static inline int scsi_sg_copy_from_buffer(struct scsi_cmnd *cmd, - void *buf, int buflen) + const void *buf, int buflen) { return sg_copy_from_buffer(scsi_sglist(cmd), scsi_sg_count(cmd), buf, buflen); From patchwork Mon Oct 24 11:29:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8565 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp417884wru; Mon, 24 Oct 2022 05:13:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5o2XNBAWRo+5yghkhGrR6o6tsy0A80XHsmLTbkGHafvm6pnXMpthN/DU9t9nCTcIrGReF6 X-Received: by 2002:aa7:c054:0:b0:453:98c6:f6c4 with SMTP id k20-20020aa7c054000000b0045398c6f6c4mr30255719edo.2.1666613628320; Mon, 24 Oct 2022 05:13:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613628; cv=none; d=google.com; s=arc-20160816; b=LudejoAaqPy1jtZEsEfjm2T57B6RQvqQIktZSiXS199XfUMWc+g8UzgQk+zfrF4sZ4 hADqto1CAv0vHMmd+hQsGo7MMxmY4hUqzgiFQE+ggE46HE/4x1v9ZpWHyJS0VR5o/yqx 3K3qEqtSonLuRbsrIThQxjqsHPQZDv4v9HEw4hRsOFLSEGTGGkU1lk3MjwM7YgMrEJU6 w03YYag+rTCrfRxQch4lEyEQOW2o58qnyTs3Rgtp9y7jj5edeE+tEC8fpflBOsYrSAJ6 mQpui4mtsMMd6YliTCyZ5FaJW2NwUY0V5qojqdiDD5HFyt/757/eKbarbKlxy7mekNrv aUfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RrbBuYO/Zz31jTQs8K2OLB/2j3MXnTHj41B3Xu2enOM=; b=fnamzpJ61eBAeJtOX5h2EDUUKkiV0unZor/0kJiUJSx7I19aIc7CZq/OBo/ZD0uIdK BwE1LHL1Ko4TxgQ3gNscwx6mH/TaQl8PNztl+5mxnAzcKrurTzAWZS00Davi/ioJvDRl juaBS8jpxOM6wR6Ioa5nJO/gi+mlmA1kYN+rkUxL9JaLvZQtJ7sBDoYpZU3rwwc15DGV I54AkQYpi9Q3Lf73PKhiABWreoC5YdAcHupUAKTG7clUUTPbDE++wtMGrAq4l63UKdg2 Rc1eKombddGwc1u/GdJxjHxf9mg8uDsPaBmJDe1WAPb2miycg19ZUGzrQMOyCTa8n9cC jbmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eXwxZVg4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m14-20020a056402510e00b0045dc25bb7easi21723689edd.555.2022.10.24.05.13.21; Mon, 24 Oct 2022 05:13:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eXwxZVg4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229651AbiJXMFL (ORCPT + 99 others); Mon, 24 Oct 2022 08:05:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232283AbiJXMCX (ORCPT ); Mon, 24 Oct 2022 08:02:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA04027162; Mon, 24 Oct 2022 04:49:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E6FDCB8119C; Mon, 24 Oct 2022 11:47:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46F6CC433D7; Mon, 24 Oct 2022 11:47:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612027; bh=LSxeXqIfLkfCe1mrHfnM4jsex1rUwKaG6O4JFKNxDsw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eXwxZVg49w5jl3zUrh2Mb+l8OFT3uOy6+1zazYerRSPnaLzpLFRe/uTC8jWi7bnxy +tGcQKb5c3d0QA1TdOQVIjNh08GYNhvtEm5nLiWa4SlYstL0WYSL23QL+qIC5GMWZI dnC7Co8S4lIQA+X3vb7TQM92zt8nAvW2G59BmYYM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Frank Wunderlich , Johan Hovold Subject: [PATCH 4.14 043/210] USB: serial: qcserial: add new usb-id for Dell branded EM7455 Date: Mon, 24 Oct 2022 13:29:20 +0200 Message-Id: <20221024112958.394942248@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571051964210450?= X-GMAIL-MSGID: =?utf-8?q?1747571051964210450?= From: Frank Wunderlich commit eee48781ea199e32c1d0c4732641c494833788ca upstream. Add support for Dell 5811e (EM7455) with USB-id 0x413c:0x81c2. Signed-off-by: Frank Wunderlich Cc: stable@vger.kernel.org Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/qcserial.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/usb/serial/qcserial.c +++ b/drivers/usb/serial/qcserial.c @@ -181,6 +181,7 @@ static const struct usb_device_id id_tab {DEVICE_SWI(0x413c, 0x81b3)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card (rev3) */ {DEVICE_SWI(0x413c, 0x81b5)}, /* Dell Wireless 5811e QDL */ {DEVICE_SWI(0x413c, 0x81b6)}, /* Dell Wireless 5811e QDL */ + {DEVICE_SWI(0x413c, 0x81c2)}, /* Dell Wireless 5811e */ {DEVICE_SWI(0x413c, 0x81cb)}, /* Dell Wireless 5816e QDL */ {DEVICE_SWI(0x413c, 0x81cc)}, /* Dell Wireless 5816e */ {DEVICE_SWI(0x413c, 0x81cf)}, /* Dell Wireless 5819 */ From patchwork Mon Oct 24 11:29:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10010 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp618205wru; Mon, 24 Oct 2022 12:33:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6lZgYnfSlXs6zputXAU3dp0mYfXXuih8ILVq8EQlssbVcgNWbk2NVVd+g3NczFncAXV8W9 X-Received: by 2002:a17:902:ccc4:b0:186:6fcb:3fcf with SMTP id z4-20020a170902ccc400b001866fcb3fcfmr21810237ple.100.1666639997677; Mon, 24 Oct 2022 12:33:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666639997; cv=none; d=google.com; s=arc-20160816; b=QXSedT/5lER8CWaUUXrqljK/yupeJYcNcGCFw+lsOI3t+M/aa95InyoGTuwQpkAhDx oJO1H31RRP5Kmm6BOTY/5nVQrXLAN/Ppd+Xfa34k/NK1JPbjI6LHYCiGdq9m22pf6P24 fELthz90WwcO/IfqAUNpVRrdXM9R1rMpvg/l4O6aabVR7WaE8v7rDcCELTFzbqhe23ZA esuserjR3bT/OSLWXWkKAFgaloQxYmuzYxlPt18FPFXTc0JGS0xKHgSzxriPuTohTBV0 GSYIk8CuiI+YbExJ3yWSSc0gAjAJ0E8qvZ/w4m+N0v657wL2AttwPbU9tMxZUXT/Xdbg cF9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5Pb2fNaaf06ZMsnWzUv8A8UZI+3EJnK07iuFaTV06Do=; b=urIrHP5R+ZuTlaHZcLCEH+DZbd3O0cJgn5cRmTDpoLCsqNsJqtbCGjjXs7CJMba4n+ G08ob04vxHqNBOrWZnuIJZ5EEIIJPa4mj6kuyNIPW6SugTmYs9VFpN70O24GPVLFL3n7 yPPglfrZ/bNzszUea2UWfJiO5kERm0R1Hejx3fZnf5t9qTihC4DwUqrgXopKDD+7nqF7 9A9IMJmeVVpsuGE2zz9DM5DRCc0TVv118G87Y+66UxS0gRMUI+7j2XWDag8G3Rvuam8t ZHjw4dOiftpjtCCgcnUTnJcXyNjtlYXLDXI8U3lBpKd4GFHlYauZAt41PiTGI5Gl8bZg zGGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ikt73LiH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j189-20020a6380c6000000b00438b7cb3311si374087pgd.501.2022.10.24.12.33.04; Mon, 24 Oct 2022 12:33:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ikt73LiH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233049AbiJXTbU (ORCPT + 99 others); Mon, 24 Oct 2022 15:31:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233794AbiJXTaB (ORCPT ); Mon, 24 Oct 2022 15:30:01 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12EF91EEA3C; Mon, 24 Oct 2022 11:01:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id CA06BCE1348; Mon, 24 Oct 2022 11:47:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0EFDC433C1; Mon, 24 Oct 2022 11:47:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612030; bh=4bL5Tuj/hi3U+nafDv72MeeMFAUY9IxSCW/j3e9tN8Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ikt73LiHr0W8jiaw/goOxobFFukTztjJvWdZqzd4rQQOgpbWnPcnTvRad50O1vTQV ory02BUF89lnLOUNKeehpNvR9kb8hrT6xQ9llkMOuBwi5AyaId1XOPMlPOPUl6SR5U jRLRYvxMnFlKDj7/D2bzxqwm94A3UOQ+bJVrN4aU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guozihua , Zhongguohua , Al Viro , Theodore Tso , Andrew Lutomirski , "Jason A. Donenfeld" Subject: [PATCH 4.14 044/210] random: restore O_NONBLOCK support Date: Mon, 24 Oct 2022 13:29:21 +0200 Message-Id: <20221024112958.426074294@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747598702382161134?= X-GMAIL-MSGID: =?utf-8?q?1747598702382161134?= From: Jason A. Donenfeld commit cd4f24ae9404fd31fc461066e57889be3b68641b upstream. Prior to 5.6, when /dev/random was opened with O_NONBLOCK, it would return -EAGAIN if there was no entropy. When the pools were unified in 5.6, this was lost. The post 5.6 behavior of blocking until the pool is initialized, and ignoring O_NONBLOCK in the process, went unnoticed, with no reports about the regression received for two and a half years. However, eventually this indeed did break somebody's userspace. So we restore the old behavior, by returning -EAGAIN if the pool is not initialized. Unlike the old /dev/random, this can only occur during early boot, after which it never blocks again. In order to make this O_NONBLOCK behavior consistent with other expectations, also respect users reading with preadv2(RWF_NOWAIT) and similar. Fixes: 30c08efec888 ("random: make /dev/random be almost like /dev/urandom") Reported-by: Guozihua Reported-by: Zhongguohua Cc: Al Viro Cc: Theodore Ts'o Cc: Andrew Lutomirski Cc: stable@vger.kernel.org Signed-off-by: Jason A. Donenfeld Signed-off-by: Greg Kroah-Hartman --- drivers/char/mem.c | 4 ++-- drivers/char/random.c | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) --- a/drivers/char/mem.c +++ b/drivers/char/mem.c @@ -887,8 +887,8 @@ static const struct memdev { #endif [5] = { "zero", 0666, &zero_fops, 0 }, [7] = { "full", 0666, &full_fops, 0 }, - [8] = { "random", 0666, &random_fops, 0 }, - [9] = { "urandom", 0666, &urandom_fops, 0 }, + [8] = { "random", 0666, &random_fops, FMODE_NOWAIT }, + [9] = { "urandom", 0666, &urandom_fops, FMODE_NOWAIT }, #ifdef CONFIG_PRINTK [11] = { "kmsg", 0644, &kmsg_fops, 0 }, #endif --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -1294,6 +1294,11 @@ static ssize_t random_read_iter(struct k { int ret; + if (!crng_ready() && + ((kiocb->ki_flags & IOCB_NOWAIT) || + (kiocb->ki_filp->f_flags & O_NONBLOCK))) + return -EAGAIN; + ret = wait_for_random_bytes(); if (ret != 0) return ret; From patchwork Mon Oct 24 11:29:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8532 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp416514wru; Mon, 24 Oct 2022 05:11:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM608ViqfDq0aWmR9ZCKbwRJ+MbXVy02BOmiac38acXe6098rx9fQcdsvYWVY8bZqgc7d7UT X-Received: by 2002:a05:6a02:18f:b0:44a:3972:898d with SMTP id bj15-20020a056a02018f00b0044a3972898dmr27584733pgb.525.1666613509400; Mon, 24 Oct 2022 05:11:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613509; cv=none; d=google.com; s=arc-20160816; b=S6RKlTJ4reC3RTN45Buf3f2i/DylHijPh4jNsK+rxFd+JBFgNuglMGSghxyDB4emIo j5Z/XOHxm6hbhP/u6pnM8hg181ghKCZTlMQ0cyZmCLgM1rH9ytBpBeNzYOuOUcDgXCcw JxUOn59qGElWodz0dLUSHzOO0fSqK6sMqMJfj/ZbMXXxUmdQFka+ITRQbh78CiTaiVZH 9Axxwm2ZbGhIrXMOYleHTuFIvaRoE/GzwOeaUwP2q1kO2ODloi857Exv9Id7x3vgUZZ1 GW7cDqYHU9BPYKMyuD1hKZRKWfZFke16d3Any+uTEel1GlfEWcjdNEb2rgidSPLgKx+W V8bA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WIR2DLtrEX0dj9NkuFSYbj1Dtbakne4q5wM7kqmAms0=; b=aEKF2KJlt9/xqzxfwycu1xYoD/NcAcf9hjxF6TKUgv2DqIsTaJeuWAFHT59XbFokpv A3gdUC7xt+Kkzi0uFeKqjODJnoRpvfGXGFAJnXu8Ed4CoG8cROxM4x1qg3O/vPlbizRk di1A2K3PgEb/MBGz0KTOJDiKlRoKPQiypS2u86XeWu3hf3DUFuN8z4Y1f6srcgoWg7tc OdzJvmX5GhH/CODQ8EhaNwA/DaK8+dAkCow36BB8I9WBSJgMogGKb8qMmYlecshuJOnx o2QLbI13f/w4J1gT7N2tZgwj2v9o4Otmz6jj2JQIFxb+zcs8vnh1BGC4NVeagc2xTToi YxyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mEepv6Hd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v24-20020a17090a899800b0021311a385c3si2993440pjn.46.2022.10.24.05.11.31; Mon, 24 Oct 2022 05:11:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mEepv6Hd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232376AbiJXL6j (ORCPT + 99 others); Mon, 24 Oct 2022 07:58:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232372AbiJXL5p (ORCPT ); Mon, 24 Oct 2022 07:57:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FA3527CC0; Mon, 24 Oct 2022 04:47:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 66E76B8113E; Mon, 24 Oct 2022 11:47:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBFE0C433C1; Mon, 24 Oct 2022 11:47:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612033; bh=HvNQLbDFpQyKb6hj8OG6baMZ1QDProYxanDCjhbgJvM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mEepv6HdZeQNBz/rBs/aquBX05uRDqiFz/7Xuu2klhYj5/lCUyTtUlwZI01qqbnKQ IQRRVUVfYTu1W6ghmZIOVtAXm0QFNNRNpYqKnwBYdbT610uVzd1xpZNaEyW/Ht3vyH doMSIk39oT0yUjz4DgGIc9zfonSY0VipndQ+kySM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sebastian Andrzej Siewior , "Jason A. Donenfeld" Subject: [PATCH 4.14 045/210] random: avoid reading two cache lines on irq randomness Date: Mon, 24 Oct 2022 13:29:22 +0200 Message-Id: <20221024112958.456405677@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747570927323658904?= X-GMAIL-MSGID: =?utf-8?q?1747570927323658904?= From: Jason A. Donenfeld commit 9ee0507e896b45af6d65408c77815800bce30008 upstream. In order to avoid reading and dirtying two cache lines on every IRQ, move the work_struct to the bottom of the fast_pool struct. add_ interrupt_randomness() always touches .pool and .count, which are currently split, because .mix pushes everything down. Instead, move .mix to the bottom, so that .pool and .count are always in the first cache line, since .mix is only accessed when the pool is full. Fixes: 58340f8e952b ("random: defer fast pool mixing to worker") Reviewed-by: Sebastian Andrzej Siewior Signed-off-by: Jason A. Donenfeld Signed-off-by: Greg Kroah-Hartman --- drivers/char/random.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -890,10 +890,10 @@ void __init add_bootloader_randomness(co } struct fast_pool { - struct work_struct mix; unsigned long pool[4]; unsigned long last; unsigned int count; + struct work_struct mix; }; static DEFINE_PER_CPU(struct fast_pool, irq_randomness) = { From patchwork Mon Oct 24 11:29:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8542 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp416887wru; Mon, 24 Oct 2022 05:12:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6GEmWG1wponMgJylYoiRtN7EWzwtb7JNTaZV3eBfFZLLanzS3Y+M+3JVA8biDyroIz9GPX X-Received: by 2002:a17:907:7252:b0:791:9fd8:222e with SMTP id ds18-20020a170907725200b007919fd8222emr26885479ejc.729.1666613542334; Mon, 24 Oct 2022 05:12:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613542; cv=none; d=google.com; s=arc-20160816; b=QRUqPYYBdrpV7A7GK268y8owBrmbewYcnP0zW5j8wetVRsZtQI9/0PeHOctx2PrSMi T+Peyp4pHRyUqs+RKeROEWoK1k8sQ3EVtFZmwP+rcKEU69csVO1TKJ+w9dyP8zEf8Nsd FlpGkYyjebu33xU2irb3ZTSmp5LtivPKzWvHGS9JfB3ge41PZSZxlI1RoRYq/ZeKRdHH nLPTeW8mLqNG/fCJpc8dn1XKztn8GJi+cvNvVPmzdyseSw+MJ6wWFKwJebkX94Qoyzps XRYLkPKjzvVDrcQ8wRIM14/SMmyUGi2TMxJDHhLBUCR1PcjZLKGW4HuYcSP7HIzKjDrj LtIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TkKvEh61/pGzvRpV5ZUDnfzcBQySgRo8HsH9woqZjgs=; b=ea/0OdlCFa6p7CXbGaXhXlU/msjpPAVYoD8JffSFYiMFHjv8f+wVACOrmh44+teXJ1 ySZggYlq4/MgeQ2TkTb5sHwmq0g6hKFphk2sKVGzHsXayxVifgZ2/RcBEzAih56lMCy+ Mn28zqqJZijh4jLNx9wN3JPoJNazRDbOKC5W1kWEqBgw6lbH6SpnB5FOuEV1UHclxwhB ueuwW5BdFj3Ii2xZJbxo5FPdORHNNWKSPoG713Zxx84Lg9T981DMVF9j22DMAbtTeN4R Spueae4+FTdp8lL11PSwtVTSelolyBIV6Km7bSy1vqQEYOHY3MXiKgT6vuSqGBAkHs/m Z19A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZqvbvSez; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dp15-20020a170906c14f00b007a6cf813043si3405339ejc.692.2022.10.24.05.11.56; Mon, 24 Oct 2022 05:12:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZqvbvSez; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232416AbiJXL6q (ORCPT + 99 others); Mon, 24 Oct 2022 07:58:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232183AbiJXL5t (ORCPT ); Mon, 24 Oct 2022 07:57:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4637A7B58E; Mon, 24 Oct 2022 04:47:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5297A6125A; Mon, 24 Oct 2022 11:47:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65D50C433D6; Mon, 24 Oct 2022 11:47:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612035; bh=JZ/6C+T35YGb6+Ln7URFq8PZ9sBiH9mzyYJMG3EFmKY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZqvbvSezVFx7yjTyvPTckSVxcBOQFl8CZJwIZEBW93oJbGwT2wdAKAZdIjudl7hXs S2T8Rv0mULqBL+3Gfp03kp6KzQzQqdXf+ycVRinp+SNWPLYdfuogk3fx/tcrMGnIba tmUzTKCL6kf0JzcHmSaD9FbPMymAKJ3XQGn/0yBg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?S=C3=B6nke_Huster?= , Johannes Berg Subject: [PATCH 4.14 046/210] wifi: mac80211_hwsim: avoid mac80211 warning on bad rate Date: Mon, 24 Oct 2022 13:29:23 +0200 Message-Id: <20221024112958.486347073@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747570961696039508?= X-GMAIL-MSGID: =?utf-8?q?1747570961696039508?= From: Johannes Berg commit 1833b6f46d7e2830251a063935ab464256defe22 upstream. If the tool on the other side (e.g. wmediumd) gets confused about the rate, we hit a warning in mac80211. Silence that by effectively duplicating the check here and dropping the frame silently (in mac80211 it's dropped with the warning). Reported-by: Sönke Huster Tested-by: Sönke Huster Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/mac80211_hwsim.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -3075,6 +3075,8 @@ static int hwsim_cloned_frame_received_n rx_status.band = data2->channel->band; rx_status.rate_idx = nla_get_u32(info->attrs[HWSIM_ATTR_RX_RATE]); + if (rx_status.rate_idx >= data2->hw->wiphy->bands[rx_status.band]->n_bitrates) + goto out; rx_status.signal = nla_get_u32(info->attrs[HWSIM_ATTR_SIGNAL]); memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status)); From patchwork Mon Oct 24 11:29:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8562 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp417718wru; Mon, 24 Oct 2022 05:13:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4h0A+t4F/eis/Mc9OltKaEJeeBlNWNZLmHfi0RVPFJwU+FnVJGghONAdHO9fCWvLxDmHj4 X-Received: by 2002:a17:907:6e1b:b0:78e:15a3:5be6 with SMTP id sd27-20020a1709076e1b00b0078e15a35be6mr27645741ejc.750.1666613614036; Mon, 24 Oct 2022 05:13:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613614; cv=none; d=google.com; s=arc-20160816; b=hT2CmtfB8gQ/Uxtb0Tzbm9nC79Vfy/FhXuK8lAiQeoTojM4guOYqsKnPjw6r1dtmoQ 3VkzlbL0JBGDkYa0kJiXUy/Xk5PtEzviftPtsb71ooTH/vTYlbrDJgbNVr1dVyN1XLYO DQVb9K0kQ0F4RZT4IklV6h+ktqgJoWodNhqgrq+Fa/SdB5kFBee0ork7R6pn4jPJygxc 3c/FsKbJ4V74GNfFoI+pFnKPd6R+vKdNmnTbHPy/d5PvggrncB38wmxgEImNTcKqMLdj S0GoNkUR4xUqpR9pYjWVW1xHCOiRL5vQ4XHj6gbc1ExP3w1rBry+dbUEuMfiTLhlobHB V/cA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6zXm+6sk0ue/AsP5ySZ+UACCvx5q4NCWDmdstNIRBMk=; b=KZxf5cYOhIiVz05U0vdtfrV9wOdvR9MYhoKGunK8PspLAUILx2apzSKjYWq+/X4Fez xtaLGkKn/QbmXIsACh2qsePGj7jnlr2KfQyfsuIezeFTT/RM4Hx8n6fYp+4TwJQFMIMf Rh4uxun0M0AgpHxxa1RVtMswD68Cy+QngBJ36O2Z+OmInNW8ukjo7Hkt3iqIGRqWxpLW ZYIfn9uM/QDj6eNTrG0zate0ZqBhiEtJa2Eidy1rma+JjQK9045LzSYCVD9DkCdXgW7q n90m7NJP0yXYGO2BJqfSRL9p1unXUsK9V/4hTRkhU53nhlgKuyTlj5LR6L4CFbsv1I8H PSOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NnKxOXLU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ji1-20020a170907980100b007a65a87f839si4437587ejc.114.2022.10.24.05.13.07; Mon, 24 Oct 2022 05:13:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NnKxOXLU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232492AbiJXMDh (ORCPT + 99 others); Mon, 24 Oct 2022 08:03:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230274AbiJXMBk (ORCPT ); Mon, 24 Oct 2022 08:01:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FBDCFE3; Mon, 24 Oct 2022 04:49:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EAE3A61257; Mon, 24 Oct 2022 11:47:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C7FCC433D7; Mon, 24 Oct 2022 11:47:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612038; bh=M+kMlfAoQikrPHbtIag+tmDBlxG1n/qkIVokq8i/99U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NnKxOXLUq4zvAkfEnTp1Xu9tqEUfNk+M0+YDeSTFaQzEdLKwYWsZVkQSrMpdHl6fJ TziVv0yuKMEYnvr5bsfcNrW4FjIjhixaAafIgTHWpXRBTXRgl9wnAVlB730B9eQ5T2 Qs6XqQhcD7qGhyWjFi5ak7XX9MbnzjpHfglGj5pc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jasper Poppe , Jeremy Palmer , Ruineka , Cleber de Mattos Casali , Kyle Gospodnetich , Pavel Rojtberg , Dmitry Torokhov Subject: [PATCH 4.14 047/210] Input: xpad - add supported devices as contributed on github Date: Mon, 24 Oct 2022 13:29:24 +0200 Message-Id: <20221024112958.515939361@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571036790291828?= X-GMAIL-MSGID: =?utf-8?q?1747571036790291828?= From: Pavel Rojtberg commit b382c5e37344883dc97525d05f1f6b788f549985 upstream. This is based on multiple commits at https://github.com/paroj/xpad Cc: stable@vger.kernel.org Signed-off-by: Jasper Poppe Signed-off-by: Jeremy Palmer Signed-off-by: Ruineka Signed-off-by: Cleber de Mattos Casali Signed-off-by: Kyle Gospodnetich Signed-off-by: Pavel Rojtberg Link: https://lore.kernel.org/r/20220818154411.510308-2-rojtberg@gmail.com Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/joystick/xpad.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -129,6 +129,8 @@ static const struct xpad_device { u8 xtype; } xpad_device[] = { { 0x0079, 0x18d4, "GPD Win 2 X-Box Controller", 0, XTYPE_XBOX360 }, + { 0x03eb, 0xff01, "Wooting One (Legacy)", 0, XTYPE_XBOX360 }, + { 0x03eb, 0xff02, "Wooting Two (Legacy)", 0, XTYPE_XBOX360 }, { 0x044f, 0x0f00, "Thrustmaster Wheel", 0, XTYPE_XBOX }, { 0x044f, 0x0f03, "Thrustmaster Wheel", 0, XTYPE_XBOX }, { 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", 0, XTYPE_XBOX }, @@ -259,6 +261,7 @@ static const struct xpad_device { { 0x0f0d, 0x0063, "Hori Real Arcade Pro Hayabusa (USA) Xbox One", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE }, { 0x0f0d, 0x0067, "HORIPAD ONE", 0, XTYPE_XBOXONE }, { 0x0f0d, 0x0078, "Hori Real Arcade Pro V Kai Xbox One", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE }, + { 0x0f0d, 0x00c5, "Hori Fighting Commander ONE", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE }, { 0x0f30, 0x010b, "Philips Recoil", 0, XTYPE_XBOX }, { 0x0f30, 0x0202, "Joytech Advanced Controller", 0, XTYPE_XBOX }, { 0x0f30, 0x8888, "BigBen XBMiniPad Controller", 0, XTYPE_XBOX }, @@ -275,6 +278,7 @@ static const struct xpad_device { { 0x1430, 0x8888, "TX6500+ Dance Pad (first generation)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, { 0x1430, 0xf801, "RedOctane Controller", 0, XTYPE_XBOX360 }, { 0x146b, 0x0601, "BigBen Interactive XBOX 360 Controller", 0, XTYPE_XBOX360 }, + { 0x146b, 0x0604, "Bigben Interactive DAIJA Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, { 0x1532, 0x0037, "Razer Sabertooth", 0, XTYPE_XBOX360 }, { 0x1532, 0x0a00, "Razer Atrox Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE }, { 0x1532, 0x0a03, "Razer Wildcat", 0, XTYPE_XBOXONE }, @@ -339,6 +343,7 @@ static const struct xpad_device { { 0x24c6, 0x5502, "Hori Fighting Stick VX Alt", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, { 0x24c6, 0x5503, "Hori Fighting Edge", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, { 0x24c6, 0x5506, "Hori SOULCALIBUR V Stick", 0, XTYPE_XBOX360 }, + { 0x24c6, 0x5510, "Hori Fighting Commander ONE (Xbox 360/PC Mode)", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, { 0x24c6, 0x550d, "Hori GEM Xbox controller", 0, XTYPE_XBOX360 }, { 0x24c6, 0x550e, "Hori Real Arcade Pro V Kai 360", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, { 0x24c6, 0x551a, "PowerA FUSION Pro Controller", 0, XTYPE_XBOXONE }, @@ -348,6 +353,14 @@ static const struct xpad_device { { 0x24c6, 0x5b03, "Thrustmaster Ferrari 458 Racing Wheel", 0, XTYPE_XBOX360 }, { 0x24c6, 0x5d04, "Razer Sabertooth", 0, XTYPE_XBOX360 }, { 0x24c6, 0xfafe, "Rock Candy Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, + { 0x2563, 0x058d, "OneXPlayer Gamepad", 0, XTYPE_XBOX360 }, + { 0x2dc8, 0x2000, "8BitDo Pro 2 Wired Controller fox Xbox", 0, XTYPE_XBOXONE }, + { 0x31e3, 0x1100, "Wooting One", 0, XTYPE_XBOX360 }, + { 0x31e3, 0x1200, "Wooting Two", 0, XTYPE_XBOX360 }, + { 0x31e3, 0x1210, "Wooting Lekker", 0, XTYPE_XBOX360 }, + { 0x31e3, 0x1220, "Wooting Two HE", 0, XTYPE_XBOX360 }, + { 0x31e3, 0x1300, "Wooting 60HE (AVR)", 0, XTYPE_XBOX360 }, + { 0x31e3, 0x1310, "Wooting 60HE (ARM)", 0, XTYPE_XBOX360 }, { 0x3285, 0x0607, "Nacon GC-100", 0, XTYPE_XBOX360 }, { 0x3767, 0x0101, "Fanatec Speedster 3 Forceshock Wheel", 0, XTYPE_XBOX }, { 0xffff, 0xffff, "Chinese-made Xbox Controller", 0, XTYPE_XBOX }, @@ -433,6 +446,7 @@ static const signed short xpad_abs_trigg static const struct usb_device_id xpad_table[] = { { USB_INTERFACE_INFO('X', 'B', 0) }, /* X-Box USB-IF not approved class */ XPAD_XBOX360_VENDOR(0x0079), /* GPD Win 2 Controller */ + XPAD_XBOX360_VENDOR(0x03eb), /* Wooting Keyboards (Legacy) */ XPAD_XBOX360_VENDOR(0x044f), /* Thrustmaster X-Box 360 controllers */ XPAD_XBOX360_VENDOR(0x045e), /* Microsoft X-Box 360 controllers */ XPAD_XBOXONE_VENDOR(0x045e), /* Microsoft X-Box One controllers */ @@ -443,6 +457,7 @@ static const struct usb_device_id xpad_t { USB_DEVICE(0x0738, 0x4540) }, /* Mad Catz Beat Pad */ XPAD_XBOXONE_VENDOR(0x0738), /* Mad Catz FightStick TE 2 */ XPAD_XBOX360_VENDOR(0x07ff), /* Mad Catz GamePad */ + XPAD_XBOX360_VENDOR(0x0c12), /* Zeroplus X-Box 360 controllers */ XPAD_XBOX360_VENDOR(0x0e6f), /* 0x0e6f X-Box 360 controllers */ XPAD_XBOXONE_VENDOR(0x0e6f), /* 0x0e6f X-Box One controllers */ XPAD_XBOX360_VENDOR(0x0f0d), /* Hori Controllers */ @@ -463,8 +478,12 @@ static const struct usb_device_id xpad_t XPAD_XBOXONE_VENDOR(0x20d6), /* PowerA Controllers */ XPAD_XBOX360_VENDOR(0x24c6), /* PowerA Controllers */ XPAD_XBOXONE_VENDOR(0x24c6), /* PowerA Controllers */ + XPAD_XBOX360_VENDOR(0x2563), /* OneXPlayer Gamepad */ + XPAD_XBOX360_VENDOR(0x260d), /* Dareu H101 */ + XPAD_XBOXONE_VENDOR(0x2dc8), /* 8BitDo Pro 2 Wired Controller for Xbox */ XPAD_XBOXONE_VENDOR(0x2e24), /* Hyperkin Duke X-Box One pad */ XPAD_XBOX360_VENDOR(0x2f24), /* GameSir Controllers */ + XPAD_XBOX360_VENDOR(0x31e3), /* Wooting Keyboards */ XPAD_XBOX360_VENDOR(0x3285), /* Nacon GC-100 */ { } }; From patchwork Mon Oct 24 11:29:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8569 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp418057wru; Mon, 24 Oct 2022 05:14:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4C3+l8oqoqg0mQg7ONm3vojIu5ghtR76Zy8WrC0bMW0JnpmPgqpU+T3svPggc4N6GPMABK X-Received: by 2002:a05:6402:440f:b0:45d:297b:c70a with SMTP id y15-20020a056402440f00b0045d297bc70amr30633571eda.187.1666613642940; Mon, 24 Oct 2022 05:14:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613642; cv=none; d=google.com; s=arc-20160816; b=F3YbNlQeuM4zDh/jN12PF94rgiqQYr5HddAi//FqGygwjAHmJVQ1Rz2LaiUqmahHAZ QBvDcwjvjEDdrVCeCnCttRuccOi+ZMq7LtVYpduK/GNS4flLZazF0vwkWicgi0IXUn6L dyyEeHagXgQMDnrSlKaY1/69t5eOsg8Wbmnkl/2MLAPXGlcLplJL9EbZAU+RpGi4+eCt RlENO1+sztTKDLimUsT/AjvMt3hbmf6GH8cHT8SaC/zFSwizXm3YE5+QR+Th4vTAXIcu 8ZOQlsLakeveud4HTsozqvrPJ/bgMw9/Dc964l091ddQruMs+dKfX0yytPDEZeMvNtTh Bs4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Gxr8mCQY6U7UkJiw+EN39SxL3VWnKeqPf7o1ilywt7M=; b=Njm4HngOXPtosD6SGD3xqvpHI5R/UG9P0HynwxUodEDxtx0tQyqCaq1aWvBlkPFX3H 25hrMuNMKIo/iPrd0zqPxApU9rRo2zfpAAnl6PrKtJSI0L+K/Xu4lvCVTLrpF1jcfJa/ vnVOwAiqFjJ2h4ICS9gnSgg2SM6u0HBMh99dHFXqMK2wKolkWFLOaZNOgxK9Pqwu1SY5 DofrMLRRkRzmi3W38QPnMb+SQ9JwV1Zx4drIumc/NIr7GhyTzr6X6VCKCVCqRcXLF2fO YZlqiarFmCvCmyaIyZAg5neYoKAGMlQooZOzdqK9TPQyHw2Yy6TdRKdBSkwVDPU1CYy3 mq8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cf5tnW9j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jg16-20020a170907971000b0078def5c29e6si30811598ejc.531.2022.10.24.05.13.36; Mon, 24 Oct 2022 05:14:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cf5tnW9j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232483AbiJXMFX (ORCPT + 99 others); Mon, 24 Oct 2022 08:05:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232453AbiJXMC4 (ORCPT ); Mon, 24 Oct 2022 08:02:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DE1B23EB0; Mon, 24 Oct 2022 04:49:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 47F1EB8117E; Mon, 24 Oct 2022 11:47:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A15C2C433C1; Mon, 24 Oct 2022 11:47:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612041; bh=zZ6aCnvvIvMD/DtvvB7qbtS2ts7lyXMgsQSGtvWJf1E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cf5tnW9jl781uCuhyFZd5zBA/iLc01IIH16bwrXl164xnE4Twgm7yiLg6ot61+7w+ JsH2gcWtUFZ3hxpCuzY0Z25PLOw4nI7kM4SKeBXD5+JrWoEAmljyH6K1ZTBbGUUvWG WqRzO740Y3HgAf2D9UQb1bJcMHyRJA3yPXkcnCG8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cameron Gutman , Pavel Rojtberg , Dmitry Torokhov Subject: [PATCH 4.14 048/210] Input: xpad - fix wireless 360 controller breaking after suspend Date: Mon, 24 Oct 2022 13:29:25 +0200 Message-Id: <20221024112958.545652058@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571067421729296?= X-GMAIL-MSGID: =?utf-8?q?1747571067421729296?= From: Cameron Gutman commit a17b9841152e7f4621619902b347e2cc39c32996 upstream. Suspending and resuming the system can sometimes cause the out URB to get hung after a reset_resume. This causes LED setting and force feedback to break on resume. To avoid this, just drop the reset_resume callback so the USB core rebinds xpad to the wireless pads on resume if a reset happened. A nice side effect of this change is the LED ring on wireless controllers is now set correctly on system resume. Cc: stable@vger.kernel.org Fixes: 4220f7db1e42 ("Input: xpad - workaround dead irq_out after suspend/ resume") Signed-off-by: Cameron Gutman Signed-off-by: Pavel Rojtberg Link: https://lore.kernel.org/r/20220818154411.510308-3-rojtberg@gmail.com Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/joystick/xpad.c | 1 - 1 file changed, 1 deletion(-) --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -2000,7 +2000,6 @@ static struct usb_driver xpad_driver = { .disconnect = xpad_disconnect, .suspend = xpad_suspend, .resume = xpad_resume, - .reset_resume = xpad_resume, .id_table = xpad_table, }; From patchwork Mon Oct 24 11:29:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10308 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp656189wru; Mon, 24 Oct 2022 14:17:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM41fmXhztSvbcTaW1KEcJyxQhdLn5Z11cbma2Nw1Azf4PXPqktZFVMeKExoM+lRzb3Tgt66 X-Received: by 2002:a17:90b:1bd2:b0:213:2d7:3162 with SMTP id oa18-20020a17090b1bd200b0021302d73162mr9886249pjb.91.1666646248009; Mon, 24 Oct 2022 14:17:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666646248; cv=none; d=google.com; s=arc-20160816; b=UJJLyrOWVsercj6hK9UnUW5ZmWWQrzP1Cmq6Jkf0ngVVR0ms5Q1d0ZD3TYsUBMZMW4 pgzaviGgzsNn/pT0vblc3GHfXuE7qCNxdDPZFNj7Q1kdlQJ55qc1/NnKnBbSSxmJqTD4 zUu+aQEIeUlmUS5T4eMZURGSnhgTQd6z1UesAa+VzsEy6jPv8N+UWIp0DBEEewbTqvhg NjCsipX7dJtc1swCj2qUwLZNTHmbFcw5vWD24A10QsiXjtmr6/iG4IFK+BfkS06Rq+eC LYh0WszwHIWIBa4Lf6/GeY6HlYQOBCR9JaPyOctECO9x21aMgdktBMiSHMDALo2xBrQO 7X/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=O8Zx1C9ylcV9EwlnXlC2g6o9LctdvuRZT5z+ZlIrrgs=; b=GoBEhs3YlkGsT0UwBGKLtqf8dNmJ/ougGMjemDTyGrFxfdlsphtVLqae1qShUXcvjG wYIQ23+3CXtSI30E9zi+QxJmyumCDlsdRGc5f4c0onE5HDfsF3jpmKemoL4Ngdeojkn7 gem5EqWoDOpY47xysXg+mQ7XNDUt/qTPJNUAgzu+yfbKX14vc2TTo2/qSSxzRiUohjiw I0Bl/eQxvSBUokQmnuuYUXKsjnLp7lc+NM+fJ0+j80uH8E1s+TLcEQYU90ApK2lJ/LIh rUtW2zw/RiDLtUS7YanQNgalHe+fAUb1Pg/PfZB0h0jL3QRH+Ry4fsJRogZdFwKh5uUZ i+Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1Kbvwdnx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i69-20020a636d48000000b0043941e5532dsi734114pgc.391.2022.10.24.14.17.15; Mon, 24 Oct 2022 14:17:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1Kbvwdnx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232324AbiJXVQq (ORCPT + 99 others); Mon, 24 Oct 2022 17:16:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232118AbiJXVQ2 (ORCPT ); Mon, 24 Oct 2022 17:16:28 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50A151CBA99; Mon, 24 Oct 2022 12:22:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 58B1ECE134E; Mon, 24 Oct 2022 11:47:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 208ADC43470; Mon, 24 Oct 2022 11:47:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612043; bh=AeF2wdAHzt1FErvHdAJ9pxYfnQWj6q9KY0QVS+DQYQw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1Kbvwdnx10r8n7D3qhRn/jQfw/Oll+K7TQM6tRszXGeMJ9uKGc296OYbl+D3TPTPa sXdwRrztJhH/Rxj/ylTXH4PDfzpCI1xWHBbA57hlpX89TFX9vXOQd+yb1VyrPsypIq bYpdMa2Awbl8awmgvW56YFLJBwI08Rjg2H/s3sOc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sherry Yang , Paul Webb , Phillip Goerl , Jack Vogel , Nicky Veitch , Colm Harrington , Ramanan Govindarajan , Sebastian Andrzej Siewior , Dominik Brodowski , Tejun Heo , Sultan Alsawaf , "Jason A. Donenfeld" Subject: [PATCH 4.14 049/210] random: use expired timer rather than wq for mixing fast pool Date: Mon, 24 Oct 2022 13:29:26 +0200 Message-Id: <20221024112958.576519606@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747605256106808647?= X-GMAIL-MSGID: =?utf-8?q?1747605256106808647?= From: Jason A. Donenfeld commit 748bc4dd9e663f23448d8ad7e58c011a67ea1eca upstream. Previously, the fast pool was dumped into the main pool periodically in the fast pool's hard IRQ handler. This worked fine and there weren't problems with it, until RT came around. Since RT converts spinlocks into sleeping locks, problems cropped up. Rather than switching to raw spinlocks, the RT developers preferred we make the transformation from originally doing: do_some_stuff() spin_lock() do_some_other_stuff() spin_unlock() to doing: do_some_stuff() queue_work_on(some_other_stuff_worker) This is an ordinary pattern done all over the kernel. However, Sherry noticed a 10% performance regression in qperf TCP over a 40gbps InfiniBand card. Quoting her message: > MT27500 Family [ConnectX-3] cards: > Infiniband device 'mlx4_0' port 1 status: > default gid: fe80:0000:0000:0000:0010:e000:0178:9eb1 > base lid: 0x6 > sm lid: 0x1 > state: 4: ACTIVE > phys state: 5: LinkUp > rate: 40 Gb/sec (4X QDR) > link_layer: InfiniBand > > Cards are configured with IP addresses on private subnet for IPoIB > performance testing. > Regression identified in this bug is in TCP latency in this stack as reported > by qperf tcp_lat metric: > > We have one system listen as a qperf server: > [root@yourQperfServer ~]# qperf > > Have the other system connect to qperf server as a client (in this > case, it’s X7 server with Mellanox card): > [root@yourQperfClient ~]# numactl -m0 -N0 qperf 20.20.20.101 -v -uu -ub --time 60 --wait_server 20 -oo msg_size:4K:1024K:*2 tcp_lat Rather than incur the scheduling latency from queue_work_on, we can instead switch to running on the next timer tick, on the same core. This also batches things a bit more -- once per jiffy -- which is okay now that mix_interrupt_randomness() can credit multiple bits at once. Reported-by: Sherry Yang Tested-by: Paul Webb Cc: Sherry Yang Cc: Phillip Goerl Cc: Jack Vogel Cc: Nicky Veitch Cc: Colm Harrington Cc: Ramanan Govindarajan Cc: Sebastian Andrzej Siewior Cc: Dominik Brodowski Cc: Tejun Heo Cc: Sultan Alsawaf Cc: stable@vger.kernel.org Fixes: 58340f8e952b ("random: defer fast pool mixing to worker") Signed-off-by: Jason A. Donenfeld Signed-off-by: Greg Kroah-Hartman --- drivers/char/random.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -893,7 +893,7 @@ struct fast_pool { unsigned long pool[4]; unsigned long last; unsigned int count; - struct work_struct mix; + struct timer_list mix; }; static DEFINE_PER_CPU(struct fast_pool, irq_randomness) = { @@ -945,9 +945,9 @@ int __cold random_online_cpu(unsigned in } #endif -static void mix_interrupt_randomness(struct work_struct *work) +static void mix_interrupt_randomness(unsigned long data) { - struct fast_pool *fast_pool = container_of(work, struct fast_pool, mix); + struct fast_pool *fast_pool = (struct fast_pool *)data; /* * The size of the copied stack pool is explicitly 2 longs so that we * only ever ingest half of the siphash output each time, retaining @@ -999,10 +999,14 @@ void add_interrupt_randomness(int irq) if (new_count < 1024 && !time_is_before_jiffies(fast_pool->last + HZ)) return; - if (unlikely(!fast_pool->mix.func)) - INIT_WORK(&fast_pool->mix, mix_interrupt_randomness); + if (unlikely(!fast_pool->mix.data)) + setup_timer(&fast_pool->mix, mix_interrupt_randomness, (unsigned long)fast_pool); + fast_pool->count |= MIX_INFLIGHT; - queue_work_on(raw_smp_processor_id(), system_highpri_wq, &fast_pool->mix); + if (!timer_pending(&fast_pool->mix)) { + fast_pool->mix.expires = jiffies; + add_timer_on(&fast_pool->mix, raw_smp_processor_id()); + } } EXPORT_SYMBOL_GPL(add_interrupt_randomness); From patchwork Mon Oct 24 11:29:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8699 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422744wru; Mon, 24 Oct 2022 05:23:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4V5r2UQbfZqtgyhxqMu5uoOwlhsiMUmCJx8AFebb4yJFatrHDz6EF0K+6eCdqPX8IMJL9Z X-Received: by 2002:a05:6402:84d:b0:454:f41d:6ccf with SMTP id b13-20020a056402084d00b00454f41d6ccfmr30347283edz.129.1666614197894; Mon, 24 Oct 2022 05:23:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614197; cv=none; d=google.com; s=arc-20160816; b=E0lB3OpkDsj5JY0NIbnRYz9OfGDQrWm6zajnUQPZMvPaQWngVGzj4IA8E/7UZJbVMM /6Lx7YjkROPQWGbflsFZ+npqdeT9MsApr7xl+FuB/hOqCeTznirhGxiux06ztjh13p+g A+niOidI1uqkNU0MdPqWAPZDyKTkcUW3lX8BkwjITjy8W7/dUtoqFaDYTNhssw1nr0+h sAMBfjAO49EuUR/Y5bPBIZS7E+Zt/IrrOrgCYLQWP9OvDUn+KkrNWM1L56wI+c575hwb sbNWkcISanbAzAGHnslJTKoGhadJ4BgC/Z/eOkkeC0QKJeCrDAzpwnQ4yGjgZK8s52OP Csug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/rVgWEN/XvYtdR9D5WlUOGgkhy8f36m8Xe4TlpkiVu8=; b=gN7jk0Xhi3/BEiKKS6QP5iTWR2q0fhJCPOYGLlBKmHmQgBDwYxYAhy7YprxAWgp4UE kHZsxsIPG8mgB/VpTkAOpZkxruExVFMnPx3HJxMFmM2zEGT2JI/mAXfA4m91WEjX2IRz 2JSkMxbvVMoq51PHDbbBPxwo7QOS5BIYgLfchuNLJ59WZhW7w4zxq7cFbui2/DahE7nS fdUE8/ny72PJOtjE2arDx9wL6ByCZ/zFv4xJoT8XGTLEZk3mINVZt4tCGfKyKueTa415 LZYV8MMBSkKt3Sc5hZ5TQtoVAMEzQLGIEUVyrvE94PbiUzpBub2iM9zKNpv+mRXQ16cn IyLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qBtGccXi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x8-20020a05640226c800b0045be589ca7fsi31107837edd.331.2022.10.24.05.22.53; Mon, 24 Oct 2022 05:23:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qBtGccXi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233451AbiJXMV7 (ORCPT + 99 others); Mon, 24 Oct 2022 08:21:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233546AbiJXMTr (ORCPT ); Mon, 24 Oct 2022 08:19:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C36F7B1ED; Mon, 24 Oct 2022 04:58:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D88646127C; Mon, 24 Oct 2022 11:47:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9BCAC433C1; Mon, 24 Oct 2022 11:47:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612046; bh=3WzImQnkbjG9/1b+5+7IqgwI/RK4Rp5ceJx3SH2/qCg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qBtGccXifl6eBT+IonzvQGiuBKGYbi6Ar5p0Miv3yJjvvS0mXVXPgYjIJUXkzxYpg kQFRQuXuodQFSUBk9g4Hh76Jz6eeT2/YrRU1w0nPehAGgPm5yhdJyExSKpnNDFjQi+ RHAC600CtDsrrM0yDqX31tovYFU1U7mI/oRU+QZs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 4.14 050/210] ALSA: oss: Fix potential deadlock at unregistration Date: Mon, 24 Oct 2022 13:29:27 +0200 Message-Id: <20221024112958.610709500@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571649365730951?= X-GMAIL-MSGID: =?utf-8?q?1747571649365730951?= From: Takashi Iwai commit 97d917879d7f92df09c3f21fd54609a8bcd654b2 upstream. We took sound_oss_mutex around the calls of unregister_sound_special() at unregistering OSS devices. This may, however, lead to a deadlock, because we manage the card release via the card's device object, and the release may happen at unregister_sound_special() call -- which will take sound_oss_mutex again in turn. Although the deadlock might be fixed by relaxing the rawmidi mutex in the previous commit, it's safer to move unregister_sound_special() calls themselves out of the sound_oss_mutex, too. The call is race-safe as the function has a spinlock protection by itself. Link: https://lore.kernel.org/r/CAB7eexJP7w1B0mVgDF0dQ+gWor7UdkiwPczmL7pn91xx8xpzOA@mail.gmail.com Cc: Link: https://lore.kernel.org/r/20221011070147.7611-2-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/core/sound_oss.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) --- a/sound/core/sound_oss.c +++ b/sound/core/sound_oss.c @@ -177,7 +177,6 @@ int snd_unregister_oss_device(int type, mutex_unlock(&sound_oss_mutex); return -ENOENT; } - unregister_sound_special(minor); switch (SNDRV_MINOR_OSS_DEVICE(minor)) { case SNDRV_MINOR_OSS_PCM: track2 = SNDRV_MINOR_OSS(cidx, SNDRV_MINOR_OSS_AUDIO); @@ -189,12 +188,18 @@ int snd_unregister_oss_device(int type, track2 = SNDRV_MINOR_OSS(cidx, SNDRV_MINOR_OSS_DMMIDI1); break; } - if (track2 >= 0) { - unregister_sound_special(track2); + if (track2 >= 0) snd_oss_minors[track2] = NULL; - } snd_oss_minors[minor] = NULL; mutex_unlock(&sound_oss_mutex); + + /* call unregister_sound_special() outside sound_oss_mutex; + * otherwise may deadlock, as it can trigger the release of a card + */ + unregister_sound_special(minor); + if (track2 >= 0) + unregister_sound_special(track2); + kfree(mptr); return 0; } From patchwork Mon Oct 24 11:29:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8537 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp416590wru; Mon, 24 Oct 2022 05:11:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5dPaPZ09OMrg/NX0+3URBAfibok/NPu2nZCij5IBWNRwceZ8za5cl2MSsRzI3Cz4R/GVsA X-Received: by 2002:a63:c111:0:b0:439:103a:6c31 with SMTP id w17-20020a63c111000000b00439103a6c31mr27729097pgf.149.1666613516647; Mon, 24 Oct 2022 05:11:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613516; cv=none; d=google.com; s=arc-20160816; b=zBQLZg8OAaxEe70hj0niGIbc7xPAnlq9e93j7bZ2YYhkNjjFEaSsZ1Dze35kkzgVe1 Vw6eIjHXSHq107XSrqgbo/P33SgUNrgDwY6C9dmV/3MWpqXc8q8uc+EF4qUlqKxz9PJp 7NSMdOti5jxGjHB5WEf1DB0FkH0PrUIs0x4vdEaW2BSqf/zyGNyvF3IO6gvBzlBMPHA5 zOnddGNfF0ID48OgW2fQwvmDn2DcdAS02wDUr9zUqrQLiomlfdEtpT1SNFIStTKAvTNe 5yeZUuTq/CihXBP8/kbOxpeDmE9Y5szgOyeMseut6szomf95rzs5meOCS3iLxiCgtwvv xc5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=grqwU8zrBnt5k7l2e02S/Mh/b564ru9v4Z2p95K020w=; b=dSjBR26FbmoNNLS1XiE0qKivh94MA9k0z+KAZUykKEk5bDQiCr1XGpnxhKCKLS7Dqf FCVKcSD2IKQeWB0eJ9JW1fgOruyegY4InB99Xr4uZ2yY6kMhF2MLHKtw3PwCTAUqmzk6 mfwoMNqDCxxKjR3okrzUMoSefx4q16TW68nPq5kHq98FFkR9HsrD9kPbSw8MfSxRO5r/ FlduQ59y+zxjtv0/E2fczStX2t3qbJqRA3er7KmOBPN0FYERJQrwAbGXXaaS3gA0fRp+ jK9vztCyt/6NqiKfuJrK/KwxccSxYQX35RYjgXUYWwQq8qmfsIJw+2SFiwC37TSfCb0n +AfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jNqBN8ku; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t15-20020a63534f000000b00439c930538csi34326909pgl.85.2022.10.24.05.11.43; Mon, 24 Oct 2022 05:11:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jNqBN8ku; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232224AbiJXMAO (ORCPT + 99 others); Mon, 24 Oct 2022 08:00:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232396AbiJXL60 (ORCPT ); Mon, 24 Oct 2022 07:58:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2571760CA; Mon, 24 Oct 2022 04:47:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1F90361291; Mon, 24 Oct 2022 11:47:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3243CC433C1; Mon, 24 Oct 2022 11:47:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612051; bh=sM65ncKA0Fp2DSYemjydTSKTheS9f7SXxpox3tYAn2Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jNqBN8ku60M9m9AqrE/vJ1Yo2Rr9q30ZqB++9ynbZORSWK/cGzyqvCEpZsq08yUb9 /48hb3t3FKRLKLCrpNBUw/VLxQ8F75k3C2bbwk6hOysiNWmLXNAyHphcduDzInkBuK GBu1WMWbA0dt+F3qi0QtZgXA5poMp8iHAtYpZWtU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 4.14 051/210] ALSA: rawmidi: Drop register_mutex in snd_rawmidi_free() Date: Mon, 24 Oct 2022 13:29:28 +0200 Message-Id: <20221024112958.649197190@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747570934550048263?= X-GMAIL-MSGID: =?utf-8?q?1747570934550048263?= From: Takashi Iwai commit a70aef7982b012e86dfd39fbb235e76a21ae778a upstream. The register_mutex taken around the dev_unregister callback call in snd_rawmidi_free() may potentially lead to a mutex deadlock, when OSS emulation and a hot unplug are involved. Since the mutex doesn't protect the actual race (as the registration itself is already protected by another means), let's drop it. Link: https://lore.kernel.org/r/CAB7eexJP7w1B0mVgDF0dQ+gWor7UdkiwPczmL7pn91xx8xpzOA@mail.gmail.com Cc: Link: https://lore.kernel.org/r/20221011070147.7611-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/core/rawmidi.c | 2 -- 1 file changed, 2 deletions(-) --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c @@ -1633,10 +1633,8 @@ static int snd_rawmidi_free(struct snd_r snd_info_free_entry(rmidi->proc_entry); rmidi->proc_entry = NULL; - mutex_lock(®ister_mutex); if (rmidi->ops && rmidi->ops->dev_unregister) rmidi->ops->dev_unregister(rmidi); - mutex_unlock(®ister_mutex); snd_rawmidi_free_substreams(&rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT]); snd_rawmidi_free_substreams(&rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT]); From patchwork Mon Oct 24 11:29:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8750 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430097wru; Mon, 24 Oct 2022 05:40:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5BhY0/O5Ze9tInNQ1pxeh5M4ZUauHALwNfHwP29Q/yakEx6DeWlcEAAJinMuQEQoWCjNQv X-Received: by 2002:a17:90a:50:b0:20a:b146:e75e with SMTP id 16-20020a17090a005000b0020ab146e75emr38256022pjb.216.1666615243702; Mon, 24 Oct 2022 05:40:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615243; cv=none; d=google.com; s=arc-20160816; b=Rvjqdjt0z7amWcRKx9u5Q1P7u9ZMyY0V+l7Kb4BKobyPMisokwP338x0xdPnw2sqoI PBdUBd68valoVwfZdJzsKDM32tYPb129jjMqE18Py1Q8kZ6lmOvmx9QKD6NAO+Ru+9qh yG2PeOPyZ5krMVeROxmhS8owV98pDl31iEUnjSg6JgC1Ah+Gt2Hd+GLzNcCF2E6WJ/Pa 45c69sW+IOuRl8SB79zuQQEuAk3P/2AEtsbvr+MnMCo9sf1ati01X6jfvBywkm1YCxaY bWeg4nK5aso6eQ/7rQlGz2hzMS0ZshvMb1+DA0iclV1FatKe2Mi2uBwGOoT+Um+b7F3f v7lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=d8s4Zdm8FBu20t6bUJd/AmtKBBB8zNwX+itxgi6fvKE=; b=ABHmlIKmyxjRp06aWC90mImhFAP84Z+LjjyOo7ABPdJh3AmQ5mNJngAcrzOA/xUX5p eztImOMEDMy9ECPqIf62RI08ZkvIIL+1aLJ841RfU+bmRjGohx4kCs9E5huMXVqaDvk6 4ZuifyiAYA8cOMNweh+UwTvxnvQ48yj/bbzP9C5HQ+kTshOxuzLdYshQhOFIXyUk/3yo dn6BdyYQpd1cnLjGkIlOuu6WM15TJ07GId57kv2V+AvsnM+S/CbYIJaSI4S4c88cO+Ct ufrQYxgf8wq5buCoUNbS+OoCYZNDQX36a5EAqirXCycpDNqjd4z7Easf6/S5/U5G84e9 MzcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wcIvQc3K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oj17-20020a17090b4d9100b002132abf9ad6si874034pjb.148.2022.10.24.05.40.28; Mon, 24 Oct 2022 05:40:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wcIvQc3K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231731AbiJXMZ7 (ORCPT + 99 others); Mon, 24 Oct 2022 08:25:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233836AbiJXMYZ (ORCPT ); Mon, 24 Oct 2022 08:24:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C79842D4E; Mon, 24 Oct 2022 05:00:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B13B2612BE; Mon, 24 Oct 2022 11:47:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5EF2C433C1; Mon, 24 Oct 2022 11:47:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612054; bh=KJ2cmYkVYWZemHCOGauIePDWAFHhV8/OUEmdQkb57Tg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wcIvQc3KZbUVP1t7qSepJvV+67QLsEvUdAgf54bjboFn/wI1bL+jbhRlib0GdQKlU rH/LEva47UNFNVpWroEIOqch2o4d/pQnrkGa1SDEETY0WwrRguxP8PVXk8e5o63zdJ W0FoKMOQMTHsYyMrDSju6DVW6XPeVLACHkXqmxUc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 4.14 052/210] ALSA: usb-audio: Fix potential memory leaks Date: Mon, 24 Oct 2022 13:29:29 +0200 Message-Id: <20221024112958.689353440@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572745444962584?= X-GMAIL-MSGID: =?utf-8?q?1747572745444962584?= From: Takashi Iwai commit 6382da0828995af87aa8b8bef28cc61aceb4aff3 upstream. When the driver hits -ENOMEM at allocating a URB or a buffer, it aborts and goes to the error path that releases the all previously allocated resources. However, when -ENOMEM hits at the middle of the sync EP URB allocation loop, the partially allocated URBs might be left without released, because ep->nurbs is still zero at that point. Fix it by setting ep->nurbs at first, so that the error handler loops over the full URB list. Cc: Link: https://lore.kernel.org/r/20220930100151.19461-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/usb/endpoint.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c @@ -818,6 +818,7 @@ static int sync_ep_set_params(struct snd if (!ep->syncbuf) return -ENOMEM; + ep->nurbs = SYNC_URBS; for (i = 0; i < SYNC_URBS; i++) { struct snd_urb_ctx *u = &ep->urb[i]; u->index = i; @@ -837,8 +838,6 @@ static int sync_ep_set_params(struct snd u->urb->complete = snd_complete_urb; } - ep->nurbs = SYNC_URBS; - return 0; out_of_memory: From patchwork Mon Oct 24 11:29:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8807 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430947wru; Mon, 24 Oct 2022 05:42:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5FzH1A8YrAofaGKIaYuicIzLFK2zm6+xt/OwWYqPn+yYu9jfZl9J/q+j00PpHC+iKUAV6s X-Received: by 2002:a05:6402:348b:b0:45c:b22b:c4a9 with SMTP id v11-20020a056402348b00b0045cb22bc4a9mr31423744edc.65.1666615354786; Mon, 24 Oct 2022 05:42:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615354; cv=none; d=google.com; s=arc-20160816; b=GonWfh8pLfFyzwm+j14SDMgIsWmTL4pTKQLcF765/xl+osPP9uaomX4IZGhIZj5ocH hhNf3lI230/ChQFTyqp6J4JQANZmE+FPZbeGy1YhtYH5GjeGZS8IpC0JwmyxMJz662h8 1AKVvn/4N9kjrafEqD6EKw3ihGn8wqXoo4qH/VL9NJwCArm9rieSFARakhurMBO/rsrt KpA+jIetgUeI+Gw0t+bdJeOVJsMAxBTBr5usAYbFZPjnxw8aIvAbUtzFzE8sbDAc70gy U9nbTwUj8esPYSw9aEhEIADX7Q0PUiKSE6pix61I5PFekVVc4ZowyXPpeyF/c9zqDKR0 1+gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DdFZ1cinygSsriobG550QUqAq5pltVLrhdrXA4ROhCc=; b=vXl6uK3PpuiAP6LEG7k6PqN30fc9qSfABfhk+JmYG9Apedy3SH1lo4NGltl5d6cFFp zG9AjocCgzAF4541ARJXUGS7+oAMuTZtd6A9XbRT7XPj8SJlGAm0dVmQHENlMmSWhcvS BtbqEJNszh2yDXwLfFlpSNz5tB41XM1d1aFs+z8aDLMxgzJonqg/QSqCEXUVwfOR14mO n84BQ2Sv3z0lrHZCEKpbfyIuNBnc2arrjiV7zsZokPlFjGP0yMfdN+iCG5Tlwi92O91g v9eMPAld4SYZI9Mr8Q+QBcFqnZsf44kukFxHEBe6h4kEMw6+TqAbKYzVujsJQsDPpaCe xVxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YBudlojf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m15-20020a056402430f00b0043d54ba0a4dsi33530349edc.327.2022.10.24.05.42.10; Mon, 24 Oct 2022 05:42:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YBudlojf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234151AbiJXMeO (ORCPT + 99 others); Mon, 24 Oct 2022 08:34:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234165AbiJXM3b (ORCPT ); Mon, 24 Oct 2022 08:29:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2737588DD2; Mon, 24 Oct 2022 05:03:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 59D42612B4; Mon, 24 Oct 2022 11:47:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B60AC43143; Mon, 24 Oct 2022 11:47:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612056; bh=FSdbiPueVjPIiHHnV4K5YK5PYMbHBcrAoHkWO81VVtQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YBudlojfPoBf11VHpn0Nknvsr7rKigpT16OpFOoZF9Ig4UrKmGKQcorCDQO3RIqF5 uKlH6g/aczNVlekbHJ60ZfKJjZrPTj5q9dVsQZ8bBiiPH7cVpwYSMRe9+nxiVVbV08 abcBNTnlQRped95J+SsvMvLGVbcZ4NhRHP0a7qC0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Sabri N. Ferreiro" , Takashi Iwai Subject: [PATCH 4.14 053/210] ALSA: usb-audio: Fix NULL dererence at error path Date: Mon, 24 Oct 2022 13:29:30 +0200 Message-Id: <20221024112958.720040159@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572862295821604?= X-GMAIL-MSGID: =?utf-8?q?1747572862295821604?= From: Takashi Iwai commit 568be8aaf8a535f79c4db76cabe17b035aa2584d upstream. At an error path to release URB buffers and contexts, the driver might hit a NULL dererence for u->urb pointer, when u->buffer_size has been already set but the actual URB allocation failed. Fix it by adding the NULL check of urb. Also, make sure that buffer_size is cleared after the error path or the close. Cc: Reported-by: Sabri N. Ferreiro Link: https://lore.kernel.org/r/CAKG+3NRjTey+fFfUEGwuxL-pi_=T4cUskYG9OzpzHytF+tzYng@mail.gmail.com Link: https://lore.kernel.org/r/20220930100129.19445-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/usb/endpoint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c @@ -86,12 +86,13 @@ static inline unsigned get_usb_high_spee */ static void release_urb_ctx(struct snd_urb_ctx *u) { - if (u->buffer_size) + if (u->urb && u->buffer_size) usb_free_coherent(u->ep->chip->dev, u->buffer_size, u->urb->transfer_buffer, u->urb->transfer_dma); usb_free_urb(u->urb); u->urb = NULL; + u->buffer_size = 0; } static const char *usb_error_string(int err) From patchwork Mon Oct 24 11:29:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8543 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp416891wru; Mon, 24 Oct 2022 05:12:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7aOdfbzxFXu15sPlJbwdezJogIxlbNGz8aBYmuSUTOy7Cov5CbdrQ+jO6DzNQODlRicF3I X-Received: by 2002:a17:907:3f13:b0:799:6aef:9837 with SMTP id hq19-20020a1709073f1300b007996aef9837mr17121315ejc.296.1666613542428; Mon, 24 Oct 2022 05:12:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613542; cv=none; d=google.com; s=arc-20160816; b=VJJm3GREn9m2FuFzFyz87oa74Gg9PGkmtCD/QnA9McnJLiYzcFIx6Ee/MvFwauNhZ1 ywnYkwGFL37moqL5d8ATPU2L8LZBhvcbOswZVUZoBkV7Y4W5wRESvpICzjrQ+bfG/o0x b0NqglGkDtcJYskiuloNsrQG5Ajh7LO602fiDF/D6kCC4/6bt7xnYf/X4XARgF/WbhnR BkNPl61v1RSqhAVSsocG1ydnuZyaXOIDShrqvwafZx0RDmiQRQ9SwDxt6oN5WjouJscO Bc7xnJTA9F6W9ALSEZZrNk10ZVW902bhjJYRWVCU/Ol399qlAeDEIayzt5taLuE1OXbL YZjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pn/M2dHQCKD27/ud0g5rdI8WzQmq4JR12MCp/6XST1w=; b=CbNQdz9bmkOixIphDTJXXtVqkhFioPcwLvZvduZPzMeCjl9Q+Qd4I3sV/+IOj/RFg1 9h/PpNhHuyiEuWfeGe1XTdaX/N67ceWoVqKxkPbSvB7Ea0eVx/q0CERPLjvdtl5TqO5W G62ByT3CIdW4PVWY9zvZtgxNIAkapponU9RtYIwRT1ePIwEh8rOBEIJQIc9y4pGncPUo ryOhOAYaQKftz1HJVZU1o33Rscta3jeT7a4KHVIKjSeN1juH9o2qfTKGaNAVmajeMrnP MgXK0CKagK4Zzh9dw0LPE56uh5rdpgnOSfrlmFmJm3uD04j5K0z6Wa591EYniv+54yCH RBwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xT3U0zOq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y10-20020a056402270a00b0045dc9b4c034si21323078edd.582.2022.10.24.05.11.57; Mon, 24 Oct 2022 05:12:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xT3U0zOq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232397AbiJXMAa (ORCPT + 99 others); Mon, 24 Oct 2022 08:00:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232333AbiJXL6e (ORCPT ); Mon, 24 Oct 2022 07:58:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A669E7C1BD; Mon, 24 Oct 2022 04:47:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2D3416125A; Mon, 24 Oct 2022 11:47:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42977C433C1; Mon, 24 Oct 2022 11:47:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612059; bh=oPcGZNPOVZFp9ic2M+WBGGfeOaLqyr96TvPpJbQRVoo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xT3U0zOqniv3KGDs+UEYiAoRUBeo2gq/C6MuWPrPjykuClg+IZe23NE1a9QMnF+SL EFNvqho+1WPtqTMnvVrn3fx4nY/3t2whkefyxQCuQWr9urDJk8GsG0MSph9KKMubJd JfFHt0v3QpJdgpNXXJA/4Jm/Z5EIlsrHOa1OrWcU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Hennerich , =?utf-8?q?Nuno_S=C3=A1?= , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 4.14 054/210] iio: dac: ad5593r: Fix i2c read protocol requirements Date: Mon, 24 Oct 2022 13:29:31 +0200 Message-Id: <20221024112958.755773852@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747570962239787155?= X-GMAIL-MSGID: =?utf-8?q?1747570962239787155?= From: Michael Hennerich commit 558a25f903b4af6361b7fbeea08a6446a0745653 upstream. For reliable operation across the full range of supported interface rates, the AD5593R needs a STOP condition between address write, and data read (like show in the datasheet Figure 40) so in turn i2c_smbus_read_word_swapped cannot be used. While at it, a simple helper was added to make the code simpler. Fixes: 56ca9db862bf ("iio: dac: Add support for the AD5592R/AD5593R ADCs/DACs") Signed-off-by: Michael Hennerich Signed-off-by: Nuno Sá Cc: Link: https://lore.kernel.org/r/20220913073413.140475-2-nuno.sa@analog.com Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/dac/ad5593r.c | 46 +++++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 19 deletions(-) --- a/drivers/iio/dac/ad5593r.c +++ b/drivers/iio/dac/ad5593r.c @@ -15,6 +15,8 @@ #include #include +#include + #define AD5593R_MODE_CONF (0 << 4) #define AD5593R_MODE_DAC_WRITE (1 << 4) #define AD5593R_MODE_ADC_READBACK (4 << 4) @@ -22,6 +24,24 @@ #define AD5593R_MODE_GPIO_READBACK (6 << 4) #define AD5593R_MODE_REG_READBACK (7 << 4) +static int ad5593r_read_word(struct i2c_client *i2c, u8 reg, u16 *value) +{ + int ret; + u8 buf[2]; + + ret = i2c_smbus_write_byte(i2c, reg); + if (ret < 0) + return ret; + + ret = i2c_master_recv(i2c, buf, sizeof(buf)); + if (ret < 0) + return ret; + + *value = get_unaligned_be16(buf); + + return 0; +} + static int ad5593r_write_dac(struct ad5592r_state *st, unsigned chan, u16 value) { struct i2c_client *i2c = to_i2c_client(st->dev); @@ -40,13 +60,7 @@ static int ad5593r_read_adc(struct ad559 if (val < 0) return (int) val; - val = i2c_smbus_read_word_swapped(i2c, AD5593R_MODE_ADC_READBACK); - if (val < 0) - return (int) val; - - *value = (u16) val; - - return 0; + return ad5593r_read_word(i2c, AD5593R_MODE_ADC_READBACK, value); } static int ad5593r_reg_write(struct ad5592r_state *st, u8 reg, u16 value) @@ -60,25 +74,19 @@ static int ad5593r_reg_write(struct ad55 static int ad5593r_reg_read(struct ad5592r_state *st, u8 reg, u16 *value) { struct i2c_client *i2c = to_i2c_client(st->dev); - s32 val; - - val = i2c_smbus_read_word_swapped(i2c, AD5593R_MODE_REG_READBACK | reg); - if (val < 0) - return (int) val; - *value = (u16) val; - - return 0; + return ad5593r_read_word(i2c, AD5593R_MODE_REG_READBACK | reg, value); } static int ad5593r_gpio_read(struct ad5592r_state *st, u8 *value) { struct i2c_client *i2c = to_i2c_client(st->dev); - s32 val; + u16 val; + int ret; - val = i2c_smbus_read_word_swapped(i2c, AD5593R_MODE_GPIO_READBACK); - if (val < 0) - return (int) val; + ret = ad5593r_read_word(i2c, AD5593R_MODE_GPIO_READBACK, &val); + if (ret) + return ret; *value = (u8) val; From patchwork Mon Oct 24 11:29:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8705 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422940wru; Mon, 24 Oct 2022 05:23:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4D630OPCazMdfYwqd08pr51HaHjNcZyfchKs9lwrAZgFqIZxRiQeTPLyzUEgM61g/nErRP X-Received: by 2002:a17:906:9fc1:b0:761:9192:504f with SMTP id hj1-20020a1709069fc100b007619192504fmr27781010ejc.116.1666614220997; Mon, 24 Oct 2022 05:23:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614220; cv=none; d=google.com; s=arc-20160816; b=CT1/ysnsfG7cjstGgZKUN9XBw+ICkAA4uWobtcgqFU9wqyE7AblrmN7ScfXqk1CRPn eNwE3UfB/dEabM8HxFGCNCxx9tCCqmgPY7a1wpyDdD9Ld46sk7xHUTnzAduHN6duiV04 PjI6rvt8PZZ8vA8bbFYHAvRmyAhIhCJ0IMB78axO4ROqXgrLCkQWUkYHddE0uBpeehtS 9PFOsfB1aB4Eh0w8wX+ZwnD4SJHYBkpL5J6XDYCXMyb4E9yM2MBtJw0sBFdaYktMiPaf 1TEjkxmlTpdN7cEGDC12pqjOB2azqGAuoNrXNm5Q7peD7wicvqAETqXlqWiOTZRo7B+R nPhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hmXdpMxOmd4MJuzvpU/cDsAiYsy+E2+329gIPH+Djks=; b=gJFOe55X+VGF0xdlQLQcUwW8/GcWmOQEZhnswYongjbXyxRz3GEAcMT5/5rzNFeumd U1o2ViU6W4tZCd5s30zegGlAI8miW4iSVqPqBvWkupAQ8090mLdqXvqF9qQCZ2bZKJh6 sleQ5aBpKvLfNY29waH1C2Bf5CCFRzB3do1bjddLqF+kdPjbKJlI10bV2g7v8NRc3eT9 ig3hdqxS8NVLqilT7a3YQHXcVLffdpllGMghy95Udhj5Do6DC0TvqdJLo+VC6b0NtKzC CHU+V2wt7dBpd3jnt4Bg5BmoRMZuNctjUgVBes7jhcxpohEO99mpV4+rV/m4RWJD929u 0+Dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MLjjHABW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z16-20020a50cd10000000b00457ebe79577si26454676edi.623.2022.10.24.05.23.16; Mon, 24 Oct 2022 05:23:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MLjjHABW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233495AbiJXMW3 (ORCPT + 99 others); Mon, 24 Oct 2022 08:22:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233017AbiJXMUB (ORCPT ); Mon, 24 Oct 2022 08:20:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 143E77B2BA; Mon, 24 Oct 2022 04:58:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C73C3612D1; Mon, 24 Oct 2022 11:47:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9221C433D7; Mon, 24 Oct 2022 11:47:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612062; bh=Awcd/0SSmDN83dUDpNoaIq8lTcT014AjU8Qvxm5qHes=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MLjjHABWdhtW9WAWyU+HSDBLufPEEfEv9GZf6A5Wd9Ir5bT0TsVda5caUKDz53cm7 kUv7ra1VrYqq5YF+1ClkPJrOnLawctV1PYofcof9dTE7uQmuJ5qxCBj6QuPOK3iAlR h6Z0K0EAmA1Mzu1RYwtY+cWN0Gm2iHwoJrxxcTxE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Aring , David Teigland Subject: [PATCH 4.14 055/210] fs: dlm: fix race between test_bit() and queue_work() Date: Mon, 24 Oct 2022 13:29:32 +0200 Message-Id: <20221024112958.796344237@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571673485988650?= X-GMAIL-MSGID: =?utf-8?q?1747571673485988650?= From: Alexander Aring commit eef6ec9bf390e836a6c4029f3620fe49528aa1fe upstream. This patch fixes a race by using ls_cb_mutex around the bit operations and conditional code blocks for LSFL_CB_DELAY. The function dlm_callback_stop() expects to stop all callbacks and flush all currently queued onces. The set_bit() is not enough because there can still be queue_work() after the workqueue was flushed. To avoid queue_work() after set_bit(), surround both by ls_cb_mutex. Cc: stable@vger.kernel.org Signed-off-by: Alexander Aring Signed-off-by: David Teigland Signed-off-by: Greg Kroah-Hartman --- fs/dlm/ast.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/fs/dlm/ast.c +++ b/fs/dlm/ast.c @@ -198,13 +198,13 @@ void dlm_add_cb(struct dlm_lkb *lkb, uin if (!prev_seq) { kref_get(&lkb->lkb_ref); + mutex_lock(&ls->ls_cb_mutex); if (test_bit(LSFL_CB_DELAY, &ls->ls_flags)) { - mutex_lock(&ls->ls_cb_mutex); list_add(&lkb->lkb_cb_list, &ls->ls_cb_delay); - mutex_unlock(&ls->ls_cb_mutex); } else { queue_work(ls->ls_callback_wq, &lkb->lkb_cb_work); } + mutex_unlock(&ls->ls_cb_mutex); } out: mutex_unlock(&lkb->lkb_cb_mutex); @@ -284,7 +284,9 @@ void dlm_callback_stop(struct dlm_ls *ls void dlm_callback_suspend(struct dlm_ls *ls) { + mutex_lock(&ls->ls_cb_mutex); set_bit(LSFL_CB_DELAY, &ls->ls_flags); + mutex_unlock(&ls->ls_cb_mutex); if (ls->ls_callback_wq) flush_workqueue(ls->ls_callback_wq); From patchwork Mon Oct 24 11:29:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8855 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp432984wru; Mon, 24 Oct 2022 05:48:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7CKzAsXLdCYJsP9XovLnZUSK9APPbXKaiGlIsIRKVWNCqimDXW8/u9zjaj2O2ot2KdrY8c X-Received: by 2002:a17:903:11c3:b0:17a:e62:16e8 with SMTP id q3-20020a17090311c300b0017a0e6216e8mr34718798plh.137.1666615695511; Mon, 24 Oct 2022 05:48:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615695; cv=none; d=google.com; s=arc-20160816; b=ScjC9TsaUFU9G9eoaZhTP+CtwIhdT7xvQzOsUBX2waNCx6fPfzOKsYBSaNO1348i/k UqSxMWtGc6VDAT6bjkicGNdQR/v5vjrIphWMg4gyhHrdTwX3SaWSflYAjg79glCd0Y24 X1WQPpf4QFxtTLNGGCmfV6eLHdpoqFRP/nKubbThDfxRNycHeip0bo6ZzBnTw2chxlGd dwehaplTG67iezK/T4sN5wJF/RNuO0bcrXYfNb8dLyp1YThZkXKnjC4Yf9NKK8tIPcFH N3pC11DN88SIbVTRLtHnSP99jv9Fg3frxOSRyXlGto4a0HQGr73r+SNV+ZSAg0dUEDds RKFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OIw9Vi02JKjELh8Dryxwq3cawlZHQhyImfU86v1c1eo=; b=QT+fMDpofPrDwkgHoik+0Yn4SLrV0q21rRyc1Jmq7+pvv5eHvHkVL7di6gvRNaYzXi y005/gapvCZDrK388QV1am2NW5xVuA3vai0zLa65wOGILxJp3Fhrl56PD6I8dtPMrKkq 8OJEfdq8hV69D33BUB3K9MwBTd8cA+apmMkYFYi4b4TBRcY0eOUehMxgfjGct/1b9EMn lnWfHug92ZwP6o1sfwURZfCHd3ejGRXMp9V8ymt2TeEyOgdczaNVLVHedtk+mok8DBdN sEJoCACxx4UKVh7L5639L7LTZVdVgs49xnrjblKm00KYZQUPBHdOSCmuaZ6zlruwR2ji CVvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1QVbDz6t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n15-20020a6546cf000000b0046b2ec0de65si34522887pgr.789.2022.10.24.05.48.01; Mon, 24 Oct 2022 05:48:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1QVbDz6t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232790AbiJXMhG (ORCPT + 99 others); Mon, 24 Oct 2022 08:37:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234463AbiJXMaY (ORCPT ); Mon, 24 Oct 2022 08:30:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA9C19FE7; Mon, 24 Oct 2022 05:04:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2CA70B810F5; Mon, 24 Oct 2022 11:47:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7CFFFC433D6; Mon, 24 Oct 2022 11:47:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612064; bh=Yje59W4irP4MXC+axArm1788mYfHlGMWTgOhxOqxDr8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1QVbDz6tO6OCFJUwoQolPrbbgzKBnrxXm4oVImiqSuyynLafl3S2irgz3fjR9LsFG gpskkYjYbkfgxHu/c24T3EQ5cmJi3cLS72H0p8/pVgxGsnxs2DxHwbxiUDeU2y5FR/ PxjNpkAD3T8+qJglfC/dRAzoMUnsAmGzz8+Y11GE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Aring , David Teigland Subject: [PATCH 4.14 056/210] fs: dlm: handle -EBUSY first in lock arg validation Date: Mon, 24 Oct 2022 13:29:33 +0200 Message-Id: <20221024112958.837223820@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573219909611904?= X-GMAIL-MSGID: =?utf-8?q?1747573219909611904?= From: Alexander Aring commit 44637ca41d551d409a481117b07fa209b330fca9 upstream. During lock arg validation, first check for -EBUSY cases, then for -EINVAL cases. The -EINVAL checks look at lkb state variables which are not stable when an lkb is busy and would cause an -EBUSY result, e.g. lkb->lkb_grmode. Cc: stable@vger.kernel.org Signed-off-by: Alexander Aring Signed-off-by: David Teigland Signed-off-by: Greg Kroah-Hartman --- fs/dlm/lock.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) --- a/fs/dlm/lock.c +++ b/fs/dlm/lock.c @@ -2887,24 +2887,24 @@ static int set_unlock_args(uint32_t flag static int validate_lock_args(struct dlm_ls *ls, struct dlm_lkb *lkb, struct dlm_args *args) { - int rv = -EINVAL; + int rv = -EBUSY; if (args->flags & DLM_LKF_CONVERT) { - if (lkb->lkb_flags & DLM_IFL_MSTCPY) + if (lkb->lkb_status != DLM_LKSTS_GRANTED) goto out; - if (args->flags & DLM_LKF_QUECVT && - !__quecvt_compat_matrix[lkb->lkb_grmode+1][args->mode+1]) + if (lkb->lkb_wait_type) goto out; - rv = -EBUSY; - if (lkb->lkb_status != DLM_LKSTS_GRANTED) + if (is_overlap(lkb)) goto out; - if (lkb->lkb_wait_type) + rv = -EINVAL; + if (lkb->lkb_flags & DLM_IFL_MSTCPY) goto out; - if (is_overlap(lkb)) + if (args->flags & DLM_LKF_QUECVT && + !__quecvt_compat_matrix[lkb->lkb_grmode+1][args->mode+1]) goto out; } From patchwork Mon Oct 24 11:29:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8548 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp417062wru; Mon, 24 Oct 2022 05:12:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM40k4S7h/gRPpeA8QJQJfzsusIZ4VfPgxgfmOy8D++NQDQil/893WoMRDSH8odLyK/2Ik9H X-Received: by 2002:a17:907:703:b0:78e:25be:5455 with SMTP id xb3-20020a170907070300b0078e25be5455mr26814918ejb.630.1666613554299; Mon, 24 Oct 2022 05:12:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613554; cv=none; d=google.com; s=arc-20160816; b=n9fmiQWrJf4MZ+qbIhGjKbnQK/wGZpEhwXvhjjdS/nrIfEbDEr//2c+OenlEDnxH/Q //1UWTYRl/iKTtlIm8tY87YPyX5SQTtHa4BYmcXJeKGSallO2jZrQZ/EW9HyOLlDR4XC W3TNOTJzKadK4lUu4Y84kgQ+fCYiNufOZkwqF8uxEjIV4l2YYS++G7Aw6NBPewNAgHp1 xWSXjcPNE1BPCBqOcVAfBouxbuhV3usup0LdLCQcOA+6/XZbh2wOXnByDLyJ2IrDgUqn O3uJ8yizU7lduhlOb3F95XXx3cZOc6Dxi/n/CTGsY/eTCStNXKFLtOaXnYTFrEkyWLKG nu3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3UETVJToKRooLul9VtzlxHjDDpDSZqBsVTpyJjEW/T8=; b=XTh8+8BxUAqH7bhJzNKEVtz2rJryGBr61zahi8BIVeAG4upKjWLhtm5I4+KaTcCWhJ Ikmem5GWc10ZWiQDL3xZ9VHtYDKNHIb+QW6BmT1d4X2vt4htzPQYt+sFOWcnAt4MR+/F vXasaXloRZwP7rbzARVoSzYJe8ssnA+lkZU8Vt83McDdkyCVHO/Y1fNMScOVBZwXYjBK vT0ghZoxnwYs1/gmtkrIXBdrPFmsS2njxwrqHWIMQop88rRq1vnVG5169kMq6JZMAdT5 bXdj3lmAFuN4hTx35uAmdDEkALEx5667FRD1jQ4POAnIPo6OiQRP+8BojS/z8Z8nBO99 INYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=S5ttM9+o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i7-20020a1709064fc700b0078d6418dcb8si30958940ejw.456.2022.10.24.05.12.09; Mon, 24 Oct 2022 05:12:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=S5ttM9+o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232456AbiJXMBB (ORCPT + 99 others); Mon, 24 Oct 2022 08:01:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232458AbiJXL7A (ORCPT ); Mon, 24 Oct 2022 07:59:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B552675FEF; Mon, 24 Oct 2022 04:48:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 07D5A61290; Mon, 24 Oct 2022 11:47:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B521C433D6; Mon, 24 Oct 2022 11:47:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612067; bh=OF1W0WRv6N1A+be9khkZucbgqhbZdDpuAKasngrywT0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S5ttM9+o9pm1IcIyoso/T/IYzO2U96a5jXjkBKf2ZNePWjZxJFfLC15niX277lOEr y9fo5Emga39KcZRSDqQsZDccGD5PI8gsaxOXQmTHuiYeY7Mn41GbiZM/yLhuTDeG51 9bW00ltPRJ2B7TFJGbR2YnCMgWVC0d/JYfEp9C/E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andri Yngvason , Benjamin Tissoires Subject: [PATCH 4.14 057/210] HID: multitouch: Add memory barriers Date: Mon, 24 Oct 2022 13:29:34 +0200 Message-Id: <20221024112958.876996172@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747570974395671837?= X-GMAIL-MSGID: =?utf-8?q?1747570974395671837?= From: Andri Yngvason commit be6e2b5734a425941fcdcdbd2a9337be498ce2cf upstream. This fixes broken atomic checks which cause a race between the release-timer and processing of hid input. I noticed that contacts were sometimes sticking, even with the "sticky fingers" quirk enabled. This fixes that problem. Cc: stable@vger.kernel.org Fixes: 9609827458c3 ("HID: multitouch: optimize the sticky fingers timer") Signed-off-by: Andri Yngvason Signed-off-by: Benjamin Tissoires Link: https://lore.kernel.org/r/20220907150159.2285460-1-andri@yngvason.is Signed-off-by: Greg Kroah-Hartman --- drivers/hid/hid-multitouch.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -832,7 +832,7 @@ static void mt_touch_report(struct hid_d int r, n; /* sticky fingers release in progress, abort */ - if (test_and_set_bit(MT_IO_FLAGS_RUNNING, &td->mt_io_flags)) + if (test_and_set_bit_lock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags)) return; /* @@ -888,7 +888,7 @@ static void mt_touch_report(struct hid_d del_timer(&td->release_timer); } - clear_bit(MT_IO_FLAGS_RUNNING, &td->mt_io_flags); + clear_bit_unlock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags); } static int mt_touch_input_configured(struct hid_device *hdev, @@ -1271,11 +1271,11 @@ static void mt_expired_timeout(unsigned * An input report came in just before we release the sticky fingers, * it will take care of the sticky fingers. */ - if (test_and_set_bit(MT_IO_FLAGS_RUNNING, &td->mt_io_flags)) + if (test_and_set_bit_lock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags)) return; if (test_bit(MT_IO_FLAGS_PENDING_SLOTS, &td->mt_io_flags)) mt_release_contacts(hdev); - clear_bit(MT_IO_FLAGS_RUNNING, &td->mt_io_flags); + clear_bit_unlock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags); } static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) From patchwork Mon Oct 24 11:29:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8553 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp417198wru; Mon, 24 Oct 2022 05:12:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7sHZK0O6IWh/tQ4WwvwaJb8atqB7UlBvcbSC6e25vgvOtB+3yLbubM4iUoJHphB6g4It1H X-Received: by 2002:a17:906:974f:b0:7aa:f705:e580 with SMTP id o15-20020a170906974f00b007aaf705e580mr567610ejy.530.1666613565722; Mon, 24 Oct 2022 05:12:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613565; cv=none; d=google.com; s=arc-20160816; b=DuUrd1BgfOsIOXD4cVLVVxwNYwDpJKjPPoJ1XEebx0WHws5quOdPFL2XucndP7WGt4 Xk3ZVQWMRVTNDPyFECkFNrLTiKX9RLSLTBPGY/ex5WyLv6DZqAGZt1LeVeJ84CmB5II+ L6jdqGNgDLh1Oln2sr824yFMu44w86YxXbSRPL03M6X2a4hJIv9UiK0cB9os/LxQNA0b Z03Hi6aDReK4DZZcEExhyvCOoCXy9r3CP4YRcnkqBJMfAQDODSglOlh4x5F5AfYaN5WY jPgPV5vZ3HNyQ7VaQrQ7n3V2FwyQgY553Nh0iDoETJVcAFG+MSm4l310rkRiQfTNEzcv FFSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VVBrQWbjmKjB6+vC7B+FnDMJY7RUKPKAlCEY0OGIoXc=; b=fl3nYixNioUOqD0MQDz/ZVPUuB5pV2+CTTxTiS7PMKOPuXbUpVQpgw6CJpnL0WXmVr ycr+hay2pgUOYbere1J64ZDJks4MHSbva2thpuU2YTGhHmSOUdABrblOAQ6v/KZnxuK/ LCSChK02mNPwL+u1KvaZdWiZMkev2ZDC3g78zjtxz2aQvdI0Eju4RJDfY4xjFcOAY8g0 IwIdJ0O3KtkdV/+JUhMLU/AbDAhWFvbmTvI9yJmv1UxCT4lMb133KRX1LzPwavvOrYl8 460AQ6XqkN8hF2Vl44wutsw2fX81NbcLtRGXCrJbgpbdVxsODJTDo0AS7LI1mEc05YNY EPGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jS2mpEGE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t30-20020a056402241e00b0046069e4590bsi12210323eda.104.2022.10.24.05.12.19; Mon, 24 Oct 2022 05:12:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jS2mpEGE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232473AbiJXMB1 (ORCPT + 99 others); Mon, 24 Oct 2022 08:01:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232518AbiJXL7J (ORCPT ); Mon, 24 Oct 2022 07:59:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C88A7C1EC; Mon, 24 Oct 2022 04:48:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A38E361259; Mon, 24 Oct 2022 11:47:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B191DC433C1; Mon, 24 Oct 2022 11:47:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612070; bh=iy6+dzbMrtUn8z3Bzy2JPrniPwMyWDR81wptzzfv+ZE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jS2mpEGEJ/mqXToHFh/lQFTPlyBsaWU+UsUBU9o3Ls/NZtCUIJ/txvr8sBJoHxPsT OCpkyThO6qP1emmdzeW8TcJ0ebqyudjtASy9nAxzE8RhCHAjA0J8OzC608vtSCMJqa 2aVw4Ri1SKsqaPtV5cf4OhuRU7vPW3mi2hAkLdOk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhihao Cheng , Jan Kara Subject: [PATCH 4.14 058/210] quota: Check next/prev free block number after reading from quota file Date: Mon, 24 Oct 2022 13:29:35 +0200 Message-Id: <20221024112958.918041273@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747570986218061509?= X-GMAIL-MSGID: =?utf-8?q?1747570986218061509?= From: Zhihao Cheng commit 6c8ea8b8cd4722efd419f91ca46a2dc81b7d89a3 upstream. Following process: Init: v2_read_file_info: <3> dqi_free_blk 0 dqi_free_entry 5 dqi_blks 6 Step 1. chown bin f_a -> dquot_acquire -> v2_write_dquot: qtree_write_dquot do_insert_tree find_free_dqentry get_free_dqblk write_blk(info->dqi_blocks) // info->dqi_blocks = 6, failure. The content in physical block (corresponding to blk 6) is random. Step 2. chown root f_a -> dquot_transfer -> dqput_all -> dqput -> ext4_release_dquot -> v2_release_dquot -> qtree_delete_dquot: dquot_release remove_tree free_dqentry put_free_dqblk(6) info->dqi_free_blk = blk // info->dqi_free_blk = 6 Step 3. drop cache (buffer head for block 6 is released) Step 4. chown bin f_b -> dquot_acquire -> commit_dqblk -> v2_write_dquot: qtree_write_dquot do_insert_tree find_free_dqentry get_free_dqblk dh = (struct qt_disk_dqdbheader *)buf blk = info->dqi_free_blk // 6 ret = read_blk(info, blk, buf) // The content of buf is random info->dqi_free_blk = le32_to_cpu(dh->dqdh_next_free) // random blk Step 5. chown bin f_c -> notify_change -> ext4_setattr -> dquot_transfer: dquot = dqget -> acquire_dquot -> ext4_acquire_dquot -> dquot_acquire -> commit_dqblk -> v2_write_dquot -> dq_insert_tree: do_insert_tree find_free_dqentry get_free_dqblk blk = info->dqi_free_blk // If blk < 0 and blk is not an error code, it will be returned as dquot transfer_to[USRQUOTA] = dquot // A random negative value __dquot_transfer(transfer_to) dquot_add_inodes(transfer_to[cnt]) spin_lock(&dquot->dq_dqb_lock) // page fault , which will lead to kernel page fault: Quota error (device sda): qtree_write_dquot: Error -8000 occurred while creating quota BUG: unable to handle page fault for address: ffffffffffffe120 #PF: supervisor write access in kernel mode #PF: error_code(0x0002) - not-present page Oops: 0002 [#1] PREEMPT SMP CPU: 0 PID: 5974 Comm: chown Not tainted 6.0.0-rc1-00004 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996) RIP: 0010:_raw_spin_lock+0x3a/0x90 Call Trace: dquot_add_inodes+0x28/0x270 __dquot_transfer+0x377/0x840 dquot_transfer+0xde/0x540 ext4_setattr+0x405/0x14d0 notify_change+0x68e/0x9f0 chown_common+0x300/0x430 __x64_sys_fchownat+0x29/0x40 In order to avoid accessing invalid quota memory address, this patch adds block number checking of next/prev free block read from quota file. Fetch a reproducer in [Link]. Link: https://bugzilla.kernel.org/show_bug.cgi?id=216372 Fixes: 1da177e4c3f4152 ("Linux-2.6.12-rc2") CC: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220923134555.2623931-2-chengzhihao1@huawei.com Signed-off-by: Zhihao Cheng Signed-off-by: Jan Kara Signed-off-by: Greg Kroah-Hartman --- fs/quota/quota_tree.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) --- a/fs/quota/quota_tree.c +++ b/fs/quota/quota_tree.c @@ -79,6 +79,35 @@ static ssize_t write_blk(struct qtree_me return ret; } +static inline int do_check_range(struct super_block *sb, const char *val_name, + uint val, uint min_val, uint max_val) +{ + if (val < min_val || val > max_val) { + quota_error(sb, "Getting %s %u out of range %u-%u", + val_name, val, min_val, max_val); + return -EUCLEAN; + } + + return 0; +} + +static int check_dquot_block_header(struct qtree_mem_dqinfo *info, + struct qt_disk_dqdbheader *dh) +{ + int err = 0; + + err = do_check_range(info->dqi_sb, "dqdh_next_free", + le32_to_cpu(dh->dqdh_next_free), 0, + info->dqi_blocks - 1); + if (err) + return err; + err = do_check_range(info->dqi_sb, "dqdh_prev_free", + le32_to_cpu(dh->dqdh_prev_free), 0, + info->dqi_blocks - 1); + + return err; +} + /* Remove empty block from list and return it */ static int get_free_dqblk(struct qtree_mem_dqinfo *info) { @@ -93,6 +122,9 @@ static int get_free_dqblk(struct qtree_m ret = read_blk(info, blk, buf); if (ret < 0) goto out_buf; + ret = check_dquot_block_header(info, dh); + if (ret) + goto out_buf; info->dqi_free_blk = le32_to_cpu(dh->dqdh_next_free); } else { @@ -240,6 +272,9 @@ static uint find_free_dqentry(struct qtr *err = read_blk(info, blk, buf); if (*err < 0) goto out_buf; + *err = check_dquot_block_header(info, dh); + if (*err) + goto out_buf; } else { blk = get_free_dqblk(info); if ((int)blk < 0) { @@ -432,6 +467,9 @@ static int free_dqentry(struct qtree_mem goto out_buf; } dh = (struct qt_disk_dqdbheader *)buf; + ret = check_dquot_block_header(info, dh); + if (ret) + goto out_buf; le16_add_cpu(&dh->dqdh_entries, -1); if (!le16_to_cpu(dh->dqdh_entries)) { /* Block got free? */ ret = remove_free_dqentry(info, buf, blk); From patchwork Mon Oct 24 11:29:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10062 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp623985wru; Mon, 24 Oct 2022 12:49:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM46uG2tTS+AG5NNEUHA1joE1JemPOSVgPwebLh7DrTM/m3Vbpk/F9dbBEWNRWJlEdkMFyIf X-Received: by 2002:a05:6402:249b:b0:460:cb11:27d4 with SMTP id q27-20020a056402249b00b00460cb1127d4mr21936728eda.410.1666640980125; Mon, 24 Oct 2022 12:49:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640980; cv=none; d=google.com; s=arc-20160816; b=bmJ+PiCGIEZ5fYHX0Deumarh3J1PnBVF8rEEBJmVAt9NzriEMBaNDBf6BVaGdEfXNf msZkbaB53HJPzrm20R+OVYaIKwoapymg0pR8slM27yeJ8eEihYII80PylwXiVAMUoIdQ +F+FdLeKVOuhi248qYEeRqRjmDtCj1b8pqaY0utyQZVoAuLh9jOkBFmaDfo5ic5ASHdl KoezLU7wPTYxH8k9EaA7wQ+yEPk+IPHKxH53mtqsLzSHxpqbfXbQnKyNSC+Tuk05pZP4 z1RjUnQik4Sa583NDWUOEPsBPec33mZekgXrpyFxmpmAM+YOZjD2B5P1wH/Wmh/sFo54 1dfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qbrkafSnNO6Fpf+BelohyT6IWkPn804grG0jEImZgjo=; b=Bx4KTS8fj349tXlwhH6wK04bzMXs+ZgIXQcztMpEeH/Zct/WdQEKNyxNfVnoxo3Ie7 B5KX26k7Ra7DIkKGVSFgyubzWsnrOTdQZeIo9joHKCRrPdx6UqBGF01AeRVyR8SiaIWL 7jw7/cjhIYWrnzRSjSV2nH2z9SJc0/Vy05lOvAm/lKyWjUxqppoTrTJj4ONHu25qJk5S GZXko4pwhygsCYyTXSATDo3sLAwf3N/4ikJg6e2QLbMe+d9yAf1l0k0qyneLF6EPCwec e1JepJ3eQYOut3p/CoSX+mCkyLf4bFWAblobPp61AvM+O5a3mmcdiGHCePR0b4wAhjSh GPRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nEqfpksp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sa23-20020a1709076d1700b0078c8dadd4bbsi585426ejc.742.2022.10.24.12.49.16; Mon, 24 Oct 2022 12:49:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nEqfpksp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232140AbiJXTpI (ORCPT + 99 others); Mon, 24 Oct 2022 15:45:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233427AbiJXTmO (ORCPT ); Mon, 24 Oct 2022 15:42:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AB4DE09B7; Mon, 24 Oct 2022 11:11:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2934DB8118F; Mon, 24 Oct 2022 11:47:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C692C433D6; Mon, 24 Oct 2022 11:47:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612072; bh=6F0okbPNaJVmpOAkAP8nAQh12Kr7LsC4w3octjhvero=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nEqfpkspUJB02q6UCO1ynUvKNwn34M58B+3Jilf5JSQ44sJfSWtqZiKLCxQXW4VDq xvJKXX3zg8loMn9MmwizjAxE3mhhkGkqEZP9WQ8yU9j9mJ+od07o4lE7mqz1q3bL6K 2fiDcEKz1PBl35s9VKxezZ/Nppw7WcuexqNoO/ek= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Gross , Bjorn Andersson , Konrad Dybcio , linux-arm-msm@vger.kernel.org, Linus Walleij , Mark Brown Subject: [PATCH 4.14 059/210] regulator: qcom_rpm: Fix circular deferral regression Date: Mon, 24 Oct 2022 13:29:36 +0200 Message-Id: <20221024112958.948588326@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747599732634885028?= X-GMAIL-MSGID: =?utf-8?q?1747599732634885028?= From: Linus Walleij commit 8478ed5844588703a1a4c96a004b1525fbdbdd5e upstream. On recent kernels, the PM8058 L16 (or any other PM8058 LDO-regulator) does not come up if they are supplied by an SMPS-regulator. This is not very strange since the regulators are registered in a long array and the L-regulators are registered before the S-regulators, and if an L-regulator defers, it will never get around to registering the S-regulator that it needs. See arch/arm/boot/dts/qcom-apq8060-dragonboard.dts: pm8058-regulators { (...) vdd_l13_l16-supply = <&pm8058_s4>; (...) Ooops. Fix this by moving the PM8058 S-regulators first in the array. Do the same for the PM8901 S-regulators (though this is currently not causing any problems with out device trees) so that the pattern of registration order is the same on all PMnnnn chips. Fixes: 087a1b5cdd55 ("regulator: qcom: Rework to single platform device") Cc: stable@vger.kernel.org Cc: Andy Gross Cc: Bjorn Andersson Cc: Konrad Dybcio Cc: linux-arm-msm@vger.kernel.org Signed-off-by: Linus Walleij Link: https://lore.kernel.org/r/20220909112529.239143-1-linus.walleij@linaro.org Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- drivers/regulator/qcom_rpm-regulator.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) --- a/drivers/regulator/qcom_rpm-regulator.c +++ b/drivers/regulator/qcom_rpm-regulator.c @@ -820,6 +820,12 @@ static const struct rpm_regulator_data r }; static const struct rpm_regulator_data rpm_pm8058_regulators[] = { + { "s0", QCOM_RPM_PM8058_SMPS0, &pm8058_smps, "vdd_s0" }, + { "s1", QCOM_RPM_PM8058_SMPS1, &pm8058_smps, "vdd_s1" }, + { "s2", QCOM_RPM_PM8058_SMPS2, &pm8058_smps, "vdd_s2" }, + { "s3", QCOM_RPM_PM8058_SMPS3, &pm8058_smps, "vdd_s3" }, + { "s4", QCOM_RPM_PM8058_SMPS4, &pm8058_smps, "vdd_s4" }, + { "l0", QCOM_RPM_PM8058_LDO0, &pm8058_nldo, "vdd_l0_l1_lvs" }, { "l1", QCOM_RPM_PM8058_LDO1, &pm8058_nldo, "vdd_l0_l1_lvs" }, { "l2", QCOM_RPM_PM8058_LDO2, &pm8058_pldo, "vdd_l2_l11_l12" }, @@ -847,12 +853,6 @@ static const struct rpm_regulator_data r { "l24", QCOM_RPM_PM8058_LDO24, &pm8058_nldo, "vdd_l23_l24_l25" }, { "l25", QCOM_RPM_PM8058_LDO25, &pm8058_nldo, "vdd_l23_l24_l25" }, - { "s0", QCOM_RPM_PM8058_SMPS0, &pm8058_smps, "vdd_s0" }, - { "s1", QCOM_RPM_PM8058_SMPS1, &pm8058_smps, "vdd_s1" }, - { "s2", QCOM_RPM_PM8058_SMPS2, &pm8058_smps, "vdd_s2" }, - { "s3", QCOM_RPM_PM8058_SMPS3, &pm8058_smps, "vdd_s3" }, - { "s4", QCOM_RPM_PM8058_SMPS4, &pm8058_smps, "vdd_s4" }, - { "lvs0", QCOM_RPM_PM8058_LVS0, &pm8058_switch, "vdd_l0_l1_lvs" }, { "lvs1", QCOM_RPM_PM8058_LVS1, &pm8058_switch, "vdd_l0_l1_lvs" }, @@ -861,6 +861,12 @@ static const struct rpm_regulator_data r }; static const struct rpm_regulator_data rpm_pm8901_regulators[] = { + { "s0", QCOM_RPM_PM8901_SMPS0, &pm8901_ftsmps, "vdd_s0" }, + { "s1", QCOM_RPM_PM8901_SMPS1, &pm8901_ftsmps, "vdd_s1" }, + { "s2", QCOM_RPM_PM8901_SMPS2, &pm8901_ftsmps, "vdd_s2" }, + { "s3", QCOM_RPM_PM8901_SMPS3, &pm8901_ftsmps, "vdd_s3" }, + { "s4", QCOM_RPM_PM8901_SMPS4, &pm8901_ftsmps, "vdd_s4" }, + { "l0", QCOM_RPM_PM8901_LDO0, &pm8901_nldo, "vdd_l0" }, { "l1", QCOM_RPM_PM8901_LDO1, &pm8901_pldo, "vdd_l1" }, { "l2", QCOM_RPM_PM8901_LDO2, &pm8901_pldo, "vdd_l2" }, @@ -869,12 +875,6 @@ static const struct rpm_regulator_data r { "l5", QCOM_RPM_PM8901_LDO5, &pm8901_pldo, "vdd_l5" }, { "l6", QCOM_RPM_PM8901_LDO6, &pm8901_pldo, "vdd_l6" }, - { "s0", QCOM_RPM_PM8901_SMPS0, &pm8901_ftsmps, "vdd_s0" }, - { "s1", QCOM_RPM_PM8901_SMPS1, &pm8901_ftsmps, "vdd_s1" }, - { "s2", QCOM_RPM_PM8901_SMPS2, &pm8901_ftsmps, "vdd_s2" }, - { "s3", QCOM_RPM_PM8901_SMPS3, &pm8901_ftsmps, "vdd_s3" }, - { "s4", QCOM_RPM_PM8901_SMPS4, &pm8901_ftsmps, "vdd_s4" }, - { "lvs0", QCOM_RPM_PM8901_LVS0, &pm8901_switch, "lvs0_in" }, { "lvs1", QCOM_RPM_PM8901_LVS1, &pm8901_switch, "lvs1_in" }, { "lvs2", QCOM_RPM_PM8901_LVS2, &pm8901_switch, "lvs2_in" }, From patchwork Mon Oct 24 11:29:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8547 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp417021wru; Mon, 24 Oct 2022 05:12:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM42p4AhzpcGgnC3+/piwQfsD1VZBa18Fh0evKiPNs1Se2gmKSumK57IH9V+g94qQpbfh95j X-Received: by 2002:a17:903:1105:b0:178:ae31:aad with SMTP id n5-20020a170903110500b00178ae310aadmr32907987plh.3.1666613551597; Mon, 24 Oct 2022 05:12:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613551; cv=none; d=google.com; s=arc-20160816; b=FXTCLnErgrdHwR8V8D6tlCOFLe+yhczQNrqzQ1ldCGWPMvCG2jbECu0zyGXpVOtt6h CjCQMJaTiNREAmVgDV3JS+U/mGpUfPQsNBOcyK/+Ej60x6ZHTWS9KX6QCMoQxHN0K2X2 5vYQIlS0DW8lguQP8DYB58MqEfGVblzU+w7bSxE+wvAEMwpEvoIAm55aI4QrTBhlCD3Y 66MGLGtNG7T1+QZJvW6x+fupn+2ACkNlooZLc5nIzMnsMD0IlsB+1LMPrDhbaK6g81yy AJ2DQWAMOn/ttSLVxgqmIgqGlJPoyFsVgjWpV3PM7oEYqOdZzh9vOGKqswsdxvyENpqX GcMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fCRKNMoDBltWLfDNcKeccFfKuww49DFJHbqqTKVamUk=; b=Eco5Edg59aJZH/WA28qk23OHmbqpWeolxrmrxnEO12JgYXhi5GDPic8cUQz6iaSuH4 Yq4nm2wT5UR1VGnjeMZEEPl87VoPz3djfL7Xm11RJmGxf82YiM6IkwAGkDQG22LIMDpD CEpSld/2Sj8lq6xPBB5Az2+/pVh4HXYSPN62WzSOzDzyhdHPYv4+NVzzhWrhg/iw1GYG EUkxoP2CxWsu2ohaF0WO9O13Y8n9cNV1VdXhuQrXcu6uxNZBZzRtVFtBhC7cuINa9kwG 4Ve8GPmsCOWaddJfJ9c+d1u5/bDquTnJ18jCmJY6Cge1PbNQuOJwYzO1hLlvqYQPw6Ki aVjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wZYn4lK+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b6-20020a170903228600b0017f75ce8a2esi38313101plh.575.2022.10.24.05.12.18; Mon, 24 Oct 2022 05:12:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wZYn4lK+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229491AbiJXMBV (ORCPT + 99 others); Mon, 24 Oct 2022 08:01:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232515AbiJXL7J (ORCPT ); Mon, 24 Oct 2022 07:59:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D889B67CAF; Mon, 24 Oct 2022 04:48:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1156861291; Mon, 24 Oct 2022 11:47:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2749DC433D6; Mon, 24 Oct 2022 11:47:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612075; bh=qm6vKhVcLtaeb42ubq9uaM2a4mSl/VgbKZoVaXZyZXc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wZYn4lK+eaOTDbFB1gaCVZNR2N2zCBAiybBNICb2rk7pM+eAIKnxDHF/CEPMfYkLc 7Bw62jmMBe3S2lkqPjEG8QisBZ3GW8YAfKhzcAFCnHq0pF+xrDBJYQcn413kPOSRGW aK6/+8kRA4n4GosAg4BNsk9mPU7R1rBQfng6T8XQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Saeed Mirzamohammadi , Sasha Levin Subject: [PATCH 4.14 060/210] Revert "fs: check FMODE_LSEEK to control internal pipe splicing" Date: Mon, 24 Oct 2022 13:29:37 +0200 Message-Id: <20221024112958.979609043@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747570971359345547?= X-GMAIL-MSGID: =?utf-8?q?1747570971359345547?= This reverts commit fd0a6e99b61e6c08fa5cf585d54fd956f70c73a6. Which was upstream commit 97ef77c52b789ec1411d360ed99dca1efe4b2c81. The commit is missing dependencies and breaks NFS tests, remove it for now. Reported-by: Saeed Mirzamohammadi Signed-off-by: Sasha Levin --- fs/splice.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- a/fs/splice.c +++ b/fs/splice.c @@ -898,15 +898,17 @@ ssize_t splice_direct_to_actor(struct fi { struct pipe_inode_info *pipe; long ret, bytes; + umode_t i_mode; size_t len; int i, flags, more; /* - * We require the input to be seekable, as we don't want to randomly - * drop data for eg socket -> socket splicing. Use the piped splicing - * for that! + * We require the input being a regular file, as we don't want to + * randomly drop data for eg socket -> socket splicing. Use the + * piped splicing for that! */ - if (unlikely(!(in->f_mode & FMODE_LSEEK))) + i_mode = file_inode(in)->i_mode; + if (unlikely(!S_ISREG(i_mode) && !S_ISBLK(i_mode))) return -EINVAL; /* From patchwork Mon Oct 24 11:29:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10058 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp623300wru; Mon, 24 Oct 2022 12:47:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4kc6hS8AesNyyMa1c5XtzVm9i6jH6gCutDB1fM/O4PJzh5wvY+cO+G4QYitJ3z32z5kwEm X-Received: by 2002:a17:906:9bed:b0:7a6:a68b:9697 with SMTP id de45-20020a1709069bed00b007a6a68b9697mr6967036ejc.218.1666640863475; Mon, 24 Oct 2022 12:47:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640863; cv=none; d=google.com; s=arc-20160816; b=b81NeJ2OwcaA6FqtZRdHHhcXwH6FEqdX5zLSR7eVy4X6mr1a4ddo++h836YR3owSRM tfbGE+PQF9a6zc5xLJsHVrumANaooGxZJSxyKMIZFfu9lIvkB8YBfsKKuwMydqj1CPxL 6GYmPtS5PtYl89oRT8GqZOMIU/m2qy7AIkkSNdiZBgbIG7PkrMHPdDaKlv8wBVX+O895 OBlSaU1JsxNpZUwOf3irkDGpjNn5LbFSjk1wd2w3yxboDkDlbU/7utbA9QwzD19ZexbT 1sdAIQ6oY5bQD+DgMH6OZ0F6XicsO1tclyCFN6TNmlnKdfocS0+o1+bfO6jFDWH5kZ16 yecg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5EJe+lboq02oe+GqHveqSKGIFzLy9JxZM70cdopWoP8=; b=DbsWEBsaZM3PHUG5bK90gfcbLqGDnXvd39tSW+t8ifD6tmg2BLcDh+/h0T/qFO/RbS 8piM9myviB0jOmDvbgMKHumNdDhLdk3oecsxOfJnCY7Gc4pHVnlgug5Z2DgTh5/r2zj+ 45FGJGGp38sL4B706+X4qVVnDtavysTr7g9OPuVQP/FvbltNcEp4aqeRPAPl5uRMGa24 U6rWOSs8QS4/gEr/l5hWcPV6OhtNI21p/JJ9tKia+IWcp3lJRCxsyG/7cikVpdjVoxuq uDp9kxS+629V3GNmnaPLFFWf1ujN4KrNYdq7vOoSen56MOHSgZcpcO+uLkcdNMJmNKlo fAJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=g67APvKJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb15-20020a1709071c8f00b007a6c5a23a48si116843ejc.551.2022.10.24.12.47.18; Mon, 24 Oct 2022 12:47:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=g67APvKJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232542AbiJXTpQ (ORCPT + 99 others); Mon, 24 Oct 2022 15:45:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233453AbiJXTmo (ORCPT ); Mon, 24 Oct 2022 15:42:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1489D4A07; Mon, 24 Oct 2022 11:11:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 05F7BB8119F; Mon, 24 Oct 2022 11:48:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 635BBC433C1; Mon, 24 Oct 2022 11:48:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612080; bh=CDq8FveJgeZh1rfJgeX4HZ9et2u3iDuKrkjXt/oPHxk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g67APvKJW91OrTdMcAA6EdvNuSlTEO40nUSjthxk+vIuS6oV3qcMT4nlOPkcSP4Xu erX6SuR4e5Hv4c+SakNLXBc40xfHMNU+M4LESvzgXj0vDhRHkEMc5a9lYyU/qq5TG7 p+toWcAWpODNALjMVnpqGoPin2hGWKt5BIKocIuY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Helge Deller Subject: [PATCH 4.14 061/210] parisc: fbdev/stifb: Align graphics memory size to 4MB Date: Mon, 24 Oct 2022 13:29:38 +0200 Message-Id: <20221024112959.009822666@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747599609963208203?= X-GMAIL-MSGID: =?utf-8?q?1747599609963208203?= From: Helge Deller commit aca7c13d3bee81a968337a5515411409ae9d095d upstream. Independend of the current graphics resolution, adjust the reported graphics card memory size to the next 4MB boundary. This fixes the fbtest program which expects a naturally aligned size. Signed-off-by: Helge Deller Cc: Signed-off-by: Greg Kroah-Hartman --- drivers/video/fbdev/stifb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/video/fbdev/stifb.c +++ b/drivers/video/fbdev/stifb.c @@ -1259,7 +1259,7 @@ static int __init stifb_init_fb(struct s /* limit fbsize to max visible screen size */ if (fix->smem_len > yres*fix->line_length) - fix->smem_len = yres*fix->line_length; + fix->smem_len = ALIGN(yres*fix->line_length, 4*1024*1024); fix->accel = FB_ACCEL_NONE; From patchwork Mon Oct 24 11:29:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10029 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp622410wru; Mon, 24 Oct 2022 12:45:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4L3txMaziQdkNRAlcDzVQNy39bEFbl/JszF486S2qft99aEKE4QaXhU7QqeGJdPkZAplHk X-Received: by 2002:a17:907:9717:b0:78d:9fb4:16dd with SMTP id jg23-20020a170907971700b0078d9fb416ddmr29831875ejc.720.1666640716196; Mon, 24 Oct 2022 12:45:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640716; cv=none; d=google.com; s=arc-20160816; b=tO2MGsjmU7Nt3pzg5FzCXLGMrOLr83V6ykuQAx0e4yI4OPCT9YQAYhSphLSBDIK5EW ArBU9ZtkSVV7PPVhreqkz7zPiMirJE12Orv5lx3Ldi4mPDL2DHOE8ZZFAHVk6aJ3G+1Z iwFGiC84D/NXZpeqaQxApeuXzneD4pIFPKg3ZNis/iZiHppX3xhu9OAhsS6769qRlGmX XxI1k5wyNSwwOvbYGayEBVyObuwNR5pESNauHnw44++Ht0f+zeumAE5MX/ZhasQexVuj +RMPegWhEdJqEV6OAr+Jr+zc38zR0w6Ej6rUCOvg2MaNuIvztHB4be4Qk51WzT1G38c7 SHPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VwaAX4ijTAW1/JY2XMmcMeTeUWRgXI9gDfuV9600zAQ=; b=U7/VUJQ3smGlNfKcl0eaXCIfVraLyzWRnBj+Qw2Wpukd6Hs6BR6/K8jk5JTwhXxfC6 D/G76Owqj5ho579eON+WTaEqgk9SDMLIganrNNH7SFRRHgdAjIDlRfBhjtgkz0E9dnBz ffF9XjogYb8r7jeiwatGc3yS5Qx2WK+oqkPSo+iLDjctUiSnxmVX97ccD7BByzGkTV1Z LUFbLknw1F/6FWT4Hsi8z5cIPImO2Bi6nC79+NmQnuNUCmO9R5R1Mtwl0mkkURDDP5p/ N/mtg5E0EEcUc1TVUHUI/lFSUt7tok3aDSrc8HoefPWK/FLbczEAMt9B4U0ZxAB7hL11 +JDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1kQGJKjo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dd21-20020a1709069b9500b00787d0df52f3si649151ejc.910.2022.10.24.12.44.48; Mon, 24 Oct 2022 12:45:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1kQGJKjo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233149AbiJXTlU (ORCPT + 99 others); Mon, 24 Oct 2022 15:41:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233230AbiJXTkh (ORCPT ); Mon, 24 Oct 2022 15:40:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A69511C5A7E; Mon, 24 Oct 2022 11:10:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 986DEB811A2; Mon, 24 Oct 2022 11:48:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE9CDC433C1; Mon, 24 Oct 2022 11:48:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612083; bh=uBbLc8QAgT9cQGnph4PMHqBIqShqWIcTjog/nTwhBok=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1kQGJKjo7cSNLUHvo8vn4kk5pSz/1f+iHRH6IUtRyLPChIUsRymdkByFxLq1Ff4a4 uMKcwW8Q79VsJ3puYtRbZpOkmAR8/kOJNHvwS8JgOyWvgzXe5oAS7kOvvFPkXzBlDt 3Q+CMd+SM80dbNHdczFLsy07mDe/5aEyKqEeZqvI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Huacai Chen , Richard Weinberger Subject: [PATCH 4.14 062/210] UM: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK Date: Mon, 24 Oct 2022 13:29:39 +0200 Message-Id: <20221024112959.049915255@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747599455269970279?= X-GMAIL-MSGID: =?utf-8?q?1747599455269970279?= From: Huacai Chen commit 16c546e148fa6d14a019431436a6f7b4087dbccd upstream. When CONFIG_CPUMASK_OFFSTACK and CONFIG_DEBUG_PER_CPU_MAPS is selected, cpu_max_bits_warn() generates a runtime warning similar as below while we show /proc/cpuinfo. Fix this by using nr_cpu_ids (the runtime limit) instead of NR_CPUS to iterate CPUs. [ 3.052463] ------------[ cut here ]------------ [ 3.059679] WARNING: CPU: 3 PID: 1 at include/linux/cpumask.h:108 show_cpuinfo+0x5e8/0x5f0 [ 3.070072] Modules linked in: efivarfs autofs4 [ 3.076257] CPU: 0 PID: 1 Comm: systemd Not tainted 5.19-rc5+ #1052 [ 3.099465] Stack : 9000000100157b08 9000000000f18530 9000000000cf846c 9000000100154000 [ 3.109127] 9000000100157a50 0000000000000000 9000000100157a58 9000000000ef7430 [ 3.118774] 90000001001578e8 0000000000000040 0000000000000020 ffffffffffffffff [ 3.128412] 0000000000aaaaaa 1ab25f00eec96a37 900000010021de80 900000000101c890 [ 3.138056] 0000000000000000 0000000000000000 0000000000000000 0000000000aaaaaa [ 3.147711] ffff8000339dc220 0000000000000001 0000000006ab4000 0000000000000000 [ 3.157364] 900000000101c998 0000000000000004 9000000000ef7430 0000000000000000 [ 3.167012] 0000000000000009 000000000000006c 0000000000000000 0000000000000000 [ 3.176641] 9000000000d3de08 9000000001639390 90000000002086d8 00007ffff0080286 [ 3.186260] 00000000000000b0 0000000000000004 0000000000000000 0000000000071c1c [ 3.195868] ... [ 3.199917] Call Trace: [ 3.203941] [<90000000002086d8>] show_stack+0x38/0x14c [ 3.210666] [<9000000000cf846c>] dump_stack_lvl+0x60/0x88 [ 3.217625] [<900000000023d268>] __warn+0xd0/0x100 [ 3.223958] [<9000000000cf3c90>] warn_slowpath_fmt+0x7c/0xcc [ 3.231150] [<9000000000210220>] show_cpuinfo+0x5e8/0x5f0 [ 3.238080] [<90000000004f578c>] seq_read_iter+0x354/0x4b4 [ 3.245098] [<90000000004c2e90>] new_sync_read+0x17c/0x1c4 [ 3.252114] [<90000000004c5174>] vfs_read+0x138/0x1d0 [ 3.258694] [<90000000004c55f8>] ksys_read+0x70/0x100 [ 3.265265] [<9000000000cfde9c>] do_syscall+0x7c/0x94 [ 3.271820] [<9000000000202fe4>] handle_syscall+0xc4/0x160 [ 3.281824] ---[ end trace 8b484262b4b8c24c ]--- Cc: stable@vger.kernel.org Signed-off-by: Huacai Chen Signed-off-by: Richard Weinberger Signed-off-by: Greg Kroah-Hartman --- arch/um/kernel/um_arch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c @@ -77,7 +77,7 @@ static int show_cpuinfo(struct seq_file static void *c_start(struct seq_file *m, loff_t *pos) { - return *pos < NR_CPUS ? cpu_data + *pos : NULL; + return *pos < nr_cpu_ids ? cpu_data + *pos : NULL; } static void *c_next(struct seq_file *m, void *v, loff_t *pos) From patchwork Mon Oct 24 11:29:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8580 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419094wru; Mon, 24 Oct 2022 05:15:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7dkBGWlofilG2OFKP571Qot1IxuT4tF3PFSiGXe2A9n9oKAgyalki99sDMZj4ns4OfOn4W X-Received: by 2002:a05:6402:2994:b0:453:4c5c:d31c with SMTP id eq20-20020a056402299400b004534c5cd31cmr31042970edb.412.1666613745027; Mon, 24 Oct 2022 05:15:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613745; cv=none; d=google.com; s=arc-20160816; b=bSRq7xJkYp9576qoZr4QKws1V0x6n6IOmwoO4GlUBD+IUuak1fDkS3l8bglyy5bzPh i5yKehSIzOFOZptINI3oriQhH0/CjNRVqsLgzJJlZ7wHPhuS3za4ImPlFIAKiSTUDk3v fOKDTN/ofOOIcntk5OWt71lOph8U7iYR+k4L6G/nQSx0FClVG6TqySC+0D4nbznmcFTr RZjK5d13qzOSrFi9qHEf1HEofp8qmfNKYKDXJlrFpKKuUhx1sCZRbJQq6yPJEfU0E82y kiOrrFM3X9004bCqOM0CLgRMbp6iJGc2wxTG5QzUfwS+NiJzUsZj/rPkGeiz8/CdyIkf 59UA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fEtQgbYu2hoRgsmFbYIHDQTFRngE9D3Z2iIRLhIXJL0=; b=sza8jZiJqrebXiYRrbvIvDU3GNTVDU2hpL2rINWI68z2VAQSIIBVT33DZ9PkATe+Gc 8V3x52QvzBaI59A0ch5G9FRknGdBW7xen6juQlvEeNXv0vYlf8QRPVJZj+e21HTEa5Ll MEkI9x3SknsdRC4W0Cn4MAyq5X4EEqa4c1lZ5YyXmG2DZXiP52KQIvBAYdOkNrb+8xAV dcN6C1hUvg/opE935i1ASViINCTbrWE0Ytu1kKAuMmAIr4R56b0fgWZhWvrnPHEpD3Ya faEZ2pCHhVH5Fxn//19BmwIpAcSHw3aQHhtwQTpToDn7eqgkX0SbxrJY9alxifyt4L/r xrcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nUZkxBRN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j10-20020a05640211ca00b00461f9648c7dsi323930edw.422.2022.10.24.05.15.21; Mon, 24 Oct 2022 05:15:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nUZkxBRN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229962AbiJXMCW (ORCPT + 99 others); Mon, 24 Oct 2022 08:02:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232650AbiJXL71 (ORCPT ); Mon, 24 Oct 2022 07:59:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBACF76467; Mon, 24 Oct 2022 04:48:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A228B61280; Mon, 24 Oct 2022 11:48:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3B5AC433D6; Mon, 24 Oct 2022 11:48:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612086; bh=dnJX2WIh5SmzNEzJFNjpWxq+cgxRnaTcjrT6XmUFK10=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nUZkxBRN3NT4vl6hVv8dQofWR1SeeUd2S5yumHLP3RfJUkfpVLNgAxrHdSnsZme8y LgitIRO0gxCL8syPbkArak2u5vFWuYhD3wI8BS/yyPRUAlU++irznHDHTC4ATUvxlb CY5SjfGyPd1EyNhC6c6FGRQEqyhp04IXvLUEGOoo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Maciej W. Rozycki" , Bjorn Helgaas Subject: [PATCH 4.14 063/210] PCI: Sanitise firmware BAR assignments behind a PCI-PCI bridge Date: Mon, 24 Oct 2022 13:29:40 +0200 Message-Id: <20221024112959.080456625@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571174125684138?= X-GMAIL-MSGID: =?utf-8?q?1747571174125684138?= From: Maciej W. Rozycki commit 0e32818397426a688f598f35d3bc762eca6d7592 upstream. When pci_assign_resource() is unable to assign resources to a BAR, it uses pci_revert_fw_address() to fall back to a firmware assignment (if any). Previously pci_revert_fw_address() assumed all addresses could reach the device, but this is not true if the device is below a bridge that only forwards addresses within its windows. This problem was observed on a Tyan Tomcat IV S1564D system where the BIOS did not assign valid addresses to several bridges and USB devices: pci 0000:00:11.0: PCI-to-PCIe bridge to [bus 01-ff] pci 0000:00:11.0: bridge window [io 0xe000-0xefff] pci 0000:01:00.0: PCIe Upstream Port to [bus 02-ff] pci 0000:01:00.0: bridge window [io 0x0000-0x0fff] # unreachable pci 0000:02:02.0: PCIe Downstream Port to [bus 05-ff] pci 0000:02:02.0: bridge window [io 0x0000-0x0fff] # unreachable pci 0000:05:00.0: PCIe-to-PCI bridge to [bus 06-ff] pci 0000:05:00.0: bridge window [io 0x0000-0x0fff] # unreachable pci 0000:06:08.0: USB UHCI 1.1 pci 0000:06:08.0: BAR 4: [io 0xfce0-0xfcff] # unreachable pci 0000:06:08.1: USB UHCI 1.1 pci 0000:06:08.1: BAR 4: [io 0xfce0-0xfcff] # unreachable pci 0000:06:08.0: can't claim BAR 4 [io 0xfce0-0xfcff]: no compatible bridge window pci 0000:06:08.1: can't claim BAR 4 [io 0xfce0-0xfcff]: no compatible bridge window During the first pass of assigning unassigned resources, there was not enough I/O space available, so we couldn't assign the 06:08.0 BAR and reverted to the firmware assignment (still unreachable). Reverting the 06:08.1 assignment failed because it conflicted with 06:08.0: pci 0000:00:11.0: bridge window [io 0xe000-0xefff] pci 0000:01:00.0: no space for bridge window [io size 0x2000] pci 0000:02:02.0: no space for bridge window [io size 0x1000] pci 0000:05:00.0: no space for bridge window [io size 0x1000] pci 0000:06:08.0: BAR 4: no space for [io size 0x0020] pci 0000:06:08.0: BAR 4: trying firmware assignment [io 0xfce0-0xfcff] pci 0000:06:08.1: BAR 4: no space for [io size 0x0020] pci 0000:06:08.1: BAR 4: trying firmware assignment [io 0xfce0-0xfcff] pci 0000:06:08.1: BAR 4: [io 0xfce0-0xfcff] conflicts with 0000:06:08.0 [io 0xfce0-0xfcff] A subsequent pass assigned valid bridge windows and a valid 06:08.1 BAR, but left the 06:08.0 BAR alone, so the UHCI device was still unusable: pci 0000:00:11.0: bridge window [io 0xe000-0xefff] released pci 0000:00:11.0: bridge window [io 0x1000-0x2fff] # reassigned pci 0000:01:00.0: bridge window [io 0x1000-0x2fff] # reassigned pci 0000:02:02.0: bridge window [io 0x2000-0x2fff] # reassigned pci 0000:05:00.0: bridge window [io 0x2000-0x2fff] # reassigned pci 0000:06:08.0: BAR 4: assigned [io 0xfce0-0xfcff] # left alone pci 0000:06:08.1: BAR 4: assigned [io 0x2000-0x201f] ... uhci_hcd 0000:06:08.0: host system error, PCI problems? uhci_hcd 0000:06:08.0: host controller process error, something bad happened! uhci_hcd 0000:06:08.0: host controller halted, very bad! uhci_hcd 0000:06:08.0: HCRESET not completed yet! uhci_hcd 0000:06:08.0: HC died; cleaning up If the address assigned by firmware is not reachable because it's not within upstream bridge windows, fail instead of assigning the unusable address from firmware. [bhelgaas: commit log, use pci_upstream_bridge()] Link: https://bugzilla.kernel.org/show_bug.cgi?id=16263 Link: https://lore.kernel.org/r/alpine.DEB.2.21.2203012338460.46819@angie.orcam.me.uk Link: https://lore.kernel.org/r/alpine.DEB.2.21.2209211921250.29493@angie.orcam.me.uk Fixes: 58c84eda0756 ("PCI: fall back to original BIOS BAR addresses") Signed-off-by: Maciej W. Rozycki Signed-off-by: Bjorn Helgaas Cc: stable@vger.kernel.org # v2.6.35+ Signed-off-by: Greg Kroah-Hartman --- drivers/pci/setup-res.c | 11 +++++++++++ 1 file changed, 11 insertions(+) --- a/drivers/pci/setup-res.c +++ b/drivers/pci/setup-res.c @@ -215,6 +215,17 @@ static int pci_revert_fw_address(struct root = pci_find_parent_resource(dev, res); if (!root) { + /* + * If dev is behind a bridge, accesses will only reach it + * if res is inside the relevant bridge window. + */ + if (pci_upstream_bridge(dev)) + return -ENXIO; + + /* + * On the root bus, assume the host bridge will forward + * everything. + */ if (res->flags & IORESOURCE_IO) root = &ioport_resource; else From patchwork Mon Oct 24 11:29:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8555 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp417208wru; Mon, 24 Oct 2022 05:12:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6QwB2aWfGXbi85XFuQGwbFX5bOF0TDCmow05ELLYtIvhqZ8BfcarcPuC7le2kqyCXGzMPN X-Received: by 2002:a17:907:2c78:b0:78d:eacd:1060 with SMTP id ib24-20020a1709072c7800b0078deacd1060mr26620156ejc.244.1666613566852; Mon, 24 Oct 2022 05:12:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613566; cv=none; d=google.com; s=arc-20160816; b=kPfxY7BSzjoVVYtyvGfjez0FE1gVZCFXCsPa6EubD5b8H6VoMObV+oF30N+Qi896hO gCEjKOO0PzOwA1E9Tee2W9+rU3fk5KrVnNntAiGroZWZc/2ZU+W5qe6gkOTbk2Q41X8T VzZPvnLeOE/NCbdwz1oLVzap+kw2R5LqVr4nRZy8JgQ+1R/sOqdClM9WdWt/0C4J+Sny YmVjg8Y1niPFXm89idRMKCTSATG2aqfX55W4aErFaLMHj/cS4oz7Ic3t7rXVigMQZuWw jnJcz6sCmX3ivTELfZYFgYH+0VAf9ndvKjN8bQmCk2+FmcK+HU495encU8iR+uMZ88Pd r4zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PzCrnk2ltXfoIb/jzNb1nwOggwsh7heKdcU3iXwzgqY=; b=ZRp0iesvWXxLEWO8uLiDoYhpzyR/n2nNTmxOrhL1J0vD1XQv26h7qJtHPuKvspmpEG oKNNsZqELAG3D8wK659j5vGXV2f4CTJ7bYMYRCrcP/yQyTFpYReTgWU2MejXuPfRqy8C x2KHmqHhCDyjlSOJkSNzIXrHmJd4bXX9UmKGz9J9X1rqeGJnku9Wz65uOe1z8Ys39APW oKL9w2hm97x/ZaxyHw0QaORWbHOFk3pqLCE/58EcdbsnVOzMei3Njb6AGv9/RmwNB7MI DvYbPydWKe/yS8NDZstiBUQ4eLGwzZ0/oHVAODL0nt3w1gIajpNri4IR2qp4uZhD4Ya/ OwiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Wxu7A8C+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j25-20020aa7c419000000b0046199bc9130si4115396edq.467.2022.10.24.05.12.22; Mon, 24 Oct 2022 05:12:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Wxu7A8C+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231207AbiJXMBv (ORCPT + 99 others); Mon, 24 Oct 2022 08:01:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232597AbiJXL7V (ORCPT ); Mon, 24 Oct 2022 07:59:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4624B76566; Mon, 24 Oct 2022 04:48:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4D9B16125D; Mon, 24 Oct 2022 11:48:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6102BC433C1; Mon, 24 Oct 2022 11:48:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612088; bh=AigwrwtcfRO68yBZHTNgX6TxImqDnWA9jhU6WuQ3pdI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wxu7A8C+aARCPx6R6pHGrNnJSAXGaJoBL7z6u4GXzzRenPbVO8QxR1Wur53dCnC5P IBH7GVqLuWxS3j0eQI+ns6FVobtS+aTCvv1FK3yFiDQcP6wrtR/+Chw1EMS3hwi3v4 2vMx4Kj7FV10KrJyyz94gXog7l+Zhtqgw6RWKnr8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hyunwoo Kim , Helge Deller Subject: [PATCH 4.14 064/210] fbdev: smscufx: Fix use-after-free in ufx_ops_open() Date: Mon, 24 Oct 2022 13:29:41 +0200 Message-Id: <20221024112959.111451423@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747570987258106374?= X-GMAIL-MSGID: =?utf-8?q?1747570987258106374?= From: Hyunwoo Kim commit 5610bcfe8693c02e2e4c8b31427f1bdbdecc839c upstream. A race condition may occur if the user physically removes the USB device while calling open() for this device node. This is a race condition between the ufx_ops_open() function and the ufx_usb_disconnect() function, which may eventually result in UAF. So, add a mutex to the ufx_ops_open() and ufx_usb_disconnect() functions to avoid race contidion of krefs. Signed-off-by: Hyunwoo Kim Cc: stable@vger.kernel.org Signed-off-by: Helge Deller Signed-off-by: Greg Kroah-Hartman --- drivers/video/fbdev/smscufx.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) --- a/drivers/video/fbdev/smscufx.c +++ b/drivers/video/fbdev/smscufx.c @@ -140,6 +140,8 @@ static int ufx_submit_urb(struct ufx_dat static int ufx_alloc_urb_list(struct ufx_data *dev, int count, size_t size); static void ufx_free_urb_list(struct ufx_data *dev); +static DEFINE_MUTEX(disconnect_mutex); + /* reads a control register */ static int ufx_reg_read(struct ufx_data *dev, u32 index, u32 *data) { @@ -1073,9 +1075,13 @@ static int ufx_ops_open(struct fb_info * if (user == 0 && !console) return -EBUSY; + mutex_lock(&disconnect_mutex); + /* If the USB device is gone, we don't accept new opens */ - if (dev->virtualized) + if (dev->virtualized) { + mutex_unlock(&disconnect_mutex); return -ENODEV; + } dev->fb_count++; @@ -1100,6 +1106,8 @@ static int ufx_ops_open(struct fb_info * pr_debug("open /dev/fb%d user=%d fb_info=%p count=%d", info->node, user, info, dev->fb_count); + mutex_unlock(&disconnect_mutex); + return 0; } @@ -1762,6 +1770,8 @@ static void ufx_usb_disconnect(struct us { struct ufx_data *dev; + mutex_lock(&disconnect_mutex); + dev = usb_get_intfdata(interface); pr_debug("USB disconnect starting\n"); @@ -1782,6 +1792,8 @@ static void ufx_usb_disconnect(struct us kref_put(&dev->kref, ufx_free); /* consider ufx_data freed */ + + mutex_unlock(&disconnect_mutex); } static struct usb_driver ufx_driver = { From patchwork Mon Oct 24 11:29:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8706 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422953wru; Mon, 24 Oct 2022 05:23:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6XRXVuNvXEnLMdZz44ic2JS3Hqvd1DTOch9h9oNrUWv1wQqtt1gSC66VgPosae7Lwf7bk2 X-Received: by 2002:a17:907:a425:b0:78d:b3ce:1e43 with SMTP id sg37-20020a170907a42500b0078db3ce1e43mr26948263ejc.95.1666614222763; Mon, 24 Oct 2022 05:23:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614222; cv=none; d=google.com; s=arc-20160816; b=fqeVVDISxq0kYy/HOMs6EbWHXDexhK6+kI3tMnHucPX4WdW555j0nx17iPIKPGvZx8 QFOmYKZsE1eIQOITgBJRo+283Wxv38noT727JV8xrTyiboDS4me7HYcOqMzU+uGRcKyj pAebIsFtYav7HKnYvOgeLwD4xWpogLYzgdL4CGcMqSU+FRIPFndUaOwHo9VvOm5imJcX KCK2t8ValiFwBgtEpaX98mYgqSQ2fo+vPw3m99wl/eJs2TwpCvG6KFIwjlreZ5RznsML naQYpiRpaIsxEtaZeg8+GFRp1xSM99Jat4rQt1GGiUOQqt/ivp6b7YNeMMc1o3tCGmpd frtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wiBsbzYX83WP9AE5nSjuz6/q7OEivkPR/55sQvr2Jw8=; b=E8149qtsCJ3jISKdxwHjxikOxCXxoq1HaYBorrDErEnB+M54ml2Eduqg7laxrowPBw 7KKGaC7iXvekucIyk5J52croIW4a6SCzOM6B0wVhNuLLxlDY8kYMxw4wr1kLKuO4Hpon pxzYG8MjYfsQS2+uXrLwTsh9i+gs2BnjwOG3Fp76AGDHkHRaQyCfNvOElQMpwUMHLttj EglEXGk8CLHoZ+9Efhnkf14By7NpIUhCFw7bYWtiqoa0uUS2FNwmipGxmLzLEqmaS0r1 ERtDcGH9TtFARfj/+Voe60i3oUIGFr1THOw/C+bjqqbCi216g6effIvAEYgYuYdQm8K3 0pBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AvNa7M+4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u8-20020a056402064800b00458cdba7a90si23441521edx.471.2022.10.24.05.23.19; Mon, 24 Oct 2022 05:23:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AvNa7M+4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233500AbiJXMWc (ORCPT + 99 others); Mon, 24 Oct 2022 08:22:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233608AbiJXMT4 (ORCPT ); Mon, 24 Oct 2022 08:19:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D2B583234; Mon, 24 Oct 2022 04:58:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CE1746128E; Mon, 24 Oct 2022 11:49:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2775C433C1; Mon, 24 Oct 2022 11:49:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612197; bh=62cxHPxacIeJObyCUvpGDXSutCGffzA9SR9xi6Ab0Pw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AvNa7M+45r94/B8gJ/AJk2db0EjEySjTY59BaWfkC4mp2RQRguRq62IMwPNK4vp9y jJogRK6fM4+myxMEPMv+ilR7+AmFAz5tPbgwJ6OhLKeNAtNgzRm3NpfCD7smdef85D wBawKM+P6fCocKAACk24ieBXWG2u7b8o9SGs54lw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ryusuke Konishi , syzbot+b8c672b0e22615c80fe0@syzkaller.appspotmail.com, Khalid Masum , Andrew Morton Subject: [PATCH 4.14 065/210] nilfs2: fix use-after-free bug of struct nilfs_root Date: Mon, 24 Oct 2022 13:29:42 +0200 Message-Id: <20221024112959.153644357@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571674814943208?= X-GMAIL-MSGID: =?utf-8?q?1747571674814943208?= From: Ryusuke Konishi commit d325dc6eb763c10f591c239550b8c7e5466a5d09 upstream. If the beginning of the inode bitmap area is corrupted on disk, an inode with the same inode number as the root inode can be allocated and fail soon after. In this case, the subsequent call to nilfs_clear_inode() on that bogus root inode will wrongly decrement the reference counter of struct nilfs_root, and this will erroneously free struct nilfs_root, causing kernel oopses. This fixes the problem by changing nilfs_new_inode() to skip reserved inode numbers while repairing the inode bitmap. Link: https://lkml.kernel.org/r/20221003150519.39789-1-konishi.ryusuke@gmail.com Signed-off-by: Ryusuke Konishi Reported-by: syzbot+b8c672b0e22615c80fe0@syzkaller.appspotmail.com Reported-by: Khalid Masum Tested-by: Ryusuke Konishi Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- fs/nilfs2/inode.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c @@ -344,6 +344,7 @@ struct inode *nilfs_new_inode(struct ino struct inode *inode; struct nilfs_inode_info *ii; struct nilfs_root *root; + struct buffer_head *bh; int err = -ENOMEM; ino_t ino; @@ -359,11 +360,26 @@ struct inode *nilfs_new_inode(struct ino ii->i_state = BIT(NILFS_I_NEW); ii->i_root = root; - err = nilfs_ifile_create_inode(root->ifile, &ino, &ii->i_bh); + err = nilfs_ifile_create_inode(root->ifile, &ino, &bh); if (unlikely(err)) goto failed_ifile_create_inode; /* reference count of i_bh inherits from nilfs_mdt_read_block() */ + if (unlikely(ino < NILFS_USER_INO)) { + nilfs_msg(sb, KERN_WARNING, + "inode bitmap is inconsistent for reserved inodes"); + do { + brelse(bh); + err = nilfs_ifile_create_inode(root->ifile, &ino, &bh); + if (unlikely(err)) + goto failed_ifile_create_inode; + } while (ino < NILFS_USER_INO); + + nilfs_msg(sb, KERN_INFO, + "repaired inode bitmap for reserved inodes"); + } + ii->i_bh = bh; + atomic64_inc(&root->inodes_count); inode_init_owner(inode, dir, mode); inode->i_ino = ino; From patchwork Mon Oct 24 11:29:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8632 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp420758wru; Mon, 24 Oct 2022 05:18:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5wcu/cnihQ5Cif+bXDdBzZVXq1YknIoa2etzDxUWI3jeQSARXuLULsfpBTKAmAsvXJuVhR X-Received: by 2002:a17:907:9713:b0:78d:8e23:892c with SMTP id jg19-20020a170907971300b0078d8e23892cmr27036345ejc.449.1666613930323; Mon, 24 Oct 2022 05:18:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613930; cv=none; d=google.com; s=arc-20160816; b=kzJCUrAuxUm+AjNFlEFZ1tO+WoodVzB2kLy9e67ch1GVnj7ODtZDMO6c3mrndJuIj9 aHb1etAKSm43uKVajJrxRi3azoYBL/l7RT6VVNZee9gB7QTd0xU4yqubeKwaKA7Tsz6o kpm9W1WqA3f7RDZ2xvkSoGwCkSkTBPENmDK9tXkdwM4et4vnmzu/nHFdnfjvllY1X56b zp8gc50UI5zp+4T3IryvF5OQdfyqJngZ2J42fD1gqefW86QtkgzfgJXTp5T3TwZgdjGz PZvZGZ6puW7kiqZJmPQKC0Zrosa7Kf08P/oAtRSq2Xg4Skzh5YS9BMq1dLqDPGRatvNg dKKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PJ4P6jLruixRZ+M7lPjZpGKkbDGNK7slN+8t4YXgHdk=; b=MhfqPooqfDSsoxQETDSDMNPrNE4VT/r9HwUASXSjTqOsZiugf//3063vdziREIQxJk oIfVV0aJHapRqm9aX7dyimEYsybHqCUdRif2N2vHjan/Y6ISFv3SnLyUmW2cERW/X+L1 DTVmeRVeUd2eFycWyTd+/tM3bxdd/BiGJVl6VilLzcUTr9fWivj+v42W73oRWNUttRrZ uhTcBw7sgSzoB0ZxbBB8LZOlh0/8qQ/E37DDFBPye1ICfNJXuzUzo7xFNChTq4/cxO8p Hu/QASVsbEE1BHInfvpOXB2yjUM8fe7DkMPsVt8Y0S6wJzxfjF1avxUdeBAteGElMxTz NkCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UZC87AI6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sg10-20020a170907a40a00b0079b40c09982si9204664ejc.340.2022.10.24.05.18.25; Mon, 24 Oct 2022 05:18:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UZC87AI6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232791AbiJXMIN (ORCPT + 99 others); Mon, 24 Oct 2022 08:08:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232587AbiJXMFo (ORCPT ); Mon, 24 Oct 2022 08:05:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 776137DF75; Mon, 24 Oct 2022 04:51:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 437BF61291; Mon, 24 Oct 2022 11:48:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31120C433D6; Mon, 24 Oct 2022 11:48:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612109; bh=LQaxVBDL6FYhY7IHHzT1f/OMwx8bPO/p+TWwPhEje5Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UZC87AI6KbF5a4KXDy/TQNhhIf9Lfx2z8ItRIeWZx1Woe/n6RS9UaQIkgNjd6tMFF 6OnfKu3gGrbaKjYy2GlQjSGzN/PZPsJt5ai2XHRe6ZeTqP3VDP3PT8phYWmkoNSN6R Bz7drFC2T4j5NioCUUo2dj1EYEC4py7eL1xNAEs8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ryusuke Konishi , syzbot+0d5b462a6f07447991b3@syzkaller.appspotmail.com, syzbot+34ef28bb2aeb28724aa0@syzkaller.appspotmail.com, Hao Sun , David Hildenbrand , Matthew Wilcox , Andrew Morton , Linus Torvalds Subject: [PATCH 4.14 066/210] nilfs2: fix lockdep warnings in page operations for btree nodes Date: Mon, 24 Oct 2022 13:29:43 +0200 Message-Id: <20221024112959.192988322@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571368286233558?= X-GMAIL-MSGID: =?utf-8?q?1747571368286233558?= From: Ryusuke Konishi commit e897be17a441fa637cd166fc3de1445131e57692 upstream. Patch series "nilfs2 lockdep warning fixes". The first two are to resolve the lockdep warning issue, and the last one is the accompanying cleanup and low priority. Based on your comment, this series solves the issue by separating inode object as needed. Since I was worried about the impact of the object composition changes, I tested the series carefully not to cause regressions especially for delicate functions such like disk space reclamation and snapshots. This patch (of 3): If CONFIG_LOCKDEP is enabled, nilfs2 hits lockdep warnings at inode_to_wb() during page/folio operations for btree nodes: WARNING: CPU: 0 PID: 6575 at include/linux/backing-dev.h:269 inode_to_wb include/linux/backing-dev.h:269 [inline] WARNING: CPU: 0 PID: 6575 at include/linux/backing-dev.h:269 folio_account_dirtied mm/page-writeback.c:2460 [inline] WARNING: CPU: 0 PID: 6575 at include/linux/backing-dev.h:269 __folio_mark_dirty+0xa7c/0xe30 mm/page-writeback.c:2509 Modules linked in: ... RIP: 0010:inode_to_wb include/linux/backing-dev.h:269 [inline] RIP: 0010:folio_account_dirtied mm/page-writeback.c:2460 [inline] RIP: 0010:__folio_mark_dirty+0xa7c/0xe30 mm/page-writeback.c:2509 ... Call Trace: __set_page_dirty include/linux/pagemap.h:834 [inline] mark_buffer_dirty+0x4e6/0x650 fs/buffer.c:1145 nilfs_btree_propagate_p fs/nilfs2/btree.c:1889 [inline] nilfs_btree_propagate+0x4ae/0xea0 fs/nilfs2/btree.c:2085 nilfs_bmap_propagate+0x73/0x170 fs/nilfs2/bmap.c:337 nilfs_collect_dat_data+0x45/0xd0 fs/nilfs2/segment.c:625 nilfs_segctor_apply_buffers+0x14a/0x470 fs/nilfs2/segment.c:1009 nilfs_segctor_scan_file+0x47a/0x700 fs/nilfs2/segment.c:1048 nilfs_segctor_collect_blocks fs/nilfs2/segment.c:1224 [inline] nilfs_segctor_collect fs/nilfs2/segment.c:1494 [inline] nilfs_segctor_do_construct+0x14f3/0x6c60 fs/nilfs2/segment.c:2036 nilfs_segctor_construct+0x7a7/0xb30 fs/nilfs2/segment.c:2372 nilfs_segctor_thread_construct fs/nilfs2/segment.c:2480 [inline] nilfs_segctor_thread+0x3c3/0xf90 fs/nilfs2/segment.c:2563 kthread+0x405/0x4f0 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 This is because nilfs2 uses two page caches for each inode and inode->i_mapping never points to one of them, the btree node cache. This causes inode_to_wb(inode) to refer to a different page cache than the caller page/folio operations such like __folio_start_writeback(), __folio_end_writeback(), or __folio_mark_dirty() acquired the lock. This patch resolves the issue by allocating and using an additional inode to hold the page cache of btree nodes. The inode is attached one-to-one to the traditional nilfs2 inode if it requires a block mapping with b-tree. This setup change is in memory only and does not affect the disk format. Link: https://lkml.kernel.org/r/1647867427-30498-1-git-send-email-konishi.ryusuke@gmail.com Link: https://lkml.kernel.org/r/1647867427-30498-2-git-send-email-konishi.ryusuke@gmail.com Link: https://lore.kernel.org/r/YXrYvIo8YRnAOJCj@casper.infradead.org Link: https://lore.kernel.org/r/9a20b33d-b38f-b4a2-4742-c1eb5b8e4d6c@redhat.com Signed-off-by: Ryusuke Konishi Reported-by: syzbot+0d5b462a6f07447991b3@syzkaller.appspotmail.com Reported-by: syzbot+34ef28bb2aeb28724aa0@syzkaller.appspotmail.com Reported-by: Hao Sun Reported-by: David Hildenbrand Tested-by: Ryusuke Konishi Cc: Matthew Wilcox Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- fs/nilfs2/btnode.c | 23 ++++++++++- fs/nilfs2/btnode.h | 1 fs/nilfs2/btree.c | 27 +++++++++---- fs/nilfs2/gcinode.c | 7 ++- fs/nilfs2/inode.c | 104 +++++++++++++++++++++++++++++++++++++++++++++------- fs/nilfs2/mdt.c | 7 ++- fs/nilfs2/nilfs.h | 14 ++----- fs/nilfs2/page.c | 7 +-- fs/nilfs2/segment.c | 11 +++-- fs/nilfs2/super.c | 5 +- 10 files changed, 155 insertions(+), 51 deletions(-) --- a/fs/nilfs2/btnode.c +++ b/fs/nilfs2/btnode.c @@ -29,6 +29,23 @@ #include "page.h" #include "btnode.h" + +/** + * nilfs_init_btnc_inode - initialize B-tree node cache inode + * @btnc_inode: inode to be initialized + * + * nilfs_init_btnc_inode() sets up an inode for B-tree node cache. + */ +void nilfs_init_btnc_inode(struct inode *btnc_inode) +{ + struct nilfs_inode_info *ii = NILFS_I(btnc_inode); + + btnc_inode->i_mode = S_IFREG; + ii->i_flags = 0; + memset(&ii->i_bmap_data, 0, sizeof(struct nilfs_bmap)); + mapping_set_gfp_mask(btnc_inode->i_mapping, GFP_NOFS); +} + void nilfs_btnode_cache_clear(struct address_space *btnc) { invalidate_mapping_pages(btnc, 0, -1); @@ -38,7 +55,7 @@ void nilfs_btnode_cache_clear(struct add struct buffer_head * nilfs_btnode_create_block(struct address_space *btnc, __u64 blocknr) { - struct inode *inode = NILFS_BTNC_I(btnc); + struct inode *inode = btnc->host; struct buffer_head *bh; bh = nilfs_grab_buffer(inode, btnc, blocknr, BIT(BH_NILFS_Node)); @@ -66,7 +83,7 @@ int nilfs_btnode_submit_block(struct add struct buffer_head **pbh, sector_t *submit_ptr) { struct buffer_head *bh; - struct inode *inode = NILFS_BTNC_I(btnc); + struct inode *inode = btnc->host; struct page *page; int err; @@ -166,7 +183,7 @@ int nilfs_btnode_prepare_change_key(stru struct nilfs_btnode_chkey_ctxt *ctxt) { struct buffer_head *obh, *nbh; - struct inode *inode = NILFS_BTNC_I(btnc); + struct inode *inode = btnc->host; __u64 oldkey = ctxt->oldkey, newkey = ctxt->newkey; int err; --- a/fs/nilfs2/btnode.h +++ b/fs/nilfs2/btnode.h @@ -39,6 +39,7 @@ struct nilfs_btnode_chkey_ctxt { struct buffer_head *newbh; }; +void nilfs_init_btnc_inode(struct inode *btnc_inode); void nilfs_btnode_cache_clear(struct address_space *); struct buffer_head *nilfs_btnode_create_block(struct address_space *btnc, __u64 blocknr); --- a/fs/nilfs2/btree.c +++ b/fs/nilfs2/btree.c @@ -67,7 +67,8 @@ static void nilfs_btree_free_path(struct static int nilfs_btree_get_new_block(const struct nilfs_bmap *btree, __u64 ptr, struct buffer_head **bhp) { - struct address_space *btnc = &NILFS_BMAP_I(btree)->i_btnode_cache; + struct inode *btnc_inode = NILFS_BMAP_I(btree)->i_assoc_inode; + struct address_space *btnc = btnc_inode->i_mapping; struct buffer_head *bh; bh = nilfs_btnode_create_block(btnc, ptr); @@ -479,7 +480,8 @@ static int __nilfs_btree_get_block(const struct buffer_head **bhp, const struct nilfs_btree_readahead_info *ra) { - struct address_space *btnc = &NILFS_BMAP_I(btree)->i_btnode_cache; + struct inode *btnc_inode = NILFS_BMAP_I(btree)->i_assoc_inode; + struct address_space *btnc = btnc_inode->i_mapping; struct buffer_head *bh, *ra_bh; sector_t submit_ptr = 0; int ret; @@ -1751,6 +1753,10 @@ nilfs_btree_prepare_convert_and_insert(s dat = nilfs_bmap_get_dat(btree); } + ret = nilfs_attach_btree_node_cache(&NILFS_BMAP_I(btree)->vfs_inode); + if (ret < 0) + return ret; + ret = nilfs_bmap_prepare_alloc_ptr(btree, dreq, dat); if (ret < 0) return ret; @@ -1923,7 +1929,7 @@ static int nilfs_btree_prepare_update_v( path[level].bp_ctxt.newkey = path[level].bp_newreq.bpr_ptr; path[level].bp_ctxt.bh = path[level].bp_bh; ret = nilfs_btnode_prepare_change_key( - &NILFS_BMAP_I(btree)->i_btnode_cache, + NILFS_BMAP_I(btree)->i_assoc_inode->i_mapping, &path[level].bp_ctxt); if (ret < 0) { nilfs_dat_abort_update(dat, @@ -1949,7 +1955,7 @@ static void nilfs_btree_commit_update_v( if (buffer_nilfs_node(path[level].bp_bh)) { nilfs_btnode_commit_change_key( - &NILFS_BMAP_I(btree)->i_btnode_cache, + NILFS_BMAP_I(btree)->i_assoc_inode->i_mapping, &path[level].bp_ctxt); path[level].bp_bh = path[level].bp_ctxt.bh; } @@ -1968,7 +1974,7 @@ static void nilfs_btree_abort_update_v(s &path[level].bp_newreq.bpr_req); if (buffer_nilfs_node(path[level].bp_bh)) nilfs_btnode_abort_change_key( - &NILFS_BMAP_I(btree)->i_btnode_cache, + NILFS_BMAP_I(btree)->i_assoc_inode->i_mapping, &path[level].bp_ctxt); } @@ -2144,7 +2150,8 @@ static void nilfs_btree_add_dirty_buffer static void nilfs_btree_lookup_dirty_buffers(struct nilfs_bmap *btree, struct list_head *listp) { - struct address_space *btcache = &NILFS_BMAP_I(btree)->i_btnode_cache; + struct inode *btnc_inode = NILFS_BMAP_I(btree)->i_assoc_inode; + struct address_space *btcache = btnc_inode->i_mapping; struct list_head lists[NILFS_BTREE_LEVEL_MAX]; struct pagevec pvec; struct buffer_head *bh, *head; @@ -2198,12 +2205,12 @@ static int nilfs_btree_assign_p(struct n path[level].bp_ctxt.newkey = blocknr; path[level].bp_ctxt.bh = *bh; ret = nilfs_btnode_prepare_change_key( - &NILFS_BMAP_I(btree)->i_btnode_cache, + NILFS_BMAP_I(btree)->i_assoc_inode->i_mapping, &path[level].bp_ctxt); if (ret < 0) return ret; nilfs_btnode_commit_change_key( - &NILFS_BMAP_I(btree)->i_btnode_cache, + NILFS_BMAP_I(btree)->i_assoc_inode->i_mapping, &path[level].bp_ctxt); *bh = path[level].bp_ctxt.bh; } @@ -2408,6 +2415,10 @@ int nilfs_btree_init(struct nilfs_bmap * if (nilfs_btree_root_broken(nilfs_btree_get_root(bmap), bmap->b_inode)) ret = -EIO; + else + ret = nilfs_attach_btree_node_cache( + &NILFS_BMAP_I(bmap)->vfs_inode); + return ret; } --- a/fs/nilfs2/gcinode.c +++ b/fs/nilfs2/gcinode.c @@ -135,9 +135,10 @@ int nilfs_gccache_submit_read_data(struc int nilfs_gccache_submit_read_node(struct inode *inode, sector_t pbn, __u64 vbn, struct buffer_head **out_bh) { + struct inode *btnc_inode = NILFS_I(inode)->i_assoc_inode; int ret; - ret = nilfs_btnode_submit_block(&NILFS_I(inode)->i_btnode_cache, + ret = nilfs_btnode_submit_block(btnc_inode->i_mapping, vbn ? : pbn, pbn, REQ_OP_READ, 0, out_bh, &pbn); if (ret == -EEXIST) /* internal code (cache hit) */ @@ -179,7 +180,7 @@ int nilfs_init_gcinode(struct inode *ino ii->i_flags = 0; nilfs_bmap_init_gc(ii->i_bmap); - return 0; + return nilfs_attach_btree_node_cache(inode); } /** @@ -194,7 +195,7 @@ void nilfs_remove_all_gcinodes(struct th ii = list_first_entry(head, struct nilfs_inode_info, i_dirty); list_del_init(&ii->i_dirty); truncate_inode_pages(&ii->vfs_inode.i_data, 0); - nilfs_btnode_cache_clear(&ii->i_btnode_cache); + nilfs_btnode_cache_clear(ii->i_assoc_inode->i_mapping); iput(&ii->vfs_inode); } } --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c @@ -37,12 +37,14 @@ * @cno: checkpoint number * @root: pointer on NILFS root object (mounted checkpoint) * @for_gc: inode for GC flag + * @for_btnc: inode for B-tree node cache flag */ struct nilfs_iget_args { u64 ino; __u64 cno; struct nilfs_root *root; - int for_gc; + bool for_gc; + bool for_btnc; }; static int nilfs_iget_test(struct inode *inode, void *opaque); @@ -331,7 +333,8 @@ static int nilfs_insert_inode_locked(str unsigned long ino) { struct nilfs_iget_args args = { - .ino = ino, .root = root, .cno = 0, .for_gc = 0 + .ino = ino, .root = root, .cno = 0, .for_gc = false, + .for_btnc = false }; return insert_inode_locked4(inode, ino, nilfs_iget_test, &args); @@ -561,6 +564,13 @@ static int nilfs_iget_test(struct inode return 0; ii = NILFS_I(inode); + if (test_bit(NILFS_I_BTNC, &ii->i_state)) { + if (!args->for_btnc) + return 0; + } else if (args->for_btnc) { + return 0; + } + if (!test_bit(NILFS_I_GCINODE, &ii->i_state)) return !args->for_gc; @@ -572,15 +582,15 @@ static int nilfs_iget_set(struct inode * struct nilfs_iget_args *args = opaque; inode->i_ino = args->ino; - if (args->for_gc) { + NILFS_I(inode)->i_cno = args->cno; + NILFS_I(inode)->i_root = args->root; + if (args->root && args->ino == NILFS_ROOT_INO) + nilfs_get_root(args->root); + + if (args->for_gc) NILFS_I(inode)->i_state = BIT(NILFS_I_GCINODE); - NILFS_I(inode)->i_cno = args->cno; - NILFS_I(inode)->i_root = NULL; - } else { - if (args->root && args->ino == NILFS_ROOT_INO) - nilfs_get_root(args->root); - NILFS_I(inode)->i_root = args->root; - } + if (args->for_btnc) + NILFS_I(inode)->i_state |= BIT(NILFS_I_BTNC); return 0; } @@ -588,7 +598,8 @@ struct inode *nilfs_ilookup(struct super unsigned long ino) { struct nilfs_iget_args args = { - .ino = ino, .root = root, .cno = 0, .for_gc = 0 + .ino = ino, .root = root, .cno = 0, .for_gc = false, + .for_btnc = false }; return ilookup5(sb, ino, nilfs_iget_test, &args); @@ -598,7 +609,8 @@ struct inode *nilfs_iget_locked(struct s unsigned long ino) { struct nilfs_iget_args args = { - .ino = ino, .root = root, .cno = 0, .for_gc = 0 + .ino = ino, .root = root, .cno = 0, .for_gc = false, + .for_btnc = false }; return iget5_locked(sb, ino, nilfs_iget_test, nilfs_iget_set, &args); @@ -629,7 +641,8 @@ struct inode *nilfs_iget_for_gc(struct s __u64 cno) { struct nilfs_iget_args args = { - .ino = ino, .root = NULL, .cno = cno, .for_gc = 1 + .ino = ino, .root = NULL, .cno = cno, .for_gc = true, + .for_btnc = false }; struct inode *inode; int err; @@ -649,6 +662,68 @@ struct inode *nilfs_iget_for_gc(struct s return inode; } +/** + * nilfs_attach_btree_node_cache - attach a B-tree node cache to the inode + * @inode: inode object + * + * nilfs_attach_btree_node_cache() attaches a B-tree node cache to @inode, + * or does nothing if the inode already has it. This function allocates + * an additional inode to maintain page cache of B-tree nodes one-on-one. + * + * Return Value: On success, 0 is returned. On errors, one of the following + * negative error code is returned. + * + * %-ENOMEM - Insufficient memory available. + */ +int nilfs_attach_btree_node_cache(struct inode *inode) +{ + struct nilfs_inode_info *ii = NILFS_I(inode); + struct inode *btnc_inode; + struct nilfs_iget_args args; + + if (ii->i_assoc_inode) + return 0; + + args.ino = inode->i_ino; + args.root = ii->i_root; + args.cno = ii->i_cno; + args.for_gc = test_bit(NILFS_I_GCINODE, &ii->i_state) != 0; + args.for_btnc = true; + + btnc_inode = iget5_locked(inode->i_sb, inode->i_ino, nilfs_iget_test, + nilfs_iget_set, &args); + if (unlikely(!btnc_inode)) + return -ENOMEM; + if (btnc_inode->i_state & I_NEW) { + nilfs_init_btnc_inode(btnc_inode); + unlock_new_inode(btnc_inode); + } + NILFS_I(btnc_inode)->i_assoc_inode = inode; + NILFS_I(btnc_inode)->i_bmap = ii->i_bmap; + ii->i_assoc_inode = btnc_inode; + + return 0; +} + +/** + * nilfs_detach_btree_node_cache - detach the B-tree node cache from the inode + * @inode: inode object + * + * nilfs_detach_btree_node_cache() detaches the B-tree node cache and its + * holder inode bound to @inode, or does nothing if @inode doesn't have it. + */ +void nilfs_detach_btree_node_cache(struct inode *inode) +{ + struct nilfs_inode_info *ii = NILFS_I(inode); + struct inode *btnc_inode = ii->i_assoc_inode; + + if (btnc_inode) { + NILFS_I(btnc_inode)->i_assoc_inode = NULL; + ii->i_assoc_inode = NULL; + iput(btnc_inode); + } +} + void nilfs_write_inode_common(struct inode *inode, struct nilfs_inode *raw_inode, int has_bmap) { @@ -797,7 +872,8 @@ static void nilfs_clear_inode(struct ino if (test_bit(NILFS_I_BMAP, &ii->i_state)) nilfs_bmap_clear(ii->i_bmap); - nilfs_btnode_cache_clear(&ii->i_btnode_cache); + if (!test_bit(NILFS_I_BTNC, &ii->i_state)) + nilfs_detach_btree_node_cache(inode); if (ii->i_root && inode->i_ino == NILFS_ROOT_INO) nilfs_put_root(ii->i_root); --- a/fs/nilfs2/mdt.c +++ b/fs/nilfs2/mdt.c @@ -540,7 +540,7 @@ int nilfs_mdt_save_to_shadow_map(struct goto out; ret = nilfs_copy_dirty_pages(&shadow->frozen_btnodes, - &ii->i_btnode_cache); + ii->i_assoc_inode->i_mapping); if (ret) goto out; @@ -631,8 +631,9 @@ void nilfs_mdt_restore_from_shadow_map(s nilfs_clear_dirty_pages(inode->i_mapping, true); nilfs_copy_back_pages(inode->i_mapping, &shadow->frozen_data); - nilfs_clear_dirty_pages(&ii->i_btnode_cache, true); - nilfs_copy_back_pages(&ii->i_btnode_cache, &shadow->frozen_btnodes); + nilfs_clear_dirty_pages(ii->i_assoc_inode->i_mapping, true); + nilfs_copy_back_pages(ii->i_assoc_inode->i_mapping, + &shadow->frozen_btnodes); nilfs_bmap_restore(ii->i_bmap, &shadow->bmap_store); --- a/fs/nilfs2/nilfs.h +++ b/fs/nilfs2/nilfs.h @@ -37,7 +37,7 @@ * @i_xattr: * @i_dir_start_lookup: page index of last successful search * @i_cno: checkpoint number for GC inode - * @i_btnode_cache: cached pages of b-tree nodes + * @i_assoc_inode: associated inode (B-tree node cache holder or back pointer) * @i_dirty: list for connecting dirty files * @xattr_sem: semaphore for extended attributes processing * @i_bh: buffer contains disk inode @@ -52,7 +52,7 @@ struct nilfs_inode_info { __u64 i_xattr; /* sector_t ??? */ __u32 i_dir_start_lookup; __u64 i_cno; /* check point number for GC inode */ - struct address_space i_btnode_cache; + struct inode *i_assoc_inode; struct list_head i_dirty; /* List for connecting dirty files */ #ifdef CONFIG_NILFS_XATTR @@ -84,13 +84,6 @@ NILFS_BMAP_I(const struct nilfs_bmap *bm return container_of(bmap, struct nilfs_inode_info, i_bmap_data); } -static inline struct inode *NILFS_BTNC_I(struct address_space *btnc) -{ - struct nilfs_inode_info *ii = - container_of(btnc, struct nilfs_inode_info, i_btnode_cache); - return &ii->vfs_inode; -} - /* * Dynamic state flags of NILFS on-memory inode (i_state) */ @@ -107,6 +100,7 @@ enum { NILFS_I_INODE_SYNC, /* dsync is not allowed for inode */ NILFS_I_BMAP, /* has bmap and btnode_cache */ NILFS_I_GCINODE, /* inode for GC, on memory only */ + NILFS_I_BTNC, /* inode for btree node cache */ }; /* @@ -277,6 +271,8 @@ struct inode *nilfs_iget(struct super_bl unsigned long ino); extern struct inode *nilfs_iget_for_gc(struct super_block *sb, unsigned long ino, __u64 cno); +int nilfs_attach_btree_node_cache(struct inode *inode); +void nilfs_detach_btree_node_cache(struct inode *inode); extern void nilfs_update_inode(struct inode *, struct buffer_head *, int); extern void nilfs_truncate(struct inode *); extern void nilfs_evict_inode(struct inode *); --- a/fs/nilfs2/page.c +++ b/fs/nilfs2/page.c @@ -462,10 +462,9 @@ void nilfs_mapping_init(struct address_s /* * NILFS2 needs clear_page_dirty() in the following two cases: * - * 1) For B-tree node pages and data pages of the dat/gcdat, NILFS2 clears - * page dirty flags when it copies back pages from the shadow cache - * (gcdat->{i_mapping,i_btnode_cache}) to its original cache - * (dat->{i_mapping,i_btnode_cache}). + * 1) For B-tree node pages and data pages of DAT file, NILFS2 clears dirty + * flag of pages when it copies back pages from shadow cache to the + * original cache. * * 2) Some B-tree operations like insertion or deletion may dispose buffers * in dirty state, and this needs to cancel the dirty state of their pages. --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c @@ -751,16 +751,19 @@ static void nilfs_lookup_dirty_node_buff struct list_head *listp) { struct nilfs_inode_info *ii = NILFS_I(inode); - struct address_space *mapping = &ii->i_btnode_cache; + struct inode *btnc_inode = ii->i_assoc_inode; struct pagevec pvec; struct buffer_head *bh, *head; unsigned int i; pgoff_t index = 0; + if (!btnc_inode) + return; + pagevec_init(&pvec, 0); - while (pagevec_lookup_tag(&pvec, mapping, &index, PAGECACHE_TAG_DIRTY, - PAGEVEC_SIZE)) { + while (pagevec_lookup_tag(&pvec, btnc_inode->i_mapping, &index, + PAGECACHE_TAG_DIRTY, PAGEVEC_SIZE)) { for (i = 0; i < pagevec_count(&pvec); i++) { bh = head = page_buffers(pvec.pages[i]); do { @@ -2429,7 +2432,7 @@ nilfs_remove_written_gcinodes(struct the continue; list_del_init(&ii->i_dirty); truncate_inode_pages(&ii->vfs_inode.i_data, 0); - nilfs_btnode_cache_clear(&ii->i_btnode_cache); + nilfs_btnode_cache_clear(ii->i_assoc_inode->i_mapping); iput(&ii->vfs_inode); } } --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c @@ -161,7 +161,8 @@ struct inode *nilfs_alloc_inode(struct s ii->i_state = 0; ii->i_cno = 0; ii->vfs_inode.i_version = 1; - nilfs_mapping_init(&ii->i_btnode_cache, &ii->vfs_inode); + ii->i_assoc_inode = NULL; + ii->i_bmap = &ii->i_bmap_data; return &ii->vfs_inode; } @@ -1392,8 +1393,6 @@ static void nilfs_inode_init_once(void * #ifdef CONFIG_NILFS_XATTR init_rwsem(&ii->xattr_sem); #endif - address_space_init_once(&ii->i_btnode_cache); - ii->i_bmap = &ii->i_bmap_data; inode_init_once(&ii->vfs_inode); } From patchwork Mon Oct 24 11:29:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10063 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp624037wru; Mon, 24 Oct 2022 12:49:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4jVMD3wxF3tiuOfkpEMd9kIVsFFtoCVgNoPXVkJUX4WG5z1euy/zuyVNVVZYo21iI/0Ytw X-Received: by 2002:a17:907:7213:b0:791:8aa5:5635 with SMTP id dr19-20020a170907721300b007918aa55635mr29814609ejc.348.1666640979435; Mon, 24 Oct 2022 12:49:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640979; cv=none; d=google.com; s=arc-20160816; b=GEQwYxQqibS6ARiAkMZlbvBH7tGakX5YjJR5yNNoiTXV4zcXKJOCKSVNTJ270Sn5Ob nIISIhghVXDOGQNbGJDDBJXSQ9Ls1Ny16JHXGeDSHp9AJu3PovDsws3V2OXC6qiXHxpt DdkmI+bU2BjNMRrJ92VMLQudkZsVzo8uFUm1phUGGn9IpRNpz231gDOBo5TBe5VNITUH DTeH5CLklP3LjpvxpKn5PqkU9MYiIzGLKK87ERJSAVDuZtQ54ktA4Uk27/JOHyGcbjrD qaWtWnYpXC6ZXxZuaoaHy35iSXS+uLnkLO6vy+DKJjzYHFYDZyfH4pqALnYkLli7cBcp X2Vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mCv75nrMpqijLTIy+iYSS5H7aLkK3tRB+aawVwM5RCM=; b=BujDGBRXGboPl6KfpgCW/zbg5NMIK1LpI4Wb54gEgR0vTrg+D+W5n/DQemmjRHz0l/ PuGFONUhCoSqpl9aTh6zb4AjJcgzyQIW0/f0TQBub7FwE6/WIxfkRoN6g0LWrgY0/Fwn 6wr3I8C8ORelUxrBDURBixPpPpv8XXoyr6/j/rruUjT+VMxtJ3tPDy5w7b4o4VH68hgL korOKliWL8ENe2B0oc7A5DEMaTAiyluE+pMeys+l677+8OvSmJ4HnpQMWbhRteeotqYE 0K+6SEbY5TIzSQ6x4k7J+mwFi+zDDn4DBFDz0VBCxfexiJSBZNu/Z1NUK6NSlJwYy3ZG rUCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="TzzG///r"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dt4-20020a170907728400b0078d5d4a6b64si661753ejc.662.2022.10.24.12.49.15; Mon, 24 Oct 2022 12:49:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="TzzG///r"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232346AbiJXTo5 (ORCPT + 99 others); Mon, 24 Oct 2022 15:44:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233422AbiJXTmO (ORCPT ); Mon, 24 Oct 2022 15:42:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C60AF3C8DC; Mon, 24 Oct 2022 11:11:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2CC2EB811AF; Mon, 24 Oct 2022 11:49:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 755B6C433C1; Mon, 24 Oct 2022 11:48:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612138; bh=NxgZ+UFijl6OL8pOEGlvJusFXy8NFC1qyy7SRIQqfrw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TzzG///rkzAeONTbr9lvj2Da0gkYTdqXep2mFS4CkiyfffFqPDPFPp6E3/aMVR5fH ZjecGCRebHJNLKVgkzP6KbfW8zhOtKVthg9e0aT31a5MDDSGmsZkZQW7xk2aNgQVre sZWl5tZ0xPIx/5Q/fhxkx7n8m4MbNBuCt3OcKWpc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ryusuke Konishi , Matthew Wilcox , David Hildenbrand , Hao Sun , Andrew Morton , Linus Torvalds Subject: [PATCH 4.14 067/210] nilfs2: fix lockdep warnings during disk space reclamation Date: Mon, 24 Oct 2022 13:29:44 +0200 Message-Id: <20221024112959.230524710@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747599731158229301?= X-GMAIL-MSGID: =?utf-8?q?1747599731158229301?= From: Ryusuke Konishi commit 6e211930f79aa45d422009a5f2e5467d2369ffe5 upstream. During disk space reclamation, nilfs2 still emits the following lockdep warning due to page/folio operations on shadowed page caches that nilfs2 uses to get a snapshot of DAT file in memory: WARNING: CPU: 0 PID: 2643 at include/linux/backing-dev.h:272 __folio_mark_dirty+0x645/0x670 ... RIP: 0010:__folio_mark_dirty+0x645/0x670 ... Call Trace: filemap_dirty_folio+0x74/0xd0 __set_page_dirty_nobuffers+0x85/0xb0 nilfs_copy_dirty_pages+0x288/0x510 [nilfs2] nilfs_mdt_save_to_shadow_map+0x50/0xe0 [nilfs2] nilfs_clean_segments+0xee/0x5d0 [nilfs2] nilfs_ioctl_clean_segments.isra.19+0xb08/0xf40 [nilfs2] nilfs_ioctl+0xc52/0xfb0 [nilfs2] __x64_sys_ioctl+0x11d/0x170 This fixes the remaining warning by using inode objects to hold those page caches. Link: https://lkml.kernel.org/r/1647867427-30498-3-git-send-email-konishi.ryusuke@gmail.com Signed-off-by: Ryusuke Konishi Tested-by: Ryusuke Konishi Cc: Matthew Wilcox Cc: David Hildenbrand Cc: Hao Sun Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- fs/nilfs2/dat.c | 4 ++- fs/nilfs2/inode.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++---- fs/nilfs2/mdt.c | 38 ++++++++++++++++++++++---------- fs/nilfs2/mdt.h | 6 +---- fs/nilfs2/nilfs.h | 2 + 5 files changed, 92 insertions(+), 21 deletions(-) --- a/fs/nilfs2/dat.c +++ b/fs/nilfs2/dat.c @@ -506,7 +506,9 @@ int nilfs_dat_read(struct super_block *s di = NILFS_DAT_I(dat); lockdep_set_class(&di->mi.mi_sem, &dat_lock_key); nilfs_palloc_setup_cache(dat, &di->palloc_cache); - nilfs_mdt_setup_shadow_map(dat, &di->shadow); + err = nilfs_mdt_setup_shadow_map(dat, &di->shadow); + if (err) + goto failed; err = nilfs_read_inode_common(dat, raw_inode); if (err) --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c @@ -38,6 +38,7 @@ * @root: pointer on NILFS root object (mounted checkpoint) * @for_gc: inode for GC flag * @for_btnc: inode for B-tree node cache flag + * @for_shadow: inode for shadowed page cache flag */ struct nilfs_iget_args { u64 ino; @@ -45,6 +46,7 @@ struct nilfs_iget_args { struct nilfs_root *root; bool for_gc; bool for_btnc; + bool for_shadow; }; static int nilfs_iget_test(struct inode *inode, void *opaque); @@ -334,7 +336,7 @@ static int nilfs_insert_inode_locked(str { struct nilfs_iget_args args = { .ino = ino, .root = root, .cno = 0, .for_gc = false, - .for_btnc = false + .for_btnc = false, .for_shadow = false }; return insert_inode_locked4(inode, ino, nilfs_iget_test, &args); @@ -570,6 +572,12 @@ static int nilfs_iget_test(struct inode } else if (args->for_btnc) { return 0; } + if (test_bit(NILFS_I_SHADOW, &ii->i_state)) { + if (!args->for_shadow) + return 0; + } else if (args->for_shadow) { + return 0; + } if (!test_bit(NILFS_I_GCINODE, &ii->i_state)) return !args->for_gc; @@ -591,6 +599,8 @@ static int nilfs_iget_set(struct inode * NILFS_I(inode)->i_state = BIT(NILFS_I_GCINODE); if (args->for_btnc) NILFS_I(inode)->i_state |= BIT(NILFS_I_BTNC); + if (args->for_shadow) + NILFS_I(inode)->i_state |= BIT(NILFS_I_SHADOW); return 0; } @@ -599,7 +609,7 @@ struct inode *nilfs_ilookup(struct super { struct nilfs_iget_args args = { .ino = ino, .root = root, .cno = 0, .for_gc = false, - .for_btnc = false + .for_btnc = false, .for_shadow = false }; return ilookup5(sb, ino, nilfs_iget_test, &args); @@ -610,7 +620,7 @@ struct inode *nilfs_iget_locked(struct s { struct nilfs_iget_args args = { .ino = ino, .root = root, .cno = 0, .for_gc = false, - .for_btnc = false + .for_btnc = false, .for_shadow = false }; return iget5_locked(sb, ino, nilfs_iget_test, nilfs_iget_set, &args); @@ -642,7 +652,7 @@ struct inode *nilfs_iget_for_gc(struct s { struct nilfs_iget_args args = { .ino = ino, .root = NULL, .cno = cno, .for_gc = true, - .for_btnc = false + .for_btnc = false, .for_shadow = false }; struct inode *inode; int err; @@ -689,6 +699,7 @@ int nilfs_attach_btree_node_cache(struct args.cno = ii->i_cno; args.for_gc = test_bit(NILFS_I_GCINODE, &ii->i_state) != 0; args.for_btnc = true; + args.for_shadow = test_bit(NILFS_I_SHADOW, &ii->i_state) != 0; btnc_inode = iget5_locked(inode->i_sb, inode->i_ino, nilfs_iget_test, nilfs_iget_set, &args); @@ -724,6 +735,50 @@ void nilfs_detach_btree_node_cache(struc } } +/** + * nilfs_iget_for_shadow - obtain inode for shadow mapping + * @inode: inode object that uses shadow mapping + * + * nilfs_iget_for_shadow() allocates a pair of inodes that holds page + * caches for shadow mapping. The page cache for data pages is set up + * in one inode and the one for b-tree node pages is set up in the + * other inode, which is attached to the former inode. + * + * Return Value: On success, a pointer to the inode for data pages is + * returned. On errors, one of the following negative error code is returned + * in a pointer type. + * + * %-ENOMEM - Insufficient memory available. + */ +struct inode *nilfs_iget_for_shadow(struct inode *inode) +{ + struct nilfs_iget_args args = { + .ino = inode->i_ino, .root = NULL, .cno = 0, .for_gc = false, + .for_btnc = false, .for_shadow = true + }; + struct inode *s_inode; + int err; + + s_inode = iget5_locked(inode->i_sb, inode->i_ino, nilfs_iget_test, + nilfs_iget_set, &args); + if (unlikely(!s_inode)) + return ERR_PTR(-ENOMEM); + if (!(s_inode->i_state & I_NEW)) + return inode; + + NILFS_I(s_inode)->i_flags = 0; + memset(NILFS_I(s_inode)->i_bmap, 0, sizeof(struct nilfs_bmap)); + mapping_set_gfp_mask(s_inode->i_mapping, GFP_NOFS); + + err = nilfs_attach_btree_node_cache(s_inode); + if (unlikely(err)) { + iget_failed(s_inode); + return ERR_PTR(err); + } + unlock_new_inode(s_inode); + return s_inode; +} + void nilfs_write_inode_common(struct inode *inode, struct nilfs_inode *raw_inode, int has_bmap) { --- a/fs/nilfs2/mdt.c +++ b/fs/nilfs2/mdt.c @@ -478,9 +478,18 @@ int nilfs_mdt_init(struct inode *inode, void nilfs_mdt_clear(struct inode *inode) { struct nilfs_mdt_info *mdi = NILFS_MDT(inode); + struct nilfs_shadow_map *shadow = mdi->mi_shadow; if (mdi->mi_palloc_cache) nilfs_palloc_destroy_cache(inode); + + if (shadow) { + struct inode *s_inode = shadow->inode; + + shadow->inode = NULL; + iput(s_inode); + mdi->mi_shadow = NULL; + } } /** @@ -514,12 +523,15 @@ int nilfs_mdt_setup_shadow_map(struct in struct nilfs_shadow_map *shadow) { struct nilfs_mdt_info *mi = NILFS_MDT(inode); + struct inode *s_inode; INIT_LIST_HEAD(&shadow->frozen_buffers); - address_space_init_once(&shadow->frozen_data); - nilfs_mapping_init(&shadow->frozen_data, inode); - address_space_init_once(&shadow->frozen_btnodes); - nilfs_mapping_init(&shadow->frozen_btnodes, inode); + + s_inode = nilfs_iget_for_shadow(inode); + if (IS_ERR(s_inode)) + return PTR_ERR(s_inode); + + shadow->inode = s_inode; mi->mi_shadow = shadow; return 0; } @@ -533,13 +545,14 @@ int nilfs_mdt_save_to_shadow_map(struct struct nilfs_mdt_info *mi = NILFS_MDT(inode); struct nilfs_inode_info *ii = NILFS_I(inode); struct nilfs_shadow_map *shadow = mi->mi_shadow; + struct inode *s_inode = shadow->inode; int ret; - ret = nilfs_copy_dirty_pages(&shadow->frozen_data, inode->i_mapping); + ret = nilfs_copy_dirty_pages(s_inode->i_mapping, inode->i_mapping); if (ret) goto out; - ret = nilfs_copy_dirty_pages(&shadow->frozen_btnodes, + ret = nilfs_copy_dirty_pages(NILFS_I(s_inode)->i_assoc_inode->i_mapping, ii->i_assoc_inode->i_mapping); if (ret) goto out; @@ -556,7 +569,7 @@ int nilfs_mdt_freeze_buffer(struct inode struct page *page; int blkbits = inode->i_blkbits; - page = grab_cache_page(&shadow->frozen_data, bh->b_page->index); + page = grab_cache_page(shadow->inode->i_mapping, bh->b_page->index); if (!page) return -ENOMEM; @@ -588,7 +601,7 @@ nilfs_mdt_get_frozen_buffer(struct inode struct page *page; int n; - page = find_lock_page(&shadow->frozen_data, bh->b_page->index); + page = find_lock_page(shadow->inode->i_mapping, bh->b_page->index); if (page) { if (page_has_buffers(page)) { n = bh_offset(bh) >> inode->i_blkbits; @@ -629,11 +642,11 @@ void nilfs_mdt_restore_from_shadow_map(s nilfs_palloc_clear_cache(inode); nilfs_clear_dirty_pages(inode->i_mapping, true); - nilfs_copy_back_pages(inode->i_mapping, &shadow->frozen_data); + nilfs_copy_back_pages(inode->i_mapping, shadow->inode->i_mapping); nilfs_clear_dirty_pages(ii->i_assoc_inode->i_mapping, true); nilfs_copy_back_pages(ii->i_assoc_inode->i_mapping, - &shadow->frozen_btnodes); + NILFS_I(shadow->inode)->i_assoc_inode->i_mapping); nilfs_bmap_restore(ii->i_bmap, &shadow->bmap_store); @@ -648,10 +661,11 @@ void nilfs_mdt_clear_shadow_map(struct i { struct nilfs_mdt_info *mi = NILFS_MDT(inode); struct nilfs_shadow_map *shadow = mi->mi_shadow; + struct inode *shadow_btnc_inode = NILFS_I(shadow->inode)->i_assoc_inode; down_write(&mi->mi_sem); nilfs_release_frozen_buffers(shadow); - truncate_inode_pages(&shadow->frozen_data, 0); - truncate_inode_pages(&shadow->frozen_btnodes, 0); + truncate_inode_pages(shadow->inode->i_mapping, 0); + truncate_inode_pages(shadow_btnc_inode->i_mapping, 0); up_write(&mi->mi_sem); } --- a/fs/nilfs2/mdt.h +++ b/fs/nilfs2/mdt.h @@ -27,14 +27,12 @@ /** * struct nilfs_shadow_map - shadow mapping of meta data file * @bmap_store: shadow copy of bmap state - * @frozen_data: shadowed dirty data pages - * @frozen_btnodes: shadowed dirty b-tree nodes' pages + * @inode: holder of page caches used in shadow mapping * @frozen_buffers: list of frozen buffers */ struct nilfs_shadow_map { struct nilfs_bmap_store bmap_store; - struct address_space frozen_data; - struct address_space frozen_btnodes; + struct inode *inode; struct list_head frozen_buffers; }; --- a/fs/nilfs2/nilfs.h +++ b/fs/nilfs2/nilfs.h @@ -101,6 +101,7 @@ enum { NILFS_I_BMAP, /* has bmap and btnode_cache */ NILFS_I_GCINODE, /* inode for GC, on memory only */ NILFS_I_BTNC, /* inode for btree node cache */ + NILFS_I_SHADOW, /* inode for shadowed page cache */ }; /* @@ -273,6 +274,7 @@ extern struct inode *nilfs_iget_for_gc(s unsigned long ino, __u64 cno); int nilfs_attach_btree_node_cache(struct inode *inode); void nilfs_detach_btree_node_cache(struct inode *inode); +struct inode *nilfs_iget_for_shadow(struct inode *inode); extern void nilfs_update_inode(struct inode *, struct buffer_head *, int); extern void nilfs_truncate(struct inode *); extern void nilfs_evict_inode(struct inode *); From patchwork Mon Oct 24 11:29:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8598 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419479wru; Mon, 24 Oct 2022 05:16:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7FmF9VLUjkCUTpvzbo8Y4BArpRTWtunF9SOC4DtAGfLp6VJX98pDCSezkY+P3BScmTr0wK X-Received: by 2002:a50:eb05:0:b0:457:c6f5:5f65 with SMTP id y5-20020a50eb05000000b00457c6f55f65mr29800851edp.311.1666613781982; Mon, 24 Oct 2022 05:16:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613781; cv=none; d=google.com; s=arc-20160816; b=P4V2biFN8Ugs0NT5Ug4SG7OYUk2ESzExJoY20f/EoBE4p02SpQUukPEx42JdGv7RLc blO3P1aF6PoECexJQ/m8WKZGI3uVP74BFQSFBoOmD7rpvMXE0sWWsKWyD20gx5wb4i9L 3NI1rsXwm+XVLWQm6S9iQANExXWxaVmD4/lS/r0KcsroiPeMqxiKFW+7u/wgoObbIRS7 /9cnFjawhMZT87kFdoIwlx9fxPKDGTsflPdKRTjpUt87za+OctBKm2eoo9XrVE/Cq0iQ OUUpmfimLm8+asvT6aKMFYu6E6RWMCFo0O/TptOUh5jlnyFhXD4ePHWC/UWqROJY1S6s t9QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=12KUCSBcr/iyD5t29KL9ux2tNnrQzhHGK8GdxJalo2g=; b=MXOEAIbSfgV4JSx/3nAFO2rzKb5msKtvVmIeqQCKwr67nq0tFCFcCx6wnNuEt9Hbd2 aPfW+EbOLfQmCTALTBGvcn7nbIPY+l9fVkjHAI/gKmPXR3HK8trYOb0nH2qNU6hPVW9f fO2WZ5bnF+Uinc0GE8uoKRmHkiQGTQ9prKwI1Qd386XNpVucUBXevPrp7xXYtzhTGk/t SNqFmb6JtTjaAeYG5yJFm/fD2hdlWv/R104vgyrTUGCb+7CYtmd5sXFGjfCNpB/FOHZL Yny+Fy6TlmvRZTD+V5HMh+Ub75TQ/bMwjPr7TcyvYq1ck5MHPqSnSEBLfk1HsafzP3eh +g0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ogUbeIKX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hq6-20020a1709073f0600b00787c0e9818csi32709120ejc.568.2022.10.24.05.15.55; Mon, 24 Oct 2022 05:16:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ogUbeIKX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232683AbiJXMGi (ORCPT + 99 others); Mon, 24 Oct 2022 08:06:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232859AbiJXME3 (ORCPT ); Mon, 24 Oct 2022 08:04:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EF6B1F60F; Mon, 24 Oct 2022 04:50:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BF199B81199; Mon, 24 Oct 2022 11:49:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22B0FC433D6; Mon, 24 Oct 2022 11:49:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612168; bh=1lz+gyBvGW+uPkiXCZxREp6jG4QKXOV8PFWgjLYk+QI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ogUbeIKXuZJMVVVyPRE2N8uqN72EfH2/rJP0YlfXSb9XqB+WVBd3ZEz6yBt6rfx6M 9tJn6ftc47LfQB+OwQkrf6ArDnL+2LnjAejuboEZ//VROKNFkBlydSLj3VBNKJR8eI 3DWUmWyF6P0hnCKjFTKc0OmVU1pn9nF/uLwh10F4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Tadeusz Struk , syzbot+bd13648a53ed6933ca49@syzkaller.appspotmail.com, Jan Kara , Lukas Czerner , Theodore Tso Subject: [PATCH 4.14 068/210] ext4: avoid crash when inline data creation follows DIO write Date: Mon, 24 Oct 2022 13:29:45 +0200 Message-Id: <20221024112959.261264220@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571212887443384?= X-GMAIL-MSGID: =?utf-8?q?1747571212887443384?= From: Jan Kara commit 4bb26f2885ac6930984ee451b952c5a6042f2c0e upstream. When inode is created and written to using direct IO, there is nothing to clear the EXT4_STATE_MAY_INLINE_DATA flag. Thus when inode gets truncated later to say 1 byte and written using normal write, we will try to store the data as inline data. This confuses the code later because the inode now has both normal block and inline data allocated and the confusion manifests for example as: kernel BUG at fs/ext4/inode.c:2721! invalid opcode: 0000 [#1] PREEMPT SMP KASAN CPU: 0 PID: 359 Comm: repro Not tainted 5.19.0-rc8-00001-g31ba1e3b8305-dirty #15 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.0-1.fc36 04/01/2014 RIP: 0010:ext4_writepages+0x363d/0x3660 RSP: 0018:ffffc90000ccf260 EFLAGS: 00010293 RAX: ffffffff81e1abcd RBX: 0000008000000000 RCX: ffff88810842a180 RDX: 0000000000000000 RSI: 0000008000000000 RDI: 0000000000000000 RBP: ffffc90000ccf650 R08: ffffffff81e17d58 R09: ffffed10222c680b R10: dfffe910222c680c R11: 1ffff110222c680a R12: ffff888111634128 R13: ffffc90000ccf880 R14: 0000008410000000 R15: 0000000000000001 FS: 00007f72635d2640(0000) GS:ffff88811b000000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000565243379180 CR3: 000000010aa74000 CR4: 0000000000150eb0 Call Trace: do_writepages+0x397/0x640 filemap_fdatawrite_wbc+0x151/0x1b0 file_write_and_wait_range+0x1c9/0x2b0 ext4_sync_file+0x19e/0xa00 vfs_fsync_range+0x17b/0x190 ext4_buffered_write_iter+0x488/0x530 ext4_file_write_iter+0x449/0x1b90 vfs_write+0xbcd/0xf40 ksys_write+0x198/0x2c0 __x64_sys_write+0x7b/0x90 do_syscall_64+0x3d/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd Fix the problem by clearing EXT4_STATE_MAY_INLINE_DATA when we are doing direct IO write to a file. Cc: stable@kernel.org Reported-by: Tadeusz Struk Reported-by: syzbot+bd13648a53ed6933ca49@syzkaller.appspotmail.com Link: https://syzkaller.appspot.com/bug?id=a1e89d09bbbcbd5c4cb45db230ee28c822953984 Signed-off-by: Jan Kara Reviewed-by: Lukas Czerner Tested-by: Tadeusz Struk Link: https://lore.kernel.org/r/20220727155753.13969-1-jack@suse.cz Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/file.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/fs/ext4/file.c +++ b/fs/ext4/file.c @@ -588,6 +588,12 @@ static loff_t ext4_seek_data(struct file inode_unlock(inode); return -ENXIO; } + /* + * Make sure inline data cannot be created anymore since we are going + * to allocate blocks for DIO. We know the inode does not have any + * inline data now because ext4_dio_supported() checked for that. + */ + ext4_clear_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA); blkbits = inode->i_sb->s_blocksize_bits; start = offset >> blkbits; From patchwork Mon Oct 24 11:29:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10121 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp633215wru; Mon, 24 Oct 2022 13:13:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6HoMiMFUwTgSQ/3tt8fhjuI/T3ckiNvBR30maEwKZU40D9HWp/A0tKxeCjjBheHtSlggd1 X-Received: by 2002:a17:902:b092:b0:17b:833e:74f7 with SMTP id p18-20020a170902b09200b0017b833e74f7mr34658905plr.149.1666642426653; Mon, 24 Oct 2022 13:13:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666642426; cv=none; d=google.com; s=arc-20160816; b=Cl5Vp/+PxftcZ+oZMeSs0qEN052UPcvJKgeZqc07Ml3Cn1PaCAHsGuzdWU9kZuQjru EVYGRd51DKjs51kVgG+OMJ+WZAYEW1MEqh792j+XdXe0OpVDudKvT3yzODP6NXMTdLzc NCpBev7R2WmP+jIMwRsz8YvxmIWyyxGItQZXBu22m4lwbyRYVmKwTOKPI739inHaoX4S va37awz7Db974K3yZLuGXKZQtyTpOh02MkqEhu3oG8eSwh5b9kD5vqxFBOn97IdqWF9t 4nVfq08wQZRBk80fLWo+Ps4x2Ys/xYqTU2iPyYOWcpo2TQ/rKBgcjCTIL2AfGzBsGHTi sDtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pYATm8vVwky0TKbzJPwm0ATIjYIV68nSbyqnIuG0Cp8=; b=x4v2wm2K+fdreTtnhWJG60hInyAalYNFdQdSx9ugtW3yC9HAKVifK+b+22TWw7sNQ9 +ecPZ9WLozJqMyeUiBJ2lwF7SjI3M1ke/1JZ9MgWDA121Fomz0s5FIbZrFTPywZfZHkF 19bBCl4xlrlC2WUqTDcHiaFAXDeHgFBFBYBOX5deyA788MR3E+O5p0XV0bb7wNbXEb7F r/MHoMmyCKtTdhBfiQmSMxwHFJg0JPEuItWP+qwBe9S21rnCZveU48m0VdCiJIzE7G4W kT3OrUOYZYkU+CTK2Nxip5ePluFj3EcYa3gNt0vhFGadjKg5XsmQvhLF5hMLJ6AmVrtH kD9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=R4Fl6gLK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y4-20020a170902ed4400b00176a116a20csi369438plb.567.2022.10.24.13.13.33; Mon, 24 Oct 2022 13:13:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=R4Fl6gLK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231178AbiJXUBS (ORCPT + 99 others); Mon, 24 Oct 2022 16:01:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234286AbiJXT7h (ORCPT ); Mon, 24 Oct 2022 15:59:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 896ED103273; Mon, 24 Oct 2022 11:22:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DEE6CB811AE; Mon, 24 Oct 2022 11:49:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 390E9C433C1; Mon, 24 Oct 2022 11:49:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612181; bh=eiIRWIwuYaAIX1wQZXkNK8DBAUTM4kPb6uvUgm1yFkk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R4Fl6gLKFBy88bE+9evStcOJecRSztNzsUqUwpM/phqcPgxVq4I+kSoZeXSGHUBan qv+mWGvjs43LTgjH7FnHDuO/vbVeW58ICh2Yizd56Iob/j6a4RQAot7AurYdCdr48j IPGnoZ/frk8nN1AYRf1yhUzceI2wbZ3WgrtCzUIw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Baokun Li , Jan Kara , Theodore Tso Subject: [PATCH 4.14 069/210] ext4: fix null-ptr-deref in ext4_write_info Date: Mon, 24 Oct 2022 13:29:46 +0200 Message-Id: <20221024112959.291852310@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747601249357759946?= X-GMAIL-MSGID: =?utf-8?q?1747601249357759946?= From: Baokun Li commit f9c1f248607d5546075d3f731e7607d5571f2b60 upstream. I caught a null-ptr-deref bug as follows: ================================================================== KASAN: null-ptr-deref in range [0x0000000000000068-0x000000000000006f] CPU: 1 PID: 1589 Comm: umount Not tainted 5.10.0-02219-dirty #339 RIP: 0010:ext4_write_info+0x53/0x1b0 [...] Call Trace: dquot_writeback_dquots+0x341/0x9a0 ext4_sync_fs+0x19e/0x800 __sync_filesystem+0x83/0x100 sync_filesystem+0x89/0xf0 generic_shutdown_super+0x79/0x3e0 kill_block_super+0xa1/0x110 deactivate_locked_super+0xac/0x130 deactivate_super+0xb6/0xd0 cleanup_mnt+0x289/0x400 __cleanup_mnt+0x16/0x20 task_work_run+0x11c/0x1c0 exit_to_user_mode_prepare+0x203/0x210 syscall_exit_to_user_mode+0x5b/0x3a0 do_syscall_64+0x59/0x70 entry_SYSCALL_64_after_hwframe+0x44/0xa9 ================================================================== Above issue may happen as follows: ------------------------------------- exit_to_user_mode_prepare task_work_run __cleanup_mnt cleanup_mnt deactivate_super deactivate_locked_super kill_block_super generic_shutdown_super shrink_dcache_for_umount dentry = sb->s_root sb->s_root = NULL <--- Here set NULL sync_filesystem __sync_filesystem sb->s_op->sync_fs > ext4_sync_fs dquot_writeback_dquots sb->dq_op->write_info > ext4_write_info ext4_journal_start(d_inode(sb->s_root), EXT4_HT_QUOTA, 2) d_inode(sb->s_root) s_root->d_inode <--- Null pointer dereference To solve this problem, we use ext4_journal_start_sb directly to avoid s_root being used. Cc: stable@kernel.org Signed-off-by: Baokun Li Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220805123947.565152-1-libaokun1@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -5601,7 +5601,7 @@ static int ext4_write_info(struct super_ handle_t *handle; /* Data block + inode block */ - handle = ext4_journal_start(d_inode(sb->s_root), EXT4_HT_QUOTA, 2); + handle = ext4_journal_start_sb(sb, EXT4_HT_QUOTA, 2); if (IS_ERR(handle)) return PTR_ERR(handle); ret = dquot_commit_info(sb, type); From patchwork Mon Oct 24 11:29:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8592 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419316wru; Mon, 24 Oct 2022 05:16:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6PLZ3Jt4/pZ6H2XAsAAGB9M2iuiNCSa7i8AVqYTNJoSTzPgfgJU+euhLsRbZD+f1+sGljv X-Received: by 2002:a17:902:ecd2:b0:186:907a:a008 with SMTP id a18-20020a170902ecd200b00186907aa008mr10853093plh.112.1666613765566; Mon, 24 Oct 2022 05:16:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613765; cv=none; d=google.com; s=arc-20160816; b=NqYihJ4DdgS3zx11WckrxQXyGxfFlisOmU3uoikryiXB0cZDmxsXYeeUs8hVIb1S7A MZE4PhITqdyWo8Mflvvdk49tiGP+hAMXVij+z6jTzNj8e5NyMqfOBtyP2EpWc1wL1LLo XyLMcJN7eeXr3R5KNqrcc5hToI9bUImdvAe2wrPvegKdshPY6rtWBwcqgFi1zeGxd4SY 438sXzkGgKxYbamQtZYfa/WAT5VunHCWxijCmOY/1IdF80c0QZewzwy8uG4MkwMyXeH9 sL6WzHUJ7r9kajpp1vGkyHrA/qaZVVDngDs+4XxWvCMWP4GaA/ggcWffwjhxEcsMhIft CEpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6l8W9BknssCYtsfH0x5+Qwl+hKxZPKsyyfHKEM30Svg=; b=IJK25NF2FbBaBfKJwrihiB/ph/CbuPBq5o6S1Gqo+0DiRdTgmK1+Ws1cSWbKm/uY6T e1E6soKSuU7hVshsNu5xKfBN9yxELgNewbmhhHFcJZSbx1TdKRvrfkWJyI3xv3Ycyw5S oxyNCiru8uM1gjdQia5mwt+42aC7BZSQEP/yoZGpNV1VeApRPbfkVwL6ru4c9Z5hjs+T e3UDSYBpHSGDD+rcmb2SHCMjiuI1ojShIgpMwNMWP32TukaWz+VmZFQ1yXNCko2L6PUh HMJxl1FQAG2HfI1a+euXCBYFba+Rq85FEVwvg4t5tSUHQKss/aZTK/PR9ZTNIUpIFrsM rz5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TyhXCPTa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c3-20020a170902d48300b00186a592183fsi4210050plg.365.2022.10.24.05.15.51; Mon, 24 Oct 2022 05:16:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TyhXCPTa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232515AbiJXMF3 (ORCPT + 99 others); Mon, 24 Oct 2022 08:05:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232559AbiJXMDD (ORCPT ); Mon, 24 Oct 2022 08:03:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E14423EB6; Mon, 24 Oct 2022 04:49:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B4A8061290; Mon, 24 Oct 2022 11:49:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C878BC433D7; Mon, 24 Oct 2022 11:49:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612184; bh=6r7DvksVj6Eagna1spU2oiIU7PrPMrYurWR9NshWROo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TyhXCPTahdQh4sVAiPDWXGzYoC7/8xYBLWAUVp+e/5zy1bZtvDI65kDxOn0kwt2KD ok6vhaC72UMQiWFvmnghf/SP9qcJTcmn4JknYmtt5E8fB+6J1Taww1a/i5zaf+RusX IBS1XZUgyeJ/FR7d4pNyWPxjRL8wevOPg05aqMp0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Lalith Rajendran , Theodore Tso Subject: [PATCH 4.14 070/210] ext4: make ext4_lazyinit_thread freezable Date: Mon, 24 Oct 2022 13:29:47 +0200 Message-Id: <20221024112959.332977521@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571195861138331?= X-GMAIL-MSGID: =?utf-8?q?1747571195861138331?= From: Lalith Rajendran commit 3b575495ab8dbb4dbe85b4ac7f991693c3668ff5 upstream. ext4_lazyinit_thread is not set freezable. Hence when the thread calls try_to_freeze it doesn't freeze during suspend and continues to send requests to the storage during suspend, resulting in suspend failures. Cc: stable@kernel.org Signed-off-by: Lalith Rajendran Link: https://lore.kernel.org/r/20220818214049.1519544-1-lalithkraj@google.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/super.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -3037,6 +3037,7 @@ static int ext4_lazyinit_thread(void *ar unsigned long next_wakeup, cur; BUG_ON(NULL == eli); + set_freezable(); cont_thread: while (true) { From patchwork Mon Oct 24 11:29:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8585 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419194wru; Mon, 24 Oct 2022 05:15:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6qj4+ydugSc1jNoAlqNcG17qK+DsD5X7uzJ2zhBK6RsvL/x+2q/s1GWg2AsqzZOdhq6qr1 X-Received: by 2002:a17:907:97c1:b0:791:98b8:9ab8 with SMTP id js1-20020a17090797c100b0079198b89ab8mr26396176ejc.425.1666613752527; Mon, 24 Oct 2022 05:15:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613752; cv=none; d=google.com; s=arc-20160816; b=Uo7l5b9+pn2Lkq9mHUZjUPnQaI2Vdv/oYmUaGEEiuDH0WbDG63n0BrJybbxbejugbu QZz8M1ep/c5aGgB6EV7zEIYMlee9vqRSG9+8C7f4oKfoL1o7MewpJsixDOIC8w4oQVgN 7a+skEGpFGprIBnWXp1QCkKk/bK3yHUZyvu/Dv33Fdd9Lfvr4LBqD2rhUfWRGcq2llSi w3qD9xEeQ7kewHAKiTAdQhh4dDENJjtQ/ewShA1qyTeKbxPYZt5n+RfT2chUrP01skPy Md0XKyVt4TbEPJ+YJChX6sJD4Wd6nMR9gB1UezvPG26GiDRk93UpTY1AO5gXaM92eeQM Pwew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4g+UCgAa4jDAMfNpZkbdRRbnc9I+ZBAsUS8coRv62xA=; b=bNJGp2HM3UO5Vm3AKnd+iYvZcgouXMblFWgwLuMKSBykuyh1FWBYsVz6vxOeHPUhFu M9f7WzCbMPllJ5GycDd1ncpkiUiz8iN4H9Fbbu9jUMfcra2Pxrz0n28lNR0QtGUJFDbz 3imjXg75R00xkiYvbdOmfV7JA1WP54JSD03tcvoa97Nr7tSB3bMp6t8fVAvfg00j6asa XDRvwtrmI112T37gHf+7SiDxNdTFjTiuam/WU9wGlA8t2+svq7G9uUsD+nS76Kg3zuLX zI3b9Rhbm51p8NhQjBC73LnbFT6eCDrQvDNNiObAEuovvRIN6+cYz06BheJ4bXC7hruJ 9LZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SD64py0F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o5-20020a509b05000000b00456dc5c7346si23336080edi.97.2022.10.24.05.15.27; Mon, 24 Oct 2022 05:15:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SD64py0F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232700AbiJXMGt (ORCPT + 99 others); Mon, 24 Oct 2022 08:06:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232909AbiJXMEh (ORCPT ); Mon, 24 Oct 2022 08:04:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC66263D0A; Mon, 24 Oct 2022 04:50:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 17638B811BD; Mon, 24 Oct 2022 11:49:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67101C433D6; Mon, 24 Oct 2022 11:49:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612186; bh=wPT73C7wz0wOnYYzNDbw2GNECMcxZOHB770mS52PGjY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SD64py0FAiV7HGu71D0Ebc1MqD9gvn7p1+xn4UN+LGOLzRcowRb/snb9EU3vE5bdK Fw5A4Ja0NWU8qtEYLQmA9iFcwjyGwPePYuceSY0lvX0uL34Ur+7dmym5ZdY6X6zA6t 4pYSrADCtEaVUobGI7Oo0gFOFnuNnquCmj75afNw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Jinke Han , Theodore Tso Subject: [PATCH 4.14 071/210] ext4: place buffer head allocation before handle start Date: Mon, 24 Oct 2022 13:29:48 +0200 Message-Id: <20221024112959.364329797@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571182138699846?= X-GMAIL-MSGID: =?utf-8?q?1747571182138699846?= From: Jinke Han commit d1052d236eddf6aa851434db1897b942e8db9921 upstream. In our product environment, we encounter some jbd hung waiting handles to stop while several writters were doing memory reclaim for buffer head allocation in delay alloc write path. Ext4 do buffer head allocation with holding transaction handle which may be blocked too long if the reclaim works not so smooth. According to our bcc trace, the reclaim time in buffer head allocation can reach 258s and the jbd transaction commit also take almost the same time meanwhile. Except for these extreme cases, we often see several seconds delays for cgroup memory reclaim on our servers. This is more likely to happen considering docker environment. One thing to note, the allocation of buffer heads is as often as page allocation or more often when blocksize less than page size. Just like page cache allocation, we should also place the buffer head allocation before startting the handle. Cc: stable@kernel.org Signed-off-by: Jinke Han Link: https://lore.kernel.org/r/20220903012429.22555-1-hanjinke.666@bytedance.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/inode.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -1309,6 +1309,13 @@ retry_grab: page = grab_cache_page_write_begin(mapping, index, flags); if (!page) return -ENOMEM; + /* + * The same as page allocation, we prealloc buffer heads before + * starting the handle. + */ + if (!page_has_buffers(page)) + create_empty_buffers(page, inode->i_sb->s_blocksize, 0); + unlock_page(page); retry_journal: From patchwork Mon Oct 24 11:29:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8591 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419280wru; Mon, 24 Oct 2022 05:16:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7mQKvRYztdB4d7hs19/XRNbPgfbFISMze4SHXxnqvL/49AjwDUz7Fm6nv5vxEWkWNrLFga X-Received: by 2002:a17:907:1c0b:b0:78d:fabe:736e with SMTP id nc11-20020a1709071c0b00b0078dfabe736emr27357986ejc.292.1666613760627; Mon, 24 Oct 2022 05:16:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613760; cv=none; d=google.com; s=arc-20160816; b=qC2ZW6kbi6QdaW6EQFfHbAp7CbK1OboQN+MU9UiL+BeeRpelc/+983aBwTRJ1WEeOx d0VfH0xemquCZPNra36xrtmkeiAFa/4GbRwpMQdmFj4AgCuOA9uuun6RFY7qXFkO0GxI MoD6qldocYvJXyJ3zdORaVVB/mIf3NXa4PpUVlSCDiWpH5UgNtJ4VA94TydYGW4EWWst W/2FnUrCQGOTGJ3sTBbxkLZbSklEIxD4jaJy//dni5n8vAVHQX6LuIB/F6Syva6peGzv dEGB4xNEyvt9hNoXm7tg9fyyfRtkWPdR6qdUsbpgIM32kholaI2mg1GJNHTs74oSNC/O K5NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=k3b09t6LCEG0UUiDrtUWwidBz7pm6c52M1PX15N+y8k=; b=skOkUInrxbeGbpxKfF5R4bdQCXWz14kxz3r3SmpS7SgLx1vWNGlvN09CluXDCj30vy mKDrPcOof1krpznaclU2r+0OpJ0V1HGk0MSsDNE9lmqWsds1F6yeh1uWjPlWSwQXBDDw ywXsTly/1haScozbcpa50swAaTIFDIuGjLKd8IPr65Gbr2Lq5kPKKkF3Vp2UraTc6nws kggJu3uqgWWkuqNxY7Znz24ymnukxPQA8tuNKFi+JPFcZ22iZUw7z/c0VEkD+e4dkf9R Hwe7qsBmfq/aI+uViACg9Zc6+06G+qnHZezUbIl3XUWEBVjSsobcwPkRDLJ80tDMlpYY 4XRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=05O7N2Ip; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id he14-20020a1709073d8e00b0078df1c345e4si30035170ejc.518.2022.10.24.05.15.36; Mon, 24 Oct 2022 05:16:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=05O7N2Ip; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232729AbiJXMHM (ORCPT + 99 others); Mon, 24 Oct 2022 08:07:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232937AbiJXMEk (ORCPT ); Mon, 24 Oct 2022 08:04:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 163627CB65; Mon, 24 Oct 2022 04:51:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 96FEFB811B3; Mon, 24 Oct 2022 11:49:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02D9AC433C1; Mon, 24 Oct 2022 11:49:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612189; bh=xIiHCK+1tURwLFmjhuDlO4CmC1NAr2veG4MABKBnho8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=05O7N2IpZ9LzdpZ+i0zELa3a3at4tNWTrucS5utuUJ0axhz+99mZMYzb/uSJi/4V4 gt0kvXZM7iDqxaMAWuFfsgWlTnz/8IQct/IONr7aUcE49HjpKak6/d7/vGO0xJmaux nQxhbI9Upjc3EJ13pJWvoMd111yHt1empZXoMXMY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rik van Riel , Breno Leitao , Petr Mladek , Josh Poimboeuf , stable@kernel.org Subject: [PATCH 4.14 072/210] livepatch: fix race between fork and KLP transition Date: Mon, 24 Oct 2022 13:29:49 +0200 Message-Id: <20221024112959.400039448@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571190873168826?= X-GMAIL-MSGID: =?utf-8?q?1747571190873168826?= From: Rik van Riel commit 747f7a2901174c9afa805dddfb7b24db6f65e985 upstream. The KLP transition code depends on the TIF_PATCH_PENDING and the task->patch_state to stay in sync. On a normal (forward) transition, TIF_PATCH_PENDING will be set on every task in the system, while on a reverse transition (after a failed forward one) first TIF_PATCH_PENDING will be cleared from every task, followed by it being set on tasks that need to be transitioned back to the original code. However, the fork code copies over the TIF_PATCH_PENDING flag from the parent to the child early on, in dup_task_struct and setup_thread_stack. Much later, klp_copy_process will set child->patch_state to match that of the parent. However, the parent's patch_state may have been changed by KLP loading or unloading since it was initially copied over into the child. This results in the KLP code occasionally hitting this warning in klp_complete_transition: for_each_process_thread(g, task) { WARN_ON_ONCE(test_tsk_thread_flag(task, TIF_PATCH_PENDING)); task->patch_state = KLP_UNDEFINED; } Set, or clear, the TIF_PATCH_PENDING flag in the child task depending on whether or not it is needed at the time klp_copy_process is called, at a point in copy_process where the tasklist_lock is held exclusively, preventing races with the KLP code. The KLP code does have a few places where the state is changed without the tasklist_lock held, but those should not cause problems because klp_update_patch_state(current) cannot be called while the current task is in the middle of fork, klp_check_and_switch_task() which is called under the pi_lock, which prevents rescheduling, and manipulation of the patch state of idle tasks, which do not fork. This should prevent this warning from triggering again in the future, and close the race for both normal and reverse transitions. Signed-off-by: Rik van Riel Reported-by: Breno Leitao Reviewed-by: Petr Mladek Acked-by: Josh Poimboeuf Fixes: d83a7cb375ee ("livepatch: change to a per-task consistency model") Cc: stable@kernel.org Signed-off-by: Petr Mladek Link: https://lore.kernel.org/r/20220808150019.03d6a67b@imladris.surriel.com Signed-off-by: Greg Kroah-Hartman --- kernel/livepatch/transition.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) --- a/kernel/livepatch/transition.c +++ b/kernel/livepatch/transition.c @@ -573,7 +573,21 @@ void klp_reverse_transition(void) /* Called from copy_process() during fork */ void klp_copy_process(struct task_struct *child) { - child->patch_state = current->patch_state; - /* TIF_PATCH_PENDING gets copied in setup_thread_stack() */ + /* + * The parent process may have gone through a KLP transition since + * the thread flag was copied in setup_thread_stack earlier. Bring + * the task flag up to date with the parent here. + * + * The operation is serialized against all klp_*_transition() + * operations by the tasklist_lock. The only exception is + * klp_update_patch_state(current), but we cannot race with + * that because we are current. + */ + if (test_tsk_thread_flag(current, TIF_PATCH_PENDING)) + set_tsk_thread_flag(child, TIF_PATCH_PENDING); + else + clear_tsk_thread_flag(child, TIF_PATCH_PENDING); + + child->patch_state = current->patch_state; } From patchwork Mon Oct 24 11:29:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8597 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419414wru; Mon, 24 Oct 2022 05:16:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM69VsQOrgvnCdf0Z1KRAgXLm9F53OpJ/4VktvgaUkvWlDA83nNWTKEK8wsR2FVeQRYU4Cts X-Received: by 2002:a17:906:58cc:b0:78d:ce9c:3787 with SMTP id e12-20020a17090658cc00b0078dce9c3787mr27008149ejs.715.1666613764480; Mon, 24 Oct 2022 05:16:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613764; cv=none; d=google.com; s=arc-20160816; b=vm/7iLdkS/DOYjtK+V8jzHz3AXzBMTE8cBz5t4c3VajTLR+LBDRzDxeC4/crO9lpNf btun3kXgyBo97lPiDE2d0VITSQWxEI3CwA4QHZ8I40sbUGj633gvOhDv7eE5aUbCwEl2 jTJVwx4z7aJcbKIqeSeCH9po4rqXcAVLa/T0dG1L+BMC/4v8ad/Q1k5r4fyrH77zwHBf dp/tcTUslvsut1UQp0nlQeQgqB4H8LOI2r4+xzhBHLlcPEp/Elc35VTxt1D7DdglsSnJ BY8DGyfKr6qXQn3JDt3JIPoIv+FELISQkvjvoeXRjXDVgJjU4VahwNslvT6gzPmlu6w4 lvmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RSAX87CGkMRZ/iVReg9Qz+0NulyzlHAtc79+ULSNHnw=; b=ztQKcF33UwrfzLy6Kx9rViizfNIPimYOpf031nePOT3mP0mnDX/RlF+WrV80h0XzqL n7Q6MO/q3qdeKzX+qhOXVkp+spnj6yXlZ6LwnRnuQp7NdRla49Nirln7Sl+kgrt1aM1m HnPaQayfxjPSZ2WM6W7vkrvDlkXGUF14umlAM+PSJReEyRFAqY0DqipfQhTDD15+6qvb 0jC1nkMt2qX/kbPXIIWXYG3S87CEn1+DoWnWBCUtGa2Ey3VPv+Z9Xq0grwv8ubCUteGG E2IXZ0uut+T2ssurT9CPwRrgOYPjBPRmLQcvscXyV9tIixTv2IHu67s0a5NpIa+Vqmzj aUcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="d/DOJJBu"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qb26-20020a1709077e9a00b0078db3762061si29385176ejc.439.2022.10.24.05.15.40; Mon, 24 Oct 2022 05:16:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="d/DOJJBu"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232491AbiJXMH0 (ORCPT + 99 others); Mon, 24 Oct 2022 08:07:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232975AbiJXMEr (ORCPT ); Mon, 24 Oct 2022 08:04:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA8427CB7C; Mon, 24 Oct 2022 04:51:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3F01EB811B2; Mon, 24 Oct 2022 11:49:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 965FFC433C1; Mon, 24 Oct 2022 11:49:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612192; bh=mXfUfUMNJxS2BzRQ6KR9PDjAr0TpVUooJu+qILoXLsU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d/DOJJBulW+YwMo1/gNd6Bp1hDW8qU2enm70MJm18OA6dV6HQnQs4Kjm5eP7s3r0m ZZ0Pf1FAb29cXga1BPD4EV3i/nIvU5a5utnG9gkv1z5qajwyYaGdJbCeLU6JCa7YR7 bNudLTnGaohvSPwVlCAeAs1FLN0tEt2NdFmU+/ZY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, mingo@redhat.com, Zheng Yejian , "Steven Rostedt (Google)" Subject: [PATCH 4.14 073/210] ftrace: Properly unset FTRACE_HASH_FL_MOD Date: Mon, 24 Oct 2022 13:29:50 +0200 Message-Id: <20221024112959.430185592@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571194716852200?= X-GMAIL-MSGID: =?utf-8?q?1747571194716852200?= From: Zheng Yejian commit 0ce0638edf5ec83343302b884fa208179580700a upstream. When executing following commands like what document said, but the log "#### all functions enabled ####" was not shown as expect: 1. Set a 'mod' filter: $ echo 'write*:mod:ext3' > /sys/kernel/tracing/set_ftrace_filter 2. Invert above filter: $ echo '!write*:mod:ext3' >> /sys/kernel/tracing/set_ftrace_filter 3. Read the file: $ cat /sys/kernel/tracing/set_ftrace_filter By some debugging, I found that flag FTRACE_HASH_FL_MOD was not unset after inversion like above step 2 and then result of ftrace_hash_empty() is incorrect. Link: https://lkml.kernel.org/r/20220926152008.2239274-1-zhengyejian1@huawei.com Cc: Cc: stable@vger.kernel.org Fixes: 8c08f0d5c6fb ("ftrace: Have cached module filters be an active filter") Signed-off-by: Zheng Yejian Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/ftrace.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -5128,8 +5128,12 @@ int ftrace_regex_release(struct inode *i if (filter_hash) { orig_hash = &iter->ops->func_hash->filter_hash; - if (iter->tr && !list_empty(&iter->tr->mod_trace)) - iter->hash->flags |= FTRACE_HASH_FL_MOD; + if (iter->tr) { + if (list_empty(&iter->tr->mod_trace)) + iter->hash->flags &= ~FTRACE_HASH_FL_MOD; + else + iter->hash->flags |= FTRACE_HASH_FL_MOD; + } } else orig_hash = &iter->ops->func_hash->notrace_hash; From patchwork Mon Oct 24 11:29:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8685 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422442wru; Mon, 24 Oct 2022 05:22:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6JBFsmNgV+1jGhok51g99hVa5y1GVrdgS8MI7QKrlaUN9FuFfm0UukwtlrJ8XiO8MV/Fhb X-Received: by 2002:a05:6402:28ca:b0:43b:5235:f325 with SMTP id ef10-20020a05640228ca00b0043b5235f325mr30043583edb.320.1666614162838; Mon, 24 Oct 2022 05:22:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614162; cv=none; d=google.com; s=arc-20160816; b=UZe4zHaD2QKbrG4K/yfgF9q8YIqrqUYMTcLi7bCFRyqgQKEHArGpBbYf99gCsoEwXo TF1ASEKSqTeIwJyADv78KXUFwE98V4YKf3yNr3HExgGY2oUAuNYGDIHGgt/QcwOiHR6+ 9BLlqPYwWzBee6nzGtQPXFPX5krOxTxepw78hpFWst9b7L0oPe4Z9ffRQv2gL8POGNkE iHGkI7mF4eFGPkFfijh1iCQsyJvdcCv6t/ajjWFkDhFoptlklvZSROTCOmz5bCmylcrq VB5buBT2eSXjoNRSV5gwzH9ieOKUdzdfzuUXuYVw3XQQ29c+CtZ/9+3JzXrQHDaPLQOr KpmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yiVLxMZbvyDb0RbUA0MvZfZMhpytpEsnrI9Zf7BAwus=; b=HoQYDApekwLOmy5rh0MZmvq6d6+QhwWmAntvUgVC7tE1MlM98DUT/OyudgB6Arc3+6 k3aO5fLQB+7zK0VgO88fVz0/iqQRptX7vyDmPzuLsHtCVykbGjwXPNhlblomEKlGG52n HgvEJeuz+7yUCcPXkBrb8Bv3AhJUG6k7BqCBhgl6ea1Eyiwf8z+SL/bxyf2ThZzfHo1Y R4NPuggJtSvj4ySVdAAxW+GJOoUVXQP2cFEIEd9Mes1ZaTnvftfdKTUQuYWnC0kYhtM0 5tMIvFy2NpG4kXcnB8VvOnnIYezWPoEDf7C3WQjAVRwwDAnB7qRrlz4kzPKok3H8LEUb ACPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="DHk/5euK"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e11-20020a50a68b000000b0045cd10a4c20si27540680edc.321.2022.10.24.05.22.18; Mon, 24 Oct 2022 05:22:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="DHk/5euK"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233219AbiJXMVA (ORCPT + 99 others); Mon, 24 Oct 2022 08:21:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233392AbiJXMTV (ORCPT ); Mon, 24 Oct 2022 08:19:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16F6682D36; Mon, 24 Oct 2022 04:58:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E025FB811BB; Mon, 24 Oct 2022 11:49:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42D59C433C1; Mon, 24 Oct 2022 11:49:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612194; bh=YpURN54bP3lO0GSk/IShWNXb2+lp0qTSkE0YhNm2eEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DHk/5euKyDhMNbphkCF25eVXj0M0B93EdbhGD6Yk9ZL4ThA3FXH8oww5xDKbFWmTm Q2J6V5fNBxHPSgmK8XvWwrY0+ImIAdy/7xqMGRhQnsgwHGPiHBFl3lNfPJqweDdvuT ODoHZZhceB8gtIomNa1HNS+MhnsgfoBF1HUidRWc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Steven Rostedt (Google)" Subject: [PATCH 4.14 074/210] ring-buffer: Allow splice to read previous partially read pages Date: Mon, 24 Oct 2022 13:29:51 +0200 Message-Id: <20221024112959.465611437@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571612150099870?= X-GMAIL-MSGID: =?utf-8?q?1747571612150099870?= From: Steven Rostedt (Google) commit fa8f4a89736b654125fb254b0db753ac68a5fced upstream. If a page is partially read, and then the splice system call is run against the ring buffer, it will always fail to read, no matter how much is in the ring buffer. That's because the code path for a partial read of the page does will fail if the "full" flag is set. The splice system call wants full pages, so if the read of the ring buffer is not yet full, it should return zero, and the splice will block. But if a previous read was done, where the beginning has been consumed, it should still be given to the splice caller if the rest of the page has been written to. This caused the splice command to never consume data in this scenario, and let the ring buffer just fill up and lose events. Link: https://lkml.kernel.org/r/20220927144317.46be6b80@gandalf.local.home Cc: stable@vger.kernel.org Fixes: 8789a9e7df6bf ("ring-buffer: read page interface") Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/ring_buffer.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -4639,7 +4639,15 @@ int ring_buffer_read_page(struct ring_bu unsigned int pos = 0; unsigned int size; - if (full) + /* + * If a full page is expected, this can still be returned + * if there's been a previous partial read and the + * rest of the page can be read and the commit page is off + * the reader page. + */ + if (full && + (!read || (len < (commit - read)) || + cpu_buffer->reader_page == cpu_buffer->commit_page)) goto out_unlock; if (len > (commit - read)) From patchwork Mon Oct 24 11:29:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10053 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp622900wru; Mon, 24 Oct 2022 12:46:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4njEXjtn0BJDjtcOljyKSrFKPGBOFLGVnnGMh18Y1GKfVQguPq/15KQDdU2fPOX43TFBxJ X-Received: by 2002:a05:6a00:1256:b0:563:ce4b:f525 with SMTP id u22-20020a056a00125600b00563ce4bf525mr35227163pfi.72.1666640813266; Mon, 24 Oct 2022 12:46:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640813; cv=none; d=google.com; s=arc-20160816; b=mOZcLvydW+y3M490PEdt7Airz93a3Enzb0arWJFTALt5WRp2CqCN2lV56kVibqZk1w xxV9mhxeftuhUbyNCiWYEVMTYqr+83WO4QOc0OKNDUZUBXc+uz7rkiZPRYXX+WhH8rVO dqeUYaijtp/flrA3MEdm1YjBiclpNI35fnmwS85axHizvR8nvgI9UJcwiT0qJNfoAZN7 yo8kHOwAqdcxPg/pXFzqAYJ0mGHONSKkGhhBOV1EnGoitRwivA82uifWCTjtnobXK4x2 rWN0mZoLmMp/FHvfxw6WqZbhOBuxS5EIK8bUkjfHR1g2GL2FdD5XWvfgOP3S0kN8sSAs bu9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kdeLuWxM1DQ8Yk1vQc4JlJu9CamVaoepax76ACY7zPE=; b=fu1BBW6DlFDtFyOPuHg5z/VfuynseON3FIPk7zjzLPGiEqkNGqqecY8LgrS9deeyDK 3dElpCWyCoHcEvZ+36O1GPKBWi9gR4+VsJAw3lqov/XgnZzORJl+BU0Dr8H5j9JvKXSc Jrjma9JGWrBhdiw9oG5RMTklmrHcJuhJsqWBV2MIQD0rTAM4asbnRdvd70vuxtXvzw1h c76qdiUNTbnT6EpgEvNTFAtWXr413W2CnJC5jsjqXul/p7ntxy5ASQBHNUAlxmoEvXIl qodWYeOBVlOrDTsYGob39bLm2O9gQIDYQ0T7ayreUrKMs8Wia37WmlO5Of8/RR5h4twW Mz6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jSNtaVm2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 81-20020a630354000000b0041c506dde92si415424pgd.636.2022.10.24.12.46.37; Mon, 24 Oct 2022 12:46:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jSNtaVm2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231573AbiJXTk4 (ORCPT + 99 others); Mon, 24 Oct 2022 15:40:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233381AbiJXTkP (ORCPT ); Mon, 24 Oct 2022 15:40:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 220311D1021; Mon, 24 Oct 2022 11:10:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9D9A7B811A9; Mon, 24 Oct 2022 11:48:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1381C433B5; Mon, 24 Oct 2022 11:48:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612112; bh=exJ6/ycf2cPgXPDrwu+frN0ZqvWYWR4ZkIMOmn0PI5k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jSNtaVm28anVXL2mizqvNFQXQqSsnv0DyqFX5LsqulmvS0ZCfj1kAaeu70M2TdD9U tSThzEpRgk9k15698rLOuLjuoab6/Z/ThUlpBopvXJbCUV/3Zj9pMEwMDnkOP4VW4h eX+oqYYfoaLD0JVW9UsJmM1UH3OO1GjDvu7ZoWSQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ingo Molnar , Andrew Morton , "Steven Rostedt (Google)" Subject: [PATCH 4.14 075/210] ring-buffer: Check pending waiters when doing wake ups as well Date: Mon, 24 Oct 2022 13:29:52 +0200 Message-Id: <20221024112959.497465537@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747599557556442135?= X-GMAIL-MSGID: =?utf-8?q?1747599557556442135?= From: Steven Rostedt (Google) commit ec0bbc5ec5664dcee344f79373852117dc672c86 upstream. The wake up waiters only checks the "wakeup_full" variable and not the "full_waiters_pending". The full_waiters_pending is set when a waiter is added to the wait queue. The wakeup_full is only set when an event is triggered, and it clears the full_waiters_pending to avoid multiple calls to irq_work_queue(). The irq_work callback really needs to check both wakeup_full as well as full_waiters_pending such that this code can be used to wake up waiters when a file is closed that represents the ring buffer and the waiters need to be woken up. Link: https://lkml.kernel.org/r/20220927231824.209460321@goodmis.org Cc: stable@vger.kernel.org Cc: Ingo Molnar Cc: Andrew Morton Fixes: 15693458c4bc0 ("tracing/ring-buffer: Move poll wake ups into ring buffer code") Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/ring_buffer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -512,8 +512,9 @@ static void rb_wake_up_waiters(struct ir struct rb_irq_work *rbwork = container_of(work, struct rb_irq_work, work); wake_up_all(&rbwork->waiters); - if (rbwork->wakeup_full) { + if (rbwork->full_waiters_pending || rbwork->wakeup_full) { rbwork->wakeup_full = false; + rbwork->full_waiters_pending = false; wake_up_all(&rbwork->full_waiters); } } From patchwork Mon Oct 24 11:29:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8566 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp417941wru; Mon, 24 Oct 2022 05:13:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6H/cXI5js3HgJUxoel48/b5bWbVu9ur9fL3pxdROU4uYxr30ZGC2OM49S6tg4mazve7pxd X-Received: by 2002:a17:907:6eab:b0:78d:4c16:a687 with SMTP id sh43-20020a1709076eab00b0078d4c16a687mr27100692ejc.392.1666613632446; Mon, 24 Oct 2022 05:13:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613632; cv=none; d=google.com; s=arc-20160816; b=a0PV69Y7RGKhUP3jGKiGC22xvml1aK6/Bso7q1mQzutb4fuQgLWZRQDS9bic4VUGwV spZbRTXKSijADdktL+FRWVZSKQPSt0jaf6jqlCcUp5Dh+nkaMl9+ycqTS6vcLGz/bViP /86Jtip8LNU7FsrgSq6wrf+KBeDf6SciUlwKKNoa8wayMA7QqL83LsppjvFwwDPl83KB m6gN+JzvBNMzBisT03wLmsapnwfRYyey2r99gWj3S3L6WZTTC8KPhUDDC/5izl31vSrH gJB4nSjwq8CGLm+d0RqQ9kAppKNybfsT9W3VAN1O93okhbOSI9LZ1IrlYJsgFaj5RCET Cijw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZuHN/+7J5IzIxxIgKvNbtYWBqnVThpExPrr3Nar9pAs=; b=hBBMWArc2x689ffKq8lpoSbiuF3yGbfWk4/ZMRbDzJfjY6WjZ+nIF5GHbOUmDLqlCX R41H38iOKcLjvL3KZWb4GAO51jUlaZr8cGc0A5oVvQaUeh3boTg4EOzoWzIej0iv48Zw 4sGyd1VO+W0QwwLdn/9MpfXQuH1GNWMJl2BSga9dxKR9emA7ul/e94lcRDlUD+IfQNPj liqluBC7CiCig/tzdB3lRGjUno8sa+ubtbUJ2QcVs5aJ+KIlfv1xIGPNILW1t4ikYS8b yBbzZdstk5nHbY5IIp3amLQPWGSxm0oGUERQiaEuc5KpPFlbnsFUQjLCzHnLTnR/6AmV c/oA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="TW8/MEUP"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u9-20020a50c2c9000000b0045cdea002e4si24582681edf.66.2022.10.24.05.13.26; Mon, 24 Oct 2022 05:13:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="TW8/MEUP"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232523AbiJXMCG (ORCPT + 99 others); Mon, 24 Oct 2022 08:02:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232641AbiJXL71 (ORCPT ); Mon, 24 Oct 2022 07:59:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 346997C746; Mon, 24 Oct 2022 04:48:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 89CB461286; Mon, 24 Oct 2022 11:48:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9AFFEC433D6; Mon, 24 Oct 2022 11:48:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612115; bh=YHuPAPNZLMhlbumDyYRCxAabMIxWjD5pgSzSNeDaNJc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TW8/MEUP4cgg5XWTpwI1dD6siqR5dA4NOMVyU9/Gect/XXIKZxeORWWKeYmSknT1G iAG32rzQ0kKCx3q3yFDQmd8gONDHArKFh4cOBHTRRfDhST7YjKsP2k3L83/Y9NkvkH iIdE7H1H+iY6Ug8vU5eP6PQBgBFmc06E7YLFbBH0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ingo Molnar , Andrew Morton , "Jiazi.Li" , "Steven Rostedt (Google)" Subject: [PATCH 4.14 076/210] ring-buffer: Fix race between reset page and reading page Date: Mon, 24 Oct 2022 13:29:53 +0200 Message-Id: <20221024112959.537331298@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571055855663055?= X-GMAIL-MSGID: =?utf-8?q?1747571055855663055?= From: Steven Rostedt (Google) commit a0fcaaed0c46cf9399d3a2d6e0c87ddb3df0e044 upstream. The ring buffer is broken up into sub buffers (currently of page size). Each sub buffer has a pointer to its "tail" (the last event written to the sub buffer). When a new event is requested, the tail is locally incremented to cover the size of the new event. This is done in a way that there is no need for locking. If the tail goes past the end of the sub buffer, the process of moving to the next sub buffer takes place. After setting the current sub buffer to the next one, the previous one that had the tail go passed the end of the sub buffer needs to be reset back to the original tail location (before the new event was requested) and the rest of the sub buffer needs to be "padded". The race happens when a reader takes control of the sub buffer. As readers do a "swap" of sub buffers from the ring buffer to get exclusive access to the sub buffer, it replaces the "head" sub buffer with an empty sub buffer that goes back into the writable portion of the ring buffer. This swap can happen as soon as the writer moves to the next sub buffer and before it updates the last sub buffer with padding. Because the sub buffer can be released to the reader while the writer is still updating the padding, it is possible for the reader to see the event that goes past the end of the sub buffer. This can cause obvious issues. To fix this, add a few memory barriers so that the reader definitely sees the updates to the sub buffer, and also waits until the writer has put back the "tail" of the sub buffer back to the last event that was written on it. To be paranoid, it will only spin for 1 second, otherwise it will warn and shutdown the ring buffer code. 1 second should be enough as the writer does have preemption disabled. If the writer doesn't move within 1 second (with preemption disabled) something is horribly wrong. No interrupt should last 1 second! Link: https://lore.kernel.org/all/20220830120854.7545-1-jiazi.li@transsion.com/ Link: https://bugzilla.kernel.org/show_bug.cgi?id=216369 Link: https://lkml.kernel.org/r/20220929104909.0650a36c@gandalf.local.home Cc: Ingo Molnar Cc: Andrew Morton Cc: stable@vger.kernel.org Fixes: c7b0930857e22 ("ring-buffer: prevent adding write in discarded area") Reported-by: Jiazi.Li Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/ring_buffer.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -2096,6 +2096,9 @@ rb_reset_tail(struct ring_buffer_per_cpu /* Mark the rest of the page with padding */ rb_event_set_padding(event); + /* Make sure the padding is visible before the write update */ + smp_wmb(); + /* Set the write back to the previous setting */ local_sub(length, &tail_page->write); return; @@ -2107,6 +2110,9 @@ rb_reset_tail(struct ring_buffer_per_cpu /* time delta must be non zero */ event->time_delta = 1; + /* Make sure the padding is visible before the tail_page->write update */ + smp_wmb(); + /* Set write to end of buffer */ length = (tail + length) - BUF_PAGE_SIZE; local_sub(length, &tail_page->write); @@ -3697,6 +3703,33 @@ rb_get_reader_page(struct ring_buffer_pe arch_spin_unlock(&cpu_buffer->lock); local_irq_restore(flags); + /* + * The writer has preempt disable, wait for it. But not forever + * Although, 1 second is pretty much "forever" + */ +#define USECS_WAIT 1000000 + for (nr_loops = 0; nr_loops < USECS_WAIT; nr_loops++) { + /* If the write is past the end of page, a writer is still updating it */ + if (likely(!reader || rb_page_write(reader) <= BUF_PAGE_SIZE)) + break; + + udelay(1); + + /* Get the latest version of the reader write value */ + smp_rmb(); + } + + /* The writer is not moving forward? Something is wrong */ + if (RB_WARN_ON(cpu_buffer, nr_loops == USECS_WAIT)) + reader = NULL; + + /* + * Make sure we see any padding after the write update + * (see rb_reset_tail()) + */ + smp_rmb(); + + return reader; } From patchwork Mon Oct 24 11:29:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8564 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp417796wru; Mon, 24 Oct 2022 05:13:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6fKjAIJo8xUUdBuS2Q2On6+0yZyeOF/GVQFmNNDBG4SCpTI8mpvc25Zsn7iycFZ8+Ip1Sk X-Received: by 2002:a17:907:3d9e:b0:791:8933:f9fc with SMTP id he30-20020a1709073d9e00b007918933f9fcmr27782700ejc.111.1666613620125; Mon, 24 Oct 2022 05:13:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613620; cv=none; d=google.com; s=arc-20160816; b=gvMJkOYW6HGJx0UZADlnGkLBBIPzEuzF+iso6FT6SC0KL7MlO6ctvJqG7HUoajZwcC 9SBqLkMMZ9T/Pwt6VQgSq9nphGTobDiUp14rLps1fA2pYuBFHLM9+o5OvhDEDOJaRjLA OUUe/QkBoY47wA47Oy2EKguSWKjwrJ4rtO2Fj7H2w6vFH9sHqNBU8SO97pjFLcIv4vES LHZ4r/+O8fpqB4AR2xwUwBwsUCMfLgjFln48OdAko8I7iKNf15xXQiNTIvkf1hobGnYF 0MEl0aIuJhydW/cEc58SuYH1G3nbnjkUb+M2qiMw8gOr8ljThaBOojG+DqSocBw1Hit8 IrYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=W8lSG+rNdh40VV2XnHKtFJ+Wje3QDhUsfh/71XqywQg=; b=odHJb1H5qyZ50Jyo7dOjv5kfO5sp5myV/P7P8mDUFnHGkPPeXGMoFNTyyhw7m3W6k3 d26txIIVIyjfYY1MqIxoPhCyPxtO7TC/SJMRZRKgBJGcnGMa+b+l3Xvw+5vzHa5zNZ1q ynSvVqJ4H2dugqhAvQ1Wcee7n3u4jPFmqHRplmDQCV9W4yo6+d+VdKaTe2rDEge5PSyP 8MQtWSL6rjCEr8MnKPHtJCgO7NcsolhxBKvJQlrQOrJf3gApaODW1VkdwJWU6SpZwrrO Z6U4ZFJlrm+Oc0STtqbXiDhcwrchpV/efLOjSWf1yFLiL95gqbTUnenPS+MP4YcMHv9o PBrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Bku3akZ/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id js6-20020a17090797c600b0078b2fed72b9si25147956ejc.111.2022.10.24.05.13.13; Mon, 24 Oct 2022 05:13:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Bku3akZ/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232411AbiJXMCp (ORCPT + 99 others); Mon, 24 Oct 2022 08:02:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232708AbiJXL7m (ORCPT ); Mon, 24 Oct 2022 07:59:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 450C77C751; Mon, 24 Oct 2022 04:48:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 25D0761218; Mon, 24 Oct 2022 11:48:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A9D4C433D7; Mon, 24 Oct 2022 11:48:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612117; bh=z1NyuPD3NEIda2Y8V4lGbryOQIxzQNQE5QhUp+B71xs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bku3akZ/U1RJ9JtSoCn9YjB0qIstAoPHMi6ZMXq8k4GsYrS7fELn7/rnEWFdRb58C z8E6JZOoNp/ku/0F/U1cEK/aWTyEWQR6d0OW+Tw6xGv5/lVxTGcH3BL8dQ769RDgvt d1tTrQXOfLquSPu+4WP/scj/oQTl6felGDC4335I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Luczaj , Sean Christopherson Subject: [PATCH 4.14 077/210] KVM: x86/emulator: Fix handing of POP SS to correctly set interruptibility Date: Mon, 24 Oct 2022 13:29:54 +0200 Message-Id: <20221024112959.567225844@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571042983276507?= X-GMAIL-MSGID: =?utf-8?q?1747571042983276507?= From: Michal Luczaj commit 6aa5c47c351b22c21205c87977c84809cd015fcf upstream. The emulator checks the wrong variable while setting the CPU interruptibility state, the target segment is embedded in the instruction opcode, not the ModR/M register. Fix the condition. Signed-off-by: Michal Luczaj Fixes: a5457e7bcf9a ("KVM: emulate: POP SS triggers a MOV SS shadow too") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/all/20220821215900.1419215-1-mhal@rbox.co Signed-off-by: Sean Christopherson Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/emulate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -1988,7 +1988,7 @@ static int em_pop_sreg(struct x86_emulat if (rc != X86EMUL_CONTINUE) return rc; - if (ctxt->modrm_reg == VCPU_SREG_SS) + if (seg == VCPU_SREG_SS) ctxt->interruptibility = KVM_X86_SHADOW_INT_MOV_SS; if (ctxt->op_bytes > 2) rsp_increment(ctxt, ctxt->op_bytes - 2); From patchwork Mon Oct 24 11:29:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8593 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419350wru; Mon, 24 Oct 2022 05:16:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5b1PkYJqgCgEcmrz+jiAz2Xo9V+r7Ewrf9KogYx3kwVecoq9d5ONRrhtAbic4uSzxGeCeq X-Received: by 2002:aa7:c78d:0:b0:454:fe1d:8eb1 with SMTP id n13-20020aa7c78d000000b00454fe1d8eb1mr30397535eds.59.1666613747618; Mon, 24 Oct 2022 05:15:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613747; cv=none; d=google.com; s=arc-20160816; b=tHKsRcPXMzHJhE452f+EMFTrbAzsHMLYpG7K3wIU7FbxmgRbTR60lW0vDBClxtihs8 vaywknnmvl92wFapzoRqHgvQv2zvA/2DggPvRoE8LDIfEpYww9RjMF96zAWS/lMVaT4D O/Niho+jtdjQTO9mwOeniQy8sakN3UL0n/Zoz53cvypPLYH3eSzYAUK9DkXW1J7I8CWn tUETEOifDbWlySuEGbHOeQjTCc4sBAVo/Wsr/3SHDrz9nvnwt+UV7zWdBAFGkFrylULf 5JMOZL6fBlBc7K8ryfuGsQK51lZmzL1rgQ2bUOlZHHDu350J9T6itOzr0qI/wHTDrz2E PSwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KzY4nP3djJe6RIC2upnuKsaqW+WbkrFhlSUE3BL9+To=; b=tnXtv+lgvuIQ2LxbkbQpTL274t3ctYBYKPfrJOnbgVfwqegorroHcmzH4Mtg9ZmYCY 1s5xpgLK0oG1ZNjoloq2a9YKDYZGZacjdEinDAx9DyJGJQ0JDz6INHuFUkwWRc1uOA/l SEWohmYopXQeJe0HVX6Kgg75P/clTp12Z3j+OQNrcY0ZXYj5Q7iAlET4tCA4BKm+IGdN 1kDRvsXp+btzzcjjdyYBpBzIxiM7QYLEOdb0/Psd4+sD8Pa0KSNv/AF2oGw0gbrPQGah 5sjok5eWRJ7mZYCUGp18EUSDBXPYIy5pN51kVRm3IVG9cbkixZP6wr74NDzcbZFpFrJc f/Bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=diz7BDPJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m24-20020a50ef18000000b004615b657cbcsi7416111eds.190.2022.10.24.05.15.23; Mon, 24 Oct 2022 05:15:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=diz7BDPJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229956AbiJXMGs (ORCPT + 99 others); Mon, 24 Oct 2022 08:06:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232902AbiJXMEh (ORCPT ); Mon, 24 Oct 2022 08:04:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85BCA7B596; Mon, 24 Oct 2022 04:50:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B2076612A1; Mon, 24 Oct 2022 11:48:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C33C5C433C1; Mon, 24 Oct 2022 11:48:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612120; bh=sZ/yz13J10ldzxTjOIIhRXD7fl+g9Se2enYqUrLTuGw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=diz7BDPJx8A1FscNKssBGqtZYJFT92mUTzTvWnBoL50VCJ5cJizqNvr+koWixml6p SmTknUzEjBUbaxrwE2YM5oHmsMqcWsGJrZrlvjITudRZtXvBTGEVdA/0iUV9EXFAXy qWcIHApxmT+/jdHjC7zU2q5iYEPRgqHgztlIDqxo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Jim Mattson , Maxim Levitsky , Paolo Bonzini Subject: [PATCH 4.14 078/210] KVM: nVMX: Unconditionally purge queued/injected events on nested "exit" Date: Mon, 24 Oct 2022 13:29:55 +0200 Message-Id: <20221024112959.596807202@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571176983888538?= X-GMAIL-MSGID: =?utf-8?q?1747571176983888538?= From: Sean Christopherson commit d953540430c5af57f5de97ea9e36253908204027 upstream. Drop pending exceptions and events queued for re-injection when leaving nested guest mode, even if the "exit" is due to VM-Fail, SMI, or forced by host userspace. Failure to purge events could result in an event belonging to L2 being injected into L1. This _should_ never happen for VM-Fail as all events should be blocked by nested_run_pending, but it's possible if KVM, not the L1 hypervisor, is the source of VM-Fail when running vmcs02. SMI is a nop (barring unknown bugs) as recognition of SMI and thus entry to SMM is blocked by pending exceptions and re-injected events. Forced exit is definitely buggy, but has likely gone unnoticed because userspace probably follows the forced exit with KVM_SET_VCPU_EVENTS (or some other ioctl() that purges the queue). Fixes: 4f350c6dbcb9 ("kvm: nVMX: Handle deferred early VMLAUNCH/VMRESUME failure properly") Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson Reviewed-by: Jim Mattson Reviewed-by: Maxim Levitsky Link: https://lore.kernel.org/r/20220830231614.3580124-2-seanjc@google.com Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/vmx.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -11917,14 +11917,6 @@ static void prepare_vmcs12(struct kvm_vc */ vmcs12_save_pending_event(vcpu, vmcs12); } - - /* - * Drop what we picked up for L2 via vmx_complete_interrupts. It is - * preserved above and would only end up incorrectly in L1. - */ - vcpu->arch.nmi_injected = false; - kvm_clear_exception_queue(vcpu); - kvm_clear_interrupt_queue(vcpu); } /* @@ -12236,6 +12228,17 @@ static void nested_vmx_vmexit(struct kvm nested_vmx_abort(vcpu, VMX_ABORT_SAVE_GUEST_MSR_FAIL); } + /* + * Drop events/exceptions that were queued for re-injection to L2 + * (picked up via vmx_complete_interrupts()), as well as exceptions + * that were pending for L2. Note, this must NOT be hoisted above + * prepare_vmcs12(), events/exceptions queued for re-injection need to + * be captured in vmcs12 (see vmcs12_save_pending_event()). + */ + vcpu->arch.nmi_injected = false; + kvm_clear_exception_queue(vcpu); + kvm_clear_interrupt_queue(vcpu); + vmx_switch_vmcs(vcpu, &vmx->vmcs01); vm_entry_controls_reset_shadow(vmx); vm_exit_controls_reset_shadow(vmx); From patchwork Mon Oct 24 11:29:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8576 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp418262wru; Mon, 24 Oct 2022 05:14:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5LxjtejdkXs3Pke/EAJ7jPBS8+n9xgiBwHZafXraTNB1ASDD8xqkF766Vf8yxKuMDg3qW7 X-Received: by 2002:a17:907:9688:b0:7a5:74eb:d12b with SMTP id hd8-20020a170907968800b007a574ebd12bmr5837241ejc.60.1666613660622; Mon, 24 Oct 2022 05:14:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613660; cv=none; d=google.com; s=arc-20160816; b=RIoPVR3DNkeq9YiBOJTVIALS2K/iiARd4ipUp2n8cQRtD7JJS7Na4/qQpygMeukdeS TLPbk3InDr0PdSElsdHxi/7IBdkamToPVjtcXEWzCpDemO6HGO2YdDgh+rU8ZqQgAr48 dIANGvjKL0X69lATn5Wnd3JziS5GU/kKpv50L88/YXFR8zSr3mPWzmhd9dH9EZ5/P7FS GqO6zu6Hj8mhQESKfshizTs5SE5uzrk/MEIz/iJEFe5AoD+2x7EYmGeAB4pAAJBnOH5n 9/Ao4H03S0JYKV+NCJsbEDvi6zrk46s/Dx4IaUe96wC9wS0OktEcDPGXGOzYLVFTfEst tMwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=E3LFXV2vyuRDWnSXKx01IaPvG9g3EwNCRRsEgRJ1rQs=; b=AaE9CU4eYHn/VjDkd9IB+mQ4xgt+qoqdw91Zd4N81RSvbK3ZjG1sR5RfOUVnoTB/rn Ut1Zv9jvXrOIRdzfVkojtDWHbjuQigSO9XiY4ja9LW+AskcgCl15N7K4vlqUNbccUq7b HLKNu5b554ps6y+L3JzTEQiTfaQcQAuHurg/8Yju1hD1VJyOZgsn3VOLW9FqLQLo8Hp8 gvgiYLzYzT/C5jLr7XwYAY/RRMCu0bh48Slo8rQoo9ZeKfSQaNLeS/P01EXQQ/ygBQkb WqDRdC2+VV5pWxs/aQASwGh/+EaI3lpy0/QHw/SPdk5zCYc+8DKFj8rqLxFnoqDk6L2U 2QNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0UpgXqRe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o7-20020a056402038700b004592ebc28a9si23363988edv.59.2022.10.24.05.13.56; Mon, 24 Oct 2022 05:14:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0UpgXqRe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232617AbiJXMF6 (ORCPT + 99 others); Mon, 24 Oct 2022 08:05:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232616AbiJXMD4 (ORCPT ); Mon, 24 Oct 2022 08:03:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14B504B4B2; Mon, 24 Oct 2022 04:50:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1A8C8B811A1; Mon, 24 Oct 2022 11:48:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6537AC433C1; Mon, 24 Oct 2022 11:48:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612122; bh=0+56YQKLRS3I50WR/rVpZJDlwNIJzh94dKECmtCa8lc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0UpgXqReQz47ptCu7Yhozcknkc6IVdokyOlX+rk5XaeOAZ/bdxYaNMwW9+hD15IcV zajoXCcsCOeGOZE9k2ciiKp5jQYY07+uVtjqy6FNvq80sd8nqoN8ePyov7OuUf9meG uJ/542Icvs/Zfq0rzXqFOI01DSryf7MacurfT0ek= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Liska , Peter Oberparleiter , Andrew Morton Subject: [PATCH 4.14 079/210] gcov: support GCC 12.1 and newer compilers Date: Mon, 24 Oct 2022 13:29:56 +0200 Message-Id: <20221024112959.627318144@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571085720575993?= X-GMAIL-MSGID: =?utf-8?q?1747571085720575993?= From: Martin Liska commit 977ef30a7d888eeb52fb6908f99080f33e5309a8 upstream. Starting with GCC 12.1, the created .gcda format can't be read by gcov tool. There are 2 significant changes to the .gcda file format that need to be supported: a) [gcov: Use system IO buffering] (23eb66d1d46a34cb28c4acbdf8a1deb80a7c5a05) changed that all sizes in the format are in bytes and not in words (4B) b) [gcov: make profile merging smarter] (72e0c742bd01f8e7e6dcca64042b9ad7e75979de) add a new checksum to the file header. Tested with GCC 7.5, 10.4, 12.2 and the current master. Link: https://lkml.kernel.org/r/624bda92-f307-30e9-9aaa-8cc678b2dfb2@suse.cz Signed-off-by: Martin Liska Tested-by: Peter Oberparleiter Reviewed-by: Peter Oberparleiter Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- kernel/gcov/gcc_4_7.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) --- a/kernel/gcov/gcc_4_7.c +++ b/kernel/gcov/gcc_4_7.c @@ -33,6 +33,13 @@ #define GCOV_TAG_FUNCTION_LENGTH 3 +/* Since GCC 12.1 sizes are in BYTES and not in WORDS (4B). */ +#if (__GNUC__ >= 12) +#define GCOV_UNIT_SIZE 4 +#else +#define GCOV_UNIT_SIZE 1 +#endif + static struct gcov_info *gcov_info_head; /** @@ -439,12 +446,18 @@ static size_t convert_to_gcda(char *buff pos += store_gcov_u32(buffer, pos, info->version); pos += store_gcov_u32(buffer, pos, info->stamp); +#if (__GNUC__ >= 12) + /* Use zero as checksum of the compilation unit. */ + pos += store_gcov_u32(buffer, pos, 0); +#endif + for (fi_idx = 0; fi_idx < info->n_functions; fi_idx++) { fi_ptr = info->functions[fi_idx]; /* Function record. */ pos += store_gcov_u32(buffer, pos, GCOV_TAG_FUNCTION); - pos += store_gcov_u32(buffer, pos, GCOV_TAG_FUNCTION_LENGTH); + pos += store_gcov_u32(buffer, pos, + GCOV_TAG_FUNCTION_LENGTH * GCOV_UNIT_SIZE); pos += store_gcov_u32(buffer, pos, fi_ptr->ident); pos += store_gcov_u32(buffer, pos, fi_ptr->lineno_checksum); pos += store_gcov_u32(buffer, pos, fi_ptr->cfg_checksum); @@ -458,7 +471,8 @@ static size_t convert_to_gcda(char *buff /* Counter record. */ pos += store_gcov_u32(buffer, pos, GCOV_TAG_FOR_COUNTER(ct_idx)); - pos += store_gcov_u32(buffer, pos, ci_ptr->num * 2); + pos += store_gcov_u32(buffer, pos, + ci_ptr->num * 2 * GCOV_UNIT_SIZE); for (cv_idx = 0; cv_idx < ci_ptr->num; cv_idx++) { pos += store_gcov_u64(buffer, pos, From patchwork Mon Oct 24 11:29:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10051 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp622860wru; Mon, 24 Oct 2022 12:46:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Xx1akeRSfh3YwDTNJa+2fRQvUJ6pnp2u0nSHpn6Qn50oJ1KrQeSdP1AlwtJkKIf2wRV0P X-Received: by 2002:a17:902:e88a:b0:183:9ecb:ff85 with SMTP id w10-20020a170902e88a00b001839ecbff85mr35239392plg.169.1666640805552; Mon, 24 Oct 2022 12:46:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640805; cv=none; d=google.com; s=arc-20160816; b=0riufpfirXpKndxNnMK/a9TJaAI9VPczNnkcKRYeMO93juyAcRNWyYXoKF9mGJ00cT HQWypKbLcekTZQnZhqnoM9L9Uzhb1qldqI+XcgLXvi+oI0pQeX3/utF616VV3CC04jIg /EnPJ527CxNpB+yvlt6pxgCFb+gvVoqNblBauQUR8FNNJA4HyOqEmlmw+SBhbfbUhLs4 KfaFz5XkhLWneEzfrgatpFDn2pFZwZUW/WzUOWtKAxLuwtPLePu6sDOcHpge6LKJoYZb Qf2wa/pR0euYeUqawawH3Tz/DwxWLw/BUOKHqM33NBIuypW1NS74vkY7+s+VlC+Dmdih 3Zog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SV20j36YBtmCMBO6hyVOtbbyAhX+h+AVVBda30RRb8g=; b=NgYs1emJF6rAORF8QQppROC+MtQI51N0hWpbaL3dNoSfU/TuCMZCO/XBXfP2EcUv6T r7QkZXu6hZsLdU5sjdmf+B5sx9K0L7hZX1T0eCfcn18RqpjaKIplXLvMz7QDLDlIkkzm /Za7H0DhAB840IyKEISMRF81Vf6dDlibazUkafy5cBmYVYQ9MIN3mgz17WXwXlNVORBk Qf4gv4UFx6XnpSqJdP7VLNmG+wTW0GIO6yotqXTjXsnGEYjTgXfTrsBqltH8/7YzxQna ZG93UZ/9xYpk33l7nVM/x/RnXz/t++OQySovdp0ShNi8W9aXPcoVT/NVpCkitbtNycQv 9HIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=F1JiIZfh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k5-20020a63ba05000000b00434df5a8524si375421pgf.396.2022.10.24.12.46.29; Mon, 24 Oct 2022 12:46:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=F1JiIZfh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233354AbiJXTkv (ORCPT + 99 others); Mon, 24 Oct 2022 15:40:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233316AbiJXTkM (ORCPT ); Mon, 24 Oct 2022 15:40:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CB536A48B; Mon, 24 Oct 2022 11:10:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A45B3B8117D; Mon, 24 Oct 2022 11:48:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B17EC433C1; Mon, 24 Oct 2022 11:48:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612125; bh=TaOMZ641qK5g+ToI/uLs8Ny1TZ131P0sMACZ7/5HZuc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F1JiIZfhPA2oQcXKMXgAphIqMxsJLvQXM7vGMsGGjC3JZBmDaASGO9/SXIa+iPlRy Gu7pzhWPrB1UgjW8XW0LBnVdFsbTpNPvTW23gJWj/0L9Xi7G9QEiYGJ59EeC9p1UKm 9+t+amYbNJmeLBE/lO/UvKKmIrwzkUqeakoYRkBQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Moore , Stephen Smalley , Eric Paris , selinux@vger.kernel.org Subject: [PATCH 4.14 080/210] selinux: use "grep -E" instead of "egrep" Date: Mon, 24 Oct 2022 13:29:57 +0200 Message-Id: <20221024112959.656887511@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747599549273008208?= X-GMAIL-MSGID: =?utf-8?q?1747599549273008208?= From: Greg Kroah-Hartman commit c969bb8dbaf2f3628927eae73e7c579a74cf1b6e upstream. The latest version of grep claims that egrep is now obsolete so the build now contains warnings that look like: egrep: warning: egrep is obsolescent; using grep -E fix this by using "grep -E" instead. Cc: Paul Moore Cc: Stephen Smalley Cc: Eric Paris Cc: selinux@vger.kernel.org Signed-off-by: Greg Kroah-Hartman [PM: tweak to remove vdso reference, cleanup subj line] Signed-off-by: Paul Moore Signed-off-by: Greg Kroah-Hartman --- scripts/selinux/install_policy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/scripts/selinux/install_policy.sh +++ b/scripts/selinux/install_policy.sh @@ -57,7 +57,7 @@ fi cd /etc/selinux/dummy/contexts/files $SF file_contexts / -mounts=`cat /proc/$$/mounts | egrep "ext2|ext3|xfs|jfs|ext4|ext4dev|gfs2" | awk '{ print $2 '}` +mounts=`cat /proc/$$/mounts | grep -E "ext2|ext3|xfs|jfs|ext4|ext4dev|gfs2" | awk '{ print $2 '}` $SF file_contexts $mounts From patchwork Mon Oct 24 11:29:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8738 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp424044wru; Mon, 24 Oct 2022 05:26:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7+VevfFrftPf7aueXH17KV8/o/qPA+BZVmbAiBbq5/TyKRHg6xAxVfIq+pMIWVwW4Oamm/ X-Received: by 2002:a17:90b:4f45:b0:20d:3282:e5e0 with SMTP id pj5-20020a17090b4f4500b0020d3282e5e0mr38565194pjb.8.1666614379971; Mon, 24 Oct 2022 05:26:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614379; cv=none; d=google.com; s=arc-20160816; b=e4yVgjjdkBhUwL/DArfj9s7xdTHR23cI0HoPXZ5dBwxSDun0LkfmpBy23Km6QP1h4K t1Raq2y33ZdaxI45qvG0Z1INIjFZpnzentmMzYwdV1l1eIGbPIdZLuStAQE4mSfEO7DW Mbg7UlT0SfL+mkYq8lNU+FW6neZrJS0JwROnXpStQe/hjFHBRXiVNzd6RPCKwVVxeww3 wvI2Gz6QrfpKlmNO12+pDB+uvapb3Fqp/TGNdCCSIWsKT8w1Nu8P247Eics/UG3weQmh h7rWjkVfjwTvil1YTCF7Ripy4fb6Kq6yrarqHFrzKJMGydGArUjceCBGYJfWDPy8cy8I rdsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7yQYpIc1Abw9/JFLTKaHE9tT7FXjE8gCWTJBHzbDwYw=; b=KaWwNXWbsZOSgyM4ZbLwHwpsSKUTRNC+XP4Aay8jheVcS7xchOljOG8DkfuQpGWzbP EbuOG5wgcpXUqxQVCkGXI+QczaKllcZFxcGjhWMbi1aU8HNS9YcnVpkPE25s5o8SlILm G0+l4NSOfGQwAqBl3DCJOqar3sKQWilT/+5nRWc+7gZHGr0Zq3jTmrKD0Xl5pkD8U0Va 3dh9mX5rc4nCxM3y4hbKap2ggpJJfqakHVJJ05ISWjGOmxAJERLz4CdRYZkl90UqyQp0 wLPNoCTrSDsx6Fe4q+zInyrlSJM4eid7x75qFn1ks82OwQcP1RomShbk/jy14Pkc2i+Y iQ1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="p/QdONgU"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fh24-20020a17090b035800b00212dc2e1abesi8506477pjb.47.2022.10.24.05.26.06; Mon, 24 Oct 2022 05:26:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="p/QdONgU"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230179AbiJXMZk (ORCPT + 99 others); Mon, 24 Oct 2022 08:25:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233744AbiJXMYL (ORCPT ); Mon, 24 Oct 2022 08:24:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF3BC44575; Mon, 24 Oct 2022 05:00:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 912CB6121A; Mon, 24 Oct 2022 11:48:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A138FC433C1; Mon, 24 Oct 2022 11:48:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612128; bh=zyn4n4h+hCJZVFeLUjY46IkKRhJ1R1o5FUAeIwX4jUQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p/QdONgUSjEp4tkelSgNvYdRZo8YFIKGFU2nS/JIlC42Y5O6FAwkDh3dyrFH9yr5P rOQL16i4BpfL6OokJXYfdUmqwksOV+qD1R//jtTjM93EIOk9G80scNfHGMH/aihnWB 5u/JRtXBpTPqawBVfET/eh4SYtzSpOQ9bB059T7c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yoshinori Sato , Rich Felker , linux-sh@vger.kernel.org, Geert Uytterhoeven , Geert Uytterhoeven , "Gustavo A. R. Silva" , Kees Cook , Sasha Levin Subject: [PATCH 4.14 081/210] sh: machvec: Use char[] for section boundaries Date: Mon, 24 Oct 2022 13:29:58 +0200 Message-Id: <20221024112959.690828237@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571840012471100?= X-GMAIL-MSGID: =?utf-8?q?1747571840012471100?= From: Kees Cook [ Upstream commit c5783af354688b24abd359f7086c282ec74de993 ] As done for other sections, define the extern as a character array, which relaxes many of the compiler-time object size checks, which would otherwise assume it's a single long. Solves the following build error: arch/sh/kernel/machvec.c: error: array subscript 'struct sh_machine_vector[0]' is partly outside array bounds of 'long int[1]' [-Werror=array-bounds]: => 105:33 Cc: Yoshinori Sato Cc: Rich Felker Cc: linux-sh@vger.kernel.org Reported-by: Geert Uytterhoeven Link: https://lore.kernel.org/lkml/alpine.DEB.2.22.394.2209050944290.964530@ramsan.of.borg/ Fixes: 9655ad03af2d ("sh: Fixup machvec support.") Reviewed-by: Geert Uytterhoeven Reviewed-by: Gustavo A. R. Silva Acked-by: Rich Felker Signed-off-by: Kees Cook Signed-off-by: Sasha Levin --- arch/sh/include/asm/sections.h | 2 +- arch/sh/kernel/machvec.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/sh/include/asm/sections.h b/arch/sh/include/asm/sections.h index 8edb824049b9..0cb0ca149ac3 100644 --- a/arch/sh/include/asm/sections.h +++ b/arch/sh/include/asm/sections.h @@ -4,7 +4,7 @@ #include -extern long __machvec_start, __machvec_end; +extern char __machvec_start[], __machvec_end[]; extern char __uncached_start, __uncached_end; extern char __start_eh_frame[], __stop_eh_frame[]; diff --git a/arch/sh/kernel/machvec.c b/arch/sh/kernel/machvec.c index ec05f491c347..a9f797a76e7c 100644 --- a/arch/sh/kernel/machvec.c +++ b/arch/sh/kernel/machvec.c @@ -22,8 +22,8 @@ #define MV_NAME_SIZE 32 #define for_each_mv(mv) \ - for ((mv) = (struct sh_machine_vector *)&__machvec_start; \ - (mv) && (unsigned long)(mv) < (unsigned long)&__machvec_end; \ + for ((mv) = (struct sh_machine_vector *)__machvec_start; \ + (mv) && (unsigned long)(mv) < (unsigned long)__machvec_end; \ (mv)++) static struct sh_machine_vector * __init get_mv_byname(const char *name) @@ -89,8 +89,8 @@ void __init sh_mv_setup(void) if (!machvec_selected) { unsigned long machvec_size; - machvec_size = ((unsigned long)&__machvec_end - - (unsigned long)&__machvec_start); + machvec_size = ((unsigned long)__machvec_end - + (unsigned long)__machvec_start); /* * Sanity check for machvec section alignment. Ensure @@ -104,7 +104,7 @@ void __init sh_mv_setup(void) * vector (usually the only one) from .machvec.init. */ if (machvec_size >= sizeof(struct sh_machine_vector)) - sh_mv = *(struct sh_machine_vector *)&__machvec_start; + sh_mv = *(struct sh_machine_vector *)__machvec_start; } printk(KERN_NOTICE "Booting machvec: %s\n", get_system_type()); From patchwork Mon Oct 24 11:29:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8577 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp418279wru; Mon, 24 Oct 2022 05:14:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7vQ9Hn1/xbQEIBE0wZVpWWqfPecM6dowFcZp9GK6RIHLpCxDwpYDkjCqopGxC7cOBNNyoY X-Received: by 2002:a17:907:84a:b0:733:735:2b1a with SMTP id ww10-20020a170907084a00b0073307352b1amr27416452ejb.290.1666613661856; Mon, 24 Oct 2022 05:14:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613661; cv=none; d=google.com; s=arc-20160816; b=LErjxibHSARgvelrWX7SmQcdlX8IC3S+ONcT4e0PqqvxXagRLrggYGRvSoB0qbHVl/ i5O9r0yuRZFblOBWWQeFNL1r6ZZyHp+SBgjKPqxqdmX/ZLjmzF3bPoSCuPaBcovJVRAa rpZ5bp95P50HHQhXzg+IZGb4PnlUu2GuHLlh7zpPq+5K0+t9HsLW2a2tz3os6J1gMWIQ cPRlno8dsN7SzaGCq2dzywzsNKZzV/EemMeBYT7BZS0Q5R6tSRrAiXhlk0A7EfU5nsZt Xb501IjxgUQsmHt/pVlPhQ58Hur9Q+bM7cOVFHakQMACVXntYSfRJxqty7C1XPsGmw43 i94w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RxHjAaNC4L4VAaTGScXrGXPdaSk0k9WuwkE85tCeKp4=; b=CuDIsm/sc7PPETaIZbviFTEA/GYjObVYqmps+68NcRNJQlakz7jgHR/QliwBLjOt/+ KFQdCmrgN+bvrGBjtHOWhxPfvYxaDo0aZt+fOkgp2uL7f9rmVNYFuuH0kmIQxXH7Hq/C 3jjauXG+GWGwNxrw9N+0hZV0Rn2qpDS3kaP+nlWte5UYGTf3OILV3xdcxeXnHC8zJa5y zxy5Xp0u5zvcGdPn6iNvFXfwN1YnSNE5fDQ4ePpppEyZsxbkhx7m1OZ2vkA0xfX2j5cy tMZGOXXuLfzjoGqeVm9xbOn1IGEuLhVLJ40ksvIHF7lhJbqzMNM6el3VE/NBb8TaEP4u 7tqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=H0Xs1mmJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i13-20020a1709064fcd00b00780def41dc4si29683608ejw.527.2022.10.24.05.13.57; Mon, 24 Oct 2022 05:14:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=H0Xs1mmJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232624AbiJXMGG (ORCPT + 99 others); Mon, 24 Oct 2022 08:06:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232658AbiJXMEB (ORCPT ); Mon, 24 Oct 2022 08:04:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FFDE5806A; Mon, 24 Oct 2022 04:50:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DB427B811AC; Mon, 24 Oct 2022 11:48:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42192C433D7; Mon, 24 Oct 2022 11:48:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612130; bh=M57LnuYz2xWTGZd0xqi/KXd5WrYvBUKJYvOGy9XaiMc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H0Xs1mmJSGHVe+UTuLXUj0UcNUYGgwbwQ4f+seUSP1MbfmTf1lOI9JLvkXNtGskgw CqdOe+XNyppntQs0KxFlQ4mqMOW8bYwmxzYp3jnfchRl8gi1tTDrF9kwilXAYuNNvW +RUJhAVyoIAoZiu5qHHhBOWdXZ6ElG8a7DGnkUnM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wen Gong , Kalle Valo , Sasha Levin Subject: [PATCH 4.14 082/210] wifi: ath10k: add peer map clean up for peer delete in ath10k_sta_state() Date: Mon, 24 Oct 2022 13:29:59 +0200 Message-Id: <20221024112959.721003890@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571087288441019?= X-GMAIL-MSGID: =?utf-8?q?1747571087288441019?= From: Wen Gong [ Upstream commit f020d9570a04df0762a2ac5c50cf1d8c511c9164 ] When peer delete failed in a disconnect operation, use-after-free detected by KFENCE in below log. It is because for each vdev_id and address, it has only one struct ath10k_peer, it is allocated in ath10k_peer_map_event(). When connected to an AP, it has more than one HTT_T2H_MSG_TYPE_PEER_MAP reported from firmware, then the array peer_map of struct ath10k will be set muti-elements to the same ath10k_peer in ath10k_peer_map_event(). When peer delete failed in ath10k_sta_state(), the ath10k_peer will be free for the 1st peer id in array peer_map of struct ath10k, and then use-after-free happened for the 2nd peer id because they map to the same ath10k_peer. And clean up all peers in array peer_map for the ath10k_peer, then user-after-free disappeared peer map event log: [ 306.911021] wlan0: authenticate with b0:2a:43:e6:75:0e [ 306.957187] ath10k_pci 0000:01:00.0: mac vdev 0 peer create b0:2a:43:e6:75:0e (new sta) sta 1 / 32 peer 1 / 33 [ 306.957395] ath10k_pci 0000:01:00.0: htt peer map vdev 0 peer b0:2a:43:e6:75:0e id 246 [ 306.957404] ath10k_pci 0000:01:00.0: htt peer map vdev 0 peer b0:2a:43:e6:75:0e id 198 [ 306.986924] ath10k_pci 0000:01:00.0: htt peer map vdev 0 peer b0:2a:43:e6:75:0e id 166 peer unmap event log: [ 435.715691] wlan0: deauthenticating from b0:2a:43:e6:75:0e by local choice (Reason: 3=DEAUTH_LEAVING) [ 435.716802] ath10k_pci 0000:01:00.0: mac vdev 0 peer delete b0:2a:43:e6:75:0e sta ffff990e0e9c2b50 (sta gone) [ 435.717177] ath10k_pci 0000:01:00.0: htt peer unmap vdev 0 peer b0:2a:43:e6:75:0e id 246 [ 435.717186] ath10k_pci 0000:01:00.0: htt peer unmap vdev 0 peer b0:2a:43:e6:75:0e id 198 [ 435.717193] ath10k_pci 0000:01:00.0: htt peer unmap vdev 0 peer b0:2a:43:e6:75:0e id 166 use-after-free log: [21705.888627] wlan0: deauthenticating from d0:76:8f:82:be:75 by local choice (Reason: 3=DEAUTH_LEAVING) [21713.799910] ath10k_pci 0000:01:00.0: failed to delete peer d0:76:8f:82:be:75 for vdev 0: -110 [21713.799925] ath10k_pci 0000:01:00.0: found sta peer d0:76:8f:82:be:75 (ptr 0000000000000000 id 102) entry on vdev 0 after it was supposedly removed [21713.799968] ================================================================== [21713.799991] BUG: KFENCE: use-after-free read in ath10k_sta_state+0x265/0xb8a [ath10k_core] [21713.799991] [21713.799997] Use-after-free read at 0x00000000abe1c75e (in kfence-#69): [21713.800010] ath10k_sta_state+0x265/0xb8a [ath10k_core] [21713.800041] drv_sta_state+0x115/0x677 [mac80211] [21713.800059] __sta_info_destroy_part2+0xb1/0x133 [mac80211] [21713.800076] __sta_info_flush+0x11d/0x162 [mac80211] [21713.800093] ieee80211_set_disassoc+0x12d/0x2f4 [mac80211] [21713.800110] ieee80211_mgd_deauth+0x26c/0x29b [mac80211] [21713.800137] cfg80211_mlme_deauth+0x13f/0x1bb [cfg80211] [21713.800153] nl80211_deauthenticate+0xf8/0x121 [cfg80211] [21713.800161] genl_rcv_msg+0x38e/0x3be [21713.800166] netlink_rcv_skb+0x89/0xf7 [21713.800171] genl_rcv+0x28/0x36 [21713.800176] netlink_unicast+0x179/0x24b [21713.800181] netlink_sendmsg+0x3a0/0x40e [21713.800187] sock_sendmsg+0x72/0x76 [21713.800192] ____sys_sendmsg+0x16d/0x1e3 [21713.800196] ___sys_sendmsg+0x95/0xd1 [21713.800200] __sys_sendmsg+0x85/0xbf [21713.800205] do_syscall_64+0x43/0x55 [21713.800210] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [21713.800213] [21713.800219] kfence-#69: 0x000000009149b0d5-0x000000004c0697fb, size=1064, cache=kmalloc-2k [21713.800219] [21713.800224] allocated by task 13 on cpu 0 at 21705.501373s: [21713.800241] ath10k_peer_map_event+0x7e/0x154 [ath10k_core] [21713.800254] ath10k_htt_t2h_msg_handler+0x586/0x1039 [ath10k_core] [21713.800265] ath10k_htt_htc_t2h_msg_handler+0x12/0x28 [ath10k_core] [21713.800277] ath10k_htc_rx_completion_handler+0x14c/0x1b5 [ath10k_core] [21713.800283] ath10k_pci_process_rx_cb+0x195/0x1df [ath10k_pci] [21713.800294] ath10k_ce_per_engine_service+0x55/0x74 [ath10k_core] [21713.800305] ath10k_ce_per_engine_service_any+0x76/0x84 [ath10k_core] [21713.800310] ath10k_pci_napi_poll+0x49/0x144 [ath10k_pci] [21713.800316] net_rx_action+0xdc/0x361 [21713.800320] __do_softirq+0x163/0x29a [21713.800325] asm_call_irq_on_stack+0x12/0x20 [21713.800331] do_softirq_own_stack+0x3c/0x48 [21713.800337] __irq_exit_rcu+0x9b/0x9d [21713.800342] common_interrupt+0xc9/0x14d [21713.800346] asm_common_interrupt+0x1e/0x40 [21713.800351] ksoftirqd_should_run+0x5/0x16 [21713.800357] smpboot_thread_fn+0x148/0x211 [21713.800362] kthread+0x150/0x15f [21713.800367] ret_from_fork+0x22/0x30 [21713.800370] [21713.800374] freed by task 708 on cpu 1 at 21713.799953s: [21713.800498] ath10k_sta_state+0x2c6/0xb8a [ath10k_core] [21713.800515] drv_sta_state+0x115/0x677 [mac80211] [21713.800532] __sta_info_destroy_part2+0xb1/0x133 [mac80211] [21713.800548] __sta_info_flush+0x11d/0x162 [mac80211] [21713.800565] ieee80211_set_disassoc+0x12d/0x2f4 [mac80211] [21713.800581] ieee80211_mgd_deauth+0x26c/0x29b [mac80211] [21713.800598] cfg80211_mlme_deauth+0x13f/0x1bb [cfg80211] [21713.800614] nl80211_deauthenticate+0xf8/0x121 [cfg80211] [21713.800619] genl_rcv_msg+0x38e/0x3be [21713.800623] netlink_rcv_skb+0x89/0xf7 [21713.800628] genl_rcv+0x28/0x36 [21713.800632] netlink_unicast+0x179/0x24b [21713.800637] netlink_sendmsg+0x3a0/0x40e [21713.800642] sock_sendmsg+0x72/0x76 [21713.800646] ____sys_sendmsg+0x16d/0x1e3 [21713.800651] ___sys_sendmsg+0x95/0xd1 [21713.800655] __sys_sendmsg+0x85/0xbf [21713.800659] do_syscall_64+0x43/0x55 [21713.800663] entry_SYSCALL_64_after_hwframe+0x44/0xa9 Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00288-QCARMSWPZ-1 Fixes: d0eeafad1189 ("ath10k: Clean up peer when sta goes away.") Signed-off-by: Wen Gong Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220801141930.16794-1-quic_wgong@quicinc.com Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath10k/mac.c | 54 ++++++++++++++------------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 41ae999c685b..49e2bfc85f1a 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -806,11 +806,36 @@ static int ath10k_peer_delete(struct ath10k *ar, u32 vdev_id, const u8 *addr) return 0; } +static void ath10k_peer_map_cleanup(struct ath10k *ar, struct ath10k_peer *peer) +{ + int peer_id, i; + + lockdep_assert_held(&ar->conf_mutex); + + for_each_set_bit(peer_id, peer->peer_ids, + ATH10K_MAX_NUM_PEER_IDS) { + ar->peer_map[peer_id] = NULL; + } + + /* Double check that peer is properly un-referenced from + * the peer_map + */ + for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) { + if (ar->peer_map[i] == peer) { + ath10k_warn(ar, "removing stale peer_map entry for %pM (ptr %pK idx %d)\n", + peer->addr, peer, i); + ar->peer_map[i] = NULL; + } + } + + list_del(&peer->list); + kfree(peer); + ar->num_peers--; +} + static void ath10k_peer_cleanup(struct ath10k *ar, u32 vdev_id) { struct ath10k_peer *peer, *tmp; - int peer_id; - int i; lockdep_assert_held(&ar->conf_mutex); @@ -822,25 +847,7 @@ static void ath10k_peer_cleanup(struct ath10k *ar, u32 vdev_id) ath10k_warn(ar, "removing stale peer %pM from vdev_id %d\n", peer->addr, vdev_id); - for_each_set_bit(peer_id, peer->peer_ids, - ATH10K_MAX_NUM_PEER_IDS) { - ar->peer_map[peer_id] = NULL; - } - - /* Double check that peer is properly un-referenced from - * the peer_map - */ - for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) { - if (ar->peer_map[i] == peer) { - ath10k_warn(ar, "removing stale peer_map entry for %pM (ptr %pK idx %d)\n", - peer->addr, peer, i); - ar->peer_map[i] = NULL; - } - } - - list_del(&peer->list); - kfree(peer); - ar->num_peers--; + ath10k_peer_map_cleanup(ar, peer); } spin_unlock_bh(&ar->data_lock); } @@ -6232,10 +6239,7 @@ static int ath10k_sta_state(struct ieee80211_hw *hw, /* Clean up the peer object as well since we * must have failed to do this above. */ - list_del(&peer->list); - ar->peer_map[i] = NULL; - kfree(peer); - ar->num_peers--; + ath10k_peer_map_cleanup(ar, peer); } } spin_unlock_bh(&ar->data_lock); From patchwork Mon Oct 24 11:30:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8715 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp423208wru; Mon, 24 Oct 2022 05:24:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4IHIQgnf78V09cuzecphOB2YDGwVhem8ZOb+KRG8iyRmMOS9igzdhsAOJmj+jZGj+37eL7 X-Received: by 2002:a17:902:900a:b0:178:77c7:aa28 with SMTP id a10-20020a170902900a00b0017877c7aa28mr32730081plp.3.1666614250072; Mon, 24 Oct 2022 05:24:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614250; cv=none; d=google.com; s=arc-20160816; b=WCcyKquKiuvojA+dxokjOO5BIakiVpiHGhUTBK+DS3SSX8G0416ae/DQWo9hM5OFqx QDxO30Q5Yq4XdgiMQYj7h+ztMTstYTJ0XXx0URV/ZmQO6rBLhGi+ZqlTprBBo3XN4rTh KMXMPGIyIr0lK/XXe6ICGruqz5M3WGV8cdvf8u0Rt1zQ37SPWRGXpDobWBGv8mReqOuL 0k3lQf2xW57eXW/563z95eBAHZ4fy9Q/S/k4Uedw7tQc6E+gB2Jx6PZSeNW1UjbikZts jIjTe/a3IoJ8Vwsed0ORGarBRXvURrEVgV0c8LA/3Gh/dhC1h6tWN4qcuA+yGpNsrspl MBag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BmjIE5B3zfGI2+D8S32mnLQmCYzGBjIIoY51wfkFBaA=; b=ufVkyLYERxaJdamYewGJ/9gAUYov+sC0JDr6dGVN/tWoliAvLGtyWVAfxS2h6sBVel glz96J0xvOK17PlkbHrIaUcV8493k+I4mzlobqJbLCFSLh5MGLEG1zdOb17t+VXQe1lL 4LVYJTqFgydZBI6dbn4s2lrjZ6YGX+WQBFSu/0rKMTACTCEubNFSASdU2N/jfB1FeNsX wueAvIyf1FSydB7b+vNLJ8B9j0Vx0XKhHEAAg2ZchSzPyHgsCgQI2KkkLk2zygTVM04X c36AQpiCSLeXv6fIEqqa/kvQe1nyYsvf7YgpV8uyvkJEzYgTuGnoLba3LE4jjLBgCVKp mkYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eJdFmILx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q14-20020a17090311ce00b001789fa8f90esi40284293plh.408.2022.10.24.05.23.54; Mon, 24 Oct 2022 05:24:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eJdFmILx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233313AbiJXMWi (ORCPT + 99 others); Mon, 24 Oct 2022 08:22:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233136AbiJXMUE (ORCPT ); Mon, 24 Oct 2022 08:20:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44FBE8321F; Mon, 24 Oct 2022 04:58:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 020C36125A; Mon, 24 Oct 2022 11:48:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14123C433D7; Mon, 24 Oct 2022 11:48:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612133; bh=eLN93t/jveBM8FxvP6yV878dqRgau5Ybg1+Lv+R+Zrw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eJdFmILxeNuzmYXZZ+Ch4+giV+slpHXjMjzukX2taiWEIEyEIGfIwpI+YfoV1+aLp SNEXc+1fKYEfCGrHC64V0kgXlrThyfZymUGbgPDbinWgUR1lFTO5rz6qpP+QmXWljx zLSwSlJAEzm5o954qdgdByG4t2qBV4OmupfPm1kI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hari Chandrakanthan , Johannes Berg , Sasha Levin Subject: [PATCH 4.14 083/210] wifi: mac80211: allow bw change during channel switch in mesh Date: Mon, 24 Oct 2022 13:30:00 +0200 Message-Id: <20221024112959.750786437@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571704194540568?= X-GMAIL-MSGID: =?utf-8?q?1747571704194540568?= From: Hari Chandrakanthan [ Upstream commit 6b75f133fe05c36c52d691ff21545d5757fff721 ] >From 'IEEE Std 802.11-2020 section 11.8.8.4.1': The mesh channel switch may be triggered by the need to avoid interference to a detected radar signal, or to reassign mesh STA channels to ensure the MBSS connectivity. A 20/40 MHz MBSS may be changed to a 20 MHz MBSS and a 20 MHz MBSS may be changed to a 20/40 MHz MBSS. Since the standard allows the change of bandwidth during the channel switch in mesh, remove the bandwidth check present in ieee80211_set_csa_beacon. Fixes: c6da674aff94 ("{nl,cfg,mac}80211: enable the triggering of CSA frame in mesh") Signed-off-by: Hari Chandrakanthan Link: https://lore.kernel.org/r/1658903549-21218-1-git-send-email-quic_haric@quicinc.com Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/mac80211/cfg.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index f769b08e6f2a..94293b57f1b2 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -3111,9 +3111,6 @@ static int ieee80211_set_csa_beacon(struct ieee80211_sub_if_data *sdata, case NL80211_IFTYPE_MESH_POINT: { struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; - if (params->chandef.width != sdata->vif.bss_conf.chandef.width) - return -EINVAL; - /* changes into another band are not supported */ if (sdata->vif.bss_conf.chandef.chan->band != params->chandef.chan->band) From patchwork Mon Oct 24 11:30:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8578 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp418305wru; Mon, 24 Oct 2022 05:14:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Hyyg5utx7MV5O8yfQ0AmfGdrt0Nrmq9VbUODdXyqNr7qYQkL/Gy7hNqb4Qnn2RbTGc+Zd X-Received: by 2002:a17:906:fe45:b0:791:9624:9ea5 with SMTP id wz5-20020a170906fe4500b0079196249ea5mr27965797ejb.282.1666613663820; Mon, 24 Oct 2022 05:14:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613663; cv=none; d=google.com; s=arc-20160816; b=FrS3O7jlxbrNIJFwfEylgkzaKoCtMiekZC04R9BgflB2GAjs7IjCHKlSFqagyMtucQ tHIITKOjXA+LX+BECivDSLPnrvuQF702j2lbw6ju2THRFfKayUzazgSx4x4AJLUlEaMN WtlxW9y64onRsc2TDkOukTtP6HEq9exsh1gXJVE4tur7ko1QYpBdW48fRSfnZoJkhtnE yVo8wKgEKRiHJydF6kbdfdnk6SYo4enw4Nq57YNwg3KmMoEAZyFYnViyowePkPF9zNdL qDpe9NMhubLnGTga8VAc7cZ6crFw6hmW5SE4Y5/gZGdT8avIHf6EXwuNVnzDWPbuFSfM B+Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DR7MtDbi0kG92JDp7zcID920Q3LKMSKywWl2Z84UB6M=; b=mUVneENc87FD3XBSFi/iIcn3KKkopV/YXfY7bUbidZBmcCTFARQuF2VxhD0ng11C1i R+fZunKBFSE5GugI//E/O7X/RwAnQm0P/CpXceytLaNpeQaErlVxURlsq5kg6uxstHeP CBPt8frYNIsbnjjdOBkUiImkxDUM7J7quJ0LA67CTdsCbsD5Wk1N6jg/DWBlAbXtrTdz /+A+OqCeemgIGsaiS+eXIVI3EsXlu9tGm6NjpiPbvUer4Sje7dsQKhMLTxl/DIIzSiYu zPwVdThEeDKx21mUuVqYJxKbZQ564ZQrmJW21/+UV9rYsX06AnimbL3tmOv555vNWzzR ZRDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RIoaaeJv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xc13-20020a170907074d00b007a0f4d6bf83si7122890ejb.305.2022.10.24.05.13.59; Mon, 24 Oct 2022 05:14:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RIoaaeJv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232560AbiJXMDF (ORCPT + 99 others); Mon, 24 Oct 2022 08:03:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232797AbiJXL7y (ORCPT ); Mon, 24 Oct 2022 07:59:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEA6D7C32C; Mon, 24 Oct 2022 04:48:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 90D4A61218; Mon, 24 Oct 2022 11:48:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4EFDC433C1; Mon, 24 Oct 2022 11:48:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612136; bh=imA00XoB1QibGoVcRmf2HbsfpTiVfj/6N8ZW4ewYQOc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RIoaaeJvQm8+wEVC0A64vux79lGAFWdYbk19XdVRNqZWSTjedhP+BzH3rRO2F+MKr ODeNn95JzJLzRmEfRXhw4WoJebRoJmQor7FVSsHAE9MvAndyoM2N25VoF+zVKztlqV cNFy1dKE2Vf+4AeQDLBK/gOxZoBWXK9EA9TES44E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Jes Sorensen , Kalle Valo , Sasha Levin Subject: [PATCH 4.14 084/210] wifi: rtl8xxxu: tighten bounds checking in rtl8xxxu_read_efuse() Date: Mon, 24 Oct 2022 13:30:01 +0200 Message-Id: <20221024112959.780851591@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571089097198737?= X-GMAIL-MSGID: =?utf-8?q?1747571089097198737?= From: Dan Carpenter [ Upstream commit 620d5eaeb9059636864bda83ca1c68c20ede34a5 ] There some bounds checking to ensure that "map_addr" is not out of bounds before the start of the loop. But the checking needs to be done as we iterate through the loop because "map_addr" gets larger as we iterate. Fixes: 26f1fad29ad9 ("New driver: rtl8xxxu (mac80211)") Signed-off-by: Dan Carpenter Acked-by: Jes Sorensen Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/Yv8eGLdBslLAk3Ct@kili Signed-off-by: Sasha Levin --- .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index 5cf61710ae2f..5588518daa96 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -1879,13 +1879,6 @@ static int rtl8xxxu_read_efuse(struct rtl8xxxu_priv *priv) /* We have 8 bits to indicate validity */ map_addr = offset * 8; - if (map_addr >= EFUSE_MAP_LEN) { - dev_warn(dev, "%s: Illegal map_addr (%04x), " - "efuse corrupt!\n", - __func__, map_addr); - ret = -EINVAL; - goto exit; - } for (i = 0; i < EFUSE_MAX_WORD_UNIT; i++) { /* Check word enable condition in the section */ if (word_mask & BIT(i)) { @@ -1896,6 +1889,13 @@ static int rtl8xxxu_read_efuse(struct rtl8xxxu_priv *priv) ret = rtl8xxxu_read_efuse8(priv, efuse_addr++, &val8); if (ret) goto exit; + if (map_addr >= EFUSE_MAP_LEN - 1) { + dev_warn(dev, "%s: Illegal map_addr (%04x), " + "efuse corrupt!\n", + __func__, map_addr); + ret = -EINVAL; + goto exit; + } priv->efuse_wifi.raw[map_addr++] = val8; ret = rtl8xxxu_read_efuse8(priv, efuse_addr++, &val8); From patchwork Mon Oct 24 11:30:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8579 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419091wru; Mon, 24 Oct 2022 05:15:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6QpBV8mvdFBo7HxGG47cy44fTaOapTrdewQTn3OjCt7kLXAZnY4dz1HiTNHrVIEQHLScFu X-Received: by 2002:a17:906:5a5b:b0:7a6:cbc7:4ca1 with SMTP id my27-20020a1709065a5b00b007a6cbc74ca1mr5220746ejc.544.1666613744932; Mon, 24 Oct 2022 05:15:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613744; cv=none; d=google.com; s=arc-20160816; b=SFOC31wraxJZqQeelOSVgJBI/fnUhfDRwUvfEkqI63wQrU+qUDgO1euhrSa8iQJ7Uh YpwjtE+X6q612+njNGWtMJMug967feEr9CjpsoVWhsnyYlxOx30067mRb9qezc4lIUBA oWxCyc+1wsMDBLr5SQYL1xHqGuO4VFgkYSOzQ1Yz9Cou2KIZWaKI7ibriI2ld5qCyWhd 9NUsBdFppE5+M1/cx1VyhLvZFWMbA3ul7sTsIlFZq0SWXF3B7brFDeXAS31Bzy/sIv+K 4hmF3D2Rld3zmNLCzZLDv61QmS3K5N3GQFLi9qHN2tFaSRyerm1Z5jRwQjIp61SzN6WU ULmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ltioo1cUxSjO/ajzzZRy7JIKD/bLDfSkewSjDzNolrg=; b=VJJ/BjnFHfFKJAVuOiQjJE61Ek5bPiDsmC8ekMbfLkmTJUGPSlJGDvkHNIwrmFZcMB tp/b55g1Z205Kli5SeOhSLsYCvnpbsd4Ke85FT3OABdFJQnsW09WxOPWauM0BTWaBoYr od58xCi+HqH4z2nBZRmdAt3m0V8kwXVh0Gg8s9XMwEIIL1y0Ewnul95yaTqUfpV2oIZB Juk1UJHg21kOFvyxHzSzxA5tt0k7ENPfPdiEpIsXrj6b7ej/UzCeHOlcWCYaojuH3VTJ lO6Sd+1QNLYI3Pf+JtCLHkpOWHzJgqcny0uaCsUyCYow+Z93Gms4ZAsBeIaEd1pcgOgB 5NSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="M/cH+aTw"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o1-20020a50fd81000000b00461a4eb674dsi4033479edt.619.2022.10.24.05.15.21; Mon, 24 Oct 2022 05:15:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="M/cH+aTw"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232635AbiJXMGS (ORCPT + 99 others); Mon, 24 Oct 2022 08:06:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232746AbiJXMEN (ORCPT ); Mon, 24 Oct 2022 08:04:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D4FA5EDDD; Mon, 24 Oct 2022 04:50:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0F373B811B8; Mon, 24 Oct 2022 11:49:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B5E2C433C1; Mon, 24 Oct 2022 11:49:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612141; bh=yXMCTS8eONU++mGlDljHj3JlkYoORL7wIFX0W3Arlcs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M/cH+aTwEG0r1e3eM635HEYkZFFPxnjx4KK5K+g5RkKtmLqvwYlcH0WoE7Pd9X7GX k8GE0n0g4XYfMi+HKL2sTEeFnPjEtnjK4sW3wJDXGKLRmsG3/j8dhwEHeOGnsUyEqV dJC72Rgj4Nk3qM/qu0vsXLEvDW17oTKMJBBv6SiQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xu Qiang , Mark Brown , Sasha Levin Subject: [PATCH 4.14 085/210] spi: qup: add missing clk_disable_unprepare on error in spi_qup_resume() Date: Mon, 24 Oct 2022 13:30:02 +0200 Message-Id: <20221024112959.811054555@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571174154884672?= X-GMAIL-MSGID: =?utf-8?q?1747571174154884672?= From: Xu Qiang [ Upstream commit 70034320fdc597b8f58b4a43bb547f17c4c5557a ] Add the missing clk_disable_unprepare() before return from spi_qup_resume() in the error handling case. Fixes: 64ff247a978f (“spi: Add Qualcomm QUP SPI controller support”) Signed-off-by: Xu Qiang Link: https://lore.kernel.org/r/20220825065324.68446-1-xuqiang36@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-qup.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c index cb74fd1af205..c5c727274814 100644 --- a/drivers/spi/spi-qup.c +++ b/drivers/spi/spi-qup.c @@ -1219,14 +1219,25 @@ static int spi_qup_resume(struct device *device) return ret; ret = clk_prepare_enable(controller->cclk); - if (ret) + if (ret) { + clk_disable_unprepare(controller->iclk); return ret; + } ret = spi_qup_set_state(controller, QUP_STATE_RESET); if (ret) - return ret; + goto disable_clk; + + ret = spi_master_resume(master); + if (ret) + goto disable_clk; - return spi_master_resume(master); + return 0; + +disable_clk: + clk_disable_unprepare(controller->cclk); + clk_disable_unprepare(controller->iclk); + return ret; } #endif /* CONFIG_PM_SLEEP */ From patchwork Mon Oct 24 11:30:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8695 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422612wru; Mon, 24 Oct 2022 05:23:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7W7GIoPhMPfxvP5tChgyTqDCpIg+BfdaC2QOBA7yHue9GysrvMy3+HndIWPUI/VzfwL2Gp X-Received: by 2002:a17:906:8a61:b0:78d:9d00:c906 with SMTP id hy1-20020a1709068a6100b0078d9d00c906mr27379437ejc.321.1666614184659; Mon, 24 Oct 2022 05:23:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614184; cv=none; d=google.com; s=arc-20160816; b=RB6ZePGlH48ZYyYRJRQd6nUvBaTKmkRt1hCgPGd5xgfCOizubAZmObfT4CWGCMAE8n /UpFK701ohYKWyTkACVU3SqUoldOo+5+EO0S7PB2UlVOqwS18vQA4M0LoafMtYo8IO8R UAVZ8CGraxcMay+8efFYgUzPKJ+fCBwsbFk52ISN50LZgx7iUUAjgUa/oNTaSeg8BQsy rImGGgd7te0bEtPRkQzb2o9mdkzHFqCTS+PDB4cQ+IA2PUxFBnZT6nUIETgUS3cuI9bM eHql41JsyiMaAvqZD+u+przw4rgQzUAi+JD1H2lNRlcFxPv8wDa9lEsN4x0HhpX+fGqk vIdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5k5F37oYNEmCHEgQoezfMItExK0RqaWxSVY7Rl77OuQ=; b=a//YplF0HYB3fJ1npVAPhK83skUoHuBW0iDu6R6idN0eioawfuv7IZh/1w82OFu+Ln tESVdLmolf7gr3W3ycR92n7SXm4UhUCRrsFTZ8JoiXqqKNjEXNBxtCIhW7T+Xy7czGZZ dm27i7yHno2Gl9ypJqOu7wHo49ACJf3+Ws5wOXpwEUwQ6EO22HH+tnJlwmcpMmicF3W2 b9BdApV2CAFqdllW4Bi3S4iKVsNCTXWySYjTfQOXeor69LEZLtObyagfN3JIjlqrPDq1 v3sUUBLBihpf1uORKcpKVTKA9TZ/20ixYr0CybRay1NgybPSiNIcSanEY5kku8Jl384q 0pMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LNVavv5W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p11-20020a056402500b00b0045d212cc170si26235262eda.363.2022.10.24.05.22.39; Mon, 24 Oct 2022 05:23:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LNVavv5W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233426AbiJXMVr (ORCPT + 99 others); Mon, 24 Oct 2022 08:21:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233512AbiJXMTn (ORCPT ); Mon, 24 Oct 2022 08:19:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B058982D02; Mon, 24 Oct 2022 04:58:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E58E661280; Mon, 24 Oct 2022 11:49:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01680C433D6; Mon, 24 Oct 2022 11:49:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612144; bh=1dNVR3X2IySjniVZceBtGxiJ2W3mMOjlJ9Z7yNLlviY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LNVavv5WrR7OeYuLXPbo6uypjWfDIxZvKbTBq/6ik0/cX6Ex2Vx8ukiaaYECcKKUV ZUBfLTCOnd/mkirCHLEHZ+9h5ypg7hZAKb6mGIRfNaON6oE4GQ/IPtR/wTzkLUF/5w Hfy2PlbweD/FyzDzlrHoTyuWTit0Q1JoZhWYKFjA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xu Qiang , Mark Brown , Sasha Levin Subject: [PATCH 4.14 086/210] spi: qup: add missing clk_disable_unprepare on error in spi_qup_pm_resume_runtime() Date: Mon, 24 Oct 2022 13:30:03 +0200 Message-Id: <20221024112959.840946811@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571635136974958?= X-GMAIL-MSGID: =?utf-8?q?1747571635136974958?= From: Xu Qiang [ Upstream commit 494a22765ce479c9f8ad181c5d24cffda9f534bb ] Add the missing clk_disable_unprepare() before return from spi_qup_pm_resume_runtime() in the error handling case. Fixes: dae1a7700b34 (“spi: qup: Handle clocks in pm_runtime suspend and resume”) Signed-off-by: Xu Qiang Link: https://lore.kernel.org/r/20220825065324.68446-2-xuqiang36@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-qup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c index c5c727274814..1ca678bcb527 100644 --- a/drivers/spi/spi-qup.c +++ b/drivers/spi/spi-qup.c @@ -1172,8 +1172,10 @@ static int spi_qup_pm_resume_runtime(struct device *device) return ret; ret = clk_prepare_enable(controller->cclk); - if (ret) + if (ret) { + clk_disable_unprepare(controller->iclk); return ret; + } /* Disable clocks auto gaiting */ config = readl_relaxed(controller->base + QUP_CONFIG); From patchwork Mon Oct 24 11:30:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8588 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419226wru; Mon, 24 Oct 2022 05:15:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5zGP1OfeqdmxuRmc+zTR0Y4uFoO2PGvZ1OrHYKNsdMB2UzpdoxBB02pnP/IiQXanL8lG/n X-Received: by 2002:a17:907:16a6:b0:78e:f140:a9b9 with SMTP id hc38-20020a17090716a600b0078ef140a9b9mr27319395ejc.502.1666613745303; Mon, 24 Oct 2022 05:15:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613745; cv=none; d=google.com; s=arc-20160816; b=F2LpuGuYFEbSIq1YIC6tsHlcfcyKbIDrG2qnJAh+cJhBJp8hFMRFkD3JmLEP5vZW9Q Ed8m3F19141hgFcG73IMP1WLA44/dHuRhyr882c3k1rkLcbglYOJT5SVDm5iXMjtUPlp MUxF/1lm2zOjXoVKG1Nvn3scKF9AWpgCGRmJSVQnhhRryn9/QikzJiV7d1DBE3Li8JEZ 8vRcnPiqFau9i4jVmqfj5J977B+IhnNWssjwM+xWwN8PdXB1O3232IBwBAPIAN338qGv I7bAzyIOmCOp4YS5m9FLiSGjrnmIFebgH5pRnIMVgdWdmBVxV4C53h5x7fuA3ovi7b6u WzTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OqZXpU/JNNzmO8lPLoQt2ycvpqHHnrInzjjfk3MvQ80=; b=zt6TS6bSNhPOGO2rgreSEsMnDhkilfyYFRqNM+6d8mOtA6POruur6JQUGrm2rlj2P6 dzLULroR7UUhWQsrH2W0xy5E/ollisXiwpwpylkCm/zB055cMi43QwmEAE7SzCvG+jUp 2dFHjbhcHZAQGHtjewn+Ud6C0Wjhq+Lp21mCfFb1bCfJe6923HvOiq4jZd7nnn03tSIW PAipZnJ5zigRrnoLjioXE3CfDi72PVk7nTNTWPPewXuKZIqeBsEQMcu4W2uYXcLnmN2y /88S0SJXwWtM2YxBqogpnMN5GsU1wCx7IaKXi3T8ho7Yd2TPFfEYvTQ66hbIupmc1r52 UZ/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ES5RJg1Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qa43-20020a17090786ab00b00782b261ea1asi27258230ejc.67.2022.10.24.05.15.21; Mon, 24 Oct 2022 05:15:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ES5RJg1Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229544AbiJXMGW (ORCPT + 99 others); Mon, 24 Oct 2022 08:06:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232761AbiJXMEO (ORCPT ); Mon, 24 Oct 2022 08:04:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01BE9638EB; Mon, 24 Oct 2022 04:50:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 71FBEB811B6; Mon, 24 Oct 2022 11:49:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96ACAC433D6; Mon, 24 Oct 2022 11:49:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612147; bh=nLPJMf6RKNv0U3Go0wd8wDoSsDzpMir4BM5wySpxLXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ES5RJg1QJpie1U1TPWrNyrzqP09RGfdL4xaLTnPWH/LB4Ti93EOdsAgZKzqU7hQpY KC91oYX4xHvkdLrFvkuUFmA5dato9qBUJE9e5ckJIHalhrPyVA8SQfbbs6vPQR0EXH yKf7E5RSNpWG2VMoFqnYWw7OVD0rR4a4Uuz69C00= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bitterblue Smith , Kalle Valo , Sasha Levin Subject: [PATCH 4.14 087/210] wifi: rtl8xxxu: Fix skb misuse in TX queue selection Date: Mon, 24 Oct 2022 13:30:04 +0200 Message-Id: <20221024112959.871050235@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571174738689918?= X-GMAIL-MSGID: =?utf-8?q?1747571174738689918?= From: Bitterblue Smith [ Upstream commit edd5747aa12ed61a5ecbfa58d3908623fddbf1e8 ] rtl8xxxu_queue_select() selects the wrong TX queues because it's reading memory from the wrong address. It expects to find ieee80211_hdr at skb->data, but that's not the case after skb_push(). Move the call to rtl8xxxu_queue_select() before the call to skb_push(). Fixes: 26f1fad29ad9 ("New driver: rtl8xxxu (mac80211)") Signed-off-by: Bitterblue Smith Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/7fa4819a-4f20-b2af-b7a6-8ee01ac49295@gmail.com Signed-off-by: Sasha Levin --- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index 5588518daa96..7cace68ef3c7 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -4955,6 +4955,8 @@ static void rtl8xxxu_tx(struct ieee80211_hw *hw, if (control && control->sta) sta = control->sta; + queue = rtl8xxxu_queue_select(hw, skb); + tx_desc = skb_push(skb, tx_desc_size); memset(tx_desc, 0, tx_desc_size); @@ -4967,7 +4969,6 @@ static void rtl8xxxu_tx(struct ieee80211_hw *hw, is_broadcast_ether_addr(ieee80211_get_DA(hdr))) tx_desc->txdw0 |= TXDESC_BROADMULTICAST; - queue = rtl8xxxu_queue_select(hw, skb); tx_desc->txdw1 = cpu_to_le32(queue << TXDESC_QUEUE_SHIFT); if (tx_info->control.hw_key) { From patchwork Mon Oct 24 11:30:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8605 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419652wru; Mon, 24 Oct 2022 05:16:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7UhfqQj5XKe6WqrAHgnLtIoKXccdDW2VRO1aPfLOS68Fj1KFEo1lvFHFvYL96D8Y/27RJu X-Received: by 2002:a17:907:3e02:b0:782:1267:f2c8 with SMTP id hp2-20020a1709073e0200b007821267f2c8mr27336432ejc.585.1666613800251; Mon, 24 Oct 2022 05:16:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613800; cv=none; d=google.com; s=arc-20160816; b=W8ftfnHorUxWWK+DV2p6Yc9Mdk590oYdO33+zYUx8PDVrzlcH1shlWw05tUMgCzytU d9QYZGne6Tu1TvF7HplVwhTxaNRcQGYpvgTlG2dDJ9AmgHinY2GAo/XmbShawC/1aaop DuNNXkzQVqi/zUuGPaOlGyTxF5uLt8R8Vdxg+qyXhPQhT3kV57Wy5mVjGwvCcnXqPR2J HQZyX006fB1KCLsgOwzz1KZTVr/yXiq2KJbhDNf9C4UQFvoLP3Wo7GxU9jp4/QrjNgnl qya0YG6Ao4BK2sQxXXIpIllqNKls3aXVaXiD4bs5Q9Yc4XACDodbB+g4iEqKfYKdFnlm f0qQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4Qnfj47+QNf3DxBDgR+TVIlHZMxx2mjq8qryU69trWg=; b=J7ycnrSED4icI+MRSIA9wbljjDnFHFRv073Ch3gnaQRqD6qtIhjwMJh6EsJUaQP/OL E9TOzwl0gYpq/uHIdKwJ+oPZmCDR9lEYu+DH/PE1PRcn7dfTFiC30D9tJBCmJkjEbWLn cVx43lvrR0LLZ/DY61LAxCsBfgLnwEuv48X8rUeqzQA/05f8a/nJfGjhjuoKTmYbhGzm Lw9lDFUaKI46rX2aW7IMtJBHsLCerGxVeTzQtrbRNr2nJQtPERInbhIwyeu11c+jdK5G UWSF8r7h3BU3PzR8jkxGD4HfWmoRBAq660XvjN9YoS4387STiTwA4rwGbuVNsd/mpLvm AgAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eidavOWb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w10-20020a50d78a000000b004539b045326si27887425edi.417.2022.10.24.05.16.15; Mon, 24 Oct 2022 05:16:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eidavOWb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230457AbiJXMIX (ORCPT + 99 others); Mon, 24 Oct 2022 08:08:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232646AbiJXMGY (ORCPT ); Mon, 24 Oct 2022 08:06:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E15817CE3C; Mon, 24 Oct 2022 04:51:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4D6F161252; Mon, 24 Oct 2022 11:49:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C4CFC433C1; Mon, 24 Oct 2022 11:49:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612149; bh=7oprHukz1adrqSLylbHEoWFbiFBfSQ7jdLdNL0ESvJ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eidavOWbKMb34Fw76la0PPCthx/v5ls1hLSQ6MyfUMB0Rhx52sZlXY/I9BBDeIJCF +QqUJz0b61aq+QJaJWFJbpOThDH3WZyreIP4v3krp7QPGIB1zH4LaIBpwIgx60XVHN jeAGJ6VLfvjz7vTi4aNwnBmRDw7HPXFPqkV7452w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bitterblue Smith , Kalle Valo , Sasha Levin Subject: [PATCH 4.14 088/210] wifi: rtl8xxxu: gen2: Fix mistake in path B IQ calibration Date: Mon, 24 Oct 2022 13:30:05 +0200 Message-Id: <20221024112959.901013860@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571232398619442?= X-GMAIL-MSGID: =?utf-8?q?1747571232398619442?= From: Bitterblue Smith [ Upstream commit e963a19c64ac0d2f8785d36a27391abd91ac77aa ] Found by comparing with the vendor driver. Currently this affects only the RTL8192EU, which is the only gen2 chip with 2 TX paths supported by this driver. It's unclear what kind of effect the mistake had in practice, since I don't have any RTL8192EU devices to test it. Fixes: e1547c535ede ("rtl8xxxu: First stab at adding IQK calibration for 8723bu parts") Signed-off-by: Bitterblue Smith Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/30a59f3a-cfa9-8379-7af0-78a8f4c77cfd@gmail.com Signed-off-by: Sasha Levin --- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index 7cace68ef3c7..a287c28b38b5 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -2930,12 +2930,12 @@ bool rtl8xxxu_gen2_simularity_compare(struct rtl8xxxu_priv *priv, } if (!(simubitmap & 0x30) && priv->tx_paths > 1) { - /* path B RX OK */ + /* path B TX OK */ for (i = 4; i < 6; i++) result[3][i] = result[c1][i]; } - if (!(simubitmap & 0x30) && priv->tx_paths > 1) { + if (!(simubitmap & 0xc0) && priv->tx_paths > 1) { /* path B RX OK */ for (i = 6; i < 8; i++) result[3][i] = result[c1][i]; From patchwork Mon Oct 24 11:30:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8602 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419537wru; Mon, 24 Oct 2022 05:16:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4CSi0ltFwTrK/9wRb9ITwMhL9m3exkbDoIcLh08+/5L1+AL1GXxsZfKJOunCYl/dLazsY3 X-Received: by 2002:a05:6402:1045:b0:461:a28b:17ab with SMTP id e5-20020a056402104500b00461a28b17abmr7055134edu.90.1666613789146; Mon, 24 Oct 2022 05:16:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613789; cv=none; d=google.com; s=arc-20160816; b=f6yV5gb20uH3Iaq1DEFwkGo0XUbXvFMuQHJNySOohUSNGU32nAcqTkMpJSjVXZw+je xMkMq4piMp4LEPXpZ3xeGFFb3ZpCohe9foOn3lCvIOsxNJIyjOBAHmVWXmo1cByJOlyx 4Eis+6uhxgVpqyzrMYeSS4G/5s1BFSZA9uqO9oDhbundd228ul7eyUM3JcUBCog7JtwW QdgI4NlCs0mxdF5/ZTNimmmWZ9CVWyob3n/RI2CuEYB0ZTIfTFQ3Fbys+jizzPof8Gfb AYRyyHwt5HVJcbTLP3dVban2WIzdAet02XMt8bbwG7uzPray48mx2D/imVsDYXJgGjcV rAhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vyfzmYw4dH/v/K9tgtBplFfExoY0PnhJZuQnTklGm4M=; b=I0rPIlTHC2eQ7EsUhuApju+JiZl+/Leyyhzw+SDK4Kbkvhq1YigvUv9cZO38t0A/FE Haj0UCOs0GchhlrWDvapXwSA4iUsV3hOfBQZF5FfA1ITj8evNBxuUGS7BzOhhgssdNYm bceqhLYj0ri/9H1znR1qXizi/f9B7cfq8TkJ5s80+nVmFrn2CUUcF0x9QljUQ78inTg/ nyJa4ITnnqNLfWVcVDhbElAT0SBdwqH4YQgwfzKaKSpGnjBTCB8VZZGQ1S/QfnyvwqIg vsQKxyzTKobbw2tWfvooyLl44aVWWP4/T8+5h0iZoMs8EK6Qt2YNiZ7UO7B7Z2W7ffCq 1pZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NnJT+iCx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g10-20020a056402090a00b0045c97ee2b01si31318232edz.616.2022.10.24.05.16.04; Mon, 24 Oct 2022 05:16:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NnJT+iCx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232651AbiJXMIF (ORCPT + 99 others); Mon, 24 Oct 2022 08:08:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232443AbiJXMFW (ORCPT ); Mon, 24 Oct 2022 08:05:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 725837E01A; Mon, 24 Oct 2022 04:51:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E2D6C6125D; Mon, 24 Oct 2022 11:49:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0167EC433C1; Mon, 24 Oct 2022 11:49:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612152; bh=vzp4zjGLVhDVa0u7CdOhbS2grFwfTsE3U0IxFxDxyr4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NnJT+iCx1Mj2ySrxEd1I6+PrZnEceAhAjUtd5SKaWTSsGqfRz9BMVWK4bFznXyy21 MbCDIOP1JiRVZICkJndGx1V5udkLHitbovaQLtYe2DBUUyRiCz1DK941aYV1CGinP4 XLQl6LCwPfdB5Nj8lcwtX30ZwE+xU7XdNMbGWCsQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheng Yongjun , Christophe Leroy , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 089/210] net: fs_enet: Fix wrong check in do_pd_setup Date: Mon, 24 Oct 2022 13:30:06 +0200 Message-Id: <20221024112959.931421842@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571220322884758?= X-GMAIL-MSGID: =?utf-8?q?1747571220322884758?= From: Zheng Yongjun [ Upstream commit ec3f06b542a960806a81345042e4eee3f8c5dec4 ] Should check of_iomap return value 'fep->fec.fecp' instead of 'fep->fcc.fccp' Fixes: 976de6a8c304 ("fs_enet: Be an of_platform device when CONFIG_PPC_CPM_NEW_BINDING is set.") Signed-off-by: Zheng Yongjun Reviewed-by: Christophe Leroy Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/freescale/fs_enet/mac-fec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/fs_enet/mac-fec.c b/drivers/net/ethernet/freescale/fs_enet/mac-fec.c index 1fc27c97e3b2..e52231cfcf77 100644 --- a/drivers/net/ethernet/freescale/fs_enet/mac-fec.c +++ b/drivers/net/ethernet/freescale/fs_enet/mac-fec.c @@ -97,7 +97,7 @@ static int do_pd_setup(struct fs_enet_private *fep) return -EINVAL; fep->fec.fecp = of_iomap(ofdev->dev.of_node, 0); - if (!fep->fcc.fccp) + if (!fep->fec.fecp) return -EINVAL; return 0; From patchwork Mon Oct 24 11:30:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8583 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419104wru; Mon, 24 Oct 2022 05:15:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5NLtFPrGybaeAwpretHYGDBg1LBSFh8OmIN6m0HOs5u8tHRvkUSWleOOXg2otp1hEeXBS9 X-Received: by 2002:a17:907:7704:b0:780:da38:4480 with SMTP id kw4-20020a170907770400b00780da384480mr27345274ejc.64.1666613745898; Mon, 24 Oct 2022 05:15:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613745; cv=none; d=google.com; s=arc-20160816; b=fDCWtO5YcQTcz2q75cvISWL2H6iWdeUlt9rQZdFkxq58iGeLDf2WVWiu+9rn+isnQd NKYZ+xtUHrb50YHjAEQhbQGnINCo8BmmEMKda9/BpGhwFXorqjUKTW4kDA6QjCgdB3jS JSClD9NgSMKCLfc8Sg6reFZPZ13hksR5dwyCWmax03OqTZK8XWz9zjGQUy2XQXRcgwuw aPPktdadUmR4/lZPCnYaGdzNzg3N9hp+l7p7sel15xYRfZ9CWF8NyDv84BwVbViDBlc/ OOgk5H/A7aAURTmcQJdkh9B3OEoh3zMuX8AskK2ADgapTLwJi7x1czT1ZHXBdY/EAcaP 6GHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cTaKOMTpgM4IMkGXR8tm7Ux2EjWsBdh6cOYuQmE+bs8=; b=RG2SPGApr11Xgopoq7WZhp9LffkGNm5yGmkJPc3G7h2c2l3W21wMsFwgGKx7dNkTIa sxc4OoQtdqgbc9KWTmtn1iMpCPeGhnm9QV2k9qvb0FyyKeUb1yKCrmcHREviePZ2I+fN vlpwrM9GvLs/meZXY8rw8r0VHENvrHLtYLrClIpKDAhXkxSke+MeaadkN4KwC6kY8QEi l6tC+N6OWCoKvS0k0Ky/984cugbmJ2iGTmf/1rdzcVm+B8RswSpTWJ7mep59ObnarrHm hWMntgSOPiT3uKHt6j+Mtm2pHmBelIYNHcr689wFoUVdI2epHzo1x+JujS209tV3yOyA lORA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="qV/oBaUf"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dt2-20020a170906b78200b00782b2a97827si24829210ejb.242.2022.10.24.05.15.21; Mon, 24 Oct 2022 05:15:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="qV/oBaUf"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232670AbiJXMGg (ORCPT + 99 others); Mon, 24 Oct 2022 08:06:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232836AbiJXME0 (ORCPT ); Mon, 24 Oct 2022 08:04:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B6C065248; Mon, 24 Oct 2022 04:50:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 45AE8B811A5; Mon, 24 Oct 2022 11:49:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99E80C433D6; Mon, 24 Oct 2022 11:49:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612155; bh=HCgnyLFXNJ666+RLJs53imFRVFNh+zNwO7IvWGDTFNk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qV/oBaUf02cSNeWOp6nTCmkkHmB34D9B799Zoprr8AFCS5eJseFggp/xdhWG4vtb1 rfycsL4umxZIaOGL5vSXMOAFGXr3VfflDKo/xFadZx/z9+KhmaTvqJdtti5xj9/wBZ K/Bw/loYnnNMS/kH0h2UhibdXtY4+59c3VvE2SKU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Qilong , Mark Brown , Sasha Levin Subject: [PATCH 4.14 090/210] spi/omap100k:Fix PM disable depth imbalance in omap1_spi100k_probe Date: Mon, 24 Oct 2022 13:30:07 +0200 Message-Id: <20221024112959.961616265@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571175217832536?= X-GMAIL-MSGID: =?utf-8?q?1747571175217832536?= From: Zhang Qilong [ Upstream commit 29f65f2171c85a9633daa380df14009a365f42f2 ] The pm_runtime_enable will increase power disable depth. Thus a pairing decrement is needed on the error handling path to keep it balanced according to context. Fixes:db91841b58f9a ("spi/omap100k: Convert to runtime PM") Signed-off-by: Zhang Qilong Link: https://lore.kernel.org/r/20220924121310.78331-4-zhangqilong3@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-omap-100k.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/spi/spi-omap-100k.c b/drivers/spi/spi-omap-100k.c index 2eeb0fe2eed2..022f5bccef81 100644 --- a/drivers/spi/spi-omap-100k.c +++ b/drivers/spi/spi-omap-100k.c @@ -425,6 +425,7 @@ static int omap1_spi100k_probe(struct platform_device *pdev) return status; err_fck: + pm_runtime_disable(&pdev->dev); clk_disable_unprepare(spi100k->fck); err_ick: clk_disable_unprepare(spi100k->ick); From patchwork Mon Oct 24 11:30:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8560 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp417658wru; Mon, 24 Oct 2022 05:13:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM400jIpNC3/8sIeevxgmOXr2PKSo1U3XFs4Je7UlpTagV3WO/LCmzfSK68kau8fVaoDnHYG X-Received: by 2002:a17:906:5a5f:b0:79f:9f1f:2fef with SMTP id my31-20020a1709065a5f00b0079f9f1f2fefmr11529841ejc.396.1666613607908; Mon, 24 Oct 2022 05:13:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613607; cv=none; d=google.com; s=arc-20160816; b=w96Vkh5NCuMsGuE8WsqTR4XXS3fw4EJ2uZilYuGSGFCQCng7r5SgSD+WVkct6uHG8F ofqj7zLZl4oFcSCyWNSXttKLxI/+UqTlJBpct0xsDBN6NdIoM0nFmy9q4risiUg86r4L I/Yy+wmpB0+GO5jiaGflcNYcmEEKefJey2s75Ls2zcAp3Vrt5KpLJ16wJuT1kqe1AdAa S9jpbCVvzr1oL/DcQN2EHW2NDoXPB7A7+vbKCeA6E8hOkxC5VRypfaZPl6pc16mlFWy/ /txyqek+VUi/mZYw4SkO6sDN7ObFWaBSc4ukMWHL4Jh3unPU0perErMm+WsIqog5LlKY nJeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PxmGU+zzEOpsSA78srrt2A+rUG66W+vTW0qCJQ9FnrU=; b=kkeGEAo1VOhr6nA2icRti4Mdx++SH29si/2C/vWyhMd+7gF1MwXK3oC9J7HrZL179C IGRAX+vz+T33NhIQ4W3rNghky+qITK72fVBh6Q5EMHIihZkcdJaQauBB4icP+39rfrRI PIl/9siefLTFVCPes8kENAAmFQEAGL2LIVnJAFtJd+j2I9P9KFrE6i+7hB3eCgTRbBMb 32XjkxUhfB0ETyP3EDk8soAPU99jc93eaT+3suOgfcv8yWFf2v7iAoLZRNOaoPyaOsis MGh3e/flqQIWpP/uA/zxtcvLuOaU1H3IObFBmKkTzLYlr+/6/YZ6PrzUUSsdAYjgLpvt oZqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IgtPM1rA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wu13-20020a170906eecd00b00741a0720a2bsi30399034ejb.814.2022.10.24.05.13.01; Mon, 24 Oct 2022 05:13:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IgtPM1rA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232568AbiJXMDM (ORCPT + 99 others); Mon, 24 Oct 2022 08:03:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232274AbiJXMAV (ORCPT ); Mon, 24 Oct 2022 08:00:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 605E87C313; Mon, 24 Oct 2022 04:49:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 268346128E; Mon, 24 Oct 2022 11:49:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 395B7C433C1; Mon, 24 Oct 2022 11:49:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612157; bh=VZ4xijO3a4nf2qV6wOvkshvxqPpkqHLgz7hAcYiDCTA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IgtPM1rAEWrt8cgi4ZRr14hhU5HjTBV68X4Nu/GDbYgq5nbre500rLe1p5WOyWAUa 2vsFa1fIdLyCwNfIK8WqJEaw/6te0bTPfaORFHrB+YRjUqeiwiF+sTMIouDvpKCs5k MI/v4dYfvlSepHdPZz2ABGhUkH6fhG5vC0Oyl/s8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Phil Sutter , Florian Westphal , Sasha Levin Subject: [PATCH 4.14 091/210] netfilter: nft_fib: Fix for rpath check with VRF devices Date: Mon, 24 Oct 2022 13:30:08 +0200 Message-Id: <20221024112959.991394202@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571030514967942?= X-GMAIL-MSGID: =?utf-8?q?1747571030514967942?= From: Phil Sutter [ Upstream commit 2a8a7c0eaa8747c16aa4a48d573aa920d5c00a5c ] Analogous to commit b575b24b8eee3 ("netfilter: Fix rpfilter dropping vrf packets by mistake") but for nftables fib expression: Add special treatment of VRF devices so that typical reverse path filtering via 'fib saddr . iif oif' expression works as expected. Fixes: f6d0cbcf09c50 ("netfilter: nf_tables: add fib expression") Signed-off-by: Phil Sutter Signed-off-by: Florian Westphal Signed-off-by: Sasha Levin --- net/ipv4/netfilter/nft_fib_ipv4.c | 3 +++ net/ipv6/netfilter/nft_fib_ipv6.c | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/net/ipv4/netfilter/nft_fib_ipv4.c b/net/ipv4/netfilter/nft_fib_ipv4.c index e50976e3c213..3b2e8ac45d4e 100644 --- a/net/ipv4/netfilter/nft_fib_ipv4.c +++ b/net/ipv4/netfilter/nft_fib_ipv4.c @@ -95,6 +95,9 @@ void nft_fib4_eval(const struct nft_expr *expr, struct nft_regs *regs, else oif = NULL; + if (priv->flags & NFTA_FIB_F_IIF) + fl4.flowi4_oif = l3mdev_master_ifindex_rcu(oif); + if (nft_hook(pkt) == NF_INET_PRE_ROUTING && nft_fib_is_loopback(pkt->skb, nft_in(pkt))) { nft_fib_store_result(dest, priv, pkt, diff --git a/net/ipv6/netfilter/nft_fib_ipv6.c b/net/ipv6/netfilter/nft_fib_ipv6.c index fd9a45cbd709..bcc673e433e6 100644 --- a/net/ipv6/netfilter/nft_fib_ipv6.c +++ b/net/ipv6/netfilter/nft_fib_ipv6.c @@ -41,6 +41,9 @@ static int nft_fib6_flowi_init(struct flowi6 *fl6, const struct nft_fib *priv, if (ipv6_addr_type(&fl6->daddr) & IPV6_ADDR_LINKLOCAL) { lookup_flags |= RT6_LOOKUP_F_IFACE; fl6->flowi6_oif = get_ifindex(dev ? dev : pkt->skb->dev); + } else if ((priv->flags & NFTA_FIB_F_IIF) && + (netif_is_l3_master(dev) || netif_is_l3_slave(dev))) { + fl6->flowi6_oif = dev->ifindex; } if (ipv6_addr_type(&fl6->saddr) & IPV6_ADDR_UNICAST) @@ -190,7 +193,8 @@ void nft_fib6_eval(const struct nft_expr *expr, struct nft_regs *regs, if (rt->rt6i_flags & (RTF_REJECT | RTF_ANYCAST | RTF_LOCAL)) goto put_rt_err; - if (oif && oif != rt->rt6i_idev->dev) + if (oif && oif != rt->rt6i_idev->dev && + l3mdev_master_ifindex_rcu(rt->rt6i_idev->dev) != oif->ifindex) goto put_rt_err; switch (priv->result) { From patchwork Mon Oct 24 11:30:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8561 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp417651wru; Mon, 24 Oct 2022 05:13:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6isng89mndOK9dcFi0yTYdR2Rf1/1niuoyuHtgzFBzyzviI1akTrZslzANLCALbr8bbcW2 X-Received: by 2002:a17:907:6d25:b0:7aa:f5a4:5f66 with SMTP id sa37-20020a1709076d2500b007aaf5a45f66mr591724ejc.216.1666613607697; Mon, 24 Oct 2022 05:13:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613607; cv=none; d=google.com; s=arc-20160816; b=1BA1SG2JyYW7FILoEqVolwdcLgugLtcp4VgapaB1BJZTxm5/8jVZr1e3H6N7ucNRIO 7poR0aq6L+9LZ6DvE1lGDgBSJgEyGBluf2F8MAMCDjwANvW8yfCeQuYoCDrTNBCimEcx 4Tq4ryb5wlPiLKwBGmz/SzZGCvh7OVCp7uQiqr/1l+bJGzYfRKbWO8gTvDGoN95vqDyi ZEkFgVlwlGdc3G8x72wbXTBTp0sdQJ6GMKfyr8iIhIen43v6AAp0kP9ZuqKlSUPmf0N7 cfESo0WbE1pZAK1bXGqZfAePbGkPOCXXHNECaiaHZ8SpSoe/yoBkFx8J5ApbKCchlIzZ iYuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=H9t2Pd79/ZBnuM+vEv0vU/tnBKXwkoj8KeSkx0yQ00s=; b=pGvjoh9NuNb9i4XJzC5GML0hljDIoPDPHvGtX3G/r22xffL3TAVRum1enbNts0gYeL ABZv1ko1glEWP9P8lZSryctoWNguw9mZrXOGE/uAfrlN0Myh+DCnS2SZURJGtRemxZN2 wmRLbDn4dwchsBpqOWYAcYT2buT4dN29z9VNBPK3CZXNkPeJFnrldBRoleJGyJo6saJi Jn5Q6WjPIOR4vVW8Aorf+0Frg+dLhtNclaqP4R5FGsO1u20DuJsoxz7TpGEJC0lZD1CF UucsohvtcW7sslN9juJ45oZ9qiL7uqLOBx7UwlwX2BxLS+P9oQvAvbF6hLxOeZ+drEHg Av+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wyhJ5D19; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g14-20020a1709065d0e00b0078219af8361si28711236ejt.883.2022.10.24.05.12.57; Mon, 24 Oct 2022 05:13:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wyhJ5D19; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232564AbiJXMDI (ORCPT + 99 others); Mon, 24 Oct 2022 08:03:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232181AbiJXMAF (ORCPT ); Mon, 24 Oct 2022 08:00:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 659AD2C13B; Mon, 24 Oct 2022 04:49:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 075066122D; Mon, 24 Oct 2022 11:49:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDDFAC433C1; Mon, 24 Oct 2022 11:49:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612160; bh=9cEPUI0SO0/uP4WT5g3TlaqxPNGzZlpCwpnE79x7qNQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wyhJ5D19w5GSfxqxzD2eAY5eqPucN1gPkaP0tvdo9zKSu+AeIVt4V+/CYGuIWXGv2 cw4wukLVBmqbGeSi6E2DGb2N/EuQaJkqNFAYvIC28ZuwaMhEKGE6w18bABKY/uKHTq D9gj8aHE4PiYJ7v1zszAavk50DTstlwWa9kVDyUg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Whitchurch , Mark Brown , Sasha Levin Subject: [PATCH 4.14 092/210] spi: s3c64xx: Fix large transfers with DMA Date: Mon, 24 Oct 2022 13:30:09 +0200 Message-Id: <20221024113000.021214538@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571030510059223?= X-GMAIL-MSGID: =?utf-8?q?1747571030510059223?= From: Vincent Whitchurch [ Upstream commit 1224e29572f655facfcd850cf0f0a4784f36a903 ] The COUNT_VALUE in the PACKET_CNT register is 16-bit so the maximum value is 65535. Asking the driver to transfer a larger size currently leads to the DMA transfer timing out. Implement ->max_transfer_size() and have the core split the transfer as needed. Fixes: 230d42d422e7 ("spi: Add s3c64xx SPI Controller driver") Signed-off-by: Vincent Whitchurch Link: https://lore.kernel.org/r/20220927112117.77599-5-vincent.whitchurch@axis.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-s3c64xx.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 1a6ec226d6e4..0594e214a636 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -94,6 +94,7 @@ #define S3C64XX_SPI_ST_TX_FIFORDY (1<<0) #define S3C64XX_SPI_PACKET_CNT_EN (1<<16) +#define S3C64XX_SPI_PACKET_CNT_MASK GENMASK(15, 0) #define S3C64XX_SPI_PND_TX_UNDERRUN_CLR (1<<4) #define S3C64XX_SPI_PND_TX_OVERRUN_CLR (1<<3) @@ -640,6 +641,13 @@ static int s3c64xx_spi_prepare_message(struct spi_master *master, return 0; } +static size_t s3c64xx_spi_max_transfer_size(struct spi_device *spi) +{ + struct spi_controller *ctlr = spi->controller; + + return ctlr->can_dma ? S3C64XX_SPI_PACKET_CNT_MASK : SIZE_MAX; +} + static int s3c64xx_spi_transfer_one(struct spi_master *master, struct spi_device *spi, struct spi_transfer *xfer) @@ -1067,6 +1075,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) master->prepare_transfer_hardware = s3c64xx_spi_prepare_transfer; master->prepare_message = s3c64xx_spi_prepare_message; master->transfer_one = s3c64xx_spi_transfer_one; + master->max_transfer_size = s3c64xx_spi_max_transfer_size; master->num_chipselect = sci->num_cs; master->dma_alignment = 8; master->bits_per_word_mask = SPI_BPW_MASK(32) | SPI_BPW_MASK(16) | From patchwork Mon Oct 24 11:30:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8703 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422873wru; Mon, 24 Oct 2022 05:23:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6GeKoCGCv7HuIH6K1ymIPrUkj4Cgp848ISxgr6hYPxpQVTEIp9q6WjD9qCqBandCt/ueOX X-Received: by 2002:a17:907:703:b0:78e:25be:5455 with SMTP id xb3-20020a170907070300b0078e25be5455mr26860440ejb.630.1666614211800; Mon, 24 Oct 2022 05:23:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614211; cv=none; d=google.com; s=arc-20160816; b=lux1uykSQFrKCUI5xCXL7sDJNGB/vF8Feg8SjxwFrhEuHFT88mWoJFuuZXlR2dkq5l FgPt0W0q2tPNvXLUR+Ft5+bC8ey4Fsxa5qYvapTkTYVMsQ7wek7iIvH0+wrHBkegOx6D tIUXVqTTJ+d8ihaSY2lklzwpduzkx3W+jNIgXo38nTcbBsJn6mXqcpi9HERUwHolyZlH OVEA7lrXTqpSrp9t+Ag+1WDbQYCjPtMNCVCrcN+Ue2oqDO02A48RKiTE+nIw4hO22qgt tihbW4dBONUX90crwHK7+BgvfhlkVvz1gTne99jZ31489oBmgd8lnpjt5Aw5zYtxTk4W //dA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ypPI7Z/Ek+IYRkw5g5s5ShisnJ2J33Y/QaPI/HQpLPs=; b=IcYhKK4BkUrybn+wKmoALMw01ZashvKbFMHxTps5xrI/VXB3EW20FTNNEuE2FznBRl IBD4U5wwPs7HB9kjmfnXCPlna5EX/R4ZeezojCGiAx8q707pN9rHPF8fhxnhlpQMg0/v ESA+YoNbGmnH7Gs+G105H35Cpvp8T/3Y6B97oVXZs1h3AqPngQReC94MDrFfIJdAiaDa 1pRB0qSwGSPIseHMNFvnzwZb2j7riTsyElvm+4fz2ELe+BLrFMdC5U3KrLPcwzoxv1mh Mxda4IvnrsgLXVFybD/CwD59kIPG6GPbPkw8vawo0MdUu3eN3H2qJsLXfuGw1z3U04pz yoiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=K1gmKTe4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hd12-20020a170907968c00b0078db8bac984si17945542ejc.830.2022.10.24.05.23.07; Mon, 24 Oct 2022 05:23:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=K1gmKTe4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233199AbiJXMWS (ORCPT + 99 others); Mon, 24 Oct 2022 08:22:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233593AbiJXMTy (ORCPT ); Mon, 24 Oct 2022 08:19:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9A8A7B5B4; Mon, 24 Oct 2022 04:58:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A8D966127D; Mon, 24 Oct 2022 11:49:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3A3DC433C1; Mon, 24 Oct 2022 11:49:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612163; bh=dBiRJ7Z5DK4pS3+FNHCtk/Uheq2qnwB5CDfuBuAOSfw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K1gmKTe49mbamoR9LjV0tgOHAHhDdcNyR/hQ5fezbaSz6PkRSAdOeE8WI8FMjATIW tFtBveP1ChHaRHi0f8ZrHnY2c/6/pOGV0uz28w6cEargroMrXs8w+SYcm/DBhuoT3k olTPWwgOHX9rqOolGfRWGfHhsu9L8OiyXlIqTfl0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Junichi Uekawa , Stefano Garzarella , "Michael S. Tsirkin" , Jakub Kicinski , Sasha Levin Subject: [PATCH 4.14 093/210] vhost/vsock: Use kvmalloc/kvfree for larger packets. Date: Mon, 24 Oct 2022 13:30:10 +0200 Message-Id: <20221024113000.050688897@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571663983549667?= X-GMAIL-MSGID: =?utf-8?q?1747571663983549667?= From: Junichi Uekawa [ Upstream commit 0e3f72931fc47bb81686020cc643cde5d9cd0bb8 ] When copying a large file over sftp over vsock, data size is usually 32kB, and kmalloc seems to fail to try to allocate 32 32kB regions. vhost-5837: page allocation failure: order:4, mode:0x24040c0 Call Trace: [] dump_stack+0x97/0xdb [] warn_alloc_failed+0x10f/0x138 [] ? __alloc_pages_direct_compact+0x38/0xc8 [] __alloc_pages_nodemask+0x84c/0x90d [] alloc_kmem_pages+0x17/0x19 [] kmalloc_order_trace+0x2b/0xdb [] __kmalloc+0x177/0x1f7 [] ? copy_from_iter+0x8d/0x31d [] vhost_vsock_handle_tx_kick+0x1fa/0x301 [vhost_vsock] [] vhost_worker+0xf7/0x157 [vhost] [] kthread+0xfd/0x105 [] ? vhost_dev_set_owner+0x22e/0x22e [vhost] [] ? flush_kthread_worker+0xf3/0xf3 [] ret_from_fork+0x4e/0x80 [] ? flush_kthread_worker+0xf3/0xf3 Work around by doing kvmalloc instead. Fixes: 433fc58e6bf2 ("VSOCK: Introduce vhost_vsock.ko") Signed-off-by: Junichi Uekawa Reviewed-by: Stefano Garzarella Acked-by: Michael S. Tsirkin Link: https://lore.kernel.org/r/20220928064538.667678-1-uekawa@chromium.org Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/vhost/vsock.c | 2 +- net/vmw_vsock/virtio_transport_common.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c index c87072217dc0..35f2fbc160a5 100644 --- a/drivers/vhost/vsock.c +++ b/drivers/vhost/vsock.c @@ -354,7 +354,7 @@ vhost_vsock_alloc_pkt(struct vhost_virtqueue *vq, return NULL; } - pkt->buf = kmalloc(pkt->len, GFP_KERNEL); + pkt->buf = kvmalloc(pkt->len, GFP_KERNEL); if (!pkt->buf) { kfree(pkt); return NULL; diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c index 349311f6d195..9b8f592897ec 100644 --- a/net/vmw_vsock/virtio_transport_common.c +++ b/net/vmw_vsock/virtio_transport_common.c @@ -1075,7 +1075,7 @@ EXPORT_SYMBOL_GPL(virtio_transport_recv_pkt); void virtio_transport_free_pkt(struct virtio_vsock_pkt *pkt) { - kfree(pkt->buf); + kvfree(pkt->buf); kfree(pkt); } EXPORT_SYMBOL_GPL(virtio_transport_free_pkt); From patchwork Mon Oct 24 11:30:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8701 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422773wru; Mon, 24 Oct 2022 05:23:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5cC3nuvbNj60c172LdWU0VSYPiazjLVzJot56o+9sXxgW3YKH5LeFRgW473H+6OR8TLvsa X-Received: by 2002:aa7:dc10:0:b0:440:b446:c0cc with SMTP id b16-20020aa7dc10000000b00440b446c0ccmr30235142edu.34.1666614201509; Mon, 24 Oct 2022 05:23:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614201; cv=none; d=google.com; s=arc-20160816; b=meZFBHemkGkTOOT4amkQslVTrVXZOwOvFcuMAepke7CSfNNL41y7xyYZ435mZ/mbeP CoT7xlVdnEJqEYMAB6iGjzu6+gM+5n6mEAOdp5GcnKHIJw9pLZKp21PSoKK6+bXLs83g EJJJixBElPrYcHGLWHEL1nbDfe4VF1fgJF3GpXwhcqX4/nDgcFwHaD16HdRO3HyDUPxi 7Ii56taO/sGviK/scL3RUUWb10texjdr5ZxcASxxdM00VMmRmnIUCXmohMgNjluHgHG6 deoYCu4F+BQOErW2Xg3Woyq4f0bh8/qZew3jwH8lb89aepMwCndDwIQbRwmsJIKMhu7e CSqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MVq2Z1dNFm59Bqrwk2E9FT/RPMQywl6cNYFO1JA2Ngs=; b=xPb12gvgVeBFOFrt/iW6nxeBAsTjXnilgS0/UgPLPJe/JQWjoYZ9eKefu66bNy4hcf 4oTYzrp5LO738ZR5x6mVsZiKnvpNclaUC4AxUDcpVZOdm9qagpgEG+BmLQ+m7OGJO9qB IS+hyJ1J+bwwc8t8tb7I2AhHRfKjrYUF98WsPjtajuHJ7dvTPH4ggn8dlCCu6jcsy0Ru 70gpbDHoeOtakEiUz9JhAqozyvpikw/DQCj0YjPIN/GuHB5seK7V2FTgS3i1JEsyasu0 DtkTf1GrBaVK38MNVySQlOyVGPmu+thW9jRtf7cmCtIyylu1qilpXFX6arJaCo3pbm5U mO4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hFUKehqi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o8-20020a170906774800b0078da99ecbdbsi23858334ejn.673.2022.10.24.05.22.57; Mon, 24 Oct 2022 05:23:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hFUKehqi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233468AbiJXMWG (ORCPT + 99 others); Mon, 24 Oct 2022 08:22:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233564AbiJXMTv (ORCPT ); Mon, 24 Oct 2022 08:19:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D44C983040; Mon, 24 Oct 2022 04:58:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 768BB61218; Mon, 24 Oct 2022 11:49:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C2DFC433C1; Mon, 24 Oct 2022 11:49:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612165; bh=ZPeymm10gGxK2SsTtk+hUrOWMe19b/6w/albuianqiM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hFUKehqiohfX01Z63RRYBck54PzrQdPUwgla5fiCqsCDaHw9rEeKYQYJW+kE1RELw F9WR2S6MUDvuVrLo6yuLOkqCETPUCsIky3Se/d3BcrQXf/UjUGhU/bRAt6E2eaV+yk ehzKqBZJhltYvB1Sx3znYmUp0hr2S12poUl+XKdc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Duoming Zhou , Leon Romanovsky , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 094/210] mISDN: fix use-after-free bugs in l1oip timer handlers Date: Mon, 24 Oct 2022 13:30:11 +0200 Message-Id: <20221024113000.080894670@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571652901505126?= X-GMAIL-MSGID: =?utf-8?q?1747571652901505126?= From: Duoming Zhou [ Upstream commit 2568a7e0832ee30b0a351016d03062ab4e0e0a3f ] The l1oip_cleanup() traverses the l1oip_ilist and calls release_card() to cleanup module and stack. However, release_card() calls del_timer() to delete the timers such as keep_tl and timeout_tl. If the timer handler is running, the del_timer() will not stop it and result in UAF bugs. One of the processes is shown below: (cleanup routine) | (timer handler) release_card() | l1oip_timeout() ... | del_timer() | ... ... | kfree(hc) //FREE | | hc->timeout_on = 0 //USE Fix by calling del_timer_sync() in release_card(), which makes sure the timer handlers have finished before the resources, such as l1oip and so on, have been deallocated. What's more, the hc->workq and hc->socket_thread can kick those timers right back in. We add a bool flag to show if card is released. Then, check this flag in hc->workq and hc->socket_thread. Fixes: 3712b42d4b1b ("Add layer1 over IP support") Signed-off-by: Duoming Zhou Reviewed-by: Leon Romanovsky Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/isdn/mISDN/l1oip.h | 1 + drivers/isdn/mISDN/l1oip_core.c | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/isdn/mISDN/l1oip.h b/drivers/isdn/mISDN/l1oip.h index 7ea10db20e3a..48133d022812 100644 --- a/drivers/isdn/mISDN/l1oip.h +++ b/drivers/isdn/mISDN/l1oip.h @@ -59,6 +59,7 @@ struct l1oip { int bundle; /* bundle channels in one frm */ int codec; /* codec to use for transmis. */ int limit; /* limit number of bchannels */ + bool shutdown; /* if card is released */ /* timer */ struct timer_list keep_tl; diff --git a/drivers/isdn/mISDN/l1oip_core.c b/drivers/isdn/mISDN/l1oip_core.c index 6be2041248d3..c86f33ed9ef9 100644 --- a/drivers/isdn/mISDN/l1oip_core.c +++ b/drivers/isdn/mISDN/l1oip_core.c @@ -289,7 +289,7 @@ l1oip_socket_send(struct l1oip *hc, u8 localcodec, u8 channel, u32 chanmask, p = frame; /* restart timer */ - if (time_before(hc->keep_tl.expires, jiffies + 5 * HZ)) + if (time_before(hc->keep_tl.expires, jiffies + 5 * HZ) && !hc->shutdown) mod_timer(&hc->keep_tl, jiffies + L1OIP_KEEPALIVE * HZ); else hc->keep_tl.expires = jiffies + L1OIP_KEEPALIVE * HZ; @@ -621,7 +621,9 @@ l1oip_socket_parse(struct l1oip *hc, struct sockaddr_in *sin, u8 *buf, int len) goto multiframe; /* restart timer */ - if (time_before(hc->timeout_tl.expires, jiffies + 5 * HZ) || !hc->timeout_on) { + if ((time_before(hc->timeout_tl.expires, jiffies + 5 * HZ) || + !hc->timeout_on) && + !hc->shutdown) { hc->timeout_on = 1; mod_timer(&hc->timeout_tl, jiffies + L1OIP_TIMEOUT * HZ); } else /* only adjust timer */ @@ -1248,11 +1250,10 @@ release_card(struct l1oip *hc) { int ch; - if (timer_pending(&hc->keep_tl)) - del_timer(&hc->keep_tl); + hc->shutdown = true; - if (timer_pending(&hc->timeout_tl)) - del_timer(&hc->timeout_tl); + del_timer_sync(&hc->keep_tl); + del_timer_sync(&hc->timeout_tl); cancel_work_sync(&hc->workq); From patchwork Mon Oct 24 11:30:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8584 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419130wru; Mon, 24 Oct 2022 05:15:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6gUFFYIrPSvHNZPu6PhK2J2rcF4bgXoNYfkGKeYnLemnGHlod3h8HGEvEWYIjqqxb7SsPs X-Received: by 2002:a17:90b:4b0f:b0:211:41f:1c72 with SMTP id lx15-20020a17090b4b0f00b00211041f1c72mr28859093pjb.25.1666613748579; Mon, 24 Oct 2022 05:15:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613748; cv=none; d=google.com; s=arc-20160816; b=gyr5iVvuGD/3uai4cM16yS3gIq689wNDJiosxqEx7hkMAP3sxoPReigXKRphH1aiJl 8tRw6l6kU8OIeIVQfsDJWt6sPAhFT2NAmKFK3Jp5NWcPJgNWXio8HTWQ+LvH4+gwvHgw QtazhtIG9xqDMTqNyOmoKEuIepTTtJAeUZ8yESlfbkzFOFmfjs/g/3UConWd8zzdjMnL 5jm3OYrW2NaBmuwr7CsCcc1bdDPhLEG+YSchruzLhCepVi+Ucf1pMqqsWKjuE08Zyo3i e0vs3IZ+ntlk/dtPcbHXsRZZzxzMeejxzTS4K7PSmDc7M+6nBPheja7L+4SF8cizjrY+ Uhtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=L5XY5Y1TeOw4K5nT9PG9daJ/su74cXPz1MQxAb+YNRs=; b=BAVHGfJLuM1rFttF7AOy1YdHE26LPZZsp/kxl5dbepYmRDjEctKhlj1L2fQSqXXU3a Z4chSd4sT9URiJbUzq0Y93zecIbvJYrSt7V9n2VxnxaBtK8bH/alDIqLOttlR/RX9qT7 ZSEtfsDPni7f/LzG9AtT2Y7sfBiPK4lGHQOVkj61R9kfILjzIcqAXFdpuZU4eoVqzebH vqAdrHgkcfRWc0mBSFZ8568IEoK4CodSHFPBQekg98yX2ouinFwPAxug8Z+Re9UlYk9w XiCmZvKjPBnMYNFYo7b0rECNgRggzZRTe+DZirXMxrX8F9Te4xIGKaQmcSwtHPHzgPk3 VE/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=C+r25CL2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g6-20020a656cc6000000b0041b7be8ef1csi34833024pgw.219.2022.10.24.05.15.34; Mon, 24 Oct 2022 05:15:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=C+r25CL2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232516AbiJXMDu (ORCPT + 99 others); Mon, 24 Oct 2022 08:03:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232504AbiJXMB6 (ORCPT ); Mon, 24 Oct 2022 08:01:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3BDD13F11; Mon, 24 Oct 2022 04:49:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A02B161286; Mon, 24 Oct 2022 11:49:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2F60C433C1; Mon, 24 Oct 2022 11:49:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612171; bh=HA9MCoEoC8QqmrO+2/VbuNC0X/ywxoU5lg6FjR2ETcw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C+r25CL2ZORvV/2FylmmFEde6pNdTjchJBH0sXyFMH8eswrtw1lt1anMSTq8zDgPo AhkK2zVfzCliyBD9PA6Ng1/fQCmEo2BY4L+/joT2VLSOrWylIseaZq8lNcE0aUziWV X3Zw2IdHZLZIXLmK3jIHePj94ixjQ/FMA3cEj120= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Neal Cardwell , "Kevin(Yudong) Yang" , Yuchung Cheng , Eric Dumazet , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 095/210] tcp: fix tcp_cwnd_validate() to not forget is_cwnd_limited Date: Mon, 24 Oct 2022 13:30:12 +0200 Message-Id: <20221024113000.110431859@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571178023271563?= X-GMAIL-MSGID: =?utf-8?q?1747571178023271563?= From: Neal Cardwell [ Upstream commit f4ce91ce12a7c6ead19b128ffa8cff6e3ded2a14 ] This commit fixes a bug in the tracking of max_packets_out and is_cwnd_limited. This bug can cause the connection to fail to remember that is_cwnd_limited is true, causing the connection to fail to grow cwnd when it should, causing throughput to be lower than it should be. The following event sequence is an example that triggers the bug: (a) The connection is cwnd_limited, but packets_out is not at its peak due to TSO deferral deciding not to send another skb yet. In such cases the connection can advance max_packets_seq and set tp->is_cwnd_limited to true and max_packets_out to a small number. (b) Then later in the round trip the connection is pacing-limited (not cwnd-limited), and packets_out is larger. In such cases the connection would raise max_packets_out to a bigger number but (unexpectedly) flip tp->is_cwnd_limited from true to false. This commit fixes that bug. One straightforward fix would be to separately track (a) the next window after max_packets_out reaches a maximum, and (b) the next window after tp->is_cwnd_limited is set to true. But this would require consuming an extra u32 sequence number. Instead, to save space we track only the most important information. Specifically, we track the strongest available signal of the degree to which the cwnd is fully utilized: (1) If the connection is cwnd-limited then we remember that fact for the current window. (2) If the connection not cwnd-limited then we track the maximum number of outstanding packets in the current window. In particular, note that the new logic cannot trigger the buggy (a)/(b) sequence above because with the new logic a condition where tp->packets_out > tp->max_packets_out can only trigger an update of tp->is_cwnd_limited if tp->is_cwnd_limited is false. This first showed up in a testing of a BBRv2 dev branch, but this buggy behavior highlighted a general issue with the tcp_cwnd_validate() logic that can cause cwnd to fail to increase at the proper rate for any TCP congestion control, including Reno or CUBIC. Fixes: ca8a22634381 ("tcp: make cwnd-limited checks measurement-based, and gentler") Signed-off-by: Neal Cardwell Signed-off-by: Kevin(Yudong) Yang Signed-off-by: Yuchung Cheng Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- include/linux/tcp.h | 2 +- include/net/tcp.h | 5 ++++- net/ipv4/tcp.c | 2 ++ net/ipv4/tcp_output.c | 19 ++++++++++++------- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/include/linux/tcp.h b/include/linux/tcp.h index 61eb40fef759..b9bc6e3e4ef9 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h @@ -245,7 +245,7 @@ struct tcp_sock { u32 packets_out; /* Packets which are "in flight" */ u32 retrans_out; /* Retransmitted packets out */ u32 max_packets_out; /* max packets_out in last window */ - u32 max_packets_seq; /* right edge of max_packets_out flight */ + u32 cwnd_usage_seq; /* right edge of cwnd usage tracking flight */ u16 urg_data; /* Saved octet of OOB data and control flags */ u8 ecn_flags; /* ECN status bits. */ diff --git a/include/net/tcp.h b/include/net/tcp.h index 5e719f9d60fd..003638f73ffa 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -1228,11 +1228,14 @@ static inline bool tcp_is_cwnd_limited(const struct sock *sk) { const struct tcp_sock *tp = tcp_sk(sk); + if (tp->is_cwnd_limited) + return true; + /* If in slow start, ensure cwnd grows to twice what was ACKed. */ if (tcp_in_slow_start(tp)) return tp->snd_cwnd < 2 * tp->max_packets_out; - return tp->is_cwnd_limited; + return false; } /* Something is really bad, we could not queue an additional packet, diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index a0fd9ef2d2c6..783d0cd4fcbd 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -2366,6 +2366,8 @@ int tcp_disconnect(struct sock *sk, int flags) icsk->icsk_probes_out = 0; tp->snd_ssthresh = TCP_INFINITE_SSTHRESH; tp->snd_cwnd_cnt = 0; + tp->is_cwnd_limited = 0; + tp->max_packets_out = 0; tp->window_clamp = 0; tp->delivered = 0; if (icsk->icsk_ca_ops->release) diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 6b6dfb08dde4..2a9e55411ac4 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -1618,15 +1618,20 @@ static void tcp_cwnd_validate(struct sock *sk, bool is_cwnd_limited) const struct tcp_congestion_ops *ca_ops = inet_csk(sk)->icsk_ca_ops; struct tcp_sock *tp = tcp_sk(sk); - /* Track the maximum number of outstanding packets in each - * window, and remember whether we were cwnd-limited then. + /* Track the strongest available signal of the degree to which the cwnd + * is fully utilized. If cwnd-limited then remember that fact for the + * current window. If not cwnd-limited then track the maximum number of + * outstanding packets in the current window. (If cwnd-limited then we + * chose to not update tp->max_packets_out to avoid an extra else + * clause with no functional impact.) */ - if (!before(tp->snd_una, tp->max_packets_seq) || - tp->packets_out > tp->max_packets_out || - is_cwnd_limited) { - tp->max_packets_out = tp->packets_out; - tp->max_packets_seq = tp->snd_nxt; + if (!before(tp->snd_una, tp->cwnd_usage_seq) || + is_cwnd_limited || + (!tp->is_cwnd_limited && + tp->packets_out > tp->max_packets_out)) { tp->is_cwnd_limited = is_cwnd_limited; + tp->max_packets_out = tp->packets_out; + tp->cwnd_usage_seq = tp->snd_nxt; } if (tcp_is_cwnd_limited(sk)) { From patchwork Mon Oct 24 11:30:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10147 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp638540wru; Mon, 24 Oct 2022 13:27:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM74prmJMMXrFVcleUVfVaZuEasj99aYtB/c9z6ENwpMj/jMXqARYSIFrxP3wpuq84bZt/jK X-Received: by 2002:a17:907:a47:b0:79e:56dc:5373 with SMTP id be7-20020a1709070a4700b0079e56dc5373mr14746166ejc.148.1666643234393; Mon, 24 Oct 2022 13:27:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643234; cv=none; d=google.com; s=arc-20160816; b=sNMi2/3jb9vQvZmxDYfcvdJelfQF1o8QTfCjaUc5qPptKbLjg98qQWVVa8Sny7orJP 3o5ohctEtz1jgI7WUvpocdv69HD7+oYb56rSKm1eIwMlT4xpvWYAhF9EernelYcqbApi wkT5UvUbNnEArWRsxLsxV6QmgzUArqolQWGoGAuhw10LV9eX7EBIqEe1Odx8S2Y+vlbn okW/pzqNv2bF5U81FZ7XNk2YnO1I7y4u1LTM844tHdoxICXwDiTHyNKK072WzmSPfLrJ 9fcV6QaEO0Q0xCAEIw/lZZXCngByG/XX0gAvUNpCRH4UzBAXwH/UBG/Xwy5cQEdURdbu yeVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lJBCCHlfmw0Tzu1mT1fvqlEYMGba/85H0JU+RoIphVI=; b=pkb0Nzo5Kq0bT/NbRv36tFD4IUKU9A2cVNADODtHcwfqcdRqGldXyEKlXsnjWceMpY X04qPPGNnjT4hU59cjHzO7HoVknPgtPynOzbGD0rgWWGgdD90ihO5lpkE2zCz2c7SXgr W84UEcHtiTNd51ljjZ03PJoaLO2qUCbtSPocaj9EBgNgJS1sXfm6sVwPXKLLqUfKKswW jcMLPsUhFXUMMtfzpKFwCTdNWwIxGYN8Exhc/dMGCSJnrmsnsJag3v7X9dvKtMSRus1R NnVe7OgTGVcTT8RhLtm3CBZGhV0NBEg4AlnbJkqH2Dr5Q8kKxMUVOK7NTl/VGuBKQWSD EXJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cuBqj0G2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bf2-20020a0564021a4200b00459c2ac54e2si622776edb.255.2022.10.24.13.26.48; Mon, 24 Oct 2022 13:27:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cuBqj0G2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233812AbiJXUQD (ORCPT + 99 others); Mon, 24 Oct 2022 16:16:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233399AbiJXUO2 (ORCPT ); Mon, 24 Oct 2022 16:14:28 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70148EACB9; Mon, 24 Oct 2022 11:33:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 7C320CE1346; Mon, 24 Oct 2022 11:49:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5814BC433D6; Mon, 24 Oct 2022 11:49:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612173; bh=ksz5cn29JcW54iRPWf1XJ2b6P5WFBFylJ5K12NnaA9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cuBqj0G2CvBZRt00SeSicYs1PUYHRDqK53BxqrP6kjfQLgE03wlIHYCJ2nsLbyfDv lzzMwf+SdrhTZLQVo/OcePc8BIuAdUuMeCooBgD650r7pdVmlMp5S1EsaP0RBPmIi5 k2uGAnf9cZsGeAKjNh/ehCPgnKwUVd5KZXbbAqbI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Hillf Danton , Tetsuo Handa , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 096/210] net: rds: dont hold sock lock when cancelling work from rds_tcp_reset_callbacks() Date: Mon, 24 Oct 2022 13:30:13 +0200 Message-Id: <20221024113000.140983339@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602096382573181?= X-GMAIL-MSGID: =?utf-8?q?1747602096382573181?= From: Tetsuo Handa [ Upstream commit a91b750fd6629354460282bbf5146c01b05c4859 ] syzbot is reporting lockdep warning at rds_tcp_reset_callbacks() [1], for commit ac3615e7f3cffe2a ("RDS: TCP: Reduce code duplication in rds_tcp_reset_callbacks()") added cancel_delayed_work_sync() into a section protected by lock_sock() without realizing that rds_send_xmit() might call lock_sock(). We don't need to protect cancel_delayed_work_sync() using lock_sock(), for even if rds_{send,recv}_worker() re-queued this work while __flush_work() from cancel_delayed_work_sync() was waiting for this work to complete, retried rds_{send,recv}_worker() is no-op due to the absence of RDS_CONN_UP bit. Link: https://syzkaller.appspot.com/bug?extid=78c55c7bc6f66e53dce2 [1] Reported-by: syzbot Co-developed-by: Hillf Danton Signed-off-by: Hillf Danton Signed-off-by: Tetsuo Handa Tested-by: syzbot Fixes: ac3615e7f3cffe2a ("RDS: TCP: Reduce code duplication in rds_tcp_reset_callbacks()") Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/rds/tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/rds/tcp.c b/net/rds/tcp.c index 55bae71bf339..ae4901933e6d 100644 --- a/net/rds/tcp.c +++ b/net/rds/tcp.c @@ -162,10 +162,10 @@ void rds_tcp_reset_callbacks(struct socket *sock, */ atomic_set(&cp->cp_state, RDS_CONN_RESETTING); wait_event(cp->cp_waitq, !test_bit(RDS_IN_XMIT, &cp->cp_flags)); - lock_sock(osock->sk); /* reset receive side state for rds_tcp_data_recv() for osock */ cancel_delayed_work_sync(&cp->cp_send_w); cancel_delayed_work_sync(&cp->cp_recv_w); + lock_sock(osock->sk); if (tc->t_tinc) { rds_inc_put(&tc->t_tinc->ti_inc); tc->t_tinc = NULL; From patchwork Mon Oct 24 11:30:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8831 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431415wru; Mon, 24 Oct 2022 05:43:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM65jZcv7oiUd35kypSn9GKgCjIcZahiZWZLdzMI9oFhzJTFJR/zX/BqGFFXDrdwrR/lkaxF X-Received: by 2002:a17:90a:e7d0:b0:20c:169f:7503 with SMTP id kb16-20020a17090ae7d000b0020c169f7503mr73298963pjb.175.1666615421788; Mon, 24 Oct 2022 05:43:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615421; cv=none; d=google.com; s=arc-20160816; b=tsVCon/K/uRDI3GHguonTQgT2bWtCtCMdF8sGzbNP48poUp7b1xukMwZfamtX73I3C HvEsx6NKgrQLAOse6xXGcWsEZrqbFaEyGCxPYbPRXejgjNsCgGhk7+PHmpQtiZyoCdQi k90Mp6rK5gW2qEGthqYza0lvp9EatIUgW84ojd0MxFCQRzWm0g53Mkn5UL9Lhr/2v6+7 7208d9k7w6SNdE9kSAEyXPj0JgXhmK1XgVOLOcCDH2/m8ZLeKppnerIs4FIcB6iETDFr xGHD3XyhyW7vWNfXezcIQaMV9yA/sR50Ygkc1pKbcViLfbKU/p5MO1/N6Ge0j80W+vTf sY1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uvz2uGnkhI/XA/+rL47HaVnw6hiLofWrRrRrAXjdOD0=; b=VEkM+WTxsLNnT4EQ+RhDaLvHlv7NWkx+KGkXeH2XjtoHGH0Icak4npRNjSdfgnWm16 n0lriQOek2MCg3UH0B5F6Iq8p6Kxioe+k6N44yUTCIfqNpS8TizSvpguzYeZs4QXtHOc SEVkaRTIB16KJ26fkpAN+VRafQn2GDqmIuKHRHffetxvxCyOo38ydCxDE/Gs5DEkhroi e7guL+fj1BmAwcIdZnNUyJRDKK7eUwCgAE19SdGkZzA/yUzjcOn0wehVCrpDfd0JB4YA XpUCmNRlFizpk8uDsjpLu9dFSTpGnijvKRIGZXWqzjk+x95MElbN39EQ0nNyhkk0lfdF SsMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dMA79c2t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oc1-20020a17090b1c0100b0020ad6d218cdsi11256690pjb.3.2022.10.24.05.43.27; Mon, 24 Oct 2022 05:43:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dMA79c2t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234423AbiJXMfC (ORCPT + 99 others); Mon, 24 Oct 2022 08:35:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234231AbiJXM3l (ORCPT ); Mon, 24 Oct 2022 08:29:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96FC023BEC; Mon, 24 Oct 2022 05:03:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8FEBDB811A3; Mon, 24 Oct 2022 11:49:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBB4AC433D6; Mon, 24 Oct 2022 11:49:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612176; bh=IT+ZuMJ69P+nAjLoBJUvmEOjP20rG6UnYzu9ZDnddCQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dMA79c2tYlg2QaDwQm9Pi+Vmwsf8UOaKZoYsNfkDqopQKBNeeHWPTXgb7fry00Yft trAbNCBZBmwlTkio3aO4faqnAvArWa1BCExzUEwSMB3l1K3GXtf5IqYlnsNe1TZdz+ z1SpOrln1S+gCYJlfBHhXknVOymbm0io2zLQlAUM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jianglei Nie , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 097/210] bnx2x: fix potential memory leak in bnx2x_tpa_stop() Date: Mon, 24 Oct 2022 13:30:14 +0200 Message-Id: <20221024113000.171390852@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572932683567299?= X-GMAIL-MSGID: =?utf-8?q?1747572932683567299?= From: Jianglei Nie [ Upstream commit b43f9acbb8942b05252be83ac25a81cec70cc192 ] bnx2x_tpa_stop() allocates a memory chunk from new_data with bnx2x_frag_alloc(). The new_data should be freed when gets some error. But when "pad + len > fp->rx_buf_size" is true, bnx2x_tpa_stop() returns without releasing the new_data, which will lead to a memory leak. We should free the new_data with bnx2x_frag_free() when "pad + len > fp->rx_buf_size" is true. Fixes: 07b0f00964def8af9321cfd6c4a7e84f6362f728 ("bnx2x: fix possible panic under memory stress") Signed-off-by: Jianglei Nie Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index 8c111def8185..96478d79243d 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c @@ -787,6 +787,7 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp, BNX2X_ERR("skb_put is about to fail... pad %d len %d rx_buf_size %d\n", pad, len, fp->rx_buf_size); bnx2x_panic(); + bnx2x_frag_free(fp, new_data); return; } #endif From patchwork Mon Oct 24 11:30:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8586 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419196wru; Mon, 24 Oct 2022 05:15:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7me92omFyamBW4dqE4S6tS1nK3oXwIiEOSci8yQvO7kO/alvMbpB8sXTAk1tfx3Vk++C27 X-Received: by 2002:a17:906:99c5:b0:73d:70c5:1a4f with SMTP id s5-20020a17090699c500b0073d70c51a4fmr26324228ejn.302.1666613752525; Mon, 24 Oct 2022 05:15:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613752; cv=none; d=google.com; s=arc-20160816; b=MPgiTyEPinatUyt/Iu8mcGhHHu9K3k+TX30qeZ2C9Q84yoXHChkRZNvrAztJtZ1BO2 VWsA1+mmgz5zJECYGKw7Tbu8mJiXeD9C00FZdqYAjbDNj1vEEuY48xLjdcx6OHnBX2w4 pbawax11UvkH16RDnJqK7ZOhIvJK+LdrLMIHut/Eil7SuhyXtlsHXTNJ6Z/ktzqzqSo9 z7HPp2ddCtVuJth2W61YLVI0/hvL4FsLGrO5p8TY5pMORMI6kXxa00oBBieVBm+JFHYB WOoLOe8v0FoSLBkVSm20dHjb9tr9uvJ+VzNiN+MSXWnpexbZxeWmnTAcoSitWR01ZxLX 23YA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fbMf3FLv7CSe7zyIpP7eOzvzi9YJVZzD2R6rOmlM7z8=; b=uBqO8HLi6PjlVjDMxbH/3szNX9sUAL5bqUJYIKNBn9Yu6D/MitPXXLhhhXNf74D0uP jSeALNBehY2L1Bbesinh3cPUnuPLzyjTDz0rzWC0c64vMGM+IUrHf8drDofwilKW/aaG UtX8X2g7S2hxmRMfBSwU4e/1mc5cNkdy7XbjyOI942pILRADWqfJUzqV/kREHHEoUR5a BPsA6x/6Nz6HbnWW78999YVPqaNRajzRbefk7RBTqmvZVkDzMIIyvrMFqGP037whqDJn heKpw+kv+SxEr83g2ljM+kljIZQUahcXl6gEj6ismqkICM8vxofuyTLCR3bTREXYk6tu ek2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NAAkafaP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ga29-20020a1709070c1d00b0078d43ae07e1si30134920ejc.649.2022.10.24.05.15.27; Mon, 24 Oct 2022 05:15:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NAAkafaP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232706AbiJXMG4 (ORCPT + 99 others); Mon, 24 Oct 2022 08:06:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232911AbiJXMEh (ORCPT ); Mon, 24 Oct 2022 08:04:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D51C73BC68; Mon, 24 Oct 2022 04:50:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 41C5BB811B9; Mon, 24 Oct 2022 11:49:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9692AC433C1; Mon, 24 Oct 2022 11:49:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612178; bh=SrzuHoasVKSFypBy+GmTnPzmZkciHvpxXHdO6la55H4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NAAkafaPdgkfmGTjnB+bujeeB73vyZEyG08GQf4fg8GemyabFtwm3U+2W/74Rv/QX dZ+iW6aARZbYj8f4sSFMlfKEcjCYoVP0prAG1v3mmP1tG7e0E7/joQv8pP0IabWEXo e6+YhRdoxkAA70dVyqQOXyVavfszJavSPtFFezXk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Zimmermann , Maxime Ripard , Sasha Levin Subject: [PATCH 4.14 098/210] drm/mipi-dsi: Detach devices when removing the host Date: Mon, 24 Oct 2022 13:30:15 +0200 Message-Id: <20221024113000.206122481@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571182401683405?= X-GMAIL-MSGID: =?utf-8?q?1747571182401683405?= From: Maxime Ripard [ Upstream commit 668a8f17b5290d04ef7343636a5588a0692731a1 ] Whenever the MIPI-DSI host is unregistered, the code of mipi_dsi_host_unregister() loops over every device currently found on that bus and will unregister it. However, it doesn't detach it from the bus first, which leads to all kind of resource leaks if the host wants to perform some clean up whenever a device is detached. Fixes: 068a00233969 ("drm: Add MIPI DSI bus support") Acked-by: Thomas Zimmermann Signed-off-by: Maxime Ripard Link: https://lore.kernel.org/r/20220711173939.1132294-2-maxime@cerno.tech Signed-off-by: Sasha Levin --- drivers/gpu/drm/drm_mipi_dsi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c index 6f0de951b75d..bd5e8661f826 100644 --- a/drivers/gpu/drm/drm_mipi_dsi.c +++ b/drivers/gpu/drm/drm_mipi_dsi.c @@ -305,6 +305,7 @@ static int mipi_dsi_remove_device_fn(struct device *dev, void *priv) { struct mipi_dsi_device *dsi = to_mipi_dsi_device(dev); + mipi_dsi_detach(dsi); mipi_dsi_device_unregister(dsi); return 0; From patchwork Mon Oct 24 11:30:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8603 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419586wru; Mon, 24 Oct 2022 05:16:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7OcpqAOBADOSPzjFNl3oT0Sa0ROHJ3uIMRILEAWMsqcRtNUBxBsOozbo3N41O211nCx3el X-Received: by 2002:a05:6402:1d4f:b0:461:d2ed:788c with SMTP id dz15-20020a0564021d4f00b00461d2ed788cmr3327644edb.418.1666613794511; Mon, 24 Oct 2022 05:16:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613794; cv=none; d=google.com; s=arc-20160816; b=pUPcB8JaN9iUx2Yv1/CEB07ugHgRi7Oqi2EYTOgcjmcIrqezBl7UIafu5D2+GG8dx/ ZtHmPLDVztRzBI6f8kimLsBuubQmcs/ssQGdcU4vxAk3CvxdkPG8J7T5fOPXVKf5RyF7 wg/VCtgO3fRdGdIh6tT87c363FgxFZrLHptJfkDWuA+NPNRe+jfnDvCPTfoJtVkX15mH 9NUKBgHqI4VJg9yZ/AKYi7P2QnrtZ6gUwJ9lRyKW2yy5IXkYsSbNGJNfb3zzWra1EzKm zYU4bQsqt/HCBBGTW4j6wKalzGjkfkv90B9B6tbgaJMUQ6W+J6kCkVHNhJ9iS6SSGQ7I j5Rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=W5TlCFZqPFVZMvd7vZxFCTmLiY4J76n86xvQCe2pJEo=; b=CzJz18Be9JUQQJojvHJuowLuuN7o93GfR7FNpRiWCY826UjJproqacyHGPUYLibXjb gHoe0AVRdyY86WdkrYc3wY/TGHmyj3IdHo5r6fxuCS7MussLtU8kgHeQSWZjiH6vS9aM oPJ2uE0IwRg1RLnMo368+N4boga7q3Vw+KbBge8Djj/0npHREDc52jIOFhfkDZj/bU9A Mkzti3GgQHAhtHhLHuxhI01aTmC6Fw4349x4aHHiKI3EFns5scAEGmM0zHKroCo9VXqb dQBu8AnIMiv4hj/4QGN5SOT7gNr2bWJ8PutBrrBKeqP8xxm57RSYhmF1w1b5b3kMMT51 Cyhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BbcjQWI7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dv2-20020a170906b80200b0078d2848bca9si23660947ejb.704.2022.10.24.05.16.10; Mon, 24 Oct 2022 05:16:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BbcjQWI7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232786AbiJXMII (ORCPT + 99 others); Mon, 24 Oct 2022 08:08:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232525AbiJXMFa (ORCPT ); Mon, 24 Oct 2022 08:05:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DB627D780; Mon, 24 Oct 2022 04:51:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9014E612BB; Mon, 24 Oct 2022 11:51:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A54F5C433D6; Mon, 24 Oct 2022 11:51:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612287; bh=8veHvggDsF0H695N4ZaRHLld1XJTkiSOIyJfY6Uu+i8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BbcjQWI7IiQj4m55vOPeE3ZFPsHEB5jYgXE8JWdmD6v7ssDUu63kmo+K3KZT9J9Ti +4CHlDxL6/mAnBLm8Vwy4sOB7BCzcglTNmDHHkyyTN6Dp+kO8BxZP/mF5Q8eS5AGUw XYLqVRdcbFbovmF27OXbM3iye/NciAJdKl8aQpKs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Sasha Levin Subject: [PATCH 4.14 099/210] platform/x86: msi-laptop: Fix old-ec check for backlight registering Date: Mon, 24 Oct 2022 13:30:16 +0200 Message-Id: <20221024113000.237096348@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571226098236095?= X-GMAIL-MSGID: =?utf-8?q?1747571226098236095?= From: Hans de Goede [ Upstream commit 83ac7a1c2ed5f17caa07cbbc84bad3c05dc3bf22 ] Commit 2cc6c717799f ("msi-laptop: Port to new backlight interface selection API") replaced this check: if (!quirks->old_ec_model || acpi_video_backlight_support()) pr_info("Brightness ignored, ..."); else do_register(); With: if (quirks->old_ec_model || acpi_video_get_backlight_type() == acpi_backlight_vendor) do_register(); But since the do_register() part was part of the else branch, the entire condition should be inverted. So not only the 2 statements on either side of the || should be inverted, but the || itself should be replaced with a &&. In practice this has likely not been an issue because the new-ec models (old_ec_model==false) likely all support ACPI video backlight control, making acpi_video_get_backlight_type() return acpi_backlight_video turning the second part of the || also false when old_ec_model == false. Fixes: 2cc6c717799f ("msi-laptop: Port to new backlight interface selection API") Signed-off-by: Hans de Goede Link: https://lore.kernel.org/r/20220825141336.208597-1-hdegoede@redhat.com Signed-off-by: Sasha Levin --- drivers/platform/x86/msi-laptop.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/platform/x86/msi-laptop.c b/drivers/platform/x86/msi-laptop.c index d5bfcc602090..7279390a2d54 100644 --- a/drivers/platform/x86/msi-laptop.c +++ b/drivers/platform/x86/msi-laptop.c @@ -1061,8 +1061,7 @@ static int __init msi_init(void) return -EINVAL; /* Register backlight stuff */ - - if (quirks->old_ec_model || + if (quirks->old_ec_model && acpi_video_get_backlight_type() == acpi_backlight_vendor) { struct backlight_properties props; memset(&props, 0, sizeof(struct backlight_properties)); From patchwork Mon Oct 24 11:30:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8599 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419480wru; Mon, 24 Oct 2022 05:16:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4qJ8HQeOmkIhgyeA2x+hCQlIVwFpvVIt0DqX4UJ/5ONbkH5fJ7NbWlR1YXSC88Kzn7EQ+Y X-Received: by 2002:a05:6402:8cc:b0:45c:a5c9:c0a with SMTP id d12-20020a05640208cc00b0045ca5c90c0amr30377312edz.135.1666613782023; Mon, 24 Oct 2022 05:16:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613782; cv=none; d=google.com; s=arc-20160816; b=Q25iirdAjmKDypME9+/eCAuBkBsgTn6Y8mk7rzss3gMdBFv40o/FqWO1bjqp/kyGpQ Yz/GfW8jiFgGCjl/zCnwAel7V21qRy+/HiJ6TGeCbFwtSJbHYaQQz8INA/aP1judBgaW K7+3Sh/rP1fM42MAkO24BZj2MYsm5imIGz0Hwl/sAiBb/zTledPhC6q/3mf4xxxNdE0h oFw02el5Sdl22ORP7YO71cWm2SBYuyyHkxl9bKSL6AKzW/j+8K5n3uqvMXKCM+tIgOQa qaWDpVQ6omUj1+kAIyk8ltQBHnox3N/CujpFcpRPXNOsu8fNPcCjFqQMnfCTbZsancAa nHkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ReqmkBiLT9nj1/NEl8rl8sQNmaUIGHG6NWhdHtHMQIE=; b=kQhxi2fPoC7ESuBsU1rEB1aAIFI3R6ATJFHCVpJYDwbG4+rLTWkO600YejAkvE0ixs dCCYWiskWswYWqlvRyIGL/hzLH4/Ba8Umw0fVeHbuG5q1MwZAS5FLspe5AsXwG1ODnik TWWHu03ud1O58xsPGqTyHx3dCdUVZKCXxgQ0xTXuLwYLP+bmksvXqoYtCloB16jx3RgQ 9SoWFc5htK14DPLpwJK+39+6nuTAbwXhxHLULE+U5NLWTJ1yG9c3ijb3izcCxgKFi0Ab OSSCKOAnfdKRlOKNJ27owGGjUWaUcoMg/1IQml/nAipu7CateKGzUYKhzxN0/zJPJwh2 27HA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QWXODkGg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o3-20020a170906288300b0073d9c412570si22752448ejd.785.2022.10.24.05.15.56; Mon, 24 Oct 2022 05:16:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QWXODkGg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232763AbiJXMHv (ORCPT + 99 others); Mon, 24 Oct 2022 08:07:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233083AbiJXMFE (ORCPT ); Mon, 24 Oct 2022 08:05:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FF6D7CAA2; Mon, 24 Oct 2022 04:51:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 57F29B811C0; Mon, 24 Oct 2022 11:50:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ACFB6C4314F; Mon, 24 Oct 2022 11:49:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612200; bh=xK4TJAnvmIYn/27eY3hx0LNJJauXMyCiuXPB+sk2Bhk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QWXODkGgUiFSeb+Od8xymSOu3+++Jn82mPzmDwGbp0YyFch9rctlRhk0K+VwMkPZK RBGZDTxR/v5SHcz+WzO/9It/mvCSMV5jwyRap4KcMQ4pNf2LLFcDhgSgavUa9IPmxB bKmmTf13slKtTUs/f4eCE2JxyQJK9DSUxsl+Uzt0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Sasha Levin Subject: [PATCH 4.14 100/210] platform/x86: msi-laptop: Fix resource cleanup Date: Mon, 24 Oct 2022 13:30:17 +0200 Message-Id: <20221024113000.267229182@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571213072785222?= X-GMAIL-MSGID: =?utf-8?q?1747571213072785222?= From: Hans de Goede [ Upstream commit 5523632aa10f906dfe2eb714ee748590dc7fc6b1 ] Fix the input-device not getting free-ed on probe-errors and fix the msi_touchpad_dwork not getting cancelled on neither probe-errors nor on remove. Fixes: 143a4c0284dc ("msi-laptop: send out touchpad on/off key") Signed-off-by: Hans de Goede Link: https://lore.kernel.org/r/20220825141336.208597-3-hdegoede@redhat.com Signed-off-by: Sasha Levin --- drivers/platform/x86/msi-laptop.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/platform/x86/msi-laptop.c b/drivers/platform/x86/msi-laptop.c index 7279390a2d54..1ba5f4689df4 100644 --- a/drivers/platform/x86/msi-laptop.c +++ b/drivers/platform/x86/msi-laptop.c @@ -1129,6 +1129,8 @@ static int __init msi_init(void) fail_create_group: if (quirks->load_scm_model) { i8042_remove_filter(msi_laptop_i8042_filter); + cancel_delayed_work_sync(&msi_touchpad_dwork); + input_unregister_device(msi_laptop_input_dev); cancel_delayed_work_sync(&msi_rfkill_dwork); cancel_work_sync(&msi_rfkill_work); rfkill_cleanup(); @@ -1149,6 +1151,7 @@ static void __exit msi_cleanup(void) { if (quirks->load_scm_model) { i8042_remove_filter(msi_laptop_i8042_filter); + cancel_delayed_work_sync(&msi_touchpad_dwork); input_unregister_device(msi_laptop_input_dev); cancel_delayed_work_sync(&msi_rfkill_dwork); cancel_work_sync(&msi_rfkill_work); From patchwork Mon Oct 24 11:30:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8820 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431213wru; Mon, 24 Oct 2022 05:43:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM41ueYObIZeITHhNvRW3D8C5Axd0PSGPNmlbgFAFDrZQ1cH9+KIZs0WiWSLwHrfZgHk6bZT X-Received: by 2002:aa7:9250:0:b0:563:723f:7914 with SMTP id 16-20020aa79250000000b00563723f7914mr32338464pfp.12.1666615393898; Mon, 24 Oct 2022 05:43:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615393; cv=none; d=google.com; s=arc-20160816; b=amnkmq5eNYppGWxQxAw9yQWIZj/T9ghIYmxG08fFzSrUuNaCv1Bs1PWDmPG9rKCxzf xH4q5ppw29dB5qDyIE+nAHVfgEYJs+/ymy3YllqEOJ3R5Aps+jPakGGKWIzcn24VgusG 6yOwZEVjHSKWikclxy+yaE4cMNDI3uJrBUKnKEErUC9WdfNT1n9ZghL4yg68cP+Oey72 PzFgQk4YoO0GwMiWX14twc/nch+52SxHMhgmtH3fIP0QPIlQ8UdDztfg6iHZiz46Uv1X te3vpIztzr1sRa7v/9YKeb2FVnqoApINa2HrNqFOvWCa2qTBJryoCBDw12JzwDEovtZe W04w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kE7X7RghR+FaEciLbPRK2EN9UNOXNHhdSek90FqzL3E=; b=BFn3JZaMQoA7FPT5MuqCtQNHkoCHCFC7zXcAlV60mEvINiS0nidsp/bUmKuYDf0kKC mycrzHv3GKtHFgN3yNMWGczVJ39U0UTKrAUICj4t43qn5OIAevMWkaCK5g+S9IAXZTdI VdzwcITwdkAeMYj++LuXRbUq6mP5N3hfEGZA7APFMdEgTWTi4vRcXFnJnMxVcz2mC2aB HZJR+BoKC/bi6+Xfe5fnEX9ektzw5lsEArv9ogmDJ8VDt9xePxLd7geZOPkjeQdHCVCL cLS1FTp1YgCMkq/1RWzASnAG8ZCUcg+y2RUn0y2Wr31SBN81eKKXHgaVQx8DfaVlU+Mb MFvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pdWIoa9S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h7-20020a635307000000b00450200a1078si36346905pgb.853.2022.10.24.05.42.54; Mon, 24 Oct 2022 05:43:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pdWIoa9S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231199AbiJXMgv (ORCPT + 99 others); Mon, 24 Oct 2022 08:36:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234373AbiJXMaK (ORCPT ); Mon, 24 Oct 2022 08:30:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 058DC11A27; Mon, 24 Oct 2022 05:04:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 62901B811BC; Mon, 24 Oct 2022 11:50:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B43DBC433D7; Mon, 24 Oct 2022 11:50:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612229; bh=p+RDls3UMSxOV4pI0uV5hNiacPwGMJMODJXouPv8m70=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pdWIoa9SISjE/4IoA9Q/E8rt6A7k1zor4VlPl8oLzbH91aKJtX6Dj/znYhXPc6cPd QxJtyVcQr850A3131P+t6AKX0lee/io5Rr9MH7+Mhdat7LLS/uAa4KLTA1rxq6mQFC xFtLNk7ZgqxJXFnoKWqlqRF7jYj16ikYXpmM3pio= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , Robert Foss , Sasha Levin Subject: [PATCH 4.14 101/210] drm/bridge: megachips: Fix a null pointer dereference bug Date: Mon, 24 Oct 2022 13:30:18 +0200 Message-Id: <20221024113000.296878970@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572903480889336?= X-GMAIL-MSGID: =?utf-8?q?1747572903480889336?= From: Zheyu Ma [ Upstream commit 1ff673333d46d2c1b053ebd0c1c7c7c79e36943e ] When removing the module we will get the following warning: [ 31.911505] i2c-core: driver [stdp2690-ge-b850v3-fw] unregistered [ 31.912484] general protection fault, probably for non-canonical address 0xdffffc0000000001: 0000 [#1] PREEMPT SMP KASAN PTI [ 31.913338] KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f] [ 31.915280] RIP: 0010:drm_bridge_remove+0x97/0x130 [ 31.921825] Call Trace: [ 31.922533] stdp4028_ge_b850v3_fw_remove+0x34/0x60 [megachips_stdpxxxx_ge_b850v3_fw] [ 31.923139] i2c_device_remove+0x181/0x1f0 The two bridges (stdp2690, stdp4028) do not probe at the same time, so the driver does not call ge_b850v3_resgiter() when probing, causing the driver to try to remove the object that has not been initialized. Fix this by checking whether both the bridges are probed. Fixes: 11632d4aa2b3 ("drm/bridge: megachips: Ensure both bridges are probed before registration") Signed-off-by: Zheyu Ma Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220830073450.1897020-1-zheyuma97@gmail.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c index 4ab7b034bfec..313c80f29972 100644 --- a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c +++ b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c @@ -290,7 +290,9 @@ static void ge_b850v3_lvds_remove(void) * This check is to avoid both the drivers * removing the bridge in their remove() function */ - if (!ge_b850v3_lvds_ptr) + if (!ge_b850v3_lvds_ptr || + !ge_b850v3_lvds_ptr->stdp2690_i2c || + !ge_b850v3_lvds_ptr->stdp4028_i2c) goto out; drm_bridge_remove(&ge_b850v3_lvds_ptr->bridge); From patchwork Mon Oct 24 11:30:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8594 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419354wru; Mon, 24 Oct 2022 05:16:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4DSNvVbfN2By4dmd5b7G2Bs9v3zTxfffNi90lCp+qg6cxb20kxZPovT9mKzKCuoMqfJQC6 X-Received: by 2002:a05:6402:5ca:b0:43b:6e01:482c with SMTP id n10-20020a05640205ca00b0043b6e01482cmr31125144edx.189.1666613769011; Mon, 24 Oct 2022 05:16:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613769; cv=none; d=google.com; s=arc-20160816; b=zFT1aHksvoiIDbjQgKE2Zae0t5cpPNw6qYsNrp1ATR/zhaqOUivDQSTECCg8I+dTlj 9ORYEaPV3v3mEUwWmwLmL7d8ktgM9caA/DaYw6Omr2TL0pWsM+I3ndn3HvQDhuDdc7dt oEb1hGIPNCI5H0t4Xtin06RQlecfHXYZbzLt2Qv04mvaO6mIiTBV8+AWMAH3h8IeI5hW JB5yZz3NAtzHF3p6mUUXEr3UmZs6sduPE44j8h86T98UwmXID7Rkult22+zB03cOHzzW tpLDE6A2nAuM/qD9X0bHs0+uzC37CZxUj4EwpPBuAreG9oqDgYEutliojTkf0Ehu+gUY vHlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dls44MZfRKxjDpYHgNqgY3mFJmiobBxL0npDJkJwk9w=; b=F761XzZwTeLOPxZQ7ACQE/6C4DygLVbp1BzOV0dn3O/ymqC2jgarfY8gaWN5EEoH77 +LFksm55RgjwE3+hXC9HpGCojyJmWMKHPRVpOiwQ7aKNFTQbLJhy8vHokqoZ4lTTFtve ZVXAVt5HCEwfyG+r8eqHL5sB//AXWyBFicaxPGgQAFElTd+EpzpimUClFVOvY3IOvZaj kgcQ/trjiKfvf9ukzkDYibq5L4IwrqH4RLCFtNYACScVuO0FCmMpOV8INl9vQfOuCGR2 shouPIrCobEwr3Sx/5m5OOS2VZKttYHDLr4hUL2af2EhEsqc47/10XrY0HRdnxDpiUNy J/tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Zf3G9eab; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oz36-20020a1709077da400b0078d930212c0si28086321ejc.347.2022.10.24.05.15.44; Mon, 24 Oct 2022 05:16:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Zf3G9eab; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232513AbiJXMHb (ORCPT + 99 others); Mon, 24 Oct 2022 08:07:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232982AbiJXMEr (ORCPT ); Mon, 24 Oct 2022 08:04:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA66C54675; Mon, 24 Oct 2022 04:51:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7BFEF612BB; Mon, 24 Oct 2022 11:50:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8CC17C433D7; Mon, 24 Oct 2022 11:50:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612257; bh=0uWZkCQZvSSzBLwJUw8HecZ+r/KnHBzmlr7A/oiemN8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zf3G9eab/UXptXFoCPkHVpM/9IDKGQrv8I9iURnvW1nJEFzqaWMKNi6QbTYSs/Nhu aSD+189v9QIh2D8WNbq9gtEXaosm6VYlQFHaX2GxZIoK9WX8yvkIHL90LCIUNKzqNC qiO/FdwQvB+cLT6/qouqLvpLxWSZLOA4RX9cdACY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Ulf Hansson , Sasha Levin Subject: [PATCH 4.14 102/210] mmc: au1xmmc: Fix an error handling path in au1xmmc_probe() Date: Mon, 24 Oct 2022 13:30:19 +0200 Message-Id: <20221024113000.327016644@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571199484134903?= X-GMAIL-MSGID: =?utf-8?q?1747571199484134903?= From: Christophe JAILLET [ Upstream commit 5cbedf52608cc3cbc1c2a9a861fb671620427a20 ] If clk_prepare_enable() fails, there is no point in calling clk_disable_unprepare() in the error handling path. Move the out_clk label at the right place. Fixes: b6507596dfd6 ("MIPS: Alchemy: au1xmmc: use clk framework") Signed-off-by: Christophe JAILLET Link: https://lore.kernel.org/r/21d99886d07fa7fcbec74992657dabad98c935c4.1661412818.git.christophe.jaillet@wanadoo.fr Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- drivers/mmc/host/au1xmmc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/au1xmmc.c b/drivers/mmc/host/au1xmmc.c index ed77fbfa4774..a1667339e21d 100644 --- a/drivers/mmc/host/au1xmmc.c +++ b/drivers/mmc/host/au1xmmc.c @@ -1114,8 +1114,9 @@ static int au1xmmc_probe(struct platform_device *pdev) if (host->platdata && host->platdata->cd_setup && !(mmc->caps & MMC_CAP_NEEDS_POLL)) host->platdata->cd_setup(mmc, 0); -out_clk: + clk_disable_unprepare(host->clk); +out_clk: clk_put(host->clk); out_irq: free_irq(host->irq, host); From patchwork Mon Oct 24 11:30:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8600 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419476wru; Mon, 24 Oct 2022 05:16:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM76QUx8nA4b9PoXHEbWjuLpICsAX8tPVZcWhlDjCbVj4QWRQ3KSbqxZ30FJ0DMln5XOUTKa X-Received: by 2002:a17:907:7f05:b0:78d:e869:f2fe with SMTP id qf5-20020a1709077f0500b0078de869f2femr25900209ejc.684.1666613781954; Mon, 24 Oct 2022 05:16:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613781; cv=none; d=google.com; s=arc-20160816; b=pc1yPs1y02J47XMPnBRVpi4uYzhkABI3E3DCIxcvBDhlo7iAiKHBy9ikPWsoLZz1D7 2gQpXiNdkUolZWY3Npg7+9fp8P+OQbwXd40QpyJI2XEO2l3vmGb291HxMv/ivAq3RcYZ OPmJGO94uUaonyim+JWaQCLQH04D/ef+dz0EXLtRh0yM7NnDiaOJBVewKwNwN1y6Y9YF 6TOcNnIsBqdAQmVup9RW0zXAOFUuP95J7wAqrhU0VLRlAw11KdnvHph8ToAPG7W5Lr3M JR4YFXH4/1leyvAHS15/ZscxgFb/i7SDdNYDax5HILd+ZFQ1fNyVPXYl/s9YHvNpTu8D F4Pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XyuslodraOlWLSKMKKFwSYlnI+b/jhPHllu1tFE+hNo=; b=js3onl5GzSPriu2JlCTuWQ543qRkT44Be+JLLOJzS8DifNdYqCdehVeQxMH4RxEAz1 pJZ3lgaeIrJDHMG0D2AKGxYJpujAQF1MmxiFOBe6P6cM0r5m8hM8ZdWsjieoiWQmG/eB iz4E3uPSEnRIuUtaoqSSwOy7V6SN+7990OFBrtsksuX5AhPw5/6BhQ8pLSYKeyAE7hHY jeTdIDsNBjkhalLS00MPGvOVhgcWA6FVKQtQ4NGN7OrJgwK5JpCeKrGweIemLZ1ZbZEB DZaBeq5CdBclTl3ASrALBQrovHRgVdARhB70ARTWsTPi0T3Ho70OVeHWIdrW8qImO6yZ wI7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Eh+3wf2y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s3-20020a17090699c300b0078e254ae43fsi30611321ejn.787.2022.10.24.05.15.57; Mon, 24 Oct 2022 05:16:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Eh+3wf2y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232768AbiJXMH5 (ORCPT + 99 others); Mon, 24 Oct 2022 08:07:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233108AbiJXMFI (ORCPT ); Mon, 24 Oct 2022 08:05:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EFF37D7AF; Mon, 24 Oct 2022 04:51:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C8611612CE; Mon, 24 Oct 2022 11:51:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCD2AC433D6; Mon, 24 Oct 2022 11:51:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612271; bh=a8l/I2TuFnDZ2LIT3P89OUO8cHanDUNMh7fG1SpkHa8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Eh+3wf2yBzhC1Tn7nq2JcTWgZ6y6XJqqqDjK2Pt4YDq3xmeBSATSf+/eBbeiwKqcH WJRhV9bgsnhWDDd7tD/O24sExFLFAwMP9ECBtk78arVThNK3qTYDTN4XV2pAtaBsWv Cvk4N+aDIuA0EgaqzUAIJ15rqam+gYfTq09P5LHI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Mark Brown , Sasha Levin , Kelin Wang Subject: [PATCH 4.14 103/210] ASoC: eureka-tlv320: Hold reference returned from of_find_xxx API Date: Mon, 24 Oct 2022 13:30:20 +0200 Message-Id: <20221024113000.357615385@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571212778990324?= X-GMAIL-MSGID: =?utf-8?q?1747571212778990324?= From: Liang He [ Upstream commit bfb735a3ceff0bab6473bac275da96f9b2a06dec ] In eukrea_tlv320_probe(), we need to hold the reference returned from of_find_compatible_node() which has increased the refcount and then call of_node_put() with it when done. Fixes: 66f232908de2 ("ASoC: eukrea-tlv320: Add DT support.") Co-authored-by: Kelin Wang Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220914134354.3995587-1-windhl@126.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/fsl/eukrea-tlv320.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sound/soc/fsl/eukrea-tlv320.c b/sound/soc/fsl/eukrea-tlv320.c index 4c6f19ef98b2..04ef886f71b2 100644 --- a/sound/soc/fsl/eukrea-tlv320.c +++ b/sound/soc/fsl/eukrea-tlv320.c @@ -88,7 +88,7 @@ static int eukrea_tlv320_probe(struct platform_device *pdev) int ret; int int_port = 0, ext_port; struct device_node *np = pdev->dev.of_node; - struct device_node *ssi_np = NULL, *codec_np = NULL; + struct device_node *ssi_np = NULL, *codec_np = NULL, *tmp_np = NULL; eukrea_tlv320.dev = &pdev->dev; if (np) { @@ -145,7 +145,7 @@ static int eukrea_tlv320_probe(struct platform_device *pdev) } if (machine_is_eukrea_cpuimx27() || - of_find_compatible_node(NULL, NULL, "fsl,imx21-audmux")) { + (tmp_np = of_find_compatible_node(NULL, NULL, "fsl,imx21-audmux"))) { imx_audmux_v1_configure_port(MX27_AUDMUX_HPCR1_SSI0, IMX_AUDMUX_V1_PCR_SYN | IMX_AUDMUX_V1_PCR_TFSDIR | @@ -160,10 +160,11 @@ static int eukrea_tlv320_probe(struct platform_device *pdev) IMX_AUDMUX_V1_PCR_SYN | IMX_AUDMUX_V1_PCR_RXDSEL(MX27_AUDMUX_HPCR1_SSI0) ); + of_node_put(tmp_np); } else if (machine_is_eukrea_cpuimx25sd() || machine_is_eukrea_cpuimx35sd() || machine_is_eukrea_cpuimx51sd() || - of_find_compatible_node(NULL, NULL, "fsl,imx31-audmux")) { + (tmp_np = of_find_compatible_node(NULL, NULL, "fsl,imx31-audmux"))) { if (!np) ext_port = machine_is_eukrea_cpuimx25sd() ? 4 : 3; @@ -180,6 +181,7 @@ static int eukrea_tlv320_probe(struct platform_device *pdev) IMX_AUDMUX_V2_PTCR_SYN, IMX_AUDMUX_V2_PDCR_RXDSEL(int_port) ); + of_node_put(tmp_np); } else { if (np) { /* The eukrea,asoc-tlv320 driver was explicitly From patchwork Mon Oct 24 11:30:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8612 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419931wru; Mon, 24 Oct 2022 05:17:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4SQitpvDQM56brGcwjASTgFoIWFG5BEHuLnKxFQeSsLit22N3ZylI7woqPW+D9aNWATxDY X-Received: by 2002:a05:6402:5cb:b0:452:e416:2bc4 with SMTP id n11-20020a05640205cb00b00452e4162bc4mr30074957edx.114.1666613834359; Mon, 24 Oct 2022 05:17:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613834; cv=none; d=google.com; s=arc-20160816; b=cjazkdkJMEUQH+9wwt8xSgrhDMf7UcUIgRVQdEW2U6JRZQV/Ayni4+HzGfumM+68TP hNEXz6irvHo3KRBNF4XB+jYBb4ygL/+c+OmWr+l4i14g6585pW4/q+V1xL7nP5RUvJ1g ZkCY5hztcs4MFzPKujnGt3Rnkz6r/06bCmiR3kGzrLWjZXR70opN3JBnCLqr9YrjWyKz CNfTd7zJscEo35PoRzmB3CKM175bna4PETsdTsJgw4rNustxRYmjYTS1egMgIRhBtW0F AkU7WWGAPEWBJkU8EoBf6ATwIDiBxhCNzH9p04DKSHoNQkpLxpplDR70mwCsTkzFOBLe pOGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jhClmv/4OFgRakic9tvTLB6c0xJfsOQdZuerEksrzJw=; b=0zlkRS06lAbsOgy5ZpVmZDNNs716FDOGxvonnavU0Q62ihzbwPmo89B3L5jFGcylaU WWbD5ZJsUk/POSbnazWhOOXeIyKWcO6PB3OsisNexyvTsZi7w/eRJD9X4C25sEk4rVrK WGb8OlXG94nVQ97CXu3aaBKY4Afcn3LriuZVAvEfoVATDkWuoOplCxvJwCvkq48Y3hAP TSDxjDIT9ZV2YaU+iqOZbyhS2XHfJ7OA9rWqDoUScURBogsGVvqMFeH2XXnoEKGMNrsS BR5fCBeE7+hnFIyh3Q95BjNmt6HQ7Hv7muyci00tHhUg/LbLs7XPkpymsn+s97i3Wk82 f64w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=i1S+8W9D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hg7-20020a1709072cc700b0078e1216fb07si14331153ejc.558.2022.10.24.05.16.50; Mon, 24 Oct 2022 05:17:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=i1S+8W9D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230164AbiJXMKV (ORCPT + 99 others); Mon, 24 Oct 2022 08:10:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232831AbiJXMI7 (ORCPT ); Mon, 24 Oct 2022 08:08:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A27777E036; Mon, 24 Oct 2022 04:52:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3158CB811A1; Mon, 24 Oct 2022 11:51:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7FABEC433B5; Mon, 24 Oct 2022 11:51:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612273; bh=bZwGPZDTogpLUxzxQ5yHMwfGBVlcNdR2myoMTG7FLZA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i1S+8W9DTxoUU0Q+1mQATXu0c0KULHHXi5G2Qah1lXHWsTyqYCb0Zq1vtevwZgXDW uGAzvxbHDbX6RSdOTGGgVzV/luUw8JPOXiyPBrL2yu8JjHoYniEYQYJEkzZs2Rd47x N7ISjJC1w+maDC5ylLQ9HvPnOKIVsiaBgMJBN6G0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andreas Pape , Eugeniu Rosca , Takashi Iwai , Sasha Levin Subject: [PATCH 4.14 104/210] ALSA: dmaengine: increment buffer pointer atomically Date: Mon, 24 Oct 2022 13:30:21 +0200 Message-Id: <20221024113000.387398401@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571268276388509?= X-GMAIL-MSGID: =?utf-8?q?1747571268276388509?= From: Andreas Pape [ Upstream commit d1c442019594692c64a70a86ad88eb5b6db92216 ] Setting pointer and afterwards checking for wraparound leads to the possibility of returning the inconsistent pointer position. This patch increments buffer pointer atomically to avoid this issue. Fixes: e7f73a1613567a ("ASoC: Add dmaengine PCM helper functions") Signed-off-by: Andreas Pape Signed-off-by: Eugeniu Rosca Link: https://lore.kernel.org/r/1664211493-11789-1-git-send-email-erosca@de.adit-jv.com Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/core/pcm_dmaengine.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sound/core/pcm_dmaengine.c b/sound/core/pcm_dmaengine.c index 8eb58c709b14..6f6da1128edc 100644 --- a/sound/core/pcm_dmaengine.c +++ b/sound/core/pcm_dmaengine.c @@ -139,12 +139,14 @@ EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_set_config_from_dai_data); static void dmaengine_pcm_dma_complete(void *arg) { + unsigned int new_pos; struct snd_pcm_substream *substream = arg; struct dmaengine_pcm_runtime_data *prtd = substream_to_prtd(substream); - prtd->pos += snd_pcm_lib_period_bytes(substream); - if (prtd->pos >= snd_pcm_lib_buffer_bytes(substream)) - prtd->pos = 0; + new_pos = prtd->pos + snd_pcm_lib_period_bytes(substream); + if (new_pos >= snd_pcm_lib_buffer_bytes(substream)) + new_pos = 0; + prtd->pos = new_pos; snd_pcm_period_elapsed(substream); } From patchwork Mon Oct 24 11:30:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8596 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419406wru; Mon, 24 Oct 2022 05:16:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4de0Ew3GiHj34r2h7wuN64VTMVJywHiwhK+w9Itf8lwqN0tTePubp7jH4d0NCeUDC3ACat X-Received: by 2002:a05:6402:2744:b0:45c:9978:eae8 with SMTP id z4-20020a056402274400b0045c9978eae8mr30770890edd.361.1666613774800; Mon, 24 Oct 2022 05:16:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613774; cv=none; d=google.com; s=arc-20160816; b=WTt6op+8p5pCbieq2rrVlUcArF/M3adYJvo3WDmVys/uyPjdjilT9XFloBEdIGVk6C z1FRqt6xxhPCqSpxTfUiSr4erNtWmSsIuj27psvhj3ZvMfjvilnntFlIK6MlBSQOe5NE 5f8cEnUNLYKOYZevnEMryxHw3xRWUB+xKAsXx8dVua1wknODH0zKef7kdFCXPFzQithz 981hMEUJcnHqWQ30VYBclB9kffsVx1w/95ULtNFrUvHGeQ+KlGMLerk0agPZ3f/JkLZ+ aKhCpWy8IyDEvkGv2nnA1pgBM3zqj111lD5Jv0f3+PQNM2pkX7cLTsd3wcU9pjrTqyJN tiiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fLMQi09DfP9PeWJ0Y6ykVLwzF6oMcwEYiN4AkbxL/II=; b=aUi7AVFFZvv6Pxbb0FpKchMILr9HuB3oFOs6VmV6cGkVhxa0KVEWffnnQ6ohOfMI3M OguRE+GnGCO+6XHuFhrQihdWZyzoeqNUINbtzevzVyTW+zI87rjrOzlhNB2DlD9kQ5SH PcAURJtij54lvd2Ed6qBAMdy9zQ5WgP8d2wMUM/MqjeZgUWCNmdghXKmNtyONTPwd0uL 0pUBe/HAZ84XToJisslSABUoffYNGpwgmjJMYaFTQE+kDMuMJ3mG+LLFROU9qNrGtV5f G91BqFsFjHFQyu9++TioouLQ8SUiINxZ+z+4TTAzgwJ99LYiDX+oGjhcOk9ha0u8rQdM xDMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zAg7tOYV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw20-20020a1709066a1400b0078dad5e8d65si24286151ejc.68.2022.10.24.05.15.50; Mon, 24 Oct 2022 05:16:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zAg7tOYV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232761AbiJXMHr (ORCPT + 99 others); Mon, 24 Oct 2022 08:07:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233082AbiJXMFE (ORCPT ); Mon, 24 Oct 2022 08:05:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A00B7CE24; Mon, 24 Oct 2022 04:51:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1AC68612D6; Mon, 24 Oct 2022 11:51:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 279C3C4347C; Mon, 24 Oct 2022 11:51:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612276; bh=8qIvuZtQBIn+XzpoaTxZT9Xx9bczzWsukg2GyFCA1/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zAg7tOYVjaEZqY8LOD1/8ne7NWQI9+q2mSO7PjlAvGisTEMsYiPAo9iAkRqMBkxBB mXworgjbbsuriasqwgmfRabXAh2YYAEYthaWKOso3YB2qpT+T48sEecfc66rmHC23p SY+EAKbYKtTMCorJmDgKAoEAH002Y1Nz/sqhj2/E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Dan Carpenter , Ulf Hansson , Sasha Levin Subject: [PATCH 4.14 105/210] mmc: wmt-sdmmc: Fix an error handling path in wmt_mci_probe() Date: Mon, 24 Oct 2022 13:30:22 +0200 Message-Id: <20221024113000.422320989@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571205095305313?= X-GMAIL-MSGID: =?utf-8?q?1747571205095305313?= From: Christophe JAILLET [ Upstream commit cb58188ad90a61784a56a64f5107faaf2ad323e7 ] A dma_free_coherent() call is missing in the error handling path of the probe, as already done in the remove function. Fixes: 3a96dff0f828 ("mmc: SD/MMC Host Controller for Wondermedia WM8505/WM8650") Signed-off-by: Christophe JAILLET Reviewed-by: Dan Carpenter Link: https://lore.kernel.org/r/53fc6ffa5d1c428fefeae7d313cf4a669c3a1e98.1663873255.git.christophe.jaillet@wanadoo.fr Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- drivers/mmc/host/wmt-sdmmc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/wmt-sdmmc.c b/drivers/mmc/host/wmt-sdmmc.c index fd30ac7da5e5..85cad20b2ae8 100644 --- a/drivers/mmc/host/wmt-sdmmc.c +++ b/drivers/mmc/host/wmt-sdmmc.c @@ -853,7 +853,7 @@ static int wmt_mci_probe(struct platform_device *pdev) if (IS_ERR(priv->clk_sdmmc)) { dev_err(&pdev->dev, "Error getting clock\n"); ret = PTR_ERR(priv->clk_sdmmc); - goto fail5; + goto fail5_and_a_half; } ret = clk_prepare_enable(priv->clk_sdmmc); @@ -870,6 +870,9 @@ static int wmt_mci_probe(struct platform_device *pdev) return 0; fail6: clk_put(priv->clk_sdmmc); +fail5_and_a_half: + dma_free_coherent(&pdev->dev, mmc->max_blk_count * 16, + priv->dma_desc_buffer, priv->dma_desc_device_addr); fail5: free_irq(dma_irq, priv); fail4: From patchwork Mon Oct 24 11:30:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8622 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp420279wru; Mon, 24 Oct 2022 05:17:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5o7ZhvTdnG+EVAzk9ES8CXSM8MB5m8PYMswpyCZzSLYt57Z+Exv1Wh6rCNDy50eZYpV/Sx X-Received: by 2002:a17:907:2cd9:b0:78d:9e76:be26 with SMTP id hg25-20020a1709072cd900b0078d9e76be26mr26691426ejc.315.1666613874449; Mon, 24 Oct 2022 05:17:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613874; cv=none; d=google.com; s=arc-20160816; b=WKwrdtoSSOOa4RISMOfITClGVOBHx42DFUwy96x+0e1FjTkLN0kMzv49J+nn2aqMSK LA/+TCUhyEZ+vYOxfvOIUzkJgEIAOFVdvBs2tgN3jMVD+vgmvZ4CwhKBhwtK/2mHzVTt fGczfEiNKT9DZ3NPA7QE9z+rekgx6R8b/pehKG5X6UNco1WY2+oLGh4BqnqdyAIz+6bR EjwT0Cah+0W7XIDS0M7bZJbPMw13ajcfq5iA1TdXD7DDCd0q8zuquBKD9cRMu1yc+EcQ LAahK1SJD2hFYXBbKmJQRVG82GMe3AmuQHU8qDfrnYQTbfY9m+lecYXZUPQ7g3y6/1mE FReQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UsLAapROTjcpFyKP+n25hzfibwA/40UUxlNrafTaqkI=; b=LrrhYeHgdzM+qnHwnlREt8D1EHhIZPFRHWSDYUPBEWNr1ZKvOm8r4OYpS1R5coOg5w T1JaeNBYyHaEOwU+WzzyfntghrTFkmP/DJ1oB8Cyc5BH7Nco4LZs2Zh3Nu9QYyPGj2Yv +IkGgeIFwJW6IzjtUeZW2k/QWY15rvU61po3E6PrDSLCvhSz59nuP4CZNnDt4D2DSZPk sWB4XEOmXD6su5rn2gfjkiBSyvImrv2Hxdv02F2MB1Y1A01WZ/RF954itBHqgeqB8ver Ic8lXP88ke3M3SP/H8CxxL89xoahR5HOsU1caDHQVQEPZCd1jDqVaJuxOcyNILvMw6oT +yag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=N4g1N5QM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nd33-20020a17090762a100b0077ac5f39842si32151470ejc.96.2022.10.24.05.17.30; Mon, 24 Oct 2022 05:17:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=N4g1N5QM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229766AbiJXMKz (ORCPT + 99 others); Mon, 24 Oct 2022 08:10:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233045AbiJXMJ2 (ORCPT ); Mon, 24 Oct 2022 08:09:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AA8E2618; Mon, 24 Oct 2022 04:52:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6F11BB81190; Mon, 24 Oct 2022 11:51:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD835C433D6; Mon, 24 Oct 2022 11:51:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612279; bh=EEFNLSb8iNcOZyiCRkJW9dNUJ383IzbjdI0YY57GVjc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N4g1N5QMsT0AoD7bZmRr6Cu7rVPLRfBrKljr5LdHhYuAXf9ARYYe1xR6A0A/cYzkg Qnj2N7PROoOuXGLtdpiOSiFmRknHYFq1zuXWLveR5elm0pqX/ZQ45xCJev3NgIs/la PkhjpedwP7tx27tY4+n61gE4soBDrc28tEd+gY2A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Krzysztof Kozlowski , Sasha Levin Subject: [PATCH 4.14 106/210] memory: of: Fix refcount leak bug in of_get_ddr_timings() Date: Mon, 24 Oct 2022 13:30:23 +0200 Message-Id: <20221024113000.455445590@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571309806817495?= X-GMAIL-MSGID: =?utf-8?q?1747571309806817495?= From: Liang He [ Upstream commit 05215fb32010d4afb68fbdbb4d237df6e2d4567b ] We should add the of_node_put() when breaking out of for_each_child_of_node() as it will automatically increase and decrease the refcount. Fixes: e6b42eb6a66c ("memory: emif: add device tree support to emif driver") Signed-off-by: Liang He Signed-off-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220719085640.1210583-1-windhl@126.com Signed-off-by: Sasha Levin --- drivers/memory/of_memory.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/memory/of_memory.c b/drivers/memory/of_memory.c index 568f05ed961a..36517b7d093e 100644 --- a/drivers/memory/of_memory.c +++ b/drivers/memory/of_memory.c @@ -135,6 +135,7 @@ const struct lpddr2_timings *of_get_ddr_timings(struct device_node *np_ddr, for_each_child_of_node(np_ddr, np_tim) { if (of_device_is_compatible(np_tim, tim_compat)) { if (of_do_get_timings(np_tim, &timings[i])) { + of_node_put(np_tim); devm_kfree(dev, timings); goto default_timings; } From patchwork Mon Oct 24 11:30:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8639 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421358wru; Mon, 24 Oct 2022 05:20:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6XBEyx038/ZXMjoEWX+9v7pqrAm7EtTiu92uu8A7eTfLH5krc5aukemPioi3ZaR2BXlw3t X-Received: by 2002:a17:907:a42c:b0:7aa:97e5:fac6 with SMTP id sg44-20020a170907a42c00b007aa97e5fac6mr1229092ejc.378.1666614020903; Mon, 24 Oct 2022 05:20:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614020; cv=none; d=google.com; s=arc-20160816; b=GjSgUrvWdy1kWaWKMohGqWAUzO/nxvJ7FHMeITK6z0i/D7bj9NTNFQqurpdM/od6t2 yegzGzncp73q+/C9lM59HAUzKqldti2jG34adsLNWJ+YuGtE2aDmwxn4rwi6RorEg9PP T5gxc15em6CN1WkSBis/imRoAoM8r9F3QEDrBu113u5rYoHeKRtPhcbbQCs8bru3uvVA QxRs842NmSYgQe3cZQ+UoXf8EXnfBFLEK8JUreBcJAV7U+VSQ+O0iow4Q00ceK60L2y0 pCSZxiWdL72ssJXlEDFDzU0IcUsVddUYegUjpZfT80lbImfeSRL0TRLmIP1mtVTOfOgl k+Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0l1UCfchiAOYZ9txbsQM9R2PKLiaKHIkWJKFIVeVXIU=; b=F7li1hABkL+UrF0R8p/Bg7vKBK73/9TIV+p1RCSfOsIlaE4bV/GvMBK4y0iz6MGXt1 G1Az0ahq+L0dVuGvNKjgm5tUZeifdpC75h/S10fc43/RpPy6hpjA2zeJWlN2SLNxTIf/ XEGS9vp5Zz1r5QBCid9s2mb16f4U+iAwuiJWKcAUc8vzBoKuxARDv+9KqpZ3DBXh0ZBg 3sQj0DLm5MfsdVuNG1uhBxIjPKB7K4hzAWYwlbMPJDvtByWiN+JSHIWpqI7nS6GC6v7Z aq4cWQzqI2OATdYRK7Qdzsam1cQnF9LB/Kui1Lk1rYvz3Wi7VtOhacYLqHzKl6sKm8fA QWiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jqqWLrMx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ne21-20020a1709077b9500b007a8c58b51a3si2603126ejc.725.2022.10.24.05.19.57; Mon, 24 Oct 2022 05:20:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jqqWLrMx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232909AbiJXMNa (ORCPT + 99 others); Mon, 24 Oct 2022 08:13:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232903AbiJXMMf (ORCPT ); Mon, 24 Oct 2022 08:12:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCC21BC8D; Mon, 24 Oct 2022 04:54:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 44ED6612B2; Mon, 24 Oct 2022 11:51:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54708C433D6; Mon, 24 Oct 2022 11:51:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612281; bh=qKvP4bmsphMKHgqIDzfbkKxyiFWTwXsEYkyhH5HCDMQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jqqWLrMxIXsNYEZ8bTFfvDy+3uz8uLfR039xXRiF55o3YugPi555Q+NrZLbk2GLDS f8ycMJW9LV3cwoyQqVI+eydgKVPbbV/aWAaQXfr7cnPXFlMfGtjkG4Q4h4T0feG3Wq EXPuqMe9kX7nNnFosQlpJRbdZ7UBhGIk9WzU+VfI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Bjorn Andersson , Sasha Levin Subject: [PATCH 4.14 107/210] soc: qcom: smsm: Fix refcount leak bugs in qcom_smsm_probe() Date: Mon, 24 Oct 2022 13:30:24 +0200 Message-Id: <20221024113000.486304399@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571463495685920?= X-GMAIL-MSGID: =?utf-8?q?1747571463495685920?= From: Liang He [ Upstream commit af8f6f39b8afd772fda4f8e61823ef8c021bf382 ] There are two refcount leak bugs in qcom_smsm_probe(): (1) The 'local_node' is escaped out from for_each_child_of_node() as the break of iteration, we should call of_node_put() for it in error path or when it is not used anymore. (2) The 'node' is escaped out from for_each_available_child_of_node() as the 'goto', we should call of_node_put() for it in goto target. Fixes: c97c4090ff72 ("soc: qcom: smsm: Add driver for Qualcomm SMSM") Signed-off-by: Liang He Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220721135217.1301039-1-windhl@126.com Signed-off-by: Sasha Levin --- drivers/soc/qcom/smsm.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/soc/qcom/smsm.c b/drivers/soc/qcom/smsm.c index 5304529b41c9..a8a1dc49519e 100644 --- a/drivers/soc/qcom/smsm.c +++ b/drivers/soc/qcom/smsm.c @@ -519,7 +519,7 @@ static int qcom_smsm_probe(struct platform_device *pdev) for (id = 0; id < smsm->num_hosts; id++) { ret = smsm_parse_ipc(smsm, id); if (ret < 0) - return ret; + goto out_put; } /* Acquire the main SMSM state vector */ @@ -527,13 +527,14 @@ static int qcom_smsm_probe(struct platform_device *pdev) smsm->num_entries * sizeof(u32)); if (ret < 0 && ret != -EEXIST) { dev_err(&pdev->dev, "unable to allocate shared state entry\n"); - return ret; + goto out_put; } states = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_SMSM_SHARED_STATE, NULL); if (IS_ERR(states)) { dev_err(&pdev->dev, "Unable to acquire shared state entry\n"); - return PTR_ERR(states); + ret = PTR_ERR(states); + goto out_put; } /* Acquire the list of interrupt mask vectors */ @@ -541,13 +542,14 @@ static int qcom_smsm_probe(struct platform_device *pdev) ret = qcom_smem_alloc(QCOM_SMEM_HOST_ANY, SMEM_SMSM_CPU_INTR_MASK, size); if (ret < 0 && ret != -EEXIST) { dev_err(&pdev->dev, "unable to allocate smsm interrupt mask\n"); - return ret; + goto out_put; } intr_mask = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_SMSM_CPU_INTR_MASK, NULL); if (IS_ERR(intr_mask)) { dev_err(&pdev->dev, "unable to acquire shared memory interrupt mask\n"); - return PTR_ERR(intr_mask); + ret = PTR_ERR(intr_mask); + goto out_put; } /* Setup the reference to the local state bits */ @@ -558,7 +560,8 @@ static int qcom_smsm_probe(struct platform_device *pdev) smsm->state = qcom_smem_state_register(local_node, &smsm_state_ops, smsm); if (IS_ERR(smsm->state)) { dev_err(smsm->dev, "failed to register qcom_smem_state\n"); - return PTR_ERR(smsm->state); + ret = PTR_ERR(smsm->state); + goto out_put; } /* Register handlers for remote processor entries of interest. */ @@ -588,16 +591,19 @@ static int qcom_smsm_probe(struct platform_device *pdev) } platform_set_drvdata(pdev, smsm); + of_node_put(local_node); return 0; unwind_interfaces: + of_node_put(node); for (id = 0; id < smsm->num_entries; id++) if (smsm->entries[id].domain) irq_domain_remove(smsm->entries[id].domain); qcom_smem_state_unregister(smsm->state); - +out_put: + of_node_put(local_node); return ret; } From patchwork Mon Oct 24 11:30:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8826 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431306wru; Mon, 24 Oct 2022 05:43:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5xoYRLS/kLAlT6RG9jOY3c9wl3YuEExwr1J9I8s/kXIhn/+0Ozf1MleKRqlR71kmLZBbex X-Received: by 2002:a63:950d:0:b0:46e:d655:b377 with SMTP id p13-20020a63950d000000b0046ed655b377mr11338467pgd.191.1666615407532; Mon, 24 Oct 2022 05:43:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615407; cv=none; d=google.com; s=arc-20160816; b=Ap9ucT9w66O3VNDo4AjIl/00sUtGKPv2ghPidZRiPpcr9q11FVTltHyfRRSqgTW48a AXqhVq+GwOX3dcDggTcdlKpBgYBLSDFJuqU88JTNj/G2yW6Zi5Fl8JV5/QQKBXB6uYgg ufBlERnRR0eSedR3GLxLiIH+HIYDVo6odMcGS+e+nPJcizIsH163rwJUYj1vK+w+sNPP HtSp0hxwuF07BiaLPNd+pkHmZOFcWt5x/F5wQx7t+aNYgPB42VeCw3Pbj1d6+Jz+EJns 9OSbJyDLs1bsLhaoWhTslgoZ84995u1IRajvjoMO7QX1rFCSolaA1hbj38mricCfaC3B xLFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=O44ViJKWLmVupMYvausLl0Nj8EZAFPZgc8VBRdZRPuQ=; b=Yv4sptQ/WZj2UH6J/AC9efJJC18I14ZMwcZYgfHgAfTVa4fSfDnqTI7ZbCjrOes27k Irj9evkYuAJ+ifxT9KlFk79uasbrU1dgFw+xXvwX8S6UMb0Ap54eU7EGy9BglLWdrQ1t rgJ8x1CwjBzVYOvfcLS6ZB/F/Yu8bVkVcAaz5P/Y6c2ctXZva8Th+bbT5+U0BX1/Tar+ v04oMWZGiMIPRlok3V2V7wPirVP8KtMEGy846QoK4rzosypMZZFOiDY0G3Rm1UL9xTQ2 ADpEFV+ZkH/8uDkOMPgFzSdAcMk9PCTg/giqYp7ejtH+eJ6BRQmW/UotzA52Z7BeIXwS xkqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wRo7FNJH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e8-20020a170902ef4800b00176b7e66c9asi34800335plx.155.2022.10.24.05.43.04; Mon, 24 Oct 2022 05:43:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wRo7FNJH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231423AbiJXMgP (ORCPT + 99 others); Mon, 24 Oct 2022 08:36:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234330AbiJXMaE (ORCPT ); Mon, 24 Oct 2022 08:30:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9805631DFF; Mon, 24 Oct 2022 05:04:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 91DE6B811AB; Mon, 24 Oct 2022 11:51:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5BDFC433D6; Mon, 24 Oct 2022 11:51:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612284; bh=E6nMjH9elQkFPPehNJVGitkxW67b30EoBEbRIBxoJYw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wRo7FNJHlHiS0+GcLZuJsRLilyHnWHFC7+WwJqWnc7q1EQSVWQjVQMbicJC1keG78 unq8WAaFAJfkE8YeNy8pN5tM5zqoUM50DRLZpSALmBb+uczfgyvzI9aBdwatQfiMCv RxecflTe7Bh8MlALzCeE0/kfMlJ9Rg7wRVGX9JlM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Bjorn Andersson , Sasha Levin Subject: [PATCH 4.14 108/210] soc: qcom: smem_state: Add refcounting for the state->of_node Date: Mon, 24 Oct 2022 13:30:25 +0200 Message-Id: <20221024113000.516514952@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572917331341622?= X-GMAIL-MSGID: =?utf-8?q?1747572917331341622?= From: Liang He [ Upstream commit 90681f53b9381c23ff7762a3b13826d620c272de ] In qcom_smem_state_register() and qcom_smem_state_release(), we should better use of_node_get() and of_node_put() for the reference creation and destruction of 'device_node'. Fixes: 9460ae2ff308 ("soc: qcom: Introduce common SMEM state machine code") Signed-off-by: Liang He Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220721135217.1301039-2-windhl@126.com Signed-off-by: Sasha Levin --- drivers/soc/qcom/smem_state.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/soc/qcom/smem_state.c b/drivers/soc/qcom/smem_state.c index d5437ca76ed9..1502cf037a6b 100644 --- a/drivers/soc/qcom/smem_state.c +++ b/drivers/soc/qcom/smem_state.c @@ -144,6 +144,7 @@ static void qcom_smem_state_release(struct kref *ref) struct qcom_smem_state *state = container_of(ref, struct qcom_smem_state, refcount); list_del(&state->list); + of_node_put(state->of_node); kfree(state); } @@ -177,7 +178,7 @@ struct qcom_smem_state *qcom_smem_state_register(struct device_node *of_node, kref_init(&state->refcount); - state->of_node = of_node; + state->of_node = of_node_get(of_node); state->ops = *ops; state->priv = priv; From patchwork Mon Oct 24 11:30:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8816 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431094wru; Mon, 24 Oct 2022 05:42:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5kL8nq5fOmKJJ8hK5azv3+sc0LyK+qxysoDFaGNJ5FI+dbzVTyCUJyxQVlAmRcHut4KEUO X-Received: by 2002:aa7:8d57:0:b0:562:b63c:c2ba with SMTP id s23-20020aa78d57000000b00562b63cc2bamr33525826pfe.29.1666615376244; Mon, 24 Oct 2022 05:42:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615376; cv=none; d=google.com; s=arc-20160816; b=IGcueEV8CV50BeplUOj7xZXv+megNPPHhsh4tzdrFUAdhsTfHy/2UXZE3AeO3lu0N0 7ZsGzA87Xfv1rdYFFQR0+Pqodel42ccIyn1CfS++Ptg1kbw9hfQdijusEVqvKgBGIZ8p rmovsTq9lMQU2dvGKdmZQ7fOqPnMDlEt39in3Lmrp8fkIpmOUcNBvXwymopUTeB5s/0+ 1pa/72ezO5u4RXXrl6TZX6H4w3e6tsdsBWvzMBfcXPUM3PlbMLVVSbEE2WtT/gTi83ys 9rVuNG1j74C8qierI0NIaHZOu4MzGyAKvLnwIOy3D3yAKkM0GObKl82YdVt1USZ8NxxC 0SWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9rL7cmkgxzBebPx1VkpLLL/JqRBETrjqDOz0ZIGdsCs=; b=eLLbxiLrWhpp5mmMOoP0xfTvN+pzv10OotMhFW3VpTII3P0EEzTkaaahLrfM5H9g0T v0UNuWt1tXIHPqcSamKhgMDueaWxSsro/Xi+jbLVDo4tpKz7bg5ojwJ0KEj3yVnaQ5Xt AiJ/4Iu4MT/+CuCH76J6bBZpdiIT0k2R3KaucJvztEmEj7LNn5l8DfZeEn8KMi9xr8Er XtIN2cNpc4rG3daNXhd3mhc0fJyAjmmkzcqxrYREkhT+njRTlG4CxTy211etQAk/7TRA Yn708LnthbCGdtv7lMOL/zGWE0/XkExVedpAKH4QSj7GA0a6DrbGTfDXK+eZtLLcxNOf 33Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=auTRMjnV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w17-20020a056a0014d100b0050df0383302si37077605pfu.255.2022.10.24.05.42.42; Mon, 24 Oct 2022 05:42:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=auTRMjnV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231407AbiJXMgI (ORCPT + 99 others); Mon, 24 Oct 2022 08:36:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234310AbiJXM37 (ORCPT ); Mon, 24 Oct 2022 08:29:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97305FD24; Mon, 24 Oct 2022 05:04:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F2B03B811BF; Mon, 24 Oct 2022 11:50:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5451EC433D6; Mon, 24 Oct 2022 11:50:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612202; bh=VkJGykt6enmbqjkkAmJnzgGF+00pbCPjk/x2Pdbi/UM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=auTRMjnVVecqm4+Sb/RZi1wULMxZfF9W3UkgpLrenwGQlFaKKpgKiooXVAjPQtDl/ EiZeKepcabcwtDsr4rKlw10IHN8g4GIIFfCLZWd06x/laPLucsfiTPORqGWgjpH6Mb LGUTIAEU3HwndzSzdF8B0+YJ/78WZ2zAAaIsKyKA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Marek_Beh=C3=BAn?= , Gregory CLEMENT , Sasha Levin Subject: [PATCH 4.14 109/210] ARM: dts: turris-omnia: Fix mpp26 pin name and comment Date: Mon, 24 Oct 2022 13:30:26 +0200 Message-Id: <20221024113000.547034483@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572884479065913?= X-GMAIL-MSGID: =?utf-8?q?1747572884479065913?= From: Marek Behún [ Upstream commit 49e93898f0dc177e645c22d0664813567fd9ec00 ] There is a bug in Turris Omnia's schematics, whereupon the MPP[26] pin, which is routed to CN11 pin header, is documented as SPI CS1, but MPP[26] pin does not support this function. Instead it controls chip select 2 if in "spi0" mode. Fix the name of the pin node in pinctrl node and fix the comment in SPI node. Fixes: 26ca8b52d6e1 ("ARM: dts: add support for Turris Omnia") Signed-off-by: Marek Behún Signed-off-by: Gregory CLEMENT Signed-off-by: Sasha Levin --- arch/arm/boot/dts/armada-385-turris-omnia.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/armada-385-turris-omnia.dts b/arch/arm/boot/dts/armada-385-turris-omnia.dts index 6c2d96cbd7cd..00f70c2fab24 100644 --- a/arch/arm/boot/dts/armada-385-turris-omnia.dts +++ b/arch/arm/boot/dts/armada-385-turris-omnia.dts @@ -340,7 +340,7 @@ marvell,function = "spi0"; }; - spi0cs1_pins: spi0cs1-pins { + spi0cs2_pins: spi0cs2-pins { marvell,pins = "mpp26"; marvell,function = "spi0"; }; @@ -375,7 +375,7 @@ }; }; - /* MISO, MOSI, SCLK and CS1 are routed to pin header CN11 */ + /* MISO, MOSI, SCLK and CS2 are routed to pin header CN11 */ }; &uart0 { From patchwork Mon Oct 24 11:30:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8975 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp438152wru; Mon, 24 Oct 2022 06:00:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7z4QCA3Df4+UrAQWpQmdJ1N0PDukjiQwomjl+5Lpk+lGfCetGUkwzgtvAEftz9trNlKIEe X-Received: by 2002:a17:90b:2248:b0:210:10dc:a314 with SMTP id hk8-20020a17090b224800b0021010dca314mr30122356pjb.15.1666616457071; Mon, 24 Oct 2022 06:00:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616457; cv=none; d=google.com; s=arc-20160816; b=nf3JMXFVTXFTQNxtvBS8TdQCABMCdl7WdaQWuP3/W2jjD+qpBD0qt4R9hvVp4e/6Xi arvfJG0F2PLXRMcUgVU8rLhCJJJzIT6Y3xbDwLZgQPcLp9jkDNxbxmiGIqM7pyAXs/zp EXp3Dk9lQsqtJxBVKCE2DDgVJ+miSl63H66Y7yIMY8iGxHalLJgPVrAaSDLZbydHMrob mxi9LIdozXMvA8kYyKU2jtsjJSE/hASet7Z2a9qpx+Qyp2LQOYVqxU1kc9/+mWiNy7dS kA4Iu2Wxt2XrUH/PJgL6T4SZXGho+v/VA3LIKO020Eu+su0PoN1eMQdgmVLGY97zdrTL iiew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RHN2Ske92yvWhsHoCz4tAmIpOnu73nVOxi2Cc3hoDoI=; b=HEYFnb4jmmBlHHPld7Mrt+zE273hHYRc9I2wQx6w5ecb0XN9OehDVOpiz8HgbPrqa4 W61F6O4vE7Q6urOUUMoGwYZ7Y1JgtspnNtgMGED3kgLJ5KXCZiviZ533r4sPLfIw2LLM LO5Ag6/WQMVc29R4xXR7Qb9XnZ8JrPgMW3RozVho6e13U+EE66mTNZbKQDAvQqYiPZfd EgMehtrG3MNBFa5fnsF8yHLh+SVivo3r5WIcgsXJ3z5WihGi1IO5S5mDJVYPng1p/Akv qvu4crrfOysKKYEnlJogoLsZR9VkKwlItI5FGKhL3egsjgjEn7ck6hsmB1AdPN7YOwJS 0TnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QotdaSOM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r192-20020a632bc9000000b0044e466f478dsi6907531pgr.204.2022.10.24.06.00.40; Mon, 24 Oct 2022 06:00:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QotdaSOM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234833AbiJXNA0 (ORCPT + 99 others); Mon, 24 Oct 2022 09:00:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232122AbiJXM63 (ORCPT ); Mon, 24 Oct 2022 08:58:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4296981CF; Mon, 24 Oct 2022 05:17:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DDDB761286; Mon, 24 Oct 2022 11:50:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFB4BC433D6; Mon, 24 Oct 2022 11:50:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612205; bh=BBEZSL/kEaLKT0nn3CDJDaoaCe8MaFX+1kU7JZ+z9Ck=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QotdaSOMakNZsKCppLdr+ert4ConasfJd2QUp599h1aygca2noXAgy9bgvhvYkTyB vn6NxbQL5t7m3AMrF5IXufw7TVs9k2BgIkzITXIUS1WJg+vf/r7TtuvhcwqNKZmUPv k7Bqc2PneutNz67IhDTlqp3ATM/a4rE2P2CHzmgQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Walle , Andrew Lunn , Gregory CLEMENT , Sasha Levin Subject: [PATCH 4.14 110/210] ARM: dts: kirkwood: lsxl: fix serial line Date: Mon, 24 Oct 2022 13:30:27 +0200 Message-Id: <20221024113000.576191265@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574018037181989?= X-GMAIL-MSGID: =?utf-8?q?1747574018037181989?= From: Michael Walle [ Upstream commit 04eabc6ac10fda9424606d9a7ab6ab9a5d95350a ] Commit 327e15428977 ("ARM: dts: kirkwood: consolidate common pinctrl settings") unknowingly broke the serial output on this board. Before this commit, the pinmux was still configured by the bootloader and the kernel didn't reconfigured it again. This was an oversight by the initial board support where the pinmux for the serial line was never configured by the kernel. But with this commit, the serial line will be reconfigured to the wrong pins. This is especially confusing, because the output still works, but the input doesn't. Presumingly, the input is reconfigured to MPP10, but the output is connected to both MPP11 and MPP5. Override the pinmux in the board device tree. Fixes: 327e15428977 ("ARM: dts: kirkwood: consolidate common pinctrl settings") Signed-off-by: Michael Walle Reviewed-by: Andrew Lunn Signed-off-by: Gregory CLEMENT Signed-off-by: Sasha Levin --- arch/arm/boot/dts/kirkwood-lsxl.dtsi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm/boot/dts/kirkwood-lsxl.dtsi b/arch/arm/boot/dts/kirkwood-lsxl.dtsi index 7b151acb9984..321a40a98ed2 100644 --- a/arch/arm/boot/dts/kirkwood-lsxl.dtsi +++ b/arch/arm/boot/dts/kirkwood-lsxl.dtsi @@ -10,6 +10,11 @@ ocp@f1000000 { pinctrl: pin-controller@10000 { + /* Non-default UART pins */ + pmx_uart0: pmx-uart0 { + marvell,pins = "mpp4", "mpp5"; + }; + pmx_power_hdd: pmx-power-hdd { marvell,pins = "mpp10"; marvell,function = "gpo"; From patchwork Mon Oct 24 11:30:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10154 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp639893wru; Mon, 24 Oct 2022 13:31:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4XwmaXRGfTYZFJXuafZPNTj8yrnMzTbJem4C3SwNAGS6uqCWo2jDLcYyAKRGSp7hBQb1AU X-Received: by 2002:a17:907:3e06:b0:733:693:600e with SMTP id hp6-20020a1709073e0600b007330693600emr28263349ejc.410.1666643478314; Mon, 24 Oct 2022 13:31:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643478; cv=none; d=google.com; s=arc-20160816; b=H7Fho10FsWvFhqrM8gocZTJJmkS7bt2IYeXeKz9BIr+JHZXlbuvrNpc7wRSoOYPSBC qaT0fRcpV1ghIXzCA1KgD2zaNKOkhoBk9a4dRJZVnCygCWUZbEMi5Uh5XTuplV811Cg6 G4CUJg0XmavtPoFJAUANEsDQZuPGbdtmFycAHNBNQeY8v+uSLTLaUP9Gu85+g/IWugrp 3sLZ/ZXecyBFJ8JutI+6O8eh/q4rQgBrKMxiM515h7OCJkOpX8o6yyPcXBOgRf0mmNhr eMVqU5dd5gNfMrnxaBLO+gMLlxv8wqGb5aZCMZ8rLUk3PEXvtLV5W0ZU5WAvlYhCqacj ilsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bZCjyF/awsLX2FZMnkU85emi6uW8YxgWuqdmAKdv8W8=; b=FNfmpsPT1HoNcKoWUX2wlcmU3VejtuMRFU2Nn/+8aQOnqXOYRlrf9lWEe2Ls5MbK/u wiyq8mH5VzOSDoW6dr7HZbI05fl/6ynZawHXT8LndXvXlPrcbWYQxwKSucmG8NPo0HT8 3DUw68CHMzLJMeZWLzqgm4qlSZxMor6hQy6JEEGDmHRFeHSR/vlgfXBCbTVEk03UNzFy GfuHsez4b5fY3PH0f0vb9k0iHLZ95QlDfEnbvjuQRpIhaDNopVYNLaw+mXTGrZ6ebZZs PIkQxpjYnPO9KjIq+e3avP2dm9aEeCyd8/3hV7oTWmvZYo7myAhV2qe/VLtoq4ugb8E2 waxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="u/KI14gd"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b10-20020aa7c6ca000000b004614e263f51si667723eds.118.2022.10.24.13.30.54; Mon, 24 Oct 2022 13:31:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="u/KI14gd"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234018AbiJXUPT (ORCPT + 99 others); Mon, 24 Oct 2022 16:15:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233265AbiJXUNr (ORCPT ); Mon, 24 Oct 2022 16:13:47 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9ADA28F27E; Mon, 24 Oct 2022 11:32:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id B9985CE131E; Mon, 24 Oct 2022 11:50:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 942EDC433D6; Mon, 24 Oct 2022 11:50:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612207; bh=RLkQdPDMRCOU/IECOAC2hHaLhoeqjEyfi9vzRWGTaUE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u/KI14gduBllgOFLXEBcWlTKIVhQz3L05Ye3AYCMAwo6M9oxlZHaMEObmPLh1natt EOREC8/84hSaXHFBkJDF6OqnFJNnQNamyrlyuzVfke5t0CmGTDOchveAxalcFE90p1 5VtS2Oxjjd15Uug2MZ0eKyvImzHZgLaduyNQaoLY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Walle , Andrew Lunn , Gregory CLEMENT , Sasha Levin Subject: [PATCH 4.14 111/210] ARM: dts: kirkwood: lsxl: remove first ethernet port Date: Mon, 24 Oct 2022 13:30:28 +0200 Message-Id: <20221024113000.606102660@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747602352125262180?= X-GMAIL-MSGID: =?utf-8?q?1747602352125262180?= From: Michael Walle [ Upstream commit 2d528eda7c96ce5c70f895854ecd5684bd5d80b9 ] Both the Linkstation LS-CHLv2 and the LS-XHL have only one ethernet port. This has always been wrong, i.e. the board code used to set up both ports, but the driver will play nice and return -ENODEV if the assiciated PHY is not found. Nevertheless, it is wrong. Remove it. Fixes: 876e23333511 ("ARM: kirkwood: add gigabit ethernet and mvmdio device tree nodes") Signed-off-by: Michael Walle Reviewed-by: Andrew Lunn Signed-off-by: Gregory CLEMENT Signed-off-by: Sasha Levin --- arch/arm/boot/dts/kirkwood-lsxl.dtsi | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/arch/arm/boot/dts/kirkwood-lsxl.dtsi b/arch/arm/boot/dts/kirkwood-lsxl.dtsi index 321a40a98ed2..88b70ba1c8fe 100644 --- a/arch/arm/boot/dts/kirkwood-lsxl.dtsi +++ b/arch/arm/boot/dts/kirkwood-lsxl.dtsi @@ -218,22 +218,11 @@ &mdio { status = "okay"; - ethphy0: ethernet-phy@0 { - reg = <0>; - }; - ethphy1: ethernet-phy@8 { reg = <8>; }; }; -ð0 { - status = "okay"; - ethernet0-port@0 { - phy-handle = <ðphy0>; - }; -}; - ð1 { status = "okay"; ethernet1-port@0 { From patchwork Mon Oct 24 11:30:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8707 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422996wru; Mon, 24 Oct 2022 05:23:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Zhx/wwyO+Jyei8zcafcZknbX1TIjF1QNvLTgiq4SKZXw6tHuQlafdFihlx9ZiEPFZVnxS X-Received: by 2002:a50:85ca:0:b0:461:168c:83ab with SMTP id q10-20020a5085ca000000b00461168c83abmr19177259edh.359.1666614229387; Mon, 24 Oct 2022 05:23:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614229; cv=none; d=google.com; s=arc-20160816; b=MgJ/XwC962UoxHUzs06GqnhkmgfcVfYOXpxBAIj+v5NtO3vJaoxi/R6NDmjfCShqiy m9v1C3Kwm5rl2G9g/xEGCEWw7xnKGLSki0KyeX6VD1bYqlhWoycp/gh1ydySmUc3lrZS PikGjDBMXPXxzJvBo1p+BBdwHsqKfq1LVVQzGfa57UKSNUUi7YzghHKmfBhpWzuXqfRb LkK2ILxq397UYNSTJdXwmpP3OsXo+Riig6n+j1nzS+KEksdiYccpYRB0WhCNA2ec7rLl KdxN/cSEHogBWDjXJUVeeBYKQpEI7kc3yhGgNUfO7wAmYD6PqPRN3ZdDH4qE8tEJvJwL JDqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=p3Yxex9J/ou2pbtXItIxt3p/+X5B9LO2CarwrwQAQwc=; b=d/YDV5hpl0cmEUVsE/I7AdSi6buV77lWLT9q0rw1MXbKh4sf0LdPIzhd+Ttdq/uOCt 6lyyng9fM+RfEcst1n2sV9mUNVlfecw2xcESjo4sX9gwd9TcgkuvGD/3NWlu0GOt1VEW O631GESeMc0LNlHGE+orIZFKWTZJY6CppcVCBANAIFltSXJaUPQicPmn1DMT4cjZoeKT z0lLwd9LcuLQarUqgFEasmauNM1+chZ1uv3M0aKVlluU9pGzaki94ZacI3+Q1aUVusp+ Ypb4UXaSRvt/z7LmFfb1b71++CWs2ygp0u7+6eiPnuq5NW2LR0iDmFoBFAYXRMPt+bEd vPYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=P+rblkMD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r24-20020aa7d158000000b004614db9083csi8513070edo.313.2022.10.24.05.23.23; Mon, 24 Oct 2022 05:23:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=P+rblkMD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233508AbiJXMWg (ORCPT + 99 others); Mon, 24 Oct 2022 08:22:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233098AbiJXMUD (ORCPT ); Mon, 24 Oct 2022 08:20:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7914183223; Mon, 24 Oct 2022 04:58:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3292C612BF; Mon, 24 Oct 2022 11:50:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D8CEC433B5; Mon, 24 Oct 2022 11:50:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612210; bh=7mkua9TtQY1bbz8Pik2tYh3kVXMe/0nuNR7b/SAw73I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P+rblkMD6kNZ2pXCylZ3C/eCTYB0K5ew7KxALelTiqRkFKhkCTsXySPqahR4Aw0g2 u03AEz5GzkGt+4ALtO8tec/eyJnBgsyyA9So2vsOO/oUu6wY1B0Ui7BcMh5Kd89AQs y0OtNqcuE8+qdwfi8R+4jdRsxT6y9wWTMW3FNP0g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Ard Biesheuvel , Arnd Bergmann , Sasha Levin Subject: [PATCH 4.14 112/210] ARM: Drop CMDLINE_* dependency on ATAGS Date: Mon, 24 Oct 2022 13:30:29 +0200 Message-Id: <20221024113000.635406550@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571681854940933?= X-GMAIL-MSGID: =?utf-8?q?1747571681854940933?= From: Geert Uytterhoeven [ Upstream commit 136f4b1ec7c962ee37a787e095fd37b058d72bd3 ] On arm32, the configuration options to specify the kernel command line type depend on ATAGS. However, the actual CMDLINE cofiguration option does not depend on ATAGS, and the code that handles this is not specific to ATAGS (see drivers/of/fdt.c:early_init_dt_scan_chosen()). Hence users who desire to override the kernel command line on arm32 must enable support for ATAGS, even on a pure-DT system. Other architectures (arm64, loongarch, microblaze, nios2, powerpc, and riscv) do not impose such a restriction. Hence drop the dependency on ATAGS. Fixes: bd51e2f595580fb6 ("ARM: 7506/1: allow for ATAGS to be configured out when DT support is selected") Signed-off-by: Geert Uytterhoeven Acked-by: Ard Biesheuvel Signed-off-by: Arnd Bergmann Signed-off-by: Sasha Levin --- arch/arm/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 3793642e0223..6fe7085cf7bd 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1951,7 +1951,6 @@ config CMDLINE choice prompt "Kernel command line type" if CMDLINE != "" default CMDLINE_FROM_BOOTLOADER - depends on ATAGS config CMDLINE_FROM_BOOTLOADER bool "Use bootloader kernel arguments if available" From patchwork Mon Oct 24 11:30:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8618 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp420180wru; Mon, 24 Oct 2022 05:17:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM59rghJsi+z5h89EfysLXiacsMOiWO3j+2sPRr68QOmXJrKosENluhKulO77GoQesn0bY19 X-Received: by 2002:a05:6402:1d53:b0:45e:ec87:686e with SMTP id dz19-20020a0564021d5300b0045eec87686emr29513321edb.380.1666613863714; Mon, 24 Oct 2022 05:17:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613863; cv=none; d=google.com; s=arc-20160816; b=Jr3E+1XdoJNjbQx1MvrpFRGcXWv7/prHRWnwskJfyqkR66bZ3UXNK+U4UiqWtW2JWA d0yBGUv3Wzpkux9lSsSPxZMH5nz/8ge+GIVgqTqA6bd08Ok9yrT000NhjFDmtYQzIzvQ 7NzZe+bHLCmjTmrcfxHOREIKfj2HH8spbUGokOPyKEBH5bk0qaDblkPQB22cqhV26z9Z bJ++YpKwQ7dxOY8WaQcWinr5SyTAznYbHAuX8xp7sYswGi7sz1NNHDz+iKDMubLUefPJ 4Iw3WKTDf5Ih38/Zwhhre9JqHyIHunO2zTHNshv+ZN/GdwoyKWpSQdYRBwvR1TyCh8CT fXEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Nucre2rFKf8dTtvTdUcZqBiJ5KIplqYlnaRmxkVJngY=; b=e2RoMZuVHMqqq8deVnvoKb/+SeeEVDfJu6ZzODjYhCQDGqe6YO11uOFiBKRtrPLNuC DHusiVmQxLuT0BTI7virXTR5cluqOLqEuCqgfuILB0zQ9w4YGeUW5zRRVG3GSmuTf/Yz CWXbxhepqTRnQScklca1iRcJB0nTLS0B2GO+wG1Mfz351LPRRpN4X4VFXuBTH8Sw0aw7 xwRcY7JCoNppXouJPlTopANaiiHbpSS5y97oMKVU78BLjX6k2ZnMZpmqHfdfWAGtIADK WeX1fJ+6U9rrbYD+Gh/E6J/CiDIx1V3YQSc4HjxA0lmc+zvf94OKpfDG/0cO/HTqFGrK i9Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=F0sB135Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id et12-20020a056402378c00b00461be538388si2866952edb.239.2022.10.24.05.17.19; Mon, 24 Oct 2022 05:17:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=F0sB135Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229936AbiJXMLZ (ORCPT + 99 others); Mon, 24 Oct 2022 08:11:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233219AbiJXMJ6 (ORCPT ); Mon, 24 Oct 2022 08:09:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2ED4C7FF8C; Mon, 24 Oct 2022 04:53:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C2C11612B1; Mon, 24 Oct 2022 11:50:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3C22C433C1; Mon, 24 Oct 2022 11:50:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612213; bh=Ufm8g+UIaVbZEBzvH5MpNH2n3O0Oyv4matEIlORTrgY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F0sB135Z+1rP9wnKnxp0gFSAcnk3OnRh9B/2vJJBbuzpMVB8w4lc2euvkwyq/47pJ s/S52vClTmHiZPzlmygHW5QwHEt9lMQYtwyKiM8/oC8Lgnyv5rV90czN96IQ4q0+1m ueglBjDHnXMf4C0hSzcLxJoAIjqvbU/JdBfoIpZs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Torokhov , Krzysztof Kozlowski , Sasha Levin Subject: [PATCH 4.14 113/210] ARM: dts: exynos: fix polarity of VBUS GPIO of Origen Date: Mon, 24 Oct 2022 13:30:30 +0200 Message-Id: <20221024113000.664598261@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571298873177500?= X-GMAIL-MSGID: =?utf-8?q?1747571298873177500?= From: Dmitry Torokhov [ Upstream commit a08137bd1e0a7ce951dce9ce4a83e39d379b6e1b ] EHCI Oxynos (drivers/usb/host/ehci-exynos.c) drives VBUS GPIO high when trying to power up the bus, therefore the GPIO in DTS must be marked as "active high". This will be important when EHCI driver is converted to gpiod API that respects declared polarities. Fixes: 4e8991def565 ("ARM: dts: exynos: Enable AX88760 USB hub on Origen board") Signed-off-by: Dmitry Torokhov Link: https://lore.kernel.org/r/20220927220504.3744878-1-dmitry.torokhov@gmail.com Signed-off-by: Krzysztof Kozlowski Signed-off-by: Sasha Levin --- arch/arm/boot/dts/exynos4412-origen.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/exynos4412-origen.dts b/arch/arm/boot/dts/exynos4412-origen.dts index 8a89eb893d64..0224e1da66c5 100644 --- a/arch/arm/boot/dts/exynos4412-origen.dts +++ b/arch/arm/boot/dts/exynos4412-origen.dts @@ -90,7 +90,7 @@ }; &ehci { - samsung,vbus-gpio = <&gpx3 5 1>; + samsung,vbus-gpio = <&gpx3 5 GPIO_ACTIVE_HIGH>; status = "okay"; port@1{ From patchwork Mon Oct 24 11:30:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8582 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419101wru; Mon, 24 Oct 2022 05:15:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6dRaqdRxzj0ZGmNMivsgGpCVHDM8u8hfv3bjNACusK0alnOcvYfG0rcKptDmcW07KtYx2K X-Received: by 2002:a17:907:94cf:b0:78d:38cd:afcf with SMTP id dn15-20020a17090794cf00b0078d38cdafcfmr27837399ejc.229.1666613745614; Mon, 24 Oct 2022 05:15:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613745; cv=none; d=google.com; s=arc-20160816; b=E7iOZIusa3o8d69zBsimGBbASfh4sEzWRtixKdjyiPWkoizsmD64kunBvNdQ7VOYnU hclAGvCJM15LIoTUjHayDtI6O0kmC7BxBRS3/Hf3OGtQLAtm4BbjP1PuyvfeeQiiWtdT oAe1F1gl8/EsT1RQgJFgowfzQUFlzsrEQbvuSI3hP4BvZyOS43LUGApCEv9Iup1kNUnf BDpLCXY2PhmkSDEFWbRbLQVf76wjL22pdM6/wVQvWBofNR/Y/KoC4Z3ayBgTKJq4JBhU 6kM8366ddcSs1k9+pwWPoY2VDGNovngtJJFwBeqp1b4wXS+30eu24mRkJf68TLHU21HF xlKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=R90gHmz3g/2IRozULoKabnAFONlDS+2xSgsYjoDPnkU=; b=Re1eyH3bgV9xKSoBgYynVQ6+fKqUHb5+OTwxcu6EtiUkuXDV97FGMepNVrRRVs+Gah T7IPlhcUk0LcQuRmUGuDKTclvsPDaUTWfIIXMAfFIw9tbON3J9wV3DbUQd2qa4dPObHK e3VgrzaT2572Gvu+/SG1Jtn3tPJCFs39S6uj3mn9lfpR17bHMWljM06QPHQ39T3W0gOa AA/tNKVIFPn88V7s29w8YiOK1Ab9H2e53f26bCp3d1sIWJt8EWWPRxSanWUKY7TamCel OzOE2u9TuW35u3ZUWl/1jB9YTw/3zARHqzVI3nzw8lv+vXXSEX3IMdrjKNFL3XcdJYuV cINw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=m5sLMSZw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nc23-20020a1709071c1700b00779f8e7ec5bsi28657904ejc.42.2022.10.24.05.15.21; Mon, 24 Oct 2022 05:15:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=m5sLMSZw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232629AbiJXMGK (ORCPT + 99 others); Mon, 24 Oct 2022 08:06:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232673AbiJXMEC (ORCPT ); Mon, 24 Oct 2022 08:04:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B30656B93; Mon, 24 Oct 2022 04:50:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5CD94612C3; Mon, 24 Oct 2022 11:50:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CA4BC43141; Mon, 24 Oct 2022 11:50:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612215; bh=oAZKZd2en7IVL08gIN/hLuFHSzYPctft03ltwnPQ5vI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m5sLMSZwHHDafSX66ete3cTwbYuL4Pb9YoCvhuy+YNLIhB9KE/ehCAkigPY8gsrj8 ZtEYHQ552V7nWHOe1s5VrhecnsZ/iYJZkRyTR4QmfYIvBJZsVvX5OiE8zD/4q0Ofb1 O+yG937pE0Nzy+oEXHRVyZBHIHfPqQ4LgNh1yQK4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Claudiu Beznea , Jonathan Cameron , Sasha Levin Subject: [PATCH 4.14 114/210] iio: adc: at91-sama5d2_adc: fix AT91_SAMA5D2_MR_TRACKTIM_MAX Date: Mon, 24 Oct 2022 13:30:31 +0200 Message-Id: <20221024113000.694338958@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571174750310191?= X-GMAIL-MSGID: =?utf-8?q?1747571174750310191?= From: Claudiu Beznea [ Upstream commit bb73d5d9164c57c4bb916739a98e5cd8e0a5ed8c ] All ADC HW versions handled by this driver (SAMA5D2, SAM9X60, SAMA7G5) have MR.TRACKTIM on 4 bits. Fix AT91_SAMA5D2_MR_TRACKTIM_MAX to reflect this. Fixes: 27e177190891 ("iio:adc:at91_adc8xx: introduce new atmel adc driver") Signed-off-by: Claudiu Beznea Link: https://lore.kernel.org/r/20220803102855.2191070-2-claudiu.beznea@microchip.com Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- drivers/iio/adc/at91-sama5d2_adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c index 34639ee2d2ce..e015b86be6b0 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -79,7 +79,7 @@ #define AT91_SAMA5D2_MR_ANACH BIT(23) /* Tracking Time */ #define AT91_SAMA5D2_MR_TRACKTIM(v) ((v) << 24) -#define AT91_SAMA5D2_MR_TRACKTIM_MAX 0xff +#define AT91_SAMA5D2_MR_TRACKTIM_MAX 0xf /* Transfer Time */ #define AT91_SAMA5D2_MR_TRANSFER(v) ((v) << 28) #define AT91_SAMA5D2_MR_TRANSFER_MAX 0x3 From patchwork Mon Oct 24 11:30:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8624 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp420382wru; Mon, 24 Oct 2022 05:18:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5mXQIIZpjKSO5e1PKiqVKxjbmeXVn+ahFsPq+LUKRgiKEZDUxjojyVPWYkQpXIRlrtP8Jm X-Received: by 2002:a17:907:75d1:b0:7a8:291:2050 with SMTP id jl17-20020a17090775d100b007a802912050mr4107646ejc.287.1666613885499; Mon, 24 Oct 2022 05:18:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613885; cv=none; d=google.com; s=arc-20160816; b=z624FwXcVra1WhnEQz8WAg7/uvzVCSVafUQJXrFH3GZnPJRJeVmBl8LwCKkSuzL/I3 9C+LaWZWH5R9XtHLBQ2/sO37DCcXK2BCtOzDSQvlsjl35JUTcpRLN3tPoSpXzfHmMEyy sX8widMG1PR+GBjvjet5u/DWCmRvLY9QcaU4cwQJxnYVEGhyfZA33aCzEXJeJQHgFsvU czW17tvV3R8mCWPchZAj2jRhuIJOMmWTtMtQB9NOZu0vC+rdJ/2+EeKD8zBeCmnqZ2bP sz4/ATRRYmH6x8QwRsGQKF5FapaV2lUjDAZv+VfgsnUbsPecoyxHtf8V5YD2F98EXnJD vGRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ezMjh/bLbyfKIwo18TDU1ekMpi4tfHNXvXwW2RWkiPI=; b=dJBg6rihNf44gnIL2pkxIT/ytjfXWiEdO2+yjWu/cC69SEKeVXmfdHY9d2ySZ1rz2a w5dQjlcK2jVYES1J4s7t0KOIjDtyx1Sv2L9Hk16f5muW6agYjNKofsSXjOGNXQSrEY0r cUU8eyYwvRTM2iucYiyrt9vcbCFKxKvCqkXVqT7jNM9lW690E36/1sJfBtqUhhYamIgu pPRuQW2bxX51uEM/G/51IA5ce3LV9t+3mX6eZBqYhz2xI9P1wyWr+SwnIuFxvPuFYjj5 qumJXOESDEthI3R4P+B3E6J/Wk/PE5hLg6eVamI8clTeEGWHcBzGIvYCELKySxzaWXbe eR3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jQyQUsQP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sb24-20020a1709076d9800b007815a44de91si30113779ejc.771.2022.10.24.05.17.41; Mon, 24 Oct 2022 05:18:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jQyQUsQP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232893AbiJXMLc (ORCPT + 99 others); Mon, 24 Oct 2022 08:11:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229947AbiJXMKB (ORCPT ); Mon, 24 Oct 2022 08:10:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BCC380496; Mon, 24 Oct 2022 04:53:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F12656122D; Mon, 24 Oct 2022 11:50:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BF66C433C1; Mon, 24 Oct 2022 11:50:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612218; bh=DC0BF9IcilZ6vNyknUu5VstpmDbJb6Kcs0pf3U3tFKo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jQyQUsQPQ2qBKheLWxj8W3Jd+OPN1OLuj9HYJ2Vvi9itN2M48bhnzeFMje+18KWOk NDbdNbT1cZ75ule69pmj402F7ZxpBytXxUtiPz1fFLiMRoEui9t/4MD9j2UIkKWLf8 oQlJqKCD3d4fcnEAFVtePKm4+LlXfvM5U/xM1zLM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Nuno_S=C3=A1?= , Jonathan Cameron , Sasha Levin Subject: [PATCH 4.14 115/210] iio: inkern: only release the device node when done with it Date: Mon, 24 Oct 2022 13:30:32 +0200 Message-Id: <20221024113000.724877639@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571321591562605?= X-GMAIL-MSGID: =?utf-8?q?1747571321591562605?= From: Nuno Sá [ Upstream commit 79c3e84874c7d14f04ad58313b64955a0d2e9437 ] 'of_node_put()' can potentially release the memory pointed to by 'iiospec.np' which would leave us with an invalid pointer (and we would still pass it in 'of_xlate()'). Note that it is not guaranteed for the of_node lifespan to be attached to the device (to which is attached) lifespan so that there is (even though very unlikely) the possibility for the node to be freed while the device is still around. Thus, as there are indeed some of_xlate users which do access the node, a race is indeed possible. As such, we can only release the node after we are done with it. Fixes: 17d82b47a215d ("iio: Add OF support") Signed-off-by: Nuno Sá Link: https://lore.kernel.org/r/20220715122903.332535-2-nuno.sa@analog.com Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- drivers/iio/inkern.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c index f12bad60a581..599069b4fe5d 100644 --- a/drivers/iio/inkern.c +++ b/drivers/iio/inkern.c @@ -139,9 +139,10 @@ static int __of_iio_channel_get(struct iio_channel *channel, idev = bus_find_device(&iio_bus_type, NULL, iiospec.np, iio_dev_node_match); - of_node_put(iiospec.np); - if (idev == NULL) + if (idev == NULL) { + of_node_put(iiospec.np); return -EPROBE_DEFER; + } indio_dev = dev_to_iio_dev(idev); channel->indio_dev = indio_dev; @@ -149,6 +150,7 @@ static int __of_iio_channel_get(struct iio_channel *channel, index = indio_dev->info->of_xlate(indio_dev, &iiospec); else index = __of_iio_simple_xlate(indio_dev, &iiospec); + of_node_put(iiospec.np); if (index < 0) goto err_put; channel->channel = &indio_dev->channels[index]; From patchwork Mon Oct 24 11:30:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8608 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419753wru; Mon, 24 Oct 2022 05:16:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM72xYtticBdw5vb/S6PNcWjX4xuvzjWThfBjiunUZ8qr94YEZbt0a0sYwHhRcU1f3RjIv1w X-Received: by 2002:a63:2bd4:0:b0:451:5df1:4b15 with SMTP id r203-20020a632bd4000000b004515df14b15mr28629893pgr.518.1666613813654; Mon, 24 Oct 2022 05:16:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613813; cv=none; d=google.com; s=arc-20160816; b=NFqt6+lYhBNwn0xEzzTl7vOgwlu5xqA52/OA8w/3vjFWXimnUcIDuC4i+yKX4HfUQ9 tWVpS3zQn2DWgD+o8vpb+8XNLChY0Mr5WTpRueJdXo3XPA8QG9zSCmcDQ1lY51fP+7pw Qb1V6a+MmRDqQwsRFcYfBLDy1F3qhDS7m3zMvQoddoeOtbAblaNn66P2K4PQ67Emlr/c VD5d+jjxw2HVCttfBRlkd00P24yuVCpRttq3kAKNq1KM35sHUsMpHjBM419TXA1U851k PIQbO4JGb5GYU1+7t6Eo3JD5p5Hi2xKyu/7S4qryW0bzGuPvyVDblOsApJGuliKx5j1V aqZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0inFV0g0RPBAhJSTmir77BgKtnIijpZGMAIEUWQ4ZoY=; b=ig+gCDaiPSSZvjg/+EDRlfs5+W79RfKSAR+B048kzzhTFaywv2X/E0caZxT3+uCKU/ QnGjw1F06xWpRwgU2NxBGgruamkKF7WmIVvnrfukQ2mNCu9QYOrjrVRzYah8vPJR2osf U4wfrr9BxFtPE6nu9iOkcyQ3sy/YLd7IExJ4MRAvgroYeFzUDtw3Rcm5x+VRQPTGNWer 9zhO/L6EpQePcfdNYBJ7ubaPjOUJi3cfUm4Ezj9R0kmBOBPL+ARlJMUyRlMR11b1gY6N 2uLNiOiG4SNlASJFSkxqZxngrtp4/ryTV+g59IQBSlLrIVZLiEFx6d3DBns7SS9c+4JL Nb+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RoF4x5x8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g1-20020a056a000b8100b0052dd9f10a47si37247997pfj.363.2022.10.24.05.16.40; Mon, 24 Oct 2022 05:16:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RoF4x5x8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230029AbiJXMG0 (ORCPT + 99 others); Mon, 24 Oct 2022 08:06:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232770AbiJXMEP (ORCPT ); Mon, 24 Oct 2022 08:04:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F40B638EF; Mon, 24 Oct 2022 04:50:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8F82561257; Mon, 24 Oct 2022 11:50:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A50F1C433C1; Mon, 24 Oct 2022 11:50:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612221; bh=gpxEK+/vB6oxf9o8QTiRM6M4RrtZn3Orj865Dz+D9bI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RoF4x5x8EwTLSAWggp8PbjUnNCa3Fr02fZWnucgfmyeEwzImMB/Z274kJtq4txfDQ rc48QO1WE8m7zdxrw2H3X8E1K6CnhwovYAwz2A/It1uujXuxhWKDcX39fY4+znYB90 U3xy9IjVmfwtxyMuBWE/Q54fYQknxmDiqaj1qX7o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jonathan Cameron , Andy Shevchenko , Sasha Levin Subject: [PATCH 4.14 116/210] iio: ABI: Fix wrong format of differential capacitance channel ABI. Date: Mon, 24 Oct 2022 13:30:33 +0200 Message-Id: <20221024113000.755261631@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571246269815944?= X-GMAIL-MSGID: =?utf-8?q?1747571246269815944?= From: Jonathan Cameron [ Upstream commit 1efc41035f1841acf0af2bab153158e27ce94f10 ] in_ only occurs once in these attributes. Fixes: 0baf29d658c7 ("staging:iio:documentation Add abi docs for capacitance adcs.") Signed-off-by: Jonathan Cameron Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/20220626122938.582107-3-jic23@kernel.org Signed-off-by: Sasha Levin --- Documentation/ABI/testing/sysfs-bus-iio | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio index e21e2ca3e4f9..c6573a733a68 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio +++ b/Documentation/ABI/testing/sysfs-bus-iio @@ -135,7 +135,7 @@ Description: Raw capacitance measurement from channel Y. Units after application of scale and offset are nanofarads. -What: /sys/.../iio:deviceX/in_capacitanceY-in_capacitanceZ_raw +What: /sys/.../iio:deviceX/in_capacitanceY-capacitanceZ_raw KernelVersion: 3.2 Contact: linux-iio@vger.kernel.org Description: From patchwork Mon Oct 24 11:30:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8590 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419257wru; Mon, 24 Oct 2022 05:15:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7o4EQONuGRqnukAjhOuho6sKeRBsYJGtNBz+TTUGEKKJoMA3gT2rxB+YZknrdO5qaeS3ch X-Received: by 2002:a17:906:58cc:b0:78d:ce9c:3787 with SMTP id e12-20020a17090658cc00b0078dce9c3787mr27006909ejs.715.1666613746997; Mon, 24 Oct 2022 05:15:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613746; cv=none; d=google.com; s=arc-20160816; b=v1SFpY2R0eROBXdkgpyW1ItDi/sErcubDXXFTQEAv+lQkqMDO0InGRGk/k+TtQVqPE lol19wdRD6eY00HMfdV93LqKESxYNVvg2UjL/GbDUgOY8GD5+c0d0A542J2ruNzeq2aq FQVMu8V5/2vWxuj9rN9GdNUIKR64tUeIggEEpJWv64Av4eD1Zb2dEYbDIJ8KtxtG8nX3 fcez/1J+v7yFMW2158c2SKfqWtb7xGHdmWuygxQ9Jhf4bxHIE5K84DTbq9IjLax17HjY ZdN1yq4w5o8ZTpYlLMqt0+Jf9yBeBgTd4CnzbIwmgy7+dNYddGiZNOw6D8iMm06tUy4e RtUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HMAPptS1OVr021ziaCM9TJZAbL1YlJYFQPeaByQn3g8=; b=j3SzlUX4Yg4HFPMkc85SxdWJqt7QfUzm/8VGfUD53Qhl9xKBTUyaGvfDfnTO/Cnb1f INxXeaouAJSGEZ84uhj+RnwMJjRP+X7zPQ8mjPRVkcmznYRHEcT9egmLX/ifJsH++4xI 9ZIGRNMPWC7LIbHLhu9qVTynBDvz2yCL4kjK88w3RP0fcH0ROAGAhBNyPoLBKi64DQhI HhrPrIrpzE4QSuUHCje7Qohm/OwQlZP2BjGtJjbhhtZc0JAQcF2bbfsA1aNUemPo9Vht wmEgvCqNXx+zQz9U0cv9uGZBNg+u3hsEn8TeDzf41dvpxARgBmS41gNmAq8kZ4lifMIY X5qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Nud6iqjI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hz4-20020a1709072ce400b0079a9eed8c1bsi8601415ejc.894.2022.10.24.05.15.22; Mon, 24 Oct 2022 05:15:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Nud6iqjI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232689AbiJXMGm (ORCPT + 99 others); Mon, 24 Oct 2022 08:06:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232885AbiJXMEg (ORCPT ); Mon, 24 Oct 2022 08:04:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91BAB6D9E5; Mon, 24 Oct 2022 04:50:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 64347612D5; Mon, 24 Oct 2022 11:50:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7728AC4314C; Mon, 24 Oct 2022 11:50:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612223; bh=JQ1YhggFy28azsY8urVLO5ERLFM3p0+gWjXW8vwNE0I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nud6iqjIFxS5v5og4PCz5tWFzu3l+kQZhSnG3RDnsmDbOdRdnbn22BclNaozXEDLW 2X0I2JaJpJjju6pMJQ5rtC9RapxEuPaPcT6QN4h3y3+ItORoSdJ/MSSVnW3lgReOBf INDnwFYaCgrog5ivLElro7BGxcMOoBCtC2FY9hck= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Stephen Boyd , Sasha Levin Subject: [PATCH 4.14 117/210] clk: oxnas: Hold reference returned by of_get_parent() Date: Mon, 24 Oct 2022 13:30:34 +0200 Message-Id: <20221024113000.785793272@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571176112773517?= X-GMAIL-MSGID: =?utf-8?q?1747571176112773517?= From: Liang He [ Upstream commit 1d6aa08c54cd0e005210ab8e3b1e92ede70f8a4f ] In oxnas_stdclk_probe(), we need to hold the reference returned by of_get_parent() and use it to call of_node_put() for refcount balance. Fixes: 0bbd72b4c64f ("clk: Add Oxford Semiconductor OXNAS Standard Clocks") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220628143155.170550-1-windhl@126.com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/clk-oxnas.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/clk/clk-oxnas.c b/drivers/clk/clk-oxnas.c index e51e0023fc6e..a92bf71f03ac 100644 --- a/drivers/clk/clk-oxnas.c +++ b/drivers/clk/clk-oxnas.c @@ -218,7 +218,7 @@ static const struct of_device_id oxnas_stdclk_dt_ids[] = { static int oxnas_stdclk_probe(struct platform_device *pdev) { - struct device_node *np = pdev->dev.of_node; + struct device_node *np = pdev->dev.of_node, *parent_np; const struct oxnas_stdclk_data *data; const struct of_device_id *id; struct regmap *regmap; @@ -230,7 +230,9 @@ static int oxnas_stdclk_probe(struct platform_device *pdev) return -ENODEV; data = id->data; - regmap = syscon_node_to_regmap(of_get_parent(np)); + parent_np = of_get_parent(np); + regmap = syscon_node_to_regmap(parent_np); + of_node_put(parent_np); if (IS_ERR(regmap)) { dev_err(&pdev->dev, "failed to have parent regmap\n"); return PTR_ERR(regmap); From patchwork Mon Oct 24 11:30:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9551 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp512394wru; Mon, 24 Oct 2022 08:27:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7LPJY71QsgQDjV0hW9x4CPQKPwuvASETqeFh6Qv7/JPq8AgMvNOQem6YzwiJwEGglcc7oM X-Received: by 2002:a17:907:75c6:b0:79c:d3f4:4a14 with SMTP id jl6-20020a17090775c600b0079cd3f44a14mr14506536ejc.61.1666625279213; Mon, 24 Oct 2022 08:27:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666625279; cv=none; d=google.com; s=arc-20160816; b=ckrl4a6B96539G1u5UaI4ZmqCfsp4UaNOtv6NC9RbtvQ+VfTCwzgvTgbb8GLM3LgGb F2QkB5Slyw55AsgIUFrIrOrW2DD25M4BmRKsD1kHHNxCGIC53cCufLgI+SZ+JBpauoct FFLMpmRfg07TspdU4zkD1zRyqtZIvOnJFnlKHLMLX96LPkhcA8B8iqQJWXsCtrBG++Lk Dd28s/44VZW6/gvB3eUEAEoM4Uqa4iXg5gL61kXonytTbv2NtjOhMy0Gp73HqDugJis2 Gt2/oURzGbowyx0K6PxBOqXpIuzgeNtHYyFLat5Druuyq133YiAFiK5NaSrIWKzgZnEv Il2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cKZ4oQExA+8BD251kHlXtMX5j4Lcm9mNaE1/Uu7ENb8=; b=PQH5+u/Koqhg65/yl5//uF+7xMgSMo6oG/Qdm4+uj2atUU5K1Q6m0rzAsNHrvS3oZF M3xf2Pi1I4TippNc7OCsrWCEoAdham+jGNY+XTGMsUNrmhiEKlmvG89+YQHEtk/uTrsf 1MQSNcncRYDxhsogRYnXVKZxZbx3+eS+a/kqWz7l0Br5CnjCyD/YpCQsMxIoYJxxS8J5 quAh2U3K0lyQrixO6z0K1/0r3CQSO7XUrDaxQ0ryTcMMZXYvA6HnrexrCbsVnynGKfpi qFmUJeGcP+gLKd15uoq59Ixo2cC9N8fCN6JHqDvXNuH9Is0MfNbl+IWZxdBzVc4+VKeF uEEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=s+df8uSL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hb6-20020a170907160600b0078ca7bbf616si26219ejc.746.2022.10.24.08.27.34; Mon, 24 Oct 2022 08:27:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=s+df8uSL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232212AbiJXPGZ (ORCPT + 99 others); Mon, 24 Oct 2022 11:06:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232242AbiJXPGF (ORCPT ); Mon, 24 Oct 2022 11:06:05 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F046F814DD; Mon, 24 Oct 2022 06:42:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 06882CE131B; Mon, 24 Oct 2022 11:50:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19937C433D7; Mon, 24 Oct 2022 11:50:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612226; bh=FkJzQqyuzVINUw/JtDrOgZ4bFtKbtqYn4qROJOxUE/k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s+df8uSLAaBPn7jmFlUEGskw+BocKpjUlv5Yq+iycRwdgXtDCIe2fBa8qlFPZlifl UQWGPvXe5m62G9ODAeMKQ+QDuT+UV2r/TFsRFlTXDXvJy/pg/yNyajM4h+9WMLyNKC iLNl9g35icQB3lKboG9JfWZ1lsc5LqJUAiweFjfo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Stephen Boyd , Sasha Levin Subject: [PATCH 4.14 118/210] clk: tegra: Fix refcount leak in tegra210_clock_init Date: Mon, 24 Oct 2022 13:30:35 +0200 Message-Id: <20221024113000.815596438@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747583268805545159?= X-GMAIL-MSGID: =?utf-8?q?1747583268805545159?= From: Miaoqian Lin [ Upstream commit 56c78cb1f00a9dde8cd762131ce8f4c5eb046fbb ] of_find_matching_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: 6b301a059eb2 ("clk: tegra: Add support for Tegra210 clocks") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220523142608.65074-1-linmq006@gmail.com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/tegra/clk-tegra210.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/clk/tegra/clk-tegra210.c b/drivers/clk/tegra/clk-tegra210.c index cb2be154db3b..8aa400d04c6b 100644 --- a/drivers/clk/tegra/clk-tegra210.c +++ b/drivers/clk/tegra/clk-tegra210.c @@ -3130,6 +3130,7 @@ static void __init tegra210_clock_init(struct device_node *np) } pmc_base = of_iomap(node, 0); + of_node_put(node); if (!pmc_base) { pr_err("Can't map pmc registers\n"); WARN_ON(1); From patchwork Mon Oct 24 11:30:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8601 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419524wru; Mon, 24 Oct 2022 05:16:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ZQlEABS77LWJoSGqeHPalrB2McpL8m9jJeFddT11ywghHi69XhFwoVdKdtsdvCEQeHDU4 X-Received: by 2002:a17:907:2cf5:b0:78d:f9cc:794a with SMTP id hz21-20020a1709072cf500b0078df9cc794amr26092866ejc.577.1666613787497; Mon, 24 Oct 2022 05:16:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613787; cv=none; d=google.com; s=arc-20160816; b=dV+NkTu01VVC1ONQQ2Zjq/OYTDKqcWcd/u4skys6wtfq9O3jnFHbuOrScD5RWJgfDx RJHNk2pdPGVkR+uaOGAt4L6byY7Q+ncVhbjvbnCbZAjhZNIpWGg+MfG19tSA6BWxzDj0 i+cS8uOWRvoUO4+bpFF2kBcFWHjVNSayOsoqWZjZY6d9Jebon6kkghrKRW2fwObQmhep Z9sStYiAIrIheDW/Tam0L7/LsVjrOe76jEPWQsNcLkfOURsdWVxHQ7JTISpyJ8Le9c49 tik4P4sRSkAjwVP/dQK3kbmz87EV6AeEJVydbcZLbiLVnNWtA3SsIrWMaLbDfQUFJ0mX 3T3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8c1j/M987/nKWBPZqILrwgvxQGNxgsfOaNFoR1kvF1g=; b=XwXmZOR31Q5K3URY3GudrUm/5f48bvnAtKGBFE1lyH2hMBv2zsbMO4ZGnzaW9ERNN5 OKLF63DhVqQvEoqIP9qvuNArUtYQsaLBr032GFstdEqT58P/U4VQID0dhlL0ZGK8Co28 KpPfgwCUAuk/dSiHYUNpstq4l/NnAhDADxB10TZEkYAcVjx1/Hy+3wRemw1chupDyj9p Ggz1BB3SD+HpRRQQjMABhl2LZVX20F61I+cFE13t8qFeQ3FCoh27iE4bItHyHUxcmqLz u5xUQxU8azh4lhLoeWyRbnramTcGMSBiWkf4j+wxwd6oxYhXkc/dTLu9elMbKBRz0s/N BJWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=t9w4b3nu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wz8-20020a170906fe4800b007aa0798e081si1385088ejb.394.2022.10.24.05.16.03; Mon, 24 Oct 2022 05:16:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=t9w4b3nu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231396AbiJXMIA (ORCPT + 99 others); Mon, 24 Oct 2022 08:08:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229936AbiJXMFJ (ORCPT ); Mon, 24 Oct 2022 08:05:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B263A7D1F1; Mon, 24 Oct 2022 04:51:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 07CB1B811C2; Mon, 24 Oct 2022 11:50:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63185C433C1; Mon, 24 Oct 2022 11:50:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612231; bh=+xRN65h8XMr3o6/9muZHdrbyw84AGq59Ye/oG3pC+jM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t9w4b3nuipwro2rbGguMhmxDNvAvAFX7w1R+h/kqLNKkGle/AsYYf3zPCllSypqYD +DRcIRdkS08phfsYt/0O9gX+3VudrNrre6rzZ03tFOOGL+pBj9w78ynYaj8todbf3j ux+p4l9rbcNHvluPQbsMUvQWoqGztnfbkntyMvI4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Stephen Boyd , Sasha Levin Subject: [PATCH 4.14 119/210] clk: tegra: Fix refcount leak in tegra114_clock_init Date: Mon, 24 Oct 2022 13:30:36 +0200 Message-Id: <20221024113000.846085929@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571218661620901?= X-GMAIL-MSGID: =?utf-8?q?1747571218661620901?= From: Miaoqian Lin [ Upstream commit db16a80c76ea395766913082b1e3f939dde29b2c ] of_find_matching_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: 2cb5efefd6f7 ("clk: tegra: Implement clocks for Tegra114") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220523143834.7587-1-linmq006@gmail.com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/tegra/clk-tegra114.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/clk/tegra/clk-tegra114.c b/drivers/clk/tegra/clk-tegra114.c index fd1a99c05c2d..8c071a8fc710 100644 --- a/drivers/clk/tegra/clk-tegra114.c +++ b/drivers/clk/tegra/clk-tegra114.c @@ -1343,6 +1343,7 @@ static void __init tegra114_clock_init(struct device_node *np) } pmc_base = of_iomap(node, 0); + of_node_put(node); if (!pmc_base) { pr_err("Can't map pmc registers\n"); WARN_ON(1); From patchwork Mon Oct 24 11:30:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8822 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431271wru; Mon, 24 Oct 2022 05:43:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5fUxrxqzGy2053re4ECGqZsYxg0SzlM0MhCsMS7KMXck8hURxUPXzqk/hLvdmXtjCXAugj X-Received: by 2002:aa7:804b:0:b0:56a:ecab:e86a with SMTP id y11-20020aa7804b000000b0056aecabe86amr16206906pfm.40.1666615401872; Mon, 24 Oct 2022 05:43:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615401; cv=none; d=google.com; s=arc-20160816; b=bCHp/KWJSozFDTIOb1QP/+Fd8sEjehEIHNFmuqXfZ1X6NWwk41J52FEIwhffEbWanj +6Q3rzMkeN2ePj4U4NFbHAJvBV935bDZI0bR3PnIUxqrzNwtOGCOAKXRewPQTr6BJ9Nl 6iwmCrkz18kCz8KKAnAcidhVpVBS6Ml23n+K3NEEakXgz3HuHnCGV8WYjb5pid2YjjAW hnxoGP7ySN2BHDlhnk5cklh+H5ziKvovpAjM53sRdq6EWux96C/TmeVQIYg/QuNLSm2i rpwzv0Upmcr0c7pHAX6sgnwHL9Cmq90HWmss7cG2bSWCG4OUOnQF3avitaaPo51SK3wR y3IQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=F2D8qWkAFjmj9aOPFnI1ohFLrF4OGWiuqNUGEqJJjjQ=; b=an5SjSyBId/rhOaIPKZ1kWY+jpSbyQWG45nZCjbJY3DVZeA1YIFNdTjtPNEK/ZhmAe eoXEWBu1zM+IzQxLZZ+O4+J5Gv2nmzh6cZrvYtG8BrRZB9dRj0y6T5Vza/JHzqypWhs6 GcfZgwq9imAcVt/ZGDp5t1IVH6jaIW7o/LCpfzmp08Q5EGMrKddFyO3mdCfrIvqu+0GA waRFuODhCPoBfQG7zX0Ynz/6Qc+VLMlfr1qcoyI0qZUnEv3vOClnMVOVzjw6FUfcZ+UJ 919sHQAdFIvEFvlNqQCD//N8cYq8fTmvPAJK+ktyKT80cszqzFTFNfpVjC3ZCbxx+Bz3 UIGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nT01TS7F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ot1-20020a17090b3b4100b00200acd39846si21066683pjb.63.2022.10.24.05.43.02; Mon, 24 Oct 2022 05:43:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nT01TS7F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231804AbiJXMg4 (ORCPT + 99 others); Mon, 24 Oct 2022 08:36:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234427AbiJXMaT (ORCPT ); Mon, 24 Oct 2022 08:30:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B74DC88A03; Mon, 24 Oct 2022 05:03:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id ADDB2B8119C; Mon, 24 Oct 2022 11:50:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 095F5C433D6; Mon, 24 Oct 2022 11:50:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612234; bh=g3xurf+26Zeho2T4obK1FAu9yl7PM0ykkt9q2gqZ0KA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nT01TS7FXF4GjdHy82PMDqIaLLvLYJlci5LJWd9lSJvN1WoJL2nhyibYQ9Kr5Ns/Z Oe/fFkZA0ZsXgw32c7d+8G1N9s5/11FrZTlaj6tPv3QXJrDl9w5H5EPEYj1uDZTakr ICm2v90u8kQ6vCTGsoKtRoWa2bCjc5gHqs8AFf90= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Stephen Boyd , Sasha Levin Subject: [PATCH 4.14 120/210] clk: tegra20: Fix refcount leak in tegra20_clock_init Date: Mon, 24 Oct 2022 13:30:37 +0200 Message-Id: <20221024113000.877227186@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572911628957176?= X-GMAIL-MSGID: =?utf-8?q?1747572911628957176?= From: Miaoqian Lin [ Upstream commit 4e343bafe03ff68a62f48f8235cf98f2c685468b ] of_find_matching_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: 37c26a906527 ("clk: tegra: add clock support for Tegra20") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220523152811.19692-1-linmq006@gmail.com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/tegra/clk-tegra20.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/clk/tegra/clk-tegra20.c b/drivers/clk/tegra/clk-tegra20.c index 837e5cbd60e9..4c9038e73888 100644 --- a/drivers/clk/tegra/clk-tegra20.c +++ b/drivers/clk/tegra/clk-tegra20.c @@ -1101,6 +1101,7 @@ static void __init tegra20_clock_init(struct device_node *np) } pmc_base = of_iomap(node, 0); + of_node_put(node); if (!pmc_base) { pr_err("Can't map pmc registers\n"); BUG(); From patchwork Mon Oct 24 11:30:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8587 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419218wru; Mon, 24 Oct 2022 05:15:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7U6dO1Vz8BZdfcPLnFXkaLTo/ihsp0I2g2nTTV9i0joXGL7gxy4Xk82ceTQNpHsPYCzeOp X-Received: by 2002:a17:906:dc8f:b0:7a5:8160:1995 with SMTP id cs15-20020a170906dc8f00b007a581601995mr6319210ejc.500.1666613754494; Mon, 24 Oct 2022 05:15:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613754; cv=none; d=google.com; s=arc-20160816; b=DsnS60wUNKNyvOO2pZYAXK1OerPL4KLyzTP0lJNr1rin2m/kmS0GkO2FUbDjnTOYfs y7xKaRdOXzV7Xnr+tMfHNTSBNITFc9kJpWlrzlvyCBZ6XKedPWbPfspgaFDeUh6t1a3A jMAKernb4oLnymfH1R9tc6pySgvf9Sn9ey6TY0E/D5Rw6eQ1hBEc1W+S+eR/E3YTbowy e+omzXf+YBJLCBcpf/Poay2VDwGjqlNlG8gCxLJc+fkZgXMXGQp7IyccDYHEch4nKY4j K9ew/33y604T9IWCaCgjejYRM/2XyO+7V1JgQ+V39SNF8RO+uXpebTWGk2AxJ7d21OCh qNqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tPRJPNA1iDsjwvA49KAi5VsVjqSNe5SRgDtKtbBlO/E=; b=Ahd1rPeAbR1WiGf2JZSe19UTrG0DYXn7wbpLL/IU9CP8TRXjnAYDnwI1Ilccvqyur0 YXsqUa6ND11VQuPsw6cU21aNQQQURQ4onPteAMyDEf2b6/4XOqW0ADx5pSuOy4OQsbhh M+oncr3PSwwt2ZUn2/0jEeIjiT5fKezQxQGpLEmgTWxemaeru7Gb2ZeucRUJVxZxFNhh dQ8nP0c1BKkG/p9NrmTIfERl0NnutD/ZexmpCrIBHA9iYrc5kp5K7RbEi1GMpmk5Qjgs /P4z4g5n1krGwG24AkqCEnPNqSOIlkJMdxcpVDi764/MOfVIhsd3R9Xk6+S0LdvBepgs A5gQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CP319DYX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fj2-20020a1709069c8200b007aa35038c6bsi1303202ejc.463.2022.10.24.05.15.30; Mon, 24 Oct 2022 05:15:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CP319DYX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229631AbiJXMHC (ORCPT + 99 others); Mon, 24 Oct 2022 08:07:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232915AbiJXMEh (ORCPT ); Mon, 24 Oct 2022 08:04:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A81ED73; Mon, 24 Oct 2022 04:50:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 82626612B2; Mon, 24 Oct 2022 11:50:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96674C433D7; Mon, 24 Oct 2022 11:50:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612237; bh=CW8gk3mYFvAel/RUsGWu75S5tMb8UzsMZGE5o3hFPAk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CP319DYXqlbPd4IGdPVTvW3rY6rEiiQ0ARfl0m9Tp7nFHewtGU6PJIysqu+TFb2+o 6cDgouG6chlRvRhd4kkKLDvBrpHC/LlxOwlvZrLd+XyVnZ0FvLPhGxT5aBsD+SXWCZ 9M/hLnL5k5WwkVh844f7Lh+/HiakcKcmsA8hvOTw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Sebastian Reichel , Sasha Levin Subject: [PATCH 4.14 121/210] HSI: omap_ssi: Fix refcount leak in ssi_probe Date: Mon, 24 Oct 2022 13:30:38 +0200 Message-Id: <20221024113000.907205001@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571184284247012?= X-GMAIL-MSGID: =?utf-8?q?1747571184284247012?= From: Miaoqian Lin [ Upstream commit 9a2ea132df860177b33c9fd421b26c4e9a0a9396 ] When returning or breaking early from a for_each_available_child_of_node() loop, we need to explicitly call of_node_put() on the child node to possibly release the node. Fixes: b209e047bc74 ("HSI: Introduce OMAP SSI driver") Signed-off-by: Miaoqian Lin Signed-off-by: Sebastian Reichel Signed-off-by: Sasha Levin --- drivers/hsi/controllers/omap_ssi_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/hsi/controllers/omap_ssi_core.c b/drivers/hsi/controllers/omap_ssi_core.c index 3554443a609c..6e9d88d9d471 100644 --- a/drivers/hsi/controllers/omap_ssi_core.c +++ b/drivers/hsi/controllers/omap_ssi_core.c @@ -560,6 +560,7 @@ static int ssi_probe(struct platform_device *pd) if (!childpdev) { err = -ENODEV; dev_err(&pd->dev, "failed to create ssi controller port\n"); + of_node_put(child); goto out3; } } From patchwork Mon Oct 24 11:30:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8683 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422404wru; Mon, 24 Oct 2022 05:22:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4kqTj7x7k7vTLfkbqqZDwPl632LZHDJU5ZNIXqvWGhl4F1mhkE9Q3QDDKD2REd0C4kXZul X-Received: by 2002:aa7:df08:0:b0:461:d9a2:b247 with SMTP id c8-20020aa7df08000000b00461d9a2b247mr2892874edy.54.1666614156683; Mon, 24 Oct 2022 05:22:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614156; cv=none; d=google.com; s=arc-20160816; b=EeZPTpPXkmiz3WGCxVaZHOHfI2MBnodvyQemqHzcnq6k1pbYO8+3yWbE8n6NCuR0f/ JQQNTJGeUB8odDJZX0snpwRoKEvA/CMXi0HxzAp/9cIUkcl7Y1TLg33DJmn+A+ya7CRp 0A+Ltmsb92cyWUXeM0VXV/ySjCyi1xyApfq6JxW/Br2HUL2v9V2sBfu8IrLgoA9rWrq7 O1cZNrPrhlEKXiZO7W+5wlCnvNk+hJpv9hn4p2o+whgish8IPSBPze5LqenZaBCrkbgx tWXryyH4Ag6IjgHFc8HhVWsMkt8C0Y8PuBZKUpMr1LSIQ5eaY8hUxDR0eMpjP7Ftd0LP OLMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+jC96M70CTc/mgLZwNq9AYuEB+LMif/W5msEdG8YzjU=; b=xRLHwlz9UZH4mSi0hkZFUzcFKzsf3TSdOedMG3qmfAMNNaR8CLXMu+exCfpibvKjPL +wZQ7f6hfOJnmphevzx5rxNm0OLMNBE91axTPuAgdv7iV8O4fMrlt/uxdaVjv8OVofQq T9hYxlbZ+gLahXvkn4IHhTsjjDIFa3Tsf50ust4TycpabQ0yCAu2jr6rMbJ+9ET3TAOy DLpKdTD1gXFpFqYWKylkANJ9Y+AD2jBqMsKLYZKi6VeToOPW2nyeXGlGl7SSpfSo4QJT Bc4gQ6QNbdT1H9ZqBAncq/irCGoW5rYrU3yAiBirjsDdeqdcbaCL4T9WcGjLb9kyQe5K xNpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xGpHThms; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j26-20020a170906255a00b0078de8494d15si7130213ejb.996.2022.10.24.05.22.12; Mon, 24 Oct 2022 05:22:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xGpHThms; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233331AbiJXMUw (ORCPT + 99 others); Mon, 24 Oct 2022 08:20:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233369AbiJXMTS (ORCPT ); Mon, 24 Oct 2022 08:19:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF8C582D04; Mon, 24 Oct 2022 04:58:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 23331612CC; Mon, 24 Oct 2022 11:50:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36EB9C433D6; Mon, 24 Oct 2022 11:50:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612239; bh=Jhmkst0PnxOYr9CFYZdLcK8CmYezRA+qQmUrSlsWzgY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xGpHThms2odKul/Tg6KR5Vbc4qwaqh11Nx0ZOq+/sH8fr2A+cvdFYzsQ+SDiGVI4e 5zRBVHipgtl5VhAsQ9GKo1ZSQHIdfvqwjeGbff0xPDWLpX2QgQwMXJcBm9IR4+yK04 jm5O0WkoPQctgQJtxedwQjLBhSWLBCFI2i1cZQEc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sebastian Reichel , Jack Wang , Sebastian Reichel , Sasha Levin Subject: [PATCH 4.14 122/210] HSI: omap_ssi_port: Fix dma_map_sg error check Date: Mon, 24 Oct 2022 13:30:39 +0200 Message-Id: <20221024113000.936773739@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571605654746742?= X-GMAIL-MSGID: =?utf-8?q?1747571605654746742?= From: Jack Wang [ Upstream commit 551e325bbd3fb8b5a686ac1e6cf76e5641461cf2 ] dma_map_sg return 0 on error, in case of error return -EIO to caller. Cc: Sebastian Reichel Cc: linux-kernel@vger.kernel.org (open list) Fixes: b209e047bc74 ("HSI: Introduce OMAP SSI driver") Signed-off-by: Jack Wang Signed-off-by: Sebastian Reichel Signed-off-by: Sasha Levin --- drivers/hsi/controllers/omap_ssi_port.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/hsi/controllers/omap_ssi_port.c b/drivers/hsi/controllers/omap_ssi_port.c index 7765de2f1ef1..68619dd6dfc1 100644 --- a/drivers/hsi/controllers/omap_ssi_port.c +++ b/drivers/hsi/controllers/omap_ssi_port.c @@ -252,10 +252,10 @@ static int ssi_start_dma(struct hsi_msg *msg, int lch) if (msg->ttype == HSI_MSG_READ) { err = dma_map_sg(&ssi->device, msg->sgt.sgl, msg->sgt.nents, DMA_FROM_DEVICE); - if (err < 0) { + if (!err) { dev_dbg(&ssi->device, "DMA map SG failed !\n"); pm_runtime_put_autosuspend(omap_port->pdev); - return err; + return -EIO; } csdp = SSI_DST_BURST_4x32_BIT | SSI_DST_MEMORY_PORT | SSI_SRC_SINGLE_ACCESS0 | SSI_SRC_PERIPHERAL_PORT | @@ -269,10 +269,10 @@ static int ssi_start_dma(struct hsi_msg *msg, int lch) } else { err = dma_map_sg(&ssi->device, msg->sgt.sgl, msg->sgt.nents, DMA_TO_DEVICE); - if (err < 0) { + if (!err) { dev_dbg(&ssi->device, "DMA map SG failed !\n"); pm_runtime_put_autosuspend(omap_port->pdev); - return err; + return -EIO; } csdp = SSI_SRC_BURST_4x32_BIT | SSI_SRC_MEMORY_PORT | SSI_DST_SINGLE_ACCESS0 | SSI_DST_PERIPHERAL_PORT | From patchwork Mon Oct 24 11:30:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8589 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419242wru; Mon, 24 Oct 2022 05:15:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5RtIcuTlGDzhcfm43GqfY/MSvM0VIspoqZhI0Af2NjWCGDdjtcsFG0Fa2iLoUdaQFgRMwM X-Received: by 2002:a17:906:d54d:b0:78e:f130:7099 with SMTP id cr13-20020a170906d54d00b0078ef1307099mr28192658ejc.142.1666613756726; Mon, 24 Oct 2022 05:15:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613756; cv=none; d=google.com; s=arc-20160816; b=wsoeGRvZprSxvPgreZS9U0pWmkjn/JY+7uC+Hr4Zwha/4POzaElZ6dh+O8sX32WYGJ atBEs/NDi2FLmTjFctrsGTOagKqqntlyRT56kGVmFEjQv/JRRH6JTi6BxXhfd8DmD2WA 8TouHqwam96fEUTohANTZ1LEDbywVMmmgMOPrp6kYJQLy0C0Fk837tMDkXBI5lfnzBHg qaLVB2wgrk0tjOb1I0Pl5eFnXIvgzmjvVw7sBhVaAMTuOnoOGvqqgr0o7AYY8vFJuXx9 NH733PSxtMBlWTsPmG1DiXHap85Kvf+cXaXgPsVbIgJl9S2sP/LVCrK4mwbOKg6bNb9X cTpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Lc9ofEiR9m3b8fsinSHyN+EfZUaecut0dTHXtVdUmFg=; b=OaFJ9sMGz1OKyYmNCkEBk0z+vaIFMbV5LBWj8iktb3o4q83uYZHZJC6lpcqgYQ1StO kFG11VoJ5t7JR1TsU7nDmXO9/IB5aCMRPxqh5darQGz58TzOqRmGMy2NXASYTE5/kPnQ gumstR76ejrq93PDbnlUPrDuspx/BlKwYa6RXQKAH3/ubuhenipHQYe5KaxLo7uKU8La YzYzho8kmPvu9z7HdfAEXjhWyPTK40m7QU7Yd+XbJVI5YVOU24nxIJ1qh6MtIbCR3H62 Syvt2lm5ytXDNWMRJs+P9w2ssOteU3eH0obKJG09j51dzfwmNlVdYhXwXiPAxXh0L8qo pa+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SBN33LXI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hd40-20020a17090796a800b0078d3ab37efasi29033188ejc.84.2022.10.24.05.15.32; Mon, 24 Oct 2022 05:15:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SBN33LXI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230233AbiJXMHH (ORCPT + 99 others); Mon, 24 Oct 2022 08:07:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232913AbiJXMEh (ORCPT ); Mon, 24 Oct 2022 08:04:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FB65647DE; Mon, 24 Oct 2022 04:50:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B1FAC612A8; Mon, 24 Oct 2022 11:50:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C24B8C4314A; Mon, 24 Oct 2022 11:50:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612242; bh=YqqfBLDCHIre+JSjFqMR5fczi5ijx+iG1FyyUcTV2kg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SBN33LXIAJ6n8AU4aXYv2w0d+GceCdB2pTM/N8mctUF3nG5aJoqIcErxeDF5zisf3 HfC4VmPlHOHFM+S1azanSv1WtdY1VuDcGZl55SkuXPtQOUwNi8TH4G2KFtTlFFIJ2/ 2wXbx8Gf4+5ptrUjw1P5kBNd/IofHE478dYtJeek= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.14 123/210] media: exynos4-is: fimc-is: Add of_node_put() when breaking out of loop Date: Mon, 24 Oct 2022 13:30:40 +0200 Message-Id: <20221024113000.967557138@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571186276234305?= X-GMAIL-MSGID: =?utf-8?q?1747571186276234305?= From: Liang He [ Upstream commit 211f8304fa21aaedc2c247f0c9d6c7f1aaa61ad7 ] In fimc_is_register_subdevs(), we need to call of_node_put() for the reference 'i2c_bus' when breaking out of the for_each_compatible_node() which has increased the refcount. Fixes: 9a761e436843 ("[media] exynos4-is: Add Exynos4x12 FIMC-IS driver") Signed-off-by: Liang He Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/exynos4-is/fimc-is.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/platform/exynos4-is/fimc-is.c b/drivers/media/platform/exynos4-is/fimc-is.c index 0f3f82bd4d20..6f59fe02c727 100644 --- a/drivers/media/platform/exynos4-is/fimc-is.c +++ b/drivers/media/platform/exynos4-is/fimc-is.c @@ -217,6 +217,7 @@ static int fimc_is_register_subdevs(struct fimc_is *is) if (ret < 0 || index >= FIMC_IS_SENSORS_NUM) { of_node_put(child); + of_node_put(i2c_bus); return ret; } index++; From patchwork Mon Oct 24 11:30:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8614 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419971wru; Mon, 24 Oct 2022 05:17:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7gwqxGQSNcsNFCQ9wyWwm0GtjqIp4FE6g+FTU66JxmCuRYZGEL4T50BcZySTDbk+6hyKtG X-Received: by 2002:a17:907:7611:b0:78d:9d69:adf9 with SMTP id jx17-20020a170907761100b0078d9d69adf9mr27665879ejc.283.1666613839094; Mon, 24 Oct 2022 05:17:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613839; cv=none; d=google.com; s=arc-20160816; b=ZBZKnrlzuMK4HhqB28JtPehvy20oKumCqAFr5+dAP73ekLrFXSY+aNGfEXhb7dATKY zgovfoXOtNFSw39iyy117UIXMN5NCpebWCYmYCHajWnK5LsPJ2AqixRNhAfrH8MubtTI NwqI1mlmFaiXk/bZI7w/Nqpf5KiIhTl/Urmm9xQPuZHBE2EM5qPR1Co9DumntcD10UrF mPudUBOVnWIQ+ij3hZ4Y+V0/Ln0IzUJKvjTzDe8lZpfec91HYIEd62srrJ09PqyxCZ30 cZC460Ko9bPfphHm6YY7/txLVhQSWTX2AQp1ojbrBbDYbJBil3cUu4Tu/3SVazlIbt8/ 6nDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kwDERlHZqfaELe+8QA07ZNmVebcbJNIDJXJbKbdzWJk=; b=tjsJP81vkOe6e5b01ikK2bV4ZKhGZ48hgn7mavumZgp9ve7ejPbUuxME7P7QSuWgp6 oZsXUyC1nynE5VlVRZ//Xt9bnrpPCeJeZeKToVWv06e1Vh4wDxScEY9B+UD4ZmygHcC3 0IwQ0b3tACzcfTsjYxqappkyqiLEOvr+YkcaZr9szEgllDpamZESF89IzATrHoU+phMd NL6YnmLHfcroDs4Ktlb0Y/MWTv24PIEB7h+ejzBC2Tbt2Osg6d5c2nnRD41MdL1JB/GF vTt67UlDKTGD8R8FILHN9LJzwVYNV/qRY5JWzvwypCNRZI3ET+du3xQMSuRb837Apfbd ruWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TTrW+kyH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q2-20020a170906678200b00780488c11bbsi23199099ejp.388.2022.10.24.05.16.54; Mon, 24 Oct 2022 05:17:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TTrW+kyH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232774AbiJXMKb (ORCPT + 99 others); Mon, 24 Oct 2022 08:10:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232856AbiJXMJD (ORCPT ); Mon, 24 Oct 2022 08:09:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 206C47E03F; Mon, 24 Oct 2022 04:51:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0F60AB811B6; Mon, 24 Oct 2022 11:50:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6EDA7C433C1; Mon, 24 Oct 2022 11:50:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612244; bh=HMtNax6B1YKpRfTbexY+MqRVDn68rD2BXHrv0/2PqNo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TTrW+kyHdxegBKiBbO9u4MPaDYLfyRFAxX3z7hESouLE8CNilz/sjni4ISdp0bxrI +p8kWI8o2eY59yCYgAoxQaHV0Ft0g0RM3dpjLer4yruIA2tm444xFs6xItgiPnlm+Y FSdce94+FaUJPo1wpY+iwJbVd2nwpQw1cCVadzRM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shubhrajyoti Datta , Sasha Levin Subject: [PATCH 4.14 124/210] tty: xilinx_uartps: Fix the ignore_status Date: Mon, 24 Oct 2022 13:30:41 +0200 Message-Id: <20221024113000.997716762@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571272779842873?= X-GMAIL-MSGID: =?utf-8?q?1747571272779842873?= From: Shubhrajyoti Datta [ Upstream commit b8a6c3b3d4654fba19881cc77da61eac29f57cae ] Currently the ignore_status is not considered in the isr. Add a check to add the ignore_status. Fixes: 61ec9016988f ("tty/serial: add support for Xilinx PS UART") Signed-off-by: Shubhrajyoti Datta Link: https://lore.kernel.org/r/20220729114748.18332-5-shubhrajyoti.datta@xilinx.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/xilinx_uartps.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index cdd81c28893a..a04fbf83d123 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -369,6 +369,8 @@ static irqreturn_t cdns_uart_isr(int irq, void *dev_id) isrstatus &= ~CDNS_UART_IXR_TXEMPTY; } + isrstatus &= port->read_status_mask; + isrstatus &= ~port->ignore_status_mask; /* * Skip RX processing if RX is disabled as RXEMPTY will never be set * as read bytes will not be removed from the FIFO. From patchwork Mon Oct 24 11:30:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10040 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp622623wru; Mon, 24 Oct 2022 12:45:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6QqOKR4tKxPLaAsYn2KJiDcqvnjpr0mYVBjJ710xMl9C1yJfyNf13EeJwkQA5ADwL77omy X-Received: by 2002:a17:90a:fe5:b0:212:cae0:7482 with SMTP id 92-20020a17090a0fe500b00212cae07482mr23243797pjz.108.1666640757567; Mon, 24 Oct 2022 12:45:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640757; cv=none; d=google.com; s=arc-20160816; b=gRxOL8O9kUCSRzIGEEwqAYbRgOAMrY73NG0LsjiIAXBqeG1VtpEueIiWrQE2EnRfPH dA+dGUDHiiNCuP/XLw7Y3GAOXTWMgt70aSXUVl5NA9vZOUxjGtK5WfIptvZI6Ow2/SAx bQegzKSiTArkhAbjFLBhQ/cNXOY38DpfAvbddSvr2qSVjJG7k2Up8K3mf9YovCspRY25 384YwLjeSIcmT84sxxVx2Dd2SM2bM50QsJG+KqoQG8C3nIZrPQJ6XXUfWkVXEl7pxF8L rKOfD4VSXp/PB6dq4Au0REI02Af2+vskY8vUusWLzPHoT9B7+MWQri2PY/cG7BH49c3q J+SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=M23wcigC0/d0AegHseZ6cHzi3psVYhi2LdOr4zM1Mco=; b=h/K+Q52YHfHQqjwBBSwPYiUpda96x9QQLrpXDuxrbeNHfPDrDBPJ6k5f7tPOzbXKXB EK2D59Ohv7WePmpenqNsnvlsuxINjx+l0Hp8CcxFjGpi7+o4/LDjyqPE/vt2d9vecE9b rjFAzq9n3yzR1sn6NlPzlAk0ffDa3xxch90FFEZk43hXu9I91jtg8DNWvCNyW6QY6v7L vWXsqxg+fv2OUqtMZDJU6kNGlkfw5wZiQxtEV8CgMbvWnWgP5LhZxywRD2k6IAWdxuEf +owZZM1ggUlPHc8N8BOvQPqYPC1I7XJyoAyCB9YjUSwGmyx7OneVLlN9eJYljAXiNBfb eKSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qx7oyCJD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o1-20020a170902d4c100b0017f97fe778dsi584849plg.126.2022.10.24.12.45.43; Mon, 24 Oct 2022 12:45:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qx7oyCJD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232571AbiJXTnc (ORCPT + 99 others); Mon, 24 Oct 2022 15:43:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231809AbiJXTlw (ORCPT ); Mon, 24 Oct 2022 15:41:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 918EF72950; Mon, 24 Oct 2022 11:11:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B68F2B811B1; Mon, 24 Oct 2022 11:50:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11961C433C1; Mon, 24 Oct 2022 11:50:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612247; bh=rBtdXM8NAjClPCybzEt83MAkGsvsxCIWqSrzQx2wJQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qx7oyCJDgu+a3Om+mtUT6K3d44jRrg45X84mhC1Ig1jKqxCzIVZoLBGs3gT98lPDy 1ksK7N9clj2y2aBAxGCJxYKnMedImBD6ERfmvCXlfE2bDjDkYV3PHQic0NHSAu8KVi WrbK6hOvOBYlVnJZb/4U5QE8QtQDR+By8jKZV25g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Laurent Pinchart , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.14 125/210] media: xilinx: vipp: Fix refcount leak in xvip_graph_dma_init Date: Mon, 24 Oct 2022 13:30:42 +0200 Message-Id: <20221024113001.027245520@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747599499002000139?= X-GMAIL-MSGID: =?utf-8?q?1747599499002000139?= From: Miaoqian Lin [ Upstream commit 1c78f19c3a0ea312a8178a6bfd8934eb93e9b10a ] of_get_child_by_name() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: df3305156f98 ("[media] v4l: xilinx: Add Xilinx Video IP core") Signed-off-by: Miaoqian Lin Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/xilinx/xilinx-vipp.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/xilinx/xilinx-vipp.c b/drivers/media/platform/xilinx/xilinx-vipp.c index ebfdf334d99c..7e0d7a47adf4 100644 --- a/drivers/media/platform/xilinx/xilinx-vipp.c +++ b/drivers/media/platform/xilinx/xilinx-vipp.c @@ -467,7 +467,7 @@ static int xvip_graph_dma_init(struct xvip_composite_device *xdev) { struct device_node *ports; struct device_node *port; - int ret; + int ret = 0; ports = of_get_child_by_name(xdev->dev->of_node, "ports"); if (ports == NULL) { @@ -477,13 +477,14 @@ static int xvip_graph_dma_init(struct xvip_composite_device *xdev) for_each_child_of_node(ports, port) { ret = xvip_graph_dma_init_one(xdev, port); - if (ret < 0) { + if (ret) { of_node_put(port); - return ret; + break; } } - return 0; + of_node_put(ports); + return ret; } static void xvip_graph_cleanup(struct xvip_composite_device *xdev) From patchwork Mon Oct 24 11:30:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10129 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp633776wru; Mon, 24 Oct 2022 13:15:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4P+gf4n6O/LP9XXNlBmPsL7f5hAXt99AcdC8ZZfvv+ViHcI3bURXFkbAH8qikXDyeOj57/ X-Received: by 2002:a17:90b:1e49:b0:20b:36a3:aba6 with SMTP id pi9-20020a17090b1e4900b0020b36a3aba6mr77876722pjb.2.1666642515685; Mon, 24 Oct 2022 13:15:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666642515; cv=none; d=google.com; s=arc-20160816; b=lU7W7KSx7wZZssgQ5JS+1ReliT11pUZqiXd9U1BVEmzA8+nCkg6voYa9cSXL0CSc7W zWNMPFA99lGWytaS9+janW1wT+euvrslDy1RK5uSlDb/81iQSLtdIw0xKI6Dd1iCyFx8 ROTPGV3tTrrkKV5Qnw145sRtjFiaOkOGGBWAiIojtaunCuAVBB/XzVPMZmFi8WGFE27S tgVUCXg+bDVOxUcXp5gKeuRwt9NU7y6zpHgEwydpY80h68gj9//Fyu/xo/wAkUb9aW2L vYhg3fjvlJE7IWfcEM+HEoTKdJvM4KzioMHqC7dG5rvIbk2DWclWAzBmemZfU09KZQVz h4lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bvt+gBVt2M41fCO97h/HV9at+0dcEiqKXYQHRNEFnhs=; b=gmIeCuYJEXsqfDq6CKJs86kVCW4L0bjRfWHuIO8rn+nZm1yAzl+imW+3zgwbVi+iDA ogNMqVqEtW3X7k0HH1f3pnKFz/YvSk9/8gD1jPShSpgkRzQ4f1nCHFT8gxkbwKTh23Sb MFJxR16yaOLGWqnNoReayRLHAxm4nKXzY+AOs4+wFz2jYw/GfhI+t+J9FXOXA8wud8Gm gqemWnxSawuSNBKaGdGFWLFSJ5FjU0cIuqB7G+RePK/3NkHRnrX4MGAUfiPGycHWZ1lg TA/Xi4yiYKu5ZQ7CU1baayfy+DnFVsYmif0IKwP6islJnkdWf7JPBfwAl2phR2dt422W rHEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0A0643p5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x21-20020aa78f15000000b0056bae3f63b5si671467pfr.327.2022.10.24.13.15.02; Mon, 24 Oct 2022 13:15:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0A0643p5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229865AbiJXUG1 (ORCPT + 99 others); Mon, 24 Oct 2022 16:06:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233762AbiJXUFj (ORCPT ); Mon, 24 Oct 2022 16:05:39 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7ADD0125039; Mon, 24 Oct 2022 11:26:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id BFDBBCE132C; Mon, 24 Oct 2022 11:50:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B375AC433B5; Mon, 24 Oct 2022 11:50:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612250; bh=UE9sMwDTAJgVqIX4DJkGduS61a4DnxqfODhdLtbgDOo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0A0643p5Ew+k0ut+THYTrPCQ0+BchGdTiLqmHe0xDVpnhPV6jT9yxfOAMgHLEERpd eTbfVJqMU1bHgMwuBfLQqbq1lDkMHQqfdH/WrycBq6x1yGEDjyLAv/Y2uywgqBBQPI YDmpeUaSKzlKCxV7FFzp15iCcGGx3a9OJltCEFNo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+ab99dc4c6e961eed8b8e@syzkaller.appspotmail.com, Zhu Yanjun , Li Zhijian , Bob Pearson , Leon Romanovsky , Sasha Levin Subject: [PATCH 4.14 126/210] RDMA/rxe: Fix "kernel NULL pointer dereference" error Date: Mon, 24 Oct 2022 13:30:43 +0200 Message-Id: <20221024113001.067795236@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747601342416272770?= X-GMAIL-MSGID: =?utf-8?q?1747601342416272770?= From: Zhu Yanjun [ Upstream commit a625ca30eff806395175ebad3ac1399014bdb280 ] When rxe_queue_init in the function rxe_qp_init_req fails, both qp->req.task.func and qp->req.task.arg are not initialized. Because of creation of qp fails, the function rxe_create_qp will call rxe_qp_do_cleanup to handle allocated resource. Before calling __rxe_do_task, both qp->req.task.func and qp->req.task.arg should be checked. Fixes: 8700e3e7c485 ("Soft RoCE driver") Link: https://lore.kernel.org/r/20220822011615.805603-2-yanjun.zhu@linux.dev Reported-by: syzbot+ab99dc4c6e961eed8b8e@syzkaller.appspotmail.com Signed-off-by: Zhu Yanjun Reviewed-by: Li Zhijian Reviewed-by: Bob Pearson Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/sw/rxe/rxe_qp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c index 6964e843bbae..6647a1628953 100644 --- a/drivers/infiniband/sw/rxe/rxe_qp.c +++ b/drivers/infiniband/sw/rxe/rxe_qp.c @@ -829,7 +829,9 @@ void rxe_qp_destroy(struct rxe_qp *qp) rxe_cleanup_task(&qp->comp.task); /* flush out any receive wr's or pending requests */ - __rxe_do_task(&qp->req.task); + if (qp->req.task.func) + __rxe_do_task(&qp->req.task); + if (qp->sq.queue) { __rxe_do_task(&qp->comp.task); __rxe_do_task(&qp->req.task); From patchwork Mon Oct 24 11:30:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8626 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp420420wru; Mon, 24 Oct 2022 05:18:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7h2v8fUb8sKP1ZBfd0nJY9UjYek16dt/KFvj6fxk9LzcSm9aayrBNuKrcaf6MFlIKTXQnL X-Received: by 2002:a05:6402:298d:b0:451:5fc5:d423 with SMTP id eq13-20020a056402298d00b004515fc5d423mr29999891edb.102.1666613889936; Mon, 24 Oct 2022 05:18:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613889; cv=none; d=google.com; s=arc-20160816; b=DJrvO9rdYef6VKPEsHlUG6uIwAycLgElE7+5/BngWqeBeAdo8PuFpnRA86fd5/3vnx pSNXfBJocpiWdxoP2e7NUK8jy/M8SCD1hvmS2Hb88gd7m9uFGP7MExznkiCoVC3Ih4eW TG2jYd/79EudZnuUcFQfX9ZLr8sHN5VuhDJ5DAatsPp1dZupMfTdtlIk0XoKWbAPuIh5 YJkOcX8Ey+BmDXfWE5Tp7qiKPfegsvcBuUyLR3QqKQobMZArXL1oP/kRR2JbBc/PzzXC 63dfBVlm71xrLUwaOAC8g+E3kWumQjQAnxH9VkHn90JcyPPBmhidKC5bhqbDWv3uFWce bb5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EjdTgTX2vfzuu3G2yCHfSirnv0E/PhqeH4FdaUVc4HQ=; b=rq7y2dHN63UMpWq/1IbHwV7Lkvyprgo/Y/LFFWt3AwC0pvIy6lRbXsANL33TBIE2IA L2QJKxz/YQoPuxY3EqGZ+RDTvdY4rMHeCcEKxx2mdOOEHNkYxDC9xGdSwY9hWMiZyKUy VPLFYDk76x6MOAm/cjFqFpc5nYa5DUnygmmfMp9ib8abhtG3jTSDW38Yyvvl0DYafJhp 0iYy8f18ou4rhZ2AMp6bo51SnZoPy34aI+F0ppVxbdoeQQX8//e7hrxKioOXDQvQCOB3 hh/9tu7VWUUbzwuRy16gQofkVoycaQZJ9fHFUeLvO6gZb9E0Lc0inQWbxn+0xalmWDq0 FseA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UFjOhmTu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k6-20020a1709067ac600b0078dc5c888f1si22751940ejo.135.2022.10.24.05.17.46; Mon, 24 Oct 2022 05:18:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UFjOhmTu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230526AbiJXMHR (ORCPT + 99 others); Mon, 24 Oct 2022 08:07:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232968AbiJXMEp (ORCPT ); Mon, 24 Oct 2022 08:04:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1646B7CB66; Mon, 24 Oct 2022 04:51:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4090061290; Mon, 24 Oct 2022 11:50:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51BD4C433C1; Mon, 24 Oct 2022 11:50:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612252; bh=xCxQdsIqbqTUrcEZF9unwa2f9VV/naFt7tQVh//Op7g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UFjOhmTuN2OE8W00d22bHJY+OFmYtmBKsQiQaGPCHW4wwk5PkZEWT7Lhxfy4/a8Jt /0OKuGzLbEwUhE0NCBfitP2Lt1gKHQpkl+6ijzy0GfygP/Fm2vfxbadVkIAJg+ss8J 2EXT0M9VK2+P3HTjWSeXFcdQihGt4nzFC7EDglwA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhu Yanjun , Li Zhijian , Bob Pearson , Leon Romanovsky , Sasha Levin Subject: [PATCH 4.14 127/210] RDMA/rxe: Fix the error caused by qp->sk Date: Mon, 24 Oct 2022 13:30:44 +0200 Message-Id: <20221024113001.102053019@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571325967848017?= X-GMAIL-MSGID: =?utf-8?q?1747571325967848017?= From: Zhu Yanjun [ Upstream commit 548ce2e66725dcba4e27d1e8ac468d5dd17fd509 ] When sock_create_kern in the function rxe_qp_init_req fails, qp->sk is set to NULL. Then the function rxe_create_qp will call rxe_qp_do_cleanup to handle allocated resource. Before handling qp->sk, this variable should be checked. Fixes: 8700e3e7c485 ("Soft RoCE driver") Link: https://lore.kernel.org/r/20220822011615.805603-3-yanjun.zhu@linux.dev Signed-off-by: Zhu Yanjun Reviewed-by: Li Zhijian Reviewed-by: Bob Pearson Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/sw/rxe/rxe_qp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c index 6647a1628953..2391b0e698a9 100644 --- a/drivers/infiniband/sw/rxe/rxe_qp.c +++ b/drivers/infiniband/sw/rxe/rxe_qp.c @@ -871,8 +871,10 @@ static void rxe_qp_do_cleanup(struct work_struct *work) free_rd_atomic_resources(qp); - kernel_sock_shutdown(qp->sk, SHUT_RDWR); - sock_release(qp->sk); + if (qp->sk) { + kernel_sock_shutdown(qp->sk, SHUT_RDWR); + sock_release(qp->sk); + } } /* called when the last reference to the qp is dropped */ From patchwork Mon Oct 24 11:30:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8698 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422697wru; Mon, 24 Oct 2022 05:23:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ZFf6ruMEoYBBOtVMC/cqcafJXL9SuMHJcQVuSrmRh7UfUwLzqjoIaCSSX7GIJCsD5xuHx X-Received: by 2002:a17:907:6da3:b0:78e:2a5f:5aaf with SMTP id sb35-20020a1709076da300b0078e2a5f5aafmr27038741ejc.554.1666614182613; Mon, 24 Oct 2022 05:23:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614182; cv=none; d=google.com; s=arc-20160816; b=w5IHwR3NeP63vCLIsU0AIYYQBmQhyEtZtGOzVmJ6gCHb5hGr1AI9RysaiNXY9E34nm Zv6wH9kV4RSf+ptEGZ5alobV7fMW6t/cvasyotGmtXOiQjI+6owuKM2+YZ7wj+4ymedn 7mdhuflwj5XdzKmZDNn4ew88Ku07aBizyZE3lHiotCJo8Rw5OvqVFnyZ5zmGFKDl2w/1 Dwoa2wBewNowoSCuKVaDq312Edek/X0Qzw6/DbsWq3m4XdoANaKdbav7MLRAfq9PNJbh yPhV2F8TSw6n3JukB/s0VxvC7PiScfqBxTtUcRgYhbLCE2u0Sx3wMn2n7IXR14YybKWA u4fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xVSIX12qppkNni78MxVYb27yW9XD9izW74viCC61gOg=; b=ta46tUe5uYhYj4bYj80Eoc9SDKNEoa3cu+Kx3Yjcx+scLgkqfSEdfMHG+WLf4bCkJd 6b+p8u1GJElGv2vQXsiDZCKbL+mqmoF/UTkKF0xwO2n6sFRPyGGq0pt0TlRcw06q4wtm QBxyMIhTdHt+ZD6dMmxO0I8PfZb2IVYeMTJx3usIOVzwMSH7++Brlf6uwlA77BPb+YS5 vFvn9d2pkKWA4u2g6OvTZI0XmqrjMccEbRhRAJEGDHhV7dOtUMJPK7KTbOKpXRAgt+EL /sZ50QTRkKYORKQDHONyjqUAS8CMCGwVcDBSXaMi0zT3S88d+/04nJKFGdMAOC7rs1OB SIDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iQGydnCT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hc35-20020a17090716a300b0073ce34d1a13si32140399ejc.499.2022.10.24.05.22.38; Mon, 24 Oct 2022 05:23:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iQGydnCT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233419AbiJXMVo (ORCPT + 99 others); Mon, 24 Oct 2022 08:21:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233516AbiJXMTn (ORCPT ); Mon, 24 Oct 2022 08:19:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95A698285C; Mon, 24 Oct 2022 04:58:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D657A61254; Mon, 24 Oct 2022 11:50:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E94C1C433C1; Mon, 24 Oct 2022 11:50:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612255; bh=3woiI64PEx05HutrOLVRH3ZjdrzIYvUydoHTUwinAaw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iQGydnCTDjmWfYHWMuCr8s3j2wHwogakGxwV4NZUlpREZWiwwNieVwUAAC2zHTIkV mtTA5/Xl8jqWweLUPgrsCFe9TvngU+3zfg1OeVam6i89j6PbVArwWq2fPnZgl5T2Em U315CMcTiS3N79NY+2+JFOk1nnrXcwmAB8lpzBhw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rasmus Villemoes , Jason Baron , Daniel Vetter , Jim Cromie , Sasha Levin Subject: [PATCH 4.14 128/210] dyndbg: fix module.dyndbg handling Date: Mon, 24 Oct 2022 13:30:45 +0200 Message-Id: <20221024113001.142535065@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571632997900555?= X-GMAIL-MSGID: =?utf-8?q?1747571632997900555?= From: Jim Cromie [ Upstream commit 85d6b66d31c35158364058ee98fb69ab5bb6a6b1 ] For CONFIG_DYNAMIC_DEBUG=N, the ddebug_dyndbg_module_param_cb() stub-fn is too permissive: bash-5.1# modprobe drm JUNKdyndbg bash-5.1# modprobe drm dyndbgJUNK [ 42.933220] dyndbg param is supported only in CONFIG_DYNAMIC_DEBUG builds [ 42.937484] ACPI: bus type drm_connector registered This caused no ill effects, because unknown parameters are either ignored by default with an "unknown parameter" warning, or ignored because dyndbg allows its no-effect use on non-dyndbg builds. But since the code has an explicit feedback message, it should be issued accurately. Fix with strcmp for exact param-name match. Fixes: b48420c1d301 dynamic_debug: make dynamic-debug work for module initialization Reported-by: Rasmus Villemoes Acked-by: Jason Baron Acked-by: Daniel Vetter Signed-off-by: Jim Cromie Link: https://lore.kernel.org/r/20220904214134.408619-3-jim.cromie@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- include/linux/dynamic_debug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 2fd8006153c3..921649db00f9 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -168,7 +168,7 @@ static inline int ddebug_remove_module(const char *mod) static inline int ddebug_dyndbg_module_param_cb(char *param, char *val, const char *modname) { - if (strstr(param, "dyndbg")) { + if (!strcmp(param, "dyndbg")) { /* avoid pr_warn(), which wants pr_fmt() fully defined */ printk(KERN_WARNING "dyndbg param is supported only in " "CONFIG_DYNAMIC_DEBUG builds\n"); From patchwork Mon Oct 24 11:30:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8607 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419748wru; Mon, 24 Oct 2022 05:16:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5AWY9mPs384v8Xyimke247oStjxiU2AM3JR6U/umWPcapY+LBjiByJWSH2EOvQ9jJ/P00Y X-Received: by 2002:a17:907:7244:b0:78d:cedc:7a9e with SMTP id ds4-20020a170907724400b0078dcedc7a9emr26781951ejc.600.1666613812600; Mon, 24 Oct 2022 05:16:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613812; cv=none; d=google.com; s=arc-20160816; b=bY28uJhMZKeA7lyjcs8GKvI2Os8+qgaBsJWA0Oa4wN+gIx307HVIROD9765fCsqgNd 2C7q5MOvqgRuNgcPHV38gqUz4UsI0p55RgNOUI3wtJSDFKbRh0XERA83VH9sRSj01e0L XeNtOZwYqMgxQ9FB+DHJ0fGfvC3xstq+8zmBgHx39/UkbFyBJFEdPvHwvijnMHWZ091R L+hoRaRFqZm8fGw8+numQTqZy6xiLMEFPLEnsonx9yjWHHS80WoTuT0lJUUCw++z4Ugx E9FPahWMHH1rjGFsdQmAicU2vSo5Ql0zydSBc9rFd5Xu52KpY0S0uL7rGs+QU7qLk3EA fwxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AhxWyfrE54TY4jmdPKQVatS23utZeDCqIjqDLjrHWFY=; b=IiJkLJNJHT+lUKoCX8p/4tfekHfkohW1k9r6aSrUg8GpAZNG9gor3tMgSM49YDufof /5K5cVFqGThzbRbzYOe4MKozqpx3cfA7Y62MV7wcxmMDnkLHATjLGwRR+te9BOPJhOwf eNr1MtRBMQCGm7ADfh/Vb6WxNWBJ6XTmt2sxLQxNrdN+mPK3OXsMz+JGNDR5RAgWqrcG 7V+RJPk2DoMJx4GIjGqXO3veYVM7rqU6hZRkDpbf+MACBWixkYmqGLDByA2X2gVrXacj OO9xe32IGdMbhLH8Bcq2AIKy04liC7HjTm0QnKEYNAbUapLyjkUaodIjuji4bb2mzQ5V 11RQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DTDZXVRN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g8-20020a056402114800b00458e43471d5si24817813edw.614.2022.10.24.05.16.28; Mon, 24 Oct 2022 05:16:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DTDZXVRN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230234AbiJXMKF (ORCPT + 99 others); Mon, 24 Oct 2022 08:10:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232771AbiJXMH5 (ORCPT ); Mon, 24 Oct 2022 08:07:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81BC97E321; Mon, 24 Oct 2022 04:51:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CB166B81199; Mon, 24 Oct 2022 11:51:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E652C433C1; Mon, 24 Oct 2022 11:51:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612260; bh=R2o+Cu2UAOttf3+FN46CvIfUeo5oZyZa9B5Y8e4wXF0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DTDZXVRN7Ia0idxc5hTBbOaGJde+B+B5WYo1CUiMDt2GMSe/vX/VJFBhlSSXcC8kv BPXxDaQlIUZGZCXPFrEU/g3+9INjJGMfhtM9vK2QhZ0xsavjGLkrmfEKtI9ooK/PF3 H3VnrkniBeBzH205vUYJogtp867OU0wa4SYPLjY0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jason Baron , Daniel Vetter , Jim Cromie , Sasha Levin Subject: [PATCH 4.14 129/210] dyndbg: let query-modname override actual module name Date: Mon, 24 Oct 2022 13:30:46 +0200 Message-Id: <20221024113001.172915017@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571245177676476?= X-GMAIL-MSGID: =?utf-8?q?1747571245177676476?= From: Jim Cromie [ Upstream commit e75ef56f74965f426dd819a41336b640ffdd8fbc ] dyndbg's control-parser: ddebug_parse_query(), requires that search terms: module, func, file, lineno, are used only once in a query; a thing cannot be named both foo and bar. The cited commit added an overriding module modname, taken from the module loader, which is authoritative. So it set query.module 1st, which disallowed its use in the query-string. But now, its useful to allow a module-load to enable classes across a whole (or part of) a subsystem at once. # enable (dynamic-debug in) drm only modprobe drm dyndbg="class DRM_UT_CORE +p" # get drm_helper too modprobe drm dyndbg="class DRM_UT_CORE module drm* +p" # get everything that knows DRM_UT_CORE modprobe drm dyndbg="class DRM_UT_CORE module * +p" # also for boot-args: drm.dyndbg="class DRM_UT_CORE module * +p" So convert the override into a default, by filling it only when/after the query-string omitted the module. NB: the query class FOO handling is forthcoming. Fixes: 8e59b5cfb9a6 dynamic_debug: add modname arg to exec_query callchain Acked-by: Jason Baron Acked-by: Daniel Vetter Signed-off-by: Jim Cromie Link: https://lore.kernel.org/r/20220904214134.408619-8-jim.cromie@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- lib/dynamic_debug.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 91c451e0f474..01591a7b151f 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -327,10 +327,6 @@ static int ddebug_parse_query(char *words[], int nwords, } memset(query, 0, sizeof(*query)); - if (modname) - /* support $modname.dyndbg= */ - query->module = modname; - for (i = 0; i < nwords; i += 2) { if (!strcmp(words[i], "func")) { rc = check_set(&query->function, words[i+1], "func"); @@ -379,6 +375,13 @@ static int ddebug_parse_query(char *words[], int nwords, if (rc) return rc; } + if (!query->module && modname) + /* + * support $modname.dyndbg=, when + * not given in the query itself + */ + query->module = modname; + vpr_info_dq(query, "parsed"); return 0; } From patchwork Mon Oct 24 11:30:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8694 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422594wru; Mon, 24 Oct 2022 05:23:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5nJR5ETdSAgCw/3QinL3IQSeQkWJBE4Cpz7zEde06lPLASAsUhYjvhK6m+LFxcZgUYnH+v X-Received: by 2002:aa7:dd45:0:b0:458:7474:1fbe with SMTP id o5-20020aa7dd45000000b0045874741fbemr30805787edw.334.1666614181475; Mon, 24 Oct 2022 05:23:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614181; cv=none; d=google.com; s=arc-20160816; b=prg2oFHoyJ3Rohy3F8SeyAK98dNwy1S6qHRRJfEnRErCfOXoWEoDqWGU7ig+E8zZlu wdq7ZOhahSkebZoR2PizyCy+tVmNTY8b1lj7Ds5Q4Tng+y7bs66FMWHIhra0eQ5Vijzv AqxoToe6lRkWJmPJ4BgE6U72cSRlr3tFMyOtD4+Fwpf2mpdL+iOUOmiNdLaWxs2T9ox4 6b0Ydk6wzTTaoyRTdgH1pAQUWZJ5sZ9OdsEC6DWze04l23tV8Mn64/ce5cj5wKgACIGJ AxhdpThltBxOLgr13Fua6ebedMuWtBpTqd77Zbk+MA8LagQZPrjLnYlEhjIaTUaefEB9 XZqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=itu0Tt8G+jkMMUauXlZ2Bt4qXBNHG5Ovltx6pgX4OUE=; b=EiumJdCC4yzEO4E1ChQgC25bWb+tdWqLVH4k72MAoGUGWFkwqyL2gs3DmTfgSnq/64 VtUW+WNSYfYWxVKx79R4WDr1S3GqBG6TjSzzO0cr8PNf526LPdTe7PXZa1H5tsbY086t uNDYUp4Wi99KyDCBKGA9fPqA/CJafS4kyPeSRne9vKUVUrUkRhzMSgKpBsJoz4RABfSI U4xx3yORqE9yl5RzbTJc+88XVBnG+xlqAQ0c5BFXEm34J0ysLnCExWv7aHEwcbikB7NR 68kaE+dQvt84f2UcknjEZjAVM6AyhNMwiHaxb9+IOErPKHDOU/jeZnAr5YaHtVuDoWVL UiMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gcMYBNzZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sh40-20020a1709076ea800b007413b206b16si27859658ejc.843.2022.10.24.05.22.36; Mon, 24 Oct 2022 05:23:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gcMYBNzZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233412AbiJXMVl (ORCPT + 99 others); Mon, 24 Oct 2022 08:21:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233495AbiJXMTk (ORCPT ); Mon, 24 Oct 2022 08:19:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D55167AB3D; Mon, 24 Oct 2022 04:58:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B18886129A; Mon, 24 Oct 2022 11:51:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5057C433C1; Mon, 24 Oct 2022 11:51:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612263; bh=0hQmG0yLukZImX36wFn80tQrPCt+zD0IZ/UYg3RA9+Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gcMYBNzZRLomqzmATpLhDN44XwFh8CocnT8Ub/iXflqY891xZcSCVPR5rR6KZOngc PttzhwjHl1Xmx3Rc+xE/3ph1PBvv7FDC7PCbh9LFK7kdT0tlM5ZV/UCGmx3DzVVpV1 DmwvlzaGXSuTf+z3X7ecx9Ov2HJrrXIqUaL66cYw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Niklas Cassel , Damien Le Moal , Sasha Levin Subject: [PATCH 4.14 130/210] ata: fix ata_id_sense_reporting_enabled() and ata_id_has_sense_reporting() Date: Mon, 24 Oct 2022 13:30:47 +0200 Message-Id: <20221024113001.208606349@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571632288504056?= X-GMAIL-MSGID: =?utf-8?q?1747571632288504056?= From: Niklas Cassel [ Upstream commit 690aa8c3ae308bc696ec8b1b357b995193927083 ] ACS-5 section 7.13.6.41 Words 85..87, 120: Commands and feature sets supported or enabled states that: If bit 15 of word 86 is set to one, bit 14 of word 119 is set to one, and bit 15 of word 119 is cleared to zero, then word 119 is valid. If bit 15 of word 86 is set to one, bit 14 of word 120 is set to one, and bit 15 of word 120 is cleared to zero, then word 120 is valid. (This text also exists in really old ACS standards, e.g. ACS-3.) Currently, ata_id_sense_reporting_enabled() and ata_id_has_sense_reporting() both check bit 15 of word 86, but neither of them check that bit 14 of word 119 is set to one, or that bit 15 of word 119 is cleared to zero. Additionally, make ata_id_sense_reporting_enabled() return false if !ata_id_has_sense_reporting(), similar to how e.g. ata_id_flush_ext_enabled() returns false if !ata_id_has_flush_ext(). Fixes: e87fd28cf9a2 ("libata: Implement support for sense data reporting") Signed-off-by: Niklas Cassel Signed-off-by: Damien Le Moal Signed-off-by: Sasha Levin --- include/linux/ata.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/include/linux/ata.h b/include/linux/ata.h index c7a353825450..90a4c166c0fa 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -784,16 +784,21 @@ static inline bool ata_id_has_read_log_dma_ext(const u16 *id) static inline bool ata_id_has_sense_reporting(const u16 *id) { - if (!(id[ATA_ID_CFS_ENABLE_2] & (1 << 15))) + if (!(id[ATA_ID_CFS_ENABLE_2] & BIT(15))) + return false; + if ((id[ATA_ID_COMMAND_SET_3] & (BIT(15) | BIT(14))) != BIT(14)) return false; - return id[ATA_ID_COMMAND_SET_3] & (1 << 6); + return id[ATA_ID_COMMAND_SET_3] & BIT(6); } static inline bool ata_id_sense_reporting_enabled(const u16 *id) { - if (!(id[ATA_ID_CFS_ENABLE_2] & (1 << 15))) + if (!ata_id_has_sense_reporting(id)) + return false; + /* ata_id_has_sense_reporting() == true, word 86 must have bit 15 set */ + if ((id[ATA_ID_COMMAND_SET_4] & (BIT(15) | BIT(14))) != BIT(14)) return false; - return id[ATA_ID_COMMAND_SET_4] & (1 << 6); + return id[ATA_ID_COMMAND_SET_4] & BIT(6); } /** From patchwork Mon Oct 24 11:30:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8609 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419799wru; Mon, 24 Oct 2022 05:16:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7CvHyywZyedgdyAkDocvi1ue2/qBf//LTQ3A3tMtEoPRjTjI1UHzEk71Y2tWs9sQzaEOD8 X-Received: by 2002:a05:6a00:1bc3:b0:562:ab5f:af2 with SMTP id o3-20020a056a001bc300b00562ab5f0af2mr33738188pfw.58.1666613819087; Mon, 24 Oct 2022 05:16:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613819; cv=none; d=google.com; s=arc-20160816; b=x6x77unjbddaxkW9pgSi96od7YJodTorDv5vOSuv80dJKIRBXPf+R8HEkxg+nNNTWJ h+xLZtXOhd6edDZ6h2ooRRsmPjRXE2IlKVH1IzaZHS0MppwZ7vcggASsW2zVCm2PUl9/ Zqw+qAiaE0M3NRcSnBKJ8uZJ1aOGT3wLFcYvnVwhMTog/L8LvuS2QnXqgZLnXkHtJjKs 83oqyaQAiI83xou+k+gplglITsYwVYaBAWb91nCEPK9gUsLZa5kpMYuc7vZ42D9EMttw u2bUmE5X0vz6lXudaZzc2/+HZFOkKU1BUUQURjxPLxUGrJStEafxJIYTyONblgvFVCzQ bCeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bLpqXTH/8JdiZsHHIoZJtYkzCnNHMsc9jPaV/ZXH32I=; b=ejv9EGY127CiB0nvY7swkWrUfWF/UJdrjAiE2/lJ6mLfK8vF8aA3tSmmTOR7GAs9iK lCVK4/6JhjqQlE2v1zZZXKn/CR6RLL8Pji+MSpnjtX6vq8HP9rRGzqS5545Ts7ct+74x 112S8GM8ZLfxqYlttXv8rNsyY43YKgxgZg1CtSIBMyax162ZWKfDyWtnNWJcZMCA+l6A RETGPwK5pOozV/KqzIPqn29nChgG7ySk2WpM8wUSGP/a6F5c/DKODDeEXAMnwBpQZTsc xGO21cY4uwFA4nMxFesfGetghodCnyljb9W/91ExvwkCB7gMB1hN+6XgVKA+O5iXc+m+ 2XIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PsMPEJVr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c3-20020a170902d48300b00186a592183fsi4210050plg.365.2022.10.24.05.16.46; Mon, 24 Oct 2022 05:16:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PsMPEJVr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232740AbiJXMKP (ORCPT + 99 others); Mon, 24 Oct 2022 08:10:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232735AbiJXMIw (ORCPT ); Mon, 24 Oct 2022 08:08:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8E7A7E812; Mon, 24 Oct 2022 04:52:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1A6F3B811A5; Mon, 24 Oct 2022 11:51:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68B3DC433D6; Mon, 24 Oct 2022 11:51:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612265; bh=XoV/HGYuQ9mhk0KvT/OiLA1uLDSd1NUz6zNz71T1NOA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PsMPEJVrhCtPqEa+EUbCH9+8Mf66huYhYPcUYAwd3MsiysuUoGymoI0X/B6Osckql ZupcGQfUt6j5kApAgM4ci0tzF1abDZ4v/6O1tXBn2vedlmi5K2+FtEhr594r550OU/ Te5hjeMDO3xFtWIeiUuTgzFekYqPGkY3NTnjta2s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Niklas Cassel , Damien Le Moal , Sasha Levin Subject: [PATCH 4.14 131/210] ata: fix ata_id_has_devslp() Date: Mon, 24 Oct 2022 13:30:48 +0200 Message-Id: <20221024113001.238323526@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571252126174124?= X-GMAIL-MSGID: =?utf-8?q?1747571252126174124?= From: Niklas Cassel [ Upstream commit 9c6e09a434e1317e09b78b3b69cd384022ec9a03 ] ACS-5 section 7.13.6.36 Word 78: Serial ATA features supported states that: If word 76 is not 0000h or FFFFh, word 78 reports the features supported by the device. If this word is not supported, the word shall be cleared to zero. (This text also exists in really old ACS standards, e.g. ACS-3.) Additionally, move the macro to the other ATA_ID_FEATURE_SUPP macros (which already have this check), thus making it more likely that the next ATA_ID_FEATURE_SUPP macro that is added will include this check. Fixes: 65fe1f0f66a5 ("ahci: implement aggressive SATA device sleep support") Signed-off-by: Niklas Cassel Signed-off-by: Damien Le Moal Signed-off-by: Sasha Levin --- include/linux/ata.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/linux/ata.h b/include/linux/ata.h index 90a4c166c0fa..c2beacc9e522 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -579,6 +579,10 @@ struct ata_bmdma_prd { ((((id)[ATA_ID_SATA_CAPABILITY] != 0x0000) && \ ((id)[ATA_ID_SATA_CAPABILITY] != 0xffff)) && \ ((id)[ATA_ID_FEATURE_SUPP] & (1 << 2))) +#define ata_id_has_devslp(id) \ + ((((id)[ATA_ID_SATA_CAPABILITY] != 0x0000) && \ + ((id)[ATA_ID_SATA_CAPABILITY] != 0xffff)) && \ + ((id)[ATA_ID_FEATURE_SUPP] & (1 << 8))) #define ata_id_iordy_disable(id) ((id)[ATA_ID_CAPABILITY] & (1 << 10)) #define ata_id_has_iordy(id) ((id)[ATA_ID_CAPABILITY] & (1 << 11)) #define ata_id_u32(id,n) \ @@ -591,7 +595,6 @@ struct ata_bmdma_prd { #define ata_id_cdb_intr(id) (((id)[ATA_ID_CONFIG] & 0x60) == 0x20) #define ata_id_has_da(id) ((id)[ATA_ID_SATA_CAPABILITY_2] & (1 << 4)) -#define ata_id_has_devslp(id) ((id)[ATA_ID_FEATURE_SUPP] & (1 << 8)) #define ata_id_has_ncq_autosense(id) \ ((id)[ATA_ID_FEATURE_SUPP] & (1 << 7)) From patchwork Mon Oct 24 11:30:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8803 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430914wru; Mon, 24 Oct 2022 05:42:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7cL7nDJbfsuyLrUSXlcGVDbSTzyiLLN/z5SfkkgW9exCGwA9ueP0zqmNJ/O3FYSgrgX6Jq X-Received: by 2002:a17:90a:fe6:b0:212:bfc3:31f5 with SMTP id 93-20020a17090a0fe600b00212bfc331f5mr23997989pjz.215.1666615351459; Mon, 24 Oct 2022 05:42:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615351; cv=none; d=google.com; s=arc-20160816; b=jB+NWirynQoA2NYf4RA1Z/bHocBI6rrxU3WBGLG/eEQ7nLzrJcyjnq+J+8Cxprb7le MDr/buRlNtv7Cxaz+/KxsAQdMNAImeg+eZDPFv1qnhC1BCDR6IJSLlvZy8hfan71c7ZZ F9OJNEydiBXKDz+3sUwJZ5G0t1BbjPqPOyUlvDM1dA4msO6QuHJx5QRrRga9z1o9ExsY oWjIMouuvrR/XonB8wMT3GOJzSgLwkUXaV5whaZtf6epHNxJ4jypNVEAicRnbifRvbKb OntjxUP1qa18aK/ZFrdGbfZxX/qcuFABZgeJbgZfviuDQ1i6ZLvpdSepItAWxJP62j/H 6nQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4UwYpnG62vg8GRnuQckq3GkN06hKul0rE+6bpRvbKKE=; b=fAl5YNPAdj8PkZMUmkjZUE7lg8XMnxaScH0dcG/4bNGF44v7nhu26as3Xccjb+UDMx 6dxqxrH2IiECgCBJyH1oC1Qto4tW+m4bGWD4dRSVoGiyCnrovfPA/xr7B0FCMyuRVjKh efy1WnRCBUXE5rmbDktv72/U+nZlzeH1sp2wn5R69A1YLPX8gKzrLmhqmIqTcASykGoN uARq8ihGDHujkNIgHvIvFovsuCtivQVdacAbDx+oev63lkzqwMDSUqa7hzzq4BdFFiF5 k/eg5UipZCvmsh7yaOpD13W6EsdYshAHhxz4H0KDHCG5LEfgYnZ6iUSf2UTS17pxZ+aF Oq5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=o+qSPsNO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k30-20020a63ff1e000000b004600ab82237si35201634pgi.293.2022.10.24.05.42.18; Mon, 24 Oct 2022 05:42:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=o+qSPsNO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234289AbiJXMen (ORCPT + 99 others); Mon, 24 Oct 2022 08:34:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234206AbiJXM3i (ORCPT ); Mon, 24 Oct 2022 08:29:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86197FF2; Mon, 24 Oct 2022 05:03:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F3248612CA; Mon, 24 Oct 2022 11:51:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12CACC4314D; Mon, 24 Oct 2022 11:51:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612268; bh=/AwGkdnNk5NaqZP67LHlYM5+TteTg5wF/F0cltxUsYg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o+qSPsNOk1yYFv1HLjkQmczRusBfw8palr7oGgGlq0oz5Vyc8OaSUnWnKdE8a2Y2j 843eNq89gQTkFcpfD+8NxPbvYkU+Ga23Izv5tHEb2O+0Rhh9fWKWsaAGnGpBK9fxBy S5m6Ut6rE4sx+b2LwmgIvlj3sRbSFI9MQIhcfoUw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Niklas Cassel , Damien Le Moal , Sasha Levin Subject: [PATCH 4.14 132/210] ata: fix ata_id_has_ncq_autosense() Date: Mon, 24 Oct 2022 13:30:49 +0200 Message-Id: <20221024113001.278988772@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572858736281771?= X-GMAIL-MSGID: =?utf-8?q?1747572858736281771?= From: Niklas Cassel [ Upstream commit a5fb6bf853148974dbde092ec1bde553bea5e49f ] ACS-5 section 7.13.6.36 Word 78: Serial ATA features supported states that: If word 76 is not 0000h or FFFFh, word 78 reports the features supported by the device. If this word is not supported, the word shall be cleared to zero. (This text also exists in really old ACS standards, e.g. ACS-3.) Additionally, move the macro to the other ATA_ID_FEATURE_SUPP macros (which already have this check), thus making it more likely that the next ATA_ID_FEATURE_SUPP macro that is added will include this check. Fixes: 5b01e4b9efa0 ("libata: Implement NCQ autosense") Signed-off-by: Niklas Cassel Signed-off-by: Damien Le Moal Signed-off-by: Sasha Levin --- include/linux/ata.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/linux/ata.h b/include/linux/ata.h index c2beacc9e522..641545929efb 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -583,6 +583,10 @@ struct ata_bmdma_prd { ((((id)[ATA_ID_SATA_CAPABILITY] != 0x0000) && \ ((id)[ATA_ID_SATA_CAPABILITY] != 0xffff)) && \ ((id)[ATA_ID_FEATURE_SUPP] & (1 << 8))) +#define ata_id_has_ncq_autosense(id) \ + ((((id)[ATA_ID_SATA_CAPABILITY] != 0x0000) && \ + ((id)[ATA_ID_SATA_CAPABILITY] != 0xffff)) && \ + ((id)[ATA_ID_FEATURE_SUPP] & (1 << 7))) #define ata_id_iordy_disable(id) ((id)[ATA_ID_CAPABILITY] & (1 << 10)) #define ata_id_has_iordy(id) ((id)[ATA_ID_CAPABILITY] & (1 << 11)) #define ata_id_u32(id,n) \ @@ -595,8 +599,6 @@ struct ata_bmdma_prd { #define ata_id_cdb_intr(id) (((id)[ATA_ID_CONFIG] & 0x60) == 0x20) #define ata_id_has_da(id) ((id)[ATA_ID_SATA_CAPABILITY_2] & (1 << 4)) -#define ata_id_has_ncq_autosense(id) \ - ((id)[ATA_ID_FEATURE_SUPP] & (1 << 7)) static inline bool ata_id_has_hipm(const u16 *id) { From patchwork Mon Oct 24 11:30:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9007 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp440578wru; Mon, 24 Oct 2022 06:04:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4StmrJ8YHmE0aWQPnngAZEZh+zcc2xYjSlZgGkWi9s5bK/6QrqKCgVA4v4RdvWynqxC+l0 X-Received: by 2002:a05:6a00:a96:b0:558:8915:2f0e with SMTP id b22-20020a056a000a9600b0055889152f0emr33393745pfl.38.1666616669182; Mon, 24 Oct 2022 06:04:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616669; cv=none; d=google.com; s=arc-20160816; b=J+YQ86+C82qv75n2FXIIVQp0p5Djg6j51S7Lc0s6M966VW5819+szgOG10yvKYpr4L 0jmslsXuFWmw0AQhq2leCe0bCWKA53jt02RVFd0kXufxzR3WZM99zHo5a9ToKUpTgf1i Qfhqoj3qunD3hFqNOgSwL7uSiFA7A8Jf9skp8RFPtc3+hjMxiWUPDh/LoFGPzc8V2fWz xHuNf6qas+69B2KdwuLO/kcwlCSvHdirJ68vUBfbEoPMDliH6+PUf9eaYG+Rn5b8lhnq mk0/pQIRZOGf0w18+yocchqo/p9JVlh3ZK4W2yKPTiSEyX68nZuM3hrXvciO0qxO2UsF fvnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vWKsqQrWUPTNUa58o6p40V9PothRCJuKJSNoOrVEY6s=; b=i/znuBuZMxeWoK3K2dpmdbyjPuDMb8CZI6wcf0nt5+7xQfJkd7RTWCHhpyoQbdGEI9 zykDdX+SEqu2R420ph3XOQbvbbKdD3NQGOXZkWO3dDvAClgjEmDgDIYzqPMmlFTX3iE5 9UX/s7Cgw1XmrMBv3rr7XSinbu5OgQ3/1OPfa1G/snGcTJ/HJoUojdBVaVh2kJearLgw ETbdgbdvZsXIXRZiqLQHxgVEVDytqW6ZLAQnMf4ypBjvElHkYyUWBVSLe+7QWaaTGNGf UKvt/0VStF6EEKB+EHF1BZTiuIPs84iIttiO4/+7q2CeYBS51Y0NW7NIV1z2FoIz/kT7 nkZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D1dQqW7U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c17-20020a637251000000b004344b581925si32891558pgn.879.2022.10.24.06.03.48; Mon, 24 Oct 2022 06:04:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D1dQqW7U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235139AbiJXNDT (ORCPT + 99 others); Mon, 24 Oct 2022 09:03:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235259AbiJXM7q (ORCPT ); Mon, 24 Oct 2022 08:59:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B87519AF87; Mon, 24 Oct 2022 05:19:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 22A97612A8; Mon, 24 Oct 2022 11:52:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39D23C433C1; Mon, 24 Oct 2022 11:52:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612373; bh=RFao88qSCGW1ebX6z+ZZ3tOEc8Bf9Cja4HoXA8uecJw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D1dQqW7U+afV4AWAynKAwNZZzJu9ZUlVkbJoqurmqtbdG+AmJoDlUJcVS/cE3bmce 4dU0kDzWn5XQMW3CRwHV9pjSBzNI+0zvki7ArhiBE+Ut7Ew6sU16WJFshOUyGuT4AV i33FFFxHjcUvEYqdotI9MMEXmfrPWahLcQpuddhQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Niklas Cassel , Damien Le Moal , Sasha Levin Subject: [PATCH 4.14 133/210] ata: fix ata_id_has_dipm() Date: Mon, 24 Oct 2022 13:30:50 +0200 Message-Id: <20221024113001.309825240@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574240474376224?= X-GMAIL-MSGID: =?utf-8?q?1747574240474376224?= From: Niklas Cassel [ Upstream commit 630624cb1b5826d753ac8e01a0e42de43d66dedf ] ACS-5 section 7.13.6.36 Word 78: Serial ATA features supported states that: If word 76 is not 0000h or FFFFh, word 78 reports the features supported by the device. If this word is not supported, the word shall be cleared to zero. (This text also exists in really old ACS standards, e.g. ACS-3.) The problem with ata_id_has_dipm() is that the while it performs a check against 0 and 0xffff, it performs the check against ATA_ID_FEATURE_SUPP (word 78), the same word where the feature bit is stored. Fix this by performing the check against ATA_ID_SATA_CAPABILITY (word 76), like required by the spec. The feature bit check itself is of course still performed against ATA_ID_FEATURE_SUPP (word 78). Additionally, move the macro to the other ATA_ID_FEATURE_SUPP macros (which already have this check), thus making it more likely that the next ATA_ID_FEATURE_SUPP macro that is added will include this check. Fixes: ca77329fb713 ("[libata] Link power management infrastructure") Signed-off-by: Niklas Cassel Signed-off-by: Damien Le Moal Signed-off-by: Sasha Levin --- include/linux/ata.h | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/include/linux/ata.h b/include/linux/ata.h index 641545929efb..af884beac08d 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -587,6 +587,10 @@ struct ata_bmdma_prd { ((((id)[ATA_ID_SATA_CAPABILITY] != 0x0000) && \ ((id)[ATA_ID_SATA_CAPABILITY] != 0xffff)) && \ ((id)[ATA_ID_FEATURE_SUPP] & (1 << 7))) +#define ata_id_has_dipm(id) \ + ((((id)[ATA_ID_SATA_CAPABILITY] != 0x0000) && \ + ((id)[ATA_ID_SATA_CAPABILITY] != 0xffff)) && \ + ((id)[ATA_ID_FEATURE_SUPP] & (1 << 3))) #define ata_id_iordy_disable(id) ((id)[ATA_ID_CAPABILITY] & (1 << 10)) #define ata_id_has_iordy(id) ((id)[ATA_ID_CAPABILITY] & (1 << 11)) #define ata_id_u32(id,n) \ @@ -610,17 +614,6 @@ static inline bool ata_id_has_hipm(const u16 *id) return val & (1 << 9); } -static inline bool ata_id_has_dipm(const u16 *id) -{ - u16 val = id[ATA_ID_FEATURE_SUPP]; - - if (val == 0 || val == 0xffff) - return false; - - return val & (1 << 3); -} - - static inline bool ata_id_has_fua(const u16 *id) { if ((id[ATA_ID_CFSSE] & 0xC000) != 0x4000) From patchwork Mon Oct 24 11:30:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9563 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp527114wru; Mon, 24 Oct 2022 09:00:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7vBkxPacR8jCiuCaeY02xGZrBgiTgHMmr/YXhnMSRIbE7u3N/d5b4g2SCzGvSaAdct1gjc X-Received: by 2002:a17:906:9b92:b0:791:9355:cb89 with SMTP id dd18-20020a1709069b9200b007919355cb89mr27642799ejc.498.1666627221301; Mon, 24 Oct 2022 09:00:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627221; cv=none; d=google.com; s=arc-20160816; b=njf0+gq74OW+m2aCr43qz2LSTwHt0ggvUyZcJyu52kNqqAUCBmz6xxQHioJhm5CCSG aA5fEuPj16/7fhGgfg3nQkbeVXDZcOBFB1UwpoCeMdyLcOH8SmJdslD1lVZUy/n2weVX ufn5KqHNyJJgfoI9ajdHdgwAO/vAAUyv9Cu2/1gQi+ewP18b0w0nnY6JneUvuc1hyKF/ scqphuOHE8ecwIdBa7tV9Xx5S9d4fGGgbwKdKhfsYCnMDXFNv8FdXbAG1K0MeTVP41iR +UMC4Rn6zu5IVZihrUVTZT5Jjm9sRMSBnzv76lC25g8qjC0hj3NNMyXJndgnIzfdvXJE JlDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=g8AqR1Nw+RvNflhPsHCN++X0+lJPVp0xXa6CcPt3F0Q=; b=tn860szuPv1ezgI5V5sWXsmwrRdO05ccP5K2VfrQlrn2Sw5zcTOEhnxrReA46ol2w4 X+2Bb2mBzIX5XPRtjsxo3xrrngLw63DUZtS3jqYOwDjZ8z+2wJAT/yy+KZpV0ncvaQoD +TUgC+R2JGiA4M3SbfXf9kGvbHjnOtLpc5bU2pppu0v/5pEgcPdZT5WnfVLwyQd+DEfi hUQ/pA/gycPls38J4ceoey5tI1pIj+f9jx0yF1s4yvCE4VRjeDsd/hazHiJ2zx/+OpI2 G8z9ELl0+wXRu0TF1j21jtsii4lylIA9LyA3uuyhPQZwd94x4Kp60b8RudAViTguivPy EpDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QO1uyp6h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ds1-20020a170907724100b007ab1b8b719csi178506ejc.0.2022.10.24.08.59.50; Mon, 24 Oct 2022 09:00:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QO1uyp6h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231295AbiJXPxK (ORCPT + 99 others); Mon, 24 Oct 2022 11:53:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231797AbiJXPwx (ORCPT ); Mon, 24 Oct 2022 11:52:53 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7D63CE5; Mon, 24 Oct 2022 07:47:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 3A058CE1353; Mon, 24 Oct 2022 11:51:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D1D6C433D6; Mon, 24 Oct 2022 11:51:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612289; bh=ipcBAw3C0ZMweEZtqlR6OMDjjvMZt6qpdLB5DJIjctM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QO1uyp6hkd5Vxvygs73CskbEBSS3DwlprNK+OtbwexxHFAN0IYc2CH+i2aQrd0e0F mGBZRmIG1hxS/EvWnOjdknVpKws3XCr48PPbi3Hr7qPkNEECUm4+o+cUiv0ccltpKE 5yu+HdWiBLms+Pmg8vWG1XCzMEEXKOXWhUMRmaOs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Song Liu , Logan Gunthorpe , Sasha Levin Subject: [PATCH 4.14 134/210] md/raid5: Ensure stripe_fill happens on non-read IO with journal Date: Mon, 24 Oct 2022 13:30:51 +0200 Message-Id: <20221024113001.347618087@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747585305354282267?= X-GMAIL-MSGID: =?utf-8?q?1747585305354282267?= From: Logan Gunthorpe [ Upstream commit e2eed85bc75138a9eeb63863d20f8904ac42a577 ] When doing degrade/recover tests using the journal a kernel BUG is hit at drivers/md/raid5.c:4381 in handle_parity_checks5(): BUG_ON(!test_bit(R5_UPTODATE, &dev->flags)); This was found to occur because handle_stripe_fill() was skipped for stripes in the journal due to a condition in that function. Thus blocks were not fetched and R5_UPTODATE was not set when the code reached handle_parity_checks5(). To fix this, don't skip handle_stripe_fill() unless the stripe is for read. Fixes: 07e83364845e ("md/r5cache: shift complex rmw from read path to write path") Link: https://lore.kernel.org/linux-raid/e05c4239-41a9-d2f7-3cfa-4aa9d2cea8c1@deltatee.com/ Suggested-by: Song Liu Signed-off-by: Logan Gunthorpe Signed-off-by: Song Liu Signed-off-by: Sasha Levin --- drivers/md/raid5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 866ba1743f9f..78b48dca3fda 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -3720,7 +3720,7 @@ static void handle_stripe_fill(struct stripe_head *sh, * back cache (prexor with orig_page, and then xor with * page) in the read path */ - if (s->injournal && s->failed) { + if (s->to_read && s->injournal && s->failed) { if (test_bit(STRIPE_R5C_CACHING, &sh->state)) r5c_make_stripe_write_out(sh); goto out; From patchwork Mon Oct 24 11:30:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8617 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp420142wru; Mon, 24 Oct 2022 05:17:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Txv39eC4XGKDnLXKiieVXPQLMCPr+ueCxsiLlfraCsdloK8vrmr3sVRns5VsndsQr2Ech X-Received: by 2002:a17:907:b15:b0:7a7:19a3:e9e7 with SMTP id h21-20020a1709070b1500b007a719a3e9e7mr4759162ejl.361.1666613859109; Mon, 24 Oct 2022 05:17:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613859; cv=none; d=google.com; s=arc-20160816; b=fiTHJ8Ah4/q51oyOo/CZY3D0Ftc+LM4QtDpin7q0u6yP+0ugvOqOWsn2GtdusfVF3T vd4G9+B60R/Sz0Z91E6Mmuu+c00MRCeyBojJdaObBhg03upCW4AO/9drbwLDmTb9MBcp wMqi9qi7tJUgci6XPUiW1eZBXggszI0m7ZTdUwMaKoVfI1HhQpgX05q/Z3PK2vbBuIes vopa3t7DFqCpa0dLzUNrpl2uUSr3XAsbKtBQMlz3NyQqGBCU148IA11xlJCio/SRoMX9 D93GychNXT0H+kCPag99aEHW7BYSa6K3ei+reRKk3Olk3yTC4KzZrQRJ41C1//zHZEZH iVEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7QoW3QoR7NaOlZSqC2NtiT6NuB51Yf5Y5Ar3bpXJPrU=; b=Mn3J6/eSuWztks+ow/2aApNqFkOg8NVUVuQ4Ao4CUnt1V4H8EO5q2t9L1gdkHEvYE5 LfIZEULaEED44pzSpCqJ2M2vy+xA+wygcx2EXhYOSG3qkRz1b6lWccw9Zpz83yhBSbM1 qugp0eJ5seIXKz5xDpoGCPoKT/KtSvxFdclhxYmoL88KysSOuoTue06RG53tupipgzZo hh/e5jj0l//gHerw+70MR78xSzF/e9rTZCHn2sQF8IKIGd4GNkeR5apeGX6scUXp71b+ eHRz9GG3CAmU989dYsZU8Ju/6/ctggg3DFt8/FAjqiL+GNe317jJf5ZjT9f4xHfsjPZK WV1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BETrhagQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l8-20020a170906644800b0078315844537si25009799ejn.378.2022.10.24.05.17.15; Mon, 24 Oct 2022 05:17:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BETrhagQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232855AbiJXMLW (ORCPT + 99 others); Mon, 24 Oct 2022 08:11:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233207AbiJXMJ5 (ORCPT ); Mon, 24 Oct 2022 08:09:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E3597FE45; Mon, 24 Oct 2022 04:53:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 00F5FB811BE; Mon, 24 Oct 2022 11:52:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 522B4C433C1; Mon, 24 Oct 2022 11:51:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612318; bh=wK+jnoO9VRmlYg/cydAggE/JknkiKXKsyEkHJKl9iJ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BETrhagQvKOmBCokw12nWP2tV4Yj6/MD5nqS2EPbMKkKx22vvRmg1pbbvX4IMvuY0 8FOperXki7Swz9ydPlVt4Ax74M18mKy+7kgkMOqIlkIRr0o9okPgU6OGVdtwl+2I4q JKWaw7jCvXoKbVPZLqjoRAlL2lkpxe6fM0wRv0wg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Artem S. Tashkinov" , Mario Limonciello , Mathias Nyman , Sasha Levin Subject: [PATCH 4.14 135/210] xhci: Dont show warning for reinit on known broken suspend Date: Mon, 24 Oct 2022 13:30:52 +0200 Message-Id: <20221024113001.377705871@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571293899601468?= X-GMAIL-MSGID: =?utf-8?q?1747571293899601468?= From: Mario Limonciello [ Upstream commit 484d6f7aa3283d082c87654b7fe7a7f725423dfb ] commit 8b328f8002bc ("xhci: re-initialize the HC during resume if HCE was set") introduced a new warning message when the host controller error was set and re-initializing. This is expected behavior on some designs which already set `xhci->broken_suspend` so the new warning is alarming to some users. Modify the code to only show the warning if this was a surprising behavior to the XHCI driver. Link: https://bugzilla.kernel.org/show_bug.cgi?id=216470 Fixes: 8b328f8002bc ("xhci: re-initialize the HC during resume if HCE was set") Reported-by: Artem S. Tashkinov Signed-off-by: Mario Limonciello Signed-off-by: Mathias Nyman Link: https://lore.kernel.org/r/20220921123450.671459-4-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/host/xhci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index c41548f08c54..0f2b67f38d2e 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -1094,7 +1094,8 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) /* re-initialize the HC on Restore Error, or Host Controller Error */ if (temp & (STS_SRE | STS_HCE)) { reinit_xhc = true; - xhci_warn(xhci, "xHC error in resume, USBSTS 0x%x, Reinit\n", temp); + if (!xhci->broken_suspend) + xhci_warn(xhci, "xHC error in resume, USBSTS 0x%x, Reinit\n", temp); } if (reinit_xhc) { From patchwork Mon Oct 24 11:30:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8795 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430845wru; Mon, 24 Oct 2022 05:42:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5uzKOZ/WaoID1S0hWf/l0CXGsnakjqMst86m8mjPjyh+MG3YYlgOXKzOqGNF3U6AmnNhzK X-Received: by 2002:a05:6402:2546:b0:45d:8bff:7afc with SMTP id l6-20020a056402254600b0045d8bff7afcmr29971571edb.302.1666615341885; Mon, 24 Oct 2022 05:42:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615341; cv=none; d=google.com; s=arc-20160816; b=P5/6i8pTqpn+jVgvo3BDTiV1ZmJWMVORrGxj9ef5J1K3DHLS8J/LjZx8TFzo0dZhPH s2mY97DX3NHtEUWftmwqnqPPlsyC6mWDISIEJZxwe+zMs59ZrtnvYvVAwjVcUuPpPS27 gIYZ0u+2sAR3SFe0sHSlIDt8A0ybs4uuZ4Nh90TmPKwD6DLL5FG0MHy6V6JEssB7Yr6R hVZPJ5BJrkUfYnIZPlrV073M4578C/l12MM6GtQ6SBUs9BK9EHrYcwQXoTUTfkWndxrG srPTJqzU20Bz6X64Nkx/EPQrtHSDpfY8n0Homl5yDDvEILZgwkoz5K4Nh43/Mc0FVtzf etTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=w6fxF3kj07rkezi/3Aw018UQjQUM+52S43iTzjsh7wQ=; b=pSEuyCRDeySDpqHufwwOQ0HjBEcbQgrI4egbILqCbk0p2qJGVq8ACdIXK3PhJOhfo4 oxRVO1zamagI13Boaz00HNOPSp4JKm7BYyFN4uarIOOBZ3jAUCDpWC7EBe3V3dj6ingA Ug4BzcJfoK0xNNGFksl/GiTDZgdwE/fPKO4i6nAphimndx0HwyB/LmfYUtTvazt5pjlo TkD06+BHdHTFAINEAahpR/EGI9n7lEFeUCNXiExYdCGe5rETQTOerqc2YioWL9ZELntQ uuxm5n54QSr1I+V5Iarmd3ErWmZYyl5sF/qBps17iQGwyi5KKL4qYdOUebFtV3N1D+ST CFDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bejunlF9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id du12-20020a17090772cc00b007aa3373e7fesi1053931ejc.520.2022.10.24.05.41.56; Mon, 24 Oct 2022 05:42:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bejunlF9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231965AbiJXMdI (ORCPT + 99 others); Mon, 24 Oct 2022 08:33:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234050AbiJXM3P (ORCPT ); Mon, 24 Oct 2022 08:29:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B4E587FBA; Mon, 24 Oct 2022 05:03:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 26989612D4; Mon, 24 Oct 2022 11:52:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36CEAC433C1; Mon, 24 Oct 2022 11:52:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612347; bh=WuQ+a24g+3pSZIPtjL7lLPfmIo0ARrrOYfngw46IVJA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bejunlF9N+hDU0wO5wuZL0rBH8wqvpFWJVgGl2K5u/qZaCHTB69KzX4CT8d4qa6Xj rmi5vM/DGb2BQsj+kgiSJHr4XY0oxvDxyPUz2kwGE+UvwM03h+Bp55MEFBKD60rfyv S0HLQBQebMNAtG2hSEAYeLTOKZwtd2gD7lSg+lWA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Albert Briscoe , Sasha Levin Subject: [PATCH 4.14 136/210] usb: gadget: function: fix dangling pnp_string in f_printer.c Date: Mon, 24 Oct 2022 13:30:53 +0200 Message-Id: <20221024113001.407237479@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572848820799356?= X-GMAIL-MSGID: =?utf-8?q?1747572848820799356?= From: Albert Briscoe [ Upstream commit 24b7ba2f88e04800b54d462f376512e8c41b8a3c ] When opts->pnp_string is changed with configfs, new memory is allocated for the string. It does not, however, update dev->pnp_string, even though the memory is freed. When rquesting the string, the host then gets old or corrupted data rather than the new string. The ieee 1284 id string should be allowed to change while the device is connected. The bug was introduced in commit fdc01cc286be ("usb: gadget: printer: Remove pnp_string static buffer"), which changed opts->pnp_string from a char[] to a char*. This patch changes dev->pnp_string from a char* to a char** pointing to opts->pnp_string. Fixes: fdc01cc286be ("usb: gadget: printer: Remove pnp_string static buffer") Signed-off-by: Albert Briscoe Link: https://lore.kernel.org/r/20220911223753.20417-1-albertsbriscoe@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/gadget/function/f_printer.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/usb/gadget/function/f_printer.c b/drivers/usb/gadget/function/f_printer.c index 4e0afeabe8b8..830cc2bb0fdf 100644 --- a/drivers/usb/gadget/function/f_printer.c +++ b/drivers/usb/gadget/function/f_printer.c @@ -91,7 +91,7 @@ struct printer_dev { u8 printer_cdev_open; wait_queue_head_t wait; unsigned q_len; - char *pnp_string; /* We don't own memory! */ + char **pnp_string; /* We don't own memory! */ struct usb_function function; }; @@ -967,16 +967,16 @@ static int printer_func_setup(struct usb_function *f, if ((wIndex>>8) != dev->interface) break; - if (!dev->pnp_string) { + if (!*dev->pnp_string) { value = 0; break; } - value = strlen(dev->pnp_string); + value = strlen(*dev->pnp_string); buf[0] = (value >> 8) & 0xFF; buf[1] = value & 0xFF; - memcpy(buf + 2, dev->pnp_string, value); + memcpy(buf + 2, *dev->pnp_string, value); DBG(dev, "1284 PNP String: %x %s\n", value, - dev->pnp_string); + *dev->pnp_string); break; case GET_PORT_STATUS: /* Get Port Status */ @@ -1439,7 +1439,7 @@ static struct usb_function *gprinter_alloc(struct usb_function_instance *fi) kref_init(&dev->kref); ++opts->refcnt; dev->minor = opts->minor; - dev->pnp_string = opts->pnp_string; + dev->pnp_string = &opts->pnp_string; dev->q_len = opts->q_len; mutex_unlock(&opts->lock); From patchwork Mon Oct 24 11:30:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9998 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp616003wru; Mon, 24 Oct 2022 12:27:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7fxV74evAyx/sDCcJMkBel/PWOz253eUEf5m6AFvu9tea76Qa8sxMMb6lm+Pk7F4XXY0Is X-Received: by 2002:a17:907:608f:b0:78e:1b60:60e2 with SMTP id ht15-20020a170907608f00b0078e1b6060e2mr29474266ejc.382.1666639668099; Mon, 24 Oct 2022 12:27:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666639668; cv=none; d=google.com; s=arc-20160816; b=H6BzzqYdjLWGz86bomkQx9ncDt7WixMPxPescYTd0UUxVjpmYBkYibi2XiLn/hJBnZ FFNVQ0ifOo4/1Mt5OBoMpwyidaBaSpu1CbXlC/cmj9HHMPeYZIvv/doNUIinEGa0ve83 k6rxsM8Ny5QoDrEXJyHZIw84nBBR4LNSmArK7Szi+HTMQ9wKIj3Fz2uWohOhFrAeZ4L8 FxjoT0YgPMtacVHHvFWlwHLaq1t+BekNvtdk5mk0LiFX3b/u8HR0Ncb4Ivq2amLXeqAf cSnWpUSHZvf1C1Y8sLIWmrLxKo/tOJ1ZJQaBRdkdN8X7vU7mj4f22bHns2SXzPMICLUH gdow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+Fi8FhAU0orUc6ufel01lVEdyKb/FbFd4Pkx9FjxR/k=; b=nhRWYN9tUc0X/a/cF9d/L+A0bnsigmN+vyyvkoOea8wle6CHzigyF2x82lNTPVysBw SManEmH/EOwBqzCBNwyi+eSYa+Qjo021fDPQ95aa76OKNesudqPRx7Ngra0eEnZYHBV1 Co5IExzCFlHa8IMAT8/uc4iDKqUObdVjenJ9svI3KnhLD8SHSwah8QTrYOjZe38Z72xV sRO1uZvs22LMiXPw1abRLH0Hm6cZdpAU14Bmkuo03WJzgZiDlvxzUXI8+BxuJxTkeV6t HSFgsWusHw+uTFWEsJLgLcldSQEnqSg9kVMj4VefrEIsMjTkhoM/xjlM7um1Y2lC2KMo EunQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hKb00Z9C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l10-20020a056402254a00b0046150eb704csi582962edb.532.2022.10.24.12.27.24; Mon, 24 Oct 2022 12:27:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hKb00Z9C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232676AbiJXTZ5 (ORCPT + 99 others); Mon, 24 Oct 2022 15:25:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233375AbiJXTYO (ORCPT ); Mon, 24 Oct 2022 15:24:14 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EB2650068; Mon, 24 Oct 2022 10:58:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 7E4DECE1354; Mon, 24 Oct 2022 11:52:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95766C433C1; Mon, 24 Oct 2022 11:52:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612357; bh=O58E1AyVjyogFsMTYnODPtbKaiCqX9nWLSX/gDKhIGE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hKb00Z9Cp3JHDX0of6vQVnIO/WEUXub57KaW4nqhDQAEJ55O3+GNIO4LFbkBuySvt 0ZEsgj1CBmha6p8KHz/4rPsAsvf9YR0zCPmhdOElUr1zq8UcxBg+tlhryhX0BjLaIn 4AZOX5j1tVnE97xF5+dTzTh09dJreb6hTwDm3wdY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Sasha Levin Subject: [PATCH 4.14 137/210] drivers: serial: jsm: fix some leaks in probe Date: Mon, 24 Oct 2022 13:30:54 +0200 Message-Id: <20221024113001.439764275@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747598356606884453?= X-GMAIL-MSGID: =?utf-8?q?1747598356606884453?= From: Dan Carpenter [ Upstream commit 1d5859ef229e381f4db38dce8ed58e4bf862006b ] This error path needs to unwind instead of just returning directly. Fixes: 03a8482c17dd ("drivers: serial: jsm: Enable support for Digi Classic adapters") Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/YyxFh1+lOeZ9WfKO@kili Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/jsm/jsm_driver.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/jsm/jsm_driver.c b/drivers/tty/serial/jsm/jsm_driver.c index 102d499814ac..bd4efbbb7073 100644 --- a/drivers/tty/serial/jsm/jsm_driver.c +++ b/drivers/tty/serial/jsm/jsm_driver.c @@ -221,7 +221,8 @@ static int jsm_probe_one(struct pci_dev *pdev, const struct pci_device_id *ent) break; default: - return -ENXIO; + rc = -ENXIO; + goto out_kfree_brd; } rc = request_irq(brd->irq, brd->bd_ops->intr, IRQF_SHARED, "JSM", brd); From patchwork Mon Oct 24 11:30:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8901 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433942wru; Mon, 24 Oct 2022 05:50:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4k2bs4vRJVyMjnYyez1Dgl1ANhV6dehH4iHEhbYAbakj8fkgJtv9jZuUwdqKnbEnjq59aC X-Received: by 2002:a05:6402:144a:b0:461:8e34:d07b with SMTP id d10-20020a056402144a00b004618e34d07bmr9607337edx.426.1666615856938; Mon, 24 Oct 2022 05:50:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615856; cv=none; d=google.com; s=arc-20160816; b=Vl1n8IR2kAPiG8TW+2OhnxN1m6r/79z80Fz/GK3PGb25x1mwgwIQej7XwnGGj8ZMiQ a6hx5KpFFZL2y9QFywId4WFn8v4Uso1zViMM196Pko6mw8xjmKjXu72T4ycWcYjyPN1M tiwxh7FKoDl7VgbuThU6tVx5KYuzEK6daaDq5ASTSg+WA67aCpXrXgEwU2zRSNjz+lVg uMBPCdOGphDel0VluyXDjFtIYBSqzHBBFIBSh81peq+atNiutOje+FtI70YRxCHKLOHB 2qEenreunvpUGFG4hATRbwZJxIaD3zOqS5Gqs1Kpf4jCsNmKAc+4t3lKgX+FPHerk7bc 1thw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nqQ4P/J9VtkX4z2cLrkC0D//fkBrc2+EHdZKZ8z03H4=; b=VCH042i4TC1PHQa7zp/HZxqS50ctavWVdpqGFIOCOu/RazDa//M+2fU9Zxm+R/CFtt dkkYJ3y5qsbjbFpA9flGVGzIYH7jk9hc8mMTTB//GKgWBDdsMncqNP/6rJGCfD8iVljP 3w2ZsKNb/sy+vftGjMdi/Vj9EI/BZK8qVFTAyseBfQjxhituTN3+NCk+L/vNujTbtONl ywezgrhJ1IdsjgeRADn1EJVcMfV0PNdj/2CFhWFgVTvnpLHU28AZGgmoHyLrLrlRSf7T 09+pOZLOZqq3XPK6aBugwPQTXcZD0wRy57rkAGtMmIOIFkHU1mAmBaDf9/80OitkMkdM j9sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=H2KODyvs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z1-20020a056402274100b0045c786162f5si6153316edd.567.2022.10.24.05.50.29; Mon, 24 Oct 2022 05:50:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=H2KODyvs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234458AbiJXMsw (ORCPT + 99 others); Mon, 24 Oct 2022 08:48:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234337AbiJXMoX (ORCPT ); Mon, 24 Oct 2022 08:44:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCE4C7CE00; Mon, 24 Oct 2022 05:09:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 16A1A61290; Mon, 24 Oct 2022 11:52:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D123C433D7; Mon, 24 Oct 2022 11:52:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612360; bh=se1kNYoyh1c3+l4JRa6OE9QKY6HWsSzNgEKBIgh4c+U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H2KODyvsjmxhGUQOv7XeVbNfMt4FZyY4rQfbQjEiKeItJn8QOPCIx45N9d6pliRrN ahxiPB3Xb2UPqwaXpIumEeOH+2H5xv16kmHcIsw2paqH1IsKAAw1ak9UIub1VMzeB4 KsG9l8YbbW3tf4k0mw/A5OUiXTJ1ap/oeOLYwFLk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dongliang Mu , Neil Armstrong , Vinod Koul , Sasha Levin Subject: [PATCH 4.14 138/210] phy: qualcomm: call clk_disable_unprepare in the error handling Date: Mon, 24 Oct 2022 13:30:55 +0200 Message-Id: <20221024113001.469398282@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573388706593207?= X-GMAIL-MSGID: =?utf-8?q?1747573388706593207?= From: Dongliang Mu [ Upstream commit c3966ced8eb8dc53b6c8d7f97d32cc8a2107d83e ] Smatch reports the following error: drivers/phy/qualcomm/phy-qcom-usb-hsic.c:82 qcom_usb_hsic_phy_power_on() warn: 'uphy->cal_clk' from clk_prepare_enable() not released on lines: 58. drivers/phy/qualcomm/phy-qcom-usb-hsic.c:82 qcom_usb_hsic_phy_power_on() warn: 'uphy->cal_sleep_clk' from clk_prepare_enable() not released on lines: 58. drivers/phy/qualcomm/phy-qcom-usb-hsic.c:82 qcom_usb_hsic_phy_power_on() warn: 'uphy->phy_clk' from clk_prepare_enable() not released on lines: 58. Fix this by calling proper clk_disable_unprepare calls. Fixes: 0b56e9a7e835 ("phy: Group vendor specific phy drivers") Signed-off-by: Dongliang Mu Reviewed-by: Neil Armstrong Link: https://lore.kernel.org/r/20220914051334.69282-1-dzm91@hust.edu.cn Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/phy/qualcomm/phy-qcom-usb-hsic.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/phy/qualcomm/phy-qcom-usb-hsic.c b/drivers/phy/qualcomm/phy-qcom-usb-hsic.c index c110563a73cb..00926df4bc5b 100644 --- a/drivers/phy/qualcomm/phy-qcom-usb-hsic.c +++ b/drivers/phy/qualcomm/phy-qcom-usb-hsic.c @@ -57,8 +57,10 @@ static int qcom_usb_hsic_phy_power_on(struct phy *phy) /* Configure pins for HSIC functionality */ pins_default = pinctrl_lookup_state(uphy->pctl, PINCTRL_STATE_DEFAULT); - if (IS_ERR(pins_default)) - return PTR_ERR(pins_default); + if (IS_ERR(pins_default)) { + ret = PTR_ERR(pins_default); + goto err_ulpi; + } ret = pinctrl_select_state(uphy->pctl, pins_default); if (ret) From patchwork Mon Oct 24 11:30:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8668 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421902wru; Mon, 24 Oct 2022 05:21:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7YbA/XafBMQmiT1E62CWIBaQgJkpcjKGqk+ZVssq2lGzk//MDArPKVkNOY8TXMaMYi0zty X-Received: by 2002:a17:906:4fcd:b0:78d:8059:17c with SMTP id i13-20020a1709064fcd00b0078d8059017cmr28069078ejw.423.1666614085902; Mon, 24 Oct 2022 05:21:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614085; cv=none; d=google.com; s=arc-20160816; b=bY4VJU2SqMcEmBWZpnrs0ZdaKW6lI/1z6//dCxggGeX6rdhhFJPciIWQ//7+IrcbUI t9O+xlyDKLa0QxNXtOZDEEgfzelnC9I0dFhlpWEAyrpYFu4eeW+XZSFNsXHgCAVrAW96 vrfuKyKub4Lb9d040JZn7UKQmlNO9iajSB/T5HfXO/kW1DDhRlBQdm3JvGt8VNl0QNjz 5mOjgWhP8iaREU4ctQq79YassXKkXdoG182iDGISTYv+456NL2iVLf/2mGuiADzrQ2JA fBnyaa+fkXYk/6oTyqg6XPua2Dy1j0wL0hhExK5XoBGgnJAUduamCg+JlEwNXVsOUWpZ cY+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GnJpkuClr5zuRENPkKpllEHzXugCqzTNJizcrXcdXYc=; b=TMNM/GGURLbsmgkb8xdBmFMwApRAr6uJTDb6iv+iXVMkZc3NqCAb8C2070R7s1Mv0j qZim2DpmR42R1fnHYdAtjbMKJOl7uNhJapIRJ6HO9QMCTh1i19GpzU3Lh5eDVBebxNgX AKJqStH7Q+ym2daqhwgSl3k8L7/rwYSc3lT67irw2i/kfsQsC9jDeUSANs/U3VY7fqH6 oCJGpZiCJLRH7BPi+LLVMMj/6F2TusjMQFCm+YNUpbHfPHD6p+FDCG+mucDW+yrezxoP SwsFdPqcsWjNezX20Xhh9W99z3Uw2w1WwXWLtBWmfrg4gxze8U0aonrztSkWt/FOm0qg 4tLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LL9sXAzb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xg14-20020a170907320e00b00780805b99ccsi31116108ejb.648.2022.10.24.05.21.01; Mon, 24 Oct 2022 05:21:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LL9sXAzb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233209AbiJXMSD (ORCPT + 99 others); Mon, 24 Oct 2022 08:18:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233074AbiJXMQH (ORCPT ); Mon, 24 Oct 2022 08:16:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0E8B7AB1B; Mon, 24 Oct 2022 04:56:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B0C71612D3; Mon, 24 Oct 2022 11:52:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF748C433D6; Mon, 24 Oct 2022 11:52:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612363; bh=sqEKswuUxTriNBWzsTySPH303zgQ9wiLoNPZnKShKxM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LL9sXAzbiKU+xmq0W5kX/y0XmIKW0AS35CpJa7V9er5SkZ8CA1eEl/GExnY66frir L3lIxFlkQSNGNWXjrEypuI3sESKvkpbwQhqXlwp9CcGKdsQpUMl9LBlxDc8tS8O1U+ y+jANXG2M6uZNdlFJ4fkxL7CFb7DFLkjGBY882fs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrew Morton , Ard Biesheuvel , David Gow , Julius Werner , Petr Mladek , Evan Green , "Guilherme G. Piccoli" , Sasha Levin Subject: [PATCH 4.14 139/210] firmware: google: Test spinlock on panic path to avoid lockups Date: Mon, 24 Oct 2022 13:30:56 +0200 Message-Id: <20221024113001.499468167@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571531585465401?= X-GMAIL-MSGID: =?utf-8?q?1747571531585465401?= From: Guilherme G. Piccoli [ Upstream commit 3e081438b8e639cc76ef1a5ce0c1bd8a154082c7 ] Currently the gsmi driver registers a panic notifier as well as reboot and die notifiers. The callbacks registered are called in atomic and very limited context - for instance, panic disables preemption and local IRQs, also all secondary CPUs (not executing the panic path) are shutdown. With that said, taking a spinlock in this scenario is a dangerous invitation for lockup scenarios. So, fix that by checking if the spinlock is free to acquire in the panic notifier callback - if not, bail-out and avoid a potential hang. Fixes: 74c5b31c6618 ("driver: Google EFI SMI") Cc: Andrew Morton Cc: Ard Biesheuvel Cc: David Gow Cc: Greg Kroah-Hartman Cc: Julius Werner Cc: Petr Mladek Reviewed-by: Evan Green Signed-off-by: Guilherme G. Piccoli Link: https://lore.kernel.org/r/20220909200755.189679-1-gpiccoli@igalia.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/firmware/google/gsmi.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/firmware/google/gsmi.c b/drivers/firmware/google/gsmi.c index 62337be07afc..2e3ef0eb6e82 100644 --- a/drivers/firmware/google/gsmi.c +++ b/drivers/firmware/google/gsmi.c @@ -661,6 +661,15 @@ static struct notifier_block gsmi_die_notifier = { static int gsmi_panic_callback(struct notifier_block *nb, unsigned long reason, void *arg) { + + /* + * Panic callbacks are executed with all other CPUs stopped, + * so we must not attempt to spin waiting for gsmi_dev.lock + * to be released. + */ + if (spin_is_locked(&gsmi_dev.lock)) + return NOTIFY_DONE; + gsmi_shutdown_reason(GSMI_SHUTDOWN_PANIC); return NOTIFY_DONE; } From patchwork Mon Oct 24 11:30:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10393 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp697782wru; Mon, 24 Oct 2022 16:14:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5593zWtZzminEYQdKhwSXOp6eto51sjp7/3oBNqRQ9XFCONPZhsYkz5NNPCTOS1ih1stTE X-Received: by 2002:a17:902:d512:b0:181:f1f4:fcb4 with SMTP id b18-20020a170902d51200b00181f1f4fcb4mr36198273plg.102.1666653297252; Mon, 24 Oct 2022 16:14:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666653297; cv=none; d=google.com; s=arc-20160816; b=TQ8mu63r83lFPSDEwUUvV/gwhZu9ElLfaFeKE2bLe5cNJLuNygb0tIKfzU8CoM8otA 3U+r+Ckfn0ZOgPIPlN/GFUYd3e9+hiucYOdN/tMaBT7ManmiiwFmK3DbWi6phzN9WPGC dOTgNoUzD1jhmimpSSKXHHwyQ7pkXODj2aKzj85v9CqCXFpo4T7xelyYgpmj+2EbX4/S v3WBpWtrc/TS2EVwGBs3kh7/lQ7XIvZcF5JaQtqf3UyJGkGI27p1RmlmTDCMyGVA9sdT +B8zLSKr7ZkJ+LY8itJNEc1aOnP75lWoQBta75iSzl2OUJishTxGbKa/460XqswT+/hz j5GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HbGEfbwf4zkyG0ThGCxvgiiSD90a4lpRYWeg2YMjk64=; b=ABhw8fm5hqvoMgbkwv0lpoEcJPvg8OCn7FbH1tODYo4JlBlf4iLXcGKf5+L152ou99 ij18aRdDf5tYaD4BEt+/PndjVsEi20OTjS76jkVxQQGmm0x4Sch22hrV4dZuCjUmXY7D XSSirjY8gWnGijEhzz1e8NgCWVbwdBCzIaFLV3CzEtteFGkVN40uKsASZYylnfDqpuCg ubJipVHcz39j4sKIm0PMKeiYWOSABaCUvfgr6BuoDPJ3MRiOsBGJtyftRbmS7L2jmMuW DmGidmbKUXTkDIfZ+h4N2VXIduk+5TMKryTfn2rQgu9bOvK85TsEwVf63ZCoEF0BO5zO MxPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vOMKbqFb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u37-20020a631425000000b0046ec2ad4a97si1029517pgl.163.2022.10.24.16.14.44; Mon, 24 Oct 2022 16:14:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vOMKbqFb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230000AbiJXXF5 (ORCPT + 99 others); Mon, 24 Oct 2022 19:05:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230048AbiJXXFQ (ORCPT ); Mon, 24 Oct 2022 19:05:16 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D11B13E9D; Mon, 24 Oct 2022 14:26:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 5B0DACE1358; Mon, 24 Oct 2022 11:52:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54D3EC433C1; Mon, 24 Oct 2022 11:52:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612365; bh=MnQq42w27sr4o4YFrHTKLGct+XKYyfZLsxJq6akJljY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vOMKbqFb3G7Ljj0B3z/cBInHebuJl+/HW/JCTSl30QGLzun4UbRZ7YI8NM1Qtb/Oa mLNWSiae+QfG9UjWaRYoTztUlpANmIj1qIYsqSaDTsDjgEBPwF1x5FiRT1Xo3KAJox 6adjRixMW/qm0xksQCBmCPuuExgTGn3Jy+mJzItg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Pali_Roh=C3=A1r?= , Sasha Levin Subject: [PATCH 4.14 140/210] serial: 8250: Fix restoring termios speed after suspend Date: Mon, 24 Oct 2022 13:30:57 +0200 Message-Id: <20221024113001.529290223@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747612648068133415?= X-GMAIL-MSGID: =?utf-8?q?1747612648068133415?= From: Pali Rohár [ Upstream commit 379a33786d489ab81885ff0b3935cfeb36137fea ] Since commit edc6afc54968 ("tty: switch to ktermios and new framework") termios speed is no longer stored only in c_cflag member but also in new additional c_ispeed and c_ospeed members. If BOTHER flag is set in c_cflag then termios speed is stored only in these new members. Since commit 027b57170bf8 ("serial: core: Fix initializing and restoring termios speed") termios speed is available also in struct console. So properly restore also c_ispeed and c_ospeed members after suspend to fix restoring termios speed which is not represented by Bnnn constant. Fixes: 4516d50aabed ("serial: 8250: Use canary to restart console after suspend") Signed-off-by: Pali Rohár Link: https://lore.kernel.org/r/20220924104324.4035-1-pali@kernel.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/8250/8250_port.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index 5d614d645e81..def880039b30 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -3236,8 +3236,13 @@ static void serial8250_console_restore(struct uart_8250_port *up) unsigned int baud, quot, frac = 0; termios.c_cflag = port->cons->cflag; - if (port->state->port.tty && termios.c_cflag == 0) + termios.c_ispeed = port->cons->ispeed; + termios.c_ospeed = port->cons->ospeed; + if (port->state->port.tty && termios.c_cflag == 0) { termios.c_cflag = port->state->port.tty->termios.c_cflag; + termios.c_ispeed = port->state->port.tty->termios.c_ispeed; + termios.c_ospeed = port->state->port.tty->termios.c_ospeed; + } baud = serial8250_get_baud_rate(port, &termios, NULL); quot = serial8250_get_divisor(up, baud, &frac); From patchwork Mon Oct 24 11:30:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8630 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp420628wru; Mon, 24 Oct 2022 05:18:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5nYjvAjSQG+to6iGhnjhBe1c5HFN6GX6b7dPcwaFZ9+RTBfiKGrW8HA/Pc3BMmOz1jutdT X-Received: by 2002:a17:907:3f85:b0:733:3f0e:2f28 with SMTP id hr5-20020a1709073f8500b007333f0e2f28mr26232676ejc.376.1666613915567; Mon, 24 Oct 2022 05:18:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613915; cv=none; d=google.com; s=arc-20160816; b=CD3mQ2i2Z3uvcil4IyMPAbXrVl6zNRmxUAGlW/rGjs1P84Khjhesqp9n4BAUhVqYLT SQG3Jf7dY8o2fMIseiToA8Yr2lGrJ3USwBoUdf+m2886j/coICIVitT4Z15jBEEX35P6 v7YJlzwr15LLY+KJnp+4JP5eJgFmqa9V/8016dNEBESrpZeivCBrPB4tCRNSRaJjb2SV X80ZCVxRIgX9EtZimRlJ6D0QBdjNlvpwJ8PqIHJIu9ta6oavao7iYW8rlxyuTNmNcza/ J7YQs06hEyY2e42tfStydOsQsC1pMmQeP1Rjm+gdg7qBqbMf3h/cvARnpVRLkxk2YKda xGCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eT7AKhV/eKbP7TWAck7ef5AWTXgqNF/c1Tqz3e/zqt0=; b=PV6LBklUGlFLFoQCmllCLn60/IvhGy5eBupF9yCgZ0aBdz27dPNL1AsfMZwK2L7nwi J9nb1EEsUCJxoyF3dn3M6OHUjORjYovnd9F10Dy8pm7ypkUnfR9PLzb3THqSH7PDje6t MN5XWrngDJceTSVhIm9s2bsTIXd+HEi0Y5SsG00glHNMxBVm/intnt5NI6I/nrz9ca5t HHRrFhjPGLnP9RsApbY4KhWpw8QjNkRa4F6QkDsZ3xG4JmKmYsLPx6d8Bk1ZH8Uv/c5/ CFdG/v/LtU+H1y1EXtb6ilLLwzS56hfuMfTUVcJTLHbcqTuyvATDSs3mjtUR38hLDMGK oLtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OnWiXnNU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q7-20020a1709060e4700b0078e176ef65csi24362187eji.723.2022.10.24.05.18.10; Mon, 24 Oct 2022 05:18:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OnWiXnNU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232930AbiJXMMI (ORCPT + 99 others); Mon, 24 Oct 2022 08:12:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232837AbiJXMLS (ORCPT ); Mon, 24 Oct 2022 08:11:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C75E88048D; Mon, 24 Oct 2022 04:53:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E1A61612CF; Mon, 24 Oct 2022 11:52:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE6C0C433C1; Mon, 24 Oct 2022 11:52:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612368; bh=t+w86/SimSzC1gn5+ybDuSGrr7/NcvbL9r66isdT9nM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OnWiXnNUj7DiIQ7gebxdSUyW3AuZ15gIMXcZCXbi9qoePr2Bn8ws1BDAwSqTtQCb3 flgb+M/PGU1XvPsEChRN0uSL0OrB0i19LkUa3vhmpn/AIrTjOBXG1klVmFexXUeZXg YMpIjzoDee4gyVMadvn8EW6qXc+H+rOMpOVt6Qzw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Eddie James , Joel Stanley , Sasha Levin Subject: [PATCH 4.14 141/210] fsi: core: Check error number after calling ida_simple_get Date: Mon, 24 Oct 2022 13:30:58 +0200 Message-Id: <20221024113001.558562863@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571352879881522?= X-GMAIL-MSGID: =?utf-8?q?1747571352879881522?= From: Jiasheng Jiang [ Upstream commit 35af9fb49bc5c6d61ef70b501c3a56fe161cce3e ] If allocation fails, the ida_simple_get() will return error number. So master->idx could be error number and be used in dev_set_name(). Therefore, it should be better to check it and return error if fails, like the ida_simple_get() in __fsi_get_new_minor(). Fixes: 09aecfab93b8 ("drivers/fsi: Add fsi master definition") Signed-off-by: Jiasheng Jiang Reviewed-by: Eddie James Link: https://lore.kernel.org/r/20220111073411.614138-1-jiasheng@iscas.ac.cn Signed-off-by: Joel Stanley Signed-off-by: Sasha Levin --- drivers/fsi/fsi-core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c index 8feca59c1f6b..392efc2a4b8c 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -821,6 +821,9 @@ int fsi_master_register(struct fsi_master *master) return -EINVAL; master->idx = ida_simple_get(&master_ida, 0, INT_MAX, GFP_KERNEL); + if (master->idx < 0) + return master->idx; + dev_set_name(&master->dev, "fsi%d", master->idx); rc = device_register(&master->dev); From patchwork Mon Oct 24 11:30:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8670 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421993wru; Mon, 24 Oct 2022 05:21:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6008Y+Tll86vEdij3R7MPZdJdobbOfKN1zOdNGG7zDbhL1X1ACWQq5EEtpjEhZVALD1ZXB X-Received: by 2002:a17:907:3da2:b0:78d:51c4:5b80 with SMTP id he34-20020a1709073da200b0078d51c45b80mr26935426ejc.716.1666614097958; Mon, 24 Oct 2022 05:21:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614097; cv=none; d=google.com; s=arc-20160816; b=p3kvCoJ/J7ctiqqxAoKVz32gwRyQSDrXnDEqGr+X64wt/6gf5+75uf9A9e9RejPBJD DB0T6SNO5TwhvQT1js5nD2EZl/NiAR8qVFBeGhFuRmMz6MZ9hS1rnr0XQeaPKRc8vm85 hQADh+mcVKwemLL5lUOJWGw0gtYecVPOvnTlEI0YuQVuzlxyQ2pBU0UL503bnB53tZy8 JM1Zk/0s7y45akKvqTAxFBaRAteUmcEEu9z6Ndk7Kekt4+5g4+hZmMu33CgBX4CQ4l/x gHRvhDCkCKwN2Z4+PQO9CKKcoApobxJp6X6LvXW8YSZFWCK/RE/22+o9uF/6Pu4EO1MA V3Nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZsZerslF/0fVhFn6vPF2dvdQANPvXSEZPyznC/Z1wxI=; b=mVDvUrNRZOTWukKle9RoyYz5LiDUnlGhn4kPqq8VaaT21AuoAF8Wq85kN3JgmxGTHR LO5t9oYEtHOdcWzTnA82AOvqriqW2otx9e92UCwdESIQhDojM0wS8FdBcnyDyAkV2kde 3f7ZV/uKW0Drnm3v7WNRh+34cTycN3HHXyIhBAHcSbcWg94QSmXmnECiSSmuoLKvTfPa BKcGHxlb7FSJtKp5Ac92vZTdk36G33Zk1mj3DDgOIxL0Fq7Ln6JCOcUgnq6llGYOUET+ 07IFeLXRrxx4medaWlB5cfAp3oZ7cWUTF3sjGEWcL/sYTKLBjeHL7YzFUWMcepCIOdiW +eFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZY3Sw3xg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ga29-20020a1709070c1d00b00782faf12c6esi29625994ejc.78.2022.10.24.05.21.14; Mon, 24 Oct 2022 05:21:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZY3Sw3xg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232959AbiJXMSj (ORCPT + 99 others); Mon, 24 Oct 2022 08:18:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233167AbiJXMQ6 (ORCPT ); Mon, 24 Oct 2022 08:16:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9FA7814FD; Mon, 24 Oct 2022 04:56:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3F193B81186; Mon, 24 Oct 2022 11:52:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B025C433D6; Mon, 24 Oct 2022 11:52:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612371; bh=e/KEj574MmNa/M0sn4QvklxgLeOlAyMdJQf52uy5n4c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZY3Sw3xgXggeSkY96fjQfH5yJOQ8eWrsUaC/Mb5SZ78YGxmVBRnYEKIHzX5ByJqR1 CIoKVdKGcAYdxak56Z/P7uYHP8h2VRKSw33ug9R8JXy1s150JdWoIfYXBEAEkn+Jiv xUqU/vkMr80VDONQ/dsEtkGZkuE0ctBz/cIipjhk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Andy Shevchenko , Hans de Goede , Lee Jones , Sasha Levin Subject: [PATCH 4.14 142/210] mfd: intel_soc_pmic: Fix an error handling path in intel_soc_pmic_i2c_probe() Date: Mon, 24 Oct 2022 13:30:59 +0200 Message-Id: <20221024113001.588033162@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571544632678776?= X-GMAIL-MSGID: =?utf-8?q?1747571544632678776?= From: Christophe JAILLET [ Upstream commit 48749cabba109397b4e7dd556e85718ec0ec114d ] The commit in Fixes: has added a pwm_add_table() call in the probe() and a pwm_remove_table() call in the remove(), but forget to update the error handling path of the probe. Add the missing pwm_remove_table() call. Fixes: a3aa9a93df9f ("mfd: intel_soc_pmic_core: ADD PWM lookup table for CRC PMIC based PWM") Signed-off-by: Christophe JAILLET Signed-off-by: Andy Shevchenko Reviewed-by: Hans de Goede Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20220801114211.36267-1-andriy.shevchenko@linux.intel.com Signed-off-by: Sasha Levin --- drivers/mfd/intel_soc_pmic_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mfd/intel_soc_pmic_core.c b/drivers/mfd/intel_soc_pmic_core.c index 36adf9e8153e..eb9ff34294e6 100644 --- a/drivers/mfd/intel_soc_pmic_core.c +++ b/drivers/mfd/intel_soc_pmic_core.c @@ -119,6 +119,7 @@ static int intel_soc_pmic_i2c_probe(struct i2c_client *i2c, return 0; err_del_irq_chip: + pwm_remove_table(crc_pwm_lookup, ARRAY_SIZE(crc_pwm_lookup)); regmap_del_irq_chip(pmic->irq, pmic->irq_chip_data); return ret; } From patchwork Mon Oct 24 11:31:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10353 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp682956wru; Mon, 24 Oct 2022 15:33:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6N+qlGnU1Aj2UyD2PtDluKgNoS5zss6bbXIcjO1R/BVrxY5I7CMWMBac1UG9B4awFrkEdI X-Received: by 2002:a17:90b:954:b0:213:c01:b8ce with SMTP id dw20-20020a17090b095400b002130c01b8cemr8991246pjb.168.1666650804840; Mon, 24 Oct 2022 15:33:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666650804; cv=none; d=google.com; s=arc-20160816; b=rDIXrGpfcuY1vI7et5hnekKKS300NoazyWczfjMcaNvXHsA86vBvxdK1RWGX9QQXCd FhcvtjYVsj61D/K3nHhaO1lNqNnr8zuqw5mUhh97vK5K/fsU+kGqq2X71HYfSkJ5IvmS KXrTj30IliwrAajei91YHCprD0B5in8qNXul0YvXEdaJ/5NuITvm8vc3VC0muXHAW6/P 6bHL7T6la6OolK347u0zO7Iiy6VJGr1jh7k/rTSrIDiNf6JbezlvbecBEHF/+ASPsB3Q Nrs0zgglVGIL/xCbefp2/ETs6Nzvt3Xr/iNZZpe/xmkiIO5Tzdo1Y61N12/CMVMy2sTr rDeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eLazDWmfyIuSzChC/l4miwSYUjp+PM7PS0a65SPPiBo=; b=tWMxSLQ0vvFBJ8IEdtSHfKxrys+ccC75kj6kJ3J8kS6TtmQc4aP4wehJO3IkeBJWDM FjgVx8XtW4hd0JaI+CWhRKbzumkSGpy72xEIR08rmXLVg32oJgghqrm7D9eLEx1HTQpy dUqTWtMHnigjZHan1SciGfjKhZDdhB5tZLC1SBRoBDJHa8xk7J0kfV/OH4ct4I3Nmc7H ud45IXtmT8gAhpUi/lZltJ/ELnO6koVcKuiXiBuJgT2l5SCrhYvMvk70IWiIbaQHJ2Yy tx0Cpgo+qpYaRCVMPjDb+BgZi+aF+Wy0pIDpsnJjAjEw27dSqLrtkqCgaiy9kYHwF67u Ctjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Oq8QZveW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x5-20020a63db45000000b0043cb5d08908si803818pgi.138.2022.10.24.15.33.11; Mon, 24 Oct 2022 15:33:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Oq8QZveW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230460AbiJXWUP (ORCPT + 99 others); Mon, 24 Oct 2022 18:20:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230385AbiJXWTf (ORCPT ); Mon, 24 Oct 2022 18:19:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00C4431284A; Mon, 24 Oct 2022 13:37:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9DBC4B81193; Mon, 24 Oct 2022 11:51:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ECE0FC433C1; Mon, 24 Oct 2022 11:51:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612292; bh=DZ+Zu5WpqihCLIpHxBVl2RjarTF9WSJjeuJbrVDk70k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Oq8QZveW60kqKacMMkplK2UIsvBSUok2X6fjRuOYTq4fdM8Rqfu/SB9dj/o9bz6v5 Ol2QlNQd3Lf/fnGez41BB0svoqbdHbALOl+wNBBCRH4PDQ8PmrCR1h/WumOYMPeRjv R6HeUCMCPIz1aGfu0dCQUtparnx6fPo7fS7frOCs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Lee Jones , Sasha Levin Subject: [PATCH 4.14 143/210] mfd: fsl-imx25: Fix an error handling path in mx25_tsadc_setup_irq() Date: Mon, 24 Oct 2022 13:31:00 +0200 Message-Id: <20221024113001.618428914@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747610034684819919?= X-GMAIL-MSGID: =?utf-8?q?1747610034684819919?= From: Christophe JAILLET [ Upstream commit 3fa9e4cfb55da512ebfd57336fde468830719298 ] If devm_of_platform_populate() fails, some resources need to be released. Introduce a mx25_tsadc_unset_irq() function that undoes mx25_tsadc_setup_irq() and call it both from the new error handling path of the probe and in the remove function. Fixes: a55196eff6d6 ("mfd: fsl-imx25: Use devm_of_platform_populate()") Signed-off-by: Christophe JAILLET Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/d404e04828fc06bcfddf81f9f3e9b4babbe35415.1659269156.git.christophe.jaillet@wanadoo.fr Signed-off-by: Sasha Levin --- drivers/mfd/fsl-imx25-tsadc.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/drivers/mfd/fsl-imx25-tsadc.c b/drivers/mfd/fsl-imx25-tsadc.c index 461b0990b56f..5ad721035e49 100644 --- a/drivers/mfd/fsl-imx25-tsadc.c +++ b/drivers/mfd/fsl-imx25-tsadc.c @@ -90,6 +90,19 @@ static int mx25_tsadc_setup_irq(struct platform_device *pdev, return 0; } +static int mx25_tsadc_unset_irq(struct platform_device *pdev) +{ + struct mx25_tsadc *tsadc = platform_get_drvdata(pdev); + int irq = platform_get_irq(pdev, 0); + + if (irq) { + irq_set_chained_handler_and_data(irq, NULL, NULL); + irq_domain_remove(tsadc->domain); + } + + return 0; +} + static void mx25_tsadc_setup_clk(struct platform_device *pdev, struct mx25_tsadc *tsadc) { @@ -177,18 +190,21 @@ static int mx25_tsadc_probe(struct platform_device *pdev) platform_set_drvdata(pdev, tsadc); - return devm_of_platform_populate(dev); + ret = devm_of_platform_populate(dev); + if (ret) + goto err_irq; + + return 0; + +err_irq: + mx25_tsadc_unset_irq(pdev); + + return ret; } static int mx25_tsadc_remove(struct platform_device *pdev) { - struct mx25_tsadc *tsadc = platform_get_drvdata(pdev); - int irq = platform_get_irq(pdev, 0); - - if (irq) { - irq_set_chained_handler_and_data(irq, NULL, NULL); - irq_domain_remove(tsadc->domain); - } + mx25_tsadc_unset_irq(pdev); return 0; } From patchwork Mon Oct 24 11:31:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9341 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp466823wru; Mon, 24 Oct 2022 06:56:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4EhUZI1NlsOkSo/OD+wA44wmi9iHJ8DPP4Jf/1TtbYFe1/pONt6fdaKJKWxgNDSy5DEMsr X-Received: by 2002:a17:902:ecc1:b0:186:b57e:d229 with SMTP id a1-20020a170902ecc100b00186b57ed229mr1979019plh.167.1666619764751; Mon, 24 Oct 2022 06:56:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619764; cv=none; d=google.com; s=arc-20160816; b=K7ui21hWvm8A+iXGljcYvjJrJle/8njlOz+WORtU37ae4AU+gPAuKmkx40siY5dLF0 I4LpOEkxoCrNqiTSfkicPI8CRQYWfldamdXqRQ8nkgVWXFkMKWgPZK45p6nynGNEFZon A8xMok9myx1kBLuPVda2NZuTfqWTkshu5B8FvjNKAcaJ5IplJ2ZN4CQe34CrejZbBXtt fQJfK3Rf1xivgsliipDlbCM8KHt9h5WhoP1UmhNY2H1Q0L3cex06d8wbxABd6L55V6ly wx6vNAQm4u1a20q84QUPLIfIT/vOdrh4m9XIIWZSpVFPFxRW3XZKjb2JNEQ8Zbm4dyMn tMuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=L+A/BSR94ma4LpScF9jqZHK9B+avof+oOFBAQ/rcUC8=; b=CfURw7mTTDBa5JqarRv/pMa12B8IqjunR3fh7KYHLwYD3ZOkUY8cDRdbEjsHD3GTYM bdNHyx+k+a3vN+94MncKryQ4oXxjiSfpXeo2Dpm7PLFiw/80dSr0esCcNhACqdzNwNIC VdG803EmZjwQ6VzTxjnGg0I6E6GdawkxtraNHvUSVvKjm1p89AQ6dHAXyntzPIlEnb59 zCh9JB+IWbjpuZnMKtamFXOl6471FHf1+6G8qePE5Rzr5UBrVyEPFAc5ocXpWHQ2n5yf f+k9/mM+aSfjEtFGpJcU1QxSv7ourwOBNFd5pfXqaGjmP80fRJnHQMb/3K75cbrDdac8 GRGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wRKZIobi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p2-20020a170902b08200b00180556e1b6bsi32487240plr.609.2022.10.24.06.55.51; Mon, 24 Oct 2022 06:56:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wRKZIobi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236704AbiJXNzQ (ORCPT + 99 others); Mon, 24 Oct 2022 09:55:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236250AbiJXNxk (ORCPT ); Mon, 24 Oct 2022 09:53:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D0EFBC47F; Mon, 24 Oct 2022 05:43:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8A319612B8; Mon, 24 Oct 2022 11:51:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99A41C433C1; Mon, 24 Oct 2022 11:51:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612295; bh=7Mf8pAymLKtC4kysmJdpY7SrgzbFoAL52CT2NFcnYPE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wRKZIobiLqoN/h2bAZMto/dyXbZuPupTBEpQvHv3HSy9o3VB7D13Rla/iXhHADWAV BohnwO1k/rn3NdY0q0y0Gy8eJpsfZicrV+FF2FUn8w1bzZ7FH6/CuuKRigC8s7LmMA Q+5qjzyfpxKVFVspdfy9AGgwiowsHGk6PBxvNyis= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Lee Jones , Sasha Levin Subject: [PATCH 4.14 144/210] mfd: lp8788: Fix an error handling path in lp8788_probe() Date: Mon, 24 Oct 2022 13:31:01 +0200 Message-Id: <20221024113001.648355789@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747577486889384306?= X-GMAIL-MSGID: =?utf-8?q?1747577486889384306?= From: Christophe JAILLET [ Upstream commit becfdcd75126b20b8ec10066c5e85b34f8994ad5 ] Should an error occurs in mfd_add_devices(), some resources need to be released, as already done in the .remove() function. Add an error handling path and a lp8788_irq_exit() call to undo a previous lp8788_irq_init(). Fixes: eea6b7cc53aa ("mfd: Add lp8788 mfd driver") Signed-off-by: Christophe JAILLET Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/18398722da9df9490722d853e4797350189ae79b.1659261275.git.christophe.jaillet@wanadoo.fr Signed-off-by: Sasha Levin --- drivers/mfd/lp8788.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/mfd/lp8788.c b/drivers/mfd/lp8788.c index acf616559512..e47150cdf747 100644 --- a/drivers/mfd/lp8788.c +++ b/drivers/mfd/lp8788.c @@ -199,8 +199,16 @@ static int lp8788_probe(struct i2c_client *cl, const struct i2c_device_id *id) if (ret) return ret; - return mfd_add_devices(lp->dev, -1, lp8788_devs, - ARRAY_SIZE(lp8788_devs), NULL, 0, NULL); + ret = mfd_add_devices(lp->dev, -1, lp8788_devs, + ARRAY_SIZE(lp8788_devs), NULL, 0, NULL); + if (ret) + goto err_exit_irq; + + return 0; + +err_exit_irq: + lp8788_irq_exit(lp); + return ret; } static int lp8788_remove(struct i2c_client *cl) From patchwork Mon Oct 24 11:31:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8604 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419642wru; Mon, 24 Oct 2022 05:16:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6u5pQBimyhgshqDWXA4I6rrl8EFBEvpxXxDQ8p4qHIXrt5NwJxwD4NgeaU3CzQPf5vYISR X-Received: by 2002:a05:6402:f2a:b0:461:eff7:bae8 with SMTP id i42-20020a0564020f2a00b00461eff7bae8mr1179476eda.322.1666613798970; Mon, 24 Oct 2022 05:16:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613798; cv=none; d=google.com; s=arc-20160816; b=FgiV696J7AjtFJBZJjVR+FkCgmJF3prwsdRuadpiGNS6eU1W1jIRSSMCAartztvMGD qYsjFHm7OAJ9HMxyo2R1dG8yiJj8pWPw5MVRRksKb/qSMXGRgwElAESpuQIfxqmPSLoR l17uEUknupON95vPighoboAHhWYGDRMX/g80Nm17QL429+IPPjaajJh2fRFg2BxvwsLp NhCvLGvOorjD2h18NH/P+FPlVn4TsrBmjH1+owDg+tUl/ilbPOgEUbUgnV8dgju+EwIH 8eOvAx5HJfJVGIYl5B4JedAZfJcqCGEVXtGRN6J8yIxkLj2HkHD3bquQfJQCQYYFZBvr mHzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ncrh4LKlHVvQtYJT+QR1ULqI34OmJaPmyfVts/ndP88=; b=S3RomOhXvCqskpiZUJ86Nt78CwE6RvBdyLmem5zUQwykuyUung077/dQ/o3mVjV+Gb VYLfRdxHrsgib6teOujRJ0cEngIAfwJZEN44TfAyJ7mpNPdD25d6c/cbNU6UcsADk4Hh 02vVEMY3Y0yvafTb6suh7Z3Q0EcbawuZDPfkURokfqRshoz78szbZ4r+VlTaOdsA3ANJ bbTqXgLL62u8GNdp6B7Nk1bSroDxOB8RmOFcg88RjD9lbT4D1STVHxIVUJVIbLKoGn9y Y+COztcGEVa4WrX5vU3pwcWGoisnuLCkZgshne3f9vKZF6CeJOI6TUpiNE0r8uXf/tCp GlnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LDGnHXHe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n14-20020a170906700e00b007330c08fe49si21610441ejj.206.2022.10.24.05.16.14; Mon, 24 Oct 2022 05:16:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LDGnHXHe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229864AbiJXMIS (ORCPT + 99 others); Mon, 24 Oct 2022 08:08:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232599AbiJXMFq (ORCPT ); Mon, 24 Oct 2022 08:05:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC8EB7E30A; Mon, 24 Oct 2022 04:51:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 25261612C3; Mon, 24 Oct 2022 11:51:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3718AC433D7; Mon, 24 Oct 2022 11:51:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612297; bh=+IJfdwQZHLdBxmVW+3yGX0T13fs3Qxpi0bql/8osMgE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LDGnHXHeSXslOuUXAxG0RV8jUwi3qHLEdq5x+AHsostU55LPP6H3xFzKwMoc9L2je fJttDwJmKT1b8uU4MVEXuuHhK+aRhAF36r2BuHyfkMdlTcmjJgUe5ceheO+j8CNYSE Kenkytqlbit3eQ6/XBzvWDUrU3yJG8f6RBXJHnJw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Lee Jones , Sasha Levin Subject: [PATCH 4.14 145/210] mfd: lp8788: Fix an error handling path in lp8788_irq_init() and lp8788_irq_init() Date: Mon, 24 Oct 2022 13:31:02 +0200 Message-Id: <20221024113001.678082256@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571230917753846?= X-GMAIL-MSGID: =?utf-8?q?1747571230917753846?= From: Christophe JAILLET [ Upstream commit 557244f6284f30613f2d61f14b579303165876c3 ] In lp8788_irq_init(), if an error occurs after a successful irq_domain_add_linear() call, it must be undone by a corresponding irq_domain_remove() call. irq_domain_remove() should also be called in lp8788_irq_exit() for the same reason. Fixes: eea6b7cc53aa ("mfd: Add lp8788 mfd driver") Signed-off-by: Christophe JAILLET Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/bcd5a72c9c1c383dd6324680116426e32737655a.1659261275.git.christophe.jaillet@wanadoo.fr Signed-off-by: Sasha Levin --- drivers/mfd/lp8788-irq.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mfd/lp8788-irq.c b/drivers/mfd/lp8788-irq.c index 792d51bae20f..ae65928f35f0 100644 --- a/drivers/mfd/lp8788-irq.c +++ b/drivers/mfd/lp8788-irq.c @@ -179,6 +179,7 @@ int lp8788_irq_init(struct lp8788 *lp, int irq) IRQF_TRIGGER_FALLING | IRQF_ONESHOT, "lp8788-irq", irqd); if (ret) { + irq_domain_remove(lp->irqdm); dev_err(lp->dev, "failed to create a thread for IRQ_N\n"); return ret; } @@ -192,4 +193,6 @@ void lp8788_irq_exit(struct lp8788 *lp) { if (lp->irq) free_irq(lp->irq, lp->irqdm); + if (lp->irqdm) + irq_domain_remove(lp->irqdm); } From patchwork Mon Oct 24 11:31:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8616 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp420078wru; Mon, 24 Oct 2022 05:17:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5dyPsC56A73rg6WtCm8Jj/GeriAq7rqf6E6uoFbY+xfISwYjZ5VQVzcb0w61BrXGyCtXq5 X-Received: by 2002:a17:907:2d1f:b0:78e:174d:2ce0 with SMTP id gs31-20020a1709072d1f00b0078e174d2ce0mr27471485ejc.638.1666613851945; Mon, 24 Oct 2022 05:17:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613851; cv=none; d=google.com; s=arc-20160816; b=aZ5/w4CaFw4LaUDGQ1F4EDs5UWUDLRDTFS/U3P89dQglQbc4ucztTV/zkKb9EBK/XI jo1KFlDawycU15U+xa74E34KDOZ0/lCRqWlpMKo8Zs/iU+PYA5FX8CBy3cGAnKXN5Kcu L6sgLQvK5gD0yCbhUdAqlGYzVx4jS78JW+fhZiVibIa+Q82bfSqVF5IQRgABEw4su4Un dTszb9YT3Nzo78Pv4Sr+fe1PKlSVWHWYvmeGPVYE+PlbwpECeN35CzyAAgkX0Ob2Z+aR T9WdN4gL2jT708s6ofAyubCmOMC6u82DptriOcdEc7Tgt4qlThFMRcZ4xkHn723XVbJd Vlsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eT2ct8uXPULVjxqC9Tu0HO2zL/R10SQ2EWK1YMhTxcs=; b=Eg7y3b52hSq/g2fPLQ6dWZFzIg3Nzc0s97RN4/Wl69OLv3t9j6WqvGF4uZO/WoTc9S SdeM+vrPBsBbshsotpB3YqwMyLNGXJ9bFjMWoYgDUkNpJw0aFv4gHVCHGCBC08RFP6Vr urjJnwHPRaWX4UvgRlNG9HPzKuD4nnawaFlLUS7C9V5ff+BAaSlzD+Z7qqeGFovkIJYV Edr6JDQN5e2w+1KDeuMjhe24x65aj1fPPJC08wJHEpXcUxS03jclBemlpYWZ6bRdSDpK oNdH3jtv5H+erpdDl057X73Y1oAlAX1YpEHzd6ycW/cM0BgFqSek99ruzi/fqkV6RhrG ihlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fO+cGc82; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hz2-20020a1709072ce200b0079ca59305a6si9675854ejc.354.2022.10.24.05.17.07; Mon, 24 Oct 2022 05:17:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fO+cGc82; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230388AbiJXMLE (ORCPT + 99 others); Mon, 24 Oct 2022 08:11:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233089AbiJXMJj (ORCPT ); Mon, 24 Oct 2022 08:09:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 814127F269; Mon, 24 Oct 2022 04:52:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A0B6EB8117E; Mon, 24 Oct 2022 11:51:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05096C43141; Mon, 24 Oct 2022 11:51:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612300; bh=BNOQsYZF/K2e4NRppXGPLidezNtKbq+7MS1OWtou5uY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fO+cGc82yzHIp69z1cmxUUyNCt95NcTevhzndod1IaPp7/edefo4YYE/TRXl0+KAV GOujpLcXByMGLuFRPQNojuDyWWvc9c5FKvVkbLM2enLYkK49TiY8MhGY8tytn7vIlI 8p9OaHzjaSw/1Ytf42VYE1UtObkG8VbV5kAe5MYM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Lee Jones , Sasha Levin Subject: [PATCH 4.14 146/210] mfd: sm501: Add check for platform_driver_register() Date: Mon, 24 Oct 2022 13:31:03 +0200 Message-Id: <20221024113001.714031697@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571286187583847?= X-GMAIL-MSGID: =?utf-8?q?1747571286187583847?= From: Jiasheng Jiang [ Upstream commit 8325a6c24ad78b8c1acc3c42b098ee24105d68e5 ] As platform_driver_register() can return error numbers, it should be better to check platform_driver_register() and deal with the exception. Fixes: b6d6454fdb66 ("[PATCH] mfd: SM501 core driver") Signed-off-by: Jiasheng Jiang Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20220913091112.1739138-1-jiasheng@iscas.ac.cn Signed-off-by: Sasha Levin --- drivers/mfd/sm501.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c index 4ca245518a19..d64bd28cc6b8 100644 --- a/drivers/mfd/sm501.c +++ b/drivers/mfd/sm501.c @@ -1736,7 +1736,12 @@ static struct platform_driver sm501_plat_driver = { static int __init sm501_base_init(void) { - platform_driver_register(&sm501_plat_driver); + int ret; + + ret = platform_driver_register(&sm501_plat_driver); + if (ret < 0) + return ret; + return pci_register_driver(&sm501_pci_driver); } From patchwork Mon Oct 24 11:31:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8858 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433062wru; Mon, 24 Oct 2022 05:48:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Uy8NMia0WMDL2q8H++ulHg+5wKpyeKMdf2bJAz/vm9QCuvt7HAnRNiF6C2gBbzzID1kHy X-Received: by 2002:a17:90a:c306:b0:211:8e5e:9a66 with SMTP id g6-20020a17090ac30600b002118e5e9a66mr27743686pjt.152.1666615710378; Mon, 24 Oct 2022 05:48:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615710; cv=none; d=google.com; s=arc-20160816; b=HDxOoxMjfSC6BlMIf7GvKlXJGBmxTBkcOOK7V7pCtc5c11m/+YeZM7e2vCVpQ0neDf /V7KX0AnhM26XGHrSbo0ca9EGTpcU5DZW0AmdaXnCd10IeRv0ileH0LzJGK2TWOuQCfH og2hVB6RF2nST0hh0SofjVbCuKK9fkSJtBsyDK+4GUu1gbtJg+zM2WApbzmyW7yMIWzn 6HqzEkE1eBjBlLdOzcN6a2LiSTNdT/4aOrwAqNWSG0avzcopT+lgfco0ika2oQyCMGrs 67W/50Vp06snF6RGOdxubpfVr+v7Ob3uAnkWkdacnpUmXSQhNNPV50hGmzNd0CpwAgsZ drNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XtDRhPPwHXNon0FrE7eUw5MG1CpN+Fr0WFNJKzq7zjw=; b=C7CZyIUBSvYM4gAR/ad+2GZKwz390lxxIUtzmG5xdQ6kWdZoql+pKvg7g7QRbT5v2o /6u3BigYW6TDSxSr09gMwjL1wR34f7PG6YTYNReDHDqrNt/JJib8+HiwOZRtdQDrpe7i d3LOrbLHk/umGC65WMyiaLEPxFBfNJQNAjDWuEr3IfXmXnXBXP71SSlo7zQyay5taDWR qGVLmPAFvW94/+CQTcM482C+XK2L+nR8vPpguo8R8ksvCw02GbCdKXDXZymH4DcNoeK/ Wey+HR1Cffj6UsXuxxa8M1Hpzoi3XZJ2ZkRoHROFCjN6O+Ic7YAEYoOwbhkIY5HRO5Jj z+Gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Pux5b9MF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id iz4-20020a170902ef8400b00186b1bb14a0si1623637plb.559.2022.10.24.05.48.13; Mon, 24 Oct 2022 05:48:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Pux5b9MF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232142AbiJXMgx (ORCPT + 99 others); Mon, 24 Oct 2022 08:36:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234393AbiJXMaM (ORCPT ); Mon, 24 Oct 2022 08:30:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 837B53C8FA; Mon, 24 Oct 2022 05:04:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 44E7CB811B2; Mon, 24 Oct 2022 11:51:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A643C433C1; Mon, 24 Oct 2022 11:51:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612303; bh=7BCEeXtMurlzH+XH4KqgBzBeshKByJRUGnyql6ZfYFY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pux5b9MFpXDh8sdNarUl8RnThUQHfRzTMnPhchsATAhzV+cSJPJitmbxgyjwoB5vV Brp2gu1+ZZlUcrlPmdpT6iomLZB1GFxRofuJvn/jtps3CU3z95gPatNL7rHsebG23r YMZVWTcpzGaKtsmFjtf7Nn/OdSY2aAOXKRhXv8dQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Jiang , Vinod Koul , Sasha Levin Subject: [PATCH 4.14 147/210] dmaengine: ioat: stop mod_timer from resurrecting deleted timer in __cleanup() Date: Mon, 24 Oct 2022 13:31:04 +0200 Message-Id: <20221024113001.743869123@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573235257253307?= X-GMAIL-MSGID: =?utf-8?q?1747573235257253307?= From: Dave Jiang [ Upstream commit 898ec89dbb55b8294695ad71694a0684e62b2a73 ] User reports observing timer event report channel halted but no error observed in CHANERR register. The driver finished self-test and released channel resources. Debug shows that __cleanup() can call mod_timer() after the timer has been deleted and thus resurrect the timer. While harmless, it causes suprious error message to be emitted. Use mod_timer_pending() call to prevent deleted timer from being resurrected. Fixes: 3372de5813e4 ("dmaengine: ioatdma: removal of dma_v3.c and relevant ioat3 references") Signed-off-by: Dave Jiang Link: https://lore.kernel.org/r/166360672197.3851724.17040290563764838369.stgit@djiang5-desk3.ch.intel.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/ioat/dma.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c index 4c2b41beaf63..6f167a082832 100644 --- a/drivers/dma/ioat/dma.c +++ b/drivers/dma/ioat/dma.c @@ -654,7 +654,7 @@ static void __cleanup(struct ioatdma_chan *ioat_chan, dma_addr_t phys_complete) if (active - i == 0) { dev_dbg(to_dev(ioat_chan), "%s: cancel completion timeout\n", __func__); - mod_timer(&ioat_chan->timer, jiffies + IDLE_TIMEOUT); + mod_timer_pending(&ioat_chan->timer, jiffies + IDLE_TIMEOUT); } /* microsecond delay by sysfs variable per pending descriptor */ @@ -680,7 +680,7 @@ static void ioat_cleanup(struct ioatdma_chan *ioat_chan) if (chanerr & (IOAT_CHANERR_HANDLE_MASK | IOAT_CHANERR_RECOVER_MASK)) { - mod_timer(&ioat_chan->timer, jiffies + IDLE_TIMEOUT); + mod_timer_pending(&ioat_chan->timer, jiffies + IDLE_TIMEOUT); ioat_eh(ioat_chan); } } @@ -872,7 +872,7 @@ static void check_active(struct ioatdma_chan *ioat_chan) } if (test_and_clear_bit(IOAT_CHAN_ACTIVE, &ioat_chan->state)) - mod_timer(&ioat_chan->timer, jiffies + IDLE_TIMEOUT); + mod_timer_pending(&ioat_chan->timer, jiffies + IDLE_TIMEOUT); } void ioat_timer_event(unsigned long data) From patchwork Mon Oct 24 11:31:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8696 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422616wru; Mon, 24 Oct 2022 05:23:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6jQ6S2Z/R+I13xh648kY+QWoNrjcCvapHMhMrzDCNfBBpL/WqXbikJFq8tZsBqfRU09Hyr X-Received: by 2002:a05:6402:538a:b0:457:b602:d5a6 with SMTP id ew10-20020a056402538a00b00457b602d5a6mr30621522edb.371.1666614185966; Mon, 24 Oct 2022 05:23:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614185; cv=none; d=google.com; s=arc-20160816; b=ZxMgOb1A8TDA+k5X/SBfS9wwOYAP2AqxqNaSzvpXYbCzqTS9zsuVgo79x+EvgOOo3z BVjofA1laRRZsdiFtgqTEp6Rfc/XTdHFQOoYJfsrxMxTjaT7ogQ8h5J+aHSJHUZ487ha dZAdgD+6Oi7Fr+9Rqmw6s6jmIowrQjxmizGZHtNRZggUqwFlt5cv2HEZDdDu+Cio2XJ0 tOqAsh4xTcpo8GpyykoUCAfPrfkvJ0WzIlpi6LWVGNCo+umVvsJSH6m50eMUZ+sW2tMf poe6h6K4A86VWeaJIUNBKXQRMyrm4UeNAj44UT1NhW2Ih20aEwaTwh73rVa1AQkADrBm J8uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZuEVKckTcaCNkTtpL58NJaZGpCNwVdESDVf350rLaAo=; b=lA2VBBMAjqCdP+rM7k83QoEQpUspcAjIiBR1TYocw+5GXdL1sgoQXv91ZNKKlZa/vS Z8+nv3o1NhBt0r6RXAMB9KtNSXkXjDzrRXZcdGA6FeiWZhBCtpVZfltzfRQRCbE97/0X s6tNt3BPmemSamjLaK59Ui6Q/iLah1QDVb67E192xoMm0lNgLlmhyomRUNBiwRriSeUA t912l2J3gqHkhimxMeC2SeVVKdlhTRx69JmUCEdXX79jfyUuXISyj8hfiMzCbgJAsVj/ tN4ooRWyQz8otS9ekmApkFh0Bol6XB/OCvBQG+JBSbEzvSDmt8CPabw3Zz2VZAKJmEYG R40g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fucp+aCT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hu9-20020a170907a08900b007a09ffe2278si6963080ejc.359.2022.10.24.05.22.41; Mon, 24 Oct 2022 05:23:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fucp+aCT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233270AbiJXMUz (ORCPT + 99 others); Mon, 24 Oct 2022 08:20:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233386AbiJXMTU (ORCPT ); Mon, 24 Oct 2022 08:19:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBCB082D19; Mon, 24 Oct 2022 04:58:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4E16B612A4; Mon, 24 Oct 2022 11:51:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36C2BC433C1; Mon, 24 Oct 2022 11:51:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612305; bh=OFe+RVcm/duytjcmCEfORAPp9ogoeTNcHx8fd2aVeYI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fucp+aCTDz1wn7PMKuCKr9ax0oPOfMFIc/tfHNdqQYgVJQl2VJxPPVVQuHp4rQRjw OHEZqlwWYqnjVvoq5UsECnOJP1qNF2AhzjhJJYrAxJA1dcxP015xQ9fcIthlIJmChD l9CcRHUzXg1YNBic9kqgJUBkNNKoaCLHAu4MTack= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Collins , Fenglin Wu , Stephen Boyd , Sasha Levin Subject: [PATCH 4.14 148/210] spmi: pmic-arb: correct duplicate APID to PPID mapping logic Date: Mon, 24 Oct 2022 13:31:05 +0200 Message-Id: <20221024113001.783345527@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571636421925991?= X-GMAIL-MSGID: =?utf-8?q?1747571636421925991?= From: David Collins [ Upstream commit 1f1693118c2476cb1666ad357edcf3cf48bf9b16 ] Correct the way that duplicate PPID mappings are handled for PMIC arbiter v5. The final APID mapped to a given PPID should be the one which has write owner = APPS EE, if it exists, or if not that, then the first APID mapped to the PPID, if it exists. Fixes: 40f318f0ed67 ("spmi: pmic-arb: add support for HW version 5") Signed-off-by: David Collins Signed-off-by: Fenglin Wu Link: https://lore.kernel.org/r/1655004286-11493-7-git-send-email-quic_fenglinw@quicinc.com Signed-off-by: Stephen Boyd Link: https://lore.kernel.org/r/20220930005019.2663064-8-sboyd@kernel.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/spmi/spmi-pmic-arb.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c index 360b8218f322..0eb156aa4975 100644 --- a/drivers/spmi/spmi-pmic-arb.c +++ b/drivers/spmi/spmi-pmic-arb.c @@ -867,7 +867,8 @@ static int pmic_arb_read_apid_map_v5(struct spmi_pmic_arb *pmic_arb) * version 5, there is more than one APID mapped to each PPID. * The owner field for each of these mappings specifies the EE which is * allowed to write to the APID. The owner of the last (highest) APID - * for a given PPID will receive interrupts from the PPID. + * which has the IRQ owner bit set for a given PPID will receive + * interrupts from the PPID. */ for (i = 0; ; i++, apidd++) { offset = pmic_arb->ver_ops->apid_map_offset(i); @@ -890,16 +891,16 @@ static int pmic_arb_read_apid_map_v5(struct spmi_pmic_arb *pmic_arb) apid = pmic_arb->ppid_to_apid[ppid] & ~PMIC_ARB_APID_VALID; prev_apidd = &pmic_arb->apid_data[apid]; - if (valid && is_irq_ee && - prev_apidd->write_ee == pmic_arb->ee) { + if (!valid || apidd->write_ee == pmic_arb->ee) { + /* First PPID mapping or one for this EE */ + pmic_arb->ppid_to_apid[ppid] = i | PMIC_ARB_APID_VALID; + } else if (valid && is_irq_ee && + prev_apidd->write_ee == pmic_arb->ee) { /* * Duplicate PPID mapping after the one for this EE; * override the irq owner */ prev_apidd->irq_ee = apidd->irq_ee; - } else if (!valid || is_irq_ee) { - /* First PPID mapping or duplicate for another EE */ - pmic_arb->ppid_to_apid[ppid] = i | PMIC_ARB_APID_VALID; } apidd->ppid = ppid; From patchwork Mon Oct 24 11:31:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8606 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419706wru; Mon, 24 Oct 2022 05:16:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4hdz7EvVFjTzX8XXzss1TeJLiknvThkhQ/TUvbw1nh8t1scrdsb92LbS//9jJ9y12XY+HV X-Received: by 2002:a17:907:7607:b0:78d:66e8:c746 with SMTP id jx7-20020a170907760700b0078d66e8c746mr27596644ejc.220.1666613806595; Mon, 24 Oct 2022 05:16:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613806; cv=none; d=google.com; s=arc-20160816; b=iiq0gpmbY9irX57vY/aj9OgoV3r09OIpG98/YywZdH5hDRcqh4MHwQ5djkns4A+2Hn xaO3aHJ4Rt4t8NROWEGHkvtOvjvoqY6sfN/OvY27jeK3U+ihEoPzJP3NnUe3IxIhCL6g GxsAuMO8G4axvw/adZuHB0jQWr0l/wtu/twe422F/jzWJcswKx5iXLq0M8d3Hz+bPzXz ERw6UyWeyjEuDT+w6D6dzw3TdvI3eK8xF8F+c1TcNaD/BfkuhXgtA+pAjftgjeoWf4zM mVDeqbwlGzDoZ0FOpgNM3dkXXxVWpLCVRL2FUFC2C313VR8c1KkMGejR9fpG8MJVge3g XVOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/rv3neag2Ze/01MwzuR6DNPAKJM7xkaiP+3kpSDD3Qk=; b=IA2exPFGmZ0Trm64e1J/dyWM8v6NuFFYNal0T/CC85WiNTVWz/ofxvDXgseQcjBXr2 hMeGscpj1nqv/8hol7lOIdJqvgzrSrl4vdJX5QpsU8kUr3SHBXRWh7EBlLN7NhwmewxQ 4CON3/W/98oShvIDCznpC6tceocLqRnGUtjh2R1TYzp2e1twR2RAy//bgWWp2gO3ediY umrwW2KIIuR7Uux6UP9L1098r0BHZZvPMDylATmYvYoSUFNl3HTrpsOFQ6G9MHQSeUTT UtIIEeMxGr4496LnY+b1mbG2z5vNu9TahpbCZ1yL3IyRj/+z1ntpBbW3CjH+75rFwxZL Z9ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="J6/sLLx/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id du12-20020a17090772cc00b007aa3373e7fesi1021211ejc.520.2022.10.24.05.16.22; Mon, 24 Oct 2022 05:16:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="J6/sLLx/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230351AbiJXMIs (ORCPT + 99 others); Mon, 24 Oct 2022 08:08:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232717AbiJXMHC (ORCPT ); Mon, 24 Oct 2022 08:07:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 543657E825; Mon, 24 Oct 2022 04:51:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E1993612BB; Mon, 24 Oct 2022 11:51:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0257C433D6; Mon, 24 Oct 2022 11:51:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612308; bh=d9UGACqchgTVt9QM+LfeOMJn5Ue0zcjSQFeX0MyUg+I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J6/sLLx/st9288usTyPbuFLr3YpwmynNCfuSbQe/yFh9zh6ScFTHW16R1JYHcztNj TGTU+QkyM1NLdDwKG6RJXVCJAriOCr+WfVymQ3Z0Rx2p5rHdKWh3a7QB8ZbyTEAqdt owc6edM5r03eXbD3idApmJAz0pvcTT+w+GALMiHU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Wahren , "Ivan T. Ivanov" , Florian Fainelli , Stephen Boyd , Sasha Levin Subject: [PATCH 4.14 149/210] clk: bcm2835: fix bcm2835_clock_rate_from_divisor declaration Date: Mon, 24 Oct 2022 13:31:06 +0200 Message-Id: <20221024113001.813660149@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571238538133746?= X-GMAIL-MSGID: =?utf-8?q?1747571238538133746?= From: Stefan Wahren [ Upstream commit 0b919a3728691c172312dee99ba654055ccd8c84 ] The return value of bcm2835_clock_rate_from_divisor is always unsigned and also all caller expect this. So fix the declaration accordingly. Fixes: 41691b8862e2 ("clk: bcm2835: Add support for programming the audio domain clocks") Signed-off-by: Stefan Wahren Link: https://lore.kernel.org/r/20220904141037.38816-1-stefan.wahren@i2se.com Reviewed-by: Ivan T. Ivanov Reviewed-by: Florian Fainelli Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/bcm/clk-bcm2835.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c index 8ccd72cc66ba..be217c876e25 100644 --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c @@ -984,9 +984,9 @@ static u32 bcm2835_clock_choose_div(struct clk_hw *hw, return div; } -static long bcm2835_clock_rate_from_divisor(struct bcm2835_clock *clock, - unsigned long parent_rate, - u32 div) +static unsigned long bcm2835_clock_rate_from_divisor(struct bcm2835_clock *clock, + unsigned long parent_rate, + u32 div) { const struct bcm2835_clock_data *data = clock->data; u64 temp; From patchwork Mon Oct 24 11:31:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8623 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp420319wru; Mon, 24 Oct 2022 05:17:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM73VS0IBkwBK1/mR457d5jjAY43w0/lsYTDONfcC7PNwSRT6XVQevNOtGV6ABfW+b+TEBip X-Received: by 2002:aa7:c04f:0:b0:457:1b08:d056 with SMTP id k15-20020aa7c04f000000b004571b08d056mr31742975edo.146.1666613878903; Mon, 24 Oct 2022 05:17:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613878; cv=none; d=google.com; s=arc-20160816; b=ePwY217iDB9Y68E7y8gxvKiNc/kMpQWs2kk5bYBNguvctWdtaR3z3WGZYwmM1NBTsg wrj+KJCiabUvyH/lMjU2iJLs6C+2bklEVBCy47IQXyqoallsfHONDuq/1+c5ev7mSMHg S+jnsPxALtAp6To8qKSakt7AcytWxCZLr2qKN7zkLCEVsaExqNtpSvX69XIfn55V5rfk AmtlSpkY9U97B6m3QGunyWsIWvUruiutZTZxjwZ/0Q82zQTT3ZVffjxwTIQNDt/umJz6 Xa30lm2n16apM3bCnwMMFvQiyv97LbjCodqxgOyFPEB25WZyiZ4iXzift84QTJQTVA2+ +BRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zxz2aFx3qD3JbKa/GPaw/tyif26U2V5X9sHZVfTfK/Q=; b=WAiguYWCBosJtwaLTPYeKFoInIYhEcM8bvRN9N2NBdmAXwnj/uKQBgC0YMm6tZlZyg N1HsRObjvxbCyprEnrMiwSafG/cd2eBThLMhIpNUcV4W5iSNqHYw9SWOlbnNtsli0D7M Iw+f/mpLNbrnFyQhbE+9ogHlsgVigdnK2q0/hPa3+OVHZMOIQZhwovDq5VV/cDpKJ9+W asiqBnbe5X4ZF+XZQ0qFASO6h1F3Ki6hhLptmM0Bs9pFFv4Y2tExyHf9rzqjQfgIf3Ue Vvf7ZJxrsYSWHadDFA4WMS7fWOEwimDwTCuWYhYloD2VWooo2qAbHCng7ib6EHnetUsf fPUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ORiidTyu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dp20-20020a170906c15400b0073da0ce043csi30805436ejc.619.2022.10.24.05.17.34; Mon, 24 Oct 2022 05:17:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ORiidTyu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232819AbiJXMLG (ORCPT + 99 others); Mon, 24 Oct 2022 08:11:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233133AbiJXMJq (ORCPT ); Mon, 24 Oct 2022 08:09:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED09B7FE56; Mon, 24 Oct 2022 04:53:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 308FDB811BD; Mon, 24 Oct 2022 11:51:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8830EC433D7; Mon, 24 Oct 2022 11:51:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612310; bh=rJmvJX1Yd+VCFEKraff9jIv/6wTZs/svtd+hRJMqLjc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ORiidTyuUdxkJEFguaQY6akdLgOTFhZlCsYVP/OPWQYYFyKFw41bP+awILNwmS/2s 1Ex5AifMtb1KVecW+T0J8+U3Dv93Eu9OVQZK7xVbW5sOze0BScz6ZkUWa6PjePT+Ap lGbacPB1HPYsgTntP604Q2bTq6zacU67wWyiLu3Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Tony Lindgren , Stephen Boyd , Sasha Levin Subject: [PATCH 4.14 150/210] clk: ti: dra7-atl: Fix reference leak in of_dra7_atl_clk_probe Date: Mon, 24 Oct 2022 13:31:07 +0200 Message-Id: <20221024113001.843666014@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571314564760694?= X-GMAIL-MSGID: =?utf-8?q?1747571314564760694?= From: Miaoqian Lin [ Upstream commit 9c59a01caba26ec06fefd6ca1f22d5fd1de57d63 ] pm_runtime_get_sync() will increment pm usage counter. Forgetting to putting operation will result in reference leak. Add missing pm_runtime_put_sync in some error paths. Fixes: 9ac33b0ce81f ("CLK: TI: Driver for DRA7 ATL (Audio Tracking Logic)") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220602030838.52057-1-linmq006@gmail.com Reviewed-by: Tony Lindgren Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/ti/clk-dra7-atl.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/clk/ti/clk-dra7-atl.c b/drivers/clk/ti/clk-dra7-atl.c index beb672a215b6..a4b6f3ac2d34 100644 --- a/drivers/clk/ti/clk-dra7-atl.c +++ b/drivers/clk/ti/clk-dra7-atl.c @@ -252,14 +252,16 @@ static int of_dra7_atl_clk_probe(struct platform_device *pdev) if (rc) { pr_err("%s: failed to lookup atl clock %d\n", __func__, i); - return -EINVAL; + ret = -EINVAL; + goto pm_put; } clk = of_clk_get_from_provider(&clkspec); if (IS_ERR(clk)) { pr_err("%s: failed to get atl clock %d from provider\n", __func__, i); - return PTR_ERR(clk); + ret = PTR_ERR(clk); + goto pm_put; } cdesc = to_atl_desc(__clk_get_hw(clk)); @@ -292,8 +294,9 @@ static int of_dra7_atl_clk_probe(struct platform_device *pdev) if (cdesc->enabled) atl_clk_enable(__clk_get_hw(clk)); } - pm_runtime_put_sync(cinfo->dev); +pm_put: + pm_runtime_put_sync(cinfo->dev); return ret; } From patchwork Mon Oct 24 11:31:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10022 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp622190wru; Mon, 24 Oct 2022 12:44:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6X+keWrkzP+yhqNGmayzkZuKjwkjdw3uhoGImL/UUcz38jeUeQyLG0eiHDuXWSOEtyIDys X-Received: by 2002:a17:906:7314:b0:791:a45a:bc84 with SMTP id di20-20020a170906731400b00791a45abc84mr27568354ejc.394.1666640697293; Mon, 24 Oct 2022 12:44:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640697; cv=none; d=google.com; s=arc-20160816; b=o2cyxeCnVhxPEM/xRxwyFB8kUqiTPlxHICxA5lQxssn7wH4BakAgBeKQH39f9UcQao doo6HUmbUSHoPZr1rqJDHykKcyyrv3yk5hPlbpRsCwBxcJC2z+2/EWSLGyfBfa7a6Zvd bqI25/nmrQsUNphUJbV3m3Oa3THovj8yHYAffmXPXKvT/cfWZrcY9IsFnxnJiEYg1Qhr tmdJ1x2t/pdf0baDVPbMnOBeaUHYAxdhEz0Qv79h31LqkuAY9jDQG3p0vP2MUaosWoTw 2x4itkuwaaHcrPvtlrDfwcx0bIl5B3jFK9Qb8CejkKACHMid5q0Q/twn5hZL23kjsTjZ nsGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uSFB3aBODyBJFeKCkatp4CUz4+yGjhblmz/g6pjLf/E=; b=BZcJTwlILvq//V+felmutSVIz88XaMBpUN5jQ7Xx1OoS3U3L4rLhCm+vQy3CarhI0C q9YaPCUVp95k6/2HRnbs0R2fibIdVfvJxV6LC/Gg1kvEy9/WMX+PEdf0Q7Vv7HKGAtJQ 45wy6UNu/5mnpplVeoeJIx5GHmiJmbHWMgLIxWjpwiHOV1ss4OFxYRCavs/voh3kV7AH PC33K14j7Cl6OwcGHClrhnsOUCO1DXP7rEr19o5ugvVbw/LeaonLBP/KDSwKkBdIdbt+ FV/PgiijA1aNmWXhBmawLIIWaWSf4m+WLQAF1LETp/WVmUeaKgNMUQOeamaVP2Oxv8Jn mN0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0wkMbXof; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm5-20020a170907948500b00791a5f0b140si502995ejc.993.2022.10.24.12.44.32; Mon, 24 Oct 2022 12:44:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0wkMbXof; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232949AbiJXTjz (ORCPT + 99 others); Mon, 24 Oct 2022 15:39:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233628AbiJXTjZ (ORCPT ); Mon, 24 Oct 2022 15:39:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C509C7C1CA; Mon, 24 Oct 2022 11:09:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BFC0DB81197; Mon, 24 Oct 2022 11:51:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21FC0C433C1; Mon, 24 Oct 2022 11:51:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612313; bh=J90OA6eZTp0oGiLkAzqf0xGHHm4dRJ2CBpHn1NUQH+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0wkMbXofebdSr1SITsyd4e1zCXhLB0keUkH7clTXjMderfJgdoL3nEWxw1wkd/TtH blO0y2wYO4WL/h8+2XzG7clx+CSRMJDs1hvFXoh5+4u3c9W8KmhdHl1oP3ZMVtm1kW /BZVVlYt1It2YWz19cKM/GbPj0Ap1+o74MmlIpkM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jack Wang , Jassi Brar , Sasha Levin Subject: [PATCH 4.14 151/210] mailbox: bcm-ferxrm-mailbox: Fix error check for dma_map_sg Date: Mon, 24 Oct 2022 13:31:08 +0200 Message-Id: <20221024113001.874873699@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747599435790335963?= X-GMAIL-MSGID: =?utf-8?q?1747599435790335963?= From: Jack Wang [ Upstream commit 6b207ce8a96a71e966831e3a13c38143ba9a73c1 ] dma_map_sg return 0 on error, fix the error check, and return -EIO to caller. Fixes: dbc049eee730 ("mailbox: Add driver for Broadcom FlexRM ring manager") Signed-off-by: Jack Wang Signed-off-by: Jassi Brar Signed-off-by: Sasha Levin --- drivers/mailbox/bcm-flexrm-mailbox.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/mailbox/bcm-flexrm-mailbox.c b/drivers/mailbox/bcm-flexrm-mailbox.c index 7e3ed2714630..6e5d59f40a18 100644 --- a/drivers/mailbox/bcm-flexrm-mailbox.c +++ b/drivers/mailbox/bcm-flexrm-mailbox.c @@ -626,15 +626,15 @@ static int flexrm_spu_dma_map(struct device *dev, struct brcm_message *msg) rc = dma_map_sg(dev, msg->spu.src, sg_nents(msg->spu.src), DMA_TO_DEVICE); - if (rc < 0) - return rc; + if (!rc) + return -EIO; rc = dma_map_sg(dev, msg->spu.dst, sg_nents(msg->spu.dst), DMA_FROM_DEVICE); - if (rc < 0) { + if (!rc) { dma_unmap_sg(dev, msg->spu.src, sg_nents(msg->spu.src), DMA_TO_DEVICE); - return rc; + return -EIO; } return 0; From patchwork Mon Oct 24 11:31:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8889 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433646wru; Mon, 24 Oct 2022 05:50:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM61MfxlnvtgsSKX1PpXI+HbayZa9RvQAoTdCU3hhXaBa7FiuPhpQoRaFIS0C85S9a3OxOaH X-Received: by 2002:a17:906:2699:b0:781:a473:9791 with SMTP id t25-20020a170906269900b00781a4739791mr27631246ejc.644.1666615806307; Mon, 24 Oct 2022 05:50:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615806; cv=none; d=google.com; s=arc-20160816; b=hHIZOYxXJI1YSArAvF6+Sg24aGLP4PXDDj6LIwvwS8Y7lOyXKU6oFmX/cnoieS7+Sv MXAU5r6BxY4AiILBJsv4sq3mUPkq5X6b1+f09qJxBX9NwVJEV6+LZ7t7vtaHCyeY+hxt 3Z4xOLxNxOzqZvd4ZI1WAxCeM4WVYUYeCAoxiQUXCwDmWpKciOF5caDpMlO2nNQ2PrHI gI9lwNY5/GOu8n85m06WOOSMKG0IpGPz58MiyR1kJYlDzaDwbx6cqM5GYNJzYUNacloa q6yi4IBiBtr86GUzTEFs8ALC/2B4okmIk6NO1FsLZy703605QDm7Zqo+R0Rulk9L+dcJ SMSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+gofdmkVWc1mrbU+lr1LvAr0n8i1COhujW2Mp619q04=; b=MScMfOm5gx2i90qg9N//EypnBXdVT5xGYW66ZKGCRTwMPJk0KMhEhZgUHthhM4+S8v fOAG0sDZQlxI2OSeDC8litV8ZNsVC6t6geAhfpnFeQk/I0s99HtKSmWH53vgLVTa7Mnw MWBz6pYCSaQXct6fM/7Az76BItOQ9FmZvDQlafbGp2Pjjg5MzML6O9Nz9rqIu181NJDj 9y32A3SvF8ldXMiIJY8PZyHrBrbZSRjH0+91rrT21LSolA2gpvFT4jCCjw7k3ZNR38Ps CVaAVxVyqPE3Y+G3o+kkswQJC+RfNOS1CN9TO11mJV3L37y85uQ9jyrsPPo7INSBP6oa 3/Nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sciuVf8B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm10-20020a05640222ca00b0046154884604si8023528edb.482.2022.10.24.05.49.41; Mon, 24 Oct 2022 05:50:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sciuVf8B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234121AbiJXMr6 (ORCPT + 99 others); Mon, 24 Oct 2022 08:47:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232090AbiJXMmy (ORCPT ); Mon, 24 Oct 2022 08:42:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 657237E80C; Mon, 24 Oct 2022 05:08:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9DFFB6125D; Mon, 24 Oct 2022 11:51:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3AF4C433C1; Mon, 24 Oct 2022 11:51:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612316; bh=erAD5uHFs99vtk9Q9Iu4F3CHrxzngC84yqaARqMsmBg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sciuVf8BEpSCfWQ4Eo69Ag+bt8mgCnrgyEtYa5xYP+ZARe/lnSB0s1LKBYijz37Uw qsnp6prVb6RgZJj8aA3Oa9nC4ArfTE6T0MZFfZUwqgx0s2Lu4H/3sHGGQotdWEEM2B qKS36GxDwgNfvd+il+kmICA59xysQxiSgxOMDBrY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Nathan Chancellor , Christophe Leroy , Michael Ellerman , Sasha Levin Subject: [PATCH 4.14 152/210] powerpc/math_emu/efp: Include module.h Date: Mon, 24 Oct 2022 13:31:09 +0200 Message-Id: <20221024113001.909695419@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573335804662441?= X-GMAIL-MSGID: =?utf-8?q?1747573335804662441?= From: Nathan Chancellor [ Upstream commit cfe0d370e0788625ce0df3239aad07a2506c1796 ] When building with a recent version of clang, there are a couple of errors around the call to module_init(): arch/powerpc/math-emu/math_efp.c:927:1: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int] module_init(spe_mathemu_init); ^ int arch/powerpc/math-emu/math_efp.c:927:13: error: a parameter list without types is only allowed in a function definition module_init(spe_mathemu_init); ^ 2 errors generated. module_init() is a macro, which is not getting expanded because module.h is not included in this file. Add the include so that the macro can expand properly, clearing up the build failure. Fixes: ac6f120369ff ("powerpc/85xx: Workaroudn e500 CPU erratum A005") [chleroy: added fixes tag] Reported-by: kernel test robot Signed-off-by: Nathan Chancellor Signed-off-by: Christophe Leroy Signed-off-by: Michael Ellerman Reviewed-by: Christophe Leroy Link: https://lore.kernel.org/r/8403854a4c187459b2f4da3537f51227b70b9223.1662134272.git.christophe.leroy@csgroup.eu Signed-off-by: Sasha Levin --- arch/powerpc/math-emu/math_efp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/math-emu/math_efp.c b/arch/powerpc/math-emu/math_efp.c index 581f404caa1d..b9848179dbaa 100644 --- a/arch/powerpc/math-emu/math_efp.c +++ b/arch/powerpc/math-emu/math_efp.c @@ -21,6 +21,7 @@ #include #include +#include #include #include From patchwork Mon Oct 24 11:31:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8627 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp420426wru; Mon, 24 Oct 2022 05:18:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ZUWxF1biDGENiyqr5WCclbJ1GgwDsx7iAHWQByibGRDoi2LfLjBuiiy9CJWqB2lXCfww4 X-Received: by 2002:a17:907:2c67:b0:78d:49d2:6297 with SMTP id ib7-20020a1709072c6700b0078d49d26297mr28230111ejc.21.1666613890305; Mon, 24 Oct 2022 05:18:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613890; cv=none; d=google.com; s=arc-20160816; b=fb7UhP7HiJwIgwGrJxcA/pjtaSpo2JzmnPxqr1vU/1iooSFjkakuhvggZotbL8RuPl UaPKfyMDND5f0alwHkPue353SBoVy3F8iGYSIidWWnkD5q8cQnj6y5KhZCeU1P1OWYrD 2Z3gDGikbyPf3Foit2LX1XdpYdiWv4ZKN6BT7BOJSZGkI2EzpjkSZX86vkMxwjcMPMuQ tH8j5ZKqzlSvuN2cR+SJAhnPqKOhfCuAxf3ZtO+HDucBzDTeyvA1Mf73nqaeMF1NCRgg HLpByzjcgYT/U8Eiy6fjZLImb2/mC9MM9emn0nZ5QGQqycwEDO4ksq3F3zgKo+j6lnAs h7Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wtwZaoxzq9yFJ4a5aZxYsJkqw6mHkDLzX9xaqLsA6wQ=; b=dZHorewx9bu+GHqQbW43Ggx/LkRzzMFH88jHxiVP8gzpcjlrdFakQ4cwjyw59fjUkl IWsfHNFFdXdlbuL1cgxADvSPHqye++AI7vYr4I1OaxNlf3Q7aV8Km49D6jc3dZb9xf7z cntxbsObRc+dXyC1vyplMVw/1I4NR3Sl271dbwqnYwqF+ri3JxeyzEQRT29kq3ob142h xBPC26L1gGZetl9rF666mce4kHhQfZOzqRtt5/ZXWBrXaxnjPORzX2UFxoDrX/AU9akH SJwTv2DGyUos0LkS6Kqy5CTYxOSDX3qvtczl4FAcOnJX2iCpx0cEcuEmKYmFJYuyoL2r iUWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oWAQ50bN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qa43-20020a17090786ab00b00782b261ea1asi27263956ejc.67.2022.10.24.05.17.46; Mon, 24 Oct 2022 05:18:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oWAQ50bN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232810AbiJXMLk (ORCPT + 99 others); Mon, 24 Oct 2022 08:11:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232502AbiJXMKI (ORCPT ); Mon, 24 Oct 2022 08:10:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E79D27FE75; Mon, 24 Oct 2022 04:53:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9B066B81134; Mon, 24 Oct 2022 11:52:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE69CC433D7; Mon, 24 Oct 2022 11:52:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612321; bh=sRESwLM37kyav1ZqzHsIQQZE1DF/iVdBz1Bgkyw1Cks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oWAQ50bNlRCfMJ4Amc9d0nytI0dYYrIyAWfQYrBytPdf1MZth4773Wo8lg5Ucn+qa FtoBRYyzUxvXp/GVdbWqoFWgMrPh9E5lOaXgFmAQ4btBg9DHa+aSOyGMRPBTZcdW4u Oqcksvs1O32qx8yFKohxr57GL4zp9Kl50r6F2IwM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Michael Ellerman , Sasha Levin , Miaoqian Lin Subject: [PATCH 4.14 153/210] powerpc/sysdev/fsl_msi: Add missing of_node_put() Date: Mon, 24 Oct 2022 13:31:10 +0200 Message-Id: <20221024113001.943630984@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571326788758021?= X-GMAIL-MSGID: =?utf-8?q?1747571326788758021?= From: Liang He [ Upstream commit def435c04ee984a5f9ed2711b2bfe946936c6a21 ] In fsl_setup_msi_irqs(), use of_node_put() to drop the reference returned by of_parse_phandle(). Fixes: 895d603f945ba ("powerpc/fsl_msi: add support for the fsl, msi property in PCI nodes") Co-authored-by: Miaoqian Lin Signed-off-by: Liang He Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220704145233.278539-1-windhl@126.com Signed-off-by: Sasha Levin --- arch/powerpc/sysdev/fsl_msi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c index 44cbf4c12ea1..d43d3d1b27ed 100644 --- a/arch/powerpc/sysdev/fsl_msi.c +++ b/arch/powerpc/sysdev/fsl_msi.c @@ -216,8 +216,10 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) dev_err(&pdev->dev, "node %pOF has an invalid fsl,msi phandle %u\n", hose->dn, np->phandle); + of_node_put(np); return -EINVAL; } + of_node_put(np); } for_each_pci_msi_entry(entry, pdev) { From patchwork Mon Oct 24 11:31:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8645 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421462wru; Mon, 24 Oct 2022 05:20:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Th7Jr9ansIz8FXZmhvVZ+qaq6F55wrBnQA2samTOixcajGEdwwLP/+R0nPudY8k0dHapd X-Received: by 2002:a17:90b:3847:b0:20d:c41f:de7a with SMTP id nl7-20020a17090b384700b0020dc41fde7amr57331893pjb.85.1666614024445; Mon, 24 Oct 2022 05:20:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614024; cv=none; d=google.com; s=arc-20160816; b=UHGqZugGXjkNzmWWahcCE1HmDtMGc4JDal3tcHK7I79tAwWzCbDULduFIVTfgUhKXW ANyTL9sCfiL3SEXtUo7McormVuSzCKoITIDM9KyP9CSRSG+oX58AUDU21qrK1ER0z2NY 5lBKdPzjesJ9akCWlKzOHSbbKF5IuZ66Kxxm6OPID3yoqNucrxay4mEordT7zXw20wCt LSWMb/p7e3q75pOW53+ee4C8teCQdp/3oWhLx++SAg/EvnMxumAqhtBHPrFZSRDWZj5y QBoGgKJd2ExcwOeX9d/q6yP+MdSmDmcrpl+Rf0G8VOpt1opyBqvtyVRaaXZeH/PAhX2p ciyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=auTmQHHrGSpjwcVb6FYNCYQDEc0G+haYVXxuYHl0RzI=; b=yg17yuo1PEIbCHVRxsyPIlN2KFPp/tZ/KQWtNZ3Kn+cxvvgTEdypHtR+k5bYSnxscw x7XfWkOMjoyThTrlGyMyNC5nXygMt5JUZfh+54oP1UC0COOFPhctuMbeSe22dCoES/XR qLY0d6ZDH6P5CINfWDgX7cwfXzSl/k3//McS68rH1OV868p0uunvXDqUr4jISwqxrCjb CO2U1Bd+r1iq9BYDR+NixCs6CE21kL1Fty+Bpzfku+Ot8Kezkwksn3f3w56rYoTDiDA+ b7ltO319dc1eB5GHF8Y67v2vMGeeKYDMPzHji2GkwsVOZRbetQNpbaR+yblIm0B354c5 /nLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="KqA7zQO/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g6-20020a656cc6000000b0041b7be8ef1csi34833024pgw.219.2022.10.24.05.20.10; Mon, 24 Oct 2022 05:20:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="KqA7zQO/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232866AbiJXMMU (ORCPT + 99 others); Mon, 24 Oct 2022 08:12:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232851AbiJXMLV (ORCPT ); Mon, 24 Oct 2022 08:11:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9A6A804A4; Mon, 24 Oct 2022 04:53:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 27602B81199; Mon, 24 Oct 2022 11:52:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8713DC433C1; Mon, 24 Oct 2022 11:52:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612323; bh=cVhhmhyue59m5yNPy7N779FKJdt+vjkUP23f1DN/X/E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KqA7zQO/XDhvid3CIEb8HqpV4zh++aoOhRXJhkQlZS6BtJpexIjOSDMTPrBNxxUIq RS+aoLfn+10+Dl+vNeXY6f54C/ABuZeqQOIa7vewEs/IyGv00CAQpWPfz/ruVnVW4O W0DsYlrNHUSIx45lkUu/OBQZRZOKVLvJnsIXbumM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Michael Ellerman , Tyrel Datwyler , Sasha Levin , Miaoqian Lin Subject: [PATCH 4.14 154/210] powerpc/pci_dn: Add missing of_node_put() Date: Mon, 24 Oct 2022 13:31:11 +0200 Message-Id: <20221024113001.980834175@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571467170645231?= X-GMAIL-MSGID: =?utf-8?q?1747571467170645231?= From: Liang He [ Upstream commit 110a1fcb6c4d55144d8179983a475f17a1d6f832 ] In pci_add_device_node_info(), use of_node_put() to drop the reference to 'parent' returned by of_get_parent() to keep refcount balance. Fixes: cca87d303c85 ("powerpc/pci: Refactor pci_dn") Co-authored-by: Miaoqian Lin Signed-off-by: Liang He Signed-off-by: Michael Ellerman Reviewed-by: Tyrel Datwyler Link: https://lore.kernel.org/r/20220701131750.240170-1-windhl@126.com Signed-off-by: Sasha Levin --- arch/powerpc/kernel/pci_dn.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c index 0e45a446a8c7..45aa39d55f91 100644 --- a/arch/powerpc/kernel/pci_dn.c +++ b/arch/powerpc/kernel/pci_dn.c @@ -344,6 +344,7 @@ struct pci_dn *pci_add_device_node_info(struct pci_controller *hose, INIT_LIST_HEAD(&pdn->list); parent = of_get_parent(dn); pdn->parent = parent ? PCI_DN(parent) : NULL; + of_node_put(parent); if (pdn->parent) list_add_tail(&pdn->list, &pdn->parent->child_list); From patchwork Mon Oct 24 11:31:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8848 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp432928wru; Mon, 24 Oct 2022 05:48:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6t7ubGfah/S1Dg3+taCRrBJ9I356AlXu2XR4zcoYsvaerfkR24ZexolHwZWsKBS9sQOxsx X-Received: by 2002:a05:6a00:705:b0:562:b9e1:d0e8 with SMTP id 5-20020a056a00070500b00562b9e1d0e8mr33650003pfl.0.1666615686283; Mon, 24 Oct 2022 05:48:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615686; cv=none; d=google.com; s=arc-20160816; b=R1kJwSHX30AEbz6efAoaSIETvQbsEoJse8aGy7WR3f1RoybGX6VONolgbXjsFTYaVC Xjkt2c/CZvsF1VoIUJUQgJT7xAGJaiegNda+iZiMQD3e5EpP3NvqRnpAk/fPnLSFNjMv nzsSdsZxNFQDeRCfl1wsGwclKLR+0qllGifsCLabnxEiqC+SRQiVw/UDJ5Pf676ha22H tFXDPkxlIenu9jXftNkKsgWEdB5DDHGsA6bQufUsmExP9mBaoEjnF/8p1mjAo+vBq+95 UcoDQBxiSVTOSuIg40qyQtW6Razbpmn2cSCSwH2PNm4Aj2KDzXyDoW4wS6/BjJRG6jcR SXbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LFFZIwOmgwsN4k0Ai/eKfoCNr1wQR97gikplZ4LyFmo=; b=ljxp9rwsQiX2ofwq8qyTmTmn1OYvbtgrxCMxLThMVIqh80Hfol07ecj2uk2fFNeC11 lgvF7pgC0F4FNnqv83+QdSkZUCQnn0mq7UWrvJo35BZxvcrCvX2Z53rhPyqmVl0IMJCl ujTcHpc1tlaJXbmuVdKgVVHIHr8EPYEpHO7azMyCGWJAJyqCegPycThjNgx+g0zI2A/w ezkNdrg9wZEn2EOMLZuJgsEQBfT0562U0VMpVG3tQjf97BRlaeC9bxfiKcPMQ5bzUxv0 weSTi2wHzFZ3Jx1gDVxXooM9Upa6mPNKZ6vEZlXXyUWyWRMHNvism4ZBxejnmPqBepE1 xr3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=U5CAAWGe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t18-20020a63dd12000000b004637c92ef98si37100453pgg.195.2022.10.24.05.47.48; Mon, 24 Oct 2022 05:48:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=U5CAAWGe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231626AbiJXMgp (ORCPT + 99 others); Mon, 24 Oct 2022 08:36:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234369AbiJXMaK (ORCPT ); Mon, 24 Oct 2022 08:30:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03D6E11A24; Mon, 24 Oct 2022 05:04:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C09C2B811A6; Mon, 24 Oct 2022 11:52:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2AD7DC433D6; Mon, 24 Oct 2022 11:52:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612326; bh=0lbPNCsDRrqENwaCBcpPeVLGu2TkgjKhDAEw/yHaLpw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U5CAAWGeR+YW9yPkjnbUbT3KF6bgJkueqzAeaWDCsUyVhzXNcnJThen8YIcwJl0K1 UzRqU4g2uKE7CvP2DSa+C333Nwdt5jGoZrZQKq6DHkCPjOT/SwXoMKbzvGzwBOcJLT 6dYdSU6pwkTDeThbD5gfcGNVl6ZkVqZaKUZv7y58= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheng Yongjun , Michael Ellerman , Sasha Levin Subject: [PATCH 4.14 155/210] powerpc/powernv: add missing of_node_put() in opal_export_attrs() Date: Mon, 24 Oct 2022 13:31:12 +0200 Message-Id: <20221024113002.010570901@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573210092117693?= X-GMAIL-MSGID: =?utf-8?q?1747573210092117693?= From: Zheng Yongjun [ Upstream commit 71a92e99c47900cc164620948b3863382cec4f1a ] After using 'np' returned by of_find_node_by_path(), of_node_put() need be called to decrease the refcount. Fixes: 11fe909d2362 ("powerpc/powernv: Add OPAL exports attributes to sysfs") Signed-off-by: Zheng Yongjun Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220906141703.118192-1-zhengyongjun3@huawei.com Signed-off-by: Sasha Levin --- arch/powerpc/platforms/powernv/opal.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c index 597fcbf7a39e..c8bc9accd858 100644 --- a/arch/powerpc/platforms/powernv/opal.c +++ b/arch/powerpc/platforms/powernv/opal.c @@ -677,6 +677,7 @@ static void opal_export_attrs(void) kobj = kobject_create_and_add("exports", opal_kobj); if (!kobj) { pr_warn("kobject_create_and_add() of exports failed\n"); + of_node_put(np); return; } From patchwork Mon Oct 24 11:31:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8649 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421553wru; Mon, 24 Oct 2022 05:20:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM79sKS/0vWcbWBML99Vol4Mvc6St68QC8nsTwe+nBR4TqkexvP+/mlOICb1UtSJcVfu//83 X-Received: by 2002:a17:907:3f23:b0:78e:260a:fc33 with SMTP id hq35-20020a1709073f2300b0078e260afc33mr27750816ejc.152.1666614045944; Mon, 24 Oct 2022 05:20:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614045; cv=none; d=google.com; s=arc-20160816; b=m4GZJMtODi4OjQEQcZjMfHmrY3ig2nsd8u7inKCloCRtkoMeeyeIIsz70dtJVQSh60 1yPmGlLSM0yucKjC2BiagSpwRjUA8Kond6RKB8q75cxoi9X55hwf+8jhymDv6I6QH2xl ldYDQrdh/8CEutmogoS6y+EztomlhWrlCOEa8uknbmp0xaaYYaCBdvY/UG2rElG5RxPR WtHFO+00TMzhSpmm7+6jq486Q0h8TI3ccEKm0ncLtdMndzOxlt/TjkBbnRM4NQYslxMH jnjRP/JdM5PXwK+RBR1V8RrC3XUtpVyeUsSOFFLcSiJeIqOJ4AIHM0fWEXli1ucJF1ET DKxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xfzsNIZMn1FsTC5NP+HI9wqJ48gCcqvumFHNqaeUphw=; b=SRm3lvPZZXhQPW5j1szXWz+KaAc4ttSuyhiACJ+gEz0axVKEaTxDJo5LBjIucC3Dhq 482Ap3lk1yVcs8X+A+yG0Dg043wl2uRJZsxQ76YpEtzzrpWDxi0pjH7VJtAjuEzfEYUJ c0w6g0f62elPKRpOiMebfPtBKMOGkgVm/xRQC9zH1eVBDFQz+05STH978JZ9eG8TWvnd rtBnlqsBidLjwx2OEEU6n7PGcEis+fGIz5ZXiIoRMgQfManyjXsYxXA4UzQ7H1AxR/6C +fafe8cxsgBJlOzZI/mCxd1zUMotL6+a9bqv5ch1ZXfEFUHPgTB2wE23OLTLJ48agnUa SKsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IhVgpfb1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ht21-20020a170907609500b007a7a3b40920si2653359ejc.995.2022.10.24.05.20.20; Mon, 24 Oct 2022 05:20:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IhVgpfb1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233044AbiJXMPo (ORCPT + 99 others); Mon, 24 Oct 2022 08:15:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233075AbiJXMOH (ORCPT ); Mon, 24 Oct 2022 08:14:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5361039119; Mon, 24 Oct 2022 04:55:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AC8FF61252; Mon, 24 Oct 2022 11:52:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF018C433C1; Mon, 24 Oct 2022 11:52:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612329; bh=b+dCW2i6SlbVAsvvFo6j2dv3TAz1oQHd4db67WosFHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IhVgpfb1xZYiU+MfMxCzQvV+i9ot3J7QvVj4IuzS2mwJ5kVw6Cq5RLIReCFJNT7oC NVKDLFsqaF5SemR27DUu1WtbMNxmSTQ9E2StRv3hEsyoC1/v/ExjYg5sqKCqUP9Inq YLRuiPRzXVdqHCJw2Jg8EjuuReYw+zgbnmhd6bhc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Pali_Roh=C3=A1r?= , Michael Ellerman , Sasha Levin Subject: [PATCH 4.14 156/210] powerpc: Fix SPE Power ISA properties for e500v1 platforms Date: Mon, 24 Oct 2022 13:31:13 +0200 Message-Id: <20221024113002.040725365@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571489702210122?= X-GMAIL-MSGID: =?utf-8?q?1747571489702210122?= From: Pali Rohár [ Upstream commit 37b9345ce7f4ab17538ea62def6f6d430f091355 ] Commit 2eb28006431c ("powerpc/e500v2: Add Power ISA properties to comply with ePAPR 1.1") introduced new include file e500v2_power_isa.dtsi and should have used it for all e500v2 platforms. But apparently it was used also for e500v1 platforms mpc8540, mpc8541, mpc8555 and mpc8560. e500v1 cores compared to e500v2 do not support double precision floating point SPE instructions. Hence power-isa-sp.fd should not be set on e500v1 platforms, which is in e500v2_power_isa.dtsi include file. Fix this issue by introducing a new e500v1_power_isa.dtsi include file and use it in all e500v1 device tree files. Fixes: 2eb28006431c ("powerpc/e500v2: Add Power ISA properties to comply with ePAPR 1.1") Signed-off-by: Pali Rohár Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220902212103.22534-1-pali@kernel.org Signed-off-by: Sasha Levin --- .../boot/dts/fsl/e500v1_power_isa.dtsi | 51 +++++++++++++++++++ arch/powerpc/boot/dts/fsl/mpc8540ads.dts | 2 +- arch/powerpc/boot/dts/fsl/mpc8541cds.dts | 2 +- arch/powerpc/boot/dts/fsl/mpc8555cds.dts | 2 +- arch/powerpc/boot/dts/fsl/mpc8560ads.dts | 2 +- 5 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 arch/powerpc/boot/dts/fsl/e500v1_power_isa.dtsi diff --git a/arch/powerpc/boot/dts/fsl/e500v1_power_isa.dtsi b/arch/powerpc/boot/dts/fsl/e500v1_power_isa.dtsi new file mode 100644 index 000000000000..7e2a90cde72e --- /dev/null +++ b/arch/powerpc/boot/dts/fsl/e500v1_power_isa.dtsi @@ -0,0 +1,51 @@ +/* + * e500v1 Power ISA Device Tree Source (include) + * + * Copyright 2012 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/ { + cpus { + power-isa-version = "2.03"; + power-isa-b; // Base + power-isa-e; // Embedded + power-isa-atb; // Alternate Time Base + power-isa-cs; // Cache Specification + power-isa-e.le; // Embedded.Little-Endian + power-isa-e.pm; // Embedded.Performance Monitor + power-isa-ecl; // Embedded Cache Locking + power-isa-mmc; // Memory Coherence + power-isa-sp; // Signal Processing Engine + power-isa-sp.fs; // SPE.Embedded Float Scalar Single + power-isa-sp.fv; // SPE.Embedded Float Vector + mmu-type = "power-embedded"; + }; +}; diff --git a/arch/powerpc/boot/dts/fsl/mpc8540ads.dts b/arch/powerpc/boot/dts/fsl/mpc8540ads.dts index e6d0b166d68d..b4314aa6769c 100644 --- a/arch/powerpc/boot/dts/fsl/mpc8540ads.dts +++ b/arch/powerpc/boot/dts/fsl/mpc8540ads.dts @@ -11,7 +11,7 @@ /dts-v1/; -/include/ "e500v2_power_isa.dtsi" +/include/ "e500v1_power_isa.dtsi" / { model = "MPC8540ADS"; diff --git a/arch/powerpc/boot/dts/fsl/mpc8541cds.dts b/arch/powerpc/boot/dts/fsl/mpc8541cds.dts index 9fa2c734a988..48492c621edf 100644 --- a/arch/powerpc/boot/dts/fsl/mpc8541cds.dts +++ b/arch/powerpc/boot/dts/fsl/mpc8541cds.dts @@ -11,7 +11,7 @@ /dts-v1/; -/include/ "e500v2_power_isa.dtsi" +/include/ "e500v1_power_isa.dtsi" / { model = "MPC8541CDS"; diff --git a/arch/powerpc/boot/dts/fsl/mpc8555cds.dts b/arch/powerpc/boot/dts/fsl/mpc8555cds.dts index 272f08caea92..325c817dedeb 100644 --- a/arch/powerpc/boot/dts/fsl/mpc8555cds.dts +++ b/arch/powerpc/boot/dts/fsl/mpc8555cds.dts @@ -11,7 +11,7 @@ /dts-v1/; -/include/ "e500v2_power_isa.dtsi" +/include/ "e500v1_power_isa.dtsi" / { model = "MPC8555CDS"; diff --git a/arch/powerpc/boot/dts/fsl/mpc8560ads.dts b/arch/powerpc/boot/dts/fsl/mpc8560ads.dts index 7a822b08aa35..b5fb5ae3ed68 100644 --- a/arch/powerpc/boot/dts/fsl/mpc8560ads.dts +++ b/arch/powerpc/boot/dts/fsl/mpc8560ads.dts @@ -11,7 +11,7 @@ /dts-v1/; -/include/ "e500v2_power_isa.dtsi" +/include/ "e500v1_power_isa.dtsi" / { model = "MPC8560ADS"; From patchwork Mon Oct 24 11:31:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8781 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430722wru; Mon, 24 Oct 2022 05:42:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6SCx3rD+9txy0yZP4/yHX8rMlozrHnwN34ZtIGE1KIzb6CwFhTNZ3EC/xAfhJHISohsxgN X-Received: by 2002:a05:6a00:80e:b0:563:4ad2:9d39 with SMTP id m14-20020a056a00080e00b005634ad29d39mr33536724pfk.66.1666615329768; Mon, 24 Oct 2022 05:42:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615329; cv=none; d=google.com; s=arc-20160816; b=ZbBayDNm+tXLDQeS1326Lc/gOS8GhPdXQOyzGaDEwnVdDI6zqQKI26sWZanmFLPYyS kptn8gLHCFOPlipzyYkeO04dR9EyCIAbblOcuKZ1/fk7SOPOWx1EWca+T2c4YWfaCQ8m rK5nMFlYCfb6KufZ2Z3yQ/IqXdhUEcAYrzgdAbe5gBlzFYD+S8urs8J5fyuPHIZ8Bogh D4qLJzI1gtBecXnzyIQr9gU1Dnwqp7gK6hYohUNnuJl9o54NAMQQcOV9aMQHDeEHwqxt vnKk5gVbLvsT2iAqtW73f2sZ1NrdEZZFnq8us6o/VRHML0bW3YLS8dG5QCZQBnneJQVb teiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WeHYePugxGs9gQOjoxAM3s7tFisdkeMS3AyP+ihM314=; b=k9AN3fz5TxCyPE7uPyWKXMuFPEaIuz5oo5IoWkavEuTyBekNdyhDU/fC12doBkRgrr BzP0RdAB4Rz3MHwnX5gFkC6v10hCgQRSb5g+dEaXvqg/fwQExNVptKdFVVsZNvaCc2Nt Ac20GB9AOvJiduLENfAo66jycGbU3SyXi5Lhk6eAlRVjlfDATnLMEmNUTiP/soCOcOn5 T36IENDcspyLEVxd3QAeT7VBKee+ox9BsBcSs2HrRgReJNldRLmbFrgjqqGEV9geWliL ye2fbIGOEDrYc/a5RAmqAupG1Mf41IK+6uxWPezvRGcTtbgOuAAKGtA2E2nEAfw20Rro mP9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Pel7MsoB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ng10-20020a17090b1a8a00b0020d2d8c9a84si18053493pjb.137.2022.10.24.05.41.54; Mon, 24 Oct 2022 05:42:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Pel7MsoB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234039AbiJXMcx (ORCPT + 99 others); Mon, 24 Oct 2022 08:32:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234001AbiJXM3K (ORCPT ); Mon, 24 Oct 2022 08:29:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0114887FBF; Mon, 24 Oct 2022 05:03:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4E599612C4; Mon, 24 Oct 2022 11:52:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64F93C433D6; Mon, 24 Oct 2022 11:52:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612331; bh=oyLbuAvGHpzGiRHM5PDQER02O7OkAB/aDBnlGorzYC8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pel7MsoBY88CfxhsUOozHg2vE8lBkYC+oVEALgkBWBhUpuMwbIRoLlhy4JMnipMFz dcZnuKtAyIZC0OIPtGbmXqj51A2VUuuIZR80lik812ff5AtWGzjBdRWssjX+DiOoLD OBFEVc3lpp5DXClx0ycVg1yt/udkf+e8zUCzsnZw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Robin Murphy , Laurent Pinchart , Joerg Roedel , Sasha Levin Subject: [PATCH 4.14 157/210] iommu/omap: Fix buffer overflow in debugfs Date: Mon, 24 Oct 2022 13:31:14 +0200 Message-Id: <20221024113002.070661190@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572835667536945?= X-GMAIL-MSGID: =?utf-8?q?1747572835667536945?= From: Dan Carpenter [ Upstream commit 184233a5202786b20220acd2d04ddf909ef18f29 ] There are two issues here: 1) The "len" variable needs to be checked before the very first write. Otherwise if omap2_iommu_dump_ctx() with "bytes" less than 32 it is a buffer overflow. 2) The snprintf() function returns the number of bytes that *would* have been copied if there were enough space. But we want to know the number of bytes which were *actually* copied so use scnprintf() instead. Fixes: bd4396f09a4a ("iommu/omap: Consolidate OMAP IOMMU modules") Signed-off-by: Dan Carpenter Reviewed-by: Robin Murphy Reviewed-by: Laurent Pinchart Link: https://lore.kernel.org/r/YuvYh1JbE3v+abd5@kili Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin --- drivers/iommu/omap-iommu-debug.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/omap-iommu-debug.c b/drivers/iommu/omap-iommu-debug.c index cec33e90e399..a15c4d99b888 100644 --- a/drivers/iommu/omap-iommu-debug.c +++ b/drivers/iommu/omap-iommu-debug.c @@ -35,12 +35,12 @@ static inline bool is_omap_iommu_detached(struct omap_iommu *obj) ssize_t bytes; \ const char *str = "%20s: %08x\n"; \ const int maxcol = 32; \ - bytes = snprintf(p, maxcol, str, __stringify(name), \ + if (len < maxcol) \ + goto out; \ + bytes = scnprintf(p, maxcol, str, __stringify(name), \ iommu_read_reg(obj, MMU_##name)); \ p += bytes; \ len -= bytes; \ - if (len < maxcol) \ - goto out; \ } while (0) static ssize_t From patchwork Mon Oct 24 11:31:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8641 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421364wru; Mon, 24 Oct 2022 05:20:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ZIBUxCccSmKFXAEOQZt11E6PDzDqJF/HkNF7UUe7awN4haRZc9pNS4WdBoAc3MmfScyu3 X-Received: by 2002:a17:907:7250:b0:791:9093:47f7 with SMTP id ds16-20020a170907725000b00791909347f7mr27426475ejc.278.1666614021407; Mon, 24 Oct 2022 05:20:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614021; cv=none; d=google.com; s=arc-20160816; b=LIFOCxDD6KaYdYsVnEjcH4Q621T+Dx/2zg3J5Jo9s978EK48TdP6yr4y4AEpQ1VTjV rVYTWZA4wy5UuGRBRrCx/TYk2jUf1y8NDlFYSxt93PiFKMKUnh+nnqsggvrcjwBgtLJw 4AXRPszILTstyCTcZ00BYF2oyGZnTuzPDyFdvs3H/Nd35pts12lsbYq7sZCnqZ8Liyv0 RrZ8Eav5wLU2wT3WVFdtrkUhEa6VK0jW35f3erBq2MXnFw5gGBjOotYefi3WJjw34FTo EYCnVeJmwx86N7ykTeZEbL3sdOJ1VR72US7nnz6HA0lkHp1D6VaXUCOdnaYAuAy5A6wy 4AqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Zxcc/ND4viNWddjgJzs/86AMikveDxJLnPjR4RQb1zM=; b=b9i62tKdOnsHZtCMJvV9kKMZ63TdZoIb0zv809gbiVS+EbjM7rFpZSM4nDeiNBzQLj 4qH3lSYacNl932G36AbRHS5kE/yz6xbQzTyblrsHGQhePhV3YmM3z6NtHDrIJQFAZrR6 ekeWJeHTQzQGNBEg2ScbxeHr1Kspu9GiiOLnFBh1+G807rzD+fcqbj20/e9o4NFoLHTT DpY5rlCvCntRI3rje9+YC8m2pI/ABtertS+XAeJamIT+BPOng5e4lz3US0Rw/GLdInX2 unuYr2n6HkfoslFQmMgj6xzJEaM1heoqORYY+T7TMN9lS5HI5neAbDW6A+9CMk9W8Qfu 7omQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JOsHCeNN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dr4-20020a170907720400b00782393c36cfsi3367793ejc.336.2022.10.24.05.19.57; Mon, 24 Oct 2022 05:20:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JOsHCeNN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232842AbiJXMM4 (ORCPT + 99 others); Mon, 24 Oct 2022 08:12:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230138AbiJXMME (ORCPT ); Mon, 24 Oct 2022 08:12:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2C0B80529; Mon, 24 Oct 2022 04:53:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A8348B811AC; Mon, 24 Oct 2022 11:52:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 083F6C433D7; Mon, 24 Oct 2022 11:52:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612334; bh=e9h4yRhNzUIntkHSn1fFub1FEWUXriihXcHA0orFn+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JOsHCeNNmRe61eJk4M7KCQnP5kbW8Ysii3FqN7rhGKaYFsqVnWQhqO7KP3OooLPkc Ii28VVqL3GTIa9TzrWS4gYiF/kSazp6tZxJve9rOiR0nD2us+9Chue8iMhDIxbQNIl qrPUa86HMW908b5nAnYJp6be9epOE8cRUMfsc/po= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thierry Reding , John Garry , Robin Murphy , Thierry Reding , Joerg Roedel , Sasha Levin Subject: [PATCH 4.14 158/210] iommu/iova: Fix module config properly Date: Mon, 24 Oct 2022 13:31:15 +0200 Message-Id: <20221024113002.104768124@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571463917477186?= X-GMAIL-MSGID: =?utf-8?q?1747571463917477186?= From: Robin Murphy [ Upstream commit 4f58330fcc8482aa90674e1f40f601e82f18ed4a ] IOMMU_IOVA is intended to be an optional library for users to select as and when they desire. Since it can be a module now, this means that built-in code which has chosen not to select it should not fail to link if it happens to have selected as a module by someone else. Replace IS_ENABLED() with IS_REACHABLE() to do the right thing. CC: Thierry Reding Reported-by: John Garry Fixes: 15bbdec3931e ("iommu: Make the iova library a module") Signed-off-by: Robin Murphy Reviewed-by: Thierry Reding Link: https://lore.kernel.org/r/548c2f683ca379aface59639a8f0cccc3a1ac050.1663069227.git.robin.murphy@arm.com Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin --- include/linux/iova.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/iova.h b/include/linux/iova.h index 7d23bbb887f2..641e62700ef3 100644 --- a/include/linux/iova.h +++ b/include/linux/iova.h @@ -131,7 +131,7 @@ static inline unsigned long iova_pfn(struct iova_domain *iovad, dma_addr_t iova) return iova >> iova_shift(iovad); } -#if IS_ENABLED(CONFIG_IOMMU_IOVA) +#if IS_REACHABLE(CONFIG_IOMMU_IOVA) int iova_cache_get(void); void iova_cache_put(void); From patchwork Mon Oct 24 11:31:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8662 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421796wru; Mon, 24 Oct 2022 05:21:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM63CQRcP7X1RqYwedV/lZedD+PNOQrwuqL1YsejTCUZF2A+NmzaU2qpWtHVgQuDbXb6pelK X-Received: by 2002:a17:907:6e18:b0:78d:b374:8989 with SMTP id sd24-20020a1709076e1800b0078db3748989mr27265401ejc.552.1666614073055; Mon, 24 Oct 2022 05:21:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614073; cv=none; d=google.com; s=arc-20160816; b=xHiGEzyHTP7rKTUf9OD5tZeevK5978EVckijip/MOGmJzrkY+MSqE6oJDxJcof39oa DMW0kMCuIBg+ejsjGhCID1A+u70r2Imzn0EbZzm3wGSfD2rKSmFOc3Fwsb1KaLahKWTo Z1U4QkwHF3I1A9q3JuU1acJCWLhbm99f4j0FlrblBtjUHa2Ze6hOjYBV52//UHqJY/m+ QUxPUGBoaIhsjiK3GIJ0XDGt3uoFynpTizC4lMgkHhzLOHpnTT3bhGf6mHvkE2BF92S4 zGzMxZjNb/EWxRMhKTVmUnU4Dvcn4DXZaZdncrtyxYPdUb8TOQ0CgPDVJnXBEQ+fQm6c WwtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bsyKcbIMDeEFw7/nt7KVuwEqlRP5FXUDAoU7kJYZED4=; b=yzzJFiBhki4PfEHkXiSHvLdEGr4mlNTvZbewqqxDqMS3dw3JYG1N3IqRSUq6Es7S/k Bs+2A/Dgi8Me7HlCHvbXfGCmGjUNC590hj2VKirzQ14C7sTjWT4TT7eCVCesRdQzoXfZ trXdAN5qNDgYd7xW4pGLtCKNO95GVHF0LIfOl0FonBUk5HVqk/gBHWBQf59NZZ1iGzCC zlv1109zavEa9bCJfZj9tXIRqgVpUEgzLmDrOTAm7btkldGKOm6P6/TJE4xLeBsbgfjS MaEUKI2onfu+aO6l1a28Q2CzELQ5fJDe2jS2e+vkBwtA/1R3LvYtM2CWiUeHHvxqkDPI Aidg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=x5pa6o4x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sb12-20020a1709076d8c00b00770534b5a71si29532527ejc.858.2022.10.24.05.20.48; Mon, 24 Oct 2022 05:21:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=x5pa6o4x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233079AbiJXMQI (ORCPT + 99 others); Mon, 24 Oct 2022 08:16:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233244AbiJXMOc (ORCPT ); Mon, 24 Oct 2022 08:14:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1968E5B071; Mon, 24 Oct 2022 04:55:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 89E99612C5; Mon, 24 Oct 2022 11:52:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F82BC433D6; Mon, 24 Oct 2022 11:52:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612337; bh=nw7eE55o7Cub4k6OxNnyj+f/jSj2zifMDaD65737OUM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x5pa6o4xcJXgFNSixqVhXjX8fMZm/NgErnyveAYqhiigqjS+MrXele+x5dZr9tj44 z0pz0hr19TUtvZwqoCuOTqo0o2LKrUOLwAJLT8iKVQy8Ni/JtacOK5FftlyhsPaRPu pKYvkadJTolV13i2+sp6Q7nGIPF2mb/hQFhq5zpw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Herbert Xu , Sasha Levin Subject: [PATCH 4.14 159/210] crypto: cavium - prevent integer overflow loading firmware Date: Mon, 24 Oct 2022 13:31:16 +0200 Message-Id: <20221024113002.134861468@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571518301643524?= X-GMAIL-MSGID: =?utf-8?q?1747571518301643524?= From: Dan Carpenter [ Upstream commit 2526d6bf27d15054bb0778b2f7bc6625fd934905 ] The "code_length" value comes from the firmware file. If your firmware is untrusted realistically there is probably very little you can do to protect yourself. Still we try to limit the damage as much as possible. Also Smatch marks any data read from the filesystem as untrusted and prints warnings if it not capped correctly. The "ntohl(ucode->code_length) * 2" multiplication can have an integer overflow. Fixes: 9e2c7d99941d ("crypto: cavium - Add Support for Octeon-tx CPT Engine") Signed-off-by: Dan Carpenter Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/cavium/cpt/cptpf_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/cavium/cpt/cptpf_main.c b/drivers/crypto/cavium/cpt/cptpf_main.c index 34a6d8bf229e..dc34326e80df 100644 --- a/drivers/crypto/cavium/cpt/cptpf_main.c +++ b/drivers/crypto/cavium/cpt/cptpf_main.c @@ -257,6 +257,7 @@ static int cpt_ucode_load_fw(struct cpt_device *cpt, const u8 *fw, bool is_ae) const struct firmware *fw_entry; struct device *dev = &cpt->pdev->dev; struct ucode_header *ucode; + unsigned int code_length; struct microcode *mcode; int j, ret = 0; @@ -267,11 +268,12 @@ static int cpt_ucode_load_fw(struct cpt_device *cpt, const u8 *fw, bool is_ae) ucode = (struct ucode_header *)fw_entry->data; mcode = &cpt->mcode[cpt->next_mc_idx]; memcpy(mcode->version, (u8 *)fw_entry->data, CPT_UCODE_VERSION_SZ); - mcode->code_size = ntohl(ucode->code_length) * 2; - if (!mcode->code_size) { + code_length = ntohl(ucode->code_length); + if (code_length == 0 || code_length >= INT_MAX / 2) { ret = -EINVAL; goto fw_release; } + mcode->code_size = code_length * 2; mcode->is_ae = is_ae; mcode->core_mask = 0ULL; From patchwork Mon Oct 24 11:31:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8636 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp420965wru; Mon, 24 Oct 2022 05:19:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ahwZ6g7qG0oG5nTwey82Wim+fqj73CIdAol12BW5z0g/bFLITvLpjjGwJg8kpBb/nnWDU X-Received: by 2002:a17:906:5dd8:b0:78d:efa7:f78d with SMTP id p24-20020a1709065dd800b0078defa7f78dmr27729406ejv.641.1666613959056; Mon, 24 Oct 2022 05:19:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613959; cv=none; d=google.com; s=arc-20160816; b=YVm199aSgLJr+JNU4eLytZEWEqB0S0ZSely/iqHg0+eHWUc2AstQImFkhe/tZt5jKZ axbfUciWP0kSC6Ml3+Q9vrKjb/24wPu+6RNif901mGdCXEHzW3e3R9iGgwtTmPF4RdIO tV5NMotnWUb6y3eCH+qt5Vr4Ibt2ANeY9agjbEctNo+O88ju1h9349mRFVq8zJzloNWo YJjK5kR/PEDaQZaXZMkRakM9lTe6odYn/S/W58sWUv5UssVUnqkiSXjqN149rz2Ni7Ay yeHvVYE5DxOCliWpyoIYHKMWKCRSUQ4N+9kPBXABfijTtlqSNuRBSprocK8mh8oq8Ge1 QUwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1GTd04xr45r8QYY/A9UzaP8zmYL13RIrVodPoZSAS5I=; b=0+Bvr3VfH86ipUEx5MFwz5rGfLwUb3BmfPjqUr45hMrScHijXAn0s5VByMKMEkKIdn D7bqVUOgVZhW/3zmYuymdUeex6FqE2ixYtt9JWOQeQugTRgrDs9ipL9gOXKEuOSv7dpX bVEBJZcy/RKsefTjI3XRS1GP3OrwHWD3/TPhTOXKAADRVgG41sHa0wjRYBtbIiyejqBi +6PnkiI7JS/JkSKPuVx96h8tmcs5KlAKK/GImtO89Acwzek6p0E5B2gTuxWTDJTwNyI1 S2g/7orUQxv3RaUVTP9ofqkURMhDGzSvKb9gl2G/vyoI826I2HpIdqBmxSyItN5WBAF6 s3/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0CzFl04h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s5-20020a056402164500b00461ebe2a168si873457edx.447.2022.10.24.05.18.54; Mon, 24 Oct 2022 05:19:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0CzFl04h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230138AbiJXMNg (ORCPT + 99 others); Mon, 24 Oct 2022 08:13:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232440AbiJXMMw (ORCPT ); Mon, 24 Oct 2022 08:12:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF113A1BD; Mon, 24 Oct 2022 04:54:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D93D6B81144; Mon, 24 Oct 2022 11:52:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A2FBC433C1; Mon, 24 Oct 2022 11:52:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612339; bh=ryw8RjTm44Jgi9Xgr6nzwugNpPMq9/+jR2HPtMHVXao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0CzFl04hFuQMJ/3bGv4fKJzzNc5Pe0doX5k3XPTwObe+Pprijxm8+IQNi2ypFIO26 9JznBNRLPa6j6+y16UJtCi3o2boLnMAm86eW7nF+KJ0B2otk8dxOOChNpKDclmGGgn 1IMKYbCsstQI7jIQ8bp2lt9xvUlegv9FiEQIRKCA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Qilong , Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 4.14 160/210] f2fs: fix race condition on setting FI_NO_EXTENT flag Date: Mon, 24 Oct 2022 13:31:17 +0200 Message-Id: <20221024113002.169798376@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571398649460036?= X-GMAIL-MSGID: =?utf-8?q?1747571398649460036?= From: Zhang Qilong [ Upstream commit 07725adc55c0a414c10acb5c8c86cea34b95ddef ] The following scenarios exist. process A: process B: ->f2fs_drop_extent_tree ->f2fs_update_extent_cache_range ->f2fs_update_extent_tree_range ->write_lock ->set_inode_flag ->is_inode_flag_set ->__free_extent_tree // Shouldn't // have been // cleaned up // here ->write_lock In this case, the "FI_NO_EXTENT" flag is set between f2fs_update_extent_tree_range and is_inode_flag_set by other process. it leads to clearing the whole exten tree which should not have happened. And we fix it by move the setting it to the range of write_lock. Fixes:5f281fab9b9a3 ("f2fs: disable extent_cache for fcollapse/finsert inodes") Signed-off-by: Zhang Qilong Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- fs/f2fs/extent_cache.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/f2fs/extent_cache.c b/fs/f2fs/extent_cache.c index aff6c2ed1c02..042c9d4f73cf 100644 --- a/fs/f2fs/extent_cache.c +++ b/fs/f2fs/extent_cache.c @@ -709,9 +709,8 @@ void f2fs_drop_extent_tree(struct inode *inode) if (!f2fs_may_extent_tree(inode)) return; - set_inode_flag(inode, FI_NO_EXTENT); - write_lock(&et->lock); + set_inode_flag(inode, FI_NO_EXTENT); __free_extent_tree(sbi, et); __drop_largest_extent(inode, 0, UINT_MAX); write_unlock(&et->lock); From patchwork Mon Oct 24 11:31:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8665 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421862wru; Mon, 24 Oct 2022 05:21:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6DVyAzYSJkBzBIMuPYALvIIaWlYBwl/9NXTTHsqh2CtixI9CWdyTrK25fnbpf7RRhriPTs X-Received: by 2002:a17:907:7e9e:b0:78d:f3b0:fc78 with SMTP id qb30-20020a1709077e9e00b0078df3b0fc78mr27834835ejc.478.1666614081612; Mon, 24 Oct 2022 05:21:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614081; cv=none; d=google.com; s=arc-20160816; b=fHAaECbDWuRHeLtWaaVq67e8Xe17AxRC3xeKycLn4AUPjzIkpjmV6wjkDn+pFbF3kO P39vDTsq5Hd7oATfZ6ddsQJ1rEOkyz0+cEfMwQVO8HaNiP17c4vxukCsQzmaQCo3N+RF dwjkTAIz9J8bI88uPJa8UesnSuhvh6bGdhYOQsfCy63oW6X5GdAdjND8MytF8SX3/w6m JLYNBfZOq2JFtFATVHnu4FkNldoDJBGTOjs2bih5uJnRajrirt3vD67eloWc4g2sdVbm CtN8vbLTl0a7u/KOGQBvnMuq/IgPj3Mn5Ygjs7m+EAKpujc0uljQxObS/2Ytzs+tY57V +HvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=S91bFyOSc2hwVxSHovGM/3CboB27qSfT0M7BQD77o90=; b=aN+4+zmHBZ7y9BN/1UY+KU8efMdLNFDj7k9tf/4EuFW1iouCe+hEstv2H1+ODSQxr7 yTz/L94s2LzTqcwLvmGyTs9tmgsiV5CLYKE9J6/2FTHJVZ2KRgSQug66ox3JDQ2DQh14 uESiM6nw1IcrGknW2UPpC0ZD6vEVDK/P0iQWj2z7uOPDuQj+26FBZfbU6h5gxnl8i8bn 9+60iAC3lRMzcJ+ZUUJfBVQhMagoVUsqM441qgZOF63pGFSaiqLzx1a+pugtgrN5Awhe yNxKZtvhDGjpoC79rfy+KTw0dgdXzMujFU5ZmXmeuY//MI95HDjXGFDRJsRul1lsKERx HucA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FxwvBaSI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ne19-20020a1709077b9300b007a92b00c075si2028381ejc.891.2022.10.24.05.20.57; Mon, 24 Oct 2022 05:21:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FxwvBaSI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233205AbiJXMR6 (ORCPT + 99 others); Mon, 24 Oct 2022 08:17:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231734AbiJXMQG (ORCPT ); Mon, 24 Oct 2022 08:16:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94A2280F41; Mon, 24 Oct 2022 04:56:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 798EAB811B8; Mon, 24 Oct 2022 11:52:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0C36C433C1; Mon, 24 Oct 2022 11:52:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612342; bh=ZkKl/EsOt+55to666XhPgsn1/N1tcDCZ1GlCuJY/pbg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FxwvBaSIk+y+cZqDdYSFCYPav31ixjZaJDUgC9jGFwtbn3tiwrZdniwrEz5+wk5be aXsZqu3MbRREXUw4VsWB6gAXrRsFKBNC2hWXO/0FNaU6r/eUDLej2E5mq6qDMYwB+1 SFrYTc4mtBAXzo9OQOvJb3xh/BfoASbZ8v8i9e0g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Arvid Norlander , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 4.14 161/210] ACPI: video: Add Toshiba Satellite/Portege Z830 quirk Date: Mon, 24 Oct 2022 13:31:18 +0200 Message-Id: <20221024113002.199716272@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571527567838443?= X-GMAIL-MSGID: =?utf-8?q?1747571527567838443?= From: Arvid Norlander [ Upstream commit 574160b8548deff8b80b174f03201e94ab8431e2 ] Toshiba Satellite Z830 needs the quirk video_disable_backlight_sysfs_if for proper backlight control after suspend/resume cycles. Toshiba Portege Z830 is simply the same laptop rebranded for certain markets (I looked through the manual to other language sections to confirm this) and thus also needs this quirk. Thanks to Hans de Goede for suggesting this fix. Link: https://www.spinics.net/lists/platform-driver-x86/msg34394.html Suggested-by: Hans de Goede Signed-off-by: Arvid Norlander Reviewed-by: Hans de Goede Tested-by: Arvid Norlander Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/acpi_video.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c index 5a69260edf80..cc228e5ad2b3 100644 --- a/drivers/acpi/acpi_video.c +++ b/drivers/acpi/acpi_video.c @@ -511,6 +511,22 @@ static const struct dmi_system_id video_dmi_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE R830"), }, }, + { + .callback = video_disable_backlight_sysfs_if, + .ident = "Toshiba Satellite Z830", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), + DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE Z830"), + }, + }, + { + .callback = video_disable_backlight_sysfs_if, + .ident = "Toshiba Portege Z830", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), + DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE Z830"), + }, + }, /* * Some machine's _DOD IDs don't have bit 31(Device ID Scheme) set * but the IDs actually follow the Device ID Scheme. From patchwork Mon Oct 24 11:31:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10303 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp654950wru; Mon, 24 Oct 2022 14:13:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4R/3fB8N/eAO/sbFCJwx/3VxVxOpfjdRzQS7je507G80yVITesHd8KD84JNFyKyYdapmg2 X-Received: by 2002:a05:6a00:a8f:b0:563:3a3f:9d5c with SMTP id b15-20020a056a000a8f00b005633a3f9d5cmr35571298pfl.50.1666646030306; Mon, 24 Oct 2022 14:13:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666646030; cv=none; d=google.com; s=arc-20160816; b=r8cQcEjej7PPD2fp70sKktHSLfimUwMUqnRuOd1p8TGX4/vmlwixj5t7T8PBWufa7l wX5wXu/bsDjUiXwrFqMKFaILsHtUHVSEDMlWMRHVAZEGjfMboTEQsJPNbmDlCDO4bGrb eqVLbbDm4whbj5QMeyX4PoSCIDKerBiSapUSf/2yFh2Xx1NuN1GN02sF4XPSsUdNt/K/ 4THRijSrMKsXZBmIG7KgmgM4LTAC3AsvIcki6FX3BvN3ZZ3j2cLOKm+4zq1gLHspsiDT OE4levP56Z7gmiCHvcoC0kjIdgTyaoBWrfNqfvktWO/n53G88ds//Fz3OKxCIqex9RjQ aJmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HMB8cwFxSZQq5hiwUjnCgLByHbQLvV/Q+JayaXkVQiI=; b=i4Cd4rSm3uqm6FaYX6qvs910FFqjI8sHulHGKR68OsBM0nDt4H0RNwDsAEih89V6Cg cdIAIA2bgntem5tBZ4FNUWm3u3il2uFqTyKsfnAUyLIfnS7s+LDKtf3g9GsIUd3Ew5VZ JA/pM/64mGKMDs2cT02X5z7DstcC0q/pLcEToFFrXTmWIOY2IpBRh+DTE7My7H0SkqSg AVWWKuPWeGnl9bGif3AWM8wNm/75xKPOS4V2YjvjtPW5s1VlaKLoCHadctgZRyFC/JdO Ybib0d5qIn6Um20/2gDyOhzLZXhPbuZ1pmRSuO9Xl0eET7HmgDBkzZ9z5zhPPwZUhxRd 8zlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zphT8N3l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a3-20020aa78e83000000b0052f9293affcsi753222pfr.335.2022.10.24.14.13.37; Mon, 24 Oct 2022 14:13:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zphT8N3l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233587AbiJXVMJ (ORCPT + 99 others); Mon, 24 Oct 2022 17:12:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233342AbiJXVLd (ORCPT ); Mon, 24 Oct 2022 17:11:33 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C2B7186D4D; Mon, 24 Oct 2022 12:17:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id C23FBCE1355; Mon, 24 Oct 2022 11:52:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 735B4C433C1; Mon, 24 Oct 2022 11:52:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612345; bh=7Biv/RB4g1yWRQ3Ir7P+DO9H5qF3EuPehLJSXWw6ecI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zphT8N3lEmzRyWQCh+kWbXIaAtR5Djp+HSSF4tsRNJiC8pZLsO+ZZXx4ZD5Pz+lxr Ujx4VnnJluMgLMXENuyiy3Xz/PVPXjiAUsQpLTEEe8o+mliAXDjyZGOosHOwgrgVwX jfV+1QIrGEePQTnbF0CtSCyI0B1Mt4MdbUZm1Ghs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hauke Mehrtens , =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= , Thomas Bogendoerfer , linux-mips@vger.kernel.org, Nathan Chancellor , Nick Desaulniers , llvm@lists.linux.dev, kernel test robot , Kees Cook , Sasha Levin Subject: [PATCH 4.14 162/210] MIPS: BCM47XX: Cast memcmp() of function to (void *) Date: Mon, 24 Oct 2022 13:31:19 +0200 Message-Id: <20221024113002.229290480@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747605027779410950?= X-GMAIL-MSGID: =?utf-8?q?1747605027779410950?= From: Kees Cook [ Upstream commit 0dedcf6e3301836eb70cfa649052e7ce4fcd13ba ] Clang is especially sensitive about argument type matching when using __overloaded functions (like memcmp(), etc). Help it see that function pointers are just "void *". Avoids this error: arch/mips/bcm47xx/prom.c:89:8: error: no matching function for call to 'memcmp' if (!memcmp(prom_init, prom_init + mem, 32)) ^~~~~~ include/linux/string.h:156:12: note: candidate function not viable: no known conversion from 'void (void)' to 'const void *' for 1st argument extern int memcmp(const void *,const void *,__kernel_size_t); Cc: Hauke Mehrtens Cc: "Rafał Miłecki" Cc: Thomas Bogendoerfer Cc: linux-mips@vger.kernel.org Cc: Nathan Chancellor Cc: Nick Desaulniers Cc: llvm@lists.linux.dev Reported-by: kernel test robot Link: https://lore.kernel.org/lkml/202209080652.sz2d68e5-lkp@intel.com Signed-off-by: Kees Cook Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin --- arch/mips/bcm47xx/prom.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/mips/bcm47xx/prom.c b/arch/mips/bcm47xx/prom.c index 135a5407f015..d26d9a6f6ee7 100644 --- a/arch/mips/bcm47xx/prom.c +++ b/arch/mips/bcm47xx/prom.c @@ -85,7 +85,7 @@ static __init void prom_init_mem(void) pr_debug("Assume 128MB RAM\n"); break; } - if (!memcmp(prom_init, prom_init + mem, 32)) + if (!memcmp((void *)prom_init, (void *)prom_init + mem, 32)) break; } lowmem = mem; @@ -162,7 +162,7 @@ void __init bcm47xx_prom_highmem_init(void) off = EXTVBASE + __pa(off); for (extmem = 128 << 20; extmem < 512 << 20; extmem <<= 1) { - if (!memcmp(prom_init, (void *)(off + extmem), 16)) + if (!memcmp((void *)prom_init, (void *)(off + extmem), 16)) break; } extmem -= lowmem; From patchwork Mon Oct 24 11:31:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8789 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430754wru; Mon, 24 Oct 2022 05:42:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Ltl/wu40hUB6KM5a4GXOInFIy8sJq0HocakVJn6am0ujYBELnI1mWHZs/pmGdQpxu9Rna X-Received: by 2002:a05:6a00:14d4:b0:563:9296:f320 with SMTP id w20-20020a056a0014d400b005639296f320mr32655002pfu.27.1666615332720; Mon, 24 Oct 2022 05:42:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615332; cv=none; d=google.com; s=arc-20160816; b=BXC6CaBnX8kBQPvfxXbginomoIi/8hQLzpcZKOil+cu8S+VyxsDNxnokb2zJaaC/gH wzZpNGT/3oxNAVJmAcNongxF2WWNV53aCw8uPcf1x07734cdHRLhn8Ni8QUoWx0A7ax+ be9kL9U2Hru3U6zuMZhQPgpGT1G0/ve54XknCvlDtb5DIA3Qo4Dhi1n2JXMUg4UbQFlF yNMMbPxkeiiOb57QJEEDrCU6tyr7IPgJlQgNIsWCvi/fLkeGfumsBMhioQKQNdTnYb0B ah7O0OPXZVvyoeryM7K6aca1BaaEL1WAlzv/Vo15uBCDaJSTUXFQgAK5OvmbEXSVW88x Q+Ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=u1nUDZwJH88xqbSZOPerD8B6svewWmzIZCocoVzjnr8=; b=OC6DKVCqLgc/340EbTZ4tWJjxHgvknqicUpLI9rKXaKVoUlz4TYcH8VNcj9aABiKWH /E5DfvzAx+TpkNHvfUfmjoxN+1s4Fi0GE6QZVA5j8hpKxVK0S3v0Zrt1n8Ks2rwKiAH7 5LZtOzkJbEv9K6aq2jhr7eSa323LpdeeCZ77FRcB6cXFbDPm6mmspvYizxejAMMJMKen DR4v0LXCse70t394W/F9JU+Dn11n4OmNjZ5krcNQyfFNiAwCC4mHMQ4qtMpbNayp2MNv V93VgdaXikGJ1P3HZflnztV46QDYgo+6hXE4zn27ESELkdgBfzmQtUFmK6XqTJdOx0vG JUoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KWQw1KSB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r10-20020a632b0a000000b0046e96b9ed89si15488822pgr.867.2022.10.24.05.41.58; Mon, 24 Oct 2022 05:42:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KWQw1KSB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233795AbiJXMdY (ORCPT + 99 others); Mon, 24 Oct 2022 08:33:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234091AbiJXM3S (ORCPT ); Mon, 24 Oct 2022 08:29:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F7C0876B1; Mon, 24 Oct 2022 05:03:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AB95561295; Mon, 24 Oct 2022 11:52:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1482C433C1; Mon, 24 Oct 2022 11:52:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612350; bh=Xdon2nvoGD4MV8vws9pMZ7TJIM8qOOsBVdwLNw/twmw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KWQw1KSBqFRU+stAACUmfFabr5W/N4zcx4gxlScIMcM6rAa8gIoKmFln31FjpjOsQ tOoGIzgB3mbnE5ORomKOUQi9BFZbfCjY8XMtbSpDed2G5jIHthA03aKV0xhPGcEOXp gzrLZqg913HWjJxyNKQ67BtyoofDvHuyBlwpY+3A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Qin , Zhang Rui , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 4.14 163/210] powercap: intel_rapl: fix UBSAN shift-out-of-bounds issue Date: Mon, 24 Oct 2022 13:31:20 +0200 Message-Id: <20221024113002.259840081@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572838916579060?= X-GMAIL-MSGID: =?utf-8?q?1747572838916579060?= From: Chao Qin [ Upstream commit 2d93540014387d1c73b9ccc4d7895320df66d01b ] When value < time_unit, the parameter of ilog2() will be zero and the return value is -1. u64(-1) is too large for shift exponent and then will trigger shift-out-of-bounds: shift exponent 18446744073709551615 is too large for 32-bit type 'int' Call Trace: rapl_compute_time_window_core rapl_write_data_raw set_time_window store_constraint_time_window_us Signed-off-by: Chao Qin Acked-by: Zhang Rui Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/powercap/intel_rapl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/powercap/intel_rapl.c b/drivers/powercap/intel_rapl.c index 54ddd78924dd..5c07e04db421 100644 --- a/drivers/powercap/intel_rapl.c +++ b/drivers/powercap/intel_rapl.c @@ -1066,6 +1066,9 @@ static u64 rapl_compute_time_window_core(struct rapl_package *rp, u64 value, y = value & 0x1f; value = (1 << y) * (4 + f) * rp->time_unit / 4; } else { + if (value < rp->time_unit) + return 0; + do_div(value, rp->time_unit); y = ilog2(value); f = div64_u64(4 * (value - (1 << y)), 1 << y); From patchwork Mon Oct 24 11:31:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9990 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp615579wru; Mon, 24 Oct 2022 12:26:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Oebu/E1Jci+t0kR4DwOUQ5whVHdY/kd00L87yWceEWrtncCF3KBeCbJbGthAjxCsi4/Kf X-Received: by 2002:a05:6402:43cb:b0:461:912d:90f with SMTP id p11-20020a05640243cb00b00461912d090fmr10907222edc.375.1666639602091; Mon, 24 Oct 2022 12:26:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666639602; cv=none; d=google.com; s=arc-20160816; b=cDV3R1LejRu7Jh+z+Ane3TeR1HCx+0UyyNpllr8k1md7S38RnDSaZMjHePnoyJ6Mwe H3va1Ze/40c5qb9cGgHcaCAMgdBznn0kLyNnOGOP5C9vTNGovAAxaNkgH/ELGqr8NjX+ jpgQq0SziHRYb+S1iVg5AbBAzgL/PTjQz3QKzC6PSMs/F1/d+DExN3cNkwGXCchemqq0 SiQUXcDk4DNVXm3bFEv/1uPJtQ7f6ruE4ehjKrz1GGwXDk1RlvlOtNmNTIVwkw2ZF9+p JpjC8ClVmp1TggfC/5uTcRgAu8W2r1GpN3M4cR55fxZ2RZ7kypKfcYYuVkRatHWulSCD Z92Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rtKEV60INoCQ3414PGodlEschV/qj1go5EZmY2Rox4I=; b=RClPAf0XiKuVopbBZj8/GPPpzgb+mOOTtM46I1xd2VfWMU8AH0k3Z2xbuwZK5wNX/f rcQ7B5BYJ8QpCtUdUqebiPymJdjgyKCmGo/iiHpRWder8A+3hnyfNriyIrbny2hlU2bz ktBur2wfW4vvGY7KWAUw+c5BVAgfFLsHIlU90cwPpcd2DyfI4cGX5xpiYwEY3SvUtyCF yhd7STfiWB/y53BvWIgbft7XuvQjvRcmdWHdVcYvQgvvfvt6nQzh6AGAqqXzwi1HFDAc puzyYE/nFbUjtDq8KmaQECNRHgkPnGefF4X0oG8Cf+Xh58niMUEmnq2QznO40EVWWZQS MB9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UvlB8XkO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z8-20020a056402274800b00457e1a02339si623465edd.592.2022.10.24.12.26.11; Mon, 24 Oct 2022 12:26:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UvlB8XkO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231607AbiJXTYp (ORCPT + 99 others); Mon, 24 Oct 2022 15:24:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232105AbiJXTWs (ORCPT ); Mon, 24 Oct 2022 15:22:48 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD6A8C4DA1; Mon, 24 Oct 2022 10:57:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 535D7CE134D; Mon, 24 Oct 2022 11:52:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67333C433D6; Mon, 24 Oct 2022 11:52:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612352; bh=QsAUGu98aFCufOBe4iBWZ+qBocl7d9WXykBVUjlzfZ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UvlB8XkOxmPArORef54xfQrXmn/wGt4pRGP9jYk4SckPA2m8Bquv02bIXXDtNc4Py ddNP+DMwy4BVCzV9wD2sE2VDXxwX7QnKX8Chihi0H38PwO2dyHPc1Np5PdeMcihapP rzj/ix0nJVYQpGhcACL3RLu7dc2OmmS50lUd+2S0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen Yu , Srinivas Pandruvada , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 4.14 164/210] thermal: intel_powerclamp: Use get_cpu() instead of smp_processor_id() to avoid crash Date: Mon, 24 Oct 2022 13:31:21 +0200 Message-Id: <20221024113002.289703206@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747598287249118429?= X-GMAIL-MSGID: =?utf-8?q?1747598287249118429?= From: Srinivas Pandruvada [ Upstream commit 68b99e94a4a2db6ba9b31fe0485e057b9354a640 ] When CPU 0 is offline and intel_powerclamp is used to inject idle, it generates kernel BUG: BUG: using smp_processor_id() in preemptible [00000000] code: bash/15687 caller is debug_smp_processor_id+0x17/0x20 CPU: 4 PID: 15687 Comm: bash Not tainted 5.19.0-rc7+ #57 Call Trace: dump_stack_lvl+0x49/0x63 dump_stack+0x10/0x16 check_preemption_disabled+0xdd/0xe0 debug_smp_processor_id+0x17/0x20 powerclamp_set_cur_state+0x7f/0xf9 [intel_powerclamp] ... ... Here CPU 0 is the control CPU by default and changed to the current CPU, if CPU 0 offlined. This check has to be performed under cpus_read_lock(), hence the above warning. Use get_cpu() instead of smp_processor_id() to avoid this BUG. Suggested-by: Chen Yu Signed-off-by: Srinivas Pandruvada [ rjw: Subject edits ] Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/thermal/intel_powerclamp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/intel_powerclamp.c b/drivers/thermal/intel_powerclamp.c index c3293fa2bb1b..7ff59f86a543 100644 --- a/drivers/thermal/intel_powerclamp.c +++ b/drivers/thermal/intel_powerclamp.c @@ -550,8 +550,10 @@ static int start_power_clamp(void) /* prefer BSP */ control_cpu = 0; - if (!cpu_online(control_cpu)) - control_cpu = smp_processor_id(); + if (!cpu_online(control_cpu)) { + control_cpu = get_cpu(); + put_cpu(); + } clamping = true; schedule_delayed_work(&poll_pkg_cstate_work, 0); From patchwork Mon Oct 24 11:31:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10037 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp622547wru; Mon, 24 Oct 2022 12:45:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4aRT4M7vgTzwACaKMrH0P+xGgYmMCx1i36+UfJ3f0qanVR/PNENmZAcr2ahWrIYR40eWSI X-Received: by 2002:a17:907:628f:b0:72f:57da:c33d with SMTP id nd15-20020a170907628f00b0072f57dac33dmr28845511ejc.374.1666640744419; Mon, 24 Oct 2022 12:45:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640744; cv=none; d=google.com; s=arc-20160816; b=HOrOxT8NO/AH0PEaa5Nd1CgUql2NbDRQPmzIBBeYfGAfHvtGToIkkkITkF8NVqxQIm RIu9h6htKDt3WA0H9lWVeXTEdpm67BUWwq6qjZm1MXj+eanZiHjAUQyRVjSO8Vz3a2Je zKXDYbE1UcV2fqqfrhZQGqxq4Fno/zVIQorjRIF1UsXS0lMDfz9YcbmEcZL4ZY7MQ5GF +i7ZfZpRy4YbKmwikFzY/3ijhkuifnbuUggwvue8Kg889iekfJv6NmXWydFf7VNaAOAF f3m2l4ZZ0aW22vqMj3RSYKifTV6BasOhlwtAWysR3epogodQdZkzKJkqgBHesL5ajMy3 u2zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1G/QNJDYbtI54uwWC8rzBHh+KSa5Ye+ucDkNqumDiq8=; b=k+1QLdW2m5jiAU4WOkPBx8WMcGFAWugl1s0yiXH7sy18r5WfDtdqMUU172zFu8CaZR jJeqlyH7zKK1ZidpWsJCqAAS2oJc0HQy2uVItiXbuWMZ2zvVM78wATL4MAbt8v1jhfhJ xJKuETx3pDApCW+vYbDqsU/7Uz8QsjckgV7MGJdm23MIlVjsHjbTBTCI1p95zl2F7Hwr vKKrUKw4wuBSUOEbQYoVc+XxMgBiwFwOni2dIT0IBNQ6stOM3a/7VwhIUPEgkw8IWD5Q 1wRCpbZfJRhuz10/bLnZMXRPVgK9ydXsbK9MpIQLdIiXvSEsSSikitC6CbO0O7/tG5ep 69Qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nCFTPgKQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l18-20020a056402029200b00448b88378f8si583127edv.359.2022.10.24.12.45.19; Mon, 24 Oct 2022 12:45:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nCFTPgKQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231376AbiJXTmt (ORCPT + 99 others); Mon, 24 Oct 2022 15:42:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233504AbiJXTld (ORCPT ); Mon, 24 Oct 2022 15:41:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC4DB157F5D; Mon, 24 Oct 2022 11:11:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A44DFB811C3; Mon, 24 Oct 2022 11:52:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC97EC433C1; Mon, 24 Oct 2022 11:52:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612355; bh=pKq6STDJUV1Dof39xPqd3W5VALSdKIfQtmFHciFElP0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nCFTPgKQGeLisWi3MP4ZDMRgdadGnvR9sOSwMqMjhxkJPELIgUwDqoJmMlOHaKVH/ dBErm38Fovc6YuRRX7pHaSzbN/jRyl/yPQaY72mj30JZPLLQUP3EjMSIBntTeQW1Oh k1f/4/a/69+cmVcV8WT6dCrQtRFXeUQNMfEatQO4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juergen Gross , Boris Ostrovsky , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , xen-devel@lists.xenproject.org, Kees Cook , Sasha Levin Subject: [PATCH 4.14 165/210] x86/entry: Work around Clang __bdos() bug Date: Mon, 24 Oct 2022 13:31:22 +0200 Message-Id: <20221024113002.320074738@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747599485224584980?= X-GMAIL-MSGID: =?utf-8?q?1747599485224584980?= From: Kees Cook [ Upstream commit 3e1730842f142add55dc658929221521a9ea62b6 ] Clang produces a false positive when building with CONFIG_FORTIFY_SOURCE=y and CONFIG_UBSAN_BOUNDS=y when operating on an array with a dynamic offset. Work around this by using a direct assignment of an empty instance. Avoids this warning: ../include/linux/fortify-string.h:309:4: warning: call to __write_overflow_field declared with 'warn ing' attribute: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Wat tribute-warning] __write_overflow_field(p_size_field, size); ^ which was isolated to the memset() call in xen_load_idt(). Note that this looks very much like another bug that was worked around: https://github.com/ClangBuiltLinux/linux/issues/1592 Cc: Juergen Gross Cc: Boris Ostrovsky Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: x86@kernel.org Cc: "H. Peter Anvin" Cc: xen-devel@lists.xenproject.org Reviewed-by: Boris Ostrovsky Link: https://lore.kernel.org/lkml/41527d69-e8ab-3f86-ff37-6b298c01d5bc@oracle.com Signed-off-by: Kees Cook Signed-off-by: Sasha Levin --- arch/x86/xen/enlighten_pv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c index 88d084a57b14..3f38541c28d2 100644 --- a/arch/x86/xen/enlighten_pv.c +++ b/arch/x86/xen/enlighten_pv.c @@ -753,6 +753,7 @@ static void xen_load_idt(const struct desc_ptr *desc) { static DEFINE_SPINLOCK(lock); static struct trap_info traps[257]; + static const struct trap_info zero = { }; unsigned out; trace_xen_cpu_load_idt(desc); @@ -762,7 +763,7 @@ static void xen_load_idt(const struct desc_ptr *desc) memcpy(this_cpu_ptr(&idt_desc), desc, sizeof(idt_desc)); out = xen_convert_trap_info(desc, traps, false); - memset(&traps[out], 0, sizeof(traps[0])); + traps[out] = zero; xen_mc_flush(); if (HYPERVISOR_set_trap_table(traps)) From patchwork Mon Oct 24 11:31:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8647 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421513wru; Mon, 24 Oct 2022 05:20:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7zMiNYqt30EA1eEKg9HoJfet3AiG9SkCsRDso6lXyhsvDP2+e1HGXB70+chBKJlw9CUAT3 X-Received: by 2002:aa7:df94:0:b0:461:aff8:d3e1 with SMTP id b20-20020aa7df94000000b00461aff8d3e1mr6435756edy.10.1666614040802; Mon, 24 Oct 2022 05:20:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614040; cv=none; d=google.com; s=arc-20160816; b=ngRFEXJxA2KYmiJPzwEICZXqNtJQyLvw0X3qRiRt83aaLDdbTSyHKBCfL1oi1fnami qCb5SjvvVHbKpmwFl1fgHrX0/Posn5ab3sZznaTxNKt9Rz9lAPPSNyjf0EWeNHWn9ae1 +nVGD0ec9Mj14YMPG2ZXT/I+wYDpOOyoDgV/Ah2HkB58QrzcuEPoIWPgNlTi5lXituGc HLm8DVpG8fEI8xMX+yoQoJ702DmgbD10bm4mU4vJT6oHcg3DpegfjhrjdWE7bL2VmT4P NzdBG8tbTHaT4J/hzBpNjoifI5xPQW1Ay+rRPUm8lNggS+EA6WLbQUnnJEikEJ8VD6UO TGSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=agcU8PU+am4KQipXWAsqAfuILAtcc1PC7kKsckqLgtc=; b=iQrF45CC8z6PQ2wsBvl6Szk0/AO1TBSbNJVgqeztm0KxH7yR5YtRQLCbmflLl/Vlzk c+zPAhq9k44K98tMh7x3c/JuQJi0SF08qmD13G4m7U7fuWsFR25oiXQp85Aj/vzcSdYL LKoijB6qaBe58QpOXeBmp9spWJHDWGr9m2wf7IvtP12ZIUGS+V+BzfsNDh6byFZ0oFJu c2fcjV14vlyXKVs2VQbX/dzOdFuGA22ZWVTlp6S9yKuVpIthpqeVZf8r856W2O3HfeFC M67aTeDJwikz2qCyNzNGII6Y6xnuEmkKFk0fOOreD1Km0tQzZ9csDa4aRoxmvgSf2afk Op8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WCjnAx5J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n9-20020a509349000000b00458cba4c78bsi24324022eda.416.2022.10.24.05.20.10; Mon, 24 Oct 2022 05:20:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WCjnAx5J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232963AbiJXMPc (ORCPT + 99 others); Mon, 24 Oct 2022 08:15:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232999AbiJXMNk (ORCPT ); Mon, 24 Oct 2022 08:13:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8097C2183C; Mon, 24 Oct 2022 04:54:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 05AAC612BB; Mon, 24 Oct 2022 11:54:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15D75C433C1; Mon, 24 Oct 2022 11:54:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612457; bh=yxPrtX9CbNfBgVgzqmzwqBKqwbTagH6YcualEdEN0T4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WCjnAx5JRYLWC8a16w0fHq8QfEX/9yUoYNr2FrQbx8uIWKaMyMTGA3cP1MEpTB+nn jt0RQYJgWTRLA+8MSFBPP0boRt2fQhkR1mPK7B/Kk8JZspHVsiSHPDVix20mBS2WMb rSWyg05JHMxWsZzQ1TmbXVFHd1QlR1RdM/brvS/w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anna Schumaker , Chuck Lever , Sasha Levin Subject: [PATCH 4.14 166/210] NFSD: Return nfserr_serverfault if splice_ok but buf->pages have data Date: Mon, 24 Oct 2022 13:31:23 +0200 Message-Id: <20221024113002.349900124@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571484252068887?= X-GMAIL-MSGID: =?utf-8?q?1747571484252068887?= From: Anna Schumaker [ Upstream commit 06981d560606ac48d61e5f4fff6738b925c93173 ] This was discussed with Chuck as part of this patch set. Returning nfserr_resource was decided to not be the best error message here, and he suggested changing to nfserr_serverfault instead. Signed-off-by: Anna Schumaker Link: https://lore.kernel.org/linux-nfs/20220907195259.926736-1-anna@kernel.org/T/#t Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin --- fs/nfsd/nfs4xdr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 2e7349b2dd4d..c5c10b7dc63e 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -3550,7 +3550,7 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr, if (resp->xdr.buf->page_len && test_bit(RQ_SPLICE_OK, &resp->rqstp->rq_flags)) { WARN_ON_ONCE(1); - return nfserr_resource; + return nfserr_serverfault; } xdr_commit_encode(xdr); From patchwork Mon Oct 24 11:31:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8631 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp420754wru; Mon, 24 Oct 2022 05:18:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM40qRahv66PqSFOUYVGMnSrQeXGh6qAsQVf2eiVbaGWGU7hM1+emQe3mNgZDAZhinTD2OPS X-Received: by 2002:a17:907:78b:b0:741:3d29:33d2 with SMTP id xd11-20020a170907078b00b007413d2933d2mr28433017ejb.103.1666613929821; Mon, 24 Oct 2022 05:18:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613929; cv=none; d=google.com; s=arc-20160816; b=NK2cJHcmYrYKtf4KY7pt1UZUq853e3TSrTItcpG4jujj/sRsmpuv3/zRrcmGabKEaK SrA4zSWePxn9ezZTNCPw+Fja4GsQqBtmf17XcNMrpIHniRw/1ZKe9XDPKF2JFUtkUTfP XRLSUiOf9irnu+BYCukjyTl0MZTFS/RhDqkknjoA9eqo7i4Nr7fB4ppx8rNdDGX0Gm+T YfFQhIBV/mwvvIgNEIvSeCZ+gO0GASr9mnl1VYc5q9xzFmfoeRJneBSGEyeIvPpsKIm6 eq6Dp/d3SKor6/UKxaKeZok/aZXENbQq700NhrL7UjKl6RTqfCEFBLm/h1/JlqrJIdJ4 d5tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dKvHghGnKL3Nb1N/EU4WBshHLTLebbQD0llejKM7Geo=; b=ukEV62Xir3lWxu0B8eBHJ1EzW7nHEa1IiU804W+/SSXdIEWIJTPZXb+YZWQz3iHxl7 PFMeHbNbHNcOi+ew9iiYPoEpXA3wDA9yk6+mJB8MW9Ea+5Te1n74Wm2yY3CFAtgxJLXh bcCt4rOIuGZpAtH2NZ0/0WA07V+QvwHzRdvbiqolXzWLyIFG8feXSIbmNnrdj84BBOeI XLHcYqtRJdvAyD3Kz1cnWzOLLFijMSEy7J53x+sL3TE2743xTErFlDgslADuvcgdroQb zyMeIU9/OUMWXGCB+tGwBZQZ7MTC+k9vVD+kgH7QqIped139rra14DVnU5REb0Sq3Mck SYuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qHQ33579; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xc9-20020a170907074900b00730aa841c5bsi27430918ejb.964.2022.10.24.05.18.24; Mon, 24 Oct 2022 05:18:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qHQ33579; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232946AbiJXMM0 (ORCPT + 99 others); Mon, 24 Oct 2022 08:12:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232892AbiJXMLc (ORCPT ); Mon, 24 Oct 2022 08:11:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32F7D8050C; Mon, 24 Oct 2022 04:53:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BC037612CE; Mon, 24 Oct 2022 11:52:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CECBFC433D7; Mon, 24 Oct 2022 11:52:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612376; bh=UXuYkRg57IpIdhL+0EpbJonj4qIC8kvPF/3E5EhuwQc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qHQ33579mcJ5q/aB2Eo40uO8cdxbXU9NNs62vB5GniWq+32yHqBxCBua6Y8CdwDcM nqElLPQLnPJG6dB9SLtminGnSzGv0pYngepHmtH99YRqG5mWZckp8xkNUkl5h60nwX Xxvwtg226loIL+YA+kR86myoaXglIY4d1kF8PJIo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wright Feng , Chi-hsien Lin , Ahmad Fatoum , =?utf-8?q?Alvin_=C5=A0ipraga?= , Kalle Valo , Sasha Levin Subject: [PATCH 4.14 167/210] wifi: brcmfmac: fix invalid address access when enabling SCAN log level Date: Mon, 24 Oct 2022 13:31:24 +0200 Message-Id: <20221024113002.383490613@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571368195041002?= X-GMAIL-MSGID: =?utf-8?q?1747571368195041002?= From: Wright Feng [ Upstream commit aa666b68e73fc06d83c070d96180b9010cf5a960 ] The variable i is changed when setting random MAC address and causes invalid address access when printing the value of pi->reqs[i]->reqid. We replace reqs index with ri to fix the issue. [ 136.726473] Unable to handle kernel access to user memory outside uaccess routines at virtual address 0000000000000000 [ 136.737365] Mem abort info: [ 136.740172] ESR = 0x96000004 [ 136.743359] Exception class = DABT (current EL), IL = 32 bits [ 136.749294] SET = 0, FnV = 0 [ 136.752481] EA = 0, S1PTW = 0 [ 136.755635] Data abort info: [ 136.758514] ISV = 0, ISS = 0x00000004 [ 136.762487] CM = 0, WnR = 0 [ 136.765522] user pgtable: 4k pages, 48-bit VAs, pgdp = 000000005c4e2577 [ 136.772265] [0000000000000000] pgd=0000000000000000 [ 136.777160] Internal error: Oops: 96000004 [#1] PREEMPT SMP [ 136.782732] Modules linked in: brcmfmac(O) brcmutil(O) cfg80211(O) compat(O) [ 136.789788] Process wificond (pid: 3175, stack limit = 0x00000000053048fb) [ 136.796664] CPU: 3 PID: 3175 Comm: wificond Tainted: G O 4.19.42-00001-g531a5f5 #1 [ 136.805532] Hardware name: Freescale i.MX8MQ EVK (DT) [ 136.810584] pstate: 60400005 (nZCv daif +PAN -UAO) [ 136.815429] pc : brcmf_pno_config_sched_scans+0x6cc/0xa80 [brcmfmac] [ 136.821811] lr : brcmf_pno_config_sched_scans+0x67c/0xa80 [brcmfmac] [ 136.828162] sp : ffff00000e9a3880 [ 136.831475] x29: ffff00000e9a3890 x28: ffff800020543400 [ 136.836786] x27: ffff8000b1008880 x26: ffff0000012bf6a0 [ 136.842098] x25: ffff80002054345c x24: ffff800088d22400 [ 136.847409] x23: ffff0000012bf638 x22: ffff0000012bf6d8 [ 136.852721] x21: ffff8000aced8fc0 x20: ffff8000ac164400 [ 136.858032] x19: ffff00000e9a3946 x18: 0000000000000000 [ 136.863343] x17: 0000000000000000 x16: 0000000000000000 [ 136.868655] x15: ffff0000093f3b37 x14: 0000000000000050 [ 136.873966] x13: 0000000000003135 x12: 0000000000000000 [ 136.879277] x11: 0000000000000000 x10: ffff000009a61888 [ 136.884589] x9 : 000000000000000f x8 : 0000000000000008 [ 136.889900] x7 : 303a32303d726464 x6 : ffff00000a1f957d [ 136.895211] x5 : 0000000000000000 x4 : ffff00000e9a3942 [ 136.900523] x3 : 0000000000000000 x2 : ffff0000012cead8 [ 136.905834] x1 : ffff0000012bf6d8 x0 : 0000000000000000 [ 136.911146] Call trace: [ 136.913623] brcmf_pno_config_sched_scans+0x6cc/0xa80 [brcmfmac] [ 136.919658] brcmf_pno_start_sched_scan+0xa4/0x118 [brcmfmac] [ 136.925430] brcmf_cfg80211_sched_scan_start+0x80/0xe0 [brcmfmac] [ 136.931636] nl80211_start_sched_scan+0x140/0x308 [cfg80211] [ 136.937298] genl_rcv_msg+0x358/0x3f4 [ 136.940960] netlink_rcv_skb+0xb4/0x118 [ 136.944795] genl_rcv+0x34/0x48 [ 136.947935] netlink_unicast+0x264/0x300 [ 136.951856] netlink_sendmsg+0x2e4/0x33c [ 136.955781] __sys_sendto+0x120/0x19c Signed-off-by: Wright Feng Signed-off-by: Chi-hsien Lin Signed-off-by: Ahmad Fatoum Signed-off-by: Alvin Šipraga Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220722115632.620681-4-alvin@pqrs.dk Signed-off-by: Sasha Levin --- .../net/wireless/broadcom/brcm80211/brcmfmac/pno.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c index ffa243e2e2d0..581a23549ee5 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c @@ -163,12 +163,12 @@ static int brcmf_pno_set_random(struct brcmf_if *ifp, struct brcmf_pno_info *pi) struct brcmf_pno_macaddr_le pfn_mac; u8 *mac_addr = NULL; u8 *mac_mask = NULL; - int err, i; + int err, i, ri; - for (i = 0; i < pi->n_reqs; i++) - if (pi->reqs[i]->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { - mac_addr = pi->reqs[i]->mac_addr; - mac_mask = pi->reqs[i]->mac_addr_mask; + for (ri = 0; ri < pi->n_reqs; ri++) + if (pi->reqs[ri]->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { + mac_addr = pi->reqs[ri]->mac_addr; + mac_mask = pi->reqs[ri]->mac_addr_mask; break; } @@ -190,7 +190,7 @@ static int brcmf_pno_set_random(struct brcmf_if *ifp, struct brcmf_pno_info *pi) pfn_mac.mac[0] |= 0x02; brcmf_dbg(SCAN, "enabling random mac: reqid=%llu mac=%pM\n", - pi->reqs[i]->reqid, pfn_mac.mac); + pi->reqs[ri]->reqid, pfn_mac.mac); err = brcmf_fil_iovar_data_set(ifp, "pfn_macaddr", &pfn_mac, sizeof(pfn_mac)); if (err) From patchwork Mon Oct 24 11:31:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8674 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422117wru; Mon, 24 Oct 2022 05:21:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4foH5fICsmdtYLMtjvmuIXUBbx57fzj+tGpdihwnrI9RHfQuQI2ni2W7MZeaTawFh//l+m X-Received: by 2002:a05:6402:548f:b0:457:ed40:5f58 with SMTP id fg15-20020a056402548f00b00457ed405f58mr30361682edb.408.1666614115413; Mon, 24 Oct 2022 05:21:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614115; cv=none; d=google.com; s=arc-20160816; b=Hxx+IHCiecgyen8ZTP1Defv22PCG/emspdJ23svk/L/hqbTT3ov/pN+2L8MoJo0nmw WiczilMeUW1r+ZNWMqbS8Qg9w9AZNGCBwVTlPsikMTOQ+DhIDRbHURFmI3YTM47ueO0X DJOFqXMf8DlejL4ux83y8D3nQHwqy0hVhJ9udGoFh1D146Xuf9CWqHbA7qMmfF73o7b9 c+N/T418/9jSkr64ziJciXRJmmz7mBE2LYRx7LTy8GfGZh/+SNhrQfpZ6Wv5mGK+9Co8 LOLVHzSBU2mHAozBHVFXKB0S8lYZ4Hbe5bK+NnRIgtoQ5DSFZ9Ti3WSrZ1y55W/92sdB No5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IzvbIhC6o0jgM2WbEsNYvNCX3tw9NXqhMv0b1hxbZNY=; b=r6TAm0N+/kY6rL26KSPaFEWaGyms9ztaRbdYJN5/u5cqs7B4gc+bdWbGWAdhqUEUgD cbgDbbh6/3Xy8VxuNRgjrLBb7L8n56CtYlI+PrWesiZ/Agr2jhpZtTYCT2gSP9D+IMNm gR7tqkPRLj9utD7MX61W1hJOGI3gfYJdVzgT4+tfTLOzfWkTOTWxl9HNxRr3CccbB4c6 XazAz9lHGh65khvRp4XCc8UVC057DTDnce6TOVX2I8QwJuqFynIFTZuibu2LAHGfRy5U ZxP6slT+INv3y71au9qdvtvdIYSX7lr3cS3gSpSfdIwADe7AECW9c3/a2ScfQbDK5X9K Mg7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hiKIzA1z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ho30-20020a1709070e9e00b007a6ec6fb027si3743418ejc.538.2022.10.24.05.21.30; Mon, 24 Oct 2022 05:21:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hiKIzA1z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233096AbiJXMS6 (ORCPT + 99 others); Mon, 24 Oct 2022 08:18:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233095AbiJXMSH (ORCPT ); Mon, 24 Oct 2022 08:18:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CF8277542; Mon, 24 Oct 2022 04:57:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 567A0B811A1; Mon, 24 Oct 2022 11:53:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4B50C433D6; Mon, 24 Oct 2022 11:53:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612405; bh=m6NQJ5EmDqzyBSscFVL9+7RWcSwAfWV9TMWJzvPm/kc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hiKIzA1zAInlGpBMMoB4C7wlWOL7Re7MhfZhge68XSw0yH5MPoZLt64PDKVzpzdgL IsNf8RTfinOds2pjawK8p0oW+ZTEy6QGukwW3wI01kPnFbv44Wf1TL+Z2polw2J+w6 Hhw7fpx08hEbVvdfMm9Yf+jr7q0jODgRGsG/DCKc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mike Pattrick , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 168/210] openvswitch: Fix double reporting of drops in dropwatch Date: Mon, 24 Oct 2022 13:31:25 +0200 Message-Id: <20221024113002.413948464@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571563013213852?= X-GMAIL-MSGID: =?utf-8?q?1747571563013213852?= From: Mike Pattrick [ Upstream commit 1100248a5c5ccd57059eb8d02ec077e839a23826 ] Frames sent to userspace can be reported as dropped in ovs_dp_process_packet, however, if they are dropped in the netlink code then netlink_attachskb will report the same frame as dropped. This patch checks for error codes which indicate that the frame has already been freed. Signed-off-by: Mike Pattrick Link: https://bugzilla.redhat.com/show_bug.cgi?id=2109946 Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/openvswitch/datapath.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index 3248cf04d0b3..42616aca0ce4 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -276,10 +276,17 @@ void ovs_dp_process_packet(struct sk_buff *skb, struct sw_flow_key *key) upcall.portid = ovs_vport_find_upcall_portid(p, skb); upcall.mru = OVS_CB(skb)->mru; error = ovs_dp_upcall(dp, skb, key, &upcall, 0); - if (unlikely(error)) - kfree_skb(skb); - else + switch (error) { + case 0: + case -EAGAIN: + case -ERESTARTSYS: + case -EINTR: consume_skb(skb); + break; + default: + kfree_skb(skb); + break; + } stats_counter = &stats->n_missed; goto out; } From patchwork Mon Oct 24 11:31:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8642 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421366wru; Mon, 24 Oct 2022 05:20:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7IjmlAEb4QF7jloQraal0jDl8RJbW4Vg0LYGG3p0G91+vnXsB7MjM9eCDuOSc0KHsM3PPf X-Received: by 2002:a05:6402:501b:b0:459:df91:983 with SMTP id p27-20020a056402501b00b00459df910983mr29131552eda.85.1666614021750; Mon, 24 Oct 2022 05:20:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614021; cv=none; d=google.com; s=arc-20160816; b=mYDShLsVNdOMZ1v1wdSfWqmj/DDqO2MOtkqTI5Sm4cIH+JrbPq3eBNPI+MGXPEVHmb zkKGrXTFowqbq88nfyXthFOB8xwTZSkuIFRg6ficJ3D6t9nhuyAY4Ekyy+pGFQrkxW7L w/1vQJW/wZDpx0ySCTSZIdy+Ikm/RCdkHuTgrRjs0n3VIRxPigT6fzxxJr0tAKkfdXaN 6LrTRQTFy0YLmIy1JVJjDBjbC1X8UjJ6yWTeCfpPWzYjODxK/8Zqz0jTtkUXtv3swIXR Ko08xdvSRCp5muvoFRnmrFPWUAaO1TML04+0QDOxyHAovIOhykFTtxsgyNzEZ5uj3NtE 5u3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iJgKrqMAHLDOosWai9oZGHxyTmfi8AHkDf3qEj21waA=; b=IwZHFrnnojlU1S09dcnbdTb/SM/lC33n6AukAxicUwX5g9gzwKjE+Nx86egBdgmEIZ TTYCx2FLUnAGDNyTRTSx+Othq9R01dK8aokMt21LAp6mmpWTqLhZXZVAc1lMVKk+jDw+ WHlK2q/utXiQoEdu2uaRlaxGcaFo8EI1Pkq/oEzfKaZ3fh3BwEukWIfdwlIQfwiSmHwk 57fxaXDpsvC8mIgWGBNy1e1VrCOC0k3FqZzEOLd+05kqETg7lKJ78zapnN1vIcvmTFQL 0C/yVaUSrB+oRiijRO4PwiHW4HVmpTOK2bDFTjq91NCsVkqJiLL0/eU94Nn26E8NE7jL 5Aig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yC4nDoDc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id eb10-20020a0564020d0a00b004537a3c4982si31382239edb.601.2022.10.24.05.19.57; Mon, 24 Oct 2022 05:20:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yC4nDoDc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232939AbiJXMNs (ORCPT + 99 others); Mon, 24 Oct 2022 08:13:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232860AbiJXMM7 (ORCPT ); Mon, 24 Oct 2022 08:12:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A0B6BFF; Mon, 24 Oct 2022 04:54:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5477E612C3; Mon, 24 Oct 2022 11:53:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64064C433D6; Mon, 24 Oct 2022 11:53:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612433; bh=T1RzVjYOnfsNgB+jghQGsmTf4DSzu07LR8BVos8WFwI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yC4nDoDcChHXyCW70fXrotDveOrj3iQhI3DSika2TKySqv4SNdT4gW8YtyALvBp1Q b9af1PgrDoU4tFPlqbOSlyKT0nUMIwkbYVcF8lKkHljax6FxbR1/rt3NHfftooyNR+ PQGFQLAHaM76hmJ7iZ9g7GZEflNL4Uqs/UwhxolA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mike Pattrick , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 169/210] openvswitch: Fix overreporting of drops in dropwatch Date: Mon, 24 Oct 2022 13:31:26 +0200 Message-Id: <20221024113002.443916899@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571464559850332?= X-GMAIL-MSGID: =?utf-8?q?1747571464559850332?= From: Mike Pattrick [ Upstream commit c21ab2afa2c64896a7f0e3cbc6845ec63dcfad2e ] Currently queue_userspace_packet will call kfree_skb for all frames, whether or not an error occurred. This can result in a single dropped frame being reported as multiple drops in dropwatch. This functions caller may also call kfree_skb in case of an error. This patch will consume the skbs instead and allow caller's to use kfree_skb. Signed-off-by: Mike Pattrick Link: https://bugzilla.redhat.com/show_bug.cgi?id=2109957 Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/openvswitch/datapath.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index 42616aca0ce4..8319628ab428 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -553,8 +553,9 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb, out: if (err) skb_tx_error(skb); - kfree_skb(user_skb); - kfree_skb(nskb); + consume_skb(user_skb); + consume_skb(nskb); + return err; } From patchwork Mon Oct 24 11:31:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8829 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431365wru; Mon, 24 Oct 2022 05:43:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6i/M1lir3T01eSilhCdGVJnbavEjCEFgNGyoihCp68sin5Oydt2yI+yyA/n+I4PWqnGzM5 X-Received: by 2002:a17:90b:128a:b0:213:26c2:2c06 with SMTP id fw10-20020a17090b128a00b0021326c22c06mr1949933pjb.26.1666615415056; Mon, 24 Oct 2022 05:43:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615415; cv=none; d=google.com; s=arc-20160816; b=uAZn8PcROnoU0GPkKO8aqbQlw1pd7c7G9nPuIqQdL8no+7cKGa+g8V4tA2eeq9O7kX R9LhLGfFrUAJ5Ra1uEOdsM9o4CECpe49aunScgL0c2Jg93G3pKtIZiBEyHyEurq8KIB4 YVRvQDbam2wmGdtkFc0iHO12osJwS/bNGfEJ8FezM7bT5DkXxLw9wEC/Ym1Q+6o/fp1S hLjbvKWTAg713sbNVaYThp0s91O7f8bGy1ahXOnx0RazrVrpXOJlpQyVnP1seA8QXZ2P tB54T0addDUthGt4uDbnoYnRdz5QdlSX5BcuQlgVduxWdVPdIuWGAcerp+YPMctAzD6b WHFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uvEApS0wshbys1Rs6bUCZZy7+ucJ+fcPABWMcKcZKW0=; b=F5PiKhktE57GNMStk34ylCGpWyxzKt/k816bn0OeI2bStCLOWkeilDtjbilhauOPDP pO7z5V59C9XzXXEcidV9aSrFmW5sveXNkl+dqxweWy3UaCwsQCfYT7Tq1orQUKMDquU8 Uq9kswyuEyBj0dbWONS9b7QaP/3/m5hIzDe6Isxh91gvf7G/jf5zrydbsXQbrtKTdE6i FjKhguXrA4BLtrKJsXCBUIrYwraSinAkCreursbi3QepYHCl99vpq/KABU0TUzZ0upjp NZ6AtJgdZ/11O/uKLcZmw8qtrFKBLWuPWNSS1OP9AN9oVeqopVGJw6fmQb967/W6oSm6 XfKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=evQIM6SS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bj3-20020a170902850300b00178488bcbccsi30819568plb.239.2022.10.24.05.43.17; Mon, 24 Oct 2022 05:43:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=evQIM6SS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234137AbiJXMeJ (ORCPT + 99 others); Mon, 24 Oct 2022 08:34:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234173AbiJXM3c (ORCPT ); Mon, 24 Oct 2022 08:29:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D001987FBD; Mon, 24 Oct 2022 05:03:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 29C10612D7; Mon, 24 Oct 2022 11:54:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B570C433C1; Mon, 24 Oct 2022 11:54:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612441; bh=1uEidU8QdesxzO/5otIAs5DQ7Dws8bVQHAz3M3ORzmU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=evQIM6SSs1whdlifhKMhQsS+SI4ObXY3BiVGy212LJjS+m3YA0aV2ULMISxy9zcx+ QwHclamxWF/YuqhlECZM9b6jFjsIpqYEn7jRjYz7P8IAH+bu3VJLcjnZ5T5mdpwHgJ r7ak5SYKc13j1dI6yIf4ipJryx/zsg3/wgp2qn7I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Abhishek Shah , Eric Dumazet , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 170/210] tcp: annotate data-race around tcp_md5sig_pool_populated Date: Mon, 24 Oct 2022 13:31:27 +0200 Message-Id: <20221024113002.473610446@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572925449494755?= X-GMAIL-MSGID: =?utf-8?q?1747572925449494755?= From: Eric Dumazet [ Upstream commit aacd467c0a576e5e44d2de4205855dc0fe43f6fb ] tcp_md5sig_pool_populated can be read while another thread changes its value. The race has no consequence because allocations are protected with tcp_md5sig_mutex. This patch adds READ_ONCE() and WRITE_ONCE() to document the race and silence KCSAN. Reported-by: Abhishek Shah Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv4/tcp.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 783d0cd4fcbd..3a5f5bcedb3b 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -3318,12 +3318,16 @@ static void __tcp_alloc_md5sig_pool(void) * to memory. See smp_rmb() in tcp_get_md5sig_pool() */ smp_wmb(); - tcp_md5sig_pool_populated = true; + /* Paired with READ_ONCE() from tcp_alloc_md5sig_pool() + * and tcp_get_md5sig_pool(). + */ + WRITE_ONCE(tcp_md5sig_pool_populated, true); } bool tcp_alloc_md5sig_pool(void) { - if (unlikely(!tcp_md5sig_pool_populated)) { + /* Paired with WRITE_ONCE() from __tcp_alloc_md5sig_pool() */ + if (unlikely(!READ_ONCE(tcp_md5sig_pool_populated))) { mutex_lock(&tcp_md5sig_mutex); if (!tcp_md5sig_pool_populated) @@ -3331,7 +3335,8 @@ bool tcp_alloc_md5sig_pool(void) mutex_unlock(&tcp_md5sig_mutex); } - return tcp_md5sig_pool_populated; + /* Paired with WRITE_ONCE() from __tcp_alloc_md5sig_pool() */ + return READ_ONCE(tcp_md5sig_pool_populated); } EXPORT_SYMBOL(tcp_alloc_md5sig_pool); @@ -3347,7 +3352,8 @@ struct tcp_md5sig_pool *tcp_get_md5sig_pool(void) { local_bh_disable(); - if (tcp_md5sig_pool_populated) { + /* Paired with WRITE_ONCE() from __tcp_alloc_md5sig_pool() */ + if (READ_ONCE(tcp_md5sig_pool_populated)) { /* coupled with smp_wmb() in __tcp_alloc_md5sig_pool() */ smp_rmb(); return this_cpu_ptr(&tcp_md5sig_pool); From patchwork Mon Oct 24 11:31:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8640 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421357wru; Mon, 24 Oct 2022 05:20:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5WOLyXj7M9kTfdLZjiNNsio+5udFgiiQ47a2AY73kmo9JvGKGeWKgjW8dpGIJvdnvl51MY X-Received: by 2002:a17:906:730e:b0:78d:94ab:77c2 with SMTP id di14-20020a170906730e00b0078d94ab77c2mr27298484ejc.639.1666614020869; Mon, 24 Oct 2022 05:20:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614020; cv=none; d=google.com; s=arc-20160816; b=KOuFtP9EB/H6gRtjtIK0tJgty1A+Ggqxuu6WFwHIWjBaBBpJPRkho0XNkA0p1TD8sF aH/tZ50QhT6FgaulE7XKozvaGUW/fuOhMfRVcqrXzhwmASQq56YoQ1npvcVCrBoNICuZ HSxfRdXy9D9KYA6xQ/N1aKmDN5OIoybmJllMwov8tIuO9aYKrq553YHXxZVj0XxQRymu 9rtgIAw3ABNw8Dtc5FCNNKaGAMVyvXSmZ9X+zRJsLad/FPaea6mXXzq4Xm61ygWUIbZt 4H5zlXdwB24DsUmX6RrpKrVZngIDBdfp1BMyxBF82pQqaROr/MPJWyPW+Ux7uHlrDfZB NmKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NR1z0r9gT6UvmrKCjILK1I/gbXSLbg6botcZNy4HE1I=; b=JrRESZLkqgnDHm+mXxR7S79k0ToYlgarModdpoN2JJfqY7PIZO7InCfIJljF5Sk3f9 KrvGHSjvXxgx6EtLzUyaW+G2q5Rrbc8lhTGwHudI9/o/qcWSoOC0q6jPs1NGH2F2pXxq 7BInt24Cxx+Em1zwV6XG5scKZz5Twa1eewfOsU3XEl+mmqxet2Jeo2BXp3clJSbaLop7 +VLQS3JX1WXh7vziQaOW59GmWzpZ9GNdTKissQFnkB8VaLoSJMs0hX30kZCh8+4giiRR 1w1k9S0GI7FOXk0u9EGI/5QvU2zIs+nvgiLixGJw1nGjbsm4OwFnuenIHQ2XdaIKP3RW dJ4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yXKhSn3c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sg8-20020a170907a40800b007807e2ff1besi26145668ejc.918.2022.10.24.05.19.57; Mon, 24 Oct 2022 05:20:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yXKhSn3c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233008AbiJXMNv (ORCPT + 99 others); Mon, 24 Oct 2022 08:13:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232938AbiJXMNK (ORCPT ); Mon, 24 Oct 2022 08:13:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 545C111473; Mon, 24 Oct 2022 04:54:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C8420612DB; Mon, 24 Oct 2022 11:54:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6A92C43470; Mon, 24 Oct 2022 11:54:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612444; bh=m/QdiEsyaqsXyeYZVuoxXTWReCx/204ZsauJ1OlEs0U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yXKhSn3c9zyz7azQCNhd95XmoXQZJScmipbraXVs3cYhKydUo7kPoFXc0mQxM5EPz CDxEZ5VmpC0eFKjoxhCnsKAiODMVQe2Pg7eNPb5mpatCO/fe/L2edFRXMVal031cNP Y9px+22nGJUmXvZ+8fT+sxwKCW2rJGvWSxRZtwrw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Tetsuo Handa , =?utf-8?q?Toke_H=C3=B8il?= =?utf-8?q?and-J=C3=B8rgensen?= , Kalle Valo , Sasha Levin Subject: [PATCH 4.14 171/210] wifi: ath9k: avoid uninit memory read in ath9k_htc_rx_msg() Date: Mon, 24 Oct 2022 13:31:28 +0200 Message-Id: <20221024113002.508144717@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571463291067977?= X-GMAIL-MSGID: =?utf-8?q?1747571463291067977?= From: Tetsuo Handa [ Upstream commit b383e8abed41cc6ff1a3b34de75df9397fa4878c ] syzbot is reporting uninit value at ath9k_htc_rx_msg() [1], for ioctl(USB_RAW_IOCTL_EP_WRITE) can call ath9k_hif_usb_rx_stream() with pkt_len = 0 but ath9k_hif_usb_rx_stream() uses __dev_alloc_skb(pkt_len + 32, GFP_ATOMIC) based on an assumption that pkt_len is valid. As a result, ath9k_hif_usb_rx_stream() allocates skb with uninitialized memory and ath9k_htc_rx_msg() is reading from uninitialized memory. Since bytes accessed by ath9k_htc_rx_msg() is not known until ath9k_htc_rx_msg() is called, it would be difficult to check minimal valid pkt_len at "if (pkt_len > 2 * MAX_RX_BUF_SIZE) {" line in ath9k_hif_usb_rx_stream(). We have two choices. One is to workaround by adding __GFP_ZERO so that ath9k_htc_rx_msg() sees 0 if pkt_len is invalid. The other is to let ath9k_htc_rx_msg() validate pkt_len before accessing. This patch chose the latter. Note that I'm not sure threshold condition is correct, for I can't find details on possible packet length used by this protocol. Link: https://syzkaller.appspot.com/bug?extid=2ca247c2d60c7023de7f [1] Reported-by: syzbot Signed-off-by: Tetsuo Handa Acked-by: Toke Høiland-Jørgensen Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/7acfa1be-4b5c-b2ce-de43-95b0593fb3e5@I-love.SAKURA.ne.jp Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath9k/htc_hst.c | 43 +++++++++++++++--------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c b/drivers/net/wireless/ath/ath9k/htc_hst.c index e37de14bc502..6d69cf69fd86 100644 --- a/drivers/net/wireless/ath/ath9k/htc_hst.c +++ b/drivers/net/wireless/ath/ath9k/htc_hst.c @@ -367,33 +367,27 @@ void ath9k_htc_txcompletion_cb(struct htc_target *htc_handle, } static void ath9k_htc_fw_panic_report(struct htc_target *htc_handle, - struct sk_buff *skb) + struct sk_buff *skb, u32 len) { uint32_t *pattern = (uint32_t *)skb->data; - switch (*pattern) { - case 0x33221199: - { + if (*pattern == 0x33221199 && len >= sizeof(struct htc_panic_bad_vaddr)) { struct htc_panic_bad_vaddr *htc_panic; htc_panic = (struct htc_panic_bad_vaddr *) skb->data; dev_err(htc_handle->dev, "ath: firmware panic! " "exccause: 0x%08x; pc: 0x%08x; badvaddr: 0x%08x.\n", htc_panic->exccause, htc_panic->pc, htc_panic->badvaddr); - break; - } - case 0x33221299: - { + return; + } + if (*pattern == 0x33221299) { struct htc_panic_bad_epid *htc_panic; htc_panic = (struct htc_panic_bad_epid *) skb->data; dev_err(htc_handle->dev, "ath: firmware panic! " "bad epid: 0x%08x\n", htc_panic->epid); - break; - } - default: - dev_err(htc_handle->dev, "ath: unknown panic pattern!\n"); - break; + return; } + dev_err(htc_handle->dev, "ath: unknown panic pattern!\n"); } /* @@ -414,16 +408,26 @@ void ath9k_htc_rx_msg(struct htc_target *htc_handle, if (!htc_handle || !skb) return; + /* A valid message requires len >= 8. + * + * sizeof(struct htc_frame_hdr) == 8 + * sizeof(struct htc_ready_msg) == 8 + * sizeof(struct htc_panic_bad_vaddr) == 16 + * sizeof(struct htc_panic_bad_epid) == 8 + */ + if (unlikely(len < sizeof(struct htc_frame_hdr))) + goto invalid; htc_hdr = (struct htc_frame_hdr *) skb->data; epid = htc_hdr->endpoint_id; if (epid == 0x99) { - ath9k_htc_fw_panic_report(htc_handle, skb); + ath9k_htc_fw_panic_report(htc_handle, skb, len); kfree_skb(skb); return; } if (epid < 0 || epid >= ENDPOINT_MAX) { +invalid: if (pipe_id != USB_REG_IN_PIPE) dev_kfree_skb_any(skb); else @@ -435,21 +439,30 @@ void ath9k_htc_rx_msg(struct htc_target *htc_handle, /* Handle trailer */ if (htc_hdr->flags & HTC_FLAGS_RECV_TRAILER) { - if (be32_to_cpu(*(__be32 *) skb->data) == 0x00C60000) + if (be32_to_cpu(*(__be32 *) skb->data) == 0x00C60000) { /* Move past the Watchdog pattern */ htc_hdr = (struct htc_frame_hdr *)(skb->data + 4); + len -= 4; + } } /* Get the message ID */ + if (unlikely(len < sizeof(struct htc_frame_hdr) + sizeof(__be16))) + goto invalid; msg_id = (__be16 *) ((void *) htc_hdr + sizeof(struct htc_frame_hdr)); /* Now process HTC messages */ switch (be16_to_cpu(*msg_id)) { case HTC_MSG_READY_ID: + if (unlikely(len < sizeof(struct htc_ready_msg))) + goto invalid; htc_process_target_rdy(htc_handle, htc_hdr); break; case HTC_MSG_CONNECT_SERVICE_RESPONSE_ID: + if (unlikely(len < sizeof(struct htc_frame_hdr) + + sizeof(struct htc_conn_svc_rspmsg))) + goto invalid; htc_process_conn_rsp(htc_handle, htc_hdr); break; default: From patchwork Mon Oct 24 11:31:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8650 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421567wru; Mon, 24 Oct 2022 05:20:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4sBQuy6nasQdI5+Fgh0+YV6o5jEFEJeabjNgFtjAowA3uvj/MX45AFSYIXBlBtnWJ9UjgT X-Received: by 2002:a17:907:724d:b0:78d:acf4:4c57 with SMTP id ds13-20020a170907724d00b0078dacf44c57mr27355057ejc.516.1666614049025; Mon, 24 Oct 2022 05:20:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614049; cv=none; d=google.com; s=arc-20160816; b=eDmu9x7oi9Cy34B6+hmCuQq33R4T7Gkb9bGPwcGrrE8vS2ODp4IQh0wu4o1jKQo8W2 4ZO3sLiq6jXQQpTQ06CbT7XEUUBamsoglSnTueUXnAi+b1/1/1kF18iMSZsQcjR1wV9r OGUVl5m90MLVNWVrRR3MZxAA3VX5duyPZk/fYtLSV6/9v72OicIfpnOWFKZA8PBoBzbf 8BRpTJ5qDzrdch6lX4l42g/9jh7Ki+YFGSfuu1AgZkSF7hNHd8od0O9Bv9ZXk2cDtDa8 4dCA/vI8xaobT7aWwwnB/4WBVYuDAuWDqjZIgpDbI80dYlijSH/yHLRhMnZUkPmA8zJ3 tTjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Tm717FB0OfzvRFjmRnD6aZ2+61xnbGzoQzQDqRQxaYQ=; b=mLtHKFvjxaRTiW18qaKVvv9Ru+QbA/8i3VVJDjE5oq8VrzOzksnKAEo09qW9OqaO6D adRLKtUMOHe+n3l7xp+CmJVLLQPNLRb7ka1PhMs8s1AkkseE8dsgU57nZ8o3fZNPPCjA Dx66MIZCsq+TP9eBE/tJ8oaupUVF1D/qVZwy7p0NK6iTtDnMXW246B4BoX8Reo1RXKCp 0K2SFC8OsPku+AyZ+mPfAjW8r+6/gRx0jPoydEjk7ganJO7tlLfhy5mJ+9IqI7I9FWLQ a0CR+BFtRiNU17CkrJAIoLfwO20y/byVv38/QIbFUfvxWAc4/xcBOKTdmP8CBOa2g4cs 1x6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RZKjxdQ9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k4-20020a50cb84000000b00453688643fasi24704379edi.260.2022.10.24.05.20.24; Mon, 24 Oct 2022 05:20:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RZKjxdQ9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230414AbiJXMN4 (ORCPT + 99 others); Mon, 24 Oct 2022 08:13:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232710AbiJXMNT (ORCPT ); Mon, 24 Oct 2022 08:13:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 694E81C410; Mon, 24 Oct 2022 04:54:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5F504612B3; Mon, 24 Oct 2022 11:54:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71AF3C433D6; Mon, 24 Oct 2022 11:54:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612446; bh=/XB4y2LpgVtKSLfj2FRGEXMsobFlbWAbbPzG5tqVxqA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RZKjxdQ9BC+/khYxsp+tmmdscO06X1tZI1GGCQbHgmFAw8/sJKeFz7MkYjYNRp52I 6/2GfwhCzitFK5hob0Y7sMLU0OA72VFWNuNcvHvRDOf9TBWLfA9+xSuYNUDksAXNpb srECbKOQrTkcwraxn9gTWDVyLol904IbQ1ib2GLA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Herbert Xu , syzbot+5ec9bb042ddfe9644773@syzkaller.appspotmail.com, Khalid Masum , Steffen Klassert , Sasha Levin Subject: [PATCH 4.14 172/210] xfrm: Update ipcomp_scratches with NULL when freed Date: Mon, 24 Oct 2022 13:31:29 +0200 Message-Id: <20221024113002.538535839@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571493272801038?= X-GMAIL-MSGID: =?utf-8?q?1747571493272801038?= From: Khalid Masum [ Upstream commit 8a04d2fc700f717104bfb95b0f6694e448a4537f ] Currently if ipcomp_alloc_scratches() fails to allocate memory ipcomp_scratches holds obsolete address. So when we try to free the percpu scratches using ipcomp_free_scratches() it tries to vfree non existent vm area. Described below: static void * __percpu *ipcomp_alloc_scratches(void) { ... scratches = alloc_percpu(void *); if (!scratches) return NULL; ipcomp_scratches does not know about this allocation failure. Therefore holding the old obsolete address. ... } So when we free, static void ipcomp_free_scratches(void) { ... scratches = ipcomp_scratches; Assigning obsolete address from ipcomp_scratches if (!scratches) return; for_each_possible_cpu(i) vfree(*per_cpu_ptr(scratches, i)); Trying to free non existent page, causing warning: trying to vfree existent vm area. ... } Fix this breakage by updating ipcomp_scrtches with NULL when scratches is freed Suggested-by: Herbert Xu Reported-by: syzbot+5ec9bb042ddfe9644773@syzkaller.appspotmail.com Tested-by: syzbot+5ec9bb042ddfe9644773@syzkaller.appspotmail.com Signed-off-by: Khalid Masum Acked-by: Herbert Xu Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin --- net/xfrm/xfrm_ipcomp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/xfrm/xfrm_ipcomp.c b/net/xfrm/xfrm_ipcomp.c index a00ec715aa46..32aed1d0f6ee 100644 --- a/net/xfrm/xfrm_ipcomp.c +++ b/net/xfrm/xfrm_ipcomp.c @@ -216,6 +216,7 @@ static void ipcomp_free_scratches(void) vfree(*per_cpu_ptr(scratches, i)); free_percpu(scratches); + ipcomp_scratches = NULL; } static void * __percpu *ipcomp_alloc_scratches(void) From patchwork Mon Oct 24 11:31:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9982 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp615298wru; Mon, 24 Oct 2022 12:26:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM58ZauKdIXFTz4Otb3n3cl2rEUGo85mePnmEAfY4/b87hkgQhFNc8ZXx0zxuf1h0LYPgMav X-Received: by 2002:a17:907:b1c:b0:797:983a:7d97 with SMTP id h28-20020a1709070b1c00b00797983a7d97mr21571650ejl.267.1666639563969; Mon, 24 Oct 2022 12:26:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666639563; cv=none; d=google.com; s=arc-20160816; b=Be3GxpQS+kApbmAJjwBqie+amVkAQ+WdusgYf0KzHhB5GBhZl0lLVXLhXoPJWBdN2x ETrOoGcoZmNcUrI3E/W46XdBYHLpyGtBNcIPyaDZKWi1YgHkMF1DMQ6NDB67o2Z779BY rolOd12gxAjUddVjZnTsPS4FfTmdN8ip0ts9ldBMa0Yxj4UBRV63jCXwcES7EukFItHF t3zAbcOeYz7X7YGh/c0WT7oEV6w59NpF53163MQMr7Sq98Kb6nh1a3F0o/OQ4usxbzRf pAGx8oARjjv8msJemo16PzDqtKWWmt5j21k1vg9wqJs3z5dtGlhDnLlp0dnceuYrjo2b vIeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UjLNf8zdX5k6SvXDI/S6DEX/Tz1Lf94yZDx7qZ84sz0=; b=0M6LwOqj3xKCiadKkl4Cp+tuj8DmrR3wF8sBZGyZEb+09OEVt4ItWlARHqvjwNJC/g 7HItRLcJFihW3huRSoBau8WETRfSZZ+DfhRmQgaC63lq+XUInCFF76elXEdcuLKonn1p 7xD4VHvRMHzFPKiuqWEbhjyEvh/6T9GFzz5n5S860LfMi2I0laN0QtE5AwvcAyNOdzBV GDURXxDM55xvnIC8P3XvbictwR6SJoYErF/8F4WcxCkfAr/6sgUARGmwPgQSllMYPSAy xdumYaMJQPreSxVMQBvBZFuhS4p6FSN5VQjJwoZWcaeIAKlOEtaBsycdPvTO9p377t5+ T/VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xHT7sHjc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f20-20020a056402355400b00458ff0764casi646455edd.95.2022.10.24.12.25.40; Mon, 24 Oct 2022 12:26:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xHT7sHjc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231135AbiJXTU2 (ORCPT + 99 others); Mon, 24 Oct 2022 15:20:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231206AbiJXTTm (ORCPT ); Mon, 24 Oct 2022 15:19:42 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 574688558A; Mon, 24 Oct 2022 10:56:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 1A9C8CE131D; Mon, 24 Oct 2022 11:54:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EAFBC433B5; Mon, 24 Oct 2022 11:54:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612449; bh=yqwMr7A4dyt1zETLxH21bVCLqABEenqVHFnpY7O232U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xHT7sHjcoaPmpaV+G7hFQtYemUPYBySZ0qKWeEYklTFhbB3Q7XRlYfPvNLYRD1/9O CnAC3zxZwCGI6PVhK79C5s36bjQYx/EYZSvXruct0tZrSu6NwzrY1W6O3LKJzQvD5o WMUvLZnpu8pJODOI0B05RCt3V/50UwNXFWwuGmJ0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Coffin , Kalle Valo , Sasha Levin Subject: [PATCH 4.14 173/210] wifi: brcmfmac: fix use-after-free bug in brcmf_netdev_start_xmit() Date: Mon, 24 Oct 2022 13:31:30 +0200 Message-Id: <20221024113002.569204279@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747598247294938234?= X-GMAIL-MSGID: =?utf-8?q?1747598247294938234?= From: Alexander Coffin [ Upstream commit 3f42faf6db431e04bf942d2ebe3ae88975723478 ] > ret = brcmf_proto_tx_queue_data(drvr, ifp->ifidx, skb); may be schedule, and then complete before the line > ndev->stats.tx_bytes += skb->len; [ 46.912801] ================================================================== [ 46.920552] BUG: KASAN: use-after-free in brcmf_netdev_start_xmit+0x718/0x8c8 [brcmfmac] [ 46.928673] Read of size 4 at addr ffffff803f5882e8 by task systemd-resolve/328 [ 46.935991] [ 46.937514] CPU: 1 PID: 328 Comm: systemd-resolve Tainted: G O 5.4.199-[REDACTED] #1 [ 46.947255] Hardware name: [REDACTED] [ 46.954568] Call trace: [ 46.957037] dump_backtrace+0x0/0x2b8 [ 46.960719] show_stack+0x24/0x30 [ 46.964052] dump_stack+0x128/0x194 [ 46.967557] print_address_description.isra.0+0x64/0x380 [ 46.972877] __kasan_report+0x1d4/0x240 [ 46.976723] kasan_report+0xc/0x18 [ 46.980138] __asan_report_load4_noabort+0x18/0x20 [ 46.985027] brcmf_netdev_start_xmit+0x718/0x8c8 [brcmfmac] [ 46.990613] dev_hard_start_xmit+0x1bc/0xda0 [ 46.994894] sch_direct_xmit+0x198/0xd08 [ 46.998827] __qdisc_run+0x37c/0x1dc0 [ 47.002500] __dev_queue_xmit+0x1528/0x21f8 [ 47.006692] dev_queue_xmit+0x24/0x30 [ 47.010366] neigh_resolve_output+0x37c/0x678 [ 47.014734] ip_finish_output2+0x598/0x2458 [ 47.018927] __ip_finish_output+0x300/0x730 [ 47.023118] ip_output+0x2e0/0x430 [ 47.026530] ip_local_out+0x90/0x140 [ 47.030117] igmpv3_sendpack+0x14c/0x228 [ 47.034049] igmpv3_send_cr+0x384/0x6b8 [ 47.037895] igmp_ifc_timer_expire+0x4c/0x118 [ 47.042262] call_timer_fn+0x1cc/0xbe8 [ 47.046021] __run_timers+0x4d8/0xb28 [ 47.049693] run_timer_softirq+0x24/0x40 [ 47.053626] __do_softirq+0x2c0/0x117c [ 47.057387] irq_exit+0x2dc/0x388 [ 47.060715] __handle_domain_irq+0xb4/0x158 [ 47.064908] gic_handle_irq+0x58/0xb0 [ 47.068581] el0_irq_naked+0x50/0x5c [ 47.072162] [ 47.073665] Allocated by task 328: [ 47.077083] save_stack+0x24/0xb0 [ 47.080410] __kasan_kmalloc.isra.0+0xc0/0xe0 [ 47.084776] kasan_slab_alloc+0x14/0x20 [ 47.088622] kmem_cache_alloc+0x15c/0x468 [ 47.092643] __alloc_skb+0xa4/0x498 [ 47.096142] igmpv3_newpack+0x158/0xd78 [ 47.099987] add_grhead+0x210/0x288 [ 47.103485] add_grec+0x6b0/0xb70 [ 47.106811] igmpv3_send_cr+0x2e0/0x6b8 [ 47.110657] igmp_ifc_timer_expire+0x4c/0x118 [ 47.115027] call_timer_fn+0x1cc/0xbe8 [ 47.118785] __run_timers+0x4d8/0xb28 [ 47.122457] run_timer_softirq+0x24/0x40 [ 47.126389] __do_softirq+0x2c0/0x117c [ 47.130142] [ 47.131643] Freed by task 180: [ 47.134712] save_stack+0x24/0xb0 [ 47.138041] __kasan_slab_free+0x108/0x180 [ 47.142146] kasan_slab_free+0x10/0x18 [ 47.145904] slab_free_freelist_hook+0xa4/0x1b0 [ 47.150444] kmem_cache_free+0x8c/0x528 [ 47.154292] kfree_skbmem+0x94/0x108 [ 47.157880] consume_skb+0x10c/0x5a8 [ 47.161466] __dev_kfree_skb_any+0x88/0xa0 [ 47.165598] brcmu_pkt_buf_free_skb+0x44/0x68 [brcmutil] [ 47.171023] brcmf_txfinalize+0xec/0x190 [brcmfmac] [ 47.176016] brcmf_proto_bcdc_txcomplete+0x1c0/0x210 [brcmfmac] [ 47.182056] brcmf_sdio_sendfromq+0x8dc/0x1e80 [brcmfmac] [ 47.187568] brcmf_sdio_dpc+0xb48/0x2108 [brcmfmac] [ 47.192529] brcmf_sdio_dataworker+0xc8/0x238 [brcmfmac] [ 47.197859] process_one_work+0x7fc/0x1a80 [ 47.201965] worker_thread+0x31c/0xc40 [ 47.205726] kthread+0x2d8/0x370 [ 47.208967] ret_from_fork+0x10/0x18 [ 47.212546] [ 47.214051] The buggy address belongs to the object at ffffff803f588280 [ 47.214051] which belongs to the cache skbuff_head_cache of size 208 [ 47.227086] The buggy address is located 104 bytes inside of [ 47.227086] 208-byte region [ffffff803f588280, ffffff803f588350) [ 47.238814] The buggy address belongs to the page: [ 47.243618] page:ffffffff00dd6200 refcount:1 mapcount:0 mapping:ffffff804b6bf800 index:0xffffff803f589900 compound_mapcount: 0 [ 47.255007] flags: 0x10200(slab|head) [ 47.258689] raw: 0000000000010200 ffffffff00dfa980 0000000200000002 ffffff804b6bf800 [ 47.266439] raw: ffffff803f589900 0000000080190018 00000001ffffffff 0000000000000000 [ 47.274180] page dumped because: kasan: bad access detected [ 47.279752] [ 47.281251] Memory state around the buggy address: [ 47.286051] ffffff803f588180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 47.293277] ffffff803f588200: fb fb fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 47.300502] >ffffff803f588280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 47.307723] ^ [ 47.314343] ffffff803f588300: fb fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc [ 47.321569] ffffff803f588380: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb [ 47.328789] ================================================================== Signed-off-by: Alexander Coffin Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220808174925.3922558-1-alex.coffin@matician.com Signed-off-by: Sasha Levin --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c index 590bef2defb9..9c8102be1d0b 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c @@ -200,6 +200,7 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb, struct brcmf_pub *drvr = ifp->drvr; struct ethhdr *eh; int head_delta; + unsigned int tx_bytes = skb->len; brcmf_dbg(DATA, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx); @@ -254,7 +255,7 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb, ndev->stats.tx_dropped++; } else { ndev->stats.tx_packets++; - ndev->stats.tx_bytes += skb->len; + ndev->stats.tx_bytes += tx_bytes; } /* Return ok: we always eat the packet */ From patchwork Mon Oct 24 11:31:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8644 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421398wru; Mon, 24 Oct 2022 05:20:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Gi0hmnUFIeCOEXrs2yyLsAJoZr/a9CpCOHJ6pEx/5PMWQJlaGMtAPz2Ax3uenfauT+6rZ X-Received: by 2002:aa7:cd92:0:b0:456:cbb5:2027 with SMTP id x18-20020aa7cd92000000b00456cbb52027mr30237851edv.384.1666614026975; Mon, 24 Oct 2022 05:20:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614026; cv=none; d=google.com; s=arc-20160816; b=yph+MDAHCTPAyL3/c+To/uN59jgiz+FVrdz0RyF5cmaS/gL6CcX1jsf5QuO5PUjfwI Z/ZYrYNn/Sp9URBRcuwV48Rei+05UdpWrHoRy53oMYCe7Q59d19DQPOlIFkM9hHB4ygK d61EJ47uQqLKfKuPq1FNWxf5yHq4+Du++MfGe3ry/sUp+r73ANk1sUWttv4NKEPd7gVB M4xElQGKtPoOAZ613USF5ojQX6vjDcoe5SpgkX0whcwD4dno9rg5Pfsz2xbEpY1vrLWo GY/8e1NEXPv23RgQCEAvH6LAhTlSUzjgDaYRQP3gU19eynzbZrNVFQuJFXSvvxkDy6SJ Rmbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NVT/JerDMzl8QV3J5oacykX3wH8ags76vEhgGLiV/ZQ=; b=EzF06oLDdUHW3zTZV6F9XNMEso7CCpAWiJ3gue/C5ON9UpuR42Qim5WCfWro5HXH9h h3/8BCbcIAOa8NymfyJ8FYXK3qN0s3Wz5Xxti0Pdr+6sbaM7FvtqWfHnezV2+1D0ktyP VX0M5LJgwnxf5dNd6Uawg/zD3a7nUDJmyqvRCF1jzns8gvgqq7ndsC5PRlGbyfnKrP3r i8sU0gZrEgYrebTjusB0gCfdGXQ1Eag9VuQHgzulG6+s9HIMIBtCv8u+4X1obsXoa9Fz LdMqCuC+Nsoin/LcJJ7Fkszfuf6i9FvyFo2L9J/pZrWMLB16G2tZzYTF9mhEvNQhr/5W yEGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=P6anJ3Cm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b6-20020a056402278600b00461d375794csi2234580ede.608.2022.10.24.05.20.02; Mon, 24 Oct 2022 05:20:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=P6anJ3Cm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232834AbiJXMPY (ORCPT + 99 others); Mon, 24 Oct 2022 08:15:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232994AbiJXMNf (ORCPT ); Mon, 24 Oct 2022 08:13:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68DEF1BEB6; Mon, 24 Oct 2022 04:54:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 940216129E; Mon, 24 Oct 2022 11:54:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7A37C433D6; Mon, 24 Oct 2022 11:54:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612452; bh=y6mb1eubaJp0f29iWdCtN2LvaUKIi3ax1uLB3dwiWUQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P6anJ3CmJCng9f0hljJcu5JK5R3zqXTZAQPEoYktAydQD4VzOhN4DdmLtbEAYjQGt wYIPvtzlDYmQ5W8ESR7mxCZQ4BozkOl/FsPhl2NEl4hpwopkHnpvwDxJCQmN6sRtGE WN0Qwt9n497vkzVqz83CEPxJh2vaigdp4U4ldmQI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Tetsuo Handa , Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 4.14 174/210] Bluetooth: L2CAP: initialize delayed works at l2cap_chan_create() Date: Mon, 24 Oct 2022 13:31:31 +0200 Message-Id: <20221024113002.605026670@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571469736628668?= X-GMAIL-MSGID: =?utf-8?q?1747571469736628668?= From: Tetsuo Handa [ Upstream commit 2d2cb3066f2c90cd8ca540b36ba7a55e7f2406e0 ] syzbot is reporting cancel_delayed_work() without INIT_DELAYED_WORK() at l2cap_chan_del() [1], for CONF_NOT_COMPLETE flag (which meant to prevent l2cap_chan_del() from calling cancel_delayed_work()) is cleared by timer which fires before l2cap_chan_del() is called by closing file descriptor created by socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_L2CAP). l2cap_bredr_sig_cmd(L2CAP_CONF_REQ) and l2cap_bredr_sig_cmd(L2CAP_CONF_RSP) are calling l2cap_ertm_init(chan), and they call l2cap_chan_ready() (which clears CONF_NOT_COMPLETE flag) only when l2cap_ertm_init(chan) succeeded. l2cap_sock_init() does not call l2cap_ertm_init(chan), and it instead sets CONF_NOT_COMPLETE flag by calling l2cap_chan_set_defaults(). However, when connect() is requested, "command 0x0409 tx timeout" happens after 2 seconds from connect() request, and CONF_NOT_COMPLETE flag is cleared after 4 seconds from connect() request, for l2cap_conn_start() from l2cap_info_timeout() callback scheduled by schedule_delayed_work(&conn->info_timer, L2CAP_INFO_TIMEOUT); in l2cap_connect() is calling l2cap_chan_ready(). Fix this problem by initializing delayed works used by L2CAP_MODE_ERTM mode as soon as l2cap_chan_create() allocates a channel, like I did in commit be8597239379f0f5 ("Bluetooth: initialize skb_queue_head at l2cap_chan_create()"). Link: https://syzkaller.appspot.com/bug?extid=83672956c7aa6af698b3 [1] Reported-by: syzbot Signed-off-by: Tetsuo Handa Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- net/bluetooth/l2cap_core.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index e45a12378bd1..75a76353525c 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -63,6 +63,9 @@ static void l2cap_send_disconn_req(struct l2cap_chan *chan, int err); static void l2cap_tx(struct l2cap_chan *chan, struct l2cap_ctrl *control, struct sk_buff_head *skbs, u8 event); +static void l2cap_retrans_timeout(struct work_struct *work); +static void l2cap_monitor_timeout(struct work_struct *work); +static void l2cap_ack_timeout(struct work_struct *work); static inline u8 bdaddr_type(u8 link_type, u8 bdaddr_type) { @@ -470,6 +473,9 @@ struct l2cap_chan *l2cap_chan_create(void) write_unlock(&chan_list_lock); INIT_DELAYED_WORK(&chan->chan_timer, l2cap_chan_timeout); + INIT_DELAYED_WORK(&chan->retrans_timer, l2cap_retrans_timeout); + INIT_DELAYED_WORK(&chan->monitor_timer, l2cap_monitor_timeout); + INIT_DELAYED_WORK(&chan->ack_timer, l2cap_ack_timeout); chan->state = BT_OPEN; @@ -3154,10 +3160,6 @@ int l2cap_ertm_init(struct l2cap_chan *chan) chan->rx_state = L2CAP_RX_STATE_RECV; chan->tx_state = L2CAP_TX_STATE_XMIT; - INIT_DELAYED_WORK(&chan->retrans_timer, l2cap_retrans_timeout); - INIT_DELAYED_WORK(&chan->monitor_timer, l2cap_monitor_timeout); - INIT_DELAYED_WORK(&chan->ack_timer, l2cap_ack_timeout); - skb_queue_head_init(&chan->srej_q); err = l2cap_seq_list_init(&chan->srej_list, chan->tx_win); From patchwork Mon Oct 24 11:31:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9146 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp457551wru; Mon, 24 Oct 2022 06:36:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6qLmGXlCOUIzCRZVK2W2LWvBCLSnbwCekwDmpQlAANJlKkcIDKK6D4uK/H8qfGBW0gTZYM X-Received: by 2002:a05:6402:190e:b0:45c:d10a:4c1a with SMTP id e14-20020a056402190e00b0045cd10a4c1amr31015723edz.345.1666618570891; Mon, 24 Oct 2022 06:36:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618570; cv=none; d=google.com; s=arc-20160816; b=lBHNaojNRtzzE8z8gbW7h/wjXchewmYQWIDMLdmitR64YP/e6gelvsjFH/O3m5Bka4 esliny9vDagHrNz/b9dGEETW/9jqOKeDf98lOZDFWmojavycN1rpl1huJ3YAEYzdxAXh +GLlWdlECe/CBJ5m07snWpuQqUkWOp07AeVbjoNvHoB3V3NiIpid9RX03/zHbMUgcW+T wXeX4MFO7qZivF5NMsErX6jZbRhdX1wacifl+TYk78OwxwLej0YJ5OBc+3HZ6K2JZb7C TZ0Hcxm7iKOydj9pUd9pFns8+5n8KVryZ/zU+eALphnqfgrmaTMzLfBYjPzDNOC9G2RE x4Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5O3Z7sFPkGHxNwZWZDkMYcRcuYrYdxkECWRbvaBmP+A=; b=G/NSkw8Fm85YJFrKNWnwyhaUYUObhUsZg9HRZT/zXT+FKSrez1t6CO/exMhbTsg5xp FTyZkxEQak7qCkYkmbDhg/2pgHyXbQqi923Cr1+GWel06yMMggmuFpcxIEY415caysRx ha9yE11094akEh6DFEz+S1U2waQVWhy2+f3X8HQnxvq5qTd9DXybS72xh27CiaWFz6Lo GkmRzIa/cJHYQSBuF8EZk1VLd0bqU9sGO5sL7Phm5tY+Sk9nn1p3uLV4w9Dbh+pZYJeC v/S7WMy6RLeb+Gwi2nj9jtJoU5EbJNPPQZDDBNHp8LLd+u3Ma90XUnLxirjXrNiiwgfo 5riA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xrqWtcc8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qa30-20020a170907869e00b007a3fbdb825asi5502527ejc.707.2022.10.24.06.35.27; Mon, 24 Oct 2022 06:36:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xrqWtcc8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230457AbiJXNVu (ORCPT + 99 others); Mon, 24 Oct 2022 09:21:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236440AbiJXNU2 (ORCPT ); Mon, 24 Oct 2022 09:20:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6B9E86F8C; Mon, 24 Oct 2022 05:28:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 60C3D61253; Mon, 24 Oct 2022 11:54:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B1CCC433D7; Mon, 24 Oct 2022 11:54:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612454; bh=GNw7U/Xkv8pquzbA9AmKaKoga6BkHp1dOGVVlwjeDZo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xrqWtcc8LjvNFwC9pm8JdCfRyu9cjKCGT6KuaskMDJctIRYg1xVDAAErkMW1aaVvH SJO9v5CXIbqw1cXxN8AEugHmQR0KVSWF3misGeEB145fl6CxUcW1Ots7LykbdKztuQ WZXRX85umg5mdvAO3R5it34CSBPKUIfvsCE1gVeM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luiz Augusto von Dentz , Hawkins Jiawei , Sasha Levin Subject: [PATCH 4.14 175/210] Bluetooth: hci_sysfs: Fix attempting to call device_add multiple times Date: Mon, 24 Oct 2022 13:31:32 +0200 Message-Id: <20221024113002.634850236@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747576234687058444?= X-GMAIL-MSGID: =?utf-8?q?1747576234687058444?= From: Luiz Augusto von Dentz [ Upstream commit 448a496f760664d3e2e79466aa1787e6abc922b5 ] device_add shall not be called multiple times as stated in its documentation: 'Do not call this routine or device_register() more than once for any device structure' Syzkaller reports a bug as follows [1]: ------------[ cut here ]------------ kernel BUG at lib/list_debug.c:33! invalid opcode: 0000 [#1] PREEMPT SMP KASAN [...] Call Trace: __list_add include/linux/list.h:69 [inline] list_add_tail include/linux/list.h:102 [inline] kobj_kset_join lib/kobject.c:164 [inline] kobject_add_internal+0x18f/0x8f0 lib/kobject.c:214 kobject_add_varg lib/kobject.c:358 [inline] kobject_add+0x150/0x1c0 lib/kobject.c:410 device_add+0x368/0x1e90 drivers/base/core.c:3452 hci_conn_add_sysfs+0x9b/0x1b0 net/bluetooth/hci_sysfs.c:53 hci_le_cis_estabilished_evt+0x57c/0xae0 net/bluetooth/hci_event.c:6799 hci_le_meta_evt+0x2b8/0x510 net/bluetooth/hci_event.c:7110 hci_event_func net/bluetooth/hci_event.c:7440 [inline] hci_event_packet+0x63d/0xfd0 net/bluetooth/hci_event.c:7495 hci_rx_work+0xae7/0x1230 net/bluetooth/hci_core.c:4007 process_one_work+0x991/0x1610 kernel/workqueue.c:2289 worker_thread+0x665/0x1080 kernel/workqueue.c:2436 kthread+0x2e4/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 Link: https://syzkaller.appspot.com/bug?id=da3246e2d33afdb92d66bc166a0934c5b146404a Signed-off-by: Luiz Augusto von Dentz Tested-by: Hawkins Jiawei Signed-off-by: Sasha Levin --- net/bluetooth/hci_sysfs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index b568f7c21b30..0c9249339790 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c @@ -48,6 +48,9 @@ void hci_conn_add_sysfs(struct hci_conn *conn) BT_DBG("conn %p", conn); + if (device_is_registered(&conn->dev)) + return; + dev_set_name(&conn->dev, "%s:%d", hdev->name, conn->handle); if (device_add(&conn->dev) < 0) { From patchwork Mon Oct 24 11:31:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10031 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp622438wru; Mon, 24 Oct 2022 12:45:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5dZK85W+FdUstnnWZrq+Swj1YpgrRNH2H7v4G5R39hnBmucyXQ04my4hK8YfENlZO4p8Tw X-Received: by 2002:a17:906:7055:b0:78b:9148:6b41 with SMTP id r21-20020a170906705500b0078b91486b41mr28155021ejj.629.1666640731030; Mon, 24 Oct 2022 12:45:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640731; cv=none; d=google.com; s=arc-20160816; b=kYxRkVH2wNEoGTygYF8UU/sytMBl69eqewXVLI4i7qvjJNyYFaZbppSZboxNltGJ24 z5HhP541MB93qIaQaZRTN2/PG69ObDmGe8Y55G7I1qkO+6MvAWYcnBuNhEQxJPptYZVC 0BvM3xXupK8pbjdOogwnm1/sVmOBBBT4auSlyd71q6atNW7+dNLcKtgRGVnh7L54od2M 4OoH+JYQFltlHL71080m6C2Xxhg0tQs4H/UWmGj8wH7UIn/PE0UVQe1xzYC1XSsJLxKh fGzDBB3GV/dVE+B6WvC6fipaaSqtfgmxyG4+URivFBMMmDs2W1pQzRHBfCE5DkJpEOG0 dC9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Y4/fcxXNEiIZeGM+5Lc9ZpSABJfmBYqQEtjGaIgweRM=; b=KrxUpIDa5VVOw9dIaU07odnAjYiSQgR3Ux+Lp06rZTzTELaw4NlVcZAmIAiOZaduxK XZEINM5x+3HX+TmwDs0FfyD66+ufR5K9XwyD9Eg8/eRo7Ix/V61m1d/HA136SMMTkw6r wATKOYDcCl0/qEJGLyNQs61HOtn0fx3cwfU0CNy7T1bM43v4R1uJiSMAQj8IsxtK9ZpS Fr/ZdcNcNjIx1k8BypgJpwPeqxlq6AVwW5l77IzTNQiYoNyyu+srCOMTcBx3kRySM8QX xsd82F245VQZGDEdZjpGAM9CMFpFTM6hYeTmiZhlf56nhJhITKSIH8A0ITeUCd2QSS/k rNTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="C/Ogn7CK"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id he43-20020a1709073dab00b007a8c58b51a3si677151ejc.725.2022.10.24.12.45.03; Mon, 24 Oct 2022 12:45:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="C/Ogn7CK"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232397AbiJXTmY (ORCPT + 99 others); Mon, 24 Oct 2022 15:42:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233416AbiJXTlY (ORCPT ); Mon, 24 Oct 2022 15:41:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C8BA2608E3; Mon, 24 Oct 2022 11:11:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 14FFCB81133; Mon, 24 Oct 2022 11:53:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BD4EC433C1; Mon, 24 Oct 2022 11:52:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612378; bh=g7jL3VwSFDP45ZHiaaVV5tuoAna1OHEHuXqpaCKJgWc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C/Ogn7CK2Hx4eE+omtdHoUUzZMW/nvBbouQsR5L0XeYVJeQrQx4UC3G5Xaoauk4nd 4fTC1lSlSgrf004A3SgrKuQDadLF/Xpg3IeMc5l56KD5v8xtpGaejgzDOqFE3UbUcJ d+Ykd8fGRu0iDnTzO+P0HFSoyySarT29z0vuHXkw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Kleine-Budde , Oliver Hartkopp , Ziyang Xuan , Sasha Levin Subject: [PATCH 4.14 176/210] can: bcm: check the result of can_send() in bcm_can_tx() Date: Mon, 24 Oct 2022 13:31:33 +0200 Message-Id: <20221024113002.665476166@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747599470814688976?= X-GMAIL-MSGID: =?utf-8?q?1747599470814688976?= From: Ziyang Xuan [ Upstream commit 3fd7bfd28cfd68ae80a2fe92ea1615722cc2ee6e ] If can_send() fail, it should not update frames_abs counter in bcm_can_tx(). Add the result check for can_send() in bcm_can_tx(). Suggested-by: Marc Kleine-Budde Suggested-by: Oliver Hartkopp Signed-off-by: Ziyang Xuan Link: https://lore.kernel.org/all/9851878e74d6d37aee2f1ee76d68361a46f89458.1663206163.git.william.xuanziyang@huawei.com Acked-by: Oliver Hartkopp Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin --- net/can/bcm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/net/can/bcm.c b/net/can/bcm.c index b3f3b02ffd42..89b955ef75d1 100644 --- a/net/can/bcm.c +++ b/net/can/bcm.c @@ -286,6 +286,7 @@ static void bcm_can_tx(struct bcm_op *op) struct sk_buff *skb; struct net_device *dev; struct canfd_frame *cf = op->frames + op->cfsiz * op->currframe; + int err; /* no target device? => exit */ if (!op->ifindex) @@ -310,11 +311,11 @@ static void bcm_can_tx(struct bcm_op *op) /* send with loopback */ skb->dev = dev; can_skb_set_owner(skb, op->sk); - can_send(skb, 1); + err = can_send(skb, 1); + if (!err) + op->frames_abs++; - /* update statistics */ op->currframe++; - op->frames_abs++; /* reached last frame? */ if (op->currframe >= op->nframes) From patchwork Mon Oct 24 11:31:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8664 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421839wru; Mon, 24 Oct 2022 05:21:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7BcirNYlzq+uxp/o/f/Cy148TXhFxaq+Snezndcz98gle3Vj766F8MNlGMNrS59D5Dts6e X-Received: by 2002:a05:6402:2681:b0:461:cbda:fe4b with SMTP id w1-20020a056402268100b00461cbdafe4bmr3836145edd.124.1666614078627; Mon, 24 Oct 2022 05:21:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614078; cv=none; d=google.com; s=arc-20160816; b=GGFglYPOnKlLWEBe4P20IaVu8/O+BnqGxI1ju9+fO15rSL5XDE2amPgrna87HQkJQi 4b9ap2+z5Y+qNdduQd5q4q8ho71FM47Q5S4hnN4AGEpGIS6PpWDUZuPtdhNF6nlBNegN wH89k0E5EpaOe+Zh5avvPH603fo5S+ldvyMMerwnRvEUSk/tTzMDEfwC+wQsgp1h11PQ 9yxobnyDW8gstjFJrD4+9d5ilHW+TEurSstKmWV9ETJaeiG++QAFF9n6AB3Yfl8OTLFr FCsQjMoBBwKtmiytd43B/BjSUvbzZ3fIQvItrYNJkWnJgQGRUV/bmHvvXaldWR0TQYtj XKRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OZP4371EwT/rySPRMPpAzaWg8YVzv0n9oyFaNTG/JhI=; b=k/fMf8Tys8SX9xPkYdp4WOBZB1u6o+VUU2tgYpeRA+KBYtRNm4yYhrH15QlDJDgtw6 TuZQr1E8G+Op+M6dG6zYc9W+66Lm56u3HYbAYclXWHeZTwNwVbSkRkkRI2+D02pri8Ig SGH9WYN3BA3Y/vLotl2Wwu2R/9VXXNGTkiChFORvqZ3kp62xUTqCEj1iP7xeumsj7SEi i1tcSUstLxy2htWeb15JATyyzkiUho4SbjUjZnfhXJ13Ts1xDc4Fg+poYP9QxgUNnLEN ItKJEWjZxiya879YmV2Ol6v6097ruGGHFhoL9jebpH64GHb/UsVB3t/XqbT2p6iOkMsD 4+Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xmboJOkb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hv20-20020a17090760d400b00791a67e4c00si16912817ejc.835.2022.10.24.05.20.53; Mon, 24 Oct 2022 05:21:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xmboJOkb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233025AbiJXMRp (ORCPT + 99 others); Mon, 24 Oct 2022 08:17:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233013AbiJXMPj (ORCPT ); Mon, 24 Oct 2022 08:15:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 964B880E9E; Mon, 24 Oct 2022 04:56:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EF3DF61257; Mon, 24 Oct 2022 11:53:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11090C433C1; Mon, 24 Oct 2022 11:53:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612381; bh=UUPFGVE5yNPwnJWYQ5KMH0OyH9TrpTMtg+zVr4sFNE0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xmboJOkbbcMv8taM6TJmEfbXg+Qcp1tEH/Gigrt6yasD9ZhloqCobmBDkfvH5OLyT mTns0FOM/Kz/nmxElHssRjJTHaTwedC+WAu2JAPUfNum+QzFf07rkQRMn9z7KIizfI d4mRnWGflI2JppACKRPyWMTDVIYgaQVrTz5xnZ5o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Vasilugin , Daniel Golle , Kalle Valo , Sasha Levin Subject: [PATCH 4.14 177/210] wifi: rt2x00: dont run Rt5592 IQ calibration on MT7620 Date: Mon, 24 Oct 2022 13:31:34 +0200 Message-Id: <20221024113002.695313072@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571524032658801?= X-GMAIL-MSGID: =?utf-8?q?1747571524032658801?= From: Daniel Golle [ Upstream commit d3aad83d05aec0cfd7670cf0028f2ad4b81de92e ] The function rt2800_iq_calibrate is intended for Rt5592 only. Don't call it for MT7620 which has it's own calibration functions. Reported-by: Serge Vasilugin Signed-off-by: Daniel Golle Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/31a1c34ddbd296b82f38c18c9ae7339059215fdc.1663445157.git.daniel@makrotopia.org Signed-off-by: Sasha Levin --- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c index d2c289446c00..1309c136f7f3 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -3835,7 +3835,8 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev, reg += 2 * rt2x00dev->lna_gain; rt2800_bbp_write_with_rx_chain(rt2x00dev, 66, reg); - rt2800_iq_calibrate(rt2x00dev, rf->channel); + if (rt2x00_rt(rt2x00dev, RT5592)) + rt2800_iq_calibrate(rt2x00dev, rf->channel); } bbp = rt2800_bbp_read(rt2x00dev, 4); From patchwork Mon Oct 24 11:31:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8646 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421474wru; Mon, 24 Oct 2022 05:20:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Z1yKVqav5lgyxlE2OELojGMJzS4N4zbdmlSrLVVupz7e7vKjtdloGNqJ8xp+iBx33dQxO X-Received: by 2002:a17:90a:b10b:b0:212:fbc3:e623 with SMTP id z11-20020a17090ab10b00b00212fbc3e623mr8979971pjq.5.1666614037058; Mon, 24 Oct 2022 05:20:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614037; cv=none; d=google.com; s=arc-20160816; b=y7zb2pqMKbx79zDn6Xl/UyicaspsBjnvvoXKBaQeglLz7vToG5/qt8NR/+OD1H8oCl 8yFdtCkZ3jjRS5n3ZN9ZLTIQgW4oU7CMjcIHWnYubL52fZZpM8uZwBTucpxz4YXHn6Op s1lg9AbIFBm+XTN1Snuy4YfX3O4nbHEIHCAGNh5rKQUEbZzP3dR+kVV5AMzshga9GNKD ezb4uFKU+7U8FuSykGzP3S1UKCYQsINRkvh11V+0OY0TB3WOn+Sod+CPSaZpzuqIdqU0 vfxwHHQaSHasLvusG6/QxMx3CffbY+n5cK9S2OoRcoxRiY9dg3heVMojA1C1mmxgfnVF eUyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=etNNsSmMk09YMGE+p+gXFR2TnEee5NHQ6uzYSOI/lLk=; b=WEvPcqJAQN4LRxDUsA3NDz2fSjsjLMynDO8Mo3gr8sgTYkrjeU7qN0NbMfjA89xKLO DGSDPJqQjvItP1xZkZZ1RYCw/gem6AxKXhlKUIMG3z9ouKXfeWDc7cGJgqauC3ngPmzr pE8zUSYVMb5wxVSdtIp3Gku27ex2nEuJVEVI8hk4n5ZC+r1fPw7J/XWm/Jku68XvTbYC E/8IWJbvvoXFrnL+3IIWBZ3AiCwcEAOMXhdC70LlKNq4IAqL3qf2yc+x6Ul8aKKNi9nh 3N98kXRR6cyo4H1FkyjG4q5TsQZjTyiZRtDHvkmsdiTRMRDSv2qrwy4gp1ideThpy+up xDxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yj63hf8M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c3-20020a170902d48300b00186a592183fsi4210050plg.365.2022.10.24.05.20.23; Mon, 24 Oct 2022 05:20:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yj63hf8M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229824AbiJXMM2 (ORCPT + 99 others); Mon, 24 Oct 2022 08:12:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232896AbiJXMLc (ORCPT ); Mon, 24 Oct 2022 08:11:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 688977FFB9; Mon, 24 Oct 2022 04:53:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A0BFA61291; Mon, 24 Oct 2022 11:53:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3448C433C1; Mon, 24 Oct 2022 11:53:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612384; bh=vjYXcM4d6U4y24O7mT2Q36DVyLJAZZU64TsfuVOvQ4A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yj63hf8MHq9DE+6r+4IpPgrgXJ6bYbeAtI97DfFmwxZ8MxBaDFTwsfQeFpSF2HKUl vDydXNvMnACWMj5BKKiiJQoWfTGgFUZKNClnNsLmSsTlpIQwPLkdkuRATeYliXiZ49 bEyIsbo249k+FzPFJh25Q4Hwn4sKDsGKvlW9bcLM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Vasilugin , Daniel Golle , Stanislaw Gruszka , Kalle Valo , Sasha Levin Subject: [PATCH 4.14 178/210] wifi: rt2x00: set correct TX_SW_CFG1 MAC register for MT7620 Date: Mon, 24 Oct 2022 13:31:35 +0200 Message-Id: <20221024113002.738576707@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571480818162956?= X-GMAIL-MSGID: =?utf-8?q?1747571480818162956?= From: Daniel Golle [ Upstream commit eeb50acf15762b61921f9df18663f839f387c054 ] Set correct TX_SW_CFG1 MAC register as it is done also in v3 of the vendor driver[1]. [1]: https://gitlab.com/dm38/padavan-ng/-/blob/master/trunk/proprietary/rt_wifi/rtpci/3.0.X.X/mt76x2/chips/rt6352.c#L531 Reported-by: Serge Vasilugin Signed-off-by: Daniel Golle Acked-by: Stanislaw Gruszka Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/4be38975ce600a34249e12d09a3cb758c6e71071.1663445157.git.daniel@makrotopia.org Signed-off-by: Sasha Levin --- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c index 1309c136f7f3..0c90bf0540b9 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -5315,7 +5315,7 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404); } else if (rt2x00_rt(rt2x00dev, RT6352)) { rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000401); - rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x000C0000); + rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x000C0001); rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000); rt2800_register_write(rt2x00dev, MIMO_PS_CFG, 0x00000002); rt2800_register_write(rt2x00dev, TX_PIN_CFG, 0x00150F0F); From patchwork Mon Oct 24 11:31:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8634 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp420928wru; Mon, 24 Oct 2022 05:19:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4frb/4YZ/jdO8vEilqhj9Y7LNFL/b5J/PahuIEGJm9scEL6oJd2jvrRs5bz8EgjwU+m58w X-Received: by 2002:a17:907:1c24:b0:78d:3518:2e58 with SMTP id nc36-20020a1709071c2400b0078d35182e58mr26932529ejc.574.1666613949758; Mon, 24 Oct 2022 05:19:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613949; cv=none; d=google.com; s=arc-20160816; b=KbyQlvWLoJZ3OGW6NPPkyohlZ+m9/09MPWm/ztTbg8kQJp384CT0hwu8wuNDoasGMk AfDcdaJ4pZxk2QNRuCMKJW5BTI1tGjMqN07gRsuC2XFpkdXmLSueB6fCC5yqsLQWCGwC WARO1adz1JrJpWsA97Vm4U1ILHRbuxVbjVCzLpb2zvO4pZUEP3rBiAkYVDBJ9UJs+hLw B0qJ90OBVnaaC2RXAqH2lzp/Fx0vB8UPVjTLqn9w5Ile6Fn/eRmtm5Cn0HshZEowlJzU fWfiVgPIONAQZBDeobdAfM6wi4mN0mxfmHGeyhiQCjAXCmAEI7n0VN4IHIIxifBUEqUp nt3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=e3loH1nVwOtQuELDA6esEWvlJ/DScy8CT7D2BFcHtrs=; b=mgNpjoRQrHiE2NjB6VjERwPp7FEaqfNhg5eBowfFrTLmOBpylloaXEa8KyYqygSxSA V8kMGBdixkEvzifYLZlr6RJlGogpNUsy1TlcHV9W8cELFLuB5CDsrt/EomYAmJiFOSkC YVVvvVUgjwo28+AbplHFl9sI1BrkShnKetsGywgLf53k+e9s8nmltZFgYVaZ78TqGhSM qX9025RQDv9J9jIKdFfCSMoBL69L8k9seG1kPDMzH4lGLiXA8jO6JEcpOczsXuwlKuxt aGjh5fyNqP6jiOQoXaFfonNcRdXcT5UMp3c5whEgdzN6ogvIF5CQiM9P57LzlZkyNBqR g9TA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cSFbbyRY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r23-20020a170906365700b0077951929341si23736393ejb.312.2022.10.24.05.18.45; Mon, 24 Oct 2022 05:19:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cSFbbyRY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232976AbiJXMNS (ORCPT + 99 others); Mon, 24 Oct 2022 08:13:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232941AbiJXMMX (ORCPT ); Mon, 24 Oct 2022 08:12:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 086954B495; Mon, 24 Oct 2022 04:54:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 48452612DD; Mon, 24 Oct 2022 11:53:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58763C433C1; Mon, 24 Oct 2022 11:53:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612386; bh=NJCqAoZMT1hBBgidJI6oolu+SE17C6YShP1K46PYaBc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cSFbbyRY8t24TBkJagEYae59pJZ8zh1JUoaWWfQV95hbtFjftH1GXePx3YyNuxb3r DR56KTTjn3A22Z+rWDbzdDyWvZRzYWtMN+hcbdMf3ZJgJh7FSrUqoqelznOh05wPxK SuDAieHgPV6Dw4AKEWnbu4Lp4LsEyUrKMBt/D7zM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Vasilugin , Daniel Golle , Stanislaw Gruszka , Kalle Valo , Sasha Levin Subject: [PATCH 4.14 179/210] wifi: rt2x00: set SoC wmac clock register Date: Mon, 24 Oct 2022 13:31:36 +0200 Message-Id: <20221024113002.777680514@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571388891730770?= X-GMAIL-MSGID: =?utf-8?q?1747571388891730770?= From: Daniel Golle [ Upstream commit cbde6ed406a51092d9e8a2df058f5f8490f27443 ] Instead of using the default value 33 (pci), set US_CYC_CNT init based on Programming guide: If available, set chipset bus clock with fallback to cpu clock/3. Reported-by: Serge Vasilugin Signed-off-by: Daniel Golle Acked-by: Stanislaw Gruszka Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/3e275d259f476f597dab91a9c395015ef3fe3284.1663445157.git.daniel@makrotopia.org Signed-off-by: Sasha Levin --- .../net/wireless/ralink/rt2x00/rt2800lib.c | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c index 0c90bf0540b9..57fa472b5c4e 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -5567,6 +5567,27 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) reg = rt2800_register_read(rt2x00dev, US_CYC_CNT); rt2x00_set_field32(®, US_CYC_CNT_CLOCK_CYCLE, 125); rt2800_register_write(rt2x00dev, US_CYC_CNT, reg); + } else if (rt2x00_is_soc(rt2x00dev)) { + struct clk *clk = clk_get_sys("bus", NULL); + int rate; + + if (IS_ERR(clk)) { + clk = clk_get_sys("cpu", NULL); + + if (IS_ERR(clk)) { + rate = 125; + } else { + rate = clk_get_rate(clk) / 3000000; + clk_put(clk); + } + } else { + rate = clk_get_rate(clk) / 1000000; + clk_put(clk); + } + + reg = rt2800_register_read(rt2x00dev, US_CYC_CNT); + rt2x00_set_field32(®, US_CYC_CNT_CLOCK_CYCLE, rate); + rt2800_register_write(rt2x00dev, US_CYC_CNT, reg); } reg = rt2800_register_read(rt2x00dev, HT_FBK_CFG0); From patchwork Mon Oct 24 11:31:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9011 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp440749wru; Mon, 24 Oct 2022 06:04:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Ag2zV/liK15J7eHV8cBoRd5M8YXYc1koXMBUM1KZVA9IMes5aqUEdXHHiJU5z3vnHnOr9 X-Received: by 2002:a17:903:1303:b0:186:969d:97cf with SMTP id iy3-20020a170903130300b00186969d97cfmr9517622plb.17.1666616686695; Mon, 24 Oct 2022 06:04:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616686; cv=none; d=google.com; s=arc-20160816; b=FpWT24vOmpccBkvdO5Mt11RIZHz5OKwpMkSGRVxJ1Ba0EEEIBI99tRXr5lgO7Jc+0m SlOOggKIZSYLri/VVwDow4mVBUF2B7X+zK8xck+06JVf1zXwNEvBBpg7siKfOFeF83a/ jnCQQr5hywSyVE/rm8japeBERk2TncfTVjPLmU/kXKpNAY2Ao7n86zvFk1nfjqIqwApA AfXwc8LKXW1yMzfynIjn1OGAVJy5R8PQkvk4SwDVhtjT5w3uw6nbuMHoXdhKOwvt3VdP eFD57GBDiAcpbGI+mQTfiaWhFq7L/dOhCFf14rawOUjYcQt3K4JHNalx2ObYX2dr9JD5 kooA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kkVa+pVHX/kxFYc/Lf83EV4j87RjwLYEimGgU/1FCqY=; b=cjfV5Og+0vQrPYgu7NnX1LbIeP7Waky3pJud4I+2MYxPwjMXah2ASQ5n7xHiU/LqsJ wJSY0CcNO40PIcBVqtNFF50FjOjrqZ/cyL7Kp6o/ERCnWKpBU+LNYPvdsZ8MgaC8+lI6 sqWyCECzJXdNV6IF8ezW2PT82Ax+i/Llk6LB086FLb5aQX2rnrozxMq8WIXa353mgi1L 7pbfPq3oMuj6P1nj3grlGG3LzOpMfaOSXTV2GVdxobjw5Xzxiy6nW7oebNoWNCK21kXX k2guh9GPjAEnLDcYqC5QFoLgFKjQY1iuBY60hjJ23uK9Fpjq9xHxcs1wNQX/1V0w7niL vyNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BBeAgUCL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id na4-20020a17090b4c0400b00200b6023910si11462523pjb.2.2022.10.24.06.03.54; Mon, 24 Oct 2022 06:04:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BBeAgUCL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235203AbiJXND3 (ORCPT + 99 others); Mon, 24 Oct 2022 09:03:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235301AbiJXM7x (ORCPT ); Mon, 24 Oct 2022 08:59:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB8D36448; Mon, 24 Oct 2022 05:19:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DA155612A1; Mon, 24 Oct 2022 11:53:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E784AC433D6; Mon, 24 Oct 2022 11:53:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612389; bh=+3IhUpAN6u1ITIK/zEVNFbHGupufpTdT9BiBQYhxLqQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BBeAgUCL5DNhP3lIY4/0LT1qItk9elQL3yrBJQQHBtMGGJ9h+t8s80je+p1caY5Br Jcur6H4IA3SKu48Ic2yE/oWZhmP9xSSWsuEK0VJbPvhryhODS1+6cMsaeGTbff3ZlP VtB46OLrNMsGx86GSAygP9gspJfaIjaGULcHaTzU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Vasilugin , Daniel Golle , Stanislaw Gruszka , Kalle Valo , Sasha Levin Subject: [PATCH 4.14 180/210] wifi: rt2x00: correctly set BBP register 86 for MT7620 Date: Mon, 24 Oct 2022 13:31:37 +0200 Message-Id: <20221024113002.807310121@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574258771013635?= X-GMAIL-MSGID: =?utf-8?q?1747574258771013635?= From: Daniel Golle [ Upstream commit c9aada64fe6493461127f1522d7e2f01792d2424 ] Instead of 0 set the correct value for BBP register 86 for MT7620. Reported-by: Serge Vasilugin Signed-off-by: Daniel Golle Acked-by: Stanislaw Gruszka Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/257267247ee4fa7ebc6a5d0c4948b3f8119c0d77.1663445157.git.daniel@makrotopia.org Signed-off-by: Sasha Levin --- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c index 57fa472b5c4e..155c08dc2e0e 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -3655,7 +3655,10 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev, rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain); rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain); rt2800_bbp_write(rt2x00dev, 64, 0x37 - rt2x00dev->lna_gain); - rt2800_bbp_write(rt2x00dev, 86, 0); + if (rt2x00_rt(rt2x00dev, RT6352)) + rt2800_bbp_write(rt2x00dev, 86, 0x38); + else + rt2800_bbp_write(rt2x00dev, 86, 0); } if (rf->channel <= 14) { From patchwork Mon Oct 24 11:31:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8633 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp420884wru; Mon, 24 Oct 2022 05:19:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM67BmKvF5w2cpHvEmJQETNIk2jCpTV1lh0bItRzeYFc8hnSX3YmVBtvKa+qm+plDP8VYSIL X-Received: by 2002:a05:6402:518b:b0:45d:9a19:66d2 with SMTP id q11-20020a056402518b00b0045d9a1966d2mr29974358edd.43.1666613944281; Mon, 24 Oct 2022 05:19:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613944; cv=none; d=google.com; s=arc-20160816; b=RzxF3IdoHYSPetPSNDOSQD0KmcDS8uDInrwnXNNvgULQ1VIDnpJ/+e26ePvqosblMP YM5zgKtos69fpZXJ6G+5Vv6e1lYot8bONIBOOAnkzAbI0BIs7MqgjFALy/1hne/rBMCG EIfBB3jgT6DzRvG92pqZWCkqR40nVLk0LdfWzUiRPAVb9m3ZBuZh9BYoMS9kiuwuiXhA va/+16OjzgSWaZ2ZEH9XQlYgY79+lqV6aa8BQDdIHMuhWOMozjRY9SV2ChBujGP1eelU sYdih0iDYCWz3mDUS7EJtnJ+YaIRW6pEJrGrRI9yhJ7P2SKvXnu6uOHX5ktSlgt+WTcU kXVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Mza8c6hkNH81WXIqUNOMWUUn8XJ3uoJosevxGlu0+KE=; b=i7Nnxzbc9uZlaHAxT/qR+v2Q1nO/yHF1+PCOWFgYblROw8P9xvb8t1TZxEnrzERQI8 awYWazVvDKwKKbl6WUsI2LQLRIfQvm3cx0An3h/Kuyv1LDhTgyWt229WeMoJQzXMmP3S lx+afFyvkR6Zksk0AzA55t09Pv+e1zkHopp0gd6kpf6gCiBBDYZPlLtKpw7zTsxrUp/Z vit328GMLsm0XVUlWGldBjin9dYCXA7rkPhFH0nhSFMkvFZ8oKGVSI9Q/qo0qPuC89Pg vfG7uGtr6E3EwJAbsGLRVaBKox43oAMKyF2Caz6VAmu3wP7c6nUz9UActIaDLFLHKh0+ Hw+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="WCVYQ/hh"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hg6-20020a1709072cc600b00791a41d1b39si17031478ejc.656.2022.10.24.05.18.39; Mon, 24 Oct 2022 05:19:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="WCVYQ/hh"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232856AbiJXMM7 (ORCPT + 99 others); Mon, 24 Oct 2022 08:12:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232931AbiJXMMI (ORCPT ); Mon, 24 Oct 2022 08:12:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C2056C950; Mon, 24 Oct 2022 04:54:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7378C612D5; Mon, 24 Oct 2022 11:53:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86318C4314F; Mon, 24 Oct 2022 11:53:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612391; bh=v1r82cymzQPnMWu7S3606OX3gKWmSJrP2gwD0jxVRvI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WCVYQ/hhDfDRXyKRqHpgVO/9ue5d8UmPtdS9f89ySMyxN7K7ZQGdNuKMYxwrkOjaB GUndFICgXm4kAga22FtfvK5TRRkrY1wF/+8qExX31kvhqGpwRYe+KaXrJvcbofLVd/ vNOjATXJxCzhez7q6Mv7lRCyM91IW2RoqBVzd/ZM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jakub Sitnicki , Liu Jian , Daniel Borkmann , John Fastabend , Eric Dumazet , Sasha Levin Subject: [PATCH 4.14 181/210] net: If sock is dead dont access socks sk_wq in sk_stream_wait_memory Date: Mon, 24 Oct 2022 13:31:38 +0200 Message-Id: <20221024113002.837817442@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571383001994482?= X-GMAIL-MSGID: =?utf-8?q?1747571383001994482?= From: Liu Jian [ Upstream commit 3f8ef65af927db247418d4e1db49164d7a158fc5 ] Fixes the below NULL pointer dereference: [...] [ 14.471200] Call Trace: [ 14.471562] [ 14.471882] lock_acquire+0x245/0x2e0 [ 14.472416] ? remove_wait_queue+0x12/0x50 [ 14.473014] ? _raw_spin_lock_irqsave+0x17/0x50 [ 14.473681] _raw_spin_lock_irqsave+0x3d/0x50 [ 14.474318] ? remove_wait_queue+0x12/0x50 [ 14.474907] remove_wait_queue+0x12/0x50 [ 14.475480] sk_stream_wait_memory+0x20d/0x340 [ 14.476127] ? do_wait_intr_irq+0x80/0x80 [ 14.476704] do_tcp_sendpages+0x287/0x600 [ 14.477283] tcp_bpf_push+0xab/0x260 [ 14.477817] tcp_bpf_sendmsg_redir+0x297/0x500 [ 14.478461] ? __local_bh_enable_ip+0x77/0xe0 [ 14.479096] tcp_bpf_send_verdict+0x105/0x470 [ 14.479729] tcp_bpf_sendmsg+0x318/0x4f0 [ 14.480311] sock_sendmsg+0x2d/0x40 [ 14.480822] ____sys_sendmsg+0x1b4/0x1c0 [ 14.481390] ? copy_msghdr_from_user+0x62/0x80 [ 14.482048] ___sys_sendmsg+0x78/0xb0 [ 14.482580] ? vmf_insert_pfn_prot+0x91/0x150 [ 14.483215] ? __do_fault+0x2a/0x1a0 [ 14.483738] ? do_fault+0x15e/0x5d0 [ 14.484246] ? __handle_mm_fault+0x56b/0x1040 [ 14.484874] ? lock_is_held_type+0xdf/0x130 [ 14.485474] ? find_held_lock+0x2d/0x90 [ 14.486046] ? __sys_sendmsg+0x41/0x70 [ 14.486587] __sys_sendmsg+0x41/0x70 [ 14.487105] ? intel_pmu_drain_pebs_core+0x350/0x350 [ 14.487822] do_syscall_64+0x34/0x80 [ 14.488345] entry_SYSCALL_64_after_hwframe+0x63/0xcd [...] The test scenario has the following flow: thread1 thread2 ----------- --------------- tcp_bpf_sendmsg tcp_bpf_send_verdict tcp_bpf_sendmsg_redir sock_close tcp_bpf_push_locked __sock_release tcp_bpf_push //inet_release do_tcp_sendpages sock->ops->release sk_stream_wait_memory // tcp_close sk_wait_event sk->sk_prot->close release_sock(__sk); *** lock_sock(sk); __tcp_close sock_orphan(sk) sk->sk_wq = NULL release_sock **** lock_sock(__sk); remove_wait_queue(sk_sleep(sk), &wait); sk_sleep(sk) //NULL pointer dereference &rcu_dereference_raw(sk->sk_wq)->wait While waiting for memory in thread1, the socket is released with its wait queue because thread2 has closed it. This caused by tcp_bpf_send_verdict didn't increase the f_count of psock->sk_redir->sk_socket->file in thread1. We should check if SOCK_DEAD flag is set on wakeup in sk_stream_wait_memory before accessing the wait queue. Suggested-by: Jakub Sitnicki Signed-off-by: Liu Jian Signed-off-by: Daniel Borkmann Acked-by: John Fastabend Cc: Eric Dumazet Link: https://lore.kernel.org/bpf/20220823133755.314697-2-liujian56@huawei.com Signed-off-by: Sasha Levin --- net/core/stream.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/core/stream.c b/net/core/stream.c index cbe52b169070..e5c6c9e5e0aa 100644 --- a/net/core/stream.c +++ b/net/core/stream.c @@ -159,7 +159,8 @@ int sk_stream_wait_memory(struct sock *sk, long *timeo_p) *timeo_p = current_timeo; } out: - remove_wait_queue(sk_sleep(sk), &wait); + if (!sock_flag(sk, SOCK_DEAD)) + remove_wait_queue(sk_sleep(sk), &wait); return err; do_error: From patchwork Mon Oct 24 11:31:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8792 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430827wru; Mon, 24 Oct 2022 05:42:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4hXzD85UIZLPbULihK2T4jithF7shQTbTFVERcSDqzP/dmDejclm1rqg/CJOYir+X9nmlF X-Received: by 2002:a17:903:2284:b0:180:289f:7f09 with SMTP id b4-20020a170903228400b00180289f7f09mr33780738plh.120.1666615340696; Mon, 24 Oct 2022 05:42:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615340; cv=none; d=google.com; s=arc-20160816; b=t97fzQxJxxj9Q4hIi2sivtBt+ItmNmh3bzSmVyVh8KOeUK1OQvOxN2u93SQGyMYQmx +JHf1baSjJPLCxZc8BsGJYZ9lImTg1XVOnvGmLErYckWN9Isj2MuW8FA25tHoo9p/jw5 mGsZRUp9I2LMSwRy+uF+u05EnUSgEdSq5Jb3P5OUvB/LJukj522xAItMBfnxijHnV9zX Vo34xANP2zRH7Q7rhVjPITf1zLANv/IQk14QwJP6WCY81D2395rgh1HDt11uH5EE9q45 WgFfJSXwdBjIFbz7S/Hly6C9aMqkT2vTg2ajeJ082d/Iq9HeYvuuNuoUtM+B1A/GOdyE dXlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UQoT74ONE1T6eJthZiZ4GVP2H2+DV6FRmhVWUOTtMcg=; b=mBr30G5wtl1fKlbfnS9j7lC38mzxS39+BuToftS7wvfZOpsVw0S9pa0OVDx+m9kW0K oHQPgBJfEOZ6WUfpnm4x2a4nXeXGdyt1RnBpt4uzuQs2H7zl6euZysKYa1h37UQVag00 EYvExU3ZtwsjmJdCOX71aYJJtQhB+lxUHE9jcjXaWLzFrLEGiGoGc0RtDtoFQK3BWrxo CZvDq/WSE2pHrabKxEMXe0wtpzQl7T+drixGRXrwY9OxBG2m5OlmKb0OaVs6ZLXsPJzf ekoIW8TQsFOZKLXMUWtDaDbNk9rb1LAWsF2zXjjX3KX4qAvVD4KKWzrCmNn7biLtVdnA oOug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="TbcYE/Wy"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v23-20020a634657000000b00455bdca34dcsi36220709pgk.88.2022.10.24.05.42.04; Mon, 24 Oct 2022 05:42:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="TbcYE/Wy"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231797AbiJXMdq (ORCPT + 99 others); Mon, 24 Oct 2022 08:33:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234134AbiJXM3Y (ORCPT ); Mon, 24 Oct 2022 08:29:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5A6C88DF2; Mon, 24 Oct 2022 05:03:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0756E612D8; Mon, 24 Oct 2022 11:53:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E284C433C1; Mon, 24 Oct 2022 11:53:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612394; bh=0vXha/ZnD8UqFgF3bT4H9GPLaJFT/OwUwdOCaflmLtc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TbcYE/Wy/37yq3p2cadURopHlzKy55ZGJ6/b23zXbSe7APgKapef/kfl7tsnLqzxr jaVrgGQFgKhtrw2fvVniu4L5UY9zwX5T6nrAVVI3JVuw9yo4KnLIeBdEDqkoD8s+3g Fx8bRNeG7PhQGewe555fH7DRrxMg7MAgAfranYFk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luiz Augusto von Dentz , Sungwoo Kim , Sasha Levin Subject: [PATCH 4.14 182/210] Bluetooth: L2CAP: Fix user-after-free Date: Mon, 24 Oct 2022 13:31:39 +0200 Message-Id: <20221024113002.867559589@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572847437949340?= X-GMAIL-MSGID: =?utf-8?q?1747572847437949340?= From: Luiz Augusto von Dentz [ Upstream commit 35fcbc4243aad7e7d020b7c1dfb14bb888b20a4f ] This uses l2cap_chan_hold_unless_zero() after calling __l2cap_get_chan_blah() to prevent the following trace: Bluetooth: l2cap_core.c:static void l2cap_chan_destroy(struct kref *kref) Bluetooth: chan 0000000023c4974d Bluetooth: parent 00000000ae861c08 ================================================================== BUG: KASAN: use-after-free in __mutex_waiter_is_first kernel/locking/mutex.c:191 [inline] BUG: KASAN: use-after-free in __mutex_lock_common kernel/locking/mutex.c:671 [inline] BUG: KASAN: use-after-free in __mutex_lock+0x278/0x400 kernel/locking/mutex.c:729 Read of size 8 at addr ffff888006a49b08 by task kworker/u3:2/389 Link: https://lore.kernel.org/lkml/20220622082716.478486-1-lee.jones@linaro.org Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sungwoo Kim Signed-off-by: Sasha Levin --- net/bluetooth/l2cap_core.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 75a76353525c..652c0723051b 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -4049,6 +4049,12 @@ static int l2cap_connect_create_rsp(struct l2cap_conn *conn, } } + chan = l2cap_chan_hold_unless_zero(chan); + if (!chan) { + err = -EBADSLT; + goto unlock; + } + err = 0; l2cap_chan_lock(chan); @@ -4078,6 +4084,7 @@ static int l2cap_connect_create_rsp(struct l2cap_conn *conn, } l2cap_chan_unlock(chan); + l2cap_chan_put(chan); unlock: mutex_unlock(&conn->chan_lock); From patchwork Mon Oct 24 11:31:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8635 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp420953wru; Mon, 24 Oct 2022 05:19:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7/dpRx0mHuGGoVhOKquo3rdHdZ98Q1y5bGLVgfW/XBUhKvvzRYK8b3GhFRAMCWWp3QePcX X-Received: by 2002:a17:907:16a6:b0:78e:f140:a9b9 with SMTP id hc38-20020a17090716a600b0078ef140a9b9mr27333481ejc.502.1666613946120; Mon, 24 Oct 2022 05:19:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613946; cv=none; d=google.com; s=arc-20160816; b=mH4yCPLJF2WHdlEEa3UqQdBVR82lZlGzh7W4GnM6NCx+HqQMmXrrDgBGg7KXCYhiy6 r4Cked45LiGz376gLzzsEQmNDjw0otGxTASO+MY8ZfmdSI+TcAhYVzgQQ3I3KeOqlaBR BbIbvTxW4CvH7ALooqtil3/Vkx6OmFztl0jhSUlXkNGsn8q9suFIbvIwGBA0lnso70R0 VAFGVz2Q5c3SesW0hkL0gEkyf+jpTG6NWIGZCqgfqutP6rj03kR/v4Zng+SgWqSfer5R TGITnsgZ2W8pFIkw2wKV6XNZA0O30exA6KSpi/+Sze3LhVTqJUveNYRI6W13M/HrH/XZ kDww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AjqEfNE8rwYg4kdwNc0mIjvzNIaxsQeuYdOvzNZuXe0=; b=ebveZc7kGggi8aYK/mJSmpYQMWLdF0HK6uJJ9D5nNfbBulL2U47oPMfTfaWV8em3+k oXS5YGwWQe4gyaLZ1QBxn7t6bQh2pI1x1oEf1pkBWXjRxIBjM2dQjhZXAU9mFAUfFpzj yaoA/jHRKMRZDYOHNvMshjpW+lqhpWoLV2ccPiePHyrz43Xk5uK97OQ+eNP9J02HZwnV E/1bwVa5lp+Z78/ZuWjmzJc/ggzk+kL31DrRg7HACkJah3YcjHGjCWF/J3kaY5heZIjn zH5ZIcli5/O3J5+zK3ay7hF0W168enah8jRcYPfSa6JaRqHA5y/GFJmqfD1ZfsuZtAwO fpFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="A3/h6DPL"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dr8-20020a170907720800b00781b6ce15e1si28886912ejc.101.2022.10.24.05.18.42; Mon, 24 Oct 2022 05:19:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="A3/h6DPL"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232873AbiJXMNH (ORCPT + 99 others); Mon, 24 Oct 2022 08:13:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232876AbiJXMMV (ORCPT ); Mon, 24 Oct 2022 08:12:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2ACBDBF5D; Mon, 24 Oct 2022 04:54:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A5CE4612D6; Mon, 24 Oct 2022 11:53:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6A62C433C1; Mon, 24 Oct 2022 11:53:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612397; bh=zsc+NPBNRssYvuCi2pIfNAVP01gepb+7Au+cEg+X6mA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A3/h6DPLc39DykkVOxjTecXz2RDh3s/JDgkSAmmyhS3z9BrJp9SHJerkmxde/cS9B CglmrnH3MN/JvCsmI5DOQQJmhcUBpwtTzx8UW5AZbg0nyGYIk8jCFw1GLGm25Y2+yE +PGyDTd9C9cmh44V3Dne7zz30HsLipBPekK72lDY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrew Gaul , Jakub Kicinski , Sasha Levin Subject: [PATCH 4.14 183/210] r8152: Rate limit overflow messages Date: Mon, 24 Oct 2022 13:31:40 +0200 Message-Id: <20221024113002.896969208@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571385224277716?= X-GMAIL-MSGID: =?utf-8?q?1747571385224277716?= From: Andrew Gaul [ Upstream commit 93e2be344a7db169b7119de21ac1bf253b8c6907 ] My system shows almost 10 million of these messages over a 24-hour period which pollutes my logs. Signed-off-by: Andrew Gaul Link: https://lore.kernel.org/r/20221002034128.2026653-1-gaul@google.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/usb/r8152.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index a5a4fef09b93..1ed358d0da84 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -1382,7 +1382,9 @@ static void intr_callback(struct urb *urb) "Stop submitting intr, status %d\n", status); return; case -EOVERFLOW: - netif_info(tp, intr, tp->netdev, "intr status -EOVERFLOW\n"); + if (net_ratelimit()) + netif_info(tp, intr, tp->netdev, + "intr status -EOVERFLOW\n"); goto resubmit; /* -EPIPE: should clear the halt */ default: From patchwork Mon Oct 24 11:31:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8663 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421809wru; Mon, 24 Oct 2022 05:21:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6IGzKMnjWNc/Gf7dIMjgLR6ygC5XWUuf/QMciZ4tfl9dqksIepQFaYk3MBYsEslT2q2rzn X-Received: by 2002:aa7:c648:0:b0:461:d9b4:687e with SMTP id z8-20020aa7c648000000b00461d9b4687emr2795233edr.91.1666614074349; Mon, 24 Oct 2022 05:21:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614074; cv=none; d=google.com; s=arc-20160816; b=R13JQQJ48SmJ+k55l+GzBwMcjjJtsPX3EIcg+Eemh4rNI7kwOiQ2uj1gRC8Hef77I4 o13srnZU6pglIHHYaNn7a4EHmbmhv0h/gnWVbhur/bHbbSIR5DmtyEfXi/Dw+Fa7uQ2E lY3dJmMKLaV9avXzcDj8qMDwjjVUuYEKCI54BTycslXR7q1gPw13JWEZ2UEPuSQ+JlzI ZJnPkTlQR3XXnaOinrTaELBJMGVJ7aB8OUJjxpI3TM9AokrtsEqqgmQrm3hT4p1COHXB +iXA8PE1hGj6Smzlq4szhWfwjwGA3mIkCRy/9zFgJ67Mktti8s0cBXQZqa7qK/PkcskT DuKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HG0/DUbcaMZKb0DO+oOaasSUSluEzA9ip17TOkSQleU=; b=afUFepfUmFc+zUUAj+a8tal26vGDuc5dHMsBhF7/vC7JgC7nmkzqG7jbQf0Wa6MfDR Lwmb6pRm0P9tAJVc/KQm7ywL3LkG+HuGEXmEmzs9OGhguys0smRKUmtV22DdFeXBoyBC w6CVm+5cLM8mJuZ017NqdA+3fz4bvHfHNr1R6jIa414PKHxBkVGNuXG6SCjFd2R1/8yN ngNLH7uH5wT9oS8PSi6GrVSS/KQ8ycuhDaJ0VOenQia4T16KGjnM34xuRJkdrszS+R6T dPef9dBbQvSWusqh219jY0oRLygqxBrUdhYiMSyGeXA8CVvg38D9kZfYaQTUFfabgQHZ hFLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bO3cxB0V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id eb13-20020a0564020d0d00b0044611122003si35655467edb.599.2022.10.24.05.20.49; Mon, 24 Oct 2022 05:21:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bO3cxB0V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232994AbiJXMRR (ORCPT + 99 others); Mon, 24 Oct 2022 08:17:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232970AbiJXMPc (ORCPT ); Mon, 24 Oct 2022 08:15:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42F757A75D; Mon, 24 Oct 2022 04:56:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4CB65612D2; Mon, 24 Oct 2022 11:53:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60E88C433C1; Mon, 24 Oct 2022 11:53:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612399; bh=dkDStA/N5coBfdpr+Nbz6hKHmobdpXDdiQ3lUfUMJpY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bO3cxB0VRyUhaqxSa5YZtZwcUd6s+xcQfq3aHVH7u3oO/TyNlITMAAsd+I4D4zrWT 4LN047wNX6DjOm4SGGGRAD5ZgRI91+pOaBhn6GTXPZMrOEi/LWvmg1+kvE+VxCGCMj sVNfWWhXF0tTw+g1dhbWHqNVNeqvBaERi4ZS9xHE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Javier Martinez Canillas , Peter Robinson , Thomas Zimmermann , Sasha Levin Subject: [PATCH 4.14 184/210] drm: Use size_t type for len variable in drm_copy_field() Date: Mon, 24 Oct 2022 13:31:41 +0200 Message-Id: <20221024113002.927118752@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571519363163715?= X-GMAIL-MSGID: =?utf-8?q?1747571519363163715?= From: Javier Martinez Canillas [ Upstream commit 94dc3471d1b2b58b3728558d0e3f264e9ce6ff59 ] The strlen() function returns a size_t which is an unsigned int on 32-bit arches and an unsigned long on 64-bit arches. But in the drm_copy_field() function, the strlen() return value is assigned to an 'int len' variable. Later, the len variable is passed as copy_from_user() third argument that is an unsigned long parameter as well. In theory, this can lead to an integer overflow via type conversion. Since the assignment happens to a signed int lvalue instead of a size_t lvalue. In practice though, that's unlikely since the values copied are set by DRM drivers and not controlled by userspace. But using a size_t for len is the correct thing to do anyways. Signed-off-by: Javier Martinez Canillas Tested-by: Peter Robinson Reviewed-by: Thomas Zimmermann Link: https://patchwork.freedesktop.org/patch/msgid/20220705100215.572498-2-javierm@redhat.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/drm_ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index ce26e8fea9c2..335fad8b209a 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -437,7 +437,7 @@ EXPORT_SYMBOL(drm_invalid_op); */ static int drm_copy_field(char __user *buf, size_t *buf_len, const char *value) { - int len; + size_t len; /* don't overflow userbuf */ len = strlen(value); From patchwork Mon Oct 24 11:31:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8673 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422087wru; Mon, 24 Oct 2022 05:21:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7qQzRFOc8DmRFHx1ft2p96UIjtDMeT/c9ManpLirrPoFACBTxln0uvQCsr9TKkC0RF5qPy X-Received: by 2002:a17:906:8a58:b0:7a1:1c25:3e82 with SMTP id gx24-20020a1709068a5800b007a11c253e82mr10074416ejc.185.1666614110144; Mon, 24 Oct 2022 05:21:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614110; cv=none; d=google.com; s=arc-20160816; b=SxhDWEAWq0LYcpCs01LI5cmzSK2hbVMv9aYdiQafmb5SEoHfeti3NQq5t9pqC3pFNV eK4AbdA5pDeriFLwUcLjXgHjsyKNcPSHnTzo6zKSckNIKFo4krJc4P8wwnx7wotnV9vz vtzWx44KobDSEvNjFsFI2lyNdohO2p1YDWZJq0n7Qj0jQRYrG5Fi2vRGxL4DCkq79mru j6d9ys97k/PKx1rbDgL9gf9pKf5cdS3pz8J3tc0Zz2XS5eKFqD31/aTnsLT1vgX+GvyZ 4E/C/Uhf98tsf+RLgod80HdDlqP+duaFnRNMgsT7igAT2wNMeCJ5AztDxzmcbUZr3Lln eFvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XRsyIJwkX1+PL71/UGsazR99EkzEzgB5Rtpw5aklFhY=; b=e46/9ADVC3dKogMXfJS653aZfGyIKGA6LEaw61RDkff3a50qax+HJ6DLocil0Vykvo E+EtuVkq5v5rSDAzZAEzlzAg6GvA+mquwum+kHidOiS89kl/5CpCnMGGkmmr0WHhpbNT kqKSvrBKEcC2JOwrNtgTMpMqWS086bKqJtjH9T9cR1Ay11KMbBASzzm9MOH8us1LhR3V TCWAhVm/qxe0+cgnZfQdliMKwuK6wgNROAfVcEpjSwJvr4kBxDi7FEY0bxOVpOvIocOn zNzTix5O1qpM+ygN5ZrZnFv1eZt238a+GK0oY+zzbX4245x8POQEw2RRlQQUtM3ut78C 1eAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gbcwPUIX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g16-20020a1709065d1000b007a6384d506csi3239614ejt.643.2022.10.24.05.21.25; Mon, 24 Oct 2022 05:21:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gbcwPUIX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233089AbiJXMSx (ORCPT + 99 others); Mon, 24 Oct 2022 08:18:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233056AbiJXMRy (ORCPT ); Mon, 24 Oct 2022 08:17:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07E5E80E8F; Mon, 24 Oct 2022 04:56:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A75FDB8117E; Mon, 24 Oct 2022 11:53:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09036C433D6; Mon, 24 Oct 2022 11:53:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612402; bh=vvwgSjYLB6FyCR2+DSdzynHETnNIDB8EdTSjFM5J3rI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gbcwPUIXTDLGuyTWW0TMMQz57XnMB2tGBrXW9sJknvg93WkyVTeO07F/VsbJvze7i BtWVwhzFGzrrW7DMU1tHjKZ9XM8UBlRT8o3tjhiv+4hd5NafATQrpWqXaq6K+tn/lE r/42OEWM/+LoGjackaG6SwkBqpeBANe39LVdm1aw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Robinson , Javier Martinez Canillas , Thomas Zimmermann , Sasha Levin Subject: [PATCH 4.14 185/210] drm: Prevent drm_copy_field() to attempt copying a NULL pointer Date: Mon, 24 Oct 2022 13:31:42 +0200 Message-Id: <20221024113002.966489577@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571556821696939?= X-GMAIL-MSGID: =?utf-8?q?1747571556821696939?= From: Javier Martinez Canillas [ Upstream commit f6ee30407e883042482ad4ad30da5eaba47872ee ] There are some struct drm_driver fields that are required by drivers since drm_copy_field() attempts to copy them to user-space via DRM_IOCTL_VERSION. But it can be possible that a driver has a bug and did not set some of the fields, which leads to drm_copy_field() attempting to copy a NULL pointer: [ +10.395966] Unable to handle kernel access to user memory outside uaccess routines at virtual address 0000000000000000 [ +0.010955] Mem abort info: [ +0.002835] ESR = 0x0000000096000004 [ +0.003872] EC = 0x25: DABT (current EL), IL = 32 bits [ +0.005395] SET = 0, FnV = 0 [ +0.003113] EA = 0, S1PTW = 0 [ +0.003182] FSC = 0x04: level 0 translation fault [ +0.004964] Data abort info: [ +0.002919] ISV = 0, ISS = 0x00000004 [ +0.003886] CM = 0, WnR = 0 [ +0.003040] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000115dad000 [ +0.006536] [0000000000000000] pgd=0000000000000000, p4d=0000000000000000 [ +0.006925] Internal error: Oops: 96000004 [#1] SMP ... [ +0.011113] pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ +0.007061] pc : __pi_strlen+0x14/0x150 [ +0.003895] lr : drm_copy_field+0x30/0x1a4 [ +0.004156] sp : ffff8000094b3a50 [ +0.003355] x29: ffff8000094b3a50 x28: ffff8000094b3b70 x27: 0000000000000040 [ +0.007242] x26: ffff443743c2ba00 x25: 0000000000000000 x24: 0000000000000040 [ +0.007243] x23: ffff443743c2ba00 x22: ffff8000094b3b70 x21: 0000000000000000 [ +0.007241] x20: 0000000000000000 x19: ffff8000094b3b90 x18: 0000000000000000 [ +0.007241] x17: 0000000000000000 x16: 0000000000000000 x15: 0000aaab14b9af40 [ +0.007241] x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000 [ +0.007239] x11: 0000000000000000 x10: 0000000000000000 x9 : ffffa524ad67d4d8 [ +0.007242] x8 : 0101010101010101 x7 : 7f7f7f7f7f7f7f7f x6 : 6c6e6263606e7141 [ +0.007239] x5 : 0000000000000000 x4 : 0000000000000000 x3 : 0000000000000000 [ +0.007241] x2 : 0000000000000000 x1 : ffff8000094b3b90 x0 : 0000000000000000 [ +0.007240] Call trace: [ +0.002475] __pi_strlen+0x14/0x150 [ +0.003537] drm_version+0x84/0xac [ +0.003448] drm_ioctl_kernel+0xa8/0x16c [ +0.003975] drm_ioctl+0x270/0x580 [ +0.003448] __arm64_sys_ioctl+0xb8/0xfc [ +0.003978] invoke_syscall+0x78/0x100 [ +0.003799] el0_svc_common.constprop.0+0x4c/0xf4 [ +0.004767] do_el0_svc+0x38/0x4c [ +0.003357] el0_svc+0x34/0x100 [ +0.003185] el0t_64_sync_handler+0x11c/0x150 [ +0.004418] el0t_64_sync+0x190/0x194 [ +0.003716] Code: 92402c04 b200c3e8 f13fc09f 5400088c (a9400c02) [ +0.006180] ---[ end trace 0000000000000000 ]--- Reported-by: Peter Robinson Signed-off-by: Javier Martinez Canillas Acked-by: Thomas Zimmermann Link: https://patchwork.freedesktop.org/patch/msgid/20220705100215.572498-3-javierm@redhat.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/drm_ioctl.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index 335fad8b209a..73dcf03e7e8c 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -439,6 +439,12 @@ static int drm_copy_field(char __user *buf, size_t *buf_len, const char *value) { size_t len; + /* don't attempt to copy a NULL pointer */ + if (WARN_ONCE(!value, "BUG: the value to copy was not set!")) { + *buf_len = 0; + return 0; + } + /* don't overflow userbuf */ len = strlen(value); if (len > *buf_len) From patchwork Mon Oct 24 11:31:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9004 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp440373wru; Mon, 24 Oct 2022 06:04:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4/tAtJ6UXmOkTevGSGcgWT/8odwSRjc8EYwpQuAz88kRrhbWLrBTIX0vRCrJV9gRgtOnOe X-Received: by 2002:a17:902:8542:b0:186:75ee:baac with SMTP id d2-20020a170902854200b0018675eebaacmr18356284plo.35.1666616650530; Mon, 24 Oct 2022 06:04:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616650; cv=none; d=google.com; s=arc-20160816; b=C/BSsRKgwG8eCqYB7lnJFurOM4FfMnyrRJ8bzvZQzkseMJ/j2AcFpmVpgYcBI1N1IG WTGSO/6SzUpNVy+9mSKE2PX/WVfdZQfI0XpwONQv22cWAUbu1mDlCX/OGXEHGZsGquEZ zVQtZc8b7MkelUUkGBrkk5tDn9BxM++fvSuMQ3nW07Nt0yGsomFgKYH7Zl7IblAYvEt8 EU1eWClStUTCI+0NJiRYTNTiT5uv7ebmyyA85N3dwWXXyeAGMi9AJhCR93rBqS1bx7zM o3E7znrZz9lE9PgzZKa09ZsE4treXEu7xb2/WN3MTqobjBK9mz7wb6gGvozz/z7LwwV7 Qo+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gEqzW6H9dpg3V0ofk7wK1su6JoI8kDUgXgXhfmXVsbo=; b=w7qLLbkYE9g7LGY/Cfua9iqMd/oCMe3r1DUftXBBDizd/BAFGTxAUkGKlbK1bFazRj Ch82sIHpOEg7R4NzPL8At+kdIqFBUub1JgmDm4/09OIQw2iE5fjrWHh/uOLVdZBJ1OF2 ljIhOQm7hYKe3NS4oS5YhzA+1WYKMSWSCr7z7gM3uV0/pwwMsQNR5W4navC0mjWlQHM6 A15f9Su6cyvY1i4LduJJ4s8UNftCUfbcVTWj5MKzmmEnFJl5Tsy1YQ9xW7ASiXehNJvs zzGQfwmtRNTS05ltwih4n0EoNAGnb8VAYmv4dthGiAk5IK2ixFfk3ss6WSKI/qlcCw22 Tvdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="b/lbCdeV"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l3-20020a170902f68300b001865f96f6f7si17605512plg.104.2022.10.24.06.03.17; Mon, 24 Oct 2022 06:04:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="b/lbCdeV"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234981AbiJXNCl (ORCPT + 99 others); Mon, 24 Oct 2022 09:02:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235189AbiJXM7g (ORCPT ); Mon, 24 Oct 2022 08:59:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCDDC8168B; Mon, 24 Oct 2022 05:19:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2DF22612E1; Mon, 24 Oct 2022 11:53:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 422BFC433C1; Mon, 24 Oct 2022 11:53:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612407; bh=vE5rL+QOIEbIK8xVnEOaxCra1ZgilolzKDEk5wzU78s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b/lbCdeVB3B/FEWDkCwVUoUGMo++i0oegFHRSq2s4JIaPLYauxYtqRg79+wPrjQgw LjiIWgFnxJPJ+pBVYjq/6zlpcvyTCt4LIUWlnmrmguy7UFRBrUPlHF1hMJm7R03JZ7 voxlmIdbxmkT47vefwCOS0MjqtPE9E9gsBMhKiuk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mateusz Kwiatkowski , =?utf-8?q?Noralf_Tr?= =?utf-8?q?=C3=B8nnes?= , Maxime Ripard , Sasha Levin Subject: [PATCH 4.14 186/210] drm/vc4: vec: Fix timings for VEC modes Date: Mon, 24 Oct 2022 13:31:43 +0200 Message-Id: <20221024113002.996469012@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747574221114588519?= X-GMAIL-MSGID: =?utf-8?q?1747574221114588519?= From: Mateusz Kwiatkowski [ Upstream commit 30d7565be96b3946c18a1ce3fd538f7946839092 ] This commit fixes vertical timings of the VEC (composite output) modes to accurately represent the 525-line ("NTSC") and 625-line ("PAL") ITU-R standards. Previous timings were actually defined as 502 and 601 lines, resulting in non-standard 62.69 Hz and 52 Hz signals being generated, respectively. Signed-off-by: Mateusz Kwiatkowski Acked-by: Noralf Trønnes Signed-off-by: Maxime Ripard Link: https://patchwork.freedesktop.org/patch/msgid/20220728-rpi-analog-tv-properties-v2-28-459522d653a7@cerno.tech Signed-off-by: Sasha Levin --- drivers/gpu/drm/vc4/vc4_vec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_vec.c index 3a9a302247a2..bcf7880f84a8 100644 --- a/drivers/gpu/drm/vc4/vc4_vec.c +++ b/drivers/gpu/drm/vc4/vc4_vec.c @@ -291,7 +291,7 @@ static void vc4_vec_ntsc_j_mode_set(struct vc4_vec *vec) static const struct drm_display_mode ntsc_mode = { DRM_MODE("720x480", DRM_MODE_TYPE_DRIVER, 13500, 720, 720 + 14, 720 + 14 + 64, 720 + 14 + 64 + 60, 0, - 480, 480 + 3, 480 + 3 + 3, 480 + 3 + 3 + 16, 0, + 480, 480 + 7, 480 + 7 + 6, 525, 0, DRM_MODE_FLAG_INTERLACE) }; @@ -313,7 +313,7 @@ static void vc4_vec_pal_m_mode_set(struct vc4_vec *vec) static const struct drm_display_mode pal_mode = { DRM_MODE("720x576", DRM_MODE_TYPE_DRIVER, 13500, 720, 720 + 20, 720 + 20 + 64, 720 + 20 + 64 + 60, 0, - 576, 576 + 2, 576 + 2 + 3, 576 + 2 + 3 + 20, 0, + 576, 576 + 4, 576 + 4 + 6, 625, 0, DRM_MODE_FLAG_INTERLACE) }; From patchwork Mon Oct 24 11:31:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9969 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp614409wru; Mon, 24 Oct 2022 12:23:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5NzqEkBakDtp273qRA5urF4mG4+faOIqeMl/EziHUXUnUSXxgrgaPhmZUhWfHojfv2KcyN X-Received: by 2002:a17:907:9811:b0:79a:a1fe:8be6 with SMTP id ji17-20020a170907981100b0079aa1fe8be6mr16490476ejc.480.1666639431508; Mon, 24 Oct 2022 12:23:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666639431; cv=none; d=google.com; s=arc-20160816; b=PHtuWhvexQ6DGQUJMSLhwU5shPlIzyV0EIthZDUNj0jBPJpFHbAd5QmaxUvq7VECFo X9K0u2aQUbOSi6hXd+bVG/a+inklvSIf1y0FsE9SAXr9AkWdqqWlk3/JUKeHZdlrIcdJ PD5dCgVpYotCEc3wooV4lYnmyrnJYcO+iB9CGsQ+1g5oeyx/ChBmYgXgrxOmwY9n9v9o miBHERf6IlTiLx202Ov4jxbW9Zq4FjOGBvT3gyzONS2IdqksO12dywEuZ+7oc5sVKUQA P+t/SpgTZkhy1dl8BQKQHwbDITDubHF2Zwg7+6bNRul65XtBuK5AecBQXlH4X1n9FhCv 0mvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Eov/uMuMp9j+hJEgM21txxRehHFmYrDxlL6AB+0WeQg=; b=ewkHRcZgvsQpavsgWwD1SBtrirq5lRsZG9061bvhSOiCSC8mimw/M/cqpgPXxqV0Mu BxMGuUMwZvE9mI9eg4TL1sNmLmlrc4QdUlVNP7VkDX4ML66ZdKJD6IoVhoHGtSvhV3kU DY/Mkmbc83+kuDzYQQK5nwKD5RzOY889X1l//b05h0hc3kNsdhqoXpaLbXUvKmqHBx3u 5FaBdMzByhA2O+uDt8cMhJAmDIFKJSPkYgUFRlfaZQJM0J22MEK+VsOEoj/BMXk7395/ PlE7gJjJTmeUcuGUycvWqoIoF7XNayrRCsWeG+ccnq97KjTYqtc+X/MrRTYRwt2OxX2k 5NVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bcA6F7Vw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id es15-20020a056402380f00b004615fad6144si574049edb.40.2022.10.24.12.23.26; Mon, 24 Oct 2022 12:23:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bcA6F7Vw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230241AbiJXTUS (ORCPT + 99 others); Mon, 24 Oct 2022 15:20:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231146AbiJXTTm (ORCPT ); Mon, 24 Oct 2022 15:19:42 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A3AB4198A; Mon, 24 Oct 2022 10:56:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id E4087CE1362; Mon, 24 Oct 2022 11:53:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3ADCC433C1; Mon, 24 Oct 2022 11:53:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612410; bh=GNPGlTVN0Wx/jDcaPTBSQwgG0mCsQRKC7an2BZBzTCA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bcA6F7VwvKoQEnBdJAZAMN/WlE5VW5kd3gisyV0eTDMJx3B3KVVzIRCHUbmfWHlnZ bdOCx9N9CLUMAhS7BQYTTLjbO2pzoN+Esxo1FXmeWsHMLXrP5bKI0U0Y4su54ofuAH qgy1CuT75AJhBVwXR+g6xrndc8aT5zvsxrU33OZI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Sasha Levin Subject: [PATCH 4.14 187/210] platform/x86: msi-laptop: Change DMI match / alias strings to fix module autoloading Date: Mon, 24 Oct 2022 13:31:44 +0200 Message-Id: <20221024113003.026570106@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747598108608712438?= X-GMAIL-MSGID: =?utf-8?q?1747598108608712438?= From: Hans de Goede [ Upstream commit 2a2565272a3628e45d61625e36ef17af7af4e3de ] On a MSI S270 with Fedora 37 x86_64 / systemd-251.4 the module does not properly autoload. This is likely caused by issues with how systemd-udevd handles the single quote char (') which is part of the sys_vendor / chassis_vendor strings on this laptop. As a workaround remove the single quote char + everything behind it from the sys_vendor + chassis_vendor matches. This fixes the module not autoloading. Link: https://github.com/systemd/systemd/issues/24715 Signed-off-by: Hans de Goede Link: https://lore.kernel.org/r/20220917210407.647432-1-hdegoede@redhat.com Signed-off-by: Sasha Levin --- drivers/platform/x86/msi-laptop.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/platform/x86/msi-laptop.c b/drivers/platform/x86/msi-laptop.c index 1ba5f4689df4..42b31c549db0 100644 --- a/drivers/platform/x86/msi-laptop.c +++ b/drivers/platform/x86/msi-laptop.c @@ -609,11 +609,10 @@ static const struct dmi_system_id msi_dmi_table[] __initconst = { { .ident = "MSI S270", .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "MICRO-STAR INT'L CO.,LTD"), + DMI_MATCH(DMI_SYS_VENDOR, "MICRO-STAR INT"), DMI_MATCH(DMI_PRODUCT_NAME, "MS-1013"), DMI_MATCH(DMI_PRODUCT_VERSION, "0131"), - DMI_MATCH(DMI_CHASSIS_VENDOR, - "MICRO-STAR INT'L CO.,LTD") + DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-STAR INT") }, .driver_data = &quirk_old_ec_model, .callback = dmi_check_cb @@ -646,8 +645,7 @@ static const struct dmi_system_id msi_dmi_table[] __initconst = { DMI_MATCH(DMI_SYS_VENDOR, "NOTEBOOK"), DMI_MATCH(DMI_PRODUCT_NAME, "SAM2000"), DMI_MATCH(DMI_PRODUCT_VERSION, "0131"), - DMI_MATCH(DMI_CHASSIS_VENDOR, - "MICRO-STAR INT'L CO.,LTD") + DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-STAR INT") }, .driver_data = &quirk_old_ec_model, .callback = dmi_check_cb From patchwork Mon Oct 24 11:31:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10033 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp622468wru; Mon, 24 Oct 2022 12:45:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM64tILTC96Axd8qNk7RZqXnYJClJX4nqeRCs+FevQ8l97P5EM4UcpC/HIf9P9szPF0R5nVX X-Received: by 2002:a17:906:7055:b0:78b:9148:6b41 with SMTP id r21-20020a170906705500b0078b91486b41mr28155160ejj.629.1666640733913; Mon, 24 Oct 2022 12:45:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640733; cv=none; d=google.com; s=arc-20160816; b=mp81jfmbac6TVCjKRXZJIiJpXdtFo+CcTJMeBEm1wPC0IYI6q5WHb4p+IXIgaLcFOn KcqrMf2Wt7uuZATqo6m7yG59ZeZx2JPu8A9ALRxkX2r8nCR0+1GF0AqJHVXmqAckH3DG wT7PperA/uqT30x0W3QPNBSRw1oEp11hCOO2icW8qmBWv5/SsqCX+Pq8wdvls+fd6XfA gRkCrSk7O4a9LTZNzBB8zQYSmz8qBtgzdgbab1Itpl0QmUTqJu2pQNNou2VGogbkqNsx P8+oS+MKw45Uq7FqHzmO4YriqRMkZZuRJAhWwGaj4U9AIp3o1W25O8VLanZSZBS2gsqe YWPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pduzL4e4PG7j9Ol/k/QG8XHoujfods5QybXQ7hCA72Q=; b=Odo3Zf1uB7EWDWE/i+0nPJczVqeJPHyq+fAWrDW8EPDu2B0HVisyVzrrbNTXXA7Ot1 UHrd4fGcT75Zv1+sbdSMDIJlFXvZy0Vuac7daxTQZ5o6LQUINCGcmXXoWlOCH6Im2EtF 2GpV9suzKDb+qwCTaMefRUqww/Z1OyoRpFGG0T23XRcNKnVFnQKgjA72f2N4jL71e8cI yjWCAKOOYm6YhaesTDmPXp7xHMrjGto2qvKH9tx7xEI0PhkflwQqMZ0RFNkyk31MYTFM ps79FQKTSUJn8VrcZdKbzWW9PzIwfuLwZIJS0Psr+7zVEMsNB2mTW9I1Tm7UWSoFWY3Q pVUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VOHOzTZl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oz30-20020a1709077d9e00b0077fd5b45e18si630676ejc.929.2022.10.24.12.45.07; Mon, 24 Oct 2022 12:45:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VOHOzTZl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233438AbiJXTmf (ORCPT + 99 others); Mon, 24 Oct 2022 15:42:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233437AbiJXTl1 (ORCPT ); Mon, 24 Oct 2022 15:41:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C867262DE5; Mon, 24 Oct 2022 11:11:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1EF33B811B3; Mon, 24 Oct 2022 11:53:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71892C433C1; Mon, 24 Oct 2022 11:53:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612412; bh=1f/IIM22KhSPq/tEzKR9rXQnG4Nt9yGvBNVX09/3mEg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VOHOzTZl/Uk0SwQEqXTjDq/MflK9nOWfAtgDJlgHKSv3xUGfJq3KD5l8FYVTUNm1G invv/FGAYpUf+v+46g512LH8tWur6TXyEGNVk5JOByzqBqO4S+U8U6aCAjz0R2LZnU 9I+dc7e5TcyO7AVykywRTFTO8uwy3waqr3/PIDtA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, hongao , Alex Deucher , Sasha Levin Subject: [PATCH 4.14 188/210] drm/amdgpu: fix initial connector audio value Date: Mon, 24 Oct 2022 13:31:45 +0200 Message-Id: <20221024113003.060115165@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747599474139452369?= X-GMAIL-MSGID: =?utf-8?q?1747599474139452369?= From: hongao [ Upstream commit 4bb71fce58f30df3f251118291d6b0187ce531e6 ] This got lost somewhere along the way, This fixes audio not working until set_property was called. Signed-off-by: hongao Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c index 0894bb98dc51..be3a384cc1cf 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c @@ -1678,10 +1678,12 @@ amdgpu_connector_add(struct amdgpu_device *adev, adev->mode_info.dither_property, AMDGPU_FMT_DITHER_DISABLE); - if (amdgpu_audio != 0) + if (amdgpu_audio != 0) { drm_object_attach_property(&amdgpu_connector->base.base, adev->mode_info.audio_property, AMDGPU_AUDIO_AUTO); + amdgpu_connector->audio = AMDGPU_AUDIO_AUTO; + } subpixel_order = SubPixelHorizontalRGB; connector->interlace_allowed = true; @@ -1786,6 +1788,7 @@ amdgpu_connector_add(struct amdgpu_device *adev, drm_object_attach_property(&amdgpu_connector->base.base, adev->mode_info.audio_property, AMDGPU_AUDIO_AUTO); + amdgpu_connector->audio = AMDGPU_AUDIO_AUTO; } drm_object_attach_property(&amdgpu_connector->base.base, adev->mode_info.dither_property, @@ -1834,6 +1837,7 @@ amdgpu_connector_add(struct amdgpu_device *adev, drm_object_attach_property(&amdgpu_connector->base.base, adev->mode_info.audio_property, AMDGPU_AUDIO_AUTO); + amdgpu_connector->audio = AMDGPU_AUDIO_AUTO; } drm_object_attach_property(&amdgpu_connector->base.base, adev->mode_info.dither_property, @@ -1879,6 +1883,7 @@ amdgpu_connector_add(struct amdgpu_device *adev, drm_object_attach_property(&amdgpu_connector->base.base, adev->mode_info.audio_property, AMDGPU_AUDIO_AUTO); + amdgpu_connector->audio = AMDGPU_AUDIO_AUTO; } drm_object_attach_property(&amdgpu_connector->base.base, adev->mode_info.dither_property, From patchwork Mon Oct 24 11:31:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8678 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422246wru; Mon, 24 Oct 2022 05:22:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5hDkxNWySRjxkj3IMhg5bODMcnYK7Vf8IpTn7WTCa+7dqKOPz2lel4lIQqVwe2ML6WylJ5 X-Received: by 2002:a05:6402:5202:b0:461:b7e3:e6b7 with SMTP id s2-20020a056402520200b00461b7e3e6b7mr5881982edd.282.1666614131424; Mon, 24 Oct 2022 05:22:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614131; cv=none; d=google.com; s=arc-20160816; b=C2W2z0c+bs/fc0PbPMOTA+hdVR0V8qPD/UejkVRW2qjYS9qhkk4L8L29A+wop2Ou7m Ofbfm11R0D6koPQNoSpr/QXwO7V7HzQHYM1wPsg8udUwF6qGiGQwfIwn8GiEB+0H58to uAMiCo9smRstWYu6GLnVjOYIAcVPAJOYiCow3ZM8T1mGcPkjc55ZqcUE7n4ra0x8GeOS 6NrtCvwOYddVHsKRyIeS+2zT8HJPvAug+KWsQ8Iy9f/dr/T/n1RQ2P2j3Y7WgtMUIEkH OWtjmJLdD/tti+GhUuY1KlKVX0xrNRaU82RD0HSUKB04RA+Cs7AgukDQj4+8FnTOJisv K6uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=t6pYzKf+dV9VwI5u7zUX4dad6lryZX4VT26odLCVul8=; b=bgwH/LFPErdoGngUzxyqdM7JID8GRzNhpSE3QqmiErw75viKAen4ytCuKtKtj2Ydcc 1FLLw/vDJoB3uORYV25203/sLe8kXlm9fiJTlQe0ICqRoPDsbw4CORT8Dp6hKV5GUYx/ lYiBodjoGfxLjOUQ9hDN12irsuk51BmemA7BrUitbne0NQfSEBnz7NeftIosxMdRIqwZ hF+pCNVhKysopqpFmAloy9zxWFjJuPTaRXQR9NU8j0gzxtKyusnptakioN7H5KeMQ/zi N8Z+jhQ/J+AfW2A1oMaLYYvDht4v3IHRcj/34kCRFVrKpxG+WUJIdhBnwqaC4/WN94CN /M+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Cemfjvw4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s16-20020a056402015000b0044f2fb68fe6si23810549edu.495.2022.10.24.05.21.47; Mon, 24 Oct 2022 05:22:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Cemfjvw4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233139AbiJXMUE (ORCPT + 99 others); Mon, 24 Oct 2022 08:20:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233247AbiJXMSr (ORCPT ); Mon, 24 Oct 2022 08:18:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CA477A755; Mon, 24 Oct 2022 04:57:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BEACFB811A5; Mon, 24 Oct 2022 11:53:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17883C433C1; Mon, 24 Oct 2022 11:53:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612415; bh=K3g/bipyVgdvYf1/LyeYSi4TuDtWzk3v8S4uK1wu3Kk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cemfjvw4/M4xVYQR9G5joEEiZLIMCiqK19OEsr2Pxnm+AObxcM68diU5zEJknvt5J Jcxrb//gLX9HwsE5mdOuEgoKLO6ckjqnp45MmLK70DahiaYRhN6E14Y07/F+L0HMvy sylrQ+m/jX1tPwn4EScFS7OaAgkbvOJY3WGaSGes= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Haibo Chen , Shawn Guo , Sasha Levin Subject: [PATCH 4.14 189/210] ARM: dts: imx7d-sdb: config the max pressure for tsc2046 Date: Mon, 24 Oct 2022 13:31:46 +0200 Message-Id: <20221024113003.089705113@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571579621294554?= X-GMAIL-MSGID: =?utf-8?q?1747571579621294554?= From: Haibo Chen [ Upstream commit e7c4ebe2f9cd68588eb24ba4ed122e696e2d5272 ] Use the general touchscreen method to config the max pressure for touch tsc2046(data sheet suggest 8 bit pressure), otherwise, for ABS_PRESSURE, when config the same max and min value, weston will meet the following issue, [17:19:39.183] event1 - ADS7846 Touchscreen: is tagged by udev as: Touchscreen [17:19:39.183] event1 - ADS7846 Touchscreen: kernel bug: device has min == max on ABS_PRESSURE [17:19:39.183] event1 - ADS7846 Touchscreen: was rejected [17:19:39.183] event1 - not using input device '/dev/input/event1' This will then cause the APP weston-touch-calibrator can't list touch devices. root@imx6ul7d:~# weston-touch-calibrator could not load cursor 'dnd-move' could not load cursor 'dnd-copy' could not load cursor 'dnd-none' No devices listed. And accroding to binding Doc, "ti,x-max", "ti,y-max", "ti,pressure-max" belong to the deprecated properties, so remove them. Also for "ti,x-min", "ti,y-min", "ti,x-plate-ohms", the value set in dts equal to the default value in driver, so are redundant, also remove here. Signed-off-by: Haibo Chen Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin --- arch/arm/boot/dts/imx7d-sdb.dts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/arch/arm/boot/dts/imx7d-sdb.dts b/arch/arm/boot/dts/imx7d-sdb.dts index 255e64ba32e2..7cf6557f4afc 100644 --- a/arch/arm/boot/dts/imx7d-sdb.dts +++ b/arch/arm/boot/dts/imx7d-sdb.dts @@ -179,12 +179,7 @@ interrupt-parent = <&gpio2>; interrupts = <29 0>; pendown-gpio = <&gpio2 29 GPIO_ACTIVE_HIGH>; - ti,x-min = /bits/ 16 <0>; - ti,x-max = /bits/ 16 <0>; - ti,y-min = /bits/ 16 <0>; - ti,y-max = /bits/ 16 <0>; - ti,pressure-max = /bits/ 16 <0>; - ti,x-plate-ohms = /bits/ 16 <400>; + touchscreen-max-pressure = <255>; wakeup-source; }; }; From patchwork Mon Oct 24 11:31:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8637 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp420998wru; Mon, 24 Oct 2022 05:19:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4w0yfKBByaisvDSj74oumA8nGPX4zlQ9ytH4TPlPP0xObjY/qc1MeJirOUBdUR/QaLTfUx X-Received: by 2002:a17:907:94c1:b0:792:56d7:2879 with SMTP id dn1-20020a17090794c100b0079256d72879mr22543802ejc.144.1666613963660; Mon, 24 Oct 2022 05:19:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613963; cv=none; d=google.com; s=arc-20160816; b=NADl796Zz6fQOwltLGOZCCbDBpOBj54JeQ1Ln866kKaQEeWQWsN2YsxzZM4leGFW23 rY5Bu5kYofAqZBfb44gNVzTcBbrlP620TKWnlLBqgFl4DXzeycOcfg89+vzilwEKBaZp E+EZX6s9Jwvfqv2A+2LgVsLOKsOrs3ytB481DTY4R8Uq71d/RErP6GfaOZZWS7cMHHub c+wXAE7xsxZFJFrQdiOhpUalenWxKlEyucsM5ykiZb72neI+zDiGime1lDD44TErPz9C xKTpJGyP2+OBMC1bTnzLpNt1nmgxzCOx7eao/zZB9Oj50bEUfe9FWSD/yUh6TeeIQTma TwAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HMztF0j8TLwl3rTB7/2n368sMeRPXWHcIExsoH+iA6c=; b=CKeN0BjOMTrszZJ62XoYXxD78fwtKOylSYo+O8XODYodW4x0jDC/6LwFiMUd+WpENr yCqX66lkoPuWfWMQP11QfDjsjuY/Lt1FArpS/oJTFq4j8J6iRIMPuCMpzAfcVcgrtIYw x/7bqg8ZNOnRKVG7YFl+6baanCTh/9NyOKhCeYs7z6VyFqfP4HUIp3xXzWPQXj97wI4E eBr5jXFKrn+350cSWyhRg7uo4lBeXAG5aNDldHRie6TJrqhgJ9p/99nSQv0Ha0S6JG9G S6S/hg259yX3VO3MM1BVYz/y2Uc/cs0ZhrAmZKlZlz9zgYC7uAs7/xMExs8H7duzx8F4 bo0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AmlEc0rV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id be5-20020a1709070a4500b007aa784a3cb8si886312ejc.687.2022.10.24.05.18.59; Mon, 24 Oct 2022 05:19:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AmlEc0rV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232966AbiJXMNk (ORCPT + 99 others); Mon, 24 Oct 2022 08:13:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232832AbiJXMMx (ORCPT ); Mon, 24 Oct 2022 08:12:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C04C3167F1; Mon, 24 Oct 2022 04:54:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9BEF2612A5; Mon, 24 Oct 2022 11:53:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B00CAC433C1; Mon, 24 Oct 2022 11:53:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612418; bh=G2Iq+E2IQldK7wPBaBskETo3Zul+M0o1nQ7kNdoncQY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AmlEc0rVutsK+K5vqSHdKlWO60LuFJtAcL+Fzw4BGZKC172tgUI5mWChJh6hHCa3S R3nnZKE6rdHji/jgBOYPC2nS5xQ2hPYEdzlsT7Umlcqlv23wLdi0xgBiyad1BTrAed NwCUKoTFtxdBkOB/8SWc+ZVJ3X3hCWSDY2MzS+K8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Stein , Shawn Guo , Sasha Levin Subject: [PATCH 4.14 190/210] ARM: dts: imx6q: add missing properties for sram Date: Mon, 24 Oct 2022 13:31:47 +0200 Message-Id: <20221024113003.119860896@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571403660905154?= X-GMAIL-MSGID: =?utf-8?q?1747571403660905154?= From: Alexander Stein [ Upstream commit b11d083c5dcec7c42fe982c854706d404ddd3a5f ] All 3 properties are required by sram.yaml. Fixes the dtbs_check warning: sram@900000: '#address-cells' is a required property sram@900000: '#size-cells' is a required property sram@900000: 'ranges' is a required property Signed-off-by: Alexander Stein Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin --- arch/arm/boot/dts/imx6q.dtsi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/boot/dts/imx6q.dtsi b/arch/arm/boot/dts/imx6q.dtsi index 4747ede61acd..7b335e8050d3 100644 --- a/arch/arm/boot/dts/imx6q.dtsi +++ b/arch/arm/boot/dts/imx6q.dtsi @@ -82,6 +82,9 @@ ocram: sram@00900000 { compatible = "mmio-sram"; reg = <0x00900000 0x40000>; + ranges = <0 0x00900000 0x40000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; }; From patchwork Mon Oct 24 11:31:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9878 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp569467wru; Mon, 24 Oct 2022 10:28:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7/7CJB0BNCrB6i+B4Sc6LV7dAvG4DEE5aRTH9DTmFU/3TI3F3UQzJP9j5a1zdASJMuFNH+ X-Received: by 2002:a17:906:cc16:b0:78d:ce93:f5af with SMTP id ml22-20020a170906cc1600b0078dce93f5afmr27134939ejb.592.1666632508597; Mon, 24 Oct 2022 10:28:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666632508; cv=none; d=google.com; s=arc-20160816; b=kg5ELr+mjGUqclqTyiCervOmsp9tqYtD4rLjOOpEbSma8voN3+dnR/RDKZg08S7sHI eDv+b64oSxQnUPdxhWJhZTwblP/9wVJBOPHR3SITIB5UJuXH4E8zNXq8yAajr5p0JRGM l1ZaDzqL8vZ/dn1rk/WoaLQ8HgoMzxXZHIRtYt7wQtwjmllrgEWPP9vYvfolcowryRqa Vwolt11oxAhFXdRk7MmPNlHrlBvdFXx6dFT4WKE2qcLLUFk88/wzWlJx8e576Mh10FJ1 s/bDsn+4oBYiqciiJL2oqaGRP3aMHKdP/UQI3iwm6/8l/sCb6alerN5UCOaGqnWIglVq ICMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bEL4653pR2Wz65VSLpN99uXElmAqmonKFhz83YDVT64=; b=OoR3/Ow34w7HV2SFkKTtoMZWGihMWM48NrtFfOOeTym/2IclSXXTOs7QA/5JoiKSjL Ru1qb3SbAwdiCk8WQNTXbu9g/Yth82ULtr4AyZC0G//SBL89k89nP+D9tC0wVpQI/tc+ PHoAtfMB1WO58n9XoQU1TibWbj4UGKl7CAJbIkB1BrCzg40oWbITbUhaZ0TvPCcpd/gP QgFCZQ95KYvXIjXg453VYDp/BW+rNHCczNuiRmkkQxHVfev1NClXriRgxhc32QuwZ8aH 7fE52QFN0qX8O/2/cRf4ZNit4fj7W2tkymkyWQuEItGy7dDexj0FX2KoObdWsuXpFYdM 4WeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VOwieUTc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gs34-20020a1709072d2200b007a39ad3da43si316127ejc.714.2022.10.24.10.28.03; Mon, 24 Oct 2022 10:28:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VOwieUTc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231265AbiJXRNf (ORCPT + 99 others); Mon, 24 Oct 2022 13:13:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234234AbiJXRNS (ORCPT ); Mon, 24 Oct 2022 13:13:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12622ABD63; Mon, 24 Oct 2022 08:48:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 48FF06122D; Mon, 24 Oct 2022 11:53:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EF7CC433D6; Mon, 24 Oct 2022 11:53:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612420; bh=YlgZOzrqukjFfVMxlUmPzEcczFx/ZMbrG2RpxM2x+LY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VOwieUTc3oSZtkFKFPnUgETdMiHs5zktYfZFAc+ha8+QreB11nquTGQNKkny4TGl7 WYYw2vfE91U+J6/iCQts0HpnbD40F46H27HaTxyoXgC912rtLRNfnVe5Y2nhMp3zkL hrOZO5mSTwFPWXcsv5CAunKeKGdj53NCchV/q73g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Stein , Shawn Guo , Sasha Levin Subject: [PATCH 4.14 191/210] ARM: dts: imx6dl: add missing properties for sram Date: Mon, 24 Oct 2022 13:31:48 +0200 Message-Id: <20221024113003.149116247@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747590849491971306?= X-GMAIL-MSGID: =?utf-8?q?1747590849491971306?= From: Alexander Stein [ Upstream commit f5848b95633d598bacf0500e0108dc5961af88c0 ] All 3 properties are required by sram.yaml. Fixes the dtbs_check warning: sram@900000: '#address-cells' is a required property sram@900000: '#size-cells' is a required property sram@900000: 'ranges' is a required property Signed-off-by: Alexander Stein Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin --- arch/arm/boot/dts/imx6dl.dtsi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/boot/dts/imx6dl.dtsi b/arch/arm/boot/dts/imx6dl.dtsi index 8475e6cc59ac..71e7c87c7497 100644 --- a/arch/arm/boot/dts/imx6dl.dtsi +++ b/arch/arm/boot/dts/imx6dl.dtsi @@ -63,6 +63,9 @@ ocram: sram@00900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; }; From patchwork Mon Oct 24 11:31:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10032 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp622445wru; Mon, 24 Oct 2022 12:45:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6T9rfXVBdeoMGEfCfDjXqse42QTt9eeS0rJtovWKVtlXTAqxl4BXIp+xGMdnd5OLEFnj/U X-Received: by 2002:a17:906:8a64:b0:78d:b00d:fe with SMTP id hy4-20020a1709068a6400b0078db00d00femr29806728ejc.32.1666640720816; Mon, 24 Oct 2022 12:45:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640720; cv=none; d=google.com; s=arc-20160816; b=vDwLhpWBjLQET15puiVKU3+XQ2krU014O+BfN7bszfrHquQ2KbwMtOUcvvftS3QhSR MNaVuPJhLoD9cp7PV5TW9O8fL6rJbYOscsXhgry1FI2GTgIjXhEwyNua6HoyAXDnqpix RhLVwuW+muDRR1ituw8Ke0TWCmTWoFnGTDCYjU74gN1cv9aVKEjVDeyJClWnbn1t2tAY C/RFRV22Lm8tvySzedjZ5SuyhJ+kXfvc4aYQgy0A8tTdwtET/Qg8VH0WJ010hbyQ+zSM HZ6QxD3cnM4veCrGCdmRt8ojKJAXWgeiPHticK9eQbhZEp+VM6ADA/DvBVBsG875tunl YZTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VIKZDtYCE2bxole8SMLodkAVqljBfJIR/yfKhVFaZhg=; b=ozPH3o1m11BxTYuhDW1XhF5K08vJCpCK9CifZ0HQywBzzAAP36lDg85R1uYxqHam+T PqBgqmtD1IUlVa94EVwL23MRhUeFeBJP18qHLfPK6lMp0/KezlEA+Iyv1SgimScELdkC bASVLE7LZzB3fiAakutsE5S1tNLaAR9xfTZps0l3mR8qXjJOJa2nlmN4ie4kEN5vCvC1 uhsoGd9grKGos6Umm14igOKS7tHD554JdMMcGQueMlqe9kfFjuQZZQ+4Q3DDHh4dzVzk FTRx59ArE9+Sj4078wYEMqfn4oG1g1HAHGbMYCuPIIL3fCDfjWBvGYMq3sGMuUyHlE59 GqNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="G/4ysU79"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 11-20020a170906310b00b0078dad42f75dsi476960ejx.475.2022.10.24.12.44.51; Mon, 24 Oct 2022 12:45:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="G/4ysU79"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231496AbiJXTlr (ORCPT + 99 others); Mon, 24 Oct 2022 15:41:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233293AbiJXTks (ORCPT ); Mon, 24 Oct 2022 15:40:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40C9A1D442E; Mon, 24 Oct 2022 11:10:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 919A4B81158; Mon, 24 Oct 2022 11:53:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFB63C433C1; Mon, 24 Oct 2022 11:53:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612423; bh=DUNRbOfYHcGduoEF3sZo4D3K7GhkZpVN4FdTCRui4gY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G/4ysU79IDXuzxsY91lUYmD6YBbShwMc7QD7brd/9QDRWkdd8OM20GmtgrHNNbR2P EPNOQPlbm65gHRUOFshh7DJ5hCAZIwR+u0KrH2YyO7aJXvySp9Ul7t7C08g7D9PGtK 7aVoXNLm+/CjQLNHM4Qmo7X2i3yWG2V9fL5FssSs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Stein , Shawn Guo , Sasha Levin Subject: [PATCH 4.14 192/210] ARM: dts: imx6qp: add missing properties for sram Date: Mon, 24 Oct 2022 13:31:49 +0200 Message-Id: <20221024113003.179050162@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747599460503510394?= X-GMAIL-MSGID: =?utf-8?q?1747599460503510394?= From: Alexander Stein [ Upstream commit 088fe5237435ee2f7ed4450519b2ef58b94c832f ] All 3 properties are required by sram.yaml. Fixes the dtbs_check warning: sram@940000: '#address-cells' is a required property sram@940000: '#size-cells' is a required property sram@940000: 'ranges' is a required property Signed-off-by: Alexander Stein Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin --- arch/arm/boot/dts/imx6qp.dtsi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/boot/dts/imx6qp.dtsi b/arch/arm/boot/dts/imx6qp.dtsi index 299d863690c5..6cf0f9e18b70 100644 --- a/arch/arm/boot/dts/imx6qp.dtsi +++ b/arch/arm/boot/dts/imx6qp.dtsi @@ -47,12 +47,18 @@ ocram2: sram@00940000 { compatible = "mmio-sram"; reg = <0x00940000 0x20000>; + ranges = <0 0x00940000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; }; ocram3: sram@00960000 { compatible = "mmio-sram"; reg = <0x00960000 0x20000>; + ranges = <0 0x00960000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; }; From patchwork Mon Oct 24 11:31:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8681 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422338wru; Mon, 24 Oct 2022 05:22:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4SaIZrwynMWkB8FRz/FUblmmWY3LFnBUfYx4OkeoSm92MyXcXLMl15dW4x0Y9r6DS+bGQA X-Received: by 2002:a17:907:7d8d:b0:78d:d467:dd3 with SMTP id oz13-20020a1709077d8d00b0078dd4670dd3mr27706169ejc.547.1666614145886; Mon, 24 Oct 2022 05:22:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614145; cv=none; d=google.com; s=arc-20160816; b=Mf3pF4+O/EjO+BatRthgrZUOYMFZPeo9M4Uk8VgcWm8W361AzprM8kTm6V/8mb8DA6 1CM5YzHUKuhPN+0vn0pkjcGyVXznvEXkDFckiBcnDk/yjSCJHM2ye77VZBz1IrKRwfzq Yjn/CRc+CGP8OSOT6l2zjyZT6zGG7/DUNOuvscR8ohJtxb1NC3hL+X1UyVn0j+YO93LL a2JahddYWXoxPHlgLk4KpPD0gnP3TtTg34n+IJJ1iLlVCPz5IMdglGorHeibJJTrZTp/ 8u8DEyS3o7fxJq6KfB/tjuXs6hrHuouH8DE2BRnSL0jhXkFyxqdQAKqW2Yb0lSON6XVU 3tZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HjpFgeJu24bIwxwONnCpSqGJZsvJiFZiPOYml/oqsC4=; b=sJsvhb+vK0wclux+TnkuOC3nPOu3IdeL+4Zlxwx8Fonf5VtWr/AEIs8e67AyARvpe9 31yqdoGsNuWnfJt5CBcoLzTVV2NGlqdiGFDbqgaYGpI6jCCGsY0ETdN1AoVU6qgpHrLb b+n9by77eNEahY/c/L/R3vZbajaoCVfkdlH3lS3aPa0kTwBKHmP/JtyW0t5BphqS+ibs XhC1TwScBpQWjQ5yIhhV0hzdjHabHSOFrpOaEx7JF/BHlNTmAY9IN4VntSXitL3eYrI1 q1IJnIJqlG2/ClgBc4H+4d8+xDExXwgMCAMigEcqZLbPPYykQHp3r8lKa1tNNQG5wOeD xqBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DZq0n4Uu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b20-20020aa7df94000000b00461b2c3c4acsi3420380edy.515.2022.10.24.05.22.01; Mon, 24 Oct 2022 05:22:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DZq0n4Uu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233265AbiJXMUY (ORCPT + 99 others); Mon, 24 Oct 2022 08:20:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233290AbiJXMTH (ORCPT ); Mon, 24 Oct 2022 08:19:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FC0082747; Mon, 24 Oct 2022 04:57:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 42592B81134; Mon, 24 Oct 2022 11:53:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99603C433D6; Mon, 24 Oct 2022 11:53:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612426; bh=5h1EeL079EdoKFS54SY8rSsM7zSpLtptACX919JUZms=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DZq0n4Uux0yo2QOlJt0Sa57WFQIPU7BG1rv2H+0vbhd4Jj9fP72Lspo+OfnpjXfxl wj3e42pRvhJGBHCgLG2/Z99PAQkyk4Jhy5W0P6x4OVo4dxZidsbermtmlBt8aGwKJo ojUcWjiELwzrY0d9eKze6nGBBy8aHkqziTchUqpg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Stein , Shawn Guo , Sasha Levin Subject: [PATCH 4.14 193/210] ARM: dts: imx6sl: add missing properties for sram Date: Mon, 24 Oct 2022 13:31:50 +0200 Message-Id: <20221024113003.219532718@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571594802694604?= X-GMAIL-MSGID: =?utf-8?q?1747571594802694604?= From: Alexander Stein [ Upstream commit 60c9213a1d9941a8b33db570796c3f9be8984974 ] All 3 properties are required by sram.yaml. Fixes the dtbs_check warning: sram@900000: '#address-cells' is a required property sram@900000: '#size-cells' is a required property sram@900000: 'ranges' is a required property Signed-off-by: Alexander Stein Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin --- arch/arm/boot/dts/imx6sl.dtsi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi index bd9308b222ba..c8613ccd0944 100644 --- a/arch/arm/boot/dts/imx6sl.dtsi +++ b/arch/arm/boot/dts/imx6sl.dtsi @@ -112,6 +112,9 @@ ocram: sram@00900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6SL_CLK_OCRAM>; }; From patchwork Mon Oct 24 11:31:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10118 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp633128wru; Mon, 24 Oct 2022 13:13:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5SfPsUR7pZUR4suh6AiUls6kQEJxjFQx1eEwQx53dDZMOSMBz78HAXemDoR/q4dmOnI9cH X-Received: by 2002:a17:903:248b:b0:17d:ea45:d76a with SMTP id p11-20020a170903248b00b0017dea45d76amr35677929plw.97.1666642410373; Mon, 24 Oct 2022 13:13:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666642410; cv=none; d=google.com; s=arc-20160816; b=qKkNTs3Z2FzTY8NpWO1yMVpAA6N5fK+Ryd4ypNTJeBIqgYEdF9tQ/36EzrhMDzZoXy da+Fqu6Kdf6SHd+Jb9G072td7vRZMpI/4ePgivU+9hCyCtxXA1yr5zAhCpd0ev3xUN6I X6yu0tHwNzpRuMze23pW/juz9wQ/BcJST9dc95B4JO11534GCYQn/ZI6UlDAhr4Qo0dy JNLjj4qoWt3Xq8SzyvhvRVsGTP/9zTyXh9Qucj/q2evaXUNXr00vCm+33kd9ewr9p/EC DihWdoxden9uNWoPFcfQzOycuVteLhkzOnxdaPCo/4nwOIY1refk0ncH8UpTMXuXySup HjFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LoNAajzBouhrx8mugl4GD3zh6H+ddWyd82dZH0erOxM=; b=Z8eicNA8Gnm4hWC28KFRRxiEbUr7OV16DXI09PhfAGtLNT2HHihD/SWaQ+lowXA0So kHuiJ0LcykPGQsrt+axPnAiJdDa2TDn70NC5nbpps5t5HTjEvBSu5Z0lQUxlgRD5XliC o0Lqnzn5olEdD+xYOHGrnNl6yg8TE1ZNsIqdwQe5qzTXuUZ4mDLRYEJJ2CAJFQeQ04U2 77CgI/ajj1zz0vD1nrifBi9OE82LSRWa9+x5TqUIKPOCEvRbPyjwM3EVUrqR9Cazpvg6 vw0FgpKA0KPIQVWTyUwmbQaluFoFqRfatl93GFdg4Ma8dGNxJXfkMhHhIz639mDdzvUE MDqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Vp02FKmf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o11-20020a17090a5b0b00b0020d67a4e6fasi674445pji.174.2022.10.24.13.13.17; Mon, 24 Oct 2022 13:13:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Vp02FKmf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232105AbiJXUA4 (ORCPT + 99 others); Mon, 24 Oct 2022 16:00:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233928AbiJXT6n (ORCPT ); Mon, 24 Oct 2022 15:58:43 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F021D27FA85; Mon, 24 Oct 2022 11:21:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 46E54CE1356; Mon, 24 Oct 2022 11:53:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 376F6C433C1; Mon, 24 Oct 2022 11:53:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612428; bh=ADoOtZnSU9oV8MbDNTbTO5d6Bon2s5hfP1Wx3LGYy6Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vp02FKmf3nnf19f1VBQ79+3TefETtfAE6tZgkStPv/+Z9Xlk7MGPgUUe7SEZEiEsz 0H4LLzcjVowhxroEs4ciI7VejvvqBgtTSQ63WlWgGWvJYy+jwPgM15iWYCkIsvJ3Q7 +nLqSLXaVsf7eZFROxvbzyTAgGlRpIT+ZsmkGIz0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.14 194/210] media: cx88: Fix a null-ptr-deref bug in buffer_prepare() Date: Mon, 24 Oct 2022 13:31:51 +0200 Message-Id: <20221024113003.260505181@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747601231736473924?= X-GMAIL-MSGID: =?utf-8?q?1747601231736473924?= From: Zheyu Ma [ Upstream commit 2b064d91440b33fba5b452f2d1b31f13ae911d71 ] When the driver calls cx88_risc_buffer() to prepare the buffer, the function call may fail, resulting in a empty buffer and null-ptr-deref later in buffer_queue(). The following log can reveal it: [ 41.822762] general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN PTI [ 41.824488] KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] [ 41.828027] RIP: 0010:buffer_queue+0xc2/0x500 [ 41.836311] Call Trace: [ 41.836945] __enqueue_in_driver+0x141/0x360 [ 41.837262] vb2_start_streaming+0x62/0x4a0 [ 41.838216] vb2_core_streamon+0x1da/0x2c0 [ 41.838516] __vb2_init_fileio+0x981/0xbc0 [ 41.839141] __vb2_perform_fileio+0xbf9/0x1120 [ 41.840072] vb2_fop_read+0x20e/0x400 [ 41.840346] v4l2_read+0x215/0x290 [ 41.840603] vfs_read+0x162/0x4c0 Fix this by checking the return value of cx88_risc_buffer() [hverkuil: fix coding style issues] Signed-off-by: Zheyu Ma Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/pci/cx88/cx88-vbi.c | 9 +++--- drivers/media/pci/cx88/cx88-video.c | 43 +++++++++++++++-------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/drivers/media/pci/cx88/cx88-vbi.c b/drivers/media/pci/cx88/cx88-vbi.c index c637679b01b2..2649f87c070f 100644 --- a/drivers/media/pci/cx88/cx88-vbi.c +++ b/drivers/media/pci/cx88/cx88-vbi.c @@ -144,11 +144,10 @@ static int buffer_prepare(struct vb2_buffer *vb) return -EINVAL; vb2_set_plane_payload(vb, 0, size); - cx88_risc_buffer(dev->pci, &buf->risc, sgt->sgl, - 0, VBI_LINE_LENGTH * lines, - VBI_LINE_LENGTH, 0, - lines); - return 0; + return cx88_risc_buffer(dev->pci, &buf->risc, sgt->sgl, + 0, VBI_LINE_LENGTH * lines, + VBI_LINE_LENGTH, 0, + lines); } static void buffer_finish(struct vb2_buffer *vb) diff --git a/drivers/media/pci/cx88/cx88-video.c b/drivers/media/pci/cx88/cx88-video.c index 1748812bd7e5..79c293c86f14 100644 --- a/drivers/media/pci/cx88/cx88-video.c +++ b/drivers/media/pci/cx88/cx88-video.c @@ -452,6 +452,7 @@ static int queue_setup(struct vb2_queue *q, static int buffer_prepare(struct vb2_buffer *vb) { + int ret; struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); struct cx8800_dev *dev = vb->vb2_queue->drv_priv; struct cx88_core *core = dev->core; @@ -466,35 +467,35 @@ static int buffer_prepare(struct vb2_buffer *vb) switch (core->field) { case V4L2_FIELD_TOP: - cx88_risc_buffer(dev->pci, &buf->risc, - sgt->sgl, 0, UNSET, - buf->bpl, 0, core->height); + ret = cx88_risc_buffer(dev->pci, &buf->risc, + sgt->sgl, 0, UNSET, + buf->bpl, 0, core->height); break; case V4L2_FIELD_BOTTOM: - cx88_risc_buffer(dev->pci, &buf->risc, - sgt->sgl, UNSET, 0, - buf->bpl, 0, core->height); + ret = cx88_risc_buffer(dev->pci, &buf->risc, + sgt->sgl, UNSET, 0, + buf->bpl, 0, core->height); break; case V4L2_FIELD_SEQ_TB: - cx88_risc_buffer(dev->pci, &buf->risc, - sgt->sgl, - 0, buf->bpl * (core->height >> 1), - buf->bpl, 0, - core->height >> 1); + ret = cx88_risc_buffer(dev->pci, &buf->risc, + sgt->sgl, + 0, buf->bpl * (core->height >> 1), + buf->bpl, 0, + core->height >> 1); break; case V4L2_FIELD_SEQ_BT: - cx88_risc_buffer(dev->pci, &buf->risc, - sgt->sgl, - buf->bpl * (core->height >> 1), 0, - buf->bpl, 0, - core->height >> 1); + ret = cx88_risc_buffer(dev->pci, &buf->risc, + sgt->sgl, + buf->bpl * (core->height >> 1), 0, + buf->bpl, 0, + core->height >> 1); break; case V4L2_FIELD_INTERLACED: default: - cx88_risc_buffer(dev->pci, &buf->risc, - sgt->sgl, 0, buf->bpl, - buf->bpl, buf->bpl, - core->height >> 1); + ret = cx88_risc_buffer(dev->pci, &buf->risc, + sgt->sgl, 0, buf->bpl, + buf->bpl, buf->bpl, + core->height >> 1); break; } dprintk(2, @@ -502,7 +503,7 @@ static int buffer_prepare(struct vb2_buffer *vb) buf, buf->vb.vb2_buf.index, core->width, core->height, dev->fmt->depth, dev->fmt->name, (unsigned long)buf->risc.dma); - return 0; + return ret; } static void buffer_finish(struct vb2_buffer *vb) From patchwork Mon Oct 24 11:31:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8693 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422593wru; Mon, 24 Oct 2022 05:23:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5hfWRgg7Z2IkgpeQbP8nNTqhtLtWQ7r8+EBc9Tdb5NI8iCgZE+GI1Onmf8WMEu1T0zb1Tt X-Received: by 2002:a17:907:7f20:b0:7aa:acf9:c07f with SMTP id qf32-20020a1709077f2000b007aaacf9c07fmr1109771ejc.559.1666614181409; Mon, 24 Oct 2022 05:23:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614181; cv=none; d=google.com; s=arc-20160816; b=tKzzhEguEK2aDZ21Gt8i3edxefbCqwm5r5l4UfhkTp5OvyYriD1uNeWPYPBCJABmAs E2CaGvmfyd6kvOHPEJfHiO2Dq82jztZQjLrCQyPbgHmcBoF+2y+Zpri0fUuRhU3hLrGQ DVImjYnkaEubpSBFojwOt1VwAo7DsBAZDcZgNYHMEQWHehZo9B1/fPE0RgmZ7EQWwQ4C l+lYYVjbACO5DnKkZoYfN4qU36Bgcu5pVq3q0YxydH8nL9fdt+jxARs8DM1xkxiqCJOD 9kRFaT2ew9VtaIO/OtNP+YgCyVX/5XKfwAAb98O8AaqcWzBQh+yTu7YFN8ueCe2itMba yr9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qPgN/ywL1XVYy/UZQdW22KrhIU+9wHF+/rcXcbZ/DrM=; b=B0r9+JIti9Wdz/Nt44R1e3P90btM5wYmA8SVTEBzr2RTrYOlU/vqMOJY3r0/YOaB0F sBf1Vx9GpkChtR4VUdP60SPJHgouUWwDo2sXLIsZ1P4ikLsoJxwk40SWGx8nhHINYvKF aKi9OD72SdmRH10E4MoG/WpPQxqB9ODw5iYdrpueIwDxHuX98MIInnUf7FqC3Mqxyle2 G/2e00Vn+Ugl4ZLYo+0tA1Yu7Xpw26cnA5I1polBjLINns64q06tW35ysURBg3EdJQAa ool7GmhPfDnVLd7MUDQL9LsR+MkmDJMHYkQ48wXoFysccdRtm0uxC4wU4DyMQuSEEKr+ T33Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1iereAO7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g17-20020a1709065d1100b007316ac034acsi26541636ejt.834.2022.10.24.05.22.35; Mon, 24 Oct 2022 05:23:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1iereAO7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233312AbiJXMUl (ORCPT + 99 others); Mon, 24 Oct 2022 08:20:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233352AbiJXMTP (ORCPT ); Mon, 24 Oct 2022 08:19:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A18527A536; Mon, 24 Oct 2022 04:57:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 77B97B81190; Mon, 24 Oct 2022 11:53:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9F06C433C1; Mon, 24 Oct 2022 11:53:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612431; bh=mzSEyvgQIhPHYGO2yz/6LzccyeE1JxvsydJsOQeo0QQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1iereAO71IypWMzpGyLie6BmkY59pbKlYDVY4mJ7zyO2SL/UnrnaFy0JMa2+kLMAw CR8ahxYb794BG25ufSmisz3SMT/rkAQphH0x/JQ/XLNlvwZUuauDrwD6+xEvk2Ynfp Oa2o7RSQFlQRD/f7uUqxI8Ue6LDpELhNQvNmy2R8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , Letu Ren , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.14 195/210] scsi: 3w-9xxx: Avoid disabling device if failing to enable it Date: Mon, 24 Oct 2022 13:31:52 +0200 Message-Id: <20221024113003.291076821@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571631864795146?= X-GMAIL-MSGID: =?utf-8?q?1747571631864795146?= From: Letu Ren [ Upstream commit 7eff437b5ee1309b34667844361c6bbb5c97df05 ] The original code will "goto out_disable_device" and call pci_disable_device() if pci_enable_device() fails. The kernel will generate a warning message like "3w-9xxx 0000:00:05.0: disabling already-disabled device". We shouldn't disable a device that failed to be enabled. A simple return is fine. Link: https://lore.kernel.org/r/20220829110115.38789-1-fantasquex@gmail.com Reported-by: Zheyu Ma Signed-off-by: Letu Ren Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/3w-9xxx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c index dd342207095a..0baeed1793aa 100644 --- a/drivers/scsi/3w-9xxx.c +++ b/drivers/scsi/3w-9xxx.c @@ -2013,7 +2013,7 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id) retval = pci_enable_device(pdev); if (retval) { TW_PRINTK(host, TW_DRIVER, 0x34, "Failed to enable pci device"); - goto out_disable_device; + return -ENODEV; } pci_set_master(pdev); From patchwork Mon Oct 24 11:31:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9996 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp615926wru; Mon, 24 Oct 2022 12:27:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5HzMxxBVvJM1wpbwSwxFsZ5jylTFt9gjxHqQ1gDBzHF6qEq/TlmdZNQ6WdxUt2td+SYK1j X-Received: by 2002:a05:6402:3487:b0:45d:2674:d187 with SMTP id v7-20020a056402348700b0045d2674d187mr32064414edc.386.1666639653025; Mon, 24 Oct 2022 12:27:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666639653; cv=none; d=google.com; s=arc-20160816; b=IGp6kFa581MDCZb8C1m11K62cTh700xEaKRzXGxSFgCNVFeoJ/DIGkzvfXbpXGxsH9 7lKywCfE99hzRm0NKRPreBHsIG+hJ7sQQwEdnavNryUWj64zMx2UTXxh/v4EJnFy3YLD SBLQ4TuWa52HCyhQIclb9bo/RcIuUY2qjX2xmcl4tbRWE286gXkrvFW1+9XEiglHjAVg KQt9UXhSjyykXZLsNvQ8u08CFxljrg/CV0mgUt6RWMdcMLbNC3vMoxjJwMMSndFT/k/k 07yj9k780lvtJJG6RkojVpimg0pgMGlRgIzr7Pfn/331YOL0dw+7HHnhxlik6HQtygqV Y1WA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MZxfd6bfEaEw4wRBYRNv67TvJ/hoZwAF1MgcHbDVi4M=; b=Vpu/MF86QO9kFG9yotsl495zuGldF9R5OtOsFY1mV5z5as04Wf/hljA/or4ko50pT3 LNseynC48gymVgtiDGo68BiMxy1qwgA/1Vm03YPaCZHDQL3ZLqVTTFoD9u5gdXCtZhqL NGc1IoM0KwlKJUkY7ktvEN7G9lFy+zFC3949pBzVV2WAPfOAonyBJyroTtXiuwQO4n2u KqJ/AQvhV1MDU1Zg10F2/4Ac7vcJLV7IN1aLyrxvs/xqG0l+CjTSPgQFtbD1RQJNB7aJ VcggpEJ2sl7ntCq+Gp/nEncGasVYU8KW6fkGUkFCkE7lHYFAzhFVlUDxoxJUJMdXD9Th uNHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D7OibFfo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u11-20020a170906950b00b00791bcf8aa61si402742ejx.505.2022.10.24.12.27.09; Mon, 24 Oct 2022 12:27:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D7OibFfo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233146AbiJXTX7 (ORCPT + 99 others); Mon, 24 Oct 2022 15:23:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231225AbiJXTWf (ORCPT ); Mon, 24 Oct 2022 15:22:35 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 105563DBE5; Mon, 24 Oct 2022 10:57:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 0C04BCE1369; Mon, 24 Oct 2022 11:53:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3710C433C1; Mon, 24 Oct 2022 11:53:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612436; bh=iQieQ4Y/Cp6gHS2C7Lg2w/a+l9Ieo+k4kqJju/g1xY4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D7OibFfoBNzu8/fN5abML/2hzCLHjivTdsFSvcXSjFdzqftgqmUTh/jPvFZxdVun/ YJdj71Bm6T7jsYrVZD+moin9frmYE6WfENwA8Q1qm/3Jurtxmnok+oxJfcN2zFcpjr dpixHWEtJWhcYrC7hoZ82Pw0Jy43Mlk1kWpI98bU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+38e6c55d4969a14c1534@syzkaller.appspotmail.com, Shigeru Yoshida , Josef Bacik , Jens Axboe , Sasha Levin Subject: [PATCH 4.14 196/210] nbd: Fix hung when signal interrupts nbd_start_device_ioctl() Date: Mon, 24 Oct 2022 13:31:53 +0200 Message-Id: <20221024113003.321506243@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747598340966519833?= X-GMAIL-MSGID: =?utf-8?q?1747598340966519833?= From: Shigeru Yoshida [ Upstream commit 1de7c3cf48fc41cd95adb12bd1ea9033a917798a ] syzbot reported hung task [1]. The following program is a simplified version of the reproducer: int main(void) { int sv[2], fd; if (socketpair(AF_UNIX, SOCK_STREAM, 0, sv) < 0) return 1; if ((fd = open("/dev/nbd0", 0)) < 0) return 1; if (ioctl(fd, NBD_SET_SIZE_BLOCKS, 0x81) < 0) return 1; if (ioctl(fd, NBD_SET_SOCK, sv[0]) < 0) return 1; if (ioctl(fd, NBD_DO_IT) < 0) return 1; return 0; } When signal interrupt nbd_start_device_ioctl() waiting the condition atomic_read(&config->recv_threads) == 0, the task can hung because it waits the completion of the inflight IOs. This patch fixes the issue by clearing queue, not just shutdown, when signal interrupt nbd_start_device_ioctl(). Link: https://syzkaller.appspot.com/bug?id=7d89a3ffacd2b83fdd39549bc4d8e0a89ef21239 [1] Reported-by: syzbot+38e6c55d4969a14c1534@syzkaller.appspotmail.com Signed-off-by: Shigeru Yoshida Reviewed-by: Josef Bacik Link: https://lore.kernel.org/r/20220907163502.577561-1-syoshida@redhat.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- drivers/block/nbd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 338d02a67afb..f01b8860ba14 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -1258,10 +1258,12 @@ static int nbd_start_device_ioctl(struct nbd_device *nbd, struct block_device *b mutex_unlock(&nbd->config_lock); ret = wait_event_interruptible(config->recv_wq, atomic_read(&config->recv_threads) == 0); - if (ret) + if (ret) { sock_shutdown(nbd); - flush_workqueue(nbd->recv_workq); + nbd_clear_que(nbd); + } + flush_workqueue(nbd->recv_workq); mutex_lock(&nbd->config_lock); bd_set_size(bdev, 0); /* user requested, ignore socket errors */ From patchwork Mon Oct 24 11:31:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8643 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421378wru; Mon, 24 Oct 2022 05:20:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4/Y9byIHJEV0EzKeXoQDa84pX5sHcGOrDnEHzbulIIiOagtjXjriPWYGOxhz280JWEsSlS X-Received: by 2002:a17:906:db07:b0:77b:82cf:54af with SMTP id xj7-20020a170906db0700b0077b82cf54afmr28303336ejb.666.1666614023415; Mon, 24 Oct 2022 05:20:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614023; cv=none; d=google.com; s=arc-20160816; b=jhFlHuoylaNk/YvtF4bemB2TwhNVmZwXQG7Vw+KFlzOJ0m4ToJdRoe3QrXG2D5No17 hXckeP/yG4DIVGFqGdScyb5uIWnTbYwadULNJVND3re7igux5aUnP35ywtlaurLjmdC3 jOOJgjodL+CQlxpzy8L9ncHf+uW/+LP263J17Y+KpNjj6qc0y0C2DCvEE2caBySibwc3 AxLll7hxlcs4JfppOOPrmuCo/R9H+GJZFDMeaSrp70u0bfpWWFiX7sIikRyStmyo0hPN /0NMW9MXpNK3m1vS3vP3Bd2LLAvRm7qNZ5al7DEZrQzl8RH0Nk/BWjfNX2sEeDN/haHf jg7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=98fX3ZsA4+T6gi9pCT+46LTotrUQk61Qsy5SACb/4Jw=; b=RSgFoYvUUieCan2qAxO6Qb4SvbGJz9+1IPJlnPOLv7hFPeyLzfEhJOWFZBa6pCrC+I XbkVmyaPXyrUF/5GP2aXhURvlaxvtW8N3MZ881JG7BLV/MNmVVEKkoNRPom32GW3G/Tq KU2WS5OqJ6XqQEMYFvL9w7LrgLgwZsktrwakkTZ3ynHXUfdSQSoQdV8Wi/tsQ33cox4s 1k6TMem/UZma1kJMXL0DNjdzEXz+enkKyEN3hFvR0lIQd2CuH612Fcy7ESIMnkQ8iM71 GGPaAGekLfAQchM3Iu9gJ3r3/ukunwoWalxeqkGBzm69tPlC4+93T8DV26sMNiypSQng t1rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BQMTuspP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n10-20020a05640204ca00b00458d5d907c6si24450098edw.514.2022.10.24.05.19.59; Mon, 24 Oct 2022 05:20:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BQMTuspP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232817AbiJXMN7 (ORCPT + 99 others); Mon, 24 Oct 2022 08:13:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232902AbiJXMN3 (ORCPT ); Mon, 24 Oct 2022 08:13:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFF7965AD; Mon, 24 Oct 2022 04:54:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7EEB9612CF; Mon, 24 Oct 2022 11:53:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E7A7C433C1; Mon, 24 Oct 2022 11:53:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612438; bh=5vo+lpmzn9h9XqDZuLMZXU0bnuqztvOAsH4ajNnGm0k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BQMTuspPIuG+nZsgLknS5z5DWgRjZBYeYahLDKIgPT6jMWv9c9ArxxOVCF5tymOJh qE2KM+hQiUuTCqJxgvxqL/xatEZsBO6IBeuQW1/FTR7IdUJZ8Rz2YV12dO7jZvhUU8 6vgJdhd7BDh0wJSuNbObc3oqWZFUwIYOK10pqaD0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hyunwoo Kim , Jiri Kosina , Sasha Levin Subject: [PATCH 4.14 197/210] HID: roccat: Fix use-after-free in roccat_read() Date: Mon, 24 Oct 2022 13:31:54 +0200 Message-Id: <20221024113003.360421241@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571466337089713?= X-GMAIL-MSGID: =?utf-8?q?1747571466337089713?= From: Hyunwoo Kim [ Upstream commit cacdb14b1c8d3804a3a7d31773bc7569837b71a4 ] roccat_report_event() is responsible for registering roccat-related reports in struct roccat_device. int roccat_report_event(int minor, u8 const *data) { struct roccat_device *device; struct roccat_reader *reader; struct roccat_report *report; uint8_t *new_value; device = devices[minor]; new_value = kmemdup(data, device->report_size, GFP_ATOMIC); if (!new_value) return -ENOMEM; report = &device->cbuf[device->cbuf_end]; /* passing NULL is safe */ kfree(report->value); ... The registered report is stored in the struct roccat_device member "struct roccat_report cbuf[ROCCAT_CBUF_SIZE];". If more reports are received than the "ROCCAT_CBUF_SIZE" value, kfree() the saved report from cbuf[0] and allocates a new reprot. Since there is no lock when this kfree() is performed, kfree() can be performed even while reading the saved report. static ssize_t roccat_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct roccat_reader *reader = file->private_data; struct roccat_device *device = reader->device; struct roccat_report *report; ssize_t retval = 0, len; DECLARE_WAITQUEUE(wait, current); mutex_lock(&device->cbuf_lock); ... report = &device->cbuf[reader->cbuf_start]; /* * If report is larger than requested amount of data, rest of report * is lost! */ len = device->report_size > count ? count : device->report_size; if (copy_to_user(buffer, report->value, len)) { retval = -EFAULT; goto exit_unlock; } ... The roccat_read() function receives the device->cbuf report and delivers it to the user through copy_to_user(). If the N+ROCCAT_CBUF_SIZE th report is received while copying of the Nth report->value is in progress, the pointer that copy_to_user() is working on is kfree()ed and UAF read may occur. (race condition) Since the device node of this driver does not set separate permissions, this is not a security vulnerability, but because it is used for requesting screen display of profile or dpi settings, a user using the roccat device can apply udev to this device node or There is a possibility to use it by giving. Signed-off-by: Hyunwoo Kim Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- drivers/hid/hid-roccat.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/hid/hid-roccat.c b/drivers/hid/hid-roccat.c index fb77dec720a4..edfaf2cd0f26 100644 --- a/drivers/hid/hid-roccat.c +++ b/drivers/hid/hid-roccat.c @@ -260,6 +260,8 @@ int roccat_report_event(int minor, u8 const *data) if (!new_value) return -ENOMEM; + mutex_lock(&device->cbuf_lock); + report = &device->cbuf[device->cbuf_end]; /* passing NULL is safe */ @@ -279,6 +281,8 @@ int roccat_report_event(int minor, u8 const *data) reader->cbuf_start = (reader->cbuf_start + 1) % ROCCAT_CBUF_SIZE; } + mutex_unlock(&device->cbuf_lock); + wake_up_interruptible(&device->wait); return 0; } From patchwork Mon Oct 24 11:31:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9975 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp614920wru; Mon, 24 Oct 2022 12:25:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7d19XRx0lee1kWw6NOT54lSlpGzBvMnaoMYJq5GQrJMKXi/zQf4ENsMNa8H2ErhQprGir9 X-Received: by 2002:a17:906:770d:b0:73c:a08f:593c with SMTP id q13-20020a170906770d00b0073ca08f593cmr29906218ejm.182.1666639509914; Mon, 24 Oct 2022 12:25:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666639509; cv=none; d=google.com; s=arc-20160816; b=w9TYwFOI8vwOO719GcJ9pQr3IPCzKZic160tzc8wlC1oV9WQSG3Y6nq0P2Hf6SVAvN vlWnwydovvA0NFJx7L8WS5hrWwoDDlt7QZLOHXIYGOt7SR/SZ68AliX6+kAOwZ49HF5z i21eYZwVoBur0pBB1b7E1QvWwtVmHlGpZitF0vYa2qtjXw6F7faDNFP5cKgL1gLjgQN+ dB0LQ0r4Fgf8sJnT/Dpx/cPsaecCZP2/keGET1slgWyOhG5QSipq0bv3WiEBA9E0E+Tt H16aXsjNGb3CcNPmgyj7uA/2Yj1W4f2Fy/zbSRhMC7l3qWRieH2keAQfWkKgIMHU2Ujt UoFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9mqe2ykGF7C0qCqmbBNtMqzzidaaKpRYxBbTYRiZiBE=; b=A9Vi3UqgHse31vI9vu8FyJEG9s712FLDAs5mB5Dbvo5jM9OYRnKlZ9O831+i+1N1y4 vw3jOFjaSIHoTGQ69n7h6s4Y99CBchWrKHMMkhgyoXaqi5+8c1gJe6kOReUVHyIfdEaJ wZZr5jkYnV8PrUzqdsCkRsCzZ8s4YBOnKLtFZl+jqUtb2jcZVwT1jDJehEoQ1eg9y8iC ktOuNTAKIC9DNj6laapWE1sxOubeADdniAhl15hZzz2PKjuIV5s/06xDbxbJiriPLqtc kcQaC9kbaXiNNbmmXFgEUCoTKFDuiwZuQnhQnuFfFftqAZy2C84BmkVcFl7HIdlsJFfV ZZ6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=k9JpPzCE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t15-20020a056402524f00b0046197a8b7a1si643314edd.485.2022.10.24.12.24.42; Mon, 24 Oct 2022 12:25:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=k9JpPzCE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232130AbiJXTUE (ORCPT + 99 others); Mon, 24 Oct 2022 15:20:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233512AbiJXTTb (ORCPT ); Mon, 24 Oct 2022 15:19:31 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A859814F5; Mon, 24 Oct 2022 10:56:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 2FC48CE136E; Mon, 24 Oct 2022 11:54:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CF07C433D7; Mon, 24 Oct 2022 11:54:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612491; bh=XeXgFmBb2J/4H2fAnQcF2pRLaqG6XK2GwrF5T7orXxI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k9JpPzCE01Ev+BZPPOSNaxm+si1a14BbiRJaI1+ADVEZ2USDPFl/xOFs8qiNXMJiz nF1JNIabWuIpIogPh3Ux1KyOeOm6Sqbm8wxQDK+K9QcEtXceFz6YJwKjTn892tvQN8 sZKv4aQ23jztzxUDUINWwfmZh4SbBlROHBd5um2I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Logan Gunthorpe , Song Liu , Sasha Levin Subject: [PATCH 4.14 198/210] md/raid5: Wait for MD_SB_CHANGE_PENDING in raid5d Date: Mon, 24 Oct 2022 13:31:55 +0200 Message-Id: <20221024113003.395495277@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747598190328112354?= X-GMAIL-MSGID: =?utf-8?q?1747598190328112354?= From: Logan Gunthorpe [ Upstream commit 5e2cf333b7bd5d3e62595a44d598a254c697cd74 ] A complicated deadlock exists when using the journal and an elevated group_thrtead_cnt. It was found with loop devices, but its not clear whether it can be seen with real disks. The deadlock can occur simply by writing data with an fio script. When the deadlock occurs, multiple threads will hang in different ways: 1) The group threads will hang in the blk-wbt code with bios waiting to be submitted to the block layer: io_schedule+0x70/0xb0 rq_qos_wait+0x153/0x210 wbt_wait+0x115/0x1b0 io_schedule+0x70/0xb0 rq_qos_wait+0x153/0x210 wbt_wait+0x115/0x1b0 __rq_qos_throttle+0x38/0x60 blk_mq_submit_bio+0x589/0xcd0 wbt_wait+0x115/0x1b0 __rq_qos_throttle+0x38/0x60 blk_mq_submit_bio+0x589/0xcd0 __submit_bio+0xe6/0x100 submit_bio_noacct_nocheck+0x42e/0x470 submit_bio_noacct+0x4c2/0xbb0 ops_run_io+0x46b/0x1a30 handle_stripe+0xcd3/0x36b0 handle_active_stripes.constprop.0+0x6f6/0xa60 raid5_do_work+0x177/0x330 Or: io_schedule+0x70/0xb0 rq_qos_wait+0x153/0x210 wbt_wait+0x115/0x1b0 __rq_qos_throttle+0x38/0x60 blk_mq_submit_bio+0x589/0xcd0 __submit_bio+0xe6/0x100 submit_bio_noacct_nocheck+0x42e/0x470 submit_bio_noacct+0x4c2/0xbb0 flush_deferred_bios+0x136/0x170 raid5_do_work+0x262/0x330 2) The r5l_reclaim thread will hang in the same way, submitting a bio to the block layer: io_schedule+0x70/0xb0 rq_qos_wait+0x153/0x210 wbt_wait+0x115/0x1b0 __rq_qos_throttle+0x38/0x60 blk_mq_submit_bio+0x589/0xcd0 __submit_bio+0xe6/0x100 submit_bio_noacct_nocheck+0x42e/0x470 submit_bio_noacct+0x4c2/0xbb0 submit_bio+0x3f/0xf0 md_super_write+0x12f/0x1b0 md_update_sb.part.0+0x7c6/0xff0 md_update_sb+0x30/0x60 r5l_do_reclaim+0x4f9/0x5e0 r5l_reclaim_thread+0x69/0x30b However, before hanging, the MD_SB_CHANGE_PENDING flag will be set for sb_flags in r5l_write_super_and_discard_space(). This flag will never be cleared because the submit_bio() call never returns. 3) Due to the MD_SB_CHANGE_PENDING flag being set, handle_stripe() will do no processing on any pending stripes and re-set STRIPE_HANDLE. This will cause the raid5d thread to enter an infinite loop, constantly trying to handle the same stripes stuck in the queue. The raid5d thread has a blk_plug that holds a number of bios that are also stuck waiting seeing the thread is in a loop that never schedules. These bios have been accounted for by blk-wbt thus preventing the other threads above from continuing when they try to submit bios. --Deadlock. To fix this, add the same wait_event() that is used in raid5_do_work() to raid5d() such that if MD_SB_CHANGE_PENDING is set, the thread will schedule and wait until the flag is cleared. The schedule action will flush the plug which will allow the r5l_reclaim thread to continue, thus preventing the deadlock. However, md_check_recovery() calls can also clear MD_SB_CHANGE_PENDING from the same thread and can thus deadlock if the thread is put to sleep. So avoid waiting if md_check_recovery() is being called in the loop. It's not clear when the deadlock was introduced, but the similar wait_event() call in raid5_do_work() was added in 2017 by this commit: 16d997b78b15 ("md/raid5: simplfy delaying of writes while metadata is updated.") Link: https://lore.kernel.org/r/7f3b87b6-b52a-f737-51d7-a4eec5c44112@deltatee.com Signed-off-by: Logan Gunthorpe Signed-off-by: Song Liu Signed-off-by: Sasha Levin --- drivers/md/raid5.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 78b48dca3fda..dc053a43a3dc 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -44,6 +44,7 @@ */ #include +#include #include #include #include @@ -6308,7 +6309,18 @@ static void raid5d(struct md_thread *thread) spin_unlock_irq(&conf->device_lock); md_check_recovery(mddev); spin_lock_irq(&conf->device_lock); + + /* + * Waiting on MD_SB_CHANGE_PENDING below may deadlock + * seeing md_check_recovery() is needed to clear + * the flag when using mdmon. + */ + continue; } + + wait_event_lock_irq(mddev->sb_wait, + !test_bit(MD_SB_CHANGE_PENDING, &mddev->sb_flags), + conf->device_lock); } pr_debug("%d stripes handled\n", handled); From patchwork Mon Oct 24 11:31:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8837 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431540wru; Mon, 24 Oct 2022 05:44:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM67QrRB97S5KmG4dzEQrTSbNcVJ7TKd7Jl/fLi+jSkwDmOciOA3sa7213vtyZ8vsiGXWsem X-Received: by 2002:a63:6b09:0:b0:453:88a9:1d18 with SMTP id g9-20020a636b09000000b0045388a91d18mr27754421pgc.41.1666615448543; Mon, 24 Oct 2022 05:44:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615448; cv=none; d=google.com; s=arc-20160816; b=yl00XNVPWaHpSYHIu7T4uQVI4r5l2vTM28jAA/bfKQ3v7PWIttrx7BcjKJcTHLHAiD x9SoOBrt6q0wbnA7Jn98w/yWElTxXOXSh6eL3NtobJT0QJXA2QUp3rot373YBPpz1MCa zxKIQ1cnzLAnMezNdsvmG0bN0SQFhGbZSdC89QWmRVN9Lf30gM7yyWzFQTqOb80LaSFz 77AkQeb3Z2pMPh7zp/fi2q2P6psR49KkoPst+cNbxuW3t0XnMh/NJXt0XXtZFnPR+P53 uXW3bOiIwIl/OBDQ3JQSI70J9+Yg7z63dP5EGnhy//5JcevQluUfn0xjf0DycrTFa459 Spcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+aXhYVLC9nqCPPfvcbC8UrYRKPKXOJHBeLJuLDwH8RQ=; b=qq84UStvGtMe19vyQ4PINqpFjNqM49RI1LN2CsnX21++uktRtbrRmLiNn1y3VdZNdS tm3P/6ho7y6lNbs4uRvmJJ7I/AO9bPWWZ8mBJPynEXj6EQrKXjzD49jsx1MVIkvzlZss RwGqtuzbCzUF2DXSulK00F0X/dWlPdSNrKy0Wo+unij1vbyMMguPFsXqlIQ4ycjU/Lzr OZBniiJiF0Y6TVTfO7SP+cR6Wf28/jhWLUy/YOYlsyuMpbSokYYB4SMyu4NI/bMCm7PW mDP864s3+80bRarEWgVy+AAElaVJud/Y9uxMa4OZvL1C3Mpof2RU1BDhIzCwDpC0Ih69 C4UA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QBCSsuzv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y7-20020a17090a784700b00212eb5485afsi6430274pjl.77.2022.10.24.05.43.55; Mon, 24 Oct 2022 05:44:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=QBCSsuzv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234066AbiJXMd2 (ORCPT + 99 others); Mon, 24 Oct 2022 08:33:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234086AbiJXM3S (ORCPT ); Mon, 24 Oct 2022 08:29:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E76B88A0B; Mon, 24 Oct 2022 05:03:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 988BA612CD; Mon, 24 Oct 2022 11:54:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A70A5C433D6; Mon, 24 Oct 2022 11:54:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612460; bh=rIg2dTzgThn+dS3MU0ennADYE3Yj0Vem1J2NhhjSi+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QBCSsuzvuNUn4dzI5mrCKWTlcYvruLi863D5KuC+riKBCH11Z5uiinbu9+cUI8Sxg Usj1u74iWy36eNVOedOlo3NKc68kUsY4fs1yFmL0D4vD7uDzB9sDfImiT+i/D1K0XY ppCzLFLZCWa8HfBuRcObX5MhV5tL/gWwSWQQqkTg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jianglei Nie , Mathias Nyman , Sasha Levin Subject: [PATCH 4.14 199/210] usb: host: xhci: Fix potential memory leak in xhci_alloc_stream_info() Date: Mon, 24 Oct 2022 13:31:56 +0200 Message-Id: <20221024113003.434828631@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572960353214333?= X-GMAIL-MSGID: =?utf-8?q?1747572960353214333?= From: Jianglei Nie [ Upstream commit 7e271f42a5cc3768cd2622b929ba66859ae21f97 ] xhci_alloc_stream_info() allocates stream context array for stream_info ->stream_ctx_array with xhci_alloc_stream_ctx(). When some error occurs, stream_info->stream_ctx_array is not released, which will lead to a memory leak. We can fix it by releasing the stream_info->stream_ctx_array with xhci_free_stream_ctx() on the error path to avoid the potential memory leak. Signed-off-by: Jianglei Nie Signed-off-by: Mathias Nyman Link: https://lore.kernel.org/r/20220921123450.671459-2-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/host/xhci-mem.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index e930e2777c87..ae724460c8f2 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -657,7 +657,7 @@ struct xhci_stream_info *xhci_alloc_stream_info(struct xhci_hcd *xhci, num_stream_ctxs, &stream_info->ctx_array_dma, mem_flags); if (!stream_info->stream_ctx_array) - goto cleanup_ctx; + goto cleanup_ring_array; memset(stream_info->stream_ctx_array, 0, sizeof(struct xhci_stream_ctx)*num_stream_ctxs); @@ -718,6 +718,11 @@ struct xhci_stream_info *xhci_alloc_stream_info(struct xhci_hcd *xhci, } xhci_free_command(xhci, stream_info->free_streams_command); cleanup_ctx: + xhci_free_stream_ctx(xhci, + stream_info->num_stream_ctxs, + stream_info->stream_ctx_array, + stream_info->ctx_array_dma); +cleanup_ring_array: kfree(stream_info->stream_rings); cleanup_info: kfree(stream_info); From patchwork Mon Oct 24 11:31:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10067 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp624435wru; Mon, 24 Oct 2022 12:51:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6t5Xebqp+lovPCWuD/JeSb5yI/I9Tha2L2L6UayUcn/T2aWtiWE53dOYO44GWZ12pC+Ljz X-Received: by 2002:a63:d34c:0:b0:462:589b:b27e with SMTP id u12-20020a63d34c000000b00462589bb27emr30086275pgi.418.1666641073697; Mon, 24 Oct 2022 12:51:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666641073; cv=none; d=google.com; s=arc-20160816; b=totJY3vqDcGaApSupILyujp9E+/IuvyQKcvyneYTDiYXARHNnqOWjfJZ5p3zr0ZyPU DFPFcy7ijLoY9tnK9+Li63ngkJwxIooOzaz+qOE4dSPQCYDXIL9+lmDt2mW7zs5J/shO LVlbg6ClD6K12PwnKJ4TlhFyFICxMQWluBLHbrgClSRRGkLaOxyVVisJznm/8gwOtrUG K4OnqsFVJj+wGZn0pQRTYlUI88YnzxzC5w+ZrdsBdYlQ4JNMFJFNBNElFtqBbfu3rYYL FCey/trcnXp0fyi3UuMGAQSyJrVEZAbukPWmUOOig4ftjCVWaVDH8t9cV/oBjPE7ah5h TsTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fkHs7PTGNsKuWn8jddUa2j0js2ZLEdlS1d0IzAl8lRg=; b=eACLAPtI36kIVvrzHdzAX8992409F98ALCUkd8nBvM+xCXDi8fQdT62B0yqKPPr5go L9s7qZFQHEfoEIG28GnxPQxUrnWVRIikM+SEauF9ITUhrr4lSRTunz7dLIzVBUazfJwi f1tuU9IhHaZWRJU0Dp+VtKdcRV0nNRC/EHDKESoDD5mQvVqA+OqS1n3O4T3K9K0TbuMP LQ2Zavpcp3/ZxhSXbcBYdPL8eGjh+1Apc1KaQuWfkn9Rl1PORw2jOU+k/NtombEh+nDd GMwCUsGUxfgrakQoTe1/nwffA4caE1vEK2gxSzYcun7i3Xhv8HBN1D5jRxqVaBNw2rAz JZ/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=y9nM0RJU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e20-20020a63f554000000b0046b2ec0de65si347938pgk.789.2022.10.24.12.50.59; Mon, 24 Oct 2022 12:51:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=y9nM0RJU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233512AbiJXTqa (ORCPT + 99 others); Mon, 24 Oct 2022 15:46:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233591AbiJXToJ (ORCPT ); Mon, 24 Oct 2022 15:44:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62012196B63; Mon, 24 Oct 2022 11:12:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CEC6CB811CB; Mon, 24 Oct 2022 11:54:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 301B5C4314B; Mon, 24 Oct 2022 11:54:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612470; bh=f6PvnzB2NTuAawVlsGsqh/PREkZdKYRgw4IKCn33zoY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y9nM0RJULq/ER9Y7EVfF5ymqOtesz2jMHh9KSN1Xkve5fojNCELpqqLvp+RusxaFh 1lcRzUTQleLfIN6FIZG0d4aJJeVUhvdwM/ZyvWlzsOTycYMyuEHqJv/3RoTTZ6FZU2 sVIA1Hqfp/hdZM5u0Jgr10iyIWOD+uofeJXcFPF4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robin Guo , Sasha Levin Subject: [PATCH 4.14 200/210] usb: musb: Fix musb_gadget.c rxstate overflow bug Date: Mon, 24 Oct 2022 13:31:57 +0200 Message-Id: <20221024113003.474849741@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747599830570122332?= X-GMAIL-MSGID: =?utf-8?q?1747599830570122332?= From: Robin Guo [ Upstream commit eea4c860c3b366369eff0489d94ee4f0571d467d ] The usb function device call musb_gadget_queue() adds the passed request to musb_ep::req_list,If the (request->length > musb_ep->packet_sz) and (is_buffer_mapped(req) return false),the rxstate() will copy all data in fifo to request->buf which may cause request->buf out of bounds. Fix it by add the length check : fifocnt = min_t(unsigned, request->length - request->actual, fifocnt); Signed-off-by: Robin Guo Link: https://lore.kernel.org/r/20220906102119.1b071d07a8391ff115e6d1ef@inspur.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/musb/musb_gadget.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index 319c5a1b4a6a..8fd68f45a8df 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c @@ -785,6 +785,9 @@ static void rxstate(struct musb *musb, struct musb_request *req) musb_writew(epio, MUSB_RXCSR, csr); buffer_aint_mapped: + fifo_count = min_t(unsigned int, + request->length - request->actual, + (unsigned int)fifo_count); musb_read_fifo(musb_ep->hw_ep, fifo_count, (u8 *) (request->buf + request->actual)); request->actual += fifo_count; From patchwork Mon Oct 24 11:31:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8700 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422754wru; Mon, 24 Oct 2022 05:23:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6fGKyzkRvbC1rKE6mQ0PdQrkJ8q+RMKafxCAAEla6QIuYx+YdrXpL5mhJn6Qb+eDdrMUVY X-Received: by 2002:a17:906:cc5c:b0:7a0:a52:8c05 with SMTP id mm28-20020a170906cc5c00b007a00a528c05mr10573518ejb.686.1666614199052; Mon, 24 Oct 2022 05:23:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614199; cv=none; d=google.com; s=arc-20160816; b=dI8vI2LUJ+eeGBXH84uRVnH3NZlSXZ80JtwWSEPLVxmQemB47DxyYkb2JBqjPrNnN8 87A+eBHscHQjD5ozjn/DKxGyUqU3YhZbipbNciI/fP2IthXIcElS+FHp+2ZXsf/JxIVq 61pdkUuX9+DueogIJObecvaUuyvYm9X6YCaWsEQMXal3JYFpcjQrxW3UfyDMTwY9WxIm zp5SVi+0i69zaj7nIjGmQUpgLHmXlncjYilx54Mm5CVHBxmFLhhZEFWdJEXeyENxxcrA h45aruTodYsiQRXgPSyyvLpxqxxfQ8uFkNcej67tuL/LgEu/QK3UJkSUbeh9/ASNZTuc /gsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vhYg8W2CwIM8+T5wCkcq1x9zc7o2at96Px/rs+QjZjk=; b=HnveVx8n0vsI+vg0oDw9Ygf6MjJfmQd9wfjN8ivrVZVaTpnos35rAvSN7gr1t/tHVP 8pr8BySSVASy646fIUZ2EOOCmDQ7eGstvAbkwSzYv3ssHBh+HntZG9C7D3jbFJ0LIgPs /XMxghAxvud5JNEhQwNzgSFBecjbbx3DYoPmIWknKKRsRHzbYZXtEft0Xu4tcJiySBB0 Br8aMDolCNwoII89DzCJs/6XCtwD/jeOWaCuiyX2HUdCIoAYqfQcNqO1rqwLXqTJfgjm be/q5R2WMmOEn+u8pPdGUhksLWQCN/Go2NC/suJtMpsDN04hdu51HpFT1JVoBpYzYqmm 9PSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YbHUs+SL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y12-20020a056402270c00b0045d636ca148si26238895edd.575.2022.10.24.05.22.54; Mon, 24 Oct 2022 05:23:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YbHUs+SL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233459AbiJXMWC (ORCPT + 99 others); Mon, 24 Oct 2022 08:22:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233563AbiJXMTv (ORCPT ); Mon, 24 Oct 2022 08:19:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A20CD82D34; Mon, 24 Oct 2022 04:58:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 70DAEB811C2; Mon, 24 Oct 2022 11:54:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C74A0C433D6; Mon, 24 Oct 2022 11:54:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612473; bh=iEJsBoW3YU23uXGXgTyOnGGgbdob3FhR9ZJsI+4No/o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YbHUs+SLPQjbxrXeJsqvXcWIDWoywz+g6Ij/ftyvqNQrguYBsZ7grt+Fo77oWEvHQ OwjFBAmEX+CWK9hwFG+roXwga3jbhbDAQZqW5DIQ8rNaTkqqb4KbwKfLqECBBeASAp D6tNB7sikGW6+PQTvJWopRcLKH1pX3q3IXYypR0o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, sunghwan jung , Sasha Levin Subject: [PATCH 4.14 201/210] Revert "usb: storage: Add quirk for Samsung Fit flash" Date: Mon, 24 Oct 2022 13:31:58 +0200 Message-Id: <20221024113003.504733937@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571650226061656?= X-GMAIL-MSGID: =?utf-8?q?1747571650226061656?= From: sunghwan jung [ Upstream commit ad5dbfc123e6ffbbde194e2a4603323e09f741ee ] This reverts commit 86d92f5465958752481269348d474414dccb1552, which fix the timeout issue for "Samsung Fit Flash". But the commit affects not only "Samsung Fit Flash" but also other usb storages that use the same controller and causes severe performance regression. # hdparm -t /dev/sda (without the quirk) Timing buffered disk reads: 622 MB in 3.01 seconds = 206.66 MB/sec # hdparm -t /dev/sda (with the quirk) Timing buffered disk reads: 220 MB in 3.00 seconds = 73.32 MB/sec The commit author mentioned that "Issue was reproduced after device has bad block", so this quirk should be applied when we have the timeout issue with a device that has bad blocks. We revert the commit so that we apply this quirk by adding kernel paramters using a bootloader or other ways when we really need it, without the performance regression with devices that don't have the issue. Signed-off-by: sunghwan jung Link: https://lore.kernel.org/r/20220913114913.3073-1-onenowy@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/storage/unusual_devs.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 8c186ab5b5f7..8b38dd7d89b7 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h @@ -1294,12 +1294,6 @@ UNUSUAL_DEV( 0x090a, 0x1200, 0x0000, 0x9999, USB_SC_RBC, USB_PR_BULK, NULL, 0 ), -UNUSUAL_DEV(0x090c, 0x1000, 0x1100, 0x1100, - "Samsung", - "Flash Drive FIT", - USB_SC_DEVICE, USB_PR_DEVICE, NULL, - US_FL_MAX_SECTORS_64), - /* aeb */ UNUSUAL_DEV( 0x090c, 0x1132, 0x0000, 0xffff, "Feiya", From patchwork Mon Oct 24 11:31:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10061 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp623901wru; Mon, 24 Oct 2022 12:49:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM45DZbG7wdEHKqTDj2Ca2TcECz3+JImmcf+i6dxs5rDQC5CtGqzdw45j737cJAm/zYs4KCv X-Received: by 2002:a05:6402:2712:b0:45d:de37:f828 with SMTP id y18-20020a056402271200b0045dde37f828mr31107428edd.317.1666640966388; Mon, 24 Oct 2022 12:49:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640966; cv=none; d=google.com; s=arc-20160816; b=YuVVM8H6s/LAplp2+6RrsVDaZc/PWXi5Bm7qPtDjzUrh7+1reLvg1NJIC/NYliH+Ez EtCBLqluxwOWc05hgrty/0hwvbWjqEo/qVJaXVJ+UCfryxi69Eg5f6I0H6FV2mNbhyrc Sast22MKZWtOhO08Fg5f0JWYplC4v0rkH5zJmiXPT0ZnQG0L7UB1u4ybg07C45DiMt22 4xJxpyoNGVn5Zb5TnryKSqQT76KEZW/6TeOJ/nldDtVrs3JpEvX39ZCMXom3tSkPgkIv 9xlGyLVHcQ4o0a2iXIO1XmEWmkMSndbMUtj6Le90rDo0qMUCZdthivsfZ3FLAyn2aIAV 9BPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BgfPyLw0rwt3niYBWySnfEzNF0mBkxpFXerjbmNSzX8=; b=dSA/pQQDhn5Vu26oioL/7/+zl2WcE7gSow+PHkQUbq7Z/BlHc6yAOB01Ih/CvNzg+3 twdUnl38Rc6+iAo0qojvxuee7zpMJyLa6/ikdQjlm2kVEiJCr2Vn7ix+W4uHSDB+yM5o pc5m8Q29/G+87WsyACpMIeEujOLcJ+IE3wTOAhm8NE6fsyOpx2NR4Y9/pd5e+XZaZHPB BcGJEFr97FBtc7Th3Wz+OQ+riFXEYPbXQEvERBSJCb+JoqLYUYNTZzXWizPelGpDbaWi hoQT+qpjpSqSyRrNzkefLn2n5p9qrdxOOvStXfhE7U2coNDksEe68QpVSwBEBZQ6Oo9x 4Mhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Eaz/YkH8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm5-20020a170907948500b00791a5f0b140si502995ejc.993.2022.10.24.12.49.01; Mon, 24 Oct 2022 12:49:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Eaz/YkH8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232156AbiJXTot (ORCPT + 99 others); Mon, 24 Oct 2022 15:44:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233425AbiJXTmO (ORCPT ); Mon, 24 Oct 2022 15:42:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50CFE22BEF; Mon, 24 Oct 2022 11:11:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 08CF3B811C6; Mon, 24 Oct 2022 11:54:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 670BDC433C1; Mon, 24 Oct 2022 11:54:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612475; bh=GlxaIfTe2cbL0wzvJCYu/yb+Dzwdt/fPXLrbYdgTPUg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Eaz/YkH8iKBdC8/i4WLn91OxuJENa3snRYbqMoYEgI/6NLd83/YZzwYRUsAJvJhBN VnqlJ5/UR8zbadSydS1yyhKqjAvIMtuzWpk/qHsFcETkKe1NE78ScXZB7Y0h3/RTp3 QxJLs+qa6xLqN/bMVwtLPbETg3Be020ot6vGHu9g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+79832d33eb89fb3cd092@syzkaller.appspotmail.com, Dongliang Mu , Sasha Levin Subject: [PATCH 4.14 202/210] usb: idmouse: fix an uninit-value in idmouse_open Date: Mon, 24 Oct 2022 13:31:59 +0200 Message-Id: <20221024113003.534804391@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747599718204080662?= X-GMAIL-MSGID: =?utf-8?q?1747599718204080662?= From: Dongliang Mu [ Upstream commit bce2b0539933e485d22d6f6f076c0fcd6f185c4c ] In idmouse_create_image, if any ftip_command fails, it will go to the reset label. However, this leads to the data in bulk_in_buffer[HEADER..IMGSIZE] uninitialized. And the check for valid image incurs an uninitialized dereference. Fix this by moving the check before reset label since this check only be valid if the data after bulk_in_buffer[HEADER] has concrete data. Note that this is found by KMSAN, so only kernel compilation is tested. Reported-by: syzbot+79832d33eb89fb3cd092@syzkaller.appspotmail.com Signed-off-by: Dongliang Mu Link: https://lore.kernel.org/r/20220922134847.1101921-1-dzm91@hust.edu.cn Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/misc/idmouse.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/misc/idmouse.c b/drivers/usb/misc/idmouse.c index 01ef2551be46..974b8d0621bd 100644 --- a/drivers/usb/misc/idmouse.c +++ b/drivers/usb/misc/idmouse.c @@ -182,10 +182,6 @@ static int idmouse_create_image(struct usb_idmouse *dev) bytes_read += bulk_read; } - /* reset the device */ -reset: - ftip_command(dev, FTIP_RELEASE, 0, 0); - /* check for valid image */ /* right border should be black (0x00) */ for (bytes_read = sizeof(HEADER)-1 + WIDTH-1; bytes_read < IMGSIZE; bytes_read += WIDTH) @@ -197,6 +193,10 @@ static int idmouse_create_image(struct usb_idmouse *dev) if (dev->bulk_in_buffer[bytes_read] != 0xFF) return -EAGAIN; + /* reset the device */ +reset: + ftip_command(dev, FTIP_RELEASE, 0, 0); + /* should be IMGSIZE == 65040 */ dev_dbg(&dev->interface->dev, "read %d bytes fingerprint data\n", bytes_read); From patchwork Mon Oct 24 11:32:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8658 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421699wru; Mon, 24 Oct 2022 05:21:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM55C9LjbsPM0YyZBKvfbQ7K5FYTjz0vmxAF49GepI1CNaZK1ZJ2SiCdQp4uawv1/9x4THAk X-Received: by 2002:a05:6402:428a:b0:42e:8f7e:1638 with SMTP id g10-20020a056402428a00b0042e8f7e1638mr30881971edc.228.1666614063533; Mon, 24 Oct 2022 05:21:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614063; cv=none; d=google.com; s=arc-20160816; b=AqnuHCkFxlGegTlKYlyiHblfQZcKc+pYOYWzCJzCpQ9FjEU2mTxhL16Oim+TQ0KZ5W pu9rNebx4knhufgIldRQHFY4NdP+rlUm8hMCQdJsmkmVyXW/5ElwMJBquKhH36VjMWlH q970iCn/RZw8W3sQAgTS6Tj5R35yuyznLu21dJsbhfQyf5/5WLd17S7Q3jdoFjzzxtkC Yd9Jf4NyefiG/mZmp4935wzUvhoS257hTxAQVNY0fyZkCt0br83emy7bQ4D+GQZxvHui 3zek1OR5m4FSpf+sBNe14CSlx9fVGnWxE6DESXjNgkSRIn3ULbubvRNZWhUVHBKycdln NtLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mbd4xz6vHxl5sj6cS2xTY51Wigzg/ebPu54m02TTNmY=; b=E3BhRL9w8P0vJDWVM73cDswhbeXfohrKjWtn5ijEMa4sZcox5kH1f92/E6yhb9zCb5 4fuyqGNRevkHBIHVQuk7iDCnvu4k0UlMASGynD2I2HYVaSswbbKKrGS3kuPuMZRoUHFV ZmQHmGXMbg+12f9yzYsA7y9ojYIDbX7pXhkNQcA1E/kwmQ8WjmE1bNQMKWCaXYQMjuGh /lmgDsyQceK7CwI4UdBiL1pzfYuX0yH1/LceDwhoQ8CHpRsWzgnWhqvg2cNrSh8e53+C qT/QLqBS+L6RvdMR1BD2x8sQXwNFT2dAwCBeOghQeomWPvhzGIVo+vHJFLW/apIcIr8A TBPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rrov728l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dz13-20020a0564021d4d00b00458db439f07si32770740edb.14.2022.10.24.05.20.38; Mon, 24 Oct 2022 05:21:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rrov728l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233163AbiJXMQ5 (ORCPT + 99 others); Mon, 24 Oct 2022 08:16:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233062AbiJXMOF (ORCPT ); Mon, 24 Oct 2022 08:14:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9508B36BCF; Mon, 24 Oct 2022 04:55:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0141D612B9; Mon, 24 Oct 2022 11:54:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 134DEC433C1; Mon, 24 Oct 2022 11:54:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612478; bh=sIVVFNzUhGVUuv6vdAiIrXMPSxdti2gXGjKG94av/UQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rrov728lubW213Gr/6QVUxOcCgKlePU8/4pGvWHpfbwz1pjZ/yw4DsareyprlKnIL C/Brd0D2Y0kuZMrhlt2ZX30xKqrPdDo9rVZrR/hrVFT+Kp0qrfhSNvtLhWPo5JKUUH i+i8maFZcAC9tSXtYrFu5WBWZyijpIaFI4OVkJ4o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adrian Hunter , Namhyung Kim , Ian Rogers , Jiri Olsa , Arnaldo Carvalho de Melo Subject: [PATCH 4.14 203/210] perf intel-pt: Fix segfault in intel_pt_print_info() with uClibc Date: Mon, 24 Oct 2022 13:32:00 +0200 Message-Id: <20221024113003.574627712@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571507902153815?= X-GMAIL-MSGID: =?utf-8?q?1747571507902153815?= From: Adrian Hunter commit 5a3d47071f0ced0431ef82a5fb6bd077ed9493db upstream. uClibc segfaulted because NULL was passed as the format to fprintf(). That happened because one of the format strings was missing and intel_pt_print_info() didn't check that before calling fprintf(). Add the missing format string, and check format is not NULL before calling fprintf(). Fixes: 11fa7cb86b56d361 ("perf tools: Pass Intel PT information for decoding MTC and CYC") Signed-off-by: Adrian Hunter Acked-by: Namhyung Kim Cc: Adrian Hunter Cc: Ian Rogers Cc: Jiri Olsa Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20221012082259.22394-2-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman --- tools/perf/util/intel-pt.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) --- a/tools/perf/util/intel-pt.c +++ b/tools/perf/util/intel-pt.c @@ -2411,6 +2411,7 @@ static const char * const intel_pt_info_ [INTEL_PT_SNAPSHOT_MODE] = " Snapshot mode %"PRId64"\n", [INTEL_PT_PER_CPU_MMAPS] = " Per-cpu maps %"PRId64"\n", [INTEL_PT_MTC_BIT] = " MTC bit %#"PRIx64"\n", + [INTEL_PT_MTC_FREQ_BITS] = " MTC freq bits %#"PRIx64"\n", [INTEL_PT_TSC_CTC_N] = " TSC:CTC numerator %"PRIu64"\n", [INTEL_PT_TSC_CTC_D] = " TSC:CTC denominator %"PRIu64"\n", [INTEL_PT_CYC_BIT] = " CYC bit %#"PRIx64"\n", @@ -2425,8 +2426,12 @@ static void intel_pt_print_info(u64 *arr if (!dump_trace) return; - for (i = start; i <= finish; i++) - fprintf(stdout, intel_pt_info_fmts[i], arr[i]); + for (i = start; i <= finish; i++) { + const char *fmt = intel_pt_info_fmts[i]; + + if (fmt) + fprintf(stdout, fmt, arr[i]); + } } static void intel_pt_print_info_str(const char *name, const char *str) From patchwork Mon Oct 24 11:32:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10011 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp618333wru; Mon, 24 Oct 2022 12:33:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5POWZgpz+5bh2LGgHXhph8ojk27Pj2BhK5nGjOJbQz60/AJqxWcjJqXHBfzm9vuPZURBfx X-Received: by 2002:a63:1e56:0:b0:462:970:e0de with SMTP id p22-20020a631e56000000b004620970e0demr30491066pgm.90.1666640018160; Mon, 24 Oct 2022 12:33:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640018; cv=none; d=google.com; s=arc-20160816; b=Ujhi/6vda2TzJaYBQDa6Y3tPEX5VKrekchNJ5dsBxSSWIIQ8wLKf2Nwt8P1RDUd2hf ynd51vL9H1rZej8AXGTDdaRiMQg374sbMyBkxJcxvjXLRIdS3Uw0edZ5Ex97Mgb0RgP0 DkBHUMV+Y53FAB479iT2IfVxiwIbs98Eupb02aTcgTnkahDti+JOu4rwA8xYti/l5F6r ScafwmWmSdv1amvF6gxi42QMlmSglGHLcBRx3W7AYfj40PLS71Fd6o54Qq3icyTtBWfP Yrfn1cLZbmqZ8MWOKWuNEAJ9OGUEyfL1RF73RUOSZkkExyKC3YBeLXtzScZeXQ12mnlP Dnqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=w+JeoqngnDIj22oFXTpwtF8uTj2pzFV8HLCcISlxjDE=; b=Ad8yW0Aexj6g7EdkLEXb94oeI5JFkuzpz883qWyOQ/nOtJU1kVlOfsXagrcyIHpBzV ZAyZ///UuQ7c+Ow57RQSfMXzEmg7SYWourYVMf+JbtzAPR1Xudn/1XH9a/rJKPrJGzJx gzO7aJwuB7CfCel4GN+JfAUCfqUBwdAlFp6sexbYiyQI087S+QpGU+FKgfjvwDu6rFSI IzW/1lI3zNo8iNii9I88IosCBmtttWLaGJ8qH8S1GAn6Ies/0VMNLff+YzrXKuli7Dsl ziZPElZ1GGRQnmOeIN6jqmqJzIUo8MjJgrieIOMt7YRyWxMP7YTbE5SqIA3s7GisebrF az5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iZdVAUtp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g5-20020aa79f05000000b0056bdae22580si506036pfr.338.2022.10.24.12.33.24; Mon, 24 Oct 2022 12:33:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iZdVAUtp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231143AbiJXTcf (ORCPT + 99 others); Mon, 24 Oct 2022 15:32:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233243AbiJXTcO (ORCPT ); Mon, 24 Oct 2022 15:32:14 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F4EE367A2; Mon, 24 Oct 2022 11:02:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 95509CE136A; Mon, 24 Oct 2022 11:54:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADAA1C433C1; Mon, 24 Oct 2022 11:54:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612481; bh=nU5shlmlTDL+WA15wXTBEMZOu70bg3gompzMDfGsWu8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iZdVAUtp/h9bRYMb6cConkvau5LV/f5eVVIPNkyOtqdaG/L63UcJmlJhV4mFKHaHM DsleZ90NvngFtbZnJX7JUTjCLXR+OyOcYPe4+4iORk2oCrJJwsPRjOKJ5IM4Wq5m2/ 67PV676oKSy1SNPfu4mnimPmdSyDL3CVSjDgg+vI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Aring , "David S. Miller" Subject: [PATCH 4.14 204/210] net: ieee802154: return -EINVAL for unknown addr type Date: Mon, 24 Oct 2022 13:32:01 +0200 Message-Id: <20221024113003.608477909@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747598723951332987?= X-GMAIL-MSGID: =?utf-8?q?1747598723951332987?= From: Alexander Aring commit 30393181fdbc1608cc683b4ee99dcce05ffcc8c7 upstream. This patch adds handling to return -EINVAL for an unknown addr type. The current behaviour is to return 0 as successful but the size of an unknown addr type is not defined and should return an error like -EINVAL. Fixes: 94160108a70c ("net/ieee802154: fix uninit value bug in dgram_sendmsg") Signed-off-by: Alexander Aring Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- include/net/ieee802154_netdev.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) --- a/include/net/ieee802154_netdev.h +++ b/include/net/ieee802154_netdev.h @@ -193,21 +193,27 @@ static inline int ieee802154_sockaddr_check_size(struct sockaddr_ieee802154 *daddr, int len) { struct ieee802154_addr_sa *sa; + int ret = 0; sa = &daddr->addr; if (len < IEEE802154_MIN_NAMELEN) return -EINVAL; switch (sa->addr_type) { + case IEEE802154_ADDR_NONE: + break; case IEEE802154_ADDR_SHORT: if (len < IEEE802154_NAMELEN_SHORT) - return -EINVAL; + ret = -EINVAL; break; case IEEE802154_ADDR_LONG: if (len < IEEE802154_NAMELEN_LONG) - return -EINVAL; + ret = -EINVAL; + break; + default: + ret = -EINVAL; break; } - return 0; + return ret; } static inline void ieee802154_addr_from_sa(struct ieee802154_addr *a, From patchwork Mon Oct 24 11:32:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10045 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp622722wru; Mon, 24 Oct 2022 12:46:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ycvUWHgMcbkYXz9rchbxtEXEmk4OvoTPEvf/t/e93RxZEmYqBqii/tAWwiinhe6ehZ0yf X-Received: by 2002:aa7:c58e:0:b0:461:77b:7bd with SMTP id g14-20020aa7c58e000000b00461077b07bdmr21412904edq.387.1666640778846; Mon, 24 Oct 2022 12:46:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666640778; cv=none; d=google.com; s=arc-20160816; b=KAnG+ahML3WflHHAyC/RZTdAHw435lsPYDE5pacoTO1HBRzjJzlhTta0TbV3VlxUkH mKcQUuxU+EugtdzOwgl8vjqfceThVRDYhc3ZpFmIU0sBr4VmZuXtrBBNd3rONj0arBmX j0K9uakI1myLASEO2VS/0o70rb8fAJDMRxwEZG9GKA89JQtVZjRQJSRNtlqfJ9D601/C E8cgQv7QhW2srlh1pkHSP+nKSla8luyEmZN0iO2ITW7M40GOhBx6t7DQ5fH4NJPdtO1s LPGGVGqF6R8RM2MjO3pKDtGms8nEcWVa4KxnVEX0K0dW78m1qavopxAUIb0S0tV8dve2 ibHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=d7xXdrhTwnQmoZA8uPRVVzlvi0NIQuuXN3Rlmj5f1ww=; b=sh+z9tM/Z0+SK1oJkDNljC1jaZhexUHMFsBUiOgZSo6+GLCu/U+UHbQNKS7w8cXx/C 5J22OV/HjsCvEuk3I8Mv1pWRktkVh9tKsIft9657YJMpClZsn3eGROlAK66jJCJXkIhr Czkz8LucSsuDJjvugiq6cdKEuCAjVvUqjZ0zhXFQfFxIxHKnYIHkThrTP+/DqqnIeWnt T3CJ5bDs1OJ4z57GBLaZMcrax06pJaWbPu+4/ria8abDIYIm+ci96rvScbFobWijsFoy v6Fnlud6u4V6auqWEVRWwzWPOUwqxxW/XpEGiXt49qlZ1UsLw/nrAmxtEE01yRE/dad+ TT9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZFYER+HX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e10-20020a170906844a00b00781df60a2c8si512134ejy.342.2022.10.24.12.45.51; Mon, 24 Oct 2022 12:46:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZFYER+HX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233008AbiJXTng (ORCPT + 99 others); Mon, 24 Oct 2022 15:43:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232117AbiJXTlx (ORCPT ); Mon, 24 Oct 2022 15:41:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7D5A265C64; Mon, 24 Oct 2022 11:11:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id ED2DBB81144; Mon, 24 Oct 2022 11:54:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54B85C433C1; Mon, 24 Oct 2022 11:54:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612483; bh=5Vy4jq/SW/H+3NBkjZm5KJ4gAaL+cSLzxnmDanCaLrA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZFYER+HXM2Frq6TZY9nZleSw3N1gSs1wzpe3plILQSvUYDy+dmIpkZIoX0WWz3lQ6 /XP7aF9o3qYzTjp4fWrQGCTw5fs0dnLFmiSbQW8Qb0i2rujTC1kLCz0q3OA06J4qiL IcdOcHhQ2wsBY2aMgp2OU8CcKT+KDYV997O4JSTY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Tetsuo Handa , Alexander Aring , Stefan Schmidt , Sasha Levin Subject: [PATCH 4.14 205/210] net/ieee802154: dont warn zero-sized raw_sendmsg() Date: Mon, 24 Oct 2022 13:32:02 +0200 Message-Id: <20221024113003.651648084@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747599521558760596?= X-GMAIL-MSGID: =?utf-8?q?1747599521558760596?= From: Tetsuo Handa [ Upstream commit b12e924a2f5b960373459c8f8a514f887adf5cac ] syzbot is hitting skb_assert_len() warning at __dev_queue_xmit() [1], for PF_IEEE802154 socket's zero-sized raw_sendmsg() request is hitting __dev_queue_xmit() with skb->len == 0. Since PF_IEEE802154 socket's zero-sized raw_sendmsg() request was able to return 0, don't call __dev_queue_xmit() if packet length is 0. ---------- #include #include int main(int argc, char *argv[]) { struct sockaddr_in addr = { .sin_family = AF_INET, .sin_addr.s_addr = htonl(INADDR_LOOPBACK) }; struct iovec iov = { }; struct msghdr hdr = { .msg_name = &addr, .msg_namelen = sizeof(addr), .msg_iov = &iov, .msg_iovlen = 1 }; sendmsg(socket(PF_IEEE802154, SOCK_RAW, 0), &hdr, 0); return 0; } ---------- Note that this might be a sign that commit fd1894224407c484 ("bpf: Don't redirect packets with invalid pkt_len") should be reverted, for skb->len == 0 was acceptable for at least PF_IEEE802154 socket. Link: https://syzkaller.appspot.com/bug?extid=5ea725c25d06fb9114c4 [1] Reported-by: syzbot Fixes: fd1894224407c484 ("bpf: Don't redirect packets with invalid pkt_len") Signed-off-by: Tetsuo Handa Signed-off-by: Alexander Aring Link: https://lore.kernel.org/r/20221005014750.3685555-2-aahringo@redhat.com Signed-off-by: Stefan Schmidt Signed-off-by: Sasha Levin --- net/ieee802154/socket.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/ieee802154/socket.c b/net/ieee802154/socket.c index 16bf114118c3..a8929675b5ab 100644 --- a/net/ieee802154/socket.c +++ b/net/ieee802154/socket.c @@ -284,6 +284,10 @@ static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) err = -EMSGSIZE; goto out_dev; } + if (!size) { + err = 0; + goto out_dev; + } hlen = LL_RESERVED_SPACE(dev); tlen = dev->needed_tailroom; From patchwork Mon Oct 24 11:32:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8798 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430869wru; Mon, 24 Oct 2022 05:42:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5IPnehzO2MeapC1Bi61CasYO4NnN0LnjJXy+ShE4i3+m2B4o5Nvqlgl4pyVrUaVwzafhcC X-Received: by 2002:a17:90a:ba85:b0:212:d644:fc28 with SMTP id t5-20020a17090aba8500b00212d644fc28mr18001152pjr.72.1666615346364; Mon, 24 Oct 2022 05:42:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615346; cv=none; d=google.com; s=arc-20160816; b=fJhQfscJ5m7uwN2tsjLU9mHHjYk5KaI1rBn8Oib0CGc5I3dvIAug+zLau8cTCSjfs8 WaUniljp/8e2QIkTGJMC+fP7ZjA5ZIG9EjnM1cu8UEUe+/FH+32vb8HLelU2Rqd4gmvt wpuvCsknfrK1np6zEOZ0HpC3VBHmATveqqI6iQcSBgdTRRDVyfE42UjBEFJeZO336HAB R7BpiRly1oAB20V8KtL9VfBjFORkIPWvV9CFxU4FtrDkHGA6tqiHOvSMH6TawblV3Hg4 NJg41flFPe56TE9YoSsmoDCOGFvL9VVuAhHHILJ7G/8Gy9Y8/OIjPwwr0oCnJhHShlPE hQtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bD2C7Lte0xU/CrJRTGvJkXaxgL7xmukdgbO9XEdOu50=; b=BU3fnxWuRi7IxryDXEUB7ks8zmHYj3tLlCt/F3FVAVYnADY9ZstxXRSSuaNvsmU6yp qwkldnmCId/kKoIW7v06QpUbnq03LgZxBBdtaJ6IznYZxzxqyRU5GE3eWNQF/AH+RGlb lsC3BO2C5/93IGgyCUTsgMJDRJvSazSkr2FtYyZV1oQEkzn7uVNr65E/L6fFOZ7H5Ia7 ukwBgsw3hEijSDWREJdXZ7Lunp4KedVv5keJJzucqPLQ4nS7EV+6JV5fUXe0egja5379 INgEJugqRG35Wjcle00hc6ZxGh3dX6/FsuHekQSo2ZZQnxTQt7VlU73P5vG6964+IQy3 BWrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MBbPWktz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n8-20020a1709026a8800b0016be68156aesi31191479plk.173.2022.10.24.05.42.12; Mon, 24 Oct 2022 05:42:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MBbPWktz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234184AbiJXMe2 (ORCPT + 99 others); Mon, 24 Oct 2022 08:34:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234178AbiJXM3d (ORCPT ); Mon, 24 Oct 2022 08:29:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B53988DC7; Mon, 24 Oct 2022 05:03:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CED61612A5; Mon, 24 Oct 2022 11:54:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0D6BC433D6; Mon, 24 Oct 2022 11:54:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612486; bh=P9uzgoT+xBNwpnWIim26R0X5Gf6DVBe9FcUCmxIZCtk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MBbPWktz3zNZI6M6/+zm3r9T8i8V37YOcYApFAp+ewKaK4yr6BKS7DSUmCqBvi0tA QfgT+4RNhIIKGSkVO3sRMf6QKs10mVc2MUP1d7UXDMX23xyZeAQUmtwnYGxl3LTJgT COOUjm8kA0jrwDrMZEx4/slrQRo94J8DahwqK1TU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jerry Lee , Theodore Tso Subject: [PATCH 4.14 206/210] ext4: continue to expand file system when the target size doesnt reach Date: Mon, 24 Oct 2022 13:32:03 +0200 Message-Id: <20221024113003.700987694@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572853293800669?= X-GMAIL-MSGID: =?utf-8?q?1747572853293800669?= From: Jerry Lee 李修賢 commit df3cb754d13d2cd5490db9b8d536311f8413a92e upstream. When expanding a file system from (16TiB-2MiB) to 18TiB, the operation exits early which leads to result inconsistency between resize2fs and Ext4 kernel driver. === before === ○ → resize2fs /dev/mapper/thin resize2fs 1.45.5 (07-Jan-2020) Filesystem at /dev/mapper/thin is mounted on /mnt/test; on-line resizing required old_desc_blocks = 2048, new_desc_blocks = 2304 The filesystem on /dev/mapper/thin is now 4831837696 (4k) blocks long. [ 865.186308] EXT4-fs (dm-5): mounted filesystem with ordered data mode. Opts: (null). Quota mode: none. [ 912.091502] dm-4: detected capacity change from 34359738368 to 38654705664 [ 970.030550] dm-5: detected capacity change from 34359734272 to 38654701568 [ 1000.012751] EXT4-fs (dm-5): resizing filesystem from 4294966784 to 4831837696 blocks [ 1000.012878] EXT4-fs (dm-5): resized filesystem to 4294967296 === after === [ 129.104898] EXT4-fs (dm-5): mounted filesystem with ordered data mode. Opts: (null). Quota mode: none. [ 143.773630] dm-4: detected capacity change from 34359738368 to 38654705664 [ 198.203246] dm-5: detected capacity change from 34359734272 to 38654701568 [ 207.918603] EXT4-fs (dm-5): resizing filesystem from 4294966784 to 4831837696 blocks [ 207.918754] EXT4-fs (dm-5): resizing filesystem from 4294967296 to 4831837696 blocks [ 207.918758] EXT4-fs (dm-5): Converting file system to meta_bg [ 207.918790] EXT4-fs (dm-5): resizing filesystem from 4294967296 to 4831837696 blocks [ 221.454050] EXT4-fs (dm-5): resized to 4658298880 blocks [ 227.634613] EXT4-fs (dm-5): resized filesystem to 4831837696 Signed-off-by: Jerry Lee Link: https://lore.kernel.org/r/PU1PR04MB22635E739BD21150DC182AC6A18C9@PU1PR04MB2263.apcprd04.prod.outlook.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/resize.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c @@ -2062,7 +2062,7 @@ retry: goto out; } - if (ext4_blocks_count(es) == n_blocks_count) + if (ext4_blocks_count(es) == n_blocks_count && n_blocks_count_retry == 0) goto out; err = ext4_alloc_flex_bg_array(sb, n_group + 1); From patchwork Mon Oct 24 11:32:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8667 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421899wru; Mon, 24 Oct 2022 05:21:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7TlMDcFEiDtfQ7WuVMaOXP4WAy56j1OfoKTexVHTE8edrl+xt4NN17Tdt7txvpaqZamY/X X-Received: by 2002:a17:906:fe45:b0:791:9624:9ea4 with SMTP id wz5-20020a170906fe4500b0079196249ea4mr27577891ejb.147.1666614074656; Mon, 24 Oct 2022 05:21:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614074; cv=none; d=google.com; s=arc-20160816; b=CPq92G8ESbV2OnPZKbfL08mmuPyWBiRsfK2rsM1CWwh8IEL07IwaPL1+geBhpOzusU 7dHnW3sB20kieMH2EA35Zp6tzHEz4/iebaDqSzrzne9AGVy2UDyrREbmhjQqefPQa7Ss wCDA+y+VPRMBLblMdMjfcCVJPoZrzSgTfC7LWyUnGBWT1RVJw37KX9wmJjOChlLN1lmj OMcAaMlUDbkcN7je0Xe21XjFm7CVF/OWen6i/mDjOOQRxUli72KeTxzEKd5be7apsekF 5jWA1q00I47ITdQ1bMoFGGiYOy5axVLhM+S5vXqSs23lSKmgd5Uwq7PdBWVjcZnrZvLM fD3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nA3UjYYQRo3nS1Agz/LGKGm6CatuNb1mmn1Hj5c0ga4=; b=vmViJ+Y/7C2CBSSwGStyxtn6o+Z0/BL9xFTHVn7G9xtMHrETV+C0I+cUkYKQzCQaIa yu9RctC5MdYrdnJImtE2PApXBpuwBVpzF6KDSMw2CQ0vMWPxhuoANnIdVNqNz8v8W6z9 lSerkTibvIfhpdmEOEmkdE3qUYGvpwKbmHMV6v9PgWqsWKCFgbhqnuRF+ocEBYOvo3KX NZX+vTSocGdIYfpvm9HMKCTOn8EuRrzofm+1i8TCdG7YZMsoG6ghrAj8U3X8qulcXOk2 qGgXz1QpmStipUhcKFEIjsQLRlNyy1uXXlSYbIKacszySZZEnFmZF2/qNZrfk+pCSn8W CxuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pQ9Arryr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i13-20020a1709064fcd00b00773dd14c80asi29240747ejw.860.2022.10.24.05.20.50; Mon, 24 Oct 2022 05:21:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pQ9Arryr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231675AbiJXMPx (ORCPT + 99 others); Mon, 24 Oct 2022 08:15:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233173AbiJXMOW (ORCPT ); Mon, 24 Oct 2022 08:14:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 684823ED78; Mon, 24 Oct 2022 04:55:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6FD73612DD; Mon, 24 Oct 2022 11:54:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 818B5C433C1; Mon, 24 Oct 2022 11:54:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612488; bh=E0YbGMFmtEwZiigkCgf2+nGcnuIodXf/bVhO/X1D1PI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pQ9ArryrayxpcQQNnYue22SVj0i8SvLMATsT/+4UFLIjfZnqUiaoBN6qBSNNE0H9+ sGtonAOPTzV4DDEkVOZ1hHuIxSRgaBOTEvl/QfhvWKu4wPTYF5uXnYCRO1Xyqq5CRq dayVO1A9nsRgUOaS9kHKwv3r0CrWxCfO6vz562ak= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Kelley , Guoqing Jiang , Saurabh Sengar , Song Liu Subject: [PATCH 4.14 207/210] md: Replace snprintf with scnprintf Date: Mon, 24 Oct 2022 13:32:04 +0200 Message-Id: <20221024113003.731875452@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571519656642727?= X-GMAIL-MSGID: =?utf-8?q?1747571519656642727?= From: Saurabh Sengar commit 1727fd5015d8f93474148f94e34cda5aa6ad4a43 upstream. Current code produces a warning as shown below when total characters in the constituent block device names plus the slashes exceeds 200. snprintf() returns the number of characters generated from the given input, which could cause the expression “200 – len” to wrap around to a large positive number. Fix this by using scnprintf() instead, which returns the actual number of characters written into the buffer. [ 1513.267938] ------------[ cut here ]------------ [ 1513.267943] WARNING: CPU: 15 PID: 37247 at /lib/vsprintf.c:2509 vsnprintf+0x2c8/0x510 [ 1513.267944] Modules linked in: [ 1513.267969] CPU: 15 PID: 37247 Comm: mdadm Not tainted 5.4.0-1085-azure #90~18.04.1-Ubuntu [ 1513.267969] Hardware name: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS Hyper-V UEFI Release v4.1 05/09/2022 [ 1513.267971] RIP: 0010:vsnprintf+0x2c8/0x510 <-snip-> [ 1513.267982] Call Trace: [ 1513.267986] snprintf+0x45/0x70 [ 1513.267990] ? disk_name+0x71/0xa0 [ 1513.267993] dump_zones+0x114/0x240 [raid0] [ 1513.267996] ? _cond_resched+0x19/0x40 [ 1513.267998] raid0_run+0x19e/0x270 [raid0] [ 1513.268000] md_run+0x5e0/0xc50 [ 1513.268003] ? security_capable+0x3f/0x60 [ 1513.268005] do_md_run+0x19/0x110 [ 1513.268006] md_ioctl+0x195e/0x1f90 [ 1513.268007] blkdev_ioctl+0x91f/0x9f0 [ 1513.268010] block_ioctl+0x3d/0x50 [ 1513.268012] do_vfs_ioctl+0xa9/0x640 [ 1513.268014] ? __fput+0x162/0x260 [ 1513.268016] ksys_ioctl+0x75/0x80 [ 1513.268017] __x64_sys_ioctl+0x1a/0x20 [ 1513.268019] do_syscall_64+0x5e/0x200 [ 1513.268021] entry_SYSCALL_64_after_hwframe+0x44/0xa9 Fixes: 766038846e875 ("md/raid0: replace printk() with pr_*()") Reviewed-by: Michael Kelley Acked-by: Guoqing Jiang Signed-off-by: Saurabh Sengar Signed-off-by: Song Liu Signed-off-by: Greg Kroah-Hartman --- drivers/md/raid0.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c @@ -70,8 +70,8 @@ static void dump_zones(struct mddev *mdd int len = 0; for (k = 0; k < conf->strip_zone[j].nb_dev; k++) - len += snprintf(line+len, 200-len, "%s%s", k?"/":"", - bdevname(conf->devlist[j*raid_disks + len += scnprintf(line+len, 200-len, "%s%s", k?"/":"", + bdevname(conf->devlist[j*raid_disks + k]->bdev, b)); pr_debug("md: zone%d=[%s]\n", j, line); From patchwork Mon Oct 24 11:32:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8689 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422499wru; Mon, 24 Oct 2022 05:22:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM787B7KE2efSvz96VVm58CpFF9f5vy1HTPgtpBERHHcrQt/aww8mSNF4wvZwICkO9E+Zq88 X-Received: by 2002:a17:906:db02:b0:780:24e:cf9 with SMTP id xj2-20020a170906db0200b00780024e0cf9mr27553078ejb.460.1666614168414; Mon, 24 Oct 2022 05:22:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614168; cv=none; d=google.com; s=arc-20160816; b=cMwsA6BHY8+qW0DIwm9nkV6au39Jd/R2w8Q+7CD4ix9S6MZ16T+HCD4ltOFNKM8IR5 tSnEdERBVRSin33BPaZBEi8NW2B2QAq2fyrkLnlJYQR28PLqoJjF+HemEoTqAwAj06fe lf3QZDSyDNHuH5IoR5L1DS32mxsYfTPJ/UzH+Sx4mpVoCvYf99yM2O2Kjp222YmaRxlW UoexWf+rYzMFkPcgThfdmtIp1P57ASf9JnScnUORZtWmX9IFRlUgKrVILv9BAKNjCj86 6YB18Lg1I4yGkMPZYNeAvLUw0wMnGlviN2HBIZ40qUdy+OZe3dQ3QDdi7bRxq1iBz5JJ KN5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KoyxwZn6X1wThRDckOywlX+i4OhYO5cRjgxTSSOJf00=; b=KLjUWLCyCv8bfp8ntjgY3ZZglCF4EFIUNfXfv2bvDyRtCoLzjhyJgUFubBOACzD3MQ 4b5OAYYjcnjaRwB2R/Mu/Hr9YSdt2byQci41yhCt9TMLNYDHLXctIcmqXYjPzyuYd67x hfetgRXhVVAt20javocxB2vNJ5w7oRUGOk3OkNf8J5sADpG97Y5WBHq0S7p30OBX2Vey k3U1nR5sVhVtrmU+PqWcH+peNLaPUBwnNQ1NlwbtM15H8by6gnI4gVdhCiFMjSbAwcoo w2nNmFPs216I8N+wEeJRVj3ejLDUG/jG6HJjm9/OQoAwsOoecI9Tq7bnQxQUzBDhZNwm ueEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lbpZ6n4R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s11-20020a056402520b00b0045db2dcff0esi21719914edd.594.2022.10.24.05.22.24; Mon, 24 Oct 2022 05:22:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lbpZ6n4R; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233367AbiJXMVX (ORCPT + 99 others); Mon, 24 Oct 2022 08:21:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233470AbiJXMTk (ORCPT ); Mon, 24 Oct 2022 08:19:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A4C482D3E; Mon, 24 Oct 2022 04:58:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E3B4DB811C5; Mon, 24 Oct 2022 11:54:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4745CC433D6; Mon, 24 Oct 2022 11:54:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612462; bh=/GUBL19Jp9NmcH/HaL4btiEfO1T1Pkk6YALZLRd1jc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lbpZ6n4RhcqCfjkWZAtn73ZM2sTC+HVgsztIbDIs5801E/Iog1IUuD+Y0yGwF8Tvx S7Tle1zSLIroqe/agDKbIR4SiQNVW9mKfoCCjFnQPkmP2RjM+8P12z/s1iNWgEFJnM Tg+C0Sx8Y9oF2YSOJ3pVc1oV5IbD6F7GuyR4Ugbs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ard Biesheuvel Subject: [PATCH 4.14 208/210] efi: libstub: drop pointless get_memory_map() call Date: Mon, 24 Oct 2022 13:32:05 +0200 Message-Id: <20221024113003.766339614@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571618044617100?= X-GMAIL-MSGID: =?utf-8?q?1747571618044617100?= From: Ard Biesheuvel commit d80ca810f096ff66f451e7a3ed2f0cd9ef1ff519 upstream. Currently, the non-x86 stub code calls get_memory_map() redundantly, given that the data it returns is never used anywhere. So drop the call. Cc: # v4.14+ Fixes: 24d7c494ce46 ("efi/arm-stub: Round up FDT allocation to mapping size") Signed-off-by: Ard Biesheuvel Signed-off-by: Greg Kroah-Hartman --- drivers/firmware/efi/libstub/fdt.c | 8 -------- 1 file changed, 8 deletions(-) --- a/drivers/firmware/efi/libstub/fdt.c +++ b/drivers/firmware/efi/libstub/fdt.c @@ -301,14 +301,6 @@ efi_status_t allocate_new_fdt_and_exit_b goto fail; } - /* - * Now that we have done our final memory allocation (and free) - * we can get the memory map key needed for exit_boot_services(). - */ - status = efi_get_memory_map(sys_table, &map); - if (status != EFI_SUCCESS) - goto fail_free_new_fdt; - status = update_fdt(sys_table, (void *)fdt_addr, fdt_size, (void *)*new_fdt_addr, MAX_FDT_SIZE, cmdline_ptr, initrd_addr, initrd_size); From patchwork Mon Oct 24 11:32:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8648 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421527wru; Mon, 24 Oct 2022 05:20:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Rl2ANyjop9KTOoqRS4vkuv57pHz9wX8WwjdhKv1u0kosSGsleF2RYif0IN5vPqe6qPD0k X-Received: by 2002:a17:907:971c:b0:78e:63f:c766 with SMTP id jg28-20020a170907971c00b0078e063fc766mr27453632ejc.330.1666614042903; Mon, 24 Oct 2022 05:20:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614042; cv=none; d=google.com; s=arc-20160816; b=FAK+5q+7xvuOJlcWHn9k07jlkI84J79qVM0mb2DSQQzptzc2qLI6IeE467V/VCPrxE 6AoyNwnLWLX6mLhYyDa+rEtGBiSK++UwgBcJ8Eik430d7CPQAF9QlJIESFT1/4Fg3Trp UeHyVlHhSSVZU8t3V8x+wPL5S6N9fclBnHHbK9dr1VWhJJ3DsVtxkGBB/7+NZ13fX4j4 vHT2myNNQLzrRn9KGJ82O5rBTkGwBNExT/v+722VKwT0/qL9V14w3vfSZHMK3iTuWi2g mNSb3wh6hOvPDAS5uAZ/KhR20Zxbm01frCTBJ6T3R07vRqhTPSVEFojUAhTI70TNPhLZ I4zQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0GvzU6upocWBIOYmsEG7ArDxWONrO4KTO0i6hnfRBD4=; b=zo2VaUuZL9NxNj9YPT0koqFCnepbZmJEpNOM3XBRztsALbF4kGsEVT9+oEVsclpuVH NTZWi+fdQJGwsMmSy4Xt1hNrDfQ0NiKlqaysOaw6N3ocamlFJBEe3HMe505k3+eiwstM xA9o2h2ns3d3HTjDmwgHnBNtKcI+Hp9TzVT/FEocD4iBRJr8iBIrXIIP7xdGvqKaqLzo KMG2SjBEPBGkBW7Qj5/20rJKSoiVOLrOJLL/M7bWcoaF1KLo7BzxM7AKH50EBeI3VF9G wf0KIHqI2y5X2cxfX5zUEQ/gWMBzh9gCUzMmomnflfkQJr/NDrEQrf6iOV/nnU1f6mQR dKwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=x2+IoDCK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lg22-20020a170906f89600b0078c959aea8bsi22196004ejb.324.2022.10.24.05.20.18; Mon, 24 Oct 2022 05:20:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=x2+IoDCK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233001AbiJXMPi (ORCPT + 99 others); Mon, 24 Oct 2022 08:15:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233053AbiJXMOE (ORCPT ); Mon, 24 Oct 2022 08:14:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAD982E68E; Mon, 24 Oct 2022 04:55:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D1BDF612DC; Mon, 24 Oct 2022 11:54:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3C11C433D7; Mon, 24 Oct 2022 11:54:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612465; bh=/T92HRDJimtnI7ZZxP5yAQ0lGXfNIfdId21GKaQTHg8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x2+IoDCKMW0ONRauzOysV2rTbcjfTAL3yCbNwutyM7WySR5M+4bF0jwGhY1afv3Fd Nde2xBj6nR2Yldo7qF8yCuk++0ITOvTYQUw5uR6yFUTa/gfm9nkynX3QGDhgffPn5i RNE1iWKKm5EWLA8Z6hN1N/q6wA4gZt8qPpLmtK5M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , Jakub Kicinski , Carlos Llamas Subject: [PATCH 4.14 209/210] inet: fully convert sk->sk_rx_dst to RCU rules Date: Mon, 24 Oct 2022 13:32:06 +0200 Message-Id: <20221024113003.796802395@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747571486494296424?= X-GMAIL-MSGID: =?utf-8?q?1747571486494296424?= From: Eric Dumazet commit 8f905c0e7354ef261360fb7535ea079b1082c105 upstream. syzbot reported various issues around early demux, one being included in this changelog [1] sk->sk_rx_dst is using RCU protection without clearly documenting it. And following sequences in tcp_v4_do_rcv()/tcp_v6_do_rcv() are not following standard RCU rules. [a] dst_release(dst); [b] sk->sk_rx_dst = NULL; They look wrong because a delete operation of RCU protected pointer is supposed to clear the pointer before the call_rcu()/synchronize_rcu() guarding actual memory freeing. In some cases indeed, dst could be freed before [b] is done. We could cheat by clearing sk_rx_dst before calling dst_release(), but this seems the right time to stick to standard RCU annotations and debugging facilities. [1] BUG: KASAN: use-after-free in dst_check include/net/dst.h:470 [inline] BUG: KASAN: use-after-free in tcp_v4_early_demux+0x95b/0x960 net/ipv4/tcp_ipv4.c:1792 Read of size 2 at addr ffff88807f1cb73a by task syz-executor.5/9204 CPU: 0 PID: 9204 Comm: syz-executor.5 Not tainted 5.16.0-rc5-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description.constprop.0.cold+0x8d/0x320 mm/kasan/report.c:247 __kasan_report mm/kasan/report.c:433 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:450 dst_check include/net/dst.h:470 [inline] tcp_v4_early_demux+0x95b/0x960 net/ipv4/tcp_ipv4.c:1792 ip_rcv_finish_core.constprop.0+0x15de/0x1e80 net/ipv4/ip_input.c:340 ip_list_rcv_finish.constprop.0+0x1b2/0x6e0 net/ipv4/ip_input.c:583 ip_sublist_rcv net/ipv4/ip_input.c:609 [inline] ip_list_rcv+0x34e/0x490 net/ipv4/ip_input.c:644 __netif_receive_skb_list_ptype net/core/dev.c:5508 [inline] __netif_receive_skb_list_core+0x549/0x8e0 net/core/dev.c:5556 __netif_receive_skb_list net/core/dev.c:5608 [inline] netif_receive_skb_list_internal+0x75e/0xd80 net/core/dev.c:5699 gro_normal_list net/core/dev.c:5853 [inline] gro_normal_list net/core/dev.c:5849 [inline] napi_complete_done+0x1f1/0x880 net/core/dev.c:6590 virtqueue_napi_complete drivers/net/virtio_net.c:339 [inline] virtnet_poll+0xca2/0x11b0 drivers/net/virtio_net.c:1557 __napi_poll+0xaf/0x440 net/core/dev.c:7023 napi_poll net/core/dev.c:7090 [inline] net_rx_action+0x801/0xb40 net/core/dev.c:7177 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558 invoke_softirq kernel/softirq.c:432 [inline] __irq_exit_rcu+0x123/0x180 kernel/softirq.c:637 irq_exit_rcu+0x5/0x20 kernel/softirq.c:649 common_interrupt+0x52/0xc0 arch/x86/kernel/irq.c:240 asm_common_interrupt+0x1e/0x40 arch/x86/include/asm/idtentry.h:629 RIP: 0033:0x7f5e972bfd57 Code: 39 d1 73 14 0f 1f 80 00 00 00 00 48 8b 50 f8 48 83 e8 08 48 39 ca 77 f3 48 39 c3 73 3e 48 89 13 48 8b 50 f8 48 89 38 49 8b 0e <48> 8b 3e 48 83 c3 08 48 83 c6 08 eb bc 48 39 d1 72 9e 48 39 d0 73 RSP: 002b:00007fff8a413210 EFLAGS: 00000283 RAX: 00007f5e97108990 RBX: 00007f5e97108338 RCX: ffffffff81d3aa45 RDX: ffffffff81d3aa45 RSI: 00007f5e97108340 RDI: ffffffff81d3aa45 RBP: 00007f5e97107eb8 R08: 00007f5e97108d88 R09: 0000000093c2e8d9 R10: 0000000000000000 R11: 0000000000000000 R12: 00007f5e97107eb0 R13: 00007f5e97108338 R14: 00007f5e97107ea8 R15: 0000000000000019 Allocated by task 13: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:434 [inline] __kasan_slab_alloc+0x90/0xc0 mm/kasan/common.c:467 kasan_slab_alloc include/linux/kasan.h:259 [inline] slab_post_alloc_hook mm/slab.h:519 [inline] slab_alloc_node mm/slub.c:3234 [inline] slab_alloc mm/slub.c:3242 [inline] kmem_cache_alloc+0x202/0x3a0 mm/slub.c:3247 dst_alloc+0x146/0x1f0 net/core/dst.c:92 rt_dst_alloc+0x73/0x430 net/ipv4/route.c:1613 ip_route_input_slow+0x1817/0x3a20 net/ipv4/route.c:2340 ip_route_input_rcu net/ipv4/route.c:2470 [inline] ip_route_input_noref+0x116/0x2a0 net/ipv4/route.c:2415 ip_rcv_finish_core.constprop.0+0x288/0x1e80 net/ipv4/ip_input.c:354 ip_list_rcv_finish.constprop.0+0x1b2/0x6e0 net/ipv4/ip_input.c:583 ip_sublist_rcv net/ipv4/ip_input.c:609 [inline] ip_list_rcv+0x34e/0x490 net/ipv4/ip_input.c:644 __netif_receive_skb_list_ptype net/core/dev.c:5508 [inline] __netif_receive_skb_list_core+0x549/0x8e0 net/core/dev.c:5556 __netif_receive_skb_list net/core/dev.c:5608 [inline] netif_receive_skb_list_internal+0x75e/0xd80 net/core/dev.c:5699 gro_normal_list net/core/dev.c:5853 [inline] gro_normal_list net/core/dev.c:5849 [inline] napi_complete_done+0x1f1/0x880 net/core/dev.c:6590 virtqueue_napi_complete drivers/net/virtio_net.c:339 [inline] virtnet_poll+0xca2/0x11b0 drivers/net/virtio_net.c:1557 __napi_poll+0xaf/0x440 net/core/dev.c:7023 napi_poll net/core/dev.c:7090 [inline] net_rx_action+0x801/0xb40 net/core/dev.c:7177 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558 Freed by task 13: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 kasan_set_track+0x21/0x30 mm/kasan/common.c:46 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370 ____kasan_slab_free mm/kasan/common.c:366 [inline] ____kasan_slab_free mm/kasan/common.c:328 [inline] __kasan_slab_free+0xff/0x130 mm/kasan/common.c:374 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:1723 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1749 slab_free mm/slub.c:3513 [inline] kmem_cache_free+0xbd/0x5d0 mm/slub.c:3530 dst_destroy+0x2d6/0x3f0 net/core/dst.c:127 rcu_do_batch kernel/rcu/tree.c:2506 [inline] rcu_core+0x7ab/0x1470 kernel/rcu/tree.c:2741 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558 Last potentially related work creation: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 __kasan_record_aux_stack+0xf5/0x120 mm/kasan/generic.c:348 __call_rcu kernel/rcu/tree.c:2985 [inline] call_rcu+0xb1/0x740 kernel/rcu/tree.c:3065 dst_release net/core/dst.c:177 [inline] dst_release+0x79/0xe0 net/core/dst.c:167 tcp_v4_do_rcv+0x612/0x8d0 net/ipv4/tcp_ipv4.c:1712 sk_backlog_rcv include/net/sock.h:1030 [inline] __release_sock+0x134/0x3b0 net/core/sock.c:2768 release_sock+0x54/0x1b0 net/core/sock.c:3300 tcp_sendmsg+0x36/0x40 net/ipv4/tcp.c:1441 inet_sendmsg+0x99/0xe0 net/ipv4/af_inet.c:819 sock_sendmsg_nosec net/socket.c:704 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:724 sock_write_iter+0x289/0x3c0 net/socket.c:1057 call_write_iter include/linux/fs.h:2162 [inline] new_sync_write+0x429/0x660 fs/read_write.c:503 vfs_write+0x7cd/0xae0 fs/read_write.c:590 ksys_write+0x1ee/0x250 fs/read_write.c:643 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff88807f1cb700 which belongs to the cache ip_dst_cache of size 176 The buggy address is located 58 bytes inside of 176-byte region [ffff88807f1cb700, ffff88807f1cb7b0) The buggy address belongs to the page: page:ffffea0001fc72c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7f1cb flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 dead000000000100 dead000000000122 ffff8881413bb780 raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_HARDWALL), pid 5, ts 108466983062, free_ts 108048976062 prep_new_page mm/page_alloc.c:2418 [inline] get_page_from_freelist+0xa72/0x2f50 mm/page_alloc.c:4149 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5369 alloc_pages+0x1a7/0x300 mm/mempolicy.c:2191 alloc_slab_page mm/slub.c:1793 [inline] allocate_slab mm/slub.c:1930 [inline] new_slab+0x32d/0x4a0 mm/slub.c:1993 ___slab_alloc+0x918/0xfe0 mm/slub.c:3022 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3109 slab_alloc_node mm/slub.c:3200 [inline] slab_alloc mm/slub.c:3242 [inline] kmem_cache_alloc+0x35c/0x3a0 mm/slub.c:3247 dst_alloc+0x146/0x1f0 net/core/dst.c:92 rt_dst_alloc+0x73/0x430 net/ipv4/route.c:1613 __mkroute_output net/ipv4/route.c:2564 [inline] ip_route_output_key_hash_rcu+0x921/0x2d00 net/ipv4/route.c:2791 ip_route_output_key_hash+0x18b/0x300 net/ipv4/route.c:2619 __ip_route_output_key include/net/route.h:126 [inline] ip_route_output_flow+0x23/0x150 net/ipv4/route.c:2850 ip_route_output_key include/net/route.h:142 [inline] geneve_get_v4_rt+0x3a6/0x830 drivers/net/geneve.c:809 geneve_xmit_skb drivers/net/geneve.c:899 [inline] geneve_xmit+0xc4a/0x3540 drivers/net/geneve.c:1082 __netdev_start_xmit include/linux/netdevice.h:4994 [inline] netdev_start_xmit include/linux/netdevice.h:5008 [inline] xmit_one net/core/dev.c:3590 [inline] dev_hard_start_xmit+0x1eb/0x920 net/core/dev.c:3606 __dev_queue_xmit+0x299a/0x3650 net/core/dev.c:4229 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1338 [inline] free_pcp_prepare+0x374/0x870 mm/page_alloc.c:1389 free_unref_page_prepare mm/page_alloc.c:3309 [inline] free_unref_page+0x19/0x690 mm/page_alloc.c:3388 qlink_free mm/kasan/quarantine.c:146 [inline] qlist_free_all+0x5a/0xc0 mm/kasan/quarantine.c:165 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:272 __kasan_slab_alloc+0xa2/0xc0 mm/kasan/common.c:444 kasan_slab_alloc include/linux/kasan.h:259 [inline] slab_post_alloc_hook mm/slab.h:519 [inline] slab_alloc_node mm/slub.c:3234 [inline] kmem_cache_alloc_node+0x255/0x3f0 mm/slub.c:3270 __alloc_skb+0x215/0x340 net/core/skbuff.c:414 alloc_skb include/linux/skbuff.h:1126 [inline] alloc_skb_with_frags+0x93/0x620 net/core/skbuff.c:6078 sock_alloc_send_pskb+0x783/0x910 net/core/sock.c:2575 mld_newpack+0x1df/0x770 net/ipv6/mcast.c:1754 add_grhead+0x265/0x330 net/ipv6/mcast.c:1857 add_grec+0x1053/0x14e0 net/ipv6/mcast.c:1995 mld_send_initial_cr.part.0+0xf6/0x230 net/ipv6/mcast.c:2242 mld_send_initial_cr net/ipv6/mcast.c:1232 [inline] mld_dad_work+0x1d3/0x690 net/ipv6/mcast.c:2268 process_one_work+0x9b2/0x1690 kernel/workqueue.c:2298 worker_thread+0x658/0x11f0 kernel/workqueue.c:2445 Memory state around the buggy address: ffff88807f1cb600: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807f1cb680: fb fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc >ffff88807f1cb700: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88807f1cb780: fb fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc ffff88807f1cb800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb Fixes: 41063e9dd119 ("ipv4: Early TCP socket demux.") Signed-off-by: Eric Dumazet Link: https://lore.kernel.org/r/20211220143330.680945-1-eric.dumazet@gmail.com Signed-off-by: Jakub Kicinski [cmllamas: fixed trivial merge conflict] Signed-off-by: Carlos Llamas Signed-off-by: Greg Kroah-Hartman --- include/net/sock.h | 2 +- net/ipv4/af_inet.c | 2 +- net/ipv4/tcp.c | 3 +-- net/ipv4/tcp_input.c | 2 +- net/ipv4/tcp_ipv4.c | 11 +++++++---- net/ipv4/udp.c | 6 +++--- net/ipv6/tcp_ipv6.c | 11 +++++++---- net/ipv6/udp.c | 4 ++-- 8 files changed, 23 insertions(+), 18 deletions(-) --- a/include/net/sock.h +++ b/include/net/sock.h @@ -389,7 +389,7 @@ struct sock { #ifdef CONFIG_XFRM struct xfrm_policy __rcu *sk_policy[2]; #endif - struct dst_entry *sk_rx_dst; + struct dst_entry __rcu *sk_rx_dst; struct dst_entry __rcu *sk_dst_cache; atomic_t sk_omem_alloc; int sk_sndbuf; --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -156,7 +156,7 @@ void inet_sock_destruct(struct sock *sk) kfree(rcu_dereference_protected(inet->inet_opt, 1)); dst_release(rcu_dereference_check(sk->sk_dst_cache, 1)); - dst_release(sk->sk_rx_dst); + dst_release(rcu_dereference_protected(sk->sk_rx_dst, 1)); sk_refcnt_debug_dec(sk); } EXPORT_SYMBOL(inet_sock_destruct); --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -2385,8 +2385,7 @@ int tcp_disconnect(struct sock *sk, int tcp_init_send_head(sk); memset(&tp->rx_opt, 0, sizeof(tp->rx_opt)); __sk_dst_reset(sk); - dst_release(sk->sk_rx_dst); - sk->sk_rx_dst = NULL; + dst_release(xchg((__force struct dst_entry **)&sk->sk_rx_dst, NULL)); tcp_saved_syn_free(tp); tp->segs_in = 0; tp->segs_out = 0; --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -5452,7 +5452,7 @@ void tcp_rcv_established(struct sock *sk struct tcp_sock *tp = tcp_sk(sk); tcp_mstamp_refresh(tp); - if (unlikely(!sk->sk_rx_dst)) + if (unlikely(!rcu_access_pointer(sk->sk_rx_dst))) inet_csk(sk)->icsk_af_ops->sk_rx_dst_set(sk, skb); /* * Header prediction. --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -1473,15 +1473,18 @@ int tcp_v4_do_rcv(struct sock *sk, struc struct sock *rsk; if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */ - struct dst_entry *dst = sk->sk_rx_dst; + struct dst_entry *dst; + + dst = rcu_dereference_protected(sk->sk_rx_dst, + lockdep_sock_is_held(sk)); sock_rps_save_rxhash(sk, skb); sk_mark_napi_id(sk, skb); if (dst) { if (inet_sk(sk)->rx_dst_ifindex != skb->skb_iif || !dst->ops->check(dst, 0)) { + RCU_INIT_POINTER(sk->sk_rx_dst, NULL); dst_release(dst); - sk->sk_rx_dst = NULL; } } tcp_rcv_established(sk, skb, tcp_hdr(skb)); @@ -1556,7 +1559,7 @@ int tcp_v4_early_demux(struct sk_buff *s skb->sk = sk; skb->destructor = sock_edemux; if (sk_fullsock(sk)) { - struct dst_entry *dst = READ_ONCE(sk->sk_rx_dst); + struct dst_entry *dst = rcu_dereference(sk->sk_rx_dst); if (dst) dst = dst_check(dst, 0); @@ -1849,7 +1852,7 @@ void inet_sk_rx_dst_set(struct sock *sk, struct dst_entry *dst = skb_dst(skb); if (dst && dst_hold_safe(dst)) { - sk->sk_rx_dst = dst; + rcu_assign_pointer(sk->sk_rx_dst, dst); inet_sk(sk)->rx_dst_ifindex = skb->skb_iif; } } --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -1955,7 +1955,7 @@ bool udp_sk_rx_dst_set(struct sock *sk, struct dst_entry *old; if (dst_hold_safe(dst)) { - old = xchg(&sk->sk_rx_dst, dst); + old = xchg((__force struct dst_entry **)&sk->sk_rx_dst, dst); dst_release(old); return old != dst; } @@ -2145,7 +2145,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct dst_entry *dst = skb_dst(skb); int ret; - if (unlikely(sk->sk_rx_dst != dst)) + if (unlikely(rcu_dereference(sk->sk_rx_dst) != dst)) udp_sk_rx_dst_set(sk, dst); ret = udp_unicast_rcv_skb(sk, skb, uh); @@ -2303,7 +2303,7 @@ int udp_v4_early_demux(struct sk_buff *s skb->sk = sk; skb->destructor = sock_efree; - dst = READ_ONCE(sk->sk_rx_dst); + dst = rcu_dereference(sk->sk_rx_dst); if (dst) dst = dst_check(dst, 0); --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -95,7 +95,7 @@ static void inet6_sk_rx_dst_set(struct s if (dst && dst_hold_safe(dst)) { const struct rt6_info *rt = (const struct rt6_info *)dst; - sk->sk_rx_dst = dst; + rcu_assign_pointer(sk->sk_rx_dst, dst); inet_sk(sk)->rx_dst_ifindex = skb->skb_iif; inet6_sk(sk)->rx_dst_cookie = rt6_get_cookie(rt); } @@ -1318,15 +1318,18 @@ static int tcp_v6_do_rcv(struct sock *sk opt_skb = skb_clone(skb, sk_gfp_mask(sk, GFP_ATOMIC)); if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */ - struct dst_entry *dst = sk->sk_rx_dst; + struct dst_entry *dst; + + dst = rcu_dereference_protected(sk->sk_rx_dst, + lockdep_sock_is_held(sk)); sock_rps_save_rxhash(sk, skb); sk_mark_napi_id(sk, skb); if (dst) { if (inet_sk(sk)->rx_dst_ifindex != skb->skb_iif || dst->ops->check(dst, np->rx_dst_cookie) == NULL) { + RCU_INIT_POINTER(sk->sk_rx_dst, NULL); dst_release(dst); - sk->sk_rx_dst = NULL; } } @@ -1659,7 +1662,7 @@ static void tcp_v6_early_demux(struct sk skb->sk = sk; skb->destructor = sock_edemux; if (sk_fullsock(sk)) { - struct dst_entry *dst = READ_ONCE(sk->sk_rx_dst); + struct dst_entry *dst = rcu_dereference(sk->sk_rx_dst); if (dst) dst = dst_check(dst, inet6_sk(sk)->rx_dst_cookie); --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c @@ -848,7 +848,7 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct dst_entry *dst = skb_dst(skb); int ret; - if (unlikely(sk->sk_rx_dst != dst)) + if (unlikely(rcu_dereference(sk->sk_rx_dst) != dst)) udp6_sk_rx_dst_set(sk, dst); if (!uh->check && !udp_sk(sk)->no_check6_rx) { @@ -960,7 +960,7 @@ static void udp_v6_early_demux(struct sk skb->sk = sk; skb->destructor = sock_efree; - dst = READ_ONCE(sk->sk_rx_dst); + dst = rcu_dereference(sk->sk_rx_dst); if (dst) dst = dst_check(dst, inet6_sk(sk)->rx_dst_cookie); From patchwork Mon Oct 24 11:32:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8819 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431171wru; Mon, 24 Oct 2022 05:43:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7KYliljTeHum4n71encxorBF2XNRuIfO0C0hbzGMBaELN5nGTMvZ84Ht8He+bmDv/v/WY8 X-Received: by 2002:a17:902:c612:b0:186:8376:208d with SMTP id r18-20020a170902c61200b001868376208dmr15132449plr.89.1666615388530; Mon, 24 Oct 2022 05:43:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615388; cv=none; d=google.com; s=arc-20160816; b=DbsdwkArHJtza5ve1n5SdnmwpU+fG63JJFa2fWkkU9pGXyFbkK60/oPb+SC6tm5niF ZeVZI1d437Qt9WsFHxnsYjkDjKshP8PuLobfzbunOrh/jdQ5jTYdLZUT4wEEm4ZBLuHB vei4CdWEHiDNWHmSbJar8M/vMqycjL3o8+lvZpf60uIYJ1yZxivt3Wqo7+wo7OJ2sHFt QY1cdVStpTGVrNzLS2+erjnA1bI6gVWZiEPj/oQkYPghGjd4ptafaIPPy5x0u97zJHk6 kU0xKU+hKwIVJqGjAztRlzD8cI6ou40D0ZiVGjDVUOzLe9b0/QSfDaIR+tlSdzE+pZms 3mUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NGQPDhb7x7+wydTtcZFehZh80yJnk0tehq4AXLIshBE=; b=pCaGuvhQ296CV6VakwuOy/5hC3ikdheyPpp1LivDvQWUFZFhrDj/BO4f+9mpA7HZfE NglXbVKLQtJKIAOTdoc7NBSvL9DhTplK7ieuWEO2j2gVi2Z2jEOmNGArJZPMZbw7EG8V f6jQvRG4aU0U+OurMPmIKnmq71P/plbMLvXshdshVd5WtQBDmoT8a8nw83w1l8y4d/DN +smJgcerLPQXnLQhiWShzCgDeL+Gl7/G5TxOcQcEbuhoS7ASqyM+RNW786bbfPJY9ECF LCmqz8+3qy2jyIxeUA6RLbnM60TDpfbhNAFiTAD4UT02T4sE0hSOWP6wkXvMSfHzFwdL WATA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IuO43QW+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f7-20020a056a0022c700b00537e88da121si37150490pfj.35.2022.10.24.05.42.51; Mon, 24 Oct 2022 05:43:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IuO43QW+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231955AbiJXMcn (ORCPT + 99 others); Mon, 24 Oct 2022 08:32:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233983AbiJXM3I (ORCPT ); Mon, 24 Oct 2022 08:29:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77CF387FB0; Mon, 24 Oct 2022 05:03:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6E680612DA; Mon, 24 Oct 2022 11:54:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83682C433D6; Mon, 24 Oct 2022 11:54:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612467; bh=jUlYH+CCO+C1GozJgPk99oAfl+QuIg9M6++iiseMq9I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IuO43QW+vapaFCju19mj4ZC+60gSwnyTJz7u9Ep5bG0FGwcecTTUwt+Sbm3KurU8c FRdC6Kz/AYc/IBLplKIdWwiqkUH1EWG57NnWedCOywFWeR3RIdT7rBN7F6iBqpmDiB YD+XDzQK0wR0NJj7WYJHoaNj8Vv0+zC41wDd1C9U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Rafael J. Wysocki" , Chen Yu Subject: [PATCH 4.14 210/210] thermal: intel_powerclamp: Use first online CPU as control_cpu Date: Mon, 24 Oct 2022 13:32:07 +0200 Message-Id: <20221024113003.827869862@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572897373556741?= X-GMAIL-MSGID: =?utf-8?q?1747572897373556741?= From: Rafael J. Wysocki commit 4bb7f6c2781e46fc5bd00475a66df2ea30ef330d upstream. Commit 68b99e94a4a2 ("thermal: intel_powerclamp: Use get_cpu() instead of smp_processor_id() to avoid crash") fixed an issue related to using smp_processor_id() in preemptible context by replacing it with a pair of get_cpu()/put_cpu(), but what is needed there really is any online CPU and not necessarily the one currently running the code. Arguably, getting the one that's running the code in there is confusing. For this reason, simply give the control CPU role to the first online one which automatically will be CPU0 if it is online, so one check can be dropped from the code for an added benefit. Link: https://lore.kernel.org/linux-pm/20221011113646.GA12080@duo.ucw.cz/ Fixes: 68b99e94a4a2 ("thermal: intel_powerclamp: Use get_cpu() instead of smp_processor_id() to avoid crash") Signed-off-by: Rafael J. Wysocki Reviewed-by: Chen Yu Signed-off-by: Greg Kroah-Hartman --- drivers/thermal/intel_powerclamp.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) --- a/drivers/thermal/intel_powerclamp.c +++ b/drivers/thermal/intel_powerclamp.c @@ -549,11 +549,7 @@ static int start_power_clamp(void) get_online_cpus(); /* prefer BSP */ - control_cpu = 0; - if (!cpu_online(control_cpu)) { - control_cpu = get_cpu(); - put_cpu(); - } + control_cpu = cpumask_first(cpu_online_mask); clamping = true; schedule_delayed_work(&poll_pkg_cstate_work, 0);