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: 8505 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp405074wru; Mon, 24 Oct 2022 04:56:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4X80JTsIguH2accxSg1s5WpbhN00u/Sc9hZD4Jgf+dgBvfTCtkWTGC0z8gE4Ki8UyzMN39 X-Received: by 2002:a17:902:d884:b0:186:5a29:2a9 with SMTP id b4-20020a170902d88400b001865a2902a9mr26141802plz.43.1666612578500; Mon, 24 Oct 2022 04:56:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612578; cv=none; d=google.com; s=arc-20160816; b=J39kdZ0RsU1uHNIpQ20rfAHoobcTwxCN7juC95RjzVAJFHaBhVa9uxtCC5txaiN2NM TPoG30InB8DXYn99HnLyhcNL8GbR4sux7C5/H5VNnkDWqcjuJp11FUePuQEfMBOrBSIC RnbuHhbqUF8fPbbH1TqYH6S7twL/euABJolJPWJGKCf4k/2D8Q9N0PhWFZMiALcABwYF 4kToRrxzYK9pmARrXyL99glwt8Gtt44fwMXtvO6zvp4Rtb02fQ/wmLqMrUhZX6Vnf3Pa 6+Raw7bXRS2p2b2H9SNK0wTLXSa6ihuzmP47u8pvN6ud3WnHk9t1hCv8dE8qMADo+EMd U88g== 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=Z4y1g4bAXhv/v2KjO0yY4ZW5c45/BUqPw93zd54BIH0=; b=am+0251uVxaAGIfgm1aEbIrgtUGWlqIfZH6n8krEpMyPqFGr+3nrRf0xvn8mUorbtq Yy0tIXUIREh8j8HKZKyLzE4oJ1A5CJBhJEDbVSwzm6KOX7l+MOvADRQhpapmDBV1BOkF 5LyE4/R48nnUZeB43V0NlDMtnFjIWTt0PQ5pvW2lIDAk03qF3WqjBLf7p+nJMBVg6gED uOCwLMRZtDfweVP1jTFphp34sj+5R5cEnOby2BCOmsXVZNVysPDdHNLjd04xhKlOMKGP 0LaP7FvahGGdyThEH4MtTzInt+OwPGBqeRfDHEDr8wfprC1e3Rap8vKh3z4ds+9k52MH wWxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LtOmlcBE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 lb1-20020a17090b4a4100b0020d4f2e056csi17444040pjb.151.2022.10.24.04.56.05; Mon, 24 Oct 2022 04:56: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=LtOmlcBE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232179AbiJXLzo (ORCPT + 99 others); Mon, 24 Oct 2022 07:55:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232176AbiJXLyD (ORCPT ); Mon, 24 Oct 2022 07:54:03 -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 188C16334D; Mon, 24 Oct 2022 04:45: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 ams.source.kernel.org (Postfix) with ESMTPS id 5F607B81147; Mon, 24 Oct 2022 11:38:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B468AC433C1; Mon, 24 Oct 2022 11:38:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611532; bh=CycjQiISUWXVWCBwpV+8GOMipnieADYN96PZP87ylE4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LtOmlcBEP3HGjB5AiaK6ZkSRYScOX4ykwRFza0OY+HkmbTot19QxsCiTyFFKAaMlF o12g3YO1vpLnlI/IIm5oRZnqSdfrJYG+zsigO2sLIohk7zp8DYwRIN33GP8iHbC3Ke +o978Pylb5T4LxM7HUzH+Y/Hrgt2MZ1oYgrBik58= 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.9 002/159] usb-storage: Add Hiksemi USB3-FW to IGNORE_UAS Date: Mon, 24 Oct 2022 13:29:16 +0200 Message-Id: <20221024112949.441068016@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569951149794786?= X-GMAIL-MSGID: =?utf-8?q?1747569951149794786?= 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 @@ -149,6 +149,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: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: 8412 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp400159wru; Mon, 24 Oct 2022 04:46:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6nmjvkeKo/Sgc+qtofQ9ZkqNsKYs4T0TXtGsUO0aWqwzT44abqljxRGMLrUFWW/TlZWyaG X-Received: by 2002:a17:907:1c01:b0:78d:eb6e:3807 with SMTP id nc1-20020a1709071c0100b0078deb6e3807mr27235369ejc.481.1666611988524; Mon, 24 Oct 2022 04:46:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666611988; cv=none; d=google.com; s=arc-20160816; b=G1tCJlTDbAyMCjev1bz7D4/UQlbvHyorcCjFUmOdUarYvVVVhLSr42sSLvu6bnSGvH cfoOClPJJl5nXDYfKUR734iTtfcfgr0GjUh94ZdxosvJLdvOL4+LE8EOYampVSel9INZ FBDIFj27kcYCdYnRFOxXUlVGKEHmp1UBLyzbv3TWawsxpxLK9BGbJdb+XnE6ZcJUZC6w HugT/SnDUHHgJ9xdQqNKndMkclMI7GMftxADWjaU3UkX2iCGFZu5BXubwfU39PEQHYN7 KOFpni9vl2tdi7gtWUHGKjhFAFa8aeztbgqgIqOL5WjuHKQW4isD9SFMCMhKVoDQ9w19 O5TQ== 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=Ikl1L+/Iyp7qU8M2uU+oxDP3JAf9IWpvIt/4fmdtCTw=; b=Wknxr12vKKixl+63yOFZxyuXAdbhz5nRr05RB0ocC0InQ4j8XSfhPG2/PBnMssI8oW akUemUePqLf7T584npC9LsacJb/f2a2WfvmVeXUTVList8+YwpP1Rpy9gs8pUDj70fie jDG7l+QQs9FE0r60EhLJOk4fbPu8ZqGT/KmaFLY6jsaORO+4Nek8s/4eUuDOKBxiWv1V oWvcCvwtLFONCRLAGqdsnepD0naUF8bG5rm9RW4z8TpWMwrMHSWgJpdek7AUtoH4Xhk3 00Ii4OA24thRK0/5wZ7TP07qYYy9/RYMnTHC0bzgFYFQr6ewbMSGDNgStiL/clIHbOPM 1gPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZQchmsv8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 ml21-20020a170906cc1500b007a1d4f0e7fcsi5812809ejb.655.2022.10.24.04.46.04; Mon, 24 Oct 2022 04:46: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=ZQchmsv8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231470AbiJXLpc (ORCPT + 99 others); Mon, 24 Oct 2022 07:45:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231547AbiJXLn7 (ORCPT ); Mon, 24 Oct 2022 07:43:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EE5F72EE6; Mon, 24 Oct 2022 04:41: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 63AA861269; Mon, 24 Oct 2022 11:38:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 783E7C433C1; Mon, 24 Oct 2022 11:38:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611534; bh=0AuyllYZlLRotjtidRW8mqdtseZlGF9ZjfVRkz43LCk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZQchmsv8kep718eXb3ifsyoTImF0CQq2iGinM/ratv5SFTjP/I9YWwBCzF7sx3cM+ XklZmbO6z+yA5P4UDlg9zFSxymPAflcvRMRikrgYGNEP6onB0hkeBK7UWP2rapge1+ ympP0Mslcq+/5LNd0LX4/8u+2q7I/jRoH2xYxwfQ= 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.9 003/159] uas: ignore UAS for Thinkplus chips Date: Mon, 24 Oct 2022 13:29:17 +0200 Message-Id: <20221024112949.481436244@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569332490642892?= X-GMAIL-MSGID: =?utf-8?q?1747569332490642892?= 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 @@ -198,6 +198,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:29:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8410 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp400114wru; Mon, 24 Oct 2022 04:46:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7ucvNemV3YlEx8eCwxec9mkESDQgohj12kPaBhtJ1RkftR+dxLq+qRjp/qwWjpWwQFDIiu X-Received: by 2002:a17:907:78a:b0:78d:9ac7:b697 with SMTP id xd10-20020a170907078a00b0078d9ac7b697mr26680355ejb.457.1666611980820; Mon, 24 Oct 2022 04:46:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666611980; cv=none; d=google.com; s=arc-20160816; b=b5A56q6KvJUsPkFQ4JW5OzspDz96Vm+YApKrGiXmCykM2nwNQY1vHKE8p7GI3UyLcv WERUz6lw2XgcEK+KLLQIi4esyaSMaSHvT+jQST7LQUoKQkUxQXCnNgbWdPHK9aOy2fdb Q1YdCGf2c5VSqiPrdL87BP7T04ngSttXp7Opa8HqBPETSZR4qEUxz6WWqYka7CMFn63U nxGaH+CY+Z5bfEBL6GhoAF/GaNfZYlG9+9q0G111FUw5QrEGBeJq3gis35/dGTFGOtWn yez9to7aHvwARoreI7ToDnhELBEzNeWostIoboHMy3s9BZiFIl5shWl5v4TnP7f7PsBq +XHw== 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=mo4CFUalX0fZmUqrKLCzxfPisaTar5Epse24BaJJAeQ=; b=Uzt3Jk/uQo3UDAI2OrA4r3uwlR0Y7SCZeKC/bPARUXGPLYW1RH4PqA8rk2IunTptvq VQGXkLwuPWsJmqW6YXc9yrpyM3Rghtt35ywHJwAQDkyI8gye7TklkWspCwJ3PLzgnXOM tk7ZWQSws+LyRUEQ3MHLlWxpvZ9EhrsTh3Agalms03EKr1xlJ8+XbVyuhRmRwVNtlTHV 6Hfrz2icWgvEA2aL6DfcVbj1ojgcTlldWbQ+jLJxme2CdwubGCPjyxor6Ls+k093ZLUQ 4J0pkD3C7JTm8ch5Y/bebeHqV7FUYFZ6BlzNc+1PJ9UufU/lG8mWRt3r81xHHq0UOoxP +DBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0gnxS6m7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 xj9-20020a170906db0900b007a7424836d5si3630949ejb.234.2022.10.24.04.45.56; Mon, 24 Oct 2022 04:46: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=0gnxS6m7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230093AbiJXLpH (ORCPT + 99 others); Mon, 24 Oct 2022 07:45:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231491AbiJXLnv (ORCPT ); Mon, 24 Oct 2022 07:43:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04BB2722AE; Mon, 24 Oct 2022 04:41: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 E2D53B8114B; Mon, 24 Oct 2022 11:38:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CBC9C433C1; Mon, 24 Oct 2022 11:38:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611537; bh=CGBcvrQd/p0n6IUwX80bJdyxLJsrY696W1INoFA4j84=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0gnxS6m7c23VYeF+/Fv7gBDNIpPS/L+hAZDAvoeIRDx9YgWr8eKEl/B+kHwrMQNZb f8l+Iu5Dl9kZMZTs8TJluj8m/nKSgJseQbJULHTPvo+DkW5YzfNBDV5BEjgi8FjUQZ jgdqJnPnJvy1ANMdCmzBJ8aXbS02wu8kRO6WbhO4= 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.9 004/159] net: usb: qmi_wwan: Add new usb-id for Dell branded EM7455 Date: Mon, 24 Oct 2022 13:29:18 +0200 Message-Id: <20221024112949.530220698@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569324669417724?= X-GMAIL-MSGID: =?utf-8?q?1747569324669417724?= 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 @@ -966,6 +966,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: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: 8418 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp400344wru; Mon, 24 Oct 2022 04:46:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6VFffwG4VqcywIz/sCPehw4K+olppSZDoet+PPTR3/XH/pirVE8D68PCzNz2hhkWz81X+t X-Received: by 2002:a05:6402:144a:b0:461:8e34:d07b with SMTP id d10-20020a056402144a00b004618e34d07bmr9345340edx.426.1666612017407; Mon, 24 Oct 2022 04:46:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612017; cv=none; d=google.com; s=arc-20160816; b=Y20k+3jnRsBn15ev5DAU/EbeAiqYjbo5WMdJ1qSkgusG0Ug+urpG/HCuq1Snkfwr+B R2HYiIUcbdnp/cfR1KQUHpgcPe5XCVlp7X4dKNa4iOEv9pIYAZvODHYxu049xi2ymLXa aNE/4ui1Dv3F66ym4UAPAAecRuLvoqF0GtKY8PZCNDPzgH81v/ojy/bThdc6M4qBDIxu I/POy8FhIdfcx7sadgf3WvIUdjf8mo/nR0bBqgQnAHIyzxiH/D41FIazKRVG3SIZ3hcr uoaZvZY2+tiK1WernqWtJWueTnBgu6R+dHJu75miayCWMBly17SSMbF08bUha/7OKvCK mOuQ== 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=/CwINnO6kkuCU/+NvgukRUPTcsftgoURdE1JZc0rRgo=; b=rZYefbUsGvc+1wk+RhcTcP7WCuFbUPZl7Axonbe9M2cVyfHxAWOmu7e4Mf0S74qDRL PYZ1Jfcqzxe6fguTP3+yZN+3GVX6gx/PfKV262YbfYlWWUgQjUgiu/CxwN7/driAuAjM 0jtsTS9/nxvq6oWoXLlLQcrq3NeD3Usnho+e8cmzVDMNPZI+cI0xhAhtg2QH6jI8IrEk fUxG4h43OM7pRDN9nbS2M8jFCuI5QKxNdwHXtZnAmCX6YTvA4CMYOBNRbSR2IWxK5gcI 3OC8fXB8yz49Vk/H4bdutWQgz4LpoJ6bu96O8lWHIKqstm/UU3/S9n9/xTt0zhfbOPf1 bMwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tMC+rg2r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 hc32-20020a17090716a000b0078ddd8656d9si28318189ejc.9.2022.10.24.04.46.34; Mon, 24 Oct 2022 04:46: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=tMC+rg2r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231246AbiJXLnd (ORCPT + 99 others); Mon, 24 Oct 2022 07:43:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231419AbiJXLnM (ORCPT ); Mon, 24 Oct 2022 07:43:12 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9728D481E4; Mon, 24 Oct 2022 04:40: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 sin.source.kernel.org (Postfix) with ESMTPS id E26DACE1316; Mon, 24 Oct 2022 11:39:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8541C433D6; Mon, 24 Oct 2022 11:38:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611540; bh=2wJzM/OpT+moIcK13Z8XJcyYyeF+rkw2CkY7TGKvMG4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tMC+rg2rpUtig8/KWYN6KytYmwXQ42EsJVecrk4aI7epXH4eh4DXPFm71PETqF8BZ SxxO6YzfdbntjGTSq8qjoXkv74Cv4hux5O8wFZSHsHk6Ye/5PfAcxQT0pzg+F8pgFC 8m0jFanwdXQizg4ZrRL0qquEbO1rOSh84m4U2Y2s= 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.9 005/159] ntfs: fix BUG_ON in ntfs_lookup_inode_by_name() Date: Mon, 24 Oct 2022 13:29:19 +0200 Message-Id: <20221024112949.566093029@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569362822376328?= X-GMAIL-MSGID: =?utf-8?q?1747569362822376328?= 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 @@ -2108,7 +2108,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: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: 8409 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp400090wru; Mon, 24 Oct 2022 04:46:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4M1kicSHvaWevPHfjwtgoydlVKzSxCeq7DeI27+l2TFk+V8hxQWnj+0SzbqFAUY+5I5QK2 X-Received: by 2002:a17:907:97c3:b0:79b:3f8d:a354 with SMTP id js3-20020a17090797c300b0079b3f8da354mr14079497ejc.461.1666611976802; Mon, 24 Oct 2022 04:46:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666611976; cv=none; d=google.com; s=arc-20160816; b=h/7/RT42h2zJzEdoWEID/5WaGpyE3dB8Qi+lc98NvujGwn2wpPcdMb02rAM6fEqxMx zM92qFIlC2PyDYUi5IlVPsB0kZvgYS6Q3gSoNJAtwtG6vo+76hSZ8G464NhNSTsKwpmn XB3jaYAO/fTq7HmDhNagZ5C22nRt1CLU3IkKlewrKANErcENVWaFJsMJMdudfT72k+BP 3d9hQJPjL2/4h2M9kOYl4xm/jlWchAfKIwimJDveFQOmJZLvztUqgw5a/dUogfJLsaMc F/kYC1aFpccGLf37WGBCryCZsPt4o09JBV4j/LoNbbvWC49l2zxcy5Y8rqgiWHqkeH9/ aLvw== 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=zxHWiFF2D+QcxEpX9wVlDThG/Iu9gilWkd5RFeJOVl8=; b=uM/WIpjjQ2mC2KLo/EWSLoPn/nDIMuWhN+DZ4IzeBglezWj9KeXebtnfcsJM5f0pJT C3/hmZo+tDraegK8WSMNVK/a3C79WlZJvnRz1WS7+zdxkOi11lJnoxpVlfbH4J/Ivh8T 7rwaplnd0r5hUN7UGUiS7QXzL+r5bQl5y7QqIO4tuv6tI+PBDIqDs0wBK6U1+6/Jr458 CQZWxgjmD/eK7yMz3hsu/VClVGjqUZdSQIIHiI9YZNrZU7BxHsgVSj7LR4DKUrYzW8KJ OvpKbTPM+b8HJwkkgInOk7BBJ0ZCQqhMaQ+tfMyVoMAVuP48ZutJB/r91A9TWPXTDMfn XGsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pNWea4CP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 2-20020a508e02000000b00460ce6c3a1asi10997631edw.454.2022.10.24.04.45.53; Mon, 24 Oct 2022 04:46: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=pNWea4CP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231450AbiJXLpW (ORCPT + 99 others); Mon, 24 Oct 2022 07:45:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231549AbiJXLn7 (ORCPT ); Mon, 24 Oct 2022 07:43:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A244871989; Mon, 24 Oct 2022 04:41: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 75B206127C; Mon, 24 Oct 2022 11:39:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86EC2C433D7; Mon, 24 Oct 2022 11:39:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611542; bh=X+j2w1ZK+eto3zhhvWVEinzAqML9IWon1wYQ/a8AxZs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pNWea4CPCCIeHz9KB+Iuuf0FqyfqpGUiD3SGFczvF8URbxS8NefOeFMcDLWheioBc 4c5/nARgINm6oLH9l8Q05eI8jxZ3+RvzJmVPpViavp2gvh0acNh7EiGh7fuFwgz85q Dj4NKuYZD41ViNPzWC8Ax7aSvTvc+Pb+PgPvSKBw= 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.9 006/159] mmc: moxart: fix 4-bit bus width and remove 8-bit bus width Date: Mon, 24 Oct 2022 13:29:20 +0200 Message-Id: <20221024112949.597564194@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569320163726186?= X-GMAIL-MSGID: =?utf-8?q?1747569320163726186?= 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 @@ -529,9 +529,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; @@ -648,16 +645,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: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: 8419 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp400367wru; Mon, 24 Oct 2022 04:47:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7qP5TRTF7UZa27OZ3pb98Svy/L6Pv28NCqy1QxvHR2Yw4e1BCs9PmcaJuqGGEQznHDxJr0 X-Received: by 2002:a17:907:2d91:b0:78d:8747:71b4 with SMTP id gt17-20020a1709072d9100b0078d874771b4mr27231797ejc.545.1666612020349; Mon, 24 Oct 2022 04:47:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612020; cv=none; d=google.com; s=arc-20160816; b=qKdXUXVzmIJ27fNj+LNB0QQF1UdFt5XTYuZGHZCsPEVbRkRu2dFSxY0kK3XtpAlYX/ CECwYTCPpe5KQvukZAK/zf1BciBhvmFehIVRIbBzLjA/Qfc/oD+dZM1rOM8jLRauT6uD No+IQjQHajqdZX2R3BAf21kIYzOO501J3ARA+DYts2neTFcntQ7KSMjX9yZxMvJ/PvU0 Mhk1Z2TUSLqzjTR1EUXQ/90KZHTOVlBflS4ZeykxG7xXlZeNtvHR66XG2uHP73aIfMbB WlYwwJejHPE4KFZXBnfcIQsVjpBYALKETdzUtfxxgECBfBVd5WXY+AYU3RIPxt3LtbVe kcIg== 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=z2Skj2vkVLCB9W18JinorXAb8uA8mx6NNxYygaa3+rk=; b=gGaJm9+hoJ8dANM4vdl4FJ2Y4DAqBJ3wAOJl8jhtzyPP+OKmjCD1dge+zFBR+kDQYy WVaLdDBHH694Km9ccG94K4JQduZojfVGJdsqRfjw+enRiy+Pu06zW52jIab7vyobQeuY zjpVhtI8fVUOs1w3F8sY1QihNXGRbzbIGqKhbSEPWzsrCIrrtNiV9Ut9m0mBm9AsNWBK e1uute83FGs28gR8GM8nX1RToinBUgXAqvBbXp+lYSZWl+8/9yqUabu9sDS2dcuEc104 tsC7v/mQTSP6C99RXO/H9VNi0ir7n2SEk/cMBwJ2wB/OT2Lc6Hb1yTCUOwN4aZXJn6z+ jB3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mIWd6O4X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 s19-20020a056402015300b004597b778b3bsi23586099edu.75.2022.10.24.04.46.36; Mon, 24 Oct 2022 04:47: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=mIWd6O4X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231202AbiJXLqG (ORCPT + 99 others); Mon, 24 Oct 2022 07:46:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231686AbiJXLoP (ORCPT ); Mon, 24 Oct 2022 07:44: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 4F5BA72FD1; Mon, 24 Oct 2022 04:41: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 C42ADB81145; Mon, 24 Oct 2022 11:39:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28F0FC433D6; Mon, 24 Oct 2022 11:39:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611545; bh=obetr8wuqaOqOKyX/zRzc+21RtJy+aLxcpblzYfxrQE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mIWd6O4XQ4EkmSUBoH98VoL+Gj96ayNIJuMA3R9rHIUwmgwKaIqslOlzgCzSo5YSv EwnG83vOjAMrnOE/nPsoulCp1w5ioRv4DJTpNFwYxgfFMTtJAXEPeOHaPWQO67rYY0 B/Hm0OtFTyFh+Tw78HvQdXMUlqr6rZZTnNDFxU84= 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.9 007/159] mm: prevent page_frag_alloc() from corrupting the memory Date: Mon, 24 Oct 2022 13:29:21 +0200 Message-Id: <20221024112949.627999696@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569365732403837?= X-GMAIL-MSGID: =?utf-8?q?1747569365732403837?= 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 @@ -3987,6 +3987,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: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: 8423 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp400528wru; Mon, 24 Oct 2022 04:47:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5POBerIHVeM5DRcOqTeQKNRSS9yegx7BMrtNw4wvv9qYOSnjURBS/3kGBwIWz2TJCSIBAE X-Received: by 2002:a50:ff13:0:b0:43e:76d3:63e1 with SMTP id a19-20020a50ff13000000b0043e76d363e1mr30275266edu.271.1666612038762; Mon, 24 Oct 2022 04:47:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612038; cv=none; d=google.com; s=arc-20160816; b=aJBRk59FrxKr+AicuVxMHwj/PhYPz9kevRwfN1Mj9nkO49n3Hu0pmETjbd/pPRX6tS TqjPMxMg6H8pevDGqzOI4dn0Q/gVdDRAJhyu67xmBonzkdhU/bLU5SEIZWo3kG5hciZR ynGYPZEVYHe6e49V1Fz6PX5x4fKOsgQgS4XSQKUeZ7fi7ktQLDlskGGvxQaaIFqClohX ElCfpb3Nf3IYfnqHvtE4lMb+OTFgxLw1Bq/Bbvy0ipYWJcNMViViHsrwLTm9MmE6BOMk 11Q7rOI8naaCpUZsck4V7/PF0A+8Uv9kZtxIc1ElcnzsJC9qUAOpm0PLldNZ8e1AEYsm SqtA== 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=UgWXfxKnyobJyDcN47zVglgbJWmFRWSj7fGr5/CtvBw=; b=xalyrD+xPasa5ZsfFh1PSKs4LL1sfxT2Hz099Y701ew3f4U/j4PYAHPX0s0lgXUqEZ bddCChf8z2sSh+kCqGCiapaSYY7w4Tv3mFJGnwot9j6XxnIWBxuSUigloTzyi9kR7eRB XqiR5PDa3qIn3Zv6AMB0YQJTQJI+xyuBHW2+jmOlR/NicjCS1qwPJ6e2aa1kW5G8Pl6P 92cqJgej5eowyvyaRuZGwdmM2G5+FWIl8YuF2uM6IGN8ppwEOlPJJUahgw7SrqkzT+35 +VpJL48nPVEzfiYyy8mmMmoWfJV4KRkqBPLQLKh71eVbVe2R7zIgwFj8keNd0ZIgm8wl criA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sg0ViGT+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 s9-20020a508d09000000b004591f959c3bsi24842374eds.427.2022.10.24.04.46.54; Mon, 24 Oct 2022 04:47: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=sg0ViGT+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231603AbiJXLqY (ORCPT + 99 others); Mon, 24 Oct 2022 07:46:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231793AbiJXLoa (ORCPT ); Mon, 24 Oct 2022 07:44:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53837753BD; Mon, 24 Oct 2022 04:42: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 D2D0661277; Mon, 24 Oct 2022 11:39:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1A19C433D6; Mon, 24 Oct 2022 11:39:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611548; bh=M+QYpG+luzN26Gb8SjLVRiKLJ1L0PZhBIsKY5yLCFg4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sg0ViGT+ndehrNB+DKa1uDYThb3J3pqzU1plJOzJB5g9maAVCKYf1Cc4K3+W+2YP2 qjnSyqP0VpNSGoHDHq+pql+sYZBmA4Bcda7djAabQpGi//iudpc/UwOSuooDqOLCZ1 6fyZ19GakLXIrTMA1sWHQ0li0lTzStliHesahuSM= 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.9 008/159] Revert "drm: bridge: analogix/dp: add panel prepare/unprepare in suspend/resume time" Date: Mon, 24 Oct 2022 13:29:22 +0200 Message-Id: <20221024112949.663627799@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569385334688298?= X-GMAIL-MSGID: =?utf-8?q?1747569385334688298?= 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 d1077a342f38..7c683245bdc0 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -1463,12 +1463,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); @@ -1484,13 +1478,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:29: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: 9639 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp532677wru; Mon, 24 Oct 2022 09:08:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Z6BG+M9J2TnC0tg/gJMHQqDsBzLhDlAgsOxJm93NMaJRUMostmm0Rl08xnWf7cRxG3KV1 X-Received: by 2002:a17:906:7314:b0:791:a45a:bc84 with SMTP id di20-20020a170906731400b00791a45abc84mr26792121ejc.394.1666627705419; Mon, 24 Oct 2022 09:08:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627705; cv=none; d=google.com; s=arc-20160816; b=dW3ieUXG6LKKXoNGHL35kqSwVFGB42OhYM6jN4ZxpR0GOsxYtLjp3hrimodXsEQ17F b10jABo+pwlq88rPHYceLNS6/5+1CboMabwa47dbFhX8KncogJmvuH+1sNQEkni2b68O vGQV6xi5gWubWqInWIHfSJhLBrznNla2Dz80dHFCxhT2EypCpmaxwwLDBoBwmdYTTw36 9mYOjquQXNnKCcMMhX2RVdKxND2UkGbGRP2NWn/CK0J6nVMs6FeLE+kRxBIUrgKmBVIC TOsemfDtVnTlLiOBKLfRvDp12RKDWzVkKGjTBIERKSpreL5tRnhKGZYnH05m6wi3ky5h rzRw== 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=Sz1b6S2pVLCUqRoM12hcVgNtfau1RcxycjRWT1cik2M=; b=v8SQ1tM1JGe/IJ2XVnoOP+Kyv9gRjrlsbXCLrToyXYhde5uD/zS/QUeRX7YEU6SlfF MQ+aciqEAX6a2Ycb+EUbRr4LhWiLrj2ZsEqy/2vzBd88qjGUofrQ2PR+ILR3mmk6O8nM jDMVx0crcQ/pwr6U4zXveu+ym42vK7PJO1APIzjuL84NlIzxKheIxZLNJCJcbuJqMnVy GrbIIbjy6IZjo4/iXLjKJ2SUNQDdx00i714lkbVVi8jzzNzxd0MINJPIN7sMZ6HQv/+c XC8poPKfvCffERsCGKlAetVAwBOiz7iWlGcf1vRkUfpSFR29U6m0GT4VMJjP6HyMfojK VZSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=p68hk6mj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 rk20-20020a170907215400b0078d3b940ec5si134688ejb.373.2022.10.24.09.07.59; Mon, 24 Oct 2022 09:08: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=p68hk6mj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232674AbiJXQHU (ORCPT + 99 others); Mon, 24 Oct 2022 12:07:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233170AbiJXQES (ORCPT ); Mon, 24 Oct 2022 12:04:18 -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 AF96711D983; Mon, 24 Oct 2022 07:56: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 291C3B8114D; Mon, 24 Oct 2022 11:39:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8474AC433D6; Mon, 24 Oct 2022 11:39:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611550; bh=Knoyj2ev+3EeXZB1JZ1QQ9InFBfJAJbjg7VhFi59HoM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p68hk6mjYgufP0VS+B+7ek1HZ6yXFPLBD3hb4dyszigSbu6huv1ItI7CJVAASNbTM nkFw6b6jzJsYK5rWaAx2xUX+o17RHdioKk+heOlalVRBWDmbRuHdd7aBUiT+q62Rz4 mbcmXhbAhgxD3lQ7jWQZk74ULVxnUIZMj9RzEiQc= 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.9 009/159] Input: melfas_mip4 - fix return value check in mip4_probe() Date: Mon, 24 Oct 2022 13:29:23 +0200 Message-Id: <20221024112949.703648319@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747585812847167057?= X-GMAIL-MSGID: =?utf-8?q?1747585812847167057?= 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 552a3773f79d..cec2df449f89 100644 --- a/drivers/input/touchscreen/melfas_mip4.c +++ b/drivers/input/touchscreen/melfas_mip4.c @@ -1416,7 +1416,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: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: 8405 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp399797wru; Mon, 24 Oct 2022 04:45:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6NqLpxHhMjqBQF+/cXW+fNjFdn/6iEQJ2j66/SAJTr/d4OHyld0dwYtYXCq9AARE8+nNbs X-Received: by 2002:a17:907:75c6:b0:79c:d3f4:4a14 with SMTP id jl6-20020a17090775c600b0079cd3f44a14mr13512383ejc.61.1666611929217; Mon, 24 Oct 2022 04:45:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666611929; cv=none; d=google.com; s=arc-20160816; b=K6bjxhW4kfJ/kZ2lSXcAV59LuZFLyYusHDDoGgjes1pBomQ+7p4rkV7vszrGHbjIzv B6A3xNdwFWtsUelSp0dEcuSvRjuM7yzEkmtRDCBmZYwKqV5SSyaZzlSGRDrYPGOg+P2a 9aXWDMPdJem2rxLY2F+UehQbhuApThAXBipnyp1TGGJYVZtEloqXqRGNJ/DAqdpteg8T yy4HolR9xU9NZE/jV/5yYuixDFuccKKvSyl3BG3sZ7aeM/SvPHyeD+p945ieLQXNhJsb snYi4vtXWM5xwqtRxAuhR7E458TU8Djh8AEk9cr6yJzd6To8VeyY+UPSCN5cuR/p+H7D LwWA== 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=bdtv6/7REeqIebRDydbhyueJB+BKuVntAXjeFO6V7Es=; b=QmKKDBIEY4ERkGIRYsndkbLGHgctz8rFaiTvsjaryuKYMUW2ntTih8fBeWfIIu4/cY MzhehYXsh2FSip12/EsdYrI3oHa/9wwZyYSczj2igT+1OxM4S/q+thcAO01sjK9ZnLnf +kjwIm6gfpjXSF5xjR52ONNEoUFcAdvGzTbjSehPuPqDlDBmLtDYKJU+3nHjl4a1yYkN DjkP17B8XGpSXiKDEyvab72FyLyEssxw7kyKbvmO5vw56YJGNfEBkK07VKtj5pe2zkbK 4SK4Rs6kuPjxSU4Aj9qw2r87VINVWzgwA23sYQ+8K6yHn5N3Ts5EaSCH/eMZjaKge5Ae xZuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vJSuuj0n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 w12-20020a1709060a0c00b0078ddff4b3absi21428231ejf.423.2022.10.24.04.45.05; Mon, 24 Oct 2022 04:45: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=vJSuuj0n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231184AbiJXLos (ORCPT + 99 others); Mon, 24 Oct 2022 07:44:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231428AbiJXLnY (ORCPT ); Mon, 24 Oct 2022 07:43: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 6900F10FCD; Mon, 24 Oct 2022 04:40: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 dfw.source.kernel.org (Postfix) with ESMTPS id E30036126B; Mon, 24 Oct 2022 11:38:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFD6BC433D7; Mon, 24 Oct 2022 11:38:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611518; bh=CcO3P73nWihKfZZsy5MC4W4ujZ0qIP4yl3E6Fxe4K1Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vJSuuj0ng8DZkj0cVJhwwKzJeRHf0JidSo6fTa0QCBXtFgjJqllWoMAqib7qP6U5w zrOi9pK2PAwEMHbgDY2D8/tagyyuB2MwphFzipmrZ75vc9NwUhIHZn5bYCUu2WZl/t tMrtL7GFxWFm0NkXGTvencs7An/dnNIOufKSnUsw= 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.9 010/159] usbnet: Fix memory leak in usbnet_disconnect() Date: Mon, 24 Oct 2022 13:29:24 +0200 Message-Id: <20221024112949.732978269@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569270206790821?= X-GMAIL-MSGID: =?utf-8?q?1747569270206790821?= 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 f1cb512c55ac..810e4e65e2a3 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -1559,6 +1559,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); @@ -1575,7 +1576,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: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: 8546 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp417001wru; Mon, 24 Oct 2022 05:12:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7r5sBDMN1FIKN+OLXR9NBqStZ7FvB6vtC9Na0lqIubuwtJsaaMyrn0rpHN9/wuhFfMkfvz X-Received: by 2002:a17:902:e849:b0:17f:f3c4:a2c4 with SMTP id t9-20020a170902e84900b0017ff3c4a2c4mr32954552plg.125.1666613539218; Mon, 24 Oct 2022 05:12:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613539; cv=none; d=google.com; s=arc-20160816; b=sDGFasqqoQc0F6LqKcg5DwTdiV3NA/0DbrA9WgKmYYm8Bp+WRgoraV/3lFM+iM9slt rwKnivoAUQxBs444sZBjCnDVQNbDKORMMGuOOeFxvhDXGNshtc3s9u5xD+gnkhdyF4Cr Z+npXsoL5ZiaV5WlpgI76a0VcLviGXu12RSd+mmZsidBt8ctxjeL/Y8QINMi50+hSJNr 8yy12CL3CuO+W0WizdKydNJXZtzXEbQH5LvkbjsywlcRCi+IopAJYXOkR+ZZJSnkHiZp YAp1VtYMhOYnVvcF3Xjv2f9dXuclqW/WcSGOH3sgtxw5xdL3tw3yr9OycUowEkh1ACju iV8A== 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=gNwqXxRtJVMUwRihUKG5KrEEiujicUVfpJxR0PSX1OY=; b=bRC7Bt/w4MCV/kkTCgXqhpku4+GkH6qxaqsEJ3LL9Tw4JithokvR0Se2Xc629xC5qj Yhg6Ok6sPeuQa0mKVrrKSwpZH87NQ+B87y1FRIP5EwbwBOvy3ImISkz28KBb4VuUORWB 1zx918fbPxIXA08kX+RYk5BjsN69LDdKEWgeuy/48MrE/euyu2Rc/ioAEEWFbVG7pK4V F/o4BDD3kzCfvcSQIF0b/hhXqMAuczShHEaghoEI8Hi2/+PUJbMnPW4APNuBE27IjB/v Uig/Cp1kqlHZmVPuJWVIAZJEAT6bj1/CxfZ+MIgujyelNJHci6Ul0vUFo5jXyicRBA6M 3fDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=B+BdPdTd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 oj10-20020a17090b4d8a00b0020d887ded6esi17016228pjb.120.2022.10.24.05.12.04; Mon, 24 Oct 2022 05:12: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=B+BdPdTd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230090AbiJXMAl (ORCPT + 99 others); Mon, 24 Oct 2022 08:00:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232145AbiJXL6g (ORCPT ); Mon, 24 Oct 2022 07:58: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 89AA72A278; Mon, 24 Oct 2022 04:47: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 BDBF461280; Mon, 24 Oct 2022 11:38:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AED4CC433D6; Mon, 24 Oct 2022 11:38:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611521; bh=vDIOLrtOH91TGb5ga4pN6oJWrbydeWF2GLGCeCY+H/E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B+BdPdTdTwu6JCaa91eK2oS0h4q8I1R3vc0uiDTxaFRsRWM0GYhumVkXjUND4mkfY v3DyzXq2skM361jTtrqg7/mfGmapZLm73oisFkfPZNwbDUIMhZ1GvCdzzKgv1Qml44 Z0S64wipGP3kb9DnUyYgwlHStINarFOCPzssDd5k= 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.9 011/159] nvme: add new line after variable declatation Date: Mon, 24 Oct 2022 13:29:25 +0200 Message-Id: <20221024112949.772495354@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747570958231771939?= X-GMAIL-MSGID: =?utf-8?q?1747570958231771939?= 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 9561a247d0dc..051bc7430af2 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1044,18 +1044,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:29: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: 9626 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp531964wru; Mon, 24 Oct 2022 09:07:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM63v+qsMUURcCfD2uFyS6FQZYlt20LJirb9+2JaIIIS3PdU+6oOwzQyXQR8wXzcZawM2ymK X-Received: by 2002:a17:907:25c5:b0:782:978d:c3da with SMTP id ae5-20020a17090725c500b00782978dc3damr28092518ejc.623.1666627637820; Mon, 24 Oct 2022 09:07:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627637; cv=none; d=google.com; s=arc-20160816; b=zWxFUU3hYgco1Yfl+kkH/wHXGexBJl0QcHPuQFjH5lOJY7/oJN+DOc2jaF/x9pcgsw gM7hqOHbZfl70/eACs40O0NGamP42m7OJfN46U6H+o6Hch3/N5rJ5iWkbZSPbIa4pUeB +HsKl6qVPENz4uAqNmcJ5EET9hqhGdnITkc+SGtBdayRplODRuVG2IdfrBfkXIBtTuut mCNAsdxZ0AlTblTWxIYZmvPTKcpMYZeaLleHf12E6vyY0EFDAds0qQU3vGxxBj0VzVaL hJpNcE12Uu8vdgq4VNHnmJ/IFfRJBNVA3q7N3SAF+DrptO2PvYgXVhpiSqmQmye5wfKa I2bQ== 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=TwFcJJkyzg7YO6TUVQ04NdLOCHGVQ6TyZBGjnZr1wt0=; b=XvhF4gDRwvbEkiz1fU/Dg54FaI9nLlzxZ56Ivi/j8XFPTY/LXL+GYAj4hn2ruAyOwo 2KR3Uc1KpwEbRGy4P1+XvKb1kttQ0S3WQ0E18H6CJeHMYhsF9+6RAfM059mfoEqJSxZe WEzkg5gZDkwPw1f76wh2NBMCPE5aqT7Y7+ihwSYUEv1RUqRCzexGx5G8KCxL5M+CxMN9 Zq4tCzlVAxT1zlOp95OOrLeXLVYiQ1JNOBZFWa6cEXdFQBJ9AEdRpIWpwrv/tN4pdMdM Denxt2/cMzxQfLVnYMBnnIuEhFLU/fccwB6K8nEtkT0d64saO7G73U6dSQ0DBttMKV5T wGqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aqFGKy3c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a056402280700b00461dfe5f99bsi202706ede.298.2022.10.24.09.06.51; Mon, 24 Oct 2022 09:07: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=aqFGKy3c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232941AbiJXQFh (ORCPT + 99 others); Mon, 24 Oct 2022 12:05:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232285AbiJXQDU (ORCPT ); Mon, 24 Oct 2022 12:03:20 -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 747CC1CBAA7; Mon, 24 Oct 2022 07:55: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 1CD0FB81142; Mon, 24 Oct 2022 11:38:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CD09C433D6; Mon, 24 Oct 2022 11:38:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611523; bh=iN2Js/H7duln38ZwZOp92nMIMPUms12TLUjDHJN09ps=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aqFGKy3cakGSeaJDzlgwiHFsjFL8ac9bS2nJ+PIo8PBlYBgh1GSCzNhHrNO/txqEp +aPdkEihGlS6RBqKqnX7UnWzD+k2Be9FGChJH7Wwjl1vXfRQLrdaC6namsK9QiWhyN wgkP62h6DwtBqJVhDpHqQXHn4/l56z1zmDqVclFE= 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.9 012/159] nvme: Fix IOC_PR_CLEAR and IOC_PR_RELEASE ioctls for nvme devices Date: Mon, 24 Oct 2022 13:29:26 +0200 Message-Id: <20221024112949.803490011@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747585741952636684?= X-GMAIL-MSGID: =?utf-8?q?1747585741952636684?= 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 051bc7430af2..f260ef59dda2 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1050,14 +1050,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: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: 8496 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp403984wru; Mon, 24 Oct 2022 04:53:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5rLAMT0MH6mOFei+X0m9+pdrgFHKfbkc8JfZyLM3+yQ4g7BKRvnhHygUwKXNI703+DI5g9 X-Received: by 2002:a63:5a1b:0:b0:461:9934:6f62 with SMTP id o27-20020a635a1b000000b0046199346f62mr27958046pgb.266.1666612438693; Mon, 24 Oct 2022 04:53:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612438; cv=none; d=google.com; s=arc-20160816; b=nWuWEh6oiQjmgIDmcnh14dfJMQWcy8SAV2Us6zig15JLPG+NKH/2n0zkDFMi/3hRdt YKCVEQgHuUhT3B6DPL+CEY7xTfr+vyxugFmKWJSYd+47/n5AJ3dEWFkBKuhWy3R/JgOB ltOm3pYJmlu3sALAWbfSekRsdtHJalcj7q22WKHcsXqTpZ3hWdyTu58CS+owO7fbyxJX 0piAI0vDWKDGtqVaxK+Fg0Y44PYe+HVq708B56nAjYbWs3SCBI1UGU8pCBT1qk5m/ckF iZpqaCWNsre/NOViLBUCiwLELVLd3SpxO3MucGF2vXSd/S/VoiQfuhjkQTnfmJPGOF3T QXKA== 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=zukwGx+8Cu6JLiVRuQC7CBsi3f/fLxQB7XI/l043YTAkRfClaNti9re7KrRm8dr9Me H+JMyDNG4BoEiOqcs8a9+NBPPqVkFV3EOiXaUs6eTTs4g76+d2kSIf4nGoWqwTz6+Cc4 BEyS5V6ZuJFMle515IIcxI471pN4WkwHIk7TK8dOpFp5oYNBgmB5gRxTDdsnxMhaeVN9 H+dVZMqFQF6eKPuDYCp1uS6XKger7dbB+3tI2l+ZRIfq4ISIi/6Smyc1zlU5+bMPne4d USqLqqjzQtOVT5HkpVGhE1SGC9YIf0UutByt/BMBcx29lngHGC87oyxAPwjAMATq0tW1 1+rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sCKE+p5k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 63-20020a630342000000b0043c700feb0dsi34268908pgd.160.2022.10.24.04.53.45; Mon, 24 Oct 2022 04:53: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=sCKE+p5k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231721AbiJXLxO (ORCPT + 99 others); Mon, 24 Oct 2022 07:53:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231995AbiJXLwj (ORCPT ); Mon, 24 Oct 2022 07:52:39 -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 2117628E03; Mon, 24 Oct 2022 04:44: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 2B0B1B81132; Mon, 24 Oct 2022 11:38:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4874CC433C1; Mon, 24 Oct 2022 11:38:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611526; bh=HzWNp5YyPkS2fPfnmk/Ug6wOXveeiRA34eO/DWm4nXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sCKE+p5kr8h9mlKhHk2Q2iFStyE8ZUPFNMqZgLbvRLBi3e85PbIviP/fH0a+E4CZ5 tqrrKSMj8bDkK4MvXdcNrbaoIFhtqTmeX9PuSVZBnI5csCKJ/uoJEKxUl6fUeQ2m8x /5uqRrEhLs/YuEEb15fiqD5UpDALmOXewv8daghc= 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.9 013/159] selftests: Fix the if conditions of in test_extra_filter() Date: Mon, 24 Oct 2022 13:29:27 +0200 Message-Id: <20221024112949.837857514@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569804838900756?= X-GMAIL-MSGID: =?utf-8?q?1747569804838900756?= 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: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: 8544 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp416935wru; Mon, 24 Oct 2022 05:12:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM48ek52VFb22Wgi7tecaIXoA+5DXfRhUrmZ6Dig6KEl1QSVZAIk6YLj9gER54DNIrFra1xQ X-Received: by 2002:a17:902:ea09:b0:186:a604:d7e4 with SMTP id s9-20020a170902ea0900b00186a604d7e4mr5435553plg.120.1666613545591; Mon, 24 Oct 2022 05:12:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613545; cv=none; d=google.com; s=arc-20160816; b=eXxP1l0H9eQwfSdvS12NsGu8vi0rJv1JEeLDIpXw5j3jxx6TbugAFeGAcCUr7dzHgK AVN175EVLQTA3elG4OAPyi2h2+OQXOAAzH9fnTyei3D6KZcH3BcJZcsAHwseM+CB9StY r3LwoeOfHsQR40Kg3nIBzA+1GZR6w4zCEhd0On8OyQJm4XYTy6Bki1BxF5AQu0Bi/GQt eZqbae7YmH7eTlbT81+ZTegmC5DasESsmDCMWLYD8npvSm38v7Uc4sCaFv/RSvn5Ggi6 xiU6Gdu/kaq9MGjHsAHihmpBV80etgyCiuQ4FDhXnG2/GuPh0e6u2bOvq0QWQ+knr/hU 7FyA== 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=FOgOoMXp2YFkAd4psg3kXD+USDeqv2fQz8KxMXEvsIY=; b=yjzXiP/hMbaYZjO8CLZ/mmdWzvT8Wtq+WxPsGH6Y3E1UP/kCz3HSYS4/omzNPSAjjO hTEozJcdxAaY202fnPYJvEaN0PM2D7z4Sj1Y53mH+9RU27Y+IKKWXM1vd2Q7FwSfkP9q 9xjzi+Cj424WADSM/6wzAVh8XmWzCf0wSY+a8q3RiSPzSp0MX4/8Tsvohdu7aW2ev+tq cxNQkBMEca+TX4FevkdHtP+Q+WbxJ8Y/OXVL/GzdOjlBjdG1frBsYLjRvHtLJhY2LDZo Tm3YjsX2L7oPFLAArciZv9wyP9XrET6R5f/8XOLlKVhp6l+t/I441nVx3vS5KbKrj5bT Q+yA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WVIfcYxC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 y31-20020a056a00181f00b00562a1693523si36053016pfa.20.2022.10.24.05.12.12; Mon, 24 Oct 2022 05:12: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=WVIfcYxC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230183AbiJXMBN (ORCPT + 99 others); Mon, 24 Oct 2022 08:01:13 -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 S232482AbiJXL7D (ORCPT ); Mon, 24 Oct 2022 07:59: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 E8CF87AC2D; Mon, 24 Oct 2022 04:48: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 1677E61252; Mon, 24 Oct 2022 11:38:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29F42C433D6; Mon, 24 Oct 2022 11:38:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611529; bh=YU3dLBhpv5jU/r+f4gU/MZ21d1RTiVhkqAKzdEe6idg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WVIfcYxCuyH/UKukWZzo4dyadvSa5lLxfzwDegwu3CSRj3cYgPd28BZNKCiup6fEv G7HT2xVL+dU4KV9CafPg40xTFLgEnHa1qKschrSOMypG1K6uLyKIu45rAnzIWrdWPj sSFwjs7MBr/Kwu77t1NBOeI3eh71kKgJZVZ/Oi/E= 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.9 014/159] clk: iproc: Minor tidy up of iproc pll data structures Date: Mon, 24 Oct 2022 13:29:28 +0200 Message-Id: <20221024112949.878116041@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747570965328911034?= X-GMAIL-MSGID: =?utf-8?q?1747570965328911034?= 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 e04634c46395..53006f4305f8 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 __init 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 __init 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 __init 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 __init 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 __init 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 __init 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 __init 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 __init 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:29:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8628 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp420498wru; Mon, 24 Oct 2022 05:18:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4okPfXr9NHIS8T2Y2XwBgFo0Jd5PxozSbM7vZgWmzRc/HM80iLADDllzaBmEpZwZ57bLpn X-Received: by 2002:a17:903:2285:b0:185:44df:d916 with SMTP id b5-20020a170903228500b0018544dfd916mr33178508plh.120.1666613898763; Mon, 24 Oct 2022 05:18:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613898; cv=none; d=google.com; s=arc-20160816; b=0jPOrdS5sooqciabUE4jLuKCaHrcyLGBoorWz87W07b4rIKhclALuKmgHOSpfa1XT8 0QXi03Nq1cEsibmxHLIzmVyH+S2iDMIhi8cNutc+2I51LRuZ89pvSfKHoMVgX5XEqHfv MxL+wYQp8rbu9KB83sXEtBMYI7bal/x9TlxUozwo4NQD3MPZsR2MegFXte2Sreimm09M hEk4T40rWYUQxCuJ0NhJmOfXDcGgNVQuI5PaIjS8pOf2Ax/OlI/br1NdoBXlubJrsLM8 IS4PJ46D/2OsCSmyNbfBMjXZAabeznOflwyAxRVYgV7A2Sdf3qCVedxMutxiYvueFLbc LxhQ== 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=dHk0QGzyE8tdOa4kNUINhMAOwAeFezv00xydwDHrwdU=; b=o5b2Wc0ZF9uBm/D1XUm81zBMx0kgIDkIixOLH/LJs1PdR0P2tE2CdeOD0aJG7uZxhu 01MPkYupyLoXLuTIwedHgjFM37xAuUBxEreK1BAEw4mKg4fzJN4mI2RIe/uTULi8S/6l Xbp6IWWAYOe0X0r/MdNh3JGkLbp9SbD1y0aUx9EFVzCLmbl1PUArnNEicVsvLuW4DFdA RvUC/BRasImHV2vyihiYR/taf807PdNkRvvd3KnwkxsJoDy4xygb/fDc2LnO02ONUgvT VqoFwVivDjAXfK4suiCzyZuNVJABpiCWxcaPi8dZms7hJRjOtgGEW4u9JUc8oADiZ9u2 gdQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=guIFiKPQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 y31-20020a056a00181f00b00562a1693523si36053016pfa.20.2022.10.24.05.18.05; Mon, 24 Oct 2022 05:18: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=guIFiKPQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232911AbiJXMLy (ORCPT + 99 others); Mon, 24 Oct 2022 08:11:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232830AbiJXMLH (ORCPT ); Mon, 24 Oct 2022 08:11: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 A78BE33362; Mon, 24 Oct 2022 04:53: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 5679461253; Mon, 24 Oct 2022 11:40:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A7AEC433D6; Mon, 24 Oct 2022 11:40:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611641; bh=ZEqcaliMDR/EDegFBvq7Wbf6roDmqbNtSYEaefYeYHE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=guIFiKPQEim1ju0+ZOtqA9FaZDKSalc1Zbk11dpkXr4OMH+N8Htm+DoFvhKVdscVh DvTelgTG6Xky6BtJSWnsIslFAb1do7j8wlOpgJuc3DaUCyUv1Vv/TS8nomejXmTIGj 2S5bQUHUF6Ru9E+al0VtvwABR3tyY5Gc5drOFiZE= 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.9 015/159] clk: iproc: Do not rely on node name for correct PLL setup Date: Mon, 24 Oct 2022 13:29:29 +0200 Message-Id: <20221024112949.908348716@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747571335972609429?= X-GMAIL-MSGID: =?utf-8?q?1747571335972609429?= 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 53006f4305f8..d52f2b810a4b 100644 --- a/drivers/clk/bcm/clk-iproc-pll.c +++ b/drivers/clk/bcm/clk-iproc-pll.c @@ -621,6 +621,7 @@ void __init 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 __init 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 __init 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: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: 8471 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp403135wru; Mon, 24 Oct 2022 04:51:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6nRzUDIAvGuYlfagx7AwS0L6cKbUbA3yvDxxFAG3/3WiU7MQT8mlHEd0H11A9IQ/cxaRHC X-Received: by 2002:a17:902:e885:b0:183:dcb7:c4f8 with SMTP id w5-20020a170902e88500b00183dcb7c4f8mr33332134plg.160.1666612282720; Mon, 24 Oct 2022 04:51:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612282; cv=none; d=google.com; s=arc-20160816; b=xTaQ0PH/DWXr3P5P+uVIts9kYT20Aytcrut0tDTKSlDRJY35ycRJFYSoYjccQVjMjS Af3ElhiCY3T5T8hi+QR10t86ibaepBSEk2YJkFi1WZsW66kP+E4bDl8MJ6DSnLlgQVPr U/FOICJ1k38pIzPkWOOHuhFwqVi9XfY+f2qex6uOvxiwciZJrDkxLE8bYVp4+Z9S1rKv ZI/ah3qJL+TIiwA0NopyNgGE0hHqLWn/LQDfOf73B3tg772QZkZ2MIVzJea8FCYjHICL afiTdSp/YZ8xwzqIjgOK/3PzuenyFNqjWPTUyvNjVBIau9PMK1ZAS0lemp8zR5baDfG4 LUGg== 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=GdIZZrU96N60lEt1Ve0GyCxqiposMFSw+ZS1kD49DF8=; b=ZZc77ag4SkEycYBZuOmxxa1LnRn2Mwlko6VULAsoCbs4Xtfmf30yVz7XLZpkAZCA+q /TEp3ALOnba47WHfNaLWlhAmDPvKkM28tOUMTzmOxC06pstljLX4lMVtZMctA76hPZ5o caaRAFLHv7Q4Vrd3fQzNTTuKdmHxCg1+Jh+9Dvfw1Csz0yNTYCUI9IU++MvwDzUXluIk xcLaCv74qtoG7t0FdZUqeuXBTB/yAbp8KTl8eznNAqyStAZn2wM0U2nZSjK5P5CTXua9 BExWVMCEPzg3DbwkXBDMPNvI+P+Wpr3Y2PFEIHvg+XGoS8p9/S0ULqlaNU2XViOuIN9I UsBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eSZE+DNL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 i3-20020a170902cf0300b0017833671bc7si36344556plg.619.2022.10.24.04.51.08; Mon, 24 Oct 2022 04:51: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=eSZE+DNL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231895AbiJXLuw (ORCPT + 99 others); Mon, 24 Oct 2022 07:50:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231896AbiJXLtK (ORCPT ); Mon, 24 Oct 2022 07:49:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E153E275F6; Mon, 24 Oct 2022 04:43: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 8264CB81144; Mon, 24 Oct 2022 11:39:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE75DC433C1; Mon, 24 Oct 2022 11:39:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611556; bh=HBBpffrAAZogUx4OltO2p8Q0Pibr4p0o4OS7Dboa33g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eSZE+DNLGwCGyHFMC3xxYhdenDhWqRz+FXx85GhxOhch+tmc4buIH4npr/iDDCZfq 2wW07k88ChxfpD05DpvXcZctE/yZxikoceV/EqRVL0YMDPvhOv+jMOEbktP7uTKPGF N2plFa6s7hn89DqQA33BGxh51q/gbyYgnIoBFhbw= 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.9 016/159] Makefile.extrawarn: Move -Wcast-function-type-strict to W=1 Date: Mon, 24 Oct 2022 13:29:30 +0200 Message-Id: <20221024112949.948390655@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569640702374798?= X-GMAIL-MSGID: =?utf-8?q?1747569640702374798?= 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 @@ -72,5 +72,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:29: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: 9557 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp519452wru; Mon, 24 Oct 2022 08:41:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4WRfXokhdJTuQwpZ33+bHCKA9VzRnrgCQ3tUbPtHCM44/wj/VacDyyuXgOF/0RRIz2qDft X-Received: by 2002:a17:903:32c2:b0:182:1a9c:8f40 with SMTP id i2-20020a17090332c200b001821a9c8f40mr35002668plr.54.1666626104371; Mon, 24 Oct 2022 08:41:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666626104; cv=none; d=google.com; s=arc-20160816; b=ukiNgB/eLwyZUkCP2+3XGrI47yB/eRPwE7cISOeUiBhgHJOysRHxVTOp6qMb0X+BI/ +MhLyukksqfqALleMS2gUibRXS/gwJ2ARDhGRJZSOvQTC33Mw4HAS+WZQwujlS2ieEBg tTTrS99bZkU81MqXBEW42TzpNxr7Zn7Ew/churle0/NH1uopdehpnNJeAukzYfKJqbHk N0Ve9yJflh6DDtawYNoS0eUx98miJ3I/Ek85K0ysw4mFF8EFeDRETso201FkllVzB9g8 KOIcV0czOMnSm7OI5AckNqnmeZjnYHPw9Ga8tR3GgmE7/flYPYYh4WyVfESh8tbT+5gS 12lA== 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=zMJ9388d2IaUr+hpTsCIhH1Vd2J7lKXFcc4WwyY1P+4=; b=avfVjFBldXb8xxhDPZuETZkm5khLSv67dDfoRKLOzsaAbUNRenL+1bZKExZnlIJBGz BH3rNfbNe72zPQT8K/6KQsCH6PEkiGCF77riacKUVcwgYDG8Epybx8Nr+T2t+G+xjugP V9BlpzurZIwNaVN//In3P+WwwCFp9OGHGq+mvxBtK5ymmtoC1m7UkMj9WfT3hEHC2Znz 6Sf42N/0XEKR93nAib1spKQv8sFfq26ghCYFpGwdxNtMdmB1DLAhc+kKl/9E/BzFacmn qJtf38Vkg/KpJLQoAjr5itENd9MgVaoAx8n7hz4IH8SxW6hah9hMlyxlaE58Vg9/0oDI gm2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hGFSsT7B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 z13-20020a63190d000000b0043c3f90f7c8si9847929pgl.655.2022.10.24.08.41.31; Mon, 24 Oct 2022 08:41: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=hGFSsT7B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231522AbiJXPXo (ORCPT + 99 others); Mon, 24 Oct 2022 11:23:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232164AbiJXPXQ (ORCPT ); Mon, 24 Oct 2022 11:23:16 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19DB718F92E; Mon, 24 Oct 2022 07:08: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 D0366CE131C; Mon, 24 Oct 2022 11:39:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BEB19C433C1; Mon, 24 Oct 2022 11:39:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611586; bh=NmoR6ZF8800yShyuHDROXNDRW2u/lpmaLXLmZLvhgAc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hGFSsT7BZAltatXegTlT9wDwApoGjDhZE1tR8eX1sPWTVGjAej1C7jUyTtq+yXuJJ St5ucSf+9LTtjUR8p52HqYsAlx0XTcbBNgNDIVVIkXwYTvwfVp6hPjIFub8Mkkidzk ku1tPoQ1FBRbPCgigikVTNTg1IjuAUBifEkzOths= 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.9 017/159] ARM: fix function graph tracer and unwinder dependencies Date: Mon, 24 Oct 2022 13:29:31 +0200 Message-Id: <20221024112949.987222185@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747584134316075595?= X-GMAIL-MSGID: =?utf-8?q?1747584134316075595?= 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 @@ -53,7 +53,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 @@ -17,8 +17,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, @@ -35,7 +35,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: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: 8417 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp400295wru; Mon, 24 Oct 2022 04:46:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4OTNJ4PZ/BNOzEV6OrLVTcxE/pcA+TeS0ha2mQwWQi4RJOc6jq0u6YD3n8NzBQQKJb+jMj X-Received: by 2002:a05:6402:50c:b0:461:bc01:1828 with SMTP id m12-20020a056402050c00b00461bc011828mr5278976edv.64.1666612009936; Mon, 24 Oct 2022 04:46:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612009; cv=none; d=google.com; s=arc-20160816; b=PgN9e5HwBW7kOLtL0tbcFy1zj2pIOiNspJco4d7uoDCEFo3yOnSqOUXESm6iN9+wDp bRfz8Xa1cv1B0ytmJSIlsNI0dO173zuG4Rm3C6J2ZMPBqJZusVhdoVX+6ltiaSxREqpc Rl5Faik7OV4lUdKJdkGxI/GAIO5gHmVUt4MreNxF3insqUSkFRWBYoNnea1d5FUvCHWB nZmORQTfiieMkwgjak7qKKLn1nqAQ+J3hb9DOxaYzfKRoclBj+bWdThfKIk+uhjDlgHT 7Y9miIoErYrzC3NBN4pdNoJ7iN4vGHRbIj+iPebv5w4UfrbVOWefs5H5X7HQRfXINmxY mjsg== 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=yVLIAp4s4dGK2vKGbYR0yt+fNeipvLJOvc54W21y4nc=; b=zSgk7yMShlJzyjrn1qUC1glF5Plh0G5nFLVe5AUNadkA5VUQV/E+H/2ahSslgG9OFv W0sbNrmhy474MqNx0LvKMgYEDAOtJxqH8PoifC/N0UcPeUBRRRgv2tItX0tuQzGcfuhR AecVZ4S+fNV9M9fRbnQDsy1qc3ivyLhkA9Lmb7uZbdNflPxnR0m+k0PY08ncp/on6+vV 1RM0z4QajJfHszBZyoGRbinuGAgowpNXW8rTNcCF2o1FhAPT52qGkTB6rvSoYT2K2Y3K lsqXqftSJ+DEOcemfEPhO1wGfCUxcPFWz4Lp8BGFn3jhWdOMaP5fFpx4NG17BwKLzQNo Su4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MN0orPqW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 z13-20020a05640240cd00b0045cf3759408si31531015edb.49.2022.10.24.04.46.25; Mon, 24 Oct 2022 04:46: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=MN0orPqW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231553AbiJXLqB (ORCPT + 99 others); Mon, 24 Oct 2022 07:46:01 -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 S231681AbiJXLoP (ORCPT ); Mon, 24 Oct 2022 07:44:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E09D3889; Mon, 24 Oct 2022 04:41: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 0281461291; Mon, 24 Oct 2022 11:40:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DEE86C433C1; Mon, 24 Oct 2022 11:40:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611615; bh=w8GcFL1jn5maqtpEMoRTTc6qRI1tWbmQU92truPDLkU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MN0orPqWWle+GY5iTbnr6w86mXPb+ZdYzUFL82jryVGCPHIMOk6tt7kL4RS7AIxWB eE3i8uC9W1l9Y+YfGFulUcIJyEqoPXufayKz1jBZPTWItR8KpRSUluSmOSi88+0IMZ L6LdyOQw/A8pBgrssgzVfvYnb4wDLwTogCVGoFA8= 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.9 018/159] fs: fix UAF/GPF bug in nilfs_mdt_destroy Date: Mon, 24 Oct 2022 13:29:32 +0200 Message-Id: <20221024112950.023006337@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569354622480590?= X-GMAIL-MSGID: =?utf-8?q?1747569354622480590?= 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 @@ -164,8 +164,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); @@ -192,11 +190,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: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: 8469 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp403087wru; Mon, 24 Oct 2022 04:51:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6VX2Fsxbuois5ZuP2QHSR5gIGzH9MSmNEyIpN8YXuj4vmnnhu4QbDsUccbCQbFF82x4P60 X-Received: by 2002:a17:902:e885:b0:183:dcb7:c4f8 with SMTP id w5-20020a170902e88500b00183dcb7c4f8mr33331659plg.160.1666612274331; Mon, 24 Oct 2022 04:51:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612274; cv=none; d=google.com; s=arc-20160816; b=vtyRL+dlYm0uyVpWjsainHwn8Zer74mcc3fiS/GPU2Fxql8TWwmT75PvpZioidjpbq xqOeP1TEWqNaJ7hbgn9JhcUCwFJvDkwPVH9eNLq42w5aN5Fhul8GeLS4d4LhCEKuIZjD y5IWUks+UZZAYg1W2QE6WB2eVoylO8qW1LgkQ4E5YQTjEMUydI9dZMi5BByxbmaqkIg6 8dLXFqDRirXxh3jFwOJxqWA2ORnQ+gHVBoM1fiUdMX3kUB26DmMgvkYjH58oMXHSFrii eIarw4jh8o+aIbrKaleSwEwHrz7F7BsvjBnwHlHSbnEEeH+esjj4GzdVRM9mtvhisvkL kS6Q== 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=jF1hi7bUQaTHSU7GvEJgGZubVtWbgp5xeowg4jY034o=; b=rKc0uWBffQCvcA9zbyCxtOskBsRcSNOf5UX7XSiMjBQTTH5+XcBhO1QfC7MNofwVjH ca2j2LM+JEk2/FkZiSYSR2Qxm/b2DFLZwr1ppStozjHTOP0kpzbnryqDMT7aYgVks6iO GBl9auNlk8DUkgGzo1qCi733lhvCOPkrDTVmLrJSSUAR+GeB22/t8XvXxtF5osxc4L7w pTJqDiyqPKnQc5wDY2RDvonuqgrmy5id31NCePyNGAc7Lkh9CkAumuWN0BJIB1zIWzRa 3Anu82Z7DkrgCT6Ic9zxScfZRRN1LiGQ1BXqN4uzNPIKLzRUktZtJfzaRpDFoYExrx3k imOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NR8wn5oR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 e12-20020a63ee0c000000b0042b16d0cbf9si35318944pgi.638.2022.10.24.04.51.01; Mon, 24 Oct 2022 04:51: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=NR8wn5oR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231872AbiJXLup (ORCPT + 99 others); Mon, 24 Oct 2022 07:50:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231854AbiJXLtG (ORCPT ); Mon, 24 Oct 2022 07:49:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16DC476757; Mon, 24 Oct 2022 04:43: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 9E88F6129B; Mon, 24 Oct 2022 11:40:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF63DC433D6; Mon, 24 Oct 2022 11:40:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611626; bh=omnBrp0Ds6pSUZeQ+zc7zo+0NlTtd4nF+pHskT6RTLs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NR8wn5oRMd7oyLP7yrg3oPuL74iF4+tLxIPBD2GlO+GpyxxdzdlwxKtK/O+mfiBRw pqqCILwvDq+hHm6cIQoVYRUeNOd6zoIDp1m31c7/hEPQ7hW03+jUelIxFqAj+O+3E5 ZEj089rUHG7u8A4sAWz3e4iSVtJojnuys2yaS7+g= 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.9 019/159] dmaengine: xilinx_dma: cleanup for fetching xlnx,num-fstores property Date: Mon, 24 Oct 2022 13:29:33 +0200 Message-Id: <20221024112950.073350920@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569632536663381?= X-GMAIL-MSGID: =?utf-8?q?1747569632536663381?= 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 d88c53ff7bb6..c0ee6859cdfc 100644 --- a/drivers/dma/xilinx/xilinx_dma.c +++ b/drivers/dma/xilinx/xilinx_dma.c @@ -2558,7 +2558,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: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: 8470 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp403109wru; Mon, 24 Oct 2022 04:51:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM716GwtWFjhaXrDwwQxPCcxFsKsBFXnLdU4TpcJ1W13qd3IUqDHd5FMmaePMaZrHaXImiCb X-Received: by 2002:a17:902:edcd:b0:17a:6fa:228d with SMTP id q13-20020a170902edcd00b0017a06fa228dmr32932235plk.29.1666612278564; Mon, 24 Oct 2022 04:51:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612278; cv=none; d=google.com; s=arc-20160816; b=oux/cW0YAKwsxO1rsjkmtq6vYP+bBlXMuVXwrLUjCNphnrmadA/y8Bu8znG4eccGfF PbotKS6J9PRQltDG4KCtUyRKq5jzNwmcfR4cFlblO0ddo3wr3itmZ3Fn6hxIZ5U8f6QU eH20INpS2/Q3jHLvXH2j5yP0LGTKTFec8WGxkqI/KVsG9OpKKJJDPSwyY5GtChrxuOZq qfckMiKHMhcMD61k5ctQw10OSEgXBCDZMyoghXTPxZUHmz3Ew2VVkUDooD4BLUigsX9e X4YZn4/vHjy5BiIIfwK8OzOOIQIP0JsS5Q1Sw/ZP8JWxCEbguDtU5KbXltcBUFGvTNev PvTw== 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=NSkfdxKazWNEQ3+goCW/a3tkos6GwID5TAHM9MIjDTw=; b=v0kicOHO2VzcNNFmE7K3YKOmmhwLSuSef7lG5ZNn+bgo8PXZIZygvmpPYU0kJQLrqK WqM/BhIAxMWdig68bHHry/tgK/XZozwZDaCVPDLuhv+r1E76gjNUS3fWb2K1VW+B7Mpn w2wSIpAutTOBdMuVv/GCYvBqtY1n906f4iIz9xYUUbI8TpsglwGvcWGKXHlDWde9bEnj pUn4r2LhH9hyJDpTeMWof+g8jAQySinP7E59C65w2wzZ3CJlFBXhUCHhXdn3kXjgOlUX x2IN2s7vskWTguPNMcWlmwBbkRltE8g7RTyf/svydn9/zJ1LQ6m9FRZHxPM1zk8WffAI 7DwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hLyBQEf8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a056a00140300b00565cb1ebdb8si39746963pfu.275.2022.10.24.04.51.05; Mon, 24 Oct 2022 04:51: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=hLyBQEf8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231886AbiJXLus (ORCPT + 99 others); Mon, 24 Oct 2022 07:50:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231876AbiJXLtI (ORCPT ); Mon, 24 Oct 2022 07:49: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 067FA6D860; Mon, 24 Oct 2022 04:43: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 EF9C9B81181; Mon, 24 Oct 2022 11:40:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46393C433D7; Mon, 24 Oct 2022 11:40:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611628; bh=zBzveb6Rt/VegdNsHPwco7gQy8Syv60pycr/MYw/PxQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hLyBQEf87xzTD7Gi2SfhnfMh42/DsHIq7ebuqZlEMYt8myeiYVXFqQoSGl+FPQtz0 cGdU2R8E9gTqxZRn9XK+s0LnerXYVlbUAsawx6Q0GbaxWjrpL17yvx6L0qgQPvu/Z+ vdWrk2lTjuH00KUx/cOwjmM0Vw3yOXqXDNJWCuEk= 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.9 020/159] dmaengine: xilinx_dma: Report error in case of dma_set_mask_and_coherent API failure Date: Mon, 24 Oct 2022 13:29:34 +0200 Message-Id: <20221024112950.122771999@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569636735808418?= X-GMAIL-MSGID: =?utf-8?q?1747569636735808418?= 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 c0ee6859cdfc..12e26dd8d442 100644 --- a/drivers/dma/xilinx/xilinx_dma.c +++ b/drivers/dma/xilinx/xilinx_dma.c @@ -2578,7 +2578,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: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: 8422 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp400455wru; Mon, 24 Oct 2022 04:47:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6SQfAo+w4r072T+1jYsU0RvRnMpKQO13a69qv/J8x7cUsEiJASdgFUVkecjsRy85T7k3e6 X-Received: by 2002:a05:6402:518f:b0:461:c252:c3b3 with SMTP id q15-20020a056402518f00b00461c252c3b3mr4832933edd.29.1666612031033; Mon, 24 Oct 2022 04:47:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612031; cv=none; d=google.com; s=arc-20160816; b=HQ22sy8xF5pN82o70kYCsFbOGylmpDv5R2FDN7p3aHexUo1bkIDDuoUnIhu/voRb+q 3hAJZOLKfVjIxKDlI7l3HCBqI4JMXCGctMOOznvOD0gZIn/O30POfQtCEF4lemEBD+/S ejyY4pQeFaZOyUSd3DWcPN3SWDC2p54V8dt0h7f4mSS/l+82RmoyN1EpYU4+sww7QJRN JB3D6WTP8KGZd1gbLTcPB1chlSQV54zufFCuxUmeVn6dAdEJu1fwgKUdr6VFTuM/Zygn HA1W4UrA7LQ7rUCx/e+mydgsV6c+HM5W2uEu7npKf5bK0+xP2jSXubSDa7r5jNuPiknU gLLg== 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=3p7icUJZ2SE8vLPo2eITL1hcqZM3ZKnx2SxaqHuLLoc=; b=dJ6hV6CK2bn1PrD7c90knavToXMYo41UT5fvUa95kVXkpDZLXPah9gNIArABI15+X0 qBQ9jcoPlcvhITHsO+Yc2xojl8Lfhir5MEAUAmW28L7kgsZ9VTSvigkJYGSKkswR8cBG t6V+kCTIB3deZfeiBqhpYmNY7+Vbv171xWabLplf1VUEwqqBwGwAZGgRXVt/hPYHb8lM 2+BWBQXCtsjvms0T3djzIPmRAUu95vM7rtR8m8aW4pY6BVNRtmJEQYw3oaVVg/e1lR7t Hem9CiCpjloLZDxSQmMRmGPIzOtxNmUDbNVWlxlQcs3V5GK1WJLocQU24cNtn9WYNcg8 /Gzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LR1EzXO8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 w3-20020a05640234c300b004595a90c510si34198589edc.3.2022.10.24.04.46.47; Mon, 24 Oct 2022 04:47: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=LR1EzXO8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231590AbiJXLqS (ORCPT + 99 others); Mon, 24 Oct 2022 07:46:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231747AbiJXLoX (ORCPT ); Mon, 24 Oct 2022 07:44:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B94E06B67F; Mon, 24 Oct 2022 04:41: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 C470761257; Mon, 24 Oct 2022 11:40:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D97D3C433C1; Mon, 24 Oct 2022 11:40:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611631; bh=Itjhk4tlvqpq7yCkr6oJEtqaCekNQTzch1Vk7YlqBnw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LR1EzXO8XOd02Vw0P9zjPsE64e9HaDMCI0WwUbyVfceFfnoiTD181vXtU7r6n3Swh 5BJwvJ2XI/ASS/gfdAYMC3u0bdRFuIQPJgRvREcY6CPgeWpCWLPFkZBLRx+2onoivQ IvWNHNe1Ph5FpuqEXRABgeSIrtq+E017MiUUddfI= 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.9 021/159] ARM: dts: fix Moxa SDIO compatible, remove sdhci misnomer Date: Mon, 24 Oct 2022 13:29:35 +0200 Message-Id: <20221024112950.172126970@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569377036750355?= X-GMAIL-MSGID: =?utf-8?q?1747569377036750355?= 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 64f2f44235d0..167278f8d117 100644 --- a/arch/arm/boot/dts/moxart.dtsi +++ b/arch/arm/boot/dts/moxart.dtsi @@ -91,8 +91,8 @@ watchdog: watchdog@98500000 { clocks = <&clk_apb>; }; - 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: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: 8688 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422483wru; Mon, 24 Oct 2022 05:22:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6M1+cMxVWJ6PhY+IOI/2/y6Xm4DVH+eCUG8T38jTYexyJnOWE2+l2VUNx5UB7Vau9+sjGU X-Received: by 2002:a17:907:1b1c:b0:72f:9aac:ee41 with SMTP id mp28-20020a1709071b1c00b0072f9aacee41mr27463591ejc.56.1666614166998; Mon, 24 Oct 2022 05:22:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614166; cv=none; d=google.com; s=arc-20160816; b=VhoHlRGaxONfOxO1nDlEtfI5rgV/muaaDKpcehRPtk+XzK3OSu1p/+Zn8E/hVjxWSf Vg1ROqNJtpqSdz2Y8ABAqx5SaL2flPpbchOhS+jb/kLPXU0/krwYtFRUXdWuOsLW3N6W JG0Ua5kPZtL4usZbOqkIpwrbNkbH3bEs4K4ewPr4iaQNZzNeynYjUMOzq7NcAx8VqTWw Rn04FOkyEWf2J5QDRdxB6IVynHQSsJ/5gtZE9bXYAERwq9f0gHiI+yIUrTQIqXirDbO8 QoRgnQift9TniH79D4dKml1CujjgD/ZjubuxsMaMkAkf3oxpd5x2RiwBoyYXglmMdlUV 3nXg== 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=D/EkT0SpLctXj2mWjALPmvKGuvZD1mrIif4+JiixStk=; b=b/2hucKVAivByg6oztm8TOF1LcX1UtomEV4aDqoQ8nM9JHKou5V8s8J5ILtAvIxCVh nHyjptNZ7xdiUenJawCssT4mf/Vb5fuI9DLxcsrKbfh2HF6wnwtGcmC7FSJrdEumchWz obFmXqxzWKomW0GlZTgtmr/Fe8u/E7Qfa5zZuda7zlPqeMHb5eMW8jcjgs1x/rct+MXk ygAiwJIJ5YbOzaiqalRO6x929PHhMksTkUMR6JI/jJOKen5FAtaQR7NZZ8gOmfATkz2F MxLI38L0rk8OqkqYvGPvdS2OlE7ot1pandxOM4tNGp6ep/Xydp6vUjKPdrbYUyppupgv AvlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KYigSt5B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 fk4-20020a056402398400b00459b51c2b25si26555382edb.438.2022.10.24.05.22.23; Mon, 24 Oct 2022 05:22: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=KYigSt5B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233336AbiJXMVT (ORCPT + 99 others); Mon, 24 Oct 2022 08:21:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233452AbiJXMTe (ORCPT ); Mon, 24 Oct 2022 08:19:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E1AB82606; Mon, 24 Oct 2022 04:57: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 648D86129D; Mon, 24 Oct 2022 11:40:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 768AAC433D6; Mon, 24 Oct 2022 11:40:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611633; bh=ibTZulFZ4AcQAS0/p8EqYUPsDL5gNwPl9ujOOSjjNec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KYigSt5BYvlWzES48yRSQk2azWap4iaXtzXxoK6eAP4Z54JcP7v0xJPJCBIVhWQ+b wmwQvZZEkDAXN6eSKdKnaIdxqOgICj8h3DRirvo5idjZCSAyXjK8xNTNEJkrsuVwvr FbPI10fT4imREeSu6apa9C6JI90YfZ1ESpGZS3+Y= 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.9 022/159] net/ieee802154: fix uninit value bug in dgram_sendmsg Date: Mon, 24 Oct 2022 13:29:36 +0200 Message-Id: <20221024112950.210682961@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747571616403132762?= X-GMAIL-MSGID: =?utf-8?q?1747571616403132762?= 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 6383627b783e..c624a54502f3 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) @@ -507,7 +508,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) @@ -578,8 +580,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; @@ -618,6 +621,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; @@ -626,10 +630,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); @@ -665,16 +679,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: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: 8426 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp400701wru; Mon, 24 Oct 2022 04:47:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM77nm7F9IumSsnTjv+GR/j2fJ1uYQ9UGL9diHXldcLg92AzMBnuCgqDjdhhnQmjoZ7ec994 X-Received: by 2002:a17:906:c14f:b0:793:30e1:96be with SMTP id dp15-20020a170906c14f00b0079330e196bemr22141438ejc.447.1666612055904; Mon, 24 Oct 2022 04:47:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612055; cv=none; d=google.com; s=arc-20160816; b=UM+6vgmXh+BKAHmnfXKpRa952hBKuhywUe39/9Mlb1+dkH3qzjr6Azp0UCWNgbjuf4 eycPHeW7+tqjHNUOSvh49rjorZ2+kOB0+SKtOo2yvKKHiaC/ZZ1EAvPsGyTaeVptjIjO qXb1DwHOMqCJ3Ba6reMD/Ypw67FLYUy+X1NJE159kLL0UV3dn1FrkW58b4T2P8jNQwmf RbdwJDEIZMS3V+kMKPWK9D2EcLu5GkgCZiVEYt44BG1RpqD5TxXbYZ8UEIBHdEw+g3jl wKPZJStqnOKsB2+j0Ht8ofD018W3apNO6+SRAWe1KY1GGWoD8crqHAfSuQZ4/O+L32od FFdw== 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=EKzrVdK0hIT1JZFfijD0uGIS6Np8sPcY9ks6esX7meSrdw2CttjTxtXvURJEzHau+d 9jMLc8jfgxX8qWiJKokwZCtlYRwW+ZSyDzqqq9FToYMaJtAcIY5tT1SBxv1UrCuOjVF+ Ko9hSIe5XJAu+S6/y3MzCTNQ2aaZgyup7w4o5quJ03IMjgevPVhlg172rXQwHJr+H38k IgGmvT1lLD8e4XdxieyLy/TzGY9+nm+NmtU7oZUsKgrn0ysHKxyJ1Qa/FWM3CAr5JPnB noS+0CiujPZTGZ8LNdXELjweirdHjccn43FvrtaQoS/OERynUHqjBdciaXoW4LPBxILo y9/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=q4qRHZdv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 gt9-20020a1709072d8900b00782627f37d6si33099772ejc.778.2022.10.24.04.47.12; Mon, 24 Oct 2022 04:47: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=q4qRHZdv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230398AbiJXLqk (ORCPT + 99 others); Mon, 24 Oct 2022 07:46:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231829AbiJXLoe (ORCPT ); Mon, 24 Oct 2022 07:44:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11E03E03; Mon, 24 Oct 2022 04:42: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 dfw.source.kernel.org (Postfix) with ESMTPS id 0EB1561297; Mon, 24 Oct 2022 11:40:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A04CC433D7; Mon, 24 Oct 2022 11:40:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611636; bh=Oo5dzfgUvi7RFuvhID2RTEtBjZh0y9xtz/tZcCFnyi8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q4qRHZdv/TwKoZ4qS8yy8whqqHOO+8t8OagQXmCQijTbiztt5KmIFgHxk1SPqdh/x WbF4nxDgxDMDSJBN+BTlHclI6IOH8nf0r/bx2lrViB1BEXf9XK4PakkFtA4KNaS2aU GxRn0JIuV7QAXnmbJfbhNPhN7JdJv71011pXV/yE= 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.9 023/159] um: Cleanup syscall_handler_t cast in syscalls_32.h Date: Mon, 24 Oct 2022 13:29:37 +0200 Message-Id: <20221024112950.248457407@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569402851172278?= X-GMAIL-MSGID: =?utf-8?q?1747569402851172278?= 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: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: 8451 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp402343wru; Mon, 24 Oct 2022 04:49:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4V56Yrd/vVfwcW9InL8lA+lndeX6sgMpHE2YeA/tTTYQv2hDSc6GusGd8/+admXw1x2F1T X-Received: by 2002:a63:fa4d:0:b0:43c:7fa:95f7 with SMTP id g13-20020a63fa4d000000b0043c07fa95f7mr27436944pgk.48.1666612195748; Mon, 24 Oct 2022 04:49:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612195; cv=none; d=google.com; s=arc-20160816; b=oduYE8IaORu+dYgXq6X7E2W3MnW4K9wrP7nOWzO95VUwMl9ThOaBHdOMFqZCviH9Fs qZEQN+j/g1C4Y+LF5B7yuREE07dYjTCXdgKameKvYRJkAJUtnCQR/4n4yy8cFGRONUk8 v26f2A3UhT1rMw5AidQTZLFE0cYFOO9Khf5Z8cJNSc+nUEY8uk9KPABz0mL0JGhn3SM+ uuZ34dXdL4WoCnqstgbc1U0hmAhiPPlEtWg4DpwjYXBVNc81Qq6Zka1WnVmI+ooQT+jp JHYqr04ZLIOzfWjw0ZaKnPprWA1KvDV0HUji0/fTmNcPxyy4uqS33tgSyVEpfEuZ49lQ 60GA== 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=GAx14qZ/ic3vPEeRcHCZo2zZBpbv4W8RwlKzHLNdHt8=; b=GwqPzvIGwAZX2sAOUiNX4jXB9NzYWtE+XviEIPtn9A/Arp58x8ZeXxTVRZgfClnjBe Dhf09rM5qnOAf42oVOx5byWkdYOGnmHjvP7sOFrlwq33Mna46qNJEex5YvwlV5jcxhSj AjFYGc38KDuzzKB9uVkqvtwVESk+wNrfGNStRBmAEGhd7KkY7y7ryqRfCHwN1TMV0TK+ 88NRPIotAMUaD/64UeqDzbFjaczJSIBVo1iBx+dbxsNSVxcTK8NVVUX1GC/HfyZz7YwY WweF91Rd8eeMuJt5npHZ/aOS9YsJgW6KZGVEMOKSaNa+LpkEaRDwbsKIL2nAtYmzyxwE NGAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fh+sYvnc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 d14-20020a17090ad3ce00b001f31f339134si7593905pjw.152.2022.10.24.04.49.42; Mon, 24 Oct 2022 04:49: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=fh+sYvnc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231773AbiJXLsg (ORCPT + 99 others); Mon, 24 Oct 2022 07:48:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229838AbiJXLrp (ORCPT ); Mon, 24 Oct 2022 07:47:45 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97E7A76566; Mon, 24 Oct 2022 04:43: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 ACF7CCE1323; Mon, 24 Oct 2022 11:40:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3807C433C1; Mon, 24 Oct 2022 11:40:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611639; bh=FX9PiNDyjGyaqH8fteImXXQwO/zrtRRI/sMYSTvfFk8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fh+sYvncJSC96kgi6VKoNdKig8ieGbyPfdOAsoxIVyCxdmJ7f/xckQe9Vr//eN3lg RI+bZxPIjopY4qoASP4g/ehJQFckIHcrxM4ElGTM0ZwU7wJMRLyokTCPw47EHyzCpy /c+/Nrw4mWD+iyT/lI2o78dyp1wyKw0BaStkuOtY= 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.9 024/159] um: Cleanup compiler warning in arch/x86/um/tls_32.c Date: Mon, 24 Oct 2022 13:29:38 +0200 Message-Id: <20221024112950.283971691@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569549669234897?= X-GMAIL-MSGID: =?utf-8?q?1747569549669234897?= 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 48e38584d5c1..0a4dba5f0542 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: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: 8408 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp400042wru; Mon, 24 Oct 2022 04:46:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4enKFjPbOgMEEmCqNNTRsKUwxrIyh8S/E/2A49VHcIs4vB5lKLyQIcT8tEGCkzhPupuBvM X-Received: by 2002:a17:907:628f:b0:72f:57da:c33d with SMTP id nd15-20020a170907628f00b0072f57dac33dmr26906869ejc.374.1666611971246; Mon, 24 Oct 2022 04:46:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666611971; cv=none; d=google.com; s=arc-20160816; b=eQaPQIyIRFnKKIvnya50IMslmmCT+oXnSvG1wGfSEuH9yQWjob94mLlKzsBm0vu3rB 21SN7VX9PZQX6E0tCYzB5msp1DPzPVnZl/Pc0+hboSMRAVpw2EKJ+lgEWI9BgUWHf6qi ljjZiKNePdC0MpunDlY8u0Epc54mnxR2GnROrK+AE58j/2k0vd+oHvJaqzWw3WGd3GDs NBLWCOUUu+8A8gg+syh8O2khA9StzojBuXCTkuyvZXfuxoQOpRAPXNxJZajxsOks+loK gAsvtyjLu5IhChAyOH1o5P+Ly/fUtiPQcZE8I+nhvuKBnxdCodPpvRF1jfmF/nU8bQKW odAg== 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=D6asHg7QZVTjMWOrU6D39hTM69mqKoyxHM8lqzzyzYE=; b=HMq+ShOANxTjle9rzjgZZhMr/6X6IWiKcTTy/X3Wv6JR2OSdPmbTGiA4B2vcOjPJ0e KlPCvAhMY791XbD4KDav6CjCdCjh6z+mVkf2DpJKd7hY8sY1GZ809O4U8yKfMR9mjshE lP8sJ7/F+ScoHsGjepMZ3Shv/w7Va1TAjBB8bADLvh9N/tnCSUG9+ZcVLiwuWLXmjB3Q YlDaf11563De9jXL96sx4aq3Xqzb6tCFDyUjG6shZXl3yaPhQy9zHOYHcEC4LPsfCHlX 26IRPIy4Rf25kJkc3MbdColRxleGmnMIvVc2vvzafMSDwKL1MvC4L01QsXcNz111N88P FmOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="rLt2/YJm"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a17090658cb00b0078e9ca562d8si24151275ejs.879.2022.10.24.04.45.47; Mon, 24 Oct 2022 04:46: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="rLt2/YJm"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231345AbiJXLo7 (ORCPT + 99 others); Mon, 24 Oct 2022 07:44:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229682AbiJXLnq (ORCPT ); Mon, 24 Oct 2022 07:43:46 -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 BCB40112E; Mon, 24 Oct 2022 04:40: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 sin.source.kernel.org (Postfix) with ESMTPS id 7A4A0CE130F; Mon, 24 Oct 2022 11:39:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8ACE3C433D6; Mon, 24 Oct 2022 11:39:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611558; bh=RN47miuc4QC2GlUe7aKV+8SGfPx1U5VJI+JT1YJIOLA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rLt2/YJmMw60J2SyL/fHPszEKUUSj30fdMH8jc23M88AZPS2gF05jXTl7NcfJTENg ij2p+BGWimB5fMp+4lXPhAoZFj8N4iHXkgS7ZB++vYzT1DvapqBfF66gdDMhTznApW lippoKp7pPFKzn860HubszMJq9A6d25vGvxisWxw= 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.9 025/159] usb: mon: make mmapped memory read only Date: Mon, 24 Oct 2022 13:29:39 +0200 Message-Id: <20221024112950.324575967@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569314688207038?= X-GMAIL-MSGID: =?utf-8?q?1747569314688207038?= 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 @@ -1265,6 +1265,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: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: 8406 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp399868wru; Mon, 24 Oct 2022 04:45:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6j9jkWWlmkeFGwXdNTkgrNr2bmo8dHBu9vNWIFNrfG/hr1NB8PR6+k/8NYkVhD1mci1n+0 X-Received: by 2002:a05:6402:278d:b0:461:60d4:8ea4 with SMTP id b13-20020a056402278d00b0046160d48ea4mr13512372ede.419.1666611940032; Mon, 24 Oct 2022 04:45:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666611940; cv=none; d=google.com; s=arc-20160816; b=qoI4eFkedLrAhoisCqtU7mB141ejP7toWWEk9Hc1f+7SsuGS5xidPGud9jP1KWg3kW +PdQlQiNar7fSDT3tgbKW+l7mb9/j737ElnN5gNHUUX3TE/pWkmadMhSQEUlYfbi2JqY 39aZ/mU+BvQi9pI4iEFVHzLWX/3Sl/eZoowxuphQ/oLeaU/FRTtE3rPtWsUWNgFhhFMd Wdq+SavlQINOKbRL2Lj6WiP1Zen4hkRgcNlSHbIWt4n34gRMiSEpaTsS1iXJTjTCPlqE iBjRhyLambolYHoYYOeIViI0fV6A8W2qWUu6rhdOYXf0SnnIR8TMWwnFvTCHlpD0YcTJ SlEw== 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=pScswNFgRSYikkGNOf5+HHLrlvdzFHDErhiYfjaUJg4=; b=oN3u7mZdL/BY+QF5DB5GfqmOxzcxcHPcyl8HvYm97Z9oCe6w3GlXS/D9MQpapA+jIx 8v0sD/PwD93AYmqt2rou5b8Q2PP+7XHCFhKOA6mLol8CBqk3/fp4wpGmjMDpf6/ECRrR WZpUCdSshfntAapcWN8HqhS/+RUNrXcZqrChxUxAhERueT3o3j3/kcMvoKYSXdGO2QTY 1PiO4z/cQ7ReJliarO0abVjapM1JSZJzdBg7MitM8F+ez6ICHaRXut7C0/NX+teLm6KP f2MOoTia+w6I0M/bg+uddyvy0ucz2Dhpa7XBEZ8r1Y38WIpVCMnp9N7fBiLOwbyyv9Zf 1Yqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Nsfv3cWZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 ey10-20020a0564022a0a00b004615c5728e8si7493824edb.494.2022.10.24.04.45.16; Mon, 24 Oct 2022 04:45: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=Nsfv3cWZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231256AbiJXLoy (ORCPT + 99 others); Mon, 24 Oct 2022 07:44:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231422AbiJXLnn (ORCPT ); Mon, 24 Oct 2022 07:43: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 63A3B6F263; Mon, 24 Oct 2022 04:40: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 sin.source.kernel.org (Postfix) with ESMTPS id 5A44BCE131B; Mon, 24 Oct 2022 11:39:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34126C433D6; Mon, 24 Oct 2022 11:39:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611561; bh=u+XRH3Ck7chIHn26YPp8pHDV5FsHo7foLSjyHN9IQYo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nsfv3cWZxIXrRCyPKSeUYLMvpQrbGgtKjAR81ox6mwGoh+kUNc41QNY8O4v5kkBkd 1HFsP0LU0TezNg+VMSRQbexKo5MAioWZg09uMelalAMYN4CDLUlpcDO2I6x/dVV+5F yAl6Pk7lIi+TCoctEFWqjVKL4OAv4ffgRrGRv9bk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold Subject: [PATCH 4.9 026/159] USB: serial: ftdi_sio: fix 300 bps rate for SIO Date: Mon, 24 Oct 2022 13:29:40 +0200 Message-Id: <20221024112950.356420829@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569281632965423?= X-GMAIL-MSGID: =?utf-8?q?1747569281632965423?= 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 @@ -1340,8 +1340,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: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: 8629 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp420536wru; Mon, 24 Oct 2022 05:18:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Q8MhQwKt0DyU6/0tT/zUzHsUAfLYwBJJf9114Ext6OtOCIYVDJY6XJhRmdU6dwdx7yeSH X-Received: by 2002:a05:6402:254d:b0:45d:3ed3:8aa9 with SMTP id l13-20020a056402254d00b0045d3ed38aa9mr29838053edb.157.1666613904353; Mon, 24 Oct 2022 05:18:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613904; cv=none; d=google.com; s=arc-20160816; b=PYJTbfzcYrPrH2iAUxXhW/ecTyncRXuZJVWeX7xJJ4ltY0ylNJLk/QW2hbQNFC5cVw h7GjQa4MELWYJtVL9uZn9VvTIZhFdKtNZndRo+3X/nlOwwotd8YS1VSQLsKSNEpObTAE NmuSjHeYDC5zlOoohul4/+6XLhSVkQgKutgbQn+rXI0k6l9eBkqRzBI7hS11vAQcHj7T LuVviJRIWjt6eeRDls3+yVsHy5EhPp/5ZXx6p9fD0aqLzp+ymqMiNGv3ugkQGJREV2QO gspMu6efIM52dwV2G6p5CofJn0eu22K/DqKD1rnCdqfBbdz3hkxPO/I1ncltbxqN7a6u qHSw== 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=SR3QC3etSsaODcA3FHvbZ4pt/x/nAXIkxviK0D2q7cLq3+QltuOAUpH13j2X+Rve9y QMVqAVYPXubhNnD1/K6EV4Cw3ZNNuRL2Uxa+9ig/bdWrKgpi7HQxyjGC1+N8JVpk0Exh l8cEJ2aSDV3MouWfsghpBNH0DEQwl+XBN6gN/KDErqEtfWVMB1BOrSzYsR+b2EQwvxuW Trfu1tFKvYUE4+TdhQ6wLOllJIfH56s86Bpe0ZsyLj8CgQzVNlUm04fnca7YO9MMxdKP 0AIDMjs6Jk4bfS3CzvSAjbfr0nIFjGDqVVVvjigZ97GcOy9fv0p/m067OnW9EubUT0dR RSdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=U9KyiCYv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 sc4-20020a1709078a0400b0078d484e0e7esi27830110ejc.488.2022.10.24.05.18.00; Mon, 24 Oct 2022 05:18: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=U9KyiCYv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232835AbiJXMMB (ORCPT + 99 others); Mon, 24 Oct 2022 08:12:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232828AbiJXMLH (ORCPT ); Mon, 24 Oct 2022 08:11:07 -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 7B88915719; Mon, 24 Oct 2022 04:53: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 D1DABCE131D; Mon, 24 Oct 2022 11:39:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CFB08C433D6; Mon, 24 Oct 2022 11:39:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611564; bh=5bSnUp5dX34XQ99c1SQZmiSSKHcGvqw4nlmJQKpbDSk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U9KyiCYvhD6GAybrMCFQy8ylSj92w9vnEYUCu8UF4u3ArmuAy54zyYMKNI167izD4 DV7inK/hjI7vPD60U+IyQY4zGAwxQVyZbHSmC8LIkdrSGIdZWuKxtER1+8LmY+rMHh RT+QTxy2Mru7MfKJqnFweXM3MGt2MhPD3gPqKGqM= 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.9 027/159] nilfs2: fix NULL pointer dereference at nilfs_bmap_lookup_at_level() Date: Mon, 24 Oct 2022 13:29:41 +0200 Message-Id: <20221024112950.397696339@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747571341010879671?= X-GMAIL-MSGID: =?utf-8?q?1747571341010879671?= 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: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: 8554 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp417200wru; Mon, 24 Oct 2022 05:12:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5nr8Ylo+Nnzr1Bt9gfKwJ0datUB6y3FtlFFUq7l1Q04mNIODmZkQVgB733cU3O5VArllDZ X-Received: by 2002:a17:906:6086:b0:731:3970:48d0 with SMTP id t6-20020a170906608600b00731397048d0mr27975752ejj.16.1666613565735; 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=1JXLtgRUo1dyUsvyXb6L/lYEHxW/NkqaMt3otUv0pPopaz6H7ud5XaojPUNHE8e8HE nNnljm+ShpMGkCuPi0G1ECSRlhxgMC4F4L0V8/c/nBcsrnwMZuyEuQHADlC+Hvkctogf egFuuy0ZLzybLI2ynlpkCvaLUDjClinbfx50NHWZLsfwSwxIv920ttvhx829wI9BrDg1 W0McNG2RdpbuMfB3prSIG3+uyeiFCrOoK8S3ogaKLnBEwtepfYQnqZfL9aHlD84qzdeL 7lGCdQI6Nr+4AQ5VqrCu4hFP97he8bN57VP2i7yQvCphlYZwH9ou9r/cqAC/pm2PHBRb 5AMw== 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=wBBHVQ/SnCsgwj7CeL+2mN9nfbtgASLm5a5qWciU3lA=; b=OrEWq3215otTYOIx3ZrdUUzOQfb7+Hpp5mxp8sPaO3IKk/ipT3z/F5PLxx725VvBDN 6J96+1BoxFk9hrxlk0oPRoHf/KjuQcAbq1r8oMaoO6hzjE5hZ0cpFN/Z4M6OPv77rLXS rybvh1AXbRsZi3bM9JP3Gg9vxobZpb0w1EHg6PaAO/h+B6onEDjVVtkIz9qfK2NvwgvG yKWzdsF0MjopB0itkyKLK6XaxH+NwiyBT1O1Oy6rRTxF4I4z+gag3ONjoOIoACIlGCef C4LXiRnwbdmFnx1gpV/r1Ab7MDH++Dt3fofUeZ+nUeMKPNqB0jdCTfYZKXH+sL2YOheq NC2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hXOLf5NO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 b11-20020a056402084b00b0045b265a1712si33942077edz.595.2022.10.24.05.12.21; 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=hXOLf5NO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230112AbiJXMBq (ORCPT + 99 others); Mon, 24 Oct 2022 08:01:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232572AbiJXL7S (ORCPT ); Mon, 24 Oct 2022 07:59: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 C98512A70C; Mon, 24 Oct 2022 04:47: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 dfw.source.kernel.org (Postfix) with ESMTPS id 59DC461286; Mon, 24 Oct 2022 11:39:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72873C433D6; Mon, 24 Oct 2022 11:39:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611566; bh=fzdObW4Tz01b4F6wuAJJY5sICvfv8+U/Svx9awbkDJI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hXOLf5NOyXk1YzivyOZxgSost0vHaePp6Aek/HhBP9Ca/PmcmGuJRtdUE1vEt9IK6 uSboZJ61+Hj4RpOJtERSj+5Tpof8npVsYJNKhh3UrZcMG0dUk99C4avCLieNj4hQZt 6rprdXWo5Eq6b8Iv0g99xRTuxi/lIIBbqyA0NQdY= 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.9 028/159] nilfs2: fix leak of nilfs_root in case of writer thread creation failure Date: Mon, 24 Oct 2022 13:29:42 +0200 Message-Id: <20221024112950.436896065@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747570986207274104?= X-GMAIL-MSGID: =?utf-8?q?1747570986207274104?= 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 @@ -2796,10 +2796,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: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: 8407 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp400040wru; Mon, 24 Oct 2022 04:46:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6RK7YkF+o17+YKH4/gXVOH45Oly6xc9AthtiF0bxCdR8BqH491eh5GQSFYM+dKAtt6GsYP X-Received: by 2002:a17:907:2d29:b0:78d:cf5c:5774 with SMTP id gs41-20020a1709072d2900b0078dcf5c5774mr26245504ejc.213.1666611970703; Mon, 24 Oct 2022 04:46:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666611970; cv=none; d=google.com; s=arc-20160816; b=LTOF1AQKxFI4Atl5FjiAQbVh3m/9jvcmI0ztCoeJSL7NlXgj2Bsq3UWsA+0ZRQk4/t 6tLaDzWeF3DctA6/R+bz80qtFMjFfiZ95A21A5ept1RdbfI+2FLTozvCjGIid7hEWR9I 1Exq1C01p3voQ6ZAtZJJSxXLfAZgKYVVyD5uGSFUH4S1dV/nD/RG4o39J2TdIjDfw9Hk DeodcIzLU0UYOuYGlV3hBh5KdlmPn2T6wy4fBolKfndGbuwWAUTT9g6Pgwk3wjKF4FfI /+wrX1KgRffCLHkyeCLicQvRzZ6j9gh6W34AplB7263WTHji6F4O/kxP1V4DxAFLO1db NzOg== 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=Cirgn2uDs8omIoQR3VIPYlKIGZOLtmjP7GIEQC3QhKo=; b=XucLGbRpcqAPZkMJfjmPwCb6DnFp5H8vgY0SAQB9paHXSR/eV3UcCI+YdDhkss+Y6Y Gtcbe+abFxkkQXghMvRhZbI23EH35KbXsx7NEs6CmUyWvdbFWjUTbVPWal51d5AD+axR CuCegmftt/tbgCIH7PYETLypzf9bX1yVetCT2sK+iEL42JhVXhdIsW1aNvvcdk2YtFf8 NzVgBagorjSxg6Hv8kxgsGiH9UtIg695GFiB4OTuQAHhiMZViD0yL7opmCUZydV01978 JtgOQx51nbbX9rr/oR7iLzD9pYLn3eKqDy7YW+ZLmpTNNFwx0OMFlKC2ScXA2TXj5iqO G8Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xfhQVnzE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a1709060d4a00b007878144285csi24136918ejh.314.2022.10.24.04.45.46; Mon, 24 Oct 2022 04:46: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=xfhQVnzE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231440AbiJXLpQ (ORCPT + 99 others); Mon, 24 Oct 2022 07:45:16 -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 S231564AbiJXLoB (ORCPT ); Mon, 24 Oct 2022 07:44:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C042768CF7; Mon, 24 Oct 2022 04:41: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 B06EDB81150; Mon, 24 Oct 2022 11:39:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 184EDC433D6; Mon, 24 Oct 2022 11:39:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611569; bh=3rqP5LXx8iCKKFP0uEtu58VISbcDiA86syfPiL3kk3k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xfhQVnzEkycKeezRKh4AqiOuhQDubS4eYeiZDZvfIXWeblIENC/2gkhG+KN2EqT3b rm55KKltpmWvnkOZv/3EQa1+qE3Tp1McZp8ZX+SS6AKX/9Vefz3PeDGyguc+G/UHzv AH2XR/m+pOpFyRKAgPHO6p2zxq5h+5Lt2A3smPlo= 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.9 029/159] nilfs2: replace WARN_ONs by nilfs_error for checkpoint acquisition failure Date: Mon, 24 Oct 2022 13:29:43 +0200 Message-Id: <20221024112950.485039215@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569313839461450?= X-GMAIL-MSGID: =?utf-8?q?1747569313839461450?= 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 @@ -888,9 +888,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; } @@ -904,7 +906,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: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: 8749 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp429412wru; Mon, 24 Oct 2022 05:38:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4QcLB7FWBffoqJyE6mWwJacUoKX3YslcJQLCdRW+RKRJj6ufQllzD6m2qat+/F8096DW4x X-Received: by 2002:a17:90b:4b0e:b0:213:227d:14a6 with SMTP id lx14-20020a17090b4b0e00b00213227d14a6mr2469678pjb.12.1666615115213; Mon, 24 Oct 2022 05:38:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615115; cv=none; d=google.com; s=arc-20160816; b=zQoI8KxFgdPyU97g7TtqlPY5IsoLdPtb9QyqW77BLdvsMN038Pnr+XuCz8n6Msqm56 37UPFuV3tKcz6E+MwOqgFVVJBSuyvsV/VgTyU3MHNW3znAk09Q+D/mpkLluZGRKQ1OUt k29lhm0RhGv1slJk8Vry0IpnVJRc3Yggn2loPootUSJOsHm+gCgGr2zo7TTXHLgzMNDx wchcbBbrwRzXEvWpJZSziUnC0uS8Mrfr8QATl0+QbooYkXpL1iLeOIUvxnJFnHUHywjY 8mBQuyxhWltWAJe2Z4qeI3NA8DfF9X3Y7krhojh9wgywCVR2+2TR5X7smHeVGOiltV8J RGOQ== 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=dJB1TNAwpSIGMKtGOJmie6C3pP9ZykNtr2lYIJXUxe4=; b=Ik3k7PRKWqKLLz3H+hlQyT0yzoOWuZqvaiTa6WcUBX/rM82E+DOi6dCQ3jFZrgAZH1 EUg9PcKb+UQPGBEN554ZTec5pJ5QE3IjSF2fPhYw0EbNAgPUtM6huFNFBeheL1VfJ4xb LWb3Xx3ieldCnAQH9598sSSMUJwJXP9tqgQKP4tTFQGLMgkC8/JeaHCJYE9A3kh0I2vv 0u/CNQMyqZC/bjrFK9vUXpIBJuv3oUhatyataiPHyGKUKKH+fnhQrBi1zdWm1sDvejqo SC4iI++Kav5AJfSSvmnT45SlE+aFh01i1KnoI4jjDlsK1voy+Z60zNPYzX667hYMhhOF PMzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=J3Nw2quF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 d20-20020a056a00199400b00563b7ea2d7fsi8425114pfl.144.2022.10.24.05.38.22; Mon, 24 Oct 2022 05:38: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=J3Nw2quF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233692AbiJXM1r (ORCPT + 99 others); Mon, 24 Oct 2022 08:27:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230323AbiJXM07 (ORCPT ); Mon, 24 Oct 2022 08:26: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 E4146855A9; Mon, 24 Oct 2022 05:01: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 4E005B8114A; Mon, 24 Oct 2022 11:39:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC687C433D6; Mon, 24 Oct 2022 11:39:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611572; bh=89u/RKNk6aKgLaW27g8p2OhkdxTPjr9yb5zFZbtSKWk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J3Nw2quFTpnqX4LI3MujVO2aVV5LOT+1ffeXMdPFajPUElWSxeQeDY24L9tpY74aP I7nswtOHjHRTRxWxux/1+lw4TBUx8h9U3cEePesVIXOmRLImzqfqSz0pCI/opDTTdZ zZSC1X2sP4J3dfNnHCYySFzR1gxObrs3BACp5yms= 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.9 030/159] ceph: dont truncate file in atomic_open Date: Mon, 24 Oct 2022 13:29:44 +0200 Message-Id: <20221024112950.514548543@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747572610781133775?= X-GMAIL-MSGID: =?utf-8?q?1747572610781133775?= 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 4.9 backport] Signed-off-by: Xiubo Li Signed-off-by: Greg Kroah-Hartman --- fs/ceph/file.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -354,6 +354,11 @@ int ceph_atomic_open(struct inode *dir, err = ceph_init_dentry(dentry); if (err < 0) return err; + /* + * 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); @@ -384,9 +389,7 @@ int ceph_atomic_open(struct inode *dir, req->r_args.open.mask = cpu_to_le32(mask); req->r_locked_dir = dir; /* caller holds dir->i_mutex */ - 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: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: 10373 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp688379wru; Mon, 24 Oct 2022 15:50:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM73UkbdS4HWOA06HChixy6vfGlRDPDSsgHjS6Vg6gXhjpPqy5b4DRhM6UiuFcXqGRsURN0s X-Received: by 2002:a17:907:1dec:b0:7aa:6262:f23f with SMTP id og44-20020a1709071dec00b007aa6262f23fmr4047934ejc.38.1666651815817; Mon, 24 Oct 2022 15:50:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666651815; cv=none; d=google.com; s=arc-20160816; b=FZs+BwTEwd2OQRK92CLuP8JX5a7R4i3aCPufzPacmHky1JzPe1zrxHTsAp66Hs6TCF O6/vmJP4Bxf2HmeyHwglZJo78hfDiGDLLiZlo+8RYHjbHINIuQ0pCxYWstS1N3uePISo cozYnayxP1BtXsP6o/qziUN6BmaMvpq9N6EGayRhjuGoaPXjP9OVElf6NOqtFm9agx1e Sxcvd4qSrvU1Pgy8pjV60u9NX22BOkJhdB3LDTtQmDZS4UHyejTajPbPmLMmOHZpI+y1 NHDeGc4/2pxVg9blhdLU5dJy46mvfkc1Wv7JAewNDa+6Datgzb8W5Rgk72cJQFF5IrQT AEhw== 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=Lit0bBARiwIiPQHbUTyfFIvvPOW7Ifm0gLpqWiJWctM=; b=mMsTjlkEehC0zJnBo4PG/IcVnM2CNsOBu94KZO1SMkOwih/SnCKok7pE/n2FxNSesM lBMl8LmZ6houeR2p8bi/d1MarFCcPqTD4EHoxPx6wzQcz5YS79KVrVk6AEiou/3HZ9pL j7nS6IBXTtlJ1ZoksbuPPVSHcsgRUTfxsdHgVwrHDFu3+Ap+qUd5h0lO3Bn7HjLcCnq7 lUjZw0wGOTPZqoR9HgRDz72hGOQ7FSGb8hdMclbAQRVXlNUfp3ko6IaIBwQqt7aGyR3Q 7hlY/94RaLaARZlhZ5tXrcYR0fs8BhR54OO0moYUcYmDUFb0Gqyomocm2/TEdsnpAcIt 53YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PQOl9iOX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020aa7d507000000b00461aa80dfa8si882684edq.429.2022.10.24.15.49.52; Mon, 24 Oct 2022 15:50: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=PQOl9iOX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230221AbiJXWt1 (ORCPT + 99 others); Mon, 24 Oct 2022 18:49:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231490AbiJXWsl (ORCPT ); Mon, 24 Oct 2022 18:48:41 -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 2EEC52CF4A7; Mon, 24 Oct 2022 14:10: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 sin.source.kernel.org (Postfix) with ESMTPS id 61AD7CE1318; Mon, 24 Oct 2022 11:39:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54791C433C1; Mon, 24 Oct 2022 11:39:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611574; bh=7d0m2Z6BIjDkYt6daIwwF++izl41uVIUnp2ibyflk6Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PQOl9iOX1nyMMdTkqlnUOGy+zJo4rwFZrxjLlMSfp2LoYeAZ45xncW5QYJMIocoGV fuxc9X6yt0vC4cWJFirkCcwj/aLDv6/8xlck+d2zl5JxydpwRuvTf+A/cOO0vclN4s hfkyiQi9DLFe2/SwEufbbfoCBE0AraVp5skKVth8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Jason A. Donenfeld" Subject: [PATCH 4.9 031/159] random: clamp credited irq bits to maximum mixed Date: Mon, 24 Oct 2022 13:29:45 +0200 Message-Id: <20221024112950.545644221@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747611094073962499?= X-GMAIL-MSGID: =?utf-8?q?1747611094073962499?= 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 @@ -977,7 +977,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: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: 8450 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp402319wru; Mon, 24 Oct 2022 04:49:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5gC6GlVX5JefJun2l2kuyfgYZiW5OLkfq2+chef2yx4MIrrE2e3F+YxAwbuXAaLF5tUBCi X-Received: by 2002:a63:874a:0:b0:46e:bcc0:c69d with SMTP id i71-20020a63874a000000b0046ebcc0c69dmr13571815pge.89.1666612193297; Mon, 24 Oct 2022 04:49:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612193; cv=none; d=google.com; s=arc-20160816; b=GJfgp2eeTUGBUzRd03p3lG7DR3jkrWt8ETsSd0V013gqpRiVvYj8ubGi9wYoE6mekv TUB7+TZKxgy7i5aJzcKUd7aYRVBarHLGZ384fYWi72Dk2tWT1iNiFDFZIAKldcd5bMhQ gG8MyukF21G2DLg3oGYkjLksmyaPbxg5G/tpvZmKL83QHn8WfNkFf8wMtpDEEpc274yN P+ZerinylelGuCsuVbqXb8+QA6nk0ayRlR+xHkealcBuYMiWukboQGdpQdgnQbhkK3sk KHLNeW+s04L5PCfsUj5KIhy7Ua5E8pVjuvKX+QaWJ0fgmHVkPJ4c7e5vb04d2Zt8JzVs bD+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=9TIF4x2/ptokehMJk5B4KkWUReXmT8fsdHwmXTxdKwk=; b=Ae2bg3ntPqBKUMSS54ekSRdnazaGVPCkVX9dHVgwJi8xLtfnhbrQvGAPONQvye3yxD BlfD0HEoPQ1d+Ki7FDjZmP8fWCRTLDB5NweYxnZjoWzn3goFpB+tGH+BDoCpd2119lWR 0rE/JgO9DXa9/ha6U34qywOwjGUPAvORryhSCS+iZ2JG1SHZDO5X/6DZAFgKCAGuo5e7 pjIRF9XhmQUOJUfHTuR6vrTFmpRDDlmL5ik0JF4sNX55ys8RBSiwhDR3RWNZQL3dAYJV dNY4csSIEznRV+xlwafi1bW1CvBcxpY7H4ZjSNdcr0GGaG5IzJvtJJ43DKsJ2nR2Pv/d /+Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cCBoLMbd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 t6-20020a17090ad50600b0020ab20c54fesi8537478pju.114.2022.10.24.04.49.39; Mon, 24 Oct 2022 04:49: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=cCBoLMbd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231761AbiJXLsc (ORCPT + 99 others); Mon, 24 Oct 2022 07:48:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231712AbiJXLrg (ORCPT ); Mon, 24 Oct 2022 07:47: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 C762B1EACB; Mon, 24 Oct 2022 04:43: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 E25AC6125A; Mon, 24 Oct 2022 11:39:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0B8AC43141; Mon, 24 Oct 2022 11:39:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611577; bh=csLkbOe7YV/S/rd9A47GzNYDSCRvmZ0xqZTGJscfmwg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cCBoLMbdgzKVaosFN3BZtELfxM26wlNoeYeAFa9som4uN9TPxPjk5en6uL7b1fIV/ fXJc+bqXAC4+8rpfdBF9LYxE3eZVcu0jeW5LgZRmG9OoMmybRm5qi6yyt7z5ruowEo YDhT/c7i9JnCq2/4iD79l05gXOPQZcLo/tF+Mnrs= 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.9 032/159] ALSA: hda: Fix position reporting on Poulsbo Date: Mon, 24 Oct 2022 13:29:46 +0200 Message-Id: <20221024112950.578096067@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569547606457070?= X-GMAIL-MSGID: =?utf-8?q?1747569547606457070?= 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 @@ -2320,7 +2320,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: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: 8454 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp402444wru; Mon, 24 Oct 2022 04:50:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4dm2b87qEc0G+3uEBuQkRCDahG0mJuBvCXMUxrPqjbMsJenc+7zRrRqAaTyZENQvXfAeXf X-Received: by 2002:a17:90a:4e85:b0:213:13f2:162b with SMTP id o5-20020a17090a4e8500b0021313f2162bmr4892640pjh.228.1666612204953; Mon, 24 Oct 2022 04:50:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612204; cv=none; d=google.com; s=arc-20160816; b=l0elMglMe7Lp534UTP5YGb4MHMTjSvBW2ceavRw8DWqGcaV4CYkdGUm4qYaiuws63E T2ooweEtQRDBXkGLOOJTZwav1mow4zfgk9/Nc7ojPLUUvMhf1MNuyRSUWIMJp42rQpGg qOTbYMCWGOUSS7AxKDVbyv9+iUnkoK7xY32VQJ/MstLMsFX1EAWMwzmuzKjeZ251QXaA +3QSQdYvRiALlSs2UesQ6hLKv9AqUvISC+jn0BPl2jE9cU6oPMZW2lgylCLQHveg3ieI NGruc2YCr8//gTFEZcHf3azZ6f2DyjOcazp8o8I9fHYEwYy1h4NvrjCKmZRr5M28uMiX E+lQ== 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=++M999F8IKsNZJg1CmVme5CeNt5eBJNJRUkjRNcGmQw=; b=NYQWVOZc3joT0DlZ6tYDPSt3yDsudp83OoezHRdWb8TfUu4iZvtQrZX4bvleVKnfV8 kMe8e9lDWKigIv5CrIVVL3bU29Y0vTfsRGPix1yQPIAms/X/Rsg4MZzIP755Si6jTWQp IZllUlZ5uFq6/Tqe8dE6nDTW+WeXxTiu+QB3+Xtm/rD6/XcQPnDnavVymXiR5XmgBd3K eM6ar/6TFEfSjL/bPeaOzx2Mvg7DB+iwIc7H1uDG3IYzhDWnyDgqZIAjHKE4lsr2zWmn sanOV6unhB+lTALcGZV0k1s2GhU4b/JL/RtEW0r8ZDgevVnH6CB2iXIJTrWOCE0tsUWb vnAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=B7DONObC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 i2-20020a170902cf0200b00186a2d376afsi4406117plg.273.2022.10.24.04.49.51; Mon, 24 Oct 2022 04:50: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=B7DONObC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231788AbiJXLst (ORCPT + 99 others); Mon, 24 Oct 2022 07:48:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231395AbiJXLrw (ORCPT ); Mon, 24 Oct 2022 07:47: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 6251A2873B; Mon, 24 Oct 2022 04:43: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 7ADC561274; Mon, 24 Oct 2022 11:39:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DD69C433C1; Mon, 24 Oct 2022 11:39:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611579; bh=nW8JXdz9lLh+C6f5ic/RdrY42SCc5YXBCjzwXfQCsbI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B7DONObCk+Zs589nlTlku83IRDVC6Lz+n6Yqe2qI7xpEiD/6oeYeD5l4L6/9QDjxA JxYBEe82RfLg9lfBnzkQM4yk05p4zPjNSSxIRTg1ejPXHzJ5nmFLADL0828KFBZ9E7 ItZ/0TgQrZjUkslR4yRMHtY7z8B8FiXCjGrmLpCM= 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.9 033/159] scsi: stex: Properly zero out the passthrough command structure Date: Mon, 24 Oct 2022 13:29:47 +0200 Message-Id: <20221024112950.609329923@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569559206953207?= X-GMAIL-MSGID: =?utf-8?q?1747569559206953207?= 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 @@ -653,16 +653,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 @@ -214,7 +214,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: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: 10128 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp633697wru; Mon, 24 Oct 2022 13:15:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5XK5Jbt8lyascuuOHkTv4y9DA6U0KAGvXRXSiZ9jnFmTDGbDHSiraPQoqo50YfYTbjHAHw X-Received: by 2002:a05:6a00:9a4:b0:56b:bf28:bb10 with SMTP id u36-20020a056a0009a400b0056bbf28bb10mr8137624pfg.22.1666642504904; Mon, 24 Oct 2022 13:15:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666642504; cv=none; d=google.com; s=arc-20160816; b=Y+FB483hnekaha98c1L5x6jJJ3Gs2+FDNlzm5McgT8Q6Zi+XGtVsR9Ix5pSSwNgbiN yLgPYd37Wwhc9s5kNClf60T2QYssLwlV6r1oZtXGKFLDx/JfWLlAA9dgAothwf+Tn4nk 6TPN48zlAorxFOUjw9qG5tzuEi4BGP56R8jgBY00p/kWGY2G1xgV9ZOH11oWDW1CXmmU mqu3bE7NrcL+eDKVBv1qECJM5gfKrrvY6NnCSu+vwuoq/a/MwgXPLqC06DTf0XekNMvc z407weynOCM4+GxGgmF20khRHjQLdfB/6yWvRoECJiNUsG7MNfjqd2kASozDD08eP8pa OT4g== 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=wiPYRKg22bdKjxiZ7lJ+x8xJSUazuS5Nwp7GhvR2ylsR5iMjx9RVwTxJljLbq8IEuy CaIKfraPpOg4ua0os0iVJ1wSne8F885Cg6qYTFSIRIfuc6hmWDkV0yPQjXyuZInDxdch LS4St1jWASP8jEIe1Kz8yCsR/Yl1/+zgMUcJklSTuhgVL7D8SqrA0wDpqvmqxSO88Lq7 cHsIAqfxjXr2ZK2uzs6dinztYJWd19KdNkKc4Ef7bYcGOmABSm+xU1tMb4yoP0br8021 XCFpRCmvKdHHJqFt2H9smTltsmp2nAhHl79NeyGVOAi6+8OU39jzVtz8G8WFlpAhZEVI MMUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="rrJLIH/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 n16-20020a170903111000b00181bcfcaa6csi653318plh.45.2022.10.24.13.14.51; Mon, 24 Oct 2022 13:15: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="rrJLIH/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 S231373AbiJXUFs (ORCPT + 99 others); Mon, 24 Oct 2022 16:05:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233890AbiJXUE5 (ORCPT ); Mon, 24 Oct 2022 16:04:57 -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 8725022395A; Mon, 24 Oct 2022 11:26: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 2302CCE131F; Mon, 24 Oct 2022 11:39:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24628C433D6; Mon, 24 Oct 2022 11:39:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611582; bh=LSxeXqIfLkfCe1mrHfnM4jsex1rUwKaG6O4JFKNxDsw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rrJLIH/rXabOHLrfMq8iRMcdPWpbo0HsyLz3xfsts/HoomUK93hYEYIKRo+HqFnoL zGMFd5f31Li6LnDaTIelZ3vrGQhjGddda/HvxKHitF3njl6xTa6QBFa32SF3tIlI40 P8b3Z+LJzTH3VpqhGanV6kmne9SECW/Az5jnjxkg= 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.9 034/159] USB: serial: qcserial: add new usb-id for Dell branded EM7455 Date: Mon, 24 Oct 2022 13:29:48 +0200 Message-Id: <20221024112950.649084226@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747601331323414844?= X-GMAIL-MSGID: =?utf-8?q?1747601331323414844?= 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: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: 8413 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp400181wru; Mon, 24 Oct 2022 04:46:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4CV+g9SogieDEnf8auZPGqNt7YYJ56hsP3xNf9Iffl4EKRU+3ax/MDZYtQCSi7hYw4Ca0A X-Received: by 2002:a17:907:7203:b0:7a5:b062:2338 with SMTP id dr3-20020a170907720300b007a5b0622338mr5978492ejc.8.1666611991299; Mon, 24 Oct 2022 04:46:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666611991; cv=none; d=google.com; s=arc-20160816; b=t6sVk+dkLamkoUnO6PUMSiWyK2jqJbJusIO2LGX2Qws6ExieJpw4ncC6KDfDAqbJkx 0BYFroX/6OVTcGt6Lse688tTd1rhOHQqFz8IKJPbnITjHwsdEiRmqQajwAk5stEoW21F 1/oRDxRca+x/Y33z91y2g6UiFdHsHFDzR1RUqUQQwOe2cCeEHZu/qchY2fAKAmVG4UwR GOtnZv6EzJk+WJ1VD7Cc+ey090evdoVX25qhfHXl9NVipRoaaqThgkD2nr8wrFiyBcDo u7zAKrv5PX7Y4wC5dkBOt0dGkooxzy14zAPf8aGJqeHSynb45LgHT26lbagj+9BJ2VDQ uZqQ== 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=SxJP2RhnXZfsR6nKWVHDhJ8EImfh03iiuzd0AqNkBgI=; b=Kozuogxl7DRV80mORnJkuDIS32/EzfmxE0tesUBqBVbqNTSmGjI6+2mCastD4uw9vM +hK5cF6T34Z1qcWYNBsPfeHlNxVnjBik9zGKl9bYn02iU6iW1QeE8UluOMfutu5HmnpA zFAk4GlbU0mLkPxrhQmdYNrBVhyscgpALhkcFKQGY9jwYCPMsMqlqoNTzAXEHTTkrwv+ rkEc+GnbFoboxrzqu4WkdihunlgDytImfPq2il7fDB1DlNK4mDefQGll8o75plnM/awE c5VR1rhSaq26cdiu+5SVmdpOwa0xqEOv9Ut3r5lE1fKEv23aFMXubCRzt+6M3TJp86l4 /D5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="a/QMcWoX"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 dt19-20020a170907729300b0078168566b26si27647617ejc.356.2022.10.24.04.46.06; Mon, 24 Oct 2022 04:46: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="a/QMcWoX"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231489AbiJXLpk (ORCPT + 99 others); Mon, 24 Oct 2022 07:45:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231573AbiJXLoC (ORCPT ); Mon, 24 Oct 2022 07:44:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 636E873C23; Mon, 24 Oct 2022 04:41: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 dfw.source.kernel.org (Postfix) with ESMTPS id 5DA5561278; Mon, 24 Oct 2022 11:39:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CEF8C433D7; Mon, 24 Oct 2022 11:39:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611588; bh=0uhDIdfk1epcziMHFK+ZKD1E2NsUZQU+n1FAp35sSls=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a/QMcWoXEiUs/kSOhgiA93hC7/VVYohdgIvVsWfhJsjF+f64RC7hSnJ5F5fqGR9IQ pgO+fKt7tqt9jPawRqn2qi7dzSZ+pjopOcYHWjVe/Zc+MbF6iJ4mzasTQkSNEDKhfn mpnmRyOASCzTXXBEmDsfsvDnup95kFXYwTCde/pc= 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.9 035/159] random: avoid reading two cache lines on irq randomness Date: Mon, 24 Oct 2022 13:29:49 +0200 Message-Id: <20221024112950.680129573@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569335520964464?= X-GMAIL-MSGID: =?utf-8?q?1747569335520964464?= 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 @@ -891,10 +891,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:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8558 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp417485wru; Mon, 24 Oct 2022 05:13:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4PIemLnPvrdV2M/pxvUV4S7RJRASYID+bUtjcUsiRB6LM/uiZsjogIHpDpyvp/YiiMdTx6 X-Received: by 2002:a17:907:7638:b0:7aa:987f:4e91 with SMTP id jy24-20020a170907763800b007aa987f4e91mr1222029ejc.442.1666613591621; Mon, 24 Oct 2022 05:13:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613591; cv=none; d=google.com; s=arc-20160816; b=cpCeUnNxlhr+p7fnfm3raw/SFg4Hdh4VGUFReX6L8Pex/4rQEdQd/l8CSMUDguMdYg /4gtOhTkuRrqjyRTlAMRFeBMaCSLI8EQ57KML+SSFik0Ayb5debJ81/0C4tBOA5F91fl YBGJBSLxgzMtv0c8Rq4Uc4Yf96141ZzW01+cD4ZaJ4e4YIf1YdkJ7BnvPhpaIBbkywV1 TWNQHSZFbULZPi2nOm8wFxxHsYZ7CHIAs11uJCUy8me5ZHo9YIfOBr/x5MU5JKZumpAO 0/RNFXWU3s939esa3zdFZK+Wgju2wQAldlLB1HntzEAOltcQrGki8pyWMVil1d+0GVrR ZJWw== 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=6d13aiVj2Jmyy3rUatHe9ZeawUttXIdC56xIkiysHGE=; b=CDokP1Q++6105nrvRSqzNLjbe4Ju3kR4VXNTBrGPf8zUcmaFW0wkvE8lcmP0K4gzFS dBD55xOyrZfJvPyIXyofG5R9iAoHUHGv4o0m74JG0ljJg0zs63XKztOIEMf6J/b7hlMM g9JfDgU3VZcpyMHFtvYSG/D9m2dMYuvtnCPqa6cViFYAdzsziLNgjbRW2WFBib93rU6R NqK0qVOCqe+Q7J09FmKv97lDHc933hRK5GkdR8JLA400Ypoq9QsWvtLW0ir0x3v5QcDn hTyfzusgDMdPjZNboAEKqix363nWaSnfdjmYoUxkIgmNpSuysr2sOnT32a/u57mdRRg3 jTLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MmlZMV0K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 sg20-20020a170907a41400b0078db6f5f4b2si27932257ejc.546.2022.10.24.05.12.44; Mon, 24 Oct 2022 05:13: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=MmlZMV0K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232438AbiJXMAr (ORCPT + 99 others); Mon, 24 Oct 2022 08:00:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232429AbiJXL6w (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 8E2C87C1EA; Mon, 24 Oct 2022 04:47: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 22EDE61295; Mon, 24 Oct 2022 11:39:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37333C43470; Mon, 24 Oct 2022 11:39:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611591; bh=Ap5ywalXWtWaRZsxV1rvpRcRkw5qRaysAZ8ipIM0BpQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MmlZMV0KI7fYsqzs9WjRlo6jMeY2ihX2KTlmHE2IE8sbAVa/jfJkv7Hvzju701Fjl of+J0KaE0F8+Kpav9kozSKiE089e7tvi8N9+wYxrqWyPZBWokHtZlSVAsgaPcz/p/1 kM+Q0Rf+kTVeIqfjiL/ceh4AjN3KJ8dPG7BxkXgg= 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.9 036/159] wifi: mac80211_hwsim: avoid mac80211 warning on bad rate Date: Mon, 24 Oct 2022 13:29:50 +0200 Message-Id: <20221024112950.709946230@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747571013503979543?= X-GMAIL-MSGID: =?utf-8?q?1747571013503979543?= 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 @@ -3011,6 +3011,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: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: 8416 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp400270wru; Mon, 24 Oct 2022 04:46:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM43M97saeNWANGJ/QCGljA0hROl2D87vkjL629rb7Y95yWP0r0VgpA5SPKEkwdonjkp9MPK X-Received: by 2002:aa7:d059:0:b0:460:9021:73cd with SMTP id n25-20020aa7d059000000b00460902173cdmr21082979edo.55.1666612005202; Mon, 24 Oct 2022 04:46:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612005; cv=none; d=google.com; s=arc-20160816; b=cdtPGFCiY+V4PYkY0P1eBJ8T1XBxdspd0fUAsclTJTvXgcuI7sJqgNFrQWrGFu0D85 IwLo1gnPJtr83K3amMoZ6M6ZopeaINcQeZDui6DFkw6H9MGxfmhBovuie08Cj1izQs7+ QPn1cJzYCWUyFWzzX24mu8WNtQhIFoBkqBcpPKWj/pN+ozDp1/sk7nkEEoo+S3JiGD2o VkSu678KBX5a99wmb/oToZdjvIesGkq2oCOXr7IUdx7luni4BA1r3atkbTsMsqAbcmTv h6yYuawjfeBksdfBB98f3AnviC+4qQ7HiDedSZ9iRJZwxRYBD1XO+YA1f5eLfYNh8/GL vT+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=yMiOb9jNunZfD96zeq5v5+NzP82+WTx7P6OfM4AnUUA=; b=cLZlocvzowt+rWcvJ5h/ZsDmvSi2h+A4Nhnctb/veqnJ2VVRBMo3NbfG7EUs/ul9zw +1eEZcWjd8Bfy8DrRloy33mNC4Y3bAqeQkALKp8WwHk5vHk5DvO4bTEukN3NhWkwSHK7 dJzEpozuprz4MA0iYyLCGOGhEbvHjv/P3Gzv0LulVB63Dj0E2OvrA16DRr2nqjZ+78x+ aS8XhD04sVxFDJiuQae9TT4kT/++z4dvy474/EaEY/t2VllOqVRoLUm3tPzPstMtCRFv 0KLQKphDond+uP8J1feLqbLaJ7dSIorYGC2ltusOLqcjtBqsHKUwE74YmGplnoMShCdH CMGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ohjFe7wJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 js10-20020a17090797ca00b0078e20d9c473si22603306ejc.764.2022.10.24.04.46.20; Mon, 24 Oct 2022 04: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=ohjFe7wJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231521AbiJXLpz (ORCPT + 99 others); Mon, 24 Oct 2022 07:45:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231668AbiJXLoO (ORCPT ); Mon, 24 Oct 2022 07:44:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29CBA73C1F; Mon, 24 Oct 2022 04:41: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 dfw.source.kernel.org (Postfix) with ESMTPS id BF2D561281; Mon, 24 Oct 2022 11:39:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D21C4C43144; Mon, 24 Oct 2022 11:39:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611594; bh=pmOPmI+oMzt7p797XAEtSZK+rbfd/3Vbxj8UdGQP6Ek=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ohjFe7wJsIa4OHcGfJetr0J3szMfO934pBpJHdoKdKRsCMX3KUOYGM2i7106j/54b nlKS18/x3p+tYn4vtXztiqvj3yC5CiE2KMgBosUQWulBlqm8levNMQ+g2SYqKgLcsl 0JDMFPjQXNzVUcddzRYv51RazcQPRhiSHbQGmWIw= 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.9 037/159] random: restore O_NONBLOCK support Date: Mon, 24 Oct 2022 13:29:51 +0200 Message-Id: <20221024112950.742291077@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569350096950871?= X-GMAIL-MSGID: =?utf-8?q?1747569350096950871?= 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/random.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -1295,6 +1295,10 @@ static ssize_t random_read_iter(struct k { int ret; + if (!crng_ready() && + (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: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: 8415 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp400221wru; Mon, 24 Oct 2022 04:46:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6wkV6IWi+OWb+TOjUdJmGefPFXJCAuo30sBtKheDDK9jkiswHpMQIrkdz3AeI97B7mEPkG X-Received: by 2002:a17:907:318b:b0:740:33f2:9e8 with SMTP id xe11-20020a170907318b00b0074033f209e8mr73010ejb.138.1666611999043; Mon, 24 Oct 2022 04:46:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666611999; cv=none; d=google.com; s=arc-20160816; b=QtRqLom9xQy23kJKmTH1b2veIyS7Fs9KhT1qGPfq7c0GRNNUixXsozYzGhKDYosc1d Wjz5KwgwtzF8DVcjjYUuUXnfwLwqEmaAh1+7q/pn2MTq9SOoN4QzeTS/SuI0bzOHrO09 BAnzn+w7o0aXftMC8ly93nc5bRg69jZ9BpftAcWNUOZYOoGO9mYbDF5bfIqbWm1YSF65 9pOvvKGe/xmOC65A0jhprYLTSuXQzl9PJhkY/6UeGc//3O0wgiT6AfvLZlvdGqoMAO4X jZfZ5mD1ystCE9/lpfnj0XI7Y6CFIfjTKstP832CB2fjtid3G/QmuB+o+mkGifOm6deY +KDg== 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=zT5ZilW5xOrctu+fNOWVBCTr0MSfj9BNMP/Q+ednhJNmiCThZE3aAGdLhciWNosYwJ YEMi3qenlh4gWSJtDIXRxM4FVEVBvmaCDm4kG4tbfW2bo0llCKaKP7ow+BKJqolA1Cf3 4a4h9zTGZPwT28gwCgy8DRlacQqLlrY8MGnQq/40BZn4yZN1vI2DnL5y/mAEva4Nwt3M PNaZpFvTsWONWrkO4FzAZ+8woNgQuvOjU+bXSqjjGHfp8g+EdYl+XnLF3DmZUD4mCWSN y95F1rPGBfFH9ITMyICz2PPPN9eBUGhvb8DmjrX4LZ++QaLSqtph36oKDn4hifxaKK3l alKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EVVjGITc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 bx13-20020a0564020b4d00b0046107f951f9si9484513edb.237.2022.10.24.04.46.14; Mon, 24 Oct 2022 04:46: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=EVVjGITc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231511AbiJXLpu (ORCPT + 99 others); Mon, 24 Oct 2022 07:45:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231640AbiJXLoL (ORCPT ); Mon, 24 Oct 2022 07:44:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 120DF74351; Mon, 24 Oct 2022 04:41:27 -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 1F60BB81134; Mon, 24 Oct 2022 11:39:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C79AC433D7; Mon, 24 Oct 2022 11:39:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611596; bh=M+kMlfAoQikrPHbtIag+tmDBlxG1n/qkIVokq8i/99U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EVVjGITcuWlkzcXaSfk2skPKX7IK42uWuu2SHajJYX9p8+ivCOTe0WwQILlgvXayS 2Bcstit9r02LzLmpSMTzE9CP1XYADOIEkyfK7YlXRjTrj6UkVVbvf9XVEif03XDC3e BSuKKV51oXnIsfWhMLauoNM0jajNC7FJ0m/TjJkw= 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.9 038/159] Input: xpad - add supported devices as contributed on github Date: Mon, 24 Oct 2022 13:29:52 +0200 Message-Id: <20221024112950.772909658@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569343197388581?= X-GMAIL-MSGID: =?utf-8?q?1747569343197388581?= 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: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: 8611 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419847wru; Mon, 24 Oct 2022 05:17:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6/mpa2g24mMMKWEp54Z4a9vZaKMYKoq4Gc1o1Cm3mJy6fWehSUbTYaHy8gGmlylG5HJel5 X-Received: by 2002:a17:902:b708:b0:184:3921:df30 with SMTP id d8-20020a170902b70800b001843921df30mr33663250pls.43.1666613824521; Mon, 24 Oct 2022 05:17:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613824; cv=none; d=google.com; s=arc-20160816; b=nGbAoMGyP9KaEn+KfG1Jz0iidQXDsVR54okASU4aRLVWWqFnqhNsi9okz3tFjYFmYx VvkIgQHTAtlSE6fGtaXBsn8BjpwcGYbxgb76vUOJ9eD0vat9RRY/loTAILi08Cae3W6v uDfJmxt+M4cRYEtAQgMAtTNytei6pKR3Y2oM9KOIlnTPw1sTctH88kC55VWeYg2uzYay Ne1DYXSbmXSsf3hL/3uiKHmWfcZvjLKBCaaMZ8i0YO+DSYBa+7jjUjlhOet1VIZeW6F4 uprRKELtocisYPNdD22frGn47uq42gRU2SY3KDgMoiEyj98Vbd8u+3FD4vS5L/imekHm 4xvQ== 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=yQpyC0Ssz6vd4LD3YMPHOVntQcd3OJgh4dwFtZ71mleKxgoBmJm9MZUzOWm/sXmz8t VX+b7RbaB537hSCM/RfTla+Qyv7Sp41hD4C7V2W9LOleQaeGpzyv+KBCgW5paTK94tIr eYe7fho/vNPDOFBLuh92bkjzBvLooM+3pR9/L7+8eZCbrp4YDdytS2JcIl5SI/uRhzNZ pp/6I1SGdRfeBrRUTxPNnl4z0MgktQeGEqL283iJ78DGdwcQvGxUZ0O3hSw5xOICEzlC V7imidoqY5cJtLygaArSXURU6nKGzGIyOrSVvWdh/bgQujc6RAeOyFciClDipmquRwQ/ o4sQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gmWnYtn0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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.16.51; Mon, 24 Oct 2022 05:17: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=gmWnYtn0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232758AbiJXMKY (ORCPT + 99 others); Mon, 24 Oct 2022 08:10:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232844AbiJXMJB (ORCPT ); Mon, 24 Oct 2022 08:09:01 -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 B2F3F7F0AF; Mon, 24 Oct 2022 04:52: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 C659DB81158; Mon, 24 Oct 2022 11:40:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 217F2C433B5; Mon, 24 Oct 2022 11:39:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611599; bh=zZ6aCnvvIvMD/DtvvB7qbtS2ts7lyXMgsQSGtvWJf1E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gmWnYtn0ST9o0YnFnkXzaZkOExg/nW9Tkkzkv0Njy4gCwcKGrcji0oUAQRlcBYfCw WhVhf65pAnYPSO7sdx9/vY+vIISZGYTX2Ot0RclNpbnfMRSD6O0qvgJWCnf1F2Kwom JgpyqqaHPLnouoMsXa4YfQKJ+/HJNKt4iEkyFFvY= 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.9 039/159] Input: xpad - fix wireless 360 controller breaking after suspend Date: Mon, 24 Oct 2022 13:29:53 +0200 Message-Id: <20221024112950.808880388@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747571257656663425?= X-GMAIL-MSGID: =?utf-8?q?1747571257656663425?= 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:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8421 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp400440wru; Mon, 24 Oct 2022 04:47:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5wfI0rz03kDFmfBJW3smbavfI8xkW/Tf76UViHTt8yaRDNE4LA2BMkZFDsY07EniScTBp/ X-Received: by 2002:a17:906:1e08:b0:73d:c724:4876 with SMTP id g8-20020a1709061e0800b0073dc7244876mr26450702ejj.62.1666612029451; Mon, 24 Oct 2022 04:47:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612029; cv=none; d=google.com; s=arc-20160816; b=NqS9e/s7KGtkFuU5T2K4sTfdRCyt9AqegsziMxsczGFkMfVoxpT1eyt+jZGKIdzsUa BG4csygx0ulSeZXrC66EyWJGT44UZNwgca3A/sbSWkiMS6iQQ8lFtYjF2kiLskmUdnmy l2VVYvV+7u0+4oBnKQGWDnc6gwYx1XwwTv02T74EYm6w6lCHFyYXfN7pnHvjHplFT9pD rwtP5UxKWWLbQpQs7bu8XZbYlfWibin3UOX9mJ+lg5mx9vVKOYFjU+owpAx1bZ5kqSMN CeTkTH+1riTchSbE0VOq8Y7eRnTrd6pgNQH/HJLsbMfHMc3dpKlX7bCfKXJLbS9ET+1c Cj+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=XzkZKyz4+5Q6PgeNb5ZRt4CNe8NEzQRDN9B5v1bncHU=; b=aFYCPXWmgJlxXT78bi+8C3oyTjsno2Mcb/mhjRAGnpwLYrONNt6Bm4PiSvjcbYkQrX O7lpTndGKdomxoag5kOSwYSgVYaUtnLI9Kq+VVblwa3J/Z6vxyUzuA/6GhmI/RfITYqe 8tuGGNhFB3bs65KdLFXU15fjuvtINlcP/YRbDGnFze86OuKZ0jQQ9kEzMZ+1GK1BdkqF iXmjMPykXHoG4i8NF/lDMvVYfOU2IYS6ZEe6DS0yzKlL3+vsj0RAElWM71cNP8r77Qty AzFZhRuS4E1GuurRAAzy8PjI5smQFjSp4KBCvb4398PXVvj8w8Wbj7JDI96IfmwNMPo8 fsvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TjZg8daD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a0564020d0d00b0044611122003si35567034edb.599.2022.10.24.04.46.45; Mon, 24 Oct 2022 04:47: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=TjZg8daD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231584AbiJXLqN (ORCPT + 99 others); Mon, 24 Oct 2022 07:46:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231726AbiJXLoV (ORCPT ); Mon, 24 Oct 2022 07:44:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1234A74352; Mon, 24 Oct 2022 04:41:27 -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 A7BAC6127D; Mon, 24 Oct 2022 11:40:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 961B1C433D6; Mon, 24 Oct 2022 11:40:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611602; bh=owFmSv/S9DLDU2vakvxfkdD4+u8AbGA58BI/lh6hDm4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TjZg8daD7jty5py2r90oPRMx43IR64QFR4GOwhpH6I8Z8B6YbJG3XpFCfIpmMOr2C ydQsAuoev7xdHHqFj3u8HNhDtyOc5FtBGYj2/+2wZRZ6RTwHXvPrdSwspwdctRY9DK hjJSymyuoQTWQaLJYYMg9yjWvTgFjgGZLtQbpbxA= 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.9 040/159] random: use expired timer rather than wq for mixing fast pool Date: Mon, 24 Oct 2022 13:29:54 +0200 Message-Id: <20221024112950.838950804@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569375910602924?= X-GMAIL-MSGID: =?utf-8?q?1747569375910602924?= 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 @@ -894,7 +894,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) = { @@ -946,9 +946,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 @@ -1000,10 +1000,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: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: 8444 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp401602wru; Mon, 24 Oct 2022 04:48:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6gWhabHFYWmzCD22wBOennx8m7Ef40hu+5y5sHB9wcgzOkSLj7opTt+Go6KHVP4W5vHFX9 X-Received: by 2002:a17:907:84a:b0:733:735:2b1a with SMTP id ww10-20020a170907084a00b0073307352b1amr27302778ejb.290.1666612132676; Mon, 24 Oct 2022 04:48:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612132; cv=none; d=google.com; s=arc-20160816; b=NRMnXlUnQ14lDHquMWnnEevDCNXAe4OF071lquqXm1CA5DrxtCbWLn5rkJ9WNgaBRQ Qrc+GUKN6oMYaPHIUn5vBh8eKvl2tZKZAmUVZf+hxwzdgHdpo18W9Iawh+c9PVojkCrE ksU9Xc1Gx0kRe2y/aFxt+TTEYTfNup40of5M7utVbCCcsVZWsskzYzIPD+VwaHe3kv5G YFa1CB0M97CmIQvQ76fSitSuq7V7MlSGGBHazBHlFNidOFpe5u5sF1pQy7ZeHadWfDxC QE5SsFQya4JFVg7iSQye3zPUJGkKypDc1dPf0xLbTPu0DWbgo8OKEEMjVR91jm63zwwP haRg== 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=tSVK4iUqtNVvEMscHEyPKfoQ2NMGePVPe7KTdafnG9U=; b=SuiII7Nw7G548PpL9tsDUVQ023jIyaXswoOsdKNktj22q3/8QAAA7l2pI+ZFWJs48R vM2DVRojx7o3lhGjJYTIFc9sNjicf7iR2klHHrXsOZhkIIArFu7fzpcAw//CpsqhtZgH wR47OadRHIWGzFHtvVUz1v2ET+BGs78z5UIvMM4ehFgsDggxC9Q58fr7NCLN8XW6VUmW l8BrOGA8x68alZI640LkBaOZK7DlYiiXbeMhBg2r5M5qowOV01O0BLfH9HXCYEaiq50l s38XbLNR/+zUulVsibC9Uv+niy8Mt0GP2rohMs1CKxZsXk+8cFkmK0zkpnTdtAStMcJU uH4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cNC3DlgL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a1709060e4700b007315809ec88si23652924eji.399.2022.10.24.04.48.28; Mon, 24 Oct 2022 04:48: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=cNC3DlgL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231654AbiJXLr6 (ORCPT + 99 others); Mon, 24 Oct 2022 07:47:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231650AbiJXLqy (ORCPT ); Mon, 24 Oct 2022 07:46:54 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1966617589; Mon, 24 Oct 2022 04:42: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 sin.source.kernel.org (Postfix) with ESMTPS id DA0EACE1320; Mon, 24 Oct 2022 11:40:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59B2EC433D6; Mon, 24 Oct 2022 11:40:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611604; bh=xAr3HtSz1TJSquIEdH3BGLK5XHEZT5yJ3V/u+aRLDLo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cNC3DlgLTIawPyP/XKzq7Wcw8f5KvqkAP2A2c4DFRAQcKvIpb0LoyeLi2Wj6OTTeV yKLaDdJweg6GgY3WxnMTLFepvLppgVpT0Pv6X6ZdtisGSOtoF4wCxFeT4rfsY8mrIL WEu4FYCkRF4fQFb1wfCnZuvCVEWlzd/4PDzAYbjs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 4.9 041/159] ALSA: oss: Fix potential deadlock at unregistration Date: Mon, 24 Oct 2022 13:29:55 +0200 Message-Id: <20221024112950.885292336@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569483411228078?= X-GMAIL-MSGID: =?utf-8?q?1747569483411228078?= 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 @@ -179,7 +179,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); @@ -191,12 +190,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: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: 8468 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp403067wru; Mon, 24 Oct 2022 04:51:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4cZhArpeRJWmKTJ5fXRqdwqqjiftmxhwve9lpS1hsmSUyo3bmebLadBFMmS9MFwhFrizdT X-Received: by 2002:a63:5b48:0:b0:458:1e98:c862 with SMTP id l8-20020a635b48000000b004581e98c862mr27336147pgm.568.1666612271557; Mon, 24 Oct 2022 04:51:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612271; cv=none; d=google.com; s=arc-20160816; b=DomDlNAUmT3SvTKdlnn2Y0W3DUJ9tC74rDdO2bsVq1FEgjNcR4J8GOhq1M8OR50u3z WCLIwVbKmo7h66bPR5HsDgq4kFI58Pn/F0v0O/HqjYIrb1wQ+ad+hWHbL0ElijM2My+m F+Upo4hUFq1q7gNVA/RJ0ZlYOHK463bOsiMP/YUNDxG6SuFs/spq/CmEKBXpeA3lkNwn 8awfsgR62mBHQfwkOR2NXXhqbIXz8/+mryRwTXI0OaQxHtjhGVRJOra2qDx3S9DA88Dd w+Wx5m69w2VNKJOiGSnBK4BCbeppP3bj8d3XYK3Vfzp66/SuhD5vXyNyzynZ9VA4PHMm b++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=grqwU8zrBnt5k7l2e02S/Mh/b564ru9v4Z2p95K020w=; b=BvmxrmhdGBpGtWQxATznL1l9fordkfj+CuylEMkfRCupKnLEKPYmCDkvtkhWnhP6/u mfcoMjlqphVVCUcQpJ/zLXJhtrA+rLF4NxKbYjHoBxSZRH43eFjCLuHwQniO+UmEWkdW hxQBy2CUG06MDPSQVi55v7vJdldWUlM6CUQS3HM1FpNAj598x3fA6fXeWvN7EACDaeg0 IDRf3OV2IfbPtNJCNNlTJ4Rz30E1Zx0l3TUISmEnguC/2kRhsnFJgV+5jZkhXTLp33vu I9nPv46kG8Qqs3FEqa+4GRaaPhDPj4+sXaSsMnQz/eb4pE3SoKFgwPwTY9BDA+lNFfRk jeog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Bdci86Hk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 r38-20020a635d26000000b004607f8ab960si36875323pgb.356.2022.10.24.04.50.58; Mon, 24 Oct 2022 04:51: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=Bdci86Hk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231865AbiJXLum (ORCPT + 99 others); Mon, 24 Oct 2022 07:50:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231855AbiJXLtG (ORCPT ); Mon, 24 Oct 2022 07:49:06 -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 4CF6B317FE; Mon, 24 Oct 2022 04:43: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 E9C2E6122D; Mon, 24 Oct 2022 11:40:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0398EC43470; Mon, 24 Oct 2022 11:40:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611607; bh=sM65ncKA0Fp2DSYemjydTSKTheS9f7SXxpox3tYAn2Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bdci86HkMTQNhFJCfK2IB9/78Iuc3y9haI/6ZohFQR2THaKPdnylgwD5NgsxXgMJR dVAOLpoW2p55/Oxms6+gv4P3Rq4K7rmeBhdV9C/vpvREcywCBOT9+qJZGWzBI0pFtj E6mer7mBDPa4FURxM0IavjhcafPhcSkYiNa/VBms= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 4.9 042/159] ALSA: rawmidi: Drop register_mutex in snd_rawmidi_free() Date: Mon, 24 Oct 2022 13:29:56 +0200 Message-Id: <20221024112950.915017843@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569628928097489?= X-GMAIL-MSGID: =?utf-8?q?1747569628928097489?= 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: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: 8448 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp401724wru; Mon, 24 Oct 2022 04:49:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM669rIn/eqUg2mLmoweA2ELjhchuE22JchAxLmysblUxuj5imTg47ELa5H+6P+PtN0Ii1zW X-Received: by 2002:a17:90b:3e83:b0:212:de17:952c with SMTP id rj3-20020a17090b3e8300b00212de17952cmr14688359pjb.102.1666612144001; Mon, 24 Oct 2022 04:49:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612143; cv=none; d=google.com; s=arc-20160816; b=l3rPtj5DmUVJ7JveQk0+YlHXcCQlU5YXftOfa5RdNGMuf+HCxYa1udfj8R0gX/f4v3 xtufZdOtoIrzi/3EL+tpvUqEvLZA6SCnJcT3JsEoFsK1QicsHe8SLQxcdO9wEp1xj6O8 MzMQotyquJcIJ0aD6/R5ktFIIh8quhKg5I/DTBYllw4XGdgpzChEil3fXuQys00gBU6p QWm+5ktB77IRUILoRYKcyeZOWWbwAgaurO2jN/NJwk9m9XCQkUKdkZiJilhDTqJXfIFY A/slzi+s4CE4SfXddoAl8WqRp8olbkfopAZBKuPOB6mR0DJlh3435l/85EKqa1XrFhWv D9NA== 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=kOix95pjwXB+QgS3L9sboGHqxj4zrRs8hh+5Ik5JBcU=; b=lfNP6Vkj58umF4yWMtIoXIlT0YC8vtsgnZO6W42AX/0xsNhwTn8H1S31S0uz2hzS0a 25cMOf1gkDRv1nDEe2ejXw+O6k1SquJrMeI+t59hC+7hbjJgQgfckGJyEWhWbzAWY3L4 D7NuFGdQITEN0W8IbO8H4j3I341XrKJ98RReWgx6h6jBW1IAXs4CMj8ORVF+gSUHTRrU zeXyfpNNQofnQWcxThLMGb8G1Wu9cOMSkotCKj6briqmJJCU1MF1D8aODJ9U1ivBPfsd u8ZT+aVVIUbdpX0YLNdMtfGAo8qVt8HXFXBdfu/JXyAT2yKa50P/3P2bKjDA5jAEqfk7 JfhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=liEUVott; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 jc12-20020a17090325cc00b0018683763131si9342989plb.501.2022.10.24.04.48.49; Mon, 24 Oct 2022 04:49: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=liEUVott; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231751AbiJXLsW (ORCPT + 99 others); Mon, 24 Oct 2022 07:48:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231558AbiJXLrc (ORCPT ); Mon, 24 Oct 2022 07:47:32 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 577067647F; Mon, 24 Oct 2022 04:42: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 sin.source.kernel.org (Postfix) with ESMTPS id AE05BCE1333; Mon, 24 Oct 2022 11:40:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1B71C433C1; Mon, 24 Oct 2022 11:40:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611610; bh=qQlgW8kTrMb8YUt5Euhjz1KQWPFftvE0dgmxeMxKkyY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=liEUVottFODe2HBmt/BpzlAIQ1vx8HFp0Lc1K7JlN4EJjHAf44JIJ7UBEinkhITlG WPfOzjc8nEqwxDnwUjznmi+4HX5dKysWzFcKLsYB4NrNHNgMhRF30JT7dHVNCaAXzh RYHVuobnEI5nPpQyz5kAEcxTsJjtLZVHtGWzAiKI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 4.9 043/159] ALSA: usb-audio: Fix potential memory leaks Date: Mon, 24 Oct 2022 13:29:57 +0200 Message-Id: <20221024112950.959546360@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569495393818032?= X-GMAIL-MSGID: =?utf-8?q?1747569495393818032?= 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 @@ -804,6 +804,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; @@ -823,8 +824,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: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: 8420 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp400412wru; Mon, 24 Oct 2022 04:47:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5gbsyg29ozXa1uAuik52vRphS3DNraFF7bdAy9hcLeqokiOUJYfeERGnJzFF3Ygk94a/F2 X-Received: by 2002:a05:6402:5162:b0:457:6ef2:df3 with SMTP id d2-20020a056402516200b004576ef20df3mr30244082ede.128.1666612024799; Mon, 24 Oct 2022 04:47:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612024; cv=none; d=google.com; s=arc-20160816; b=KkrZF2SBhy2QOslxlf/zFzkQH6b2dBrcsEwp12auA1Tp/OlI+Pxi6FKkejKsN3/qF1 Mn5bnP29+cnowj7fMT05ulUzctr6zIt+Tx4vox+8DyVpm0Yg3DrAd2AjH4pCPA9T30Qc AtmpurRLsEtc9+AGk/sBWObEEUfk0gbBTfHpGaDugWiSmzGLn6B9Hv7kygkx7IodM56V eGZH2zrIP6fRbsCH0OAoEmp6PAxTQl5dVVsQdS9Sp5nQ85VZ5GdNUVTfp3wWoyktmA/T Ia3t53h+2TAUW+BPBMGUWporP4n5mxkE86kfEdAAlkf43LSI4//fu2z9ZATrzn7UkRVT LSDg== 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=oBjJYdzEQsA507ZEJB0mrPemb8P31MftbE5astkoNpA14heAlSTrQE1b5+advxFAU7 TmMSnojFr5cn6xDK5wTimHNIGENAWRy3L30UpIuMZTeBUZ0bIVPVGqiKTdvD8Qx6vBkU HokfXMvRnEXQSlQbpqxuMvM59IZY1xM5fPLxb0lTUyxdAEIowZr0uvlsDHdUFKSrwCLd hvANkj+9255SQpJU6J9POCPIkylXTE9F4AHgHYUnwYvqQyvfdGnlKd+bG/Hjci2Bearz Ic3WSYDRLqjL9KdqNOiFl6VoQofeeFxqUNCFaTSlIqly8cggAC7cKp2bQxlD3+vZfkCW XAjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TkF8h0C6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 q24-20020a50c358000000b004610f91a242si10053962edb.300.2022.10.24.04.46.40; Mon, 24 Oct 2022 04:47: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=TkF8h0C6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231577AbiJXLqL (ORCPT + 99 others); Mon, 24 Oct 2022 07:46:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231710AbiJXLoT (ORCPT ); Mon, 24 Oct 2022 07:44:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7973C748D7; Mon, 24 Oct 2022 04:41: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 E14EDB81151; Mon, 24 Oct 2022 11:40:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E81DC433C1; Mon, 24 Oct 2022 11:40:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611612; bh=FSdbiPueVjPIiHHnV4K5YK5PYMbHBcrAoHkWO81VVtQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TkF8h0C61ggFfo6kLqMzzPERT+dnEZFuWMwEHj3TWAXBMQChqIuE2vIeV8bXCcinm 0wuiKF1YZOks04tRyaS7RBBzfdyVK3qNuzkp/ndsFVn9w4Wkqj6L3QEUJupgUHzdAg kf16ccLZQC6LeJMCNoX93EzXQAAKBmwHkvtj2UUM= 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.9 044/159] ALSA: usb-audio: Fix NULL dererence at error path Date: Mon, 24 Oct 2022 13:29:58 +0200 Message-Id: <20221024112950.999694278@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569370410285160?= X-GMAIL-MSGID: =?utf-8?q?1747569370410285160?= 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:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8427 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp400759wru; Mon, 24 Oct 2022 04:47:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4XldP8x9/bDJjiXkPDqZFoDc58nUYflkmEntcMogP4zvgob+ZbK3vyubjn1duKJj6B0yFz X-Received: by 2002:a17:907:2e0b:b0:7a5:fc2e:dc7 with SMTP id ig11-20020a1709072e0b00b007a5fc2e0dc7mr5545626ejc.257.1666612061131; Mon, 24 Oct 2022 04:47:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612061; cv=none; d=google.com; s=arc-20160816; b=vTezDX/jaL7odo6FGpkWQvQnC+6mTJT3PTksKYQ56c0LS6+lUwCWcLesTIklRY1nx/ RPySB9A+UVrWLmrGDh08RylAy17mRCTmA1NI9ordyGul8T/IVmx8h+KzeT/T3NqxaVLM 8bI5eE/80lQdaJwgyk2xR0DjnBTPeqU8d1t1hCQv+L86pbW3Jo2MODLRV+6re28uHWua htvdz3rOdMdCY0MarJvie7FgeBnp2pC7pq2X6wB3FzAaiVhTvwmgcMPE9+ePlVyWMEB3 RKARFuAHUKBXkmcS69TM2UzDK9AdWVoifvwzIyeBeTtgWpdBHjPVs//XXfSgWe7e2OvV ICZw== 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=gJ3H931i2exBpy+iiQNhhMa9DMeqYiUl/pTUVGvxyDA=; b=Cf96uzwxOCRyI7WM9Pm7NC8UJjLm4S1jHNdF7hHoFjhDanDXAFElqyd84RBf6itRB5 W/+97LCXv+MuE1habxK6NCfKi7s5q0J1NI2NDFmJXtOtrmLpRJkLOEIMH3xqiMPhvP/3 cj4vaeDEKEXvEtJ2slF5fKi6SUOVqeiEI9q1dUHnASUNRI8GF2Gmxiyn7M1xZn7N7hyK sQ/SFDCbyy3WWX0aAfMmJt/aLMS5rZb8mG5C1Gyj+0qn7adSHzGaC3kqCfAoTGmC6D4d gHKva+/sj/yizWtAERDmqcURpbiHAtZ1kEhh67cQCBskJmXlK56lNdonPTibb9ZgIjHm Ua7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JMFwaJEo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 mm6-20020a170906cc4600b0078a76811e33si5136365ejb.408.2022.10.24.04.47.17; Mon, 24 Oct 2022 04:47: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=JMFwaJEo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231597AbiJXLqU (ORCPT + 99 others); Mon, 24 Oct 2022 07:46:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231736AbiJXLoW (ORCPT ); Mon, 24 Oct 2022 07:44: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 32BDBD5A; Mon, 24 Oct 2022 04:41: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 ams.source.kernel.org (Postfix) with ESMTPS id 5DE17B8117B; Mon, 24 Oct 2022 11:40:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A908FC43470; Mon, 24 Oct 2022 11:40:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611618; bh=66V6PwS+1zZa07hIGePR1fkuGJ16jCujTpJ53JGWIjo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JMFwaJEo2bAviMusWJivlKL+nsI82A2ZsMe8LTgiQLHPD1+T7v+zTxkV5EucZcnXt e/2cQb9jD23o0eqTqpSJN8kAJki4Yb9uv3icsEedSqMvg307kUkayngf2QcSxI/64J 1hO0ScdZ0KhW6HtnaSet9Q2LW0SBPhT6w8EI8ZwI= 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.9 045/159] iio: dac: ad5593r: Fix i2c read protocol requirements Date: Mon, 24 Oct 2022 13:29:59 +0200 Message-Id: <20221024112951.039626959@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569408330516272?= X-GMAIL-MSGID: =?utf-8?q?1747569408330516272?= 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 @@ -14,6 +14,8 @@ #include #include +#include + #define AD5593R_MODE_CONF (0 << 4) #define AD5593R_MODE_DAC_WRITE (1 << 4) #define AD5593R_MODE_ADC_READBACK (4 << 4) @@ -21,6 +23,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); @@ -39,13 +59,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) @@ -59,25 +73,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: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: 8467 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp403028wru; Mon, 24 Oct 2022 04:51:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4u/DvNAoks/KmnHXrYZj7UYe0vNYVl7tjBae6Z/qC7ipsMv3naWPPClkSdoWzBScvNKYq2 X-Received: by 2002:a17:90b:1c0c:b0:213:1455:131f with SMTP id oc12-20020a17090b1c0c00b002131455131fmr4679613pjb.129.1666612266385; Mon, 24 Oct 2022 04:51:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612266; cv=none; d=google.com; s=arc-20160816; b=I1W22xKkPEFZgpdl+ABsR2sAw2wfpi750lwSXzZhqvnOq54j/FBSIoVT+hOD5Vac69 Nqk+6MAw0gze9v7MR7ffNr+L+buhx7N41MT/gDm+5u6UHP5rTYOxmNSa1nifckepC+00 W0JIvkEFDX95a+Oq8u8GyBPDIp+mJ6fGPlFcjwQntOI99QDVQRRG64o+qmxuL+U33gvz zNVFZmrQ8hFaubIieru9PScGs07IndABrQ6Ue8HYkXZh/9J1uhrn3U42H00eQJNezggB zlBrmn+KXSmPjwpFhNeyckF9fnVwz/I2bBqR5icT7VwrT/zmNr6zDZRuSMSrKsFqg4fM 9HLA== 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=hBvk3P4U5mjyVcqlM4PQe7SAhRrry7FMBFuPfvfrcfTbl1bWdmpYqdZkXf8T+DElrQ UTtXAIwY+qiLEt249LsCGK9dJjuurdh669PSSD08a6SPAUqCEf4wUMArksxIQLSwkg1E MriADd5PQxSVXk0Ga1TRzaVajUADCpMRusCceN2Bq8ek+CymMMY/kBM+25FINbNjJ/wz SpdZ9JwloWz7R3xHUSqbzxQyeyLhaxnevmWM2afjgJacvh6OV4/tr+p6mXT71IaRqN3M gtdxXIYgJy+XAb2CYe0cqS6wbN5M2vKKz+No7cfMXP4adALd3ERbMoJFm6XE0vTUx9sv 28XA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lB0PLDXm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 k15-20020a170902d58f00b00176806795b7si33757805plh.351.2022.10.24.04.50.53; Mon, 24 Oct 2022 04:51: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=lB0PLDXm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231847AbiJXLui (ORCPT + 99 others); Mon, 24 Oct 2022 07:50:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231844AbiJXLtF (ORCPT ); Mon, 24 Oct 2022 07:49:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAABA2125A; Mon, 24 Oct 2022 04:43: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 ED2B4B8117A; Mon, 24 Oct 2022 11:40:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49C69C43470; Mon, 24 Oct 2022 11:40:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611620; bh=Awcd/0SSmDN83dUDpNoaIq8lTcT014AjU8Qvxm5qHes=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lB0PLDXmDESahme5pgsy4l0Wc/sPAcCEp8E4tdpmG0zYIzFfBoKVOL59vM5yC3Zln S1o7FIIJA4PSHJr94s2T1xCCwn/SLaPLmtxf6A94KvgaitB5EKrsVryccH3SRYUyRn lMFemW9uT4bGNqodO4VATkvuaVQMFNrk+Hc0mf48= 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.9 046/159] fs: dlm: fix race between test_bit() and queue_work() Date: Mon, 24 Oct 2022 13:30:00 +0200 Message-Id: <20221024112951.076208775@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569623886812333?= X-GMAIL-MSGID: =?utf-8?q?1747569623886812333?= 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: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: 8429 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp400833wru; Mon, 24 Oct 2022 04:47:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5xXgW3ZS8Jzrf2IDjbAxqCeQDlblSfvUvjaPaVnPTyEANiQ89x5ttwZ7Ujzx9irWV0hlR8 X-Received: by 2002:a05:6402:448c:b0:457:52eb:b57e with SMTP id er12-20020a056402448c00b0045752ebb57emr30859297edb.178.1666612068006; Mon, 24 Oct 2022 04:47:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612068; cv=none; d=google.com; s=arc-20160816; b=g8cObh/j+8LOSoJAmZXm8uQ0aAMfwkwsite63iOTgSoZvognS/bNzRIw74cgp0iZeX ectOvNIdzPU3a+UTosoU50tMgbkGAwNfIWlaw+EW9BHps51Wt8pkiqrLGY3jpapYovQ7 GMW9NCQXkS4t7fHMDU7ZQ6BnYtL16X8VSpQBvr6YpsDQuAIHx3M+lrBrzkUQJJk0qtVX Rmg/jjlnPh6PyLqMGuyghPwzmF5JSR6VANxllHWjNRkOB7GGA4NVSj1NxEytJEKgs9/L q1TFonyr+QSBfGZ0kaB7U1d+L8pqs2/hXGENuINVD2l4TjJ2ceTIZh8bYVsJIBkTmUV/ UiMg== 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=zoLsly3rSX2k+tJrefEqaG3ZAdumxmHDrsw1ro01eYY=; b=KEOQoWmlyTJw2KfYMMvoRF97w9CtanEIO9TQ2nKg7jxzfsBEMU191AmDiJR9M3WkAt ByDEIODlVlr5/ro9Kr5zRGIxCeC52W/jXUJ85NtnmGPZPJtpblbNrEoBg05jAir8ycG8 2LliBTkSqMA/Y1dEeBNdG1teXaJo2Pyt/wZolIoksfqEbbFSUgi4S1N2sbHOTfVkf+Lo NHXeWxME25b6D/VDwN3nqVEskTx0zv0uzROZJ4ZTNL1vhGGsTOtU/UH/BZI0AHg3yj81 t9QJfMTpow/9Uc4csikpGhI3w3fW2EegY+Q0nNysBeXedmUIFlVHe2RadKijO26ktdwE aOqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tDysg+kz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 s17-20020aa7c551000000b0045c9dbe290csi24368931edr.406.2022.10.24.04.47.24; Mon, 24 Oct 2022 04:47: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=tDysg+kz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231611AbiJXLq1 (ORCPT + 99 others); Mon, 24 Oct 2022 07:46:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231801AbiJXLob (ORCPT ); Mon, 24 Oct 2022 07:44:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0404574CDC; Mon, 24 Oct 2022 04:41: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 9B6D4B8117E; Mon, 24 Oct 2022 11:40:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBD26C433C1; Mon, 24 Oct 2022 11:40:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611623; bh=HyQXrJH1l3T0A4SR0/zGg1i70pBwz1wEYQUnliiTFqs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tDysg+kzw6SbyYmIweEkjiKR3EhzymMZwxFLc6SqF+tU1RuofV6SdGRb8ICbXBE1n pd8hqB7Zsom8a/tIVL3qIgFAAOMeJ0pl7i2Qo64dmQuD6h++Th7jQvbrf/Jj/CyaJm Qn+RO8uMoIPcTgDuLNEYS6PZ+jgo+cBtMjN4nrO0= 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.9 047/159] fs: dlm: handle -EBUSY first in lock arg validation Date: Mon, 24 Oct 2022 13:30:01 +0200 Message-Id: <20221024112951.127474701@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569415926718678?= X-GMAIL-MSGID: =?utf-8?q?1747569415926718678?= 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 @@ -2888,24 +2888,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:30: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: 8891 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433652wru; Mon, 24 Oct 2022 05:50:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM69EA2yBnIFqmHiNbF6esR/TSGq0SIPCKTdmQUUklpMjCUctCxuLwjraviccrklzMwZR1EI X-Received: by 2002:aa7:cb87:0:b0:43b:e650:6036 with SMTP id r7-20020aa7cb87000000b0043be6506036mr31155694edt.350.1666615806749; 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=TociJrh4xHK1Xf5B41mtXRCGb7C10TWSb8GgHXljJG41Z9wopQ9+itvUNxizzPRZA0 b19opx3Qdew711N8f/N8WUKG8nG3ytMDMvzBDyPpK1dbdlHn/JymiQ/V57YDbQs4k0TP 260Mqh9zzDSTtnnahWxLeV8faXIsjQn3CHnfu2oMW7SCmTbiPImTO6meA3MCONbzHiqG w4KWshan2bXYpRhL3ksAGFrjZZV9dat14Pldj5BN/T3nsUjMGX+brgl76kuOFKFBuoDA XA3ofv07AwsP5VB0/OMOIQ3mQMcgbUdZyWb9ukJJaMLphXgKLS2y8VJv4TNhQmIwNr9x 1ppA== 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=UsWcTsj77ZloPe55x92jy5/GvKmBOIf0PjDMDbkIcUtVR8h3Z4HlMhrflOKkgV1qp/ 4rdVaA69QDElecmC6D+MqOuBj+QlRRDpwDC1bhyvCC/j7vvP/Ni72BKQuEkjmAWzNTb/ cZPwmZTU4KLp59/P0wVAjxXJ8uFouF+fQkIQBgaFkNXa0vMrMK2kRznpKF7dw8hDiauJ MN0uZfMrRqTtrRZLQofuJyT0sOJBLCYsE+xPAb4BGxKFGZ4dBXmRtn1w9Wt9ALZgr0kp 6YrMWRihzhq0oxzKc/hVCxpBZfbEXCygvotHiy21dZXz5AvyM3r8FA0DOFWjrIJNbZ7A fpaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jIEbhME1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 qk18-20020a1709077f9200b0078d9c0e896bsi26402550ejc.525.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=jIEbhME1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231460AbiJXMrv (ORCPT + 99 others); Mon, 24 Oct 2022 08:47:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234210AbiJXMmV (ORCPT ); Mon, 24 Oct 2022 08:42: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 4849F7E80B; Mon, 24 Oct 2022 05:08: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 B629861281; Mon, 24 Oct 2022 11:42:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8B26C43470; Mon, 24 Oct 2022 11:42:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611726; bh=iy6+dzbMrtUn8z3Bzy2JPrniPwMyWDR81wptzzfv+ZE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jIEbhME1sh8Uk+j2wwWZ2a0JdV2CUFc5rGNxo/KtluAvQzJ7Gk0lF52jcfkq8l3+/ d3K+7ZAZ+sPuZ3Hn5pqBKVamVUKuyjMKt1SS8eU2xEeQitW0FF18wo2wt7TIIT7PMr cWoyk5W03HlvBnd0ssitJegUzSRoDOex4OeeyBws= 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.9 048/159] quota: Check next/prev free block number after reading from quota file Date: Mon, 24 Oct 2022 13:30:02 +0200 Message-Id: <20221024112951.159251294@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747573335881690246?= X-GMAIL-MSGID: =?utf-8?q?1747573335881690246?= 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:30: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: 8424 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp400619wru; Mon, 24 Oct 2022 04:47:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7YkQtVZOs7bniRRm6r3QjLVZYUUwdn2WS1HmZ/I7p1FekCmD2hv79oO+C8tN8AwTeJDF7s X-Received: by 2002:a05:6402:f0e:b0:461:aaa3:a11c with SMTP id i14-20020a0564020f0e00b00461aaa3a11cmr6428383eda.53.1666612047025; Mon, 24 Oct 2022 04:47:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612047; cv=none; d=google.com; s=arc-20160816; b=0wIAKMDaK5Py4evIoa4Y1HZj1Wwjc9VftMIECNIs84W7I36YB/M7eIGIO6iPo3fsIS Wge9V1kds0AGeRqmS9nPxjbXqcAJvwPD29FQpCVZgm1jsAt8ikwVz68NQuo5ZJmJ0k9N hUH5Js2Tzim7EgPCyHDhLd8qdfdg5wk6komCl5cI9jKCxcLWraLoOySupmMdSREIteDG hDKmahtWsfdWTFi1lg7xwC9GdOzh6EIAtQVhWH3QLCsENIk00nkCc2mXOLPVE8w2i5rV D1OLclNCVRyZrnYYD7AWjy0HyOXMcyBChxCjawyt3m1Dy4EcbLbWqBqPcREHNZYRrPxD odsg== 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=lvzIFFuaJJZY37AgrCcHvA8KvVfmTblrKW7+CKenBNxctNbAsbr/ofsVcrFr3uv5uc 4+q2yRCTwR9gn3AqNhKa7Q0Hm9ML0DHqw4rutlL3zGBUFZvzvcJOmG++m70AkpAro0y+ kbe6pJ5BX1DakTTUD2OmrG7yQLyOzBGQtqNpRKnoirmZE6Hj2ZdQqQCGCcR5q9xtuh7W AWdPJOAjzyFBJ1hjsmlNiK6eKb+6k6z0+jlFF3ORTRQhs9VPR688jyZTMrHwh8mnjRWY xcDixBZ6iVvPxB3qMc+4R36LQRj1jIhsVCwoHqxOLTG6d4TtspwuirS55PuxopR5ooZb N1oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fM56iolr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 sa26-20020a1709076d1a00b00781c1645926si27879466ejc.524.2022.10.24.04.47.03; Mon, 24 Oct 2022 04:47: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=fM56iolr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231616AbiJXLq3 (ORCPT + 99 others); Mon, 24 Oct 2022 07:46:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231809AbiJXLod (ORCPT ); Mon, 24 Oct 2022 07:44: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 73CAE6CD16; Mon, 24 Oct 2022 04:42: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 D579DB81185; Mon, 24 Oct 2022 11:40:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 095B8C433D6; Mon, 24 Oct 2022 11:40:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611644; bh=6F0okbPNaJVmpOAkAP8nAQh12Kr7LsC4w3octjhvero=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fM56iolrFUGOwCWYwBF90jDbeZ+gisICIsHNRjnTG8w8iEwjPDHN808tKMF7nK5ac 61K+1MVTq/GWn7dpkSjwYnT0sBnp/gqbeXIQelqo8Nw2aYkw3O3oporFIKCjiA3iLe TwrURRICLwGCSe/G3xYtzKFqtvfYyGRU1qid0TR4= 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.9 049/159] regulator: qcom_rpm: Fix circular deferral regression Date: Mon, 24 Oct 2022 13:30:03 +0200 Message-Id: <20221024112951.200371345@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569394145370939?= X-GMAIL-MSGID: =?utf-8?q?1747569394145370939?= 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: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: 8481 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp403500wru; Mon, 24 Oct 2022 04:52:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM62MWTnkXTDbG/8XR++1vL5nz9JLhhAjQf6zQgW03jtUUVZ+TIp+5wbwrzmVCPw6uraDFAl X-Received: by 2002:a17:90b:1e08:b0:212:ee11:7b09 with SMTP id pg8-20020a17090b1e0800b00212ee117b09mr11229647pjb.60.1666612346034; Mon, 24 Oct 2022 04:52:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612346; cv=none; d=google.com; s=arc-20160816; b=uWak1fNYJaLj1h5NUvdoKIWglTNLhKzfmEgWozqxZfkF4mqIO7RQkKJNi8tkKg+lOM LFL+dGvR7/+84fXnYyuw6i7sQ3v8XSmRmXKBgwPho6Fsk7NhGb8W9z20HnuhXxPkQTzX u8A3wC0SrqT+6eVy50cfvNzzJ7zvswpMQRU6AMoa6wwxcbR5NzkeM2Fp4CyN/PA42Jpj cxgH8tQykrwCxdcg6oVQ8SM77VA2c0uveZUWkq+zFjxBEB+HnWMzYM4wOAsCWezye0Iw 8AOieHlv9pdsj1sFn8oWvK6H/mkoopPRfDAx/tXR6g/+3Avt61eqSlYBmisFnKDwomDi Wxhg== 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=EVQheG8NWzLU5Cpd4UVqJ5zhF5qYHTdNtl6fvLOhmAzQREsCufpM4xpXF6WLqv5v79 XQq5F8bICNDZ04pSzDukp4GQaoxPAUp+O0merxuxPw8AIC5yZ4HXy7TtJ3MSYCWDDTfJ rOWQ09Yk8mBhQEKUNOQXLEtuQ3DhbgY8pCzvwEop5VsHVo6W9DLDa5Dzr0HNRijDtsva bHPVUePV9FQ5eucRn8mJTDg8l02glpg9T/GBeYDXAxAFxZZQhLsmE/veUt/O5dqS5fyc iNvZGKzG4IcwFre8X6w9FqYMEHx8D7sHh/DtZps4uXpPDRUHdlVx2pq+McQLP3p0SD/F 0LuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KvJjHyCR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 f17-20020a170902ce9100b0017e90e88875si35434938plg.384.2022.10.24.04.52.11; Mon, 24 Oct 2022 04:52: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=KvJjHyCR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231642AbiJXLvr (ORCPT + 99 others); Mon, 24 Oct 2022 07:51:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232064AbiJXLth (ORCPT ); Mon, 24 Oct 2022 07:49:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AA2B696FF; Mon, 24 Oct 2022 04:44: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 449C4612A4; Mon, 24 Oct 2022 11:41:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C2A1C433C1; Mon, 24 Oct 2022 11:41:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611673; bh=CDq8FveJgeZh1rfJgeX4HZ9et2u3iDuKrkjXt/oPHxk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KvJjHyCRQ5/GEFzkwxvBf+4QQFFT+WEZHfQPNond6inCFQc8UzOUeNr5yjtyqdqrA cSOZDaz0uPe2k8fAa4o0dAmNc1i94/HFIJk7F8v6dGGRB2DWySJM3rYUghrCvq+Wj0 qevhCRV4um1kVF8nB482xPpxEyVse3lqulTAFbkM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Helge Deller Subject: [PATCH 4.9 050/159] parisc: fbdev/stifb: Align graphics memory size to 4MB Date: Mon, 24 Oct 2022 13:30:04 +0200 Message-Id: <20221024112951.245656596@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569707174072831?= X-GMAIL-MSGID: =?utf-8?q?1747569707174072831?= 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: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: 8499 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp404711wru; Mon, 24 Oct 2022 04:55:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7JZDbaq/D2A6u5cGSLM7bDd/0XFP4KinEucTKGH37llwjj4tMioSNwvyA0XAKZ/Uh3Rw7B X-Received: by 2002:a63:5519:0:b0:457:dced:8ba1 with SMTP id j25-20020a635519000000b00457dced8ba1mr27243642pgb.163.1666612533060; Mon, 24 Oct 2022 04:55:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612533; cv=none; d=google.com; s=arc-20160816; b=FKBouA8E6rHpTbkV9kON8Ca6K6oVCwPtmDAzevb23v7jxxjg9A3eOeqYwg29nFrptU pmigVULwpLJ59M5VtWYW4aWnJl36vfqj4kGWzYgQpIXMnMHnIQiZjYdrqA1TYSDA43h8 5VYgh32YVK+TOoXuL0i2Pd9TBKXyjtR7wb1NJlBsIoFxXVDVopxNDWSFxi5SFObgIlSs jbImS/o9hnOiON73h/ZVrO3r0HICSEJuD3ziDTgx2qAdgL1j4OZ7YUuJ5pIpeaR6Gl/U 2jRk1L6C3RcOjKeoPLx2+9bjS+74gJTAYBB2Ptv0mPBwlXv2vcV+J69EMtBp7sYJ35YD C6oA== 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=83TVEQGd6MZDG1KWZg2TXxgx9iot94w/E1X3L4CiEnk=; b=wtDwo8sjtPWzNormy17j8Llqgn4eND/m9mLRS2b7KIYlHlIvVhlAZfJ/+gtLc0iC5b Z2KL+HvcSLWXmB1leSLkBCSAcBp242q3+RoEMbH6RKNRLnACeD72OFJddBYLZFngNcJJ N7Bj09kF2GGzICWN27dJhoXY7ayt5H+gNAQViVpTeG787aWYswgRilUILDsVO8k75Y24 p24FZ8BNoJOeEq+RK+9tQ4OsBO1dpKObXOZcx9aCwlRNoz/6wuxx8QJn7RHDGnbbAase B5xlz23+y09jwJvQShVwQ5Wgh5dsQUNeqkRCfcWkcF2oqBBVWV+JKgIyM21OQwg1WNLg Dxvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OuRXxQ1c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 g20-20020a63dd54000000b0045d4e861cc8si32258828pgj.276.2022.10.24.04.55.19; Mon, 24 Oct 2022 04:55: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=OuRXxQ1c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231860AbiJXLxl (ORCPT + 99 others); Mon, 24 Oct 2022 07:53:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232063AbiJXLwy (ORCPT ); Mon, 24 Oct 2022 07:52:54 -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 263AF33373; Mon, 24 Oct 2022 04:44: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 sin.source.kernel.org (Postfix) with ESMTPS id 3CE5ACE1344; Mon, 24 Oct 2022 11:41:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4EF2DC433C1; Mon, 24 Oct 2022 11:41:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611702; bh=d3Nj01Y5Re8s4uPm1i1fXaN5p8WAoCTqkphTN44PsgU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OuRXxQ1cYC9+Ok8FnzX4mKSpySEPmMH/uQtCLVaozzvwjCtUUrh/O/dA9LPFLzktu lsH+kCOCWnSsK8d1nRRC7e1utK5nY4oz3wl4jQQLQg9jYzM/czo2eokxt7vRKMv6C1 ZFBmqukeXzZPM6x/SA+VpBe2kMRPoRyyWQnfDM1Y= 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.9 051/159] UM: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK Date: Mon, 24 Oct 2022 13:30:05 +0200 Message-Id: <20221024112951.284697843@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569903636989588?= X-GMAIL-MSGID: =?utf-8?q?1747569903636989588?= 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 @@ -81,7 +81,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: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: 8431 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp400931wru; Mon, 24 Oct 2022 04:47:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7fledwWU1LdQaCpnyUDA3QhuxbWWUhdGaNXkH4bNLPaSeJZqcoUTFqBETPPSzG6H7o1K87 X-Received: by 2002:a17:907:2be9:b0:7a1:11a9:1334 with SMTP id gv41-20020a1709072be900b007a111a91334mr2985027ejc.131.1666612075718; Mon, 24 Oct 2022 04:47:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612075; cv=none; d=google.com; s=arc-20160816; b=Ql2Gg4zC0JTa1UWbIkFysl/ivfa91PNYZSRWE5RSzDIOGtPeh594HY38obgysPwHWD gClPJ11WW7jVKJUE5cvBuxv7UDNvNj82Xm/NMiJX7/B69TwY1OsWD75KiT9NGrQGus87 RgG1JwQBeuFdR/bUe+BQ+TDhluYG4X+mrPZ79ojY0PVh5VI+9QZsVxnG9/Zbgm6nvI5t SSX30gCkzH1RDFPMrSzR8RowsqcFZO+z4Qs7gNZwVKNaX+h2864yzDFugc18OVzYgZQr /k1mmxeOaB3ouhBnFS5mIgwRDK9xnpxiYeY4psRMUakANum2CDow5JYcPRfFmEuS2Z9O teXA== 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=Df9u8FN84hNypRsXoyD5eqGGFY76K8WcBVsj+F67qgc=; b=RZWlD4CRi5cblaP2Y7BPzPvrWcipu8bdWOymtRQYvRTPBzvR8TS909lzhFdmI+D+qD Wpiq1GNmD+7jT7kpM06a+F9dNNuQmL8Tho0/PvDRoCus4hEOnIbEaLOdVTJdtGZg4YzW hYvyRRr8ASNx66Apaw+jciQ08sIVUKJGhWDRbKOc9EhwYeyt9vOV+9H/Zlz407eAe4c/ Y9kntx9pXmve9la9TVMpb3VIX8YAR+1b3MuiZ7zG8jtZtz0WStsU0a1OE4wkaR6E10ho 40bBKaDhbir1+Jix5QqC9fzug8fa85YPA3saYKu62PcZncvQ2s2NTML3tuMhj5U4glTD nSmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oYmxsm3T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 d1-20020a170906174100b0077ef3eeca17si22819232eje.155.2022.10.24.04.47.31; Mon, 24 Oct 2022 04:47: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=oYmxsm3T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231496AbiJXLqz (ORCPT + 99 others); Mon, 24 Oct 2022 07:46:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231873AbiJXLok (ORCPT ); Mon, 24 Oct 2022 07:44:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D38875CFB; Mon, 24 Oct 2022 04:42: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 B8D66B8113E; Mon, 24 Oct 2022 11:41:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B031C433C1; Mon, 24 Oct 2022 11:41:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611710; bh=14mKDapbgbuh31OpS2MIP0VbUg71zVnPdpLmFUC99dY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oYmxsm3TcQsX9x59NtEyrmR4zuNC93AtNMI54IHri5G/k6E0syjDsPg8hi36INtQa O75L/xW7aDIOXO6VO1NuApPp0nRwcrm7Gm8aT2f1mj4CEF+Un61lS2xNMisBygui/f MNf8vyctJR+o57o/bgv+PNgBKYXmeR8fkWkx3uAQ= 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.9 052/159] PCI: Sanitise firmware BAR assignments behind a PCI-PCI bridge Date: Mon, 24 Oct 2022 13:30:06 +0200 Message-Id: <20221024112951.319992639@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569424177626847?= X-GMAIL-MSGID: =?utf-8?q?1747569424177626847?= 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 @@ -214,6 +214,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: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: 8621 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp420253wru; Mon, 24 Oct 2022 05:17:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7zzXwN0/es2fINaYoFTwbGnqMTmt2kk/r0jGGhC3wxlsX9R9vPQsATdl9Gm+JwpBqN0jt3 X-Received: by 2002:a17:906:6a17:b0:794:f0e8:1918 with SMTP id qw23-20020a1709066a1700b00794f0e81918mr21793454ejc.474.1666613871410; Mon, 24 Oct 2022 05:17:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613871; cv=none; d=google.com; s=arc-20160816; b=NbCGmDvn64h6KdeNtATnAky41T9QaR05QzUCPGq8JpauDlB9SmWnYcYELN8jlGr0q7 TMlnVxvLX7uvaO7KcasWumm5gMQY4z2+XJqRWl0R49kuy9xITGqjbrV6KcFs7hsXsw12 BTHE3G2D8ktVzxhp9F4WEplrcR9NvZzTVMR3vHWJwGa6er8EjlDvcnwE5Q6uDeaoY4OP BwfEv6HKnz6b+HI4N/jQjfphcegfU7QAW21y1t2cuHctlyTPLXlSfa7n0mvDp5IKbm58 a5tjgTHTuYdOboeFateu2ZixasfGwreWvSlKiFyVhaleEhIfaZNdK3Sf87RZpes0M1yy WN5w== 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=oAFkOlfgk2U4eZMXGrVEVXILCkNMqbza1qPpoSS74ns=; b=pi2RAgE+szXI3DJAaznpcTucWtiyjs7ksWeaqyuyZXvC7M+Ow2UUw5Cgbd6BrbeHvw HRHuZRZfldvb0XDVIc2+CmqJTNQ/vcCfB/iwovhl5nzSKCxk6I9YtFwLpofUSBM4iEVH UutL10Gz08KGU+ZuTQeQT1NVF2Fbo7no/JRI3hCUNOz6kl/ksuLCNU1F08sM1trH9i0t jEaB6YrYz7WNnkZ71+TIHkpymuIknjXJfQiH4OFYypN8k0QRjw78F3yURbwBPO5Aiwe6 fK6uZWM4/2TlBQIKCHHprOroWU8y9Ytd6jgmTgd5adEkZXs3kQqr5nyjNjdwGZzLnmlC uoJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DB5JLbN1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 h16-20020a05640250d000b0045a1e2373dbsi31554887edb.44.2022.10.24.05.17.27; Mon, 24 Oct 2022 05:17: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=DB5JLbN1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232802AbiJXMKt (ORCPT + 99 others); Mon, 24 Oct 2022 08:10:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232936AbiJXMJN (ORCPT ); Mon, 24 Oct 2022 08:09:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E3BD7F12B; Mon, 24 Oct 2022 04:52:27 -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 6DA5BB81133; Mon, 24 Oct 2022 11:41:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB4B9C433D7; Mon, 24 Oct 2022 11:41:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611713; bh=r506Ag79BSrfZBh8eR/bVpeZ0sWlRaZMTh3EzvetG4E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DB5JLbN1mNtRh8df+g+gaeCZ1BttWLAxgvUbosouPtcKlpKzmn7Z3dhmLmIDdTgSR n8muIO51ZG9C8Jpz0k3A8ZXDho0X4wHXO+1QLL8i8xdRe25ltzCB99SQZ2Rt7/XG+t tPukWRc33jmobld3VHdK8mPmkJP1Y4LIJ2qmuFrg= 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.9 053/159] fbdev: smscufx: Fix use-after-free in ufx_ops_open() Date: Mon, 24 Oct 2022 13:30:07 +0200 Message-Id: <20221024112951.366575229@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747571306873867482?= X-GMAIL-MSGID: =?utf-8?q?1747571306873867482?= 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; } @@ -1761,6 +1769,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"); @@ -1781,6 +1791,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: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: 8463 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp402895wru; Mon, 24 Oct 2022 04:50:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7XBZg8gzwgW5VbUFXIuYPNnb74Tv6FPkgtGi4dMiGEjCNMJRprpQWRPiOZd5nyvRm7ynzq X-Received: by 2002:a65:40c8:0:b0:434:dfee:8dc1 with SMTP id u8-20020a6540c8000000b00434dfee8dc1mr28800636pgp.156.1666612252379; Mon, 24 Oct 2022 04:50:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612252; cv=none; d=google.com; s=arc-20160816; b=setX7sFg/v+Ekzy8ybrsM1zL0kXhhr83L478h/ojSvp3VTC28l4OwSWS1cK2cpMdNb bweDD0U/VdUcXqIkFjoo0Py6gEjEeEwzLkYwt0ofIHZU99s0naTfto203sgEUqJFn4lc FWNkOxkUO3d5kPa5CmZYUMmYDjrrIkJs3X3uS7ZVmRM2Vnv5oU9ql0gPlkJHTakE0oXk 1opRWcb/CoWVoOqNMQdWVw8KTqnMzq5HUtMCPxj3FmA0SGScwNCm1ySQXG82dVaBU4al iTWHMRQbtCt7t1Il3bFhbBBP8IaAP2OU4KN9Ux4ORp7Z9gJX2YxLvgh9x/B6nhensAec zKyw== 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=jCAWzkaYrtDgNvLLVKQrSpbpXsfHbrrQA+kbMhRvL756eKaTDVWacSywm/r1RVmhsE sk6+ZhogeBtvcLjEciivsKifDptkkcM0nhWS2dYNo5MG3nmrTzUsXGnv2296sP19mJhU muec9fzexZn3KEcZWBHMSDdfNSiXjYu49LzRRz+9ZpzgUftMEDyLhb48L5Wgk64NbsxT Cg+ZDFekBMeGF+tbasvKvQIGSAEr4U6huu/I6qlAH30wV1MQDyU3OAz/EA/+rEv6gvjQ hTAywm+WU5vTMmoN8mkYdqvKlLht+jwW+HXFoMZqGVxxGgyESZB4rLbj1DOmbcMMPloZ oUBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Hn06oHh5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 n31-20020a17090a5aa200b00201d6d4cc79si9133885pji.113.2022.10.24.04.50.39; Mon, 24 Oct 2022 04:50: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=Hn06oHh5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231261AbiJXLuY (ORCPT + 99 others); Mon, 24 Oct 2022 07:50:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231757AbiJXLsW (ORCPT ); Mon, 24 Oct 2022 07:48:22 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EA9A10FEA; Mon, 24 Oct 2022 04:43: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 sin.source.kernel.org (Postfix) with ESMTPS id 7034BCE1346; Mon, 24 Oct 2022 11:41:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67C44C433B5; Mon, 24 Oct 2022 11:41:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611715; bh=62cxHPxacIeJObyCUvpGDXSutCGffzA9SR9xi6Ab0Pw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hn06oHh5ktdp0XJf8WF4EnQ6zX9elWei8SRkJJW+GiwHhVZun8sV9qvfXDFNlSjUZ fGtZVEWE89pKwTrFh6jj67Tra2adfId+1GdhMg3GZLrvlPzKgU+aI29/WpdUnjqOYV A4eWc2X67s9XDgMaIi4dg3HQe9ELLFSedESkv7kk= 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.9 054/159] nilfs2: fix use-after-free bug of struct nilfs_root Date: Mon, 24 Oct 2022 13:30:08 +0200 Message-Id: <20221024112951.405149610@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569609046936211?= X-GMAIL-MSGID: =?utf-8?q?1747569609046936211?= 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: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: 8447 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp401674wru; Mon, 24 Oct 2022 04:48:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4TusfkafY8ws8VtZvxIo6BnFqq65ghEle7qXXyZGOhIvkqc+KP4sAcAcrcaHOG1OtBPYYk X-Received: by 2002:a17:907:1c01:b0:79d:637c:7848 with SMTP id nc1-20020a1709071c0100b0079d637c7848mr13052938ejc.513.1666612138812; Mon, 24 Oct 2022 04:48:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612138; cv=none; d=google.com; s=arc-20160816; b=qyPSH1mxfroSUuYgBbmzSiFCjuoNUVygVoU3XsE0C4s3gd2Hn2gzuoAYr/4+jDSWZn F5JYp2SjsuIHsii766YSdRX4pmBe+mppE5aqVmM9J4DN1XYctQSaARytTANOoyRXnl6p 1cyu1ALEav40reFjBOZhunMmHHR0f7taigNaYjp/QJe/ZZXVzB69CUZj1O42mImx/suv y3OQDU3W2sB2KOsDS78ArOXYzJdfkhK18f3BltnzbkmgrmGlmcGYnZG2MZfpabRPufIX 26mXbvH2QF7O7QrWq24UJG0NBpPM1jnDM/7GMQktjKOKViUAl0KTaG4EdpOJkmt/SnmE 9LDw== 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=mqMFJ+e/wnJ/N6KfYxHBD9cCNbUo+FwoJqnFIOE4rOc=; b=o+j1iUOoBhJnTBAYjYhS5mdRSxIkbzoE8n4/unbkGXWuQ4JVDEVobleYVjqRv/TW04 1oPAsnAKIqQ/7cGXGejK0aBKOePWyFdFkIkHlKMa3dWpssnxw40ajbh4U4KY13H46DyA nsJ11Dsfp8T+xfl2Ki8RruSJ6mVW0vrdD+FB4NesLHfiehO7h3RVgYR5qrbjMC9t91PA Upo8nR24l7ymKdWoS6XH0moXJ1XxlVvoMAE9xg7DwFhlKPdxEnxKyRtjoa/XClHZsPmu SR7G39C4fywLeFMmHE/AQBtyXQSMW5Wl/+2uCsZgf8VG5OcvCWO4eq+prF3tVgbKSg8w PN2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PbJiL+AK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a056402115800b00446fdce2a62si24662394edw.420.2022.10.24.04.48.34; Mon, 24 Oct 2022 04:48: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=PbJiL+AK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231691AbiJXLsE (ORCPT + 99 others); Mon, 24 Oct 2022 07:48:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231673AbiJXLrO (ORCPT ); Mon, 24 Oct 2022 07:47:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2486D11152; Mon, 24 Oct 2022 04:42: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 E732761291; Mon, 24 Oct 2022 11:41:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09C21C433C1; Mon, 24 Oct 2022 11:41:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611718; bh=D6HpnG73y3wmp2/vJzJHQp6mWr5jNAm6p8Bk2cTBc9Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PbJiL+AKLabDwM6FnPNZX/VNsyw7u8F+pcdqdxSIw9CyemNm6BXWV2K928fbRqabW A1wGygrYTYfgGtH/fruMwR96uSsht+b49BEKHEih7lt+LXeI37I8ubBCkKl/nP4ozA cMHKp3mvSwJxJBjE43O4wsJ26Kt9y5ob6IjpLu5g= 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.9 055/159] ext4: avoid crash when inline data creation follows DIO write Date: Mon, 24 Oct 2022 13:30:09 +0200 Message-Id: <20221024112951.439734601@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569490138061896?= X-GMAIL-MSGID: =?utf-8?q?1747569490138061896?= 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 @@ -538,6 +538,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: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: 8490 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp403787wru; Mon, 24 Oct 2022 04:53:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6vd2fd04JdAUp/2nn060f1hCNyy5PnpYPvkQQVw88kbPYsz0vLF6tYKKknou2RE1uM0wXY X-Received: by 2002:a63:6f8a:0:b0:439:36bc:89f9 with SMTP id k132-20020a636f8a000000b0043936bc89f9mr27480114pgc.100.1666612401004; Mon, 24 Oct 2022 04:53:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612400; cv=none; d=google.com; s=arc-20160816; b=IEIxxElAZe8y61YVSoKaqbsSh6zByl2ArZQOeRSYwT08uhmGRC/8AFPYyb/5KXkagz sxIFl5qKGX9GBEmMFVi3KoFqhs3c4Hf/JN9tYGRecrx+DgAu+CYpML8BgJcN3zpTIGGs ICgU1hGBfqODXLeIZsJY43HLQzIz8ktnvOzPF8d95fIA78ynS6TzT8YkJEDoVCm2W9/r 3ZJQSYF/24S4dOEFMauOMjMB4QS+InpvW3QZz2ZdssBmjf06yPjEF6cxDQp2PMnE1KiT ctXwQKhqKJEJLpNJcTCQaWBMyuOLZLA47LK7wI2gXmwWgnvUalQpU4iy/YMSJJeVrve6 r00w== 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=FkYr2WiLDxAHnuoN8q9oL5I7p3NnA29PH1II9qhlljo=; b=zVUG8pF1k0q80B6/up3/RQf1LH0y4L/4aHS8JJTgCe7DdFoclSl7vr9F/46SDqhNi5 jCnJuUilI2TdwHqtUp178rkD/W6dAORljTWKV7+5hzAx3p9it1CyAdPC0FKa7k7y8oOk tO9joHSdkTdMhWTPaQJi3MW4nIPCDxKfKxRm2+cIPVNvu6D/DU3F3M+7kp7hyoRb/EdI O3EjdsadqI2Om5A7FXIPIYd1iG+9riyuJazppo9X4dSGBjsAsgbB23XsfCglDEsJp7l4 O6xZkJGIcq1GNJ/ygK5mtuXZGm1VWC5apJ4unSqbbZzVZfE/uadDmoI+U4I4IrHF9k9i UKlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=avclhSTJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 k14-20020a633d0e000000b00439d86cf509si39367819pga.645.2022.10.24.04.53.07; Mon, 24 Oct 2022 04:53: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=avclhSTJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231986AbiJXLwg (ORCPT + 99 others); Mon, 24 Oct 2022 07:52:36 -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 S231983AbiJXLvn (ORCPT ); Mon, 24 Oct 2022 07:51: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 6A22D25DB; Mon, 24 Oct 2022 04:44:27 -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 8F5F66127D; Mon, 24 Oct 2022 11:42:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9CE4AC433D6; Mon, 24 Oct 2022 11:42:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611721; bh=gK9tBW5QGusxJXici9NHLyY1IzBuFwJKABTxygaS+yI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=avclhSTJTkr5wehxEju2JltpUsP9HWiS/S9QRkuGvgnnJwNJdqjaGpgD8ByhBwW7V 9TT6IvvKVHr01rWqPheF4ugAz8V0Eg2zTlwBwI4QzghwOzW7qShT0FkjTfbX51fiMV 242yFgmUbpG1LdA+ogLHruqVsZKwXSZcI0QMJniY= 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.9 056/159] ext4: fix null-ptr-deref in ext4_write_info Date: Mon, 24 Oct 2022 13:30:10 +0200 Message-Id: <20221024112951.478694189@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569765007171010?= X-GMAIL-MSGID: =?utf-8?q?1747569765007171010?= 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 @@ -5381,7 +5381,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: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: 8449 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp401751wru; Mon, 24 Oct 2022 04:49:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6gwre9aJXf/aZStUwTwjOJFLce3PUSDr9k0mdctd7yWF+B9X7vy4anvRGxfhihJIAwg0j7 X-Received: by 2002:a63:2ad8:0:b0:46e:bb8e:b343 with SMTP id q207-20020a632ad8000000b0046ebb8eb343mr13821415pgq.408.1666612147048; Mon, 24 Oct 2022 04:49:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612147; cv=none; d=google.com; s=arc-20160816; b=FStx05Ag/f3UXOAIcf272owd4NCEf77UblXvAfrGvbnTpv9MLNF+GRGHYzuW18Xatb c57SMPvpDc4p+QFIi+GEaFjoJ1opBHOVJvueG42U1AEqvlEh+fED8EcywfyfP+199zre jdhu0l8NuTT3Pn+9w9r5z/g4FcqcIq2WN7yQBfMLYQXKvhlJRM9Sy+urXMg7xK7t5CNp sLiY1WziHbZDUsvTwAa2VLEoQOhtcNQBguzXnSQGtBjX0PSxW6OHB0CAAjvVeO7pJQdf SKlJSAly+d21FVOexBuHnAcFlNImXbEOVGHaxF+JkfqjZtNBlSR8sKx0X1Wzzth1LkGF g2uA== 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=o046RuC0dVvSFNAb3f4cS1RiuFphTqakQzyPnZFVifw=; b=T7BfTnAF6QhXWoD1c1A1Y7ZVsJfa5RngCr64Lmnc4eLnT/OeTd9pRgRqeR0jJCxdKD T+Kv3B76sFtJw5rNgcxBZ5o6aR+1Q1Rc2pMh/c7bIyEUVCfYMKuuPYsL4TlbEStlAIU7 CXpwNaQEvWF4jOzov1ZyPfKSKf7ERaXk7dSS1jPZRqKH8gSf6b7eVEkD0Z2BJcQYkQni sFN5G+YGzXzOw43tzUwM+mbp/5dwQ/x1wVeLXOIDCgJylceyNTgYJwaPLMCJSubAUNpT 8/7Mon8cMqnWmc8GsIbRKc7sYpPPpTqblqpzYaaRWcUGyo+RxXQ7lNCc4u8MaQz3Gp0s 9pWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2K+c6iR+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a621b14000000b0056bb26401dcsi4776168pfb.207.2022.10.24.04.48.53; Mon, 24 Oct 2022 04:49:07 -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=2K+c6iR+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231328AbiJXLs2 (ORCPT + 99 others); Mon, 24 Oct 2022 07:48:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231709AbiJXLrg (ORCPT ); Mon, 24 Oct 2022 07:47:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 545482ED5D; Mon, 24 Oct 2022 04:42: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 dfw.source.kernel.org (Postfix) with ESMTPS id 2EB78612A1; Mon, 24 Oct 2022 11:42:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43DADC433C1; Mon, 24 Oct 2022 11:42:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611723; bh=jNle1HeYOW3IMKmWWkg33TJ1Gw0ec7HuD4SxLGQeq5A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2K+c6iR+uXHT+1e4K6YmbCfVGcBkhqvJ70Yazyum6a81Nm7N5MRXoa0PSMYOT7Byu mp5C99JRumckiTjc60JYLioctjaZDlJ/2z+2zI3Yogj1EZBbNmB+0wlSL/MKjTh1DG Tb1JLD9VFsapiPos3ymw6UrtXxyezXf6R8DZRLXg= 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.9 057/159] ext4: make ext4_lazyinit_thread freezable Date: Mon, 24 Oct 2022 13:30:11 +0200 Message-Id: <20221024112951.515497074@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569498374611274?= X-GMAIL-MSGID: =?utf-8?q?1747569498374611274?= 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 @@ -2911,6 +2911,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: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: 8428 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp400767wru; Mon, 24 Oct 2022 04:47:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5q8pymXpJ0zMD2A6hnO+AGur9sk2liWAuBLU33ru8gkrWKbYA82fI5WaMRT+Je2ZkKaE2Y X-Received: by 2002:a05:6402:5507:b0:452:183f:16d1 with SMTP id fi7-20020a056402550700b00452183f16d1mr30980898edb.96.1666612061782; Mon, 24 Oct 2022 04:47:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612061; cv=none; d=google.com; s=arc-20160816; b=UvwTZhhLvoFhbmc/xJaF+gjmKrxWNBlDjNg2KOyNpRISlpnW4pwLUnFbM1jVrmjmpv 0O7z+H4/IFM1IZ8YSdK7n2+ISm3BQKq4DAxgV+GCuhoM6FXqqdZQ2uwSUywC+IF33KtG F1AL0SI8GzfH2zXyFDGEUpTlM1aKyNu0/iKQB5u9WuNApDWzGQzFXn9F3pKlGnB27dgT SMUxGfuCflfPveRl7I323jVP4TvrbJwl//697az9XXb4r+LEJIwd2lREOgDFbeCNGWV/ QP2GwTUvevsWnw+Z3v18LN+VrlWbad+6w23E00Dcwnm29zsutTeIymU1eWcjP/KT2H6y eQGw== 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=VaxZ90Ayyfbpz0H+c6zD70YVtAmrIXSyx1/W/BKkDCI=; b=Vy1tu04834MJOSYAZMZvyS4k1yTa2aK8jwDi23kPincgXxfWHyeyrC4cwZMLF9+yXf F5pZHRXvqhkhR7P7xFLebi6PSV+YHoCE2TNKhgiDlq3adOzpUSoBmeNgEC62Up/LX5tx DvXeshPOdC3Z/+BE/sak3QPFUsMnuYJIkx2NZhlXZmnc6WvLtgGzHiucZ+RZNt2E5KLN 8zmEixJML14SBvEZ+vkvFlp9zqjWmEO3E4b3guQwZNmAlwZXpr9odVa0qapRgAU5fMix XnKBja5L7mRqyMzZRhlJyQZ6Z1Pm6qkdMLdxSR0R9BN/G2q3uU2r0UPQTS/FfONYKHt8 buig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Jidp2Y8n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 dz16-20020a0564021d5000b00461c74a07c8si2828323edb.343.2022.10.24.04.47.17; Mon, 24 Oct 2022 04:47: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=Jidp2Y8n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231419AbiJXLqp (ORCPT + 99 others); Mon, 24 Oct 2022 07:46:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231844AbiJXLog (ORCPT ); Mon, 24 Oct 2022 07:44:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65DF110BE; Mon, 24 Oct 2022 04:42: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 B93406129E; Mon, 24 Oct 2022 11:40:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9F80C433C1; Mon, 24 Oct 2022 11:40:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611647; bh=+I0xfy1z0X+lsymIB2vC9bMATzX/t2nZ5Oe46nZnOzY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jidp2Y8nsnEnavBQn+EioPMg2cQv9p/mpOPe0XUCePdPln2UZ2Cp1Ldss6cN1Vy5r qc1jba3UIl7MqR1hCTcN23ZkwL9ZO3UEXHn9kXpk+gQ065EovmO4iGXBYLsvLnsIQ3 PhRKMA2FOjW7rtdAQ+lOYIDe4OAyabggSyS9Zvso= 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.9 058/159] ext4: place buffer head allocation before handle start Date: Mon, 24 Oct 2022 13:30:12 +0200 Message-Id: <20221024112951.560021650@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569409452053049?= X-GMAIL-MSGID: =?utf-8?q?1747569409452053049?= 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 @@ -1215,6 +1215,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: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: 8430 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp400837wru; Mon, 24 Oct 2022 04:47:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM51+N5oJR+SOT8FWdvSN6AXSmfMT1dPo9STG6Orjb+nI+fLU2DreD8CErn8EhXZXGbYbTGM X-Received: by 2002:a05:6402:5162:b0:457:6ef2:df3 with SMTP id d2-20020a056402516200b004576ef20df3mr30246630ede.128.1666612068406; Mon, 24 Oct 2022 04:47:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612068; cv=none; d=google.com; s=arc-20160816; b=sxMAPw5NC9VFhfQXzudDvjUb49HVeIT4mo0q0OPFerf0UL1Kphkgeh1tq3GBV9ic+8 fmKeDfFL7kI6G/9/qGIYaOAOqAlaz8YRhTr7yKrUseRhwH0Wxb2yNTwvsaEkL/Y4ujuC pogCEXl1NFjWv+GhCrZU45rsyijsPRDAvwan2oCRYDFTtix1W9DTrTGpRNBNU9TZ8f5G BhZKbnvHAo2yZCbNuDci0jyexgeOGfvHY1B45uWIRlvZOxLhdUO3TVr/tRPLhD3bfo9S XKOrniB4sdcZBuTEJGoYwv8vlEDewj2QjWI2Vw5kHES3UfzgKBkCDgBRrvglYXCXn0Vf 8Pcg== 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=+rQzwhh/Ik1UAbn15gSm0Dh9Qn9y2V0rvLmD+9Y9MSg=; b=LYcEK4eQnCNaQtO0uiSNZbS12EwWPSgx/2fDU03fjAI2hiIbWaZlrYrFie37cunAEC 8rBWtq8LfH03GBuOl2cfAdfw/2PVIdLziaTaf1EOCOgYZNxXxW/RSzaa6oEJr/ONtVCi HCSTTHaQvhsMGGuR2vxQ/b2WP8ok0xzyY8KwpGbXJrS9ymJ1QcGxxr26Tz88ZcFXbMaQ YoVee+67DqxtHY6Bmvdgm3sUTST/q6BbEh6B1zxiUUNO2gWgT4OKKzlsMU9z4JDRvVh1 1mEY5r156wqzUmzEDweqvS+RRVIGiaW0cfHe5ef7+zsnVgIqPzAgxIDqxih9TaS0aZfO WPVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ri3MVWqD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 go10-20020a1709070d8a00b0078e11cbb722si33778559ejc.92.2022.10.24.04.47.24; Mon, 24 Oct 2022 04:47: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=Ri3MVWqD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231473AbiJXLqu (ORCPT + 99 others); Mon, 24 Oct 2022 07:46:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231866AbiJXLoj (ORCPT ); Mon, 24 Oct 2022 07:44:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3B1F754A6; Mon, 24 Oct 2022 04:42: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 55FE9612A3; Mon, 24 Oct 2022 11:40:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66641C433D6; Mon, 24 Oct 2022 11:40:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611649; bh=HleRpNnRVYw5VRTljs6TvCLKvfcsk+4I4s4hYiy2qTc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ri3MVWqDsJdAS7Rly4z0ftWrrGCeyzV3nU/tKy9JHS2HF0j1i0Z/oVWBpo6rJjg/D 9f03aiq6DU4TDak/NOXkaQJP+Xzbw8nVSnaZWRwGci4tgBK8FkVW6p4xzPqatcV9/Y I5oMFx9DAoBMbvQ5mpSbQRZ6mIVa1QTluKqogJ24= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Steven Rostedt (Google)" Subject: [PATCH 4.9 059/159] ring-buffer: Allow splice to read previous partially read pages Date: Mon, 24 Oct 2022 13:30:13 +0200 Message-Id: <20221024112951.590823450@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569416221352754?= X-GMAIL-MSGID: =?utf-8?q?1747569416221352754?= 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 @@ -4623,7 +4623,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: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: 8457 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp402572wru; Mon, 24 Oct 2022 04:50:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM74WO1QuYABSxBo0d5PaC7t7xWVh0k7S35v/bYTNfkS/ZBXEbzhMeSqQC8wYEFH9h3E61L3 X-Received: by 2002:a63:c112:0:b0:443:94a1:f09 with SMTP id w18-20020a63c112000000b0044394a10f09mr28211119pgf.396.1666612218715; Mon, 24 Oct 2022 04:50:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612218; cv=none; d=google.com; s=arc-20160816; b=iPQ3W5WvY9AhNzpuhVYBdSk4ZSH35yoCUtYNdo8Ipq6Dnudl2XqVELMJoR+ihLN82r FZeHAXnHY90fpVilwKyUUmuUciKVVJPpSCMHTFG/ChkAKAczlCN/vcbEg9eqlo4u7fph wXh5O4F1jAsS/xrzyMXBQkw252dTPsEdDflezESXTgyVwbovcQVKQsR8RY6jGZrR3MBG tnui1ExJwHgVR5z+fwxHPf/rnCtkUF46HCVLrF/YkVuSeYhkK0cCluiyoZSrkfaHp7O1 pJcl32cZI9Z97+cv2vqDql42kqVczp9p1rmr7TwerS48B41+RHwtrZIDQT2FFAv0WwM9 eoNg== 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=3p0yf4xZ6/0vrxO/YXfvQsxxTaD4UUwpIbWxQFeoqfg=; b=lg5t3CXObREt1zSkpBoEkqql6kjMVFv2o8BkBjVmEOw5pqUl4Aj6mEfkeDpfepN6z8 VOzPzgOlyKuCXVNfMNVts19bwuMA9Mcr3G6QjO58UwBdQINRfWPNyDPxg+s9WKR+nusg 9upF6uU6YH3lVhR3AFq5sZXDoDBe/lCQIHyN43mqmmEXBs/EXXk/cv4WG11xjvVxBY+D hWLbaRrrPAS4S31rvDvNfaWYQyKReOslqJK7xcTyRxsYyQtPV7FfwPXt9nZsTC4SmPTN R3RWZdAoM3VAVS/8lE80lQJkjgOcxnzZ16SdZBnyMlYqbf6uvkdWXWHVCo+bz/Z3Z3nn Q6+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="zm/oux05"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 j15-20020aa78dcf000000b005631dab9f69si32065693pfr.301.2022.10.24.04.50.05; Mon, 24 Oct 2022 04:50: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="zm/oux05"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231649AbiJXLtt (ORCPT + 99 others); Mon, 24 Oct 2022 07:49:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231650AbiJXLr7 (ORCPT ); Mon, 24 Oct 2022 07:47:59 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10BDF1A22C; Mon, 24 Oct 2022 04:43: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 sin.source.kernel.org (Postfix) with ESMTPS id 24DB2CE1343; Mon, 24 Oct 2022 11:40:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11739C433C1; Mon, 24 Oct 2022 11:40:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611652; bh=1IOQmUI6946jvhWqijchMtnbXd4TLovY9etrS+Rty8c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zm/oux05W9eArkEkk9V83dEQC89t6QT5L8d3pnkmrmFigWHNSIwC28tQooinGFFxv Gju+fVOcFnpBDFByXUjxlNYmCjSIJBMUaIZ9oSa0CFhFyI+8Hkp4tar+v631tkCwV7 QkuALV/mcirL4XiXOaTztqTCjKzsGHu237cAMx4s= 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.9 060/159] ring-buffer: Check pending waiters when doing wake ups as well Date: Mon, 24 Oct 2022 13:30:14 +0200 Message-Id: <20221024112951.631538334@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569573803560136?= X-GMAIL-MSGID: =?utf-8?q?1747569573803560136?= 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 @@ -513,8 +513,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: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: 8486 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp403657wru; Mon, 24 Oct 2022 04:52:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6We0kPr9V1HEwzicrS1BPaB6GpVLOlxwvxgZyZHAHGCFqlTfrAw2lywWxnz7f1uvxUB4gF X-Received: by 2002:a17:90b:3882:b0:212:f4e9:ceb0 with SMTP id mu2-20020a17090b388200b00212f4e9ceb0mr9887467pjb.135.1666612375717; Mon, 24 Oct 2022 04:52:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612375; cv=none; d=google.com; s=arc-20160816; b=BYy14F+R2X6zw0YunEEvknTeM7nAMZtmIxu3z/iYTkPWIGatlu/qV/qW/H/EkhRHH9 sscptPd2bvU8EF5z/SWe5HdFjBkrdvlDEXdkmxLDWUfa3WdhhUIZHIY2zwDzV9kPbv5U LlUDHMCMAoFuA6Aws8KpIb9CMDOquwnJ26rnUyJ9pZnI163bcKwjypdCUI/0QKG1uQZI /dV6xrhN7j/fuX4FnJCPe18nuQ4B42m/gwxkxDNpQ3/EaeN1dDKRO0DME0q7SDiTmExi LMk+muojSjanVWCyTx7LunovYxdVUn2v8XA04qMeK95U6+DVVGIUdXXkAIXw0rayXSlA KOkQ== 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=r9nYBlHoCjOTpz7fKpUzLBRQcp88Xcj0hRM6LheulL0=; b=1JWfiD0KQ80pTsgcLooEKszyw0uliu6slSC1DEVjGgWNRzywhMlzCdAZcY9MPku99J y110vsJq1qpHV2732EVoc8uDBZbVIwB4UZLDLybdWoMSE0oFjUfB5mBv1LnBitx4ZdeJ 9D2xahBd+mLFbM2Mq3LI/onCl2VGl6SAlpbtKgYr0NL1Wl5z3dks3XVvJg5pMQ+W8Vpn m2yySTTafFNZy/2V6GWY2GcpSf6yX2akFbbRGUaaM38TMeO5i+DWCCVGMP710aZ7vrwv HxZjUPQPi2yKBVFZtTAuTLcJWsIHfOrMUHJ7qhhsJvsGlRfWFrKFCKDPF3sfqHJhQCP6 6hQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RzxJ7p9F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a17090302c600b0017b2fe7de33si35762929plk.10.2022.10.24.04.52.42; Mon, 24 Oct 2022 04:52: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=RzxJ7p9F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232020AbiJXLwL (ORCPT + 99 others); Mon, 24 Oct 2022 07:52:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231862AbiJXLuk (ORCPT ); Mon, 24 Oct 2022 07:50: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 E97DA6C945; Mon, 24 Oct 2022 04:44: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 9C143612A8; Mon, 24 Oct 2022 11:40:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD67CC433C1; Mon, 24 Oct 2022 11:40:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611655; bh=UC4N3sBjhLDZ+wcXGgo6PpGYM16M/ta0K69RYYrVh+s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RzxJ7p9FVuftpUoT6BMCQFOIQ/YoSsMjipLG+6jEvGpeepeGGslyzrM3Br+VgXBe3 xW5TPDeiaQP3Dr9ve9Q7n3rPe+mfhYAxxYlZNjmotqv30/tnDPz8uKPrUz1aendkrf 4BvYPum64TLdS6x8+0p7u6KU+62TVvpPdLlXIZak= 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.9 061/159] ring-buffer: Fix race between reset page and reading page Date: Mon, 24 Oct 2022 13:30:15 +0200 Message-Id: <20221024112951.678044566@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569738398427671?= X-GMAIL-MSGID: =?utf-8?q?1747569738398427671?= 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 @@ -2122,6 +2122,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; @@ -2133,6 +2136,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); @@ -3724,6 +3730,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: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: 8495 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp403946wru; Mon, 24 Oct 2022 04:53:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6qx+qYvobgRuw0jyQXFw2U5EQEBAh33YR7NK8WsWo3Skm9yXHYgEd9Fp5XWq3irancKtR6 X-Received: by 2002:a65:6e0e:0:b0:434:59e0:27d3 with SMTP id bd14-20020a656e0e000000b0043459e027d3mr27062865pgb.185.1666612433769; Mon, 24 Oct 2022 04:53:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612433; cv=none; d=google.com; s=arc-20160816; b=zFMgM536sywpN25Sklq5iFbA6jDfWKhzdsh+AejPJveaPV1vmaWMJsH+PyQdFIOB7n QKW1No5VwCFEOkdA2RsDtCSUDbQO9EWr+CHVZ3rKoQjPS0233QYQJL9/YPK/SEtTIIR1 fs9qr+hi45JX2+p3S+LawZn89xGQliJlCFvXE3Lra595ZPH9Uw07bVC+Oztc9Rbyfy4q nFm8NdRQ9OR6A8ZhF0wpT4VT0ewPaSZIQjY18S5Wuw5Ik1yEosDu3k7lIKd1S3kXkxnq nRMGdnjAhRIJs/V2vd443KYmvM37OX0iQRYi7jvmwlhTDzMEW/FlXK+x8qp6jlekG6wT eFpA== 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=0HbWFCRwWyhCBco71WEIe8buK58+jZx3rEUyHLMb/gk=; b=VrEokydyge2ml/xpjJWgnefZY2S5pCl2ygmcUlfei7flhtEHcEumBcQI25eTsGJAF9 pUsH1oQqH3L5+MLb2PfZwYt10sGCbtu+0wjcqx6CK0ZX+BErj0bhssHoJPLANPzsb6Sv UqImyclgXX0IbDdpp3UEid8/nbztkiL3lft4VYeLqQSJbfVZegLu34YRZWZ5gOpfKuzx dni4dxVvL+T/qv2eo6/scJvKdkiWL7r1+u+bw4nkjg6Zz2KNXZgiaYINPRoo2ZfNOl7c BfkYlGNAwWvw/L6ZXEOz+P/x/h9guDHXm/4gOWP5qiMcxNXr7Uf1Lv4ErYsB/PnEEO4r qMEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SUIeEzcB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 s200-20020a632cd1000000b0042ff6b15129si32609881pgs.2.2022.10.24.04.53.41; Mon, 24 Oct 2022 04:53: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=SUIeEzcB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232105AbiJXLxW (ORCPT + 99 others); Mon, 24 Oct 2022 07:53:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232054AbiJXLwr (ORCPT ); Mon, 24 Oct 2022 07:52: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 757AC140D1; Mon, 24 Oct 2022 04:44: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 sin.source.kernel.org (Postfix) with ESMTPS id 5DE38CE1331; Mon, 24 Oct 2022 11:40:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B31AC433D6; Mon, 24 Oct 2022 11:40:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611657; bh=pS5WP/5RnEfDdJOQcfOSKRNblYIG0koFCLEF4yVIa44=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SUIeEzcB+TygSa55iKR8/Z/zeBgrEPL+nPX9/SIy/4pIYbHyA+oOi/nF1lLdMmqFs q0yMrHr2PwLTK9GP0wBaVWDTMLZgpZccS/YrG8tWi4AulZYFVW0mMvDh6KkmjO7V0Q 0ZIw+Hyi8D5eYxOC6B7CXhg7x9TCgIgPIBqCHfiU= 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.9 062/159] KVM: x86/emulator: Fix handing of POP SS to correctly set interruptibility Date: Mon, 24 Oct 2022 13:30:16 +0200 Message-Id: <20221024112951.717779337@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569799308892964?= X-GMAIL-MSGID: =?utf-8?q?1747569799308892964?= 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 @@ -1980,7 +1980,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: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: 8638 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp421005wru; Mon, 24 Oct 2022 05:19:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6EBvvOkABtxyXVNIgcW/hWEnfP/mP1aF7eCi2FruULPtY27Z5ZYZ/4iwFYcQX6KjzSap4T X-Received: by 2002:a05:6a00:1256:b0:56b:deeb:c5cb with SMTP id u22-20020a056a00125600b0056bdeebc5cbmr3820194pfi.2.1666613965032; Mon, 24 Oct 2022 05:19:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613965; cv=none; d=google.com; s=arc-20160816; b=mmQyABRIJCMTl7q606A0exS5HqLo5q9RlLq5pp54LenfDaixzP64klj2GzBYMaLnhe ZdC1bUsS6+68tFIHznzpsnXNA0nlvBR+DKvHmxqOgPEfSPSwloEw1dwe+XA4QYmGZE5L ARxsoahOoxlICpwVbQY6Im2lzc4WNH3do0G0fOB1DVy8zTzjIkLNN3pXdkQeqMy8PfXx hMHnZ8iYCEJhI6Rz1ZJqkgM5nNivoUH0eNmgHy7rURmxkxo5Xxs8WvifNQQAqm89doTu tgsoqkHDVeeTaHUpRxRkNmA2S5XH3hgYt0pTKLsFuShifsoOqVgpILU/gKCZWc1Mqk9p 3yKw== 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=nv63YBSn+zpYfaKlz2JLw3DQGas3Vtx+guOuZKmYDbY=; b=ILXsOlRhJJJneVj46qAZklXsqvSx3/Aj8oqgFrcXLlBxIUqsXNDnA7RI8j+A/HjLD4 gVlaspNoOBCYjvQVRg9bxYHKZlJX6vw9EIXnPOcepjkBEn133FHQ5QxICkwM1fQwFA76 4Awa4AOhevHmwIE9Mew1CURGTUocvsBbkH1IcpMOcR5fHWIkwMV87gbOxbRdkqtfc7uZ Mfv4bKBaq35vjqh3mP9lgoukVtMnazEt9XwvHiD9Ds/SAGS1XoB9cQDnCoiCCbvTcQp8 rtcyQbgIRpzCHVTd+wQeNaL3jlAgJnUXnw/mVSPDEJ/U+wI0EGJ1sT/doHfZ1knWNGPp smkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mjqP74QW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 oj10-20020a17090b4d8a00b0020d887ded6esi17016228pjb.120.2022.10.24.05.19.11; Mon, 24 Oct 2022 05:19: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=mjqP74QW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232839AbiJXMMF (ORCPT + 99 others); Mon, 24 Oct 2022 08:12:05 -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 S232827AbiJXMLR (ORCPT ); Mon, 24 Oct 2022 08:11:17 -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 053C2356CF; Mon, 24 Oct 2022 04:53: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 0C3A26126B; Mon, 24 Oct 2022 11:41:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23222C433D6; Mon, 24 Oct 2022 11:40:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611660; bh=DGqJfFMgG4TmWzz5+DVYmlWy4iPs6CceCKlcZx+zjH0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mjqP74QWXeQ7HQQrrYjVZlGIKufqgePio8NWllMPn6f791M8k/KnodrKKNW26s5Mu 7Mzg5aWa24I4G1wN4S30p21NxDNgPymC75hAI7QoVNYOx6zFoRsGcrrKarkYeA+x6D 8Lu/wkusFwn6xSGgQhPyjNx4nyYAEEMJRhaERPcY= 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.9 063/159] selinux: use "grep -E" instead of "egrep" Date: Mon, 24 Oct 2022 13:30:17 +0200 Message-Id: <20221024112951.764643056@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747571404934909841?= X-GMAIL-MSGID: =?utf-8?q?1747571404934909841?= 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 @@ -56,7 +56,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: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: 8434 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp401024wru; Mon, 24 Oct 2022 04:48:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5gRpvl3WUdAW9+IJpIBqNGOHJ1YIJk6iqYrdbI5CFDNHydeypZfBYHvdMmUa1eaQdqQrTB X-Received: by 2002:a17:906:730c:b0:791:997f:d65d with SMTP id di12-20020a170906730c00b00791997fd65dmr28034805ejc.18.1666612082802; Mon, 24 Oct 2022 04:48:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612082; cv=none; d=google.com; s=arc-20160816; b=pNxY59sgkxoEQHvcAq3rNsNNMKPQNsCibqfaDeoZWRxQPe9jFWJLhxpFTEu5u11EyH HPWY1YuJhfZYb/dbOhKo5FKQeh5Y+5scjsqbIPWzrTwwOmN0+9PmW75karF2XmXRuA1Q KrbmyAdubXIlvknOvHSpk9qF6YZv+8IpEbML9uCqSGduz/0zLxWlCv6GWoJtEPXJq2E2 ByZ74oQvDZM5CJlYmykm866X4GLx2hj8x3A4Q7q5gHmz5+0bAQ/K33CkyN8Q8u7djiSq H9MLSJyhPadwe0J9JCMjpcXGK+pZWnoQ6PsRGaTFaPl7glbdID4sR1efSzC7oYzF57Lm t+9w== 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=bKg9WAkkYdo4VgTajrnDnnw5yhyTxE6NMMSdtZZbug8=; b=wFB4SegAOM9dG9J1NtEWBNKY3ZVb0NfmgN0U5Bba2sHTMY7aToqTwafJ1daQqWMfiz Taav1oa3CLhKsXzimH/szUL6UphspT1Es0sunJ39+75mnRkHfDGdkoPG9zjEDYRlzErC lKAwfHuBgP4PKC59h47au3RvDhZsePuAr5g083fOa74uQqK6U76SWYvhIw5Zg0QnuILu 561ohSZ5oB8iHzpEDvB3r3sDo4toyhKTEEbXKTb6nu0btG7F5XbAG8oVo4Hw5tir0FHZ xNaOagVzmBLF3tEFjUlkhDwdqAgz8UfviVrCG/SDt37lRv91qCm+54m5dqVJ39eNB2TV Dpsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MyDN1wqE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 dp19-20020a170906c15300b0078c47b4478esi25733452ejc.106.2022.10.24.04.47.39; Mon, 24 Oct 2022 04:48: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=MyDN1wqE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231519AbiJXLrH (ORCPT + 99 others); Mon, 24 Oct 2022 07:47:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231126AbiJXLpK (ORCPT ); Mon, 24 Oct 2022 07:45:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEBE775CD5; Mon, 24 Oct 2022 04:42: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 dfw.source.kernel.org (Postfix) with ESMTPS id 99993612AB; Mon, 24 Oct 2022 11:41:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF1CCC433C1; Mon, 24 Oct 2022 11:41:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611663; bh=N9qKZYT7mOJgyhIRE5pCqOGzv5ItisKgr4od6nYdI7U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MyDN1wqEn1UCdNBjRQRzOtoesmmWc1qL7Kf4gIW/9GfzqJ49DQkw6OCRUSsPUDYiC aYcAVNXyjMPKlmTPRF0DAz99YoffmM++Msxf9yPkvClLS2gB/2B/wJAMLxRfnVZTvh CvQ/VdLHoZhaaomm6OJmdCXaF8I1idpkcqSSV2uY= 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.9 064/159] sh: machvec: Use char[] for section boundaries Date: Mon, 24 Oct 2022 13:30:18 +0200 Message-Id: <20221024112951.802269614@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569431231250966?= X-GMAIL-MSGID: =?utf-8?q?1747569431231250966?= 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 7a99e6af6372..9ec764c4ffe9 100644 --- a/arch/sh/include/asm/sections.h +++ b/arch/sh/include/asm/sections.h @@ -3,7 +3,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: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: 8477 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp403369wru; Mon, 24 Oct 2022 04:52:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6AxU7qtnowUPejkieywzdNoPWrSl1zPHDdH64gQnI4WBka/5/IY/2pq6q78NtTMPwtrJJL X-Received: by 2002:a17:902:eb92:b0:186:7067:3e9a with SMTP id q18-20020a170902eb9200b0018670673e9amr19560254plg.80.1666612321089; Mon, 24 Oct 2022 04:52:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612321; cv=none; d=google.com; s=arc-20160816; b=1GScppHMaagahhPT2Alt8np5OQ0QxUhrEm2bboxGaMJbiUChQrA7THcY6cDVn0yMgn nBY0lRtYZvu9r+pp5Rq7y74jbzbuWoDUw6yrwDuALGB1TktHIHhSpfrfqbpSuOlyERmh /1dNZnPpLNj6W+WkCYtMSpYeZeHi6wu9BernGA7l+UDECFN2BSGjYdsFohJK05pQH+tm FX393+QRSpyJC3zdtw6VtKOwJnD+POGNZCrMk7eWrYmueWGXWbuXJHb9vg11EbW0Ke8r FqkKpaUC5hOU+zdsbJfyki+dc1l+vXTs4ODFvNo26F1iqgiOHLcm4WBv4F5emCmBDY37 E3Jw== 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=XZnRZLcldCraO6+XyLgFSidHYOZy2oWL8CzFJ6XDa4o=; b=NUIsQW0C0c//m18KCdSO4gVOIHd2NLAH43Li6ldRcTHZ+tbwhnsyAel6DTHVLm8CuN snOlLdnUi1rg6A2nVU87SIKUILASxU0baitPUbWxdxJoQCAzDTuqDqvkCSILfeS6xa60 lRgW5c/FyzxT8Rq2kCL2BXr9bqwIBn0qzHVN4afYuQOJh0phdcI/sXIpjyyum0wvJ2Z/ WOSAvRSLKcwdRn4kH7EDe4jNZoXSr6JnFYzCtBQ2/s07K+qsFiZy694GaRxSa+2AORe9 k/TeinrOsL6ENrNaK5VCCjTuz1Yqz2Y81oimCFrMB10sfX3hWhEUCLT0uCt29M0Lnn/1 x4nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=j3FluWJL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 j21-20020a62e915000000b0056262d97880si7806607pfh.186.2022.10.24.04.51.47; Mon, 24 Oct 2022 04:52: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=j3FluWJL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231947AbiJXLvQ (ORCPT + 99 others); Mon, 24 Oct 2022 07:51:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231998AbiJXLtW (ORCPT ); Mon, 24 Oct 2022 07:49: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 6984446238; Mon, 24 Oct 2022 04:43: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 ams.source.kernel.org (Postfix) with ESMTPS id 27F19B8117D; Mon, 24 Oct 2022 11:41:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59FC7C433D6; Mon, 24 Oct 2022 11:41:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611665; bh=QZZzGQRN8KVemc7keCD42fZI755qbg4WrnpVLBiB5O0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j3FluWJLwtpzi+K/OFgXIByqniJ52HiGSSjIyLUBfyEY4u7ACnvRLyc/eO3QtuZkm mntOM6Cq4KZpgpMt/scElXzEmOtCzTSEjywS8Cetfwco7TAZKWFemPHfryUidatr+G BcmjNmgcAISE3kPXDEHVLz7JAWJLXsC+yi1yJjzc= 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.9 065/159] wifi: ath10k: add peer map clean up for peer delete in ath10k_sta_state() Date: Mon, 24 Oct 2022 13:30:19 +0200 Message-Id: <20221024112951.833699139@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569681181823690?= X-GMAIL-MSGID: =?utf-8?q?1747569681181823690?= 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 41fb17cece62..1ac24507b4e5 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -798,11 +798,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); @@ -814,25 +839,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); } @@ -6095,10 +6102,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: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: 8435 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp401085wru; Mon, 24 Oct 2022 04:48:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM69KbSGb5VmvR6aqmqFpN2LxbI5NkbspqK7uX8W1qs8BbI8u00AvYVxOPoQZVN9dNsRe8oJ X-Received: by 2002:a05:6402:3890:b0:45c:2b5:b622 with SMTP id fd16-20020a056402389000b0045c02b5b622mr30868632edb.69.1666612086751; Mon, 24 Oct 2022 04:48:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612086; cv=none; d=google.com; s=arc-20160816; b=jhogvRVs2a98VuL0u9FjTEER6hU5tnOpyvZVgx5MOR4GY3gtqMqF14CcCrv9K2j2Cc rJlE8DEnyb8hVFQ60LH/qNCG2F4nsD2v8SQKslpbyDFOannozF/wi47/5MGs5gr82Z/B 2LYjht4huI2htP3DppxEuQiFuFn+3jY9QsAfsEMmoAX53OTwY/oHDUGpSVxvG6Tw6Seb xXe/Y2Wg0/TvyXcJiz8a5AqSkdBbx6gs72M98/J78K86xdYBhKmQSR7Z7KrFfglqfrRY vdUbii7IyC1bE++Ht2bHuVK5mNHvGcBU+s7FVZLe0ou+7UgEJ/FLsUY9Uo4rq7mOH1WJ v7DQ== 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=yIWLGeJDn1IHXrrfoU/H2O8KmkIXukfH6bLBo+7dVKk=; b=d2C/UBMU0zPK/WzLYEiHrExemi+KrvyYISE/G1Jn0LHvdU58LrT/i5r/ztUs3kHCci Z73aNjRn3/AJIVcQkflqfBE+YQkFkjCnQXbGEwdpZo2jFYKiZtzS1t7uuZZptFWHWW7o 3uvkR8iyQYUdyiZ9+1HIJw3ZjzBR7eZz1xer+uQSSk94AHPnM/oa0REuKYH3BPAmxJ01 cCExWQ3l/BxDoi9jg4zM2vqcsqmb6/hVk05jbaR3B8WTQN0kRAptBmRGesLYZD7nst/E ABeEIvQqmvutkaWvPcGOt3vfDmehVw5vaBALtXb/4tjDGMRS46Aq2PE1D0ZL1z0mnqH/ tHPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="eieu9/5X"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 i15-20020a05640242cf00b0045a1dbedd92si35987246edc.35.2022.10.24.04.47.43; Mon, 24 Oct 2022 04: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="eieu9/5X"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231529AbiJXLrL (ORCPT + 99 others); Mon, 24 Oct 2022 07:47:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231407AbiJXLpM (ORCPT ); Mon, 24 Oct 2022 07:45:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23B0B6BD51; Mon, 24 Oct 2022 04:42:27 -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 1D44361254; Mon, 24 Oct 2022 11:41:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22FB9C433C1; Mon, 24 Oct 2022 11:41:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611668; bh=z03gnAyu/ZPDMEYEDNx/tGiKO/URw4LGx7hfVzA473Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eieu9/5XTn9nK9IqkJhoq+ZzNVWRyEIGOrsbQ5iQ4fUkX7NknaKP3mATyt2YgNzAh 7Jo/45iAYM6ucaJJ2p+kTU+WhHnTh0LvPLUVsrKVOkXUIWU6ukVDC33yxfKCF/d2t5 iCCoI/ftrw8zZn8PewIQPt+NgIfqjOzhCi3fukkk= 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.9 066/159] wifi: mac80211: allow bw change during channel switch in mesh Date: Mon, 24 Oct 2022 13:30:20 +0200 Message-Id: <20221024112951.872628357@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569435152273483?= X-GMAIL-MSGID: =?utf-8?q?1747569435152273483?= 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 091ac3a7b186..85beeb32f59f 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -3016,9 +3016,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: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: 8436 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp401216wru; Mon, 24 Oct 2022 04:48:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7QBkcelRRegWh+Z8d1jXx//LVXBhGNJ9CrZSQ6i+uAVoOPIWCdOk6K1vZkj0JpoI5oMWuu X-Received: by 2002:a05:6402:298b:b0:44f:20a:2db2 with SMTP id eq11-20020a056402298b00b0044f020a2db2mr30456171edb.138.1666612097239; Mon, 24 Oct 2022 04:48:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612097; cv=none; d=google.com; s=arc-20160816; b=i3cMOFgGiGREZB7TVvOMJAgRngQw/YSBcLSzqhlDdS11mLeY7Zrk9TJ1FESeVxzWUU QAXH4ihh0d2bshlP4qh2VvUv7677J7pmBFFwGHUyh3EtUfGaHTMwYQHJdVEBHowXZPOu EzkaJX336Vt7vt4MpXWfSxRrGcSiMsKe8pOBXEMWZom6Bd50b9Zd/fKxZVug3OAjXLzn rrVVzh8Z6s+D51WSOSKSqcDnL78l4ECw2RkVfgXqT9LLGhbgI5qi6on8OT1Gdix8BW18 2CWKBb4Q8fh+eqTg4ezZ3a6egPN83EIaOZdVehYbewsBPmrH6PVEzmxPcMtkQ1MsH3qL 36FQ== 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=XxyzIdVMZ1emID24GwvA5ijjuBFCS913U3TOlLOx6nM=; b=PtIdlfyFTMa6M4C+Vmlsy1aeSjeQbWShTBOazQLd/k/CfrTz93T9+4FXV7IZcXcHV/ Esfp5uGKIyIez8VeV6cm1SX/XEIGVObY0sQEQFkMTrirIWQdOKUZo6Znn/lHqctFiV7A 8u0ReeY89AaaMcZHwc5mo/4/RiXHyNgyP/x0HnldwEvaPEjh2QRutf8STJsZo6943O0W 01BgachHQ/TUL+Fi8iHcI49GBszOBZea26+gyv4g1tZfxdRiEymRTyB2T28hYzL70K2j NWoI694S4QLQR7AexlRDS7EE641x8O9RTRTnQgdSSvbAUr/BPt4dlEVW3+zJYdT9Slzs 1c0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aDwI48QV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a1709073d8e00b0078df1c345e4si29967756ejc.518.2022.10.24.04.47.53; Mon, 24 Oct 2022 04:48: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=aDwI48QV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231390AbiJXLrP (ORCPT + 99 others); Mon, 24 Oct 2022 07:47:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231438AbiJXLpQ (ORCPT ); Mon, 24 Oct 2022 07:45:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26B291275F; Mon, 24 Oct 2022 04:42: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 A922F612BE; Mon, 24 Oct 2022 11:41:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBBBAC433D6; Mon, 24 Oct 2022 11:41:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611671; bh=rG3ub0U7/cQm/WivGP8FxXmsTrG3WqKRY49hGng6RBI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aDwI48QVM4cHsDhX8hcS8Mcp45CEshqEZqDCZp1dhIreEF2z6tP1jHIgIF9L7yZzE BsrHu+IB8JSpWxi9xi5+VUfo9Q6TKhVx0hgsdO1QBDki9NXTSxbsyKjmWLBysluVZB qky9Ww6pcmOUiOlSN/0VPU6zlGl903f0M9TSiiD4= 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.9 067/159] wifi: rtl8xxxu: tighten bounds checking in rtl8xxxu_read_efuse() Date: Mon, 24 Oct 2022 13:30:21 +0200 Message-Id: <20221024112951.914160397@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569446698666457?= X-GMAIL-MSGID: =?utf-8?q?1747569446698666457?= 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 e73613b9f2f5..31e9495bb479 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:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8441 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp401424wru; Mon, 24 Oct 2022 04:48:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6PiUptELlSJJB8MZpBFlX5Rc6OZpVVy2AYp3EEodlsRgtWuYuPh2XbJCVtbBSfSeWowm4l X-Received: by 2002:a17:907:720e:b0:78e:2b59:fdf1 with SMTP id dr14-20020a170907720e00b0078e2b59fdf1mr28067648ejc.659.1666612118575; Mon, 24 Oct 2022 04:48:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612118; cv=none; d=google.com; s=arc-20160816; b=NxEOcjjznpVMYp0Csb7xSSgaQqXjsSUwJlFyLDce7NAAwGk/mkCgnBSwVjJKk5Hfnq MFBSAx6LTelsCxIeJ42wdI2MRKc1tuAPnLK3nE3nLSDaaeh+ldzDNWt270JWTviC2Pem kxJ9Cd1skN4z314+9trkmpN/cDr4dH3rGbzWXoVI2Tls9aGchdLjUP2/D8asZRnRIc2o nxeEsDFgffsgvSXoHEjujU3y6V9V8rP9P8T3Upn0WBEqxvHBIgOuttM34l6cpg3k6U11 hWi6cqtuhJvf1Qipoq7iqePwP3BviSn4qGBZfuczTlwXbg1BXSBsx1VhvJrf5xajCTOW GZmw== 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=vau55XG4AtDA/bradHiTIFS1hkZL53Ox2+1RaoOTq/Y=; b=MJopIgYSfIL7IOKAcRAe2fNLWoG6IN+XMOIsn1C5AZs0/Dlw0vBRsymzQgtQDPdtpk sEv8n8hqeS3tDA/7bwIpfOkSRVVdAsETXV2PNy6kmfljVeFRGoUiP/8yVJxOP5MqWDqf Bzn306ZaxJAONwib3u/apR2i3D6Z6VCKzzjPATVFMZhA5AjZID4WsECvnmrR6i4Bdcqh L4xIzolz8q8rsf0YTE0fOTnXanS+snlBdOUCG/jb4N4m0ivJOYo8XFmI6h2bwoNiVy+E 3ZUzC5s/gv0XxxLcsHObw7NvbUBo0jNkp4NQWALfls9hJScdUlsmMv79qIAdOnoimlCV UcUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ep3w1nA6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a1709073f0600b00787c0e9818csi32642647ejc.568.2022.10.24.04.48.14; Mon, 24 Oct 2022 04:48: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=ep3w1nA6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231713AbiJXLrg (ORCPT + 99 others); Mon, 24 Oct 2022 07:47:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231567AbiJXLqC (ORCPT ); Mon, 24 Oct 2022 07:46:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6CBF75FED; Mon, 24 Oct 2022 04:42: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 D7DE8612B1; Mon, 24 Oct 2022 11:41:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB10EC433D7; Mon, 24 Oct 2022 11:41:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611676; bh=BGNZK/cB2kFggn5itPQ393cYoDcWc44Ku6wOYLbv6xc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ep3w1nA6KEnmDNPtj1ehOionWcNcVzqUVn0aS6ZR040Uizz2hmpXQKbo3CqdeGD1X Lx+HcMq1/Yrhzu1EO/s87ttbAH6ZgUaf3vzS5YUxrThrCVGrZjuUBibfi7mO9a+52z 5im7mZrPBjFDj7oes6/uJ92Mnz9qwF7GNdtgLwRk= 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.9 068/159] spi: qup: add missing clk_disable_unprepare on error in spi_qup_resume() Date: Mon, 24 Oct 2022 13:30:22 +0200 Message-Id: <20221024112951.953277693@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569469176916439?= X-GMAIL-MSGID: =?utf-8?q?1747569469176916439?= 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 88b108e1c85f..431cb184595f 100644 --- a/drivers/spi/spi-qup.c +++ b/drivers/spi/spi-qup.c @@ -1003,14 +1003,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: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: 8708 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp423003wru; Mon, 24 Oct 2022 05:23:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Sc+Gfo3mrNEwT7HAoDdyMR/tqZMbmu9S7xMHOLTCYGMl572QUtd53IQpqjNLCrJLXTL3Q X-Received: by 2002:a05:6402:34ce:b0:45d:14c9:c522 with SMTP id w14-20020a05640234ce00b0045d14c9c522mr30248950edc.160.1666614231172; Mon, 24 Oct 2022 05:23:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614231; cv=none; d=google.com; s=arc-20160816; b=yYHzXeHPWP4Zv2j6qijaN1umdbmLw5bhxfPN7RGtoRYssXDAl/gA+fqMUXl2ECBS1+ GlmB60TnQi8CV3c78a7KVPoNEIwJkXDJDpSvaTwovgrJTO11FnFO93QXgbVKnye2K0dj c7POoCf5lsmheNMs5wFrkQwWsSX6QCo3mYThrX8W78kH8bOhLXzHm5BgjFFAgM4akFrh F3wqtq64W4LGWgE1WuXc1UkuPVvuwpNVmYJAXRmyE/YqQVmkrHUGSmBt5p2oIecAJRvv 7GcgbRScDbFy9EkFTtqfaHAB81r2dEdv6K+VfInrrtW64SGgVoc/A0LjovTzMcZHFrZm fHeg== 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=l4VMmjmMqjdYgy6yIB8Wy8uM7sYFPme4mBMOOrkOfno=; b=a6KmKR6bR6FOtEK/bfBg8rC1qNiuBjWsBylfh9ZR2zxCTOJ7qQuVJPHG7i0oHRQT6P C4UvvJ6c2yO+QRfIEN4yjer6Yy99zL2fWEyeJUYJoMRU3N1DYP/OxwvR6SMZaJjyqCFq 1SZmYkECLumkPZWbJqPu5DUeRKFNKR/2n+7HDRYq5Kqrt6UMPJmRbcCY4Z2UQIDOH7L4 GIY+5pPTutcebV399bwZYFICGmSNfSfh91J4EPTLSavcwRPDVPVgFW7hrm2OMZu+p4bI ph8NXYwCLACb0PxG+xKwm9mWGOTeeZV+j1NiNA9toatJ5PhLCwjXEGjfIODJu1FVgqQg 28Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=StokCbB0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a1709076da400b0078dd22dd569si29424463ejc.121.2022.10.24.05.23.27; Mon, 24 Oct 2022 05: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=StokCbB0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233476AbiJXMWL (ORCPT + 99 others); Mon, 24 Oct 2022 08:22:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233572AbiJXMTv (ORCPT ); Mon, 24 Oct 2022 08:19:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC7A67990A; Mon, 24 Oct 2022 04:58: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 78DE2612BC; Mon, 24 Oct 2022 11:41:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8AAB1C433D7; Mon, 24 Oct 2022 11:41:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611678; bh=TU4uPUlz2aBAo5ptSH8Omzj8EzskygPLm/0gr2snHyE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=StokCbB0kb8SQUL4H2sLUB2B8dU0ZaFi2N4+kMh7tYaih3xESn2Mme6QDnFS2pi6p 8MsaTTstD2mSZ8ehleHUSEhLbxRBjLgs2l9ids7BUFS87bpVfLfaEHK3hL4xi/+p84 k7vNDuDYbWEHO9mj4od6YDOITPR0tYOy9Q51Nzms= 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.9 069/159] spi: qup: add missing clk_disable_unprepare on error in spi_qup_pm_resume_runtime() Date: Mon, 24 Oct 2022 13:30:23 +0200 Message-Id: <20221024112951.985158304@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747571684368826173?= X-GMAIL-MSGID: =?utf-8?q?1747571684368826173?= 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 431cb184595f..bfca5f38d7b7 100644 --- a/drivers/spi/spi-qup.c +++ b/drivers/spi/spi-qup.c @@ -956,8 +956,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: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: 8425 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp400637wru; Mon, 24 Oct 2022 04:47:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM64BKNO1FC5yJyktE0oVcLWf2QRyB8L3VyGmRctH8pDnMNqleeYeD150M/V6Oq7e5DOOKXQ X-Received: by 2002:a17:907:3e95:b0:792:e5b3:5a19 with SMTP id hs21-20020a1709073e9500b00792e5b35a19mr21850272ejc.766.1666612049388; Mon, 24 Oct 2022 04:47:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612049; cv=none; d=google.com; s=arc-20160816; b=lV1z0StCiEXtSXF8Z3owMLE1Hz4uO3LSjFcFKR6IZ5Ww9PHnjCsUK/X9S4MiIkQmwj y6wKaJGXLCJJnClefDjNS5uaT135ZbyJThWSRq/IKaa/89ogTJI0VaTbIs2w1Fnp7epc D7RogtsTsyuRHoE33Fipe8YTIUY8An5Wn3A1Wy2ysLwPT82ueGnsRyBt5qlcgOL1jeqb YBgPL6NlZC5irN+G24ieKhvAYJLhUMZz0Bsv7DWmsavjTtPm5PbUG+6DfEFwYBcuT8CK 1TriIrTx/w+RV3SgEdSAA6X2akneKmMnC86MzbVJwZZSVGbxIBFqLm5FpGcu4oUHioS0 AYNw== 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=2lXJZhxDEEs6hNAfSVssNZjVKsiVJyiu7y2GNyzAMSU=; b=kBaRLFEz6rb1EZ4usf+I+q24o3QEzZNh+uuR2NYbhKKZh5AO3dnXUAnwi22NMioQau ZGsDnvBqm+4QnfZQZvdAWKeaeGQWEDqHLqHZdH5EfbxDeGanS5q/IG8/knALX6Zt03hd Fkin+3VJIksQrypqXqlBNvL7/Hsr9PgWXFSg6NvWEkkOp2lhxGsqbW0GPpe9k9K+XRzw 7wODF9BluCxDqbV0J4bq32CDn16eDkNpFmyCtgrutXdcWcRxsfE+D8/CjzUV2sH9C88+ 69HtoIw8lzatNJHVhgR+w3BZbDhw9J2RHNUSZ6axkYeHJ7OJokFamRmI0e2HB+V4EkgA JM6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2iqDxJCc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 sc41-20020a1709078a2900b0078d027ceb41si31214731ejc.857.2022.10.24.04.47.06; Mon, 24 Oct 2022 04:47: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=2iqDxJCc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231622AbiJXLqh (ORCPT + 99 others); Mon, 24 Oct 2022 07:46:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231820AbiJXLod (ORCPT ); Mon, 24 Oct 2022 07:44:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3972754A1; Mon, 24 Oct 2022 04:42: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 ams.source.kernel.org (Postfix) with ESMTPS id F2E19B81188; Mon, 24 Oct 2022 11:41:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F4B4C433D6; Mon, 24 Oct 2022 11:41:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611681; bh=BsjeOKCEr2SWKzLt9qvyOm1BnV092tyoRVicBoSzI8Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2iqDxJCc0vCoROc7TUGMJ3smsgebGTDWCqj1LgS5vOUK4Vt7WNHpWjnQHRF6ig6MJ bwd8iwrclmG+xs6cVi06gOyfIr+yBriPMOYOSCkYJRZstnicBM6t1nqwu7M9+in7/c Svsgpikt1BfutEyZbC0+luPR/haAxnsEOUSvRr+w= 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.9 070/159] wifi: rtl8xxxu: gen2: Fix mistake in path B IQ calibration Date: Mon, 24 Oct 2022 13:30:24 +0200 Message-Id: <20221024112952.016351511@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569395953098132?= X-GMAIL-MSGID: =?utf-8?q?1747569395953098132?= 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 31e9495bb479..6875ec7290bf 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: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: 8460 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp402800wru; Mon, 24 Oct 2022 04:50:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6JAgM2lPNnLeYDVrPpwrXjHbFSp6gPMtDSnn8edkSTShcs2YZi9KTdq59AXIfyfNJS7eXO X-Received: by 2002:a63:7304:0:b0:46a:faa5:700f with SMTP id o4-20020a637304000000b0046afaa5700fmr28843536pgc.253.1666612242060; Mon, 24 Oct 2022 04:50:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612242; cv=none; d=google.com; s=arc-20160816; b=BWl4qQssiKo/KWG5OGykjtkmohUozxaHpu2k7g0eEnhE3unIHXj34ZWSAuFJse6udJ ZUxijAjTes0x3ygbsh/kpHfDUVLsZItmCfCC9+N2vXw4kxPQd++p6gbTEOgtaVixKUi2 1Aljf9PcVDOqeDlPzD5jkAq9cTvdizQnIXKhp+1ZLqnMn0y+xJ32D5bd5um0xjcDm5XC R3C0U5yGsWd2BV8QSN5qOK4YLQfbUosMG4jsQdOHMRuW3CLG6x45F20jiR1v3EWONYQU FEvSQ82yVLx3Vhwtgmp4lkwcY6A15xxBH2b6+iMDpGfBWDkA+Q9dNR3n6Drdok6EKsi2 bHuQ== 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=i0Y5Q7r9iZOm1OaapVSSJllBdxSIe+INKjpuptXNuGE=; b=Kf39O5/rtXKGpKM2UbZWxrkViKq6dWgpFl19Q0jY+rYmvWB5hKjBnVnmYBMEhtFhkM bfbr9KgHHb7FFsZmMGgP7RoXiMRng4kqFX9cBLNExoZ0tZqN082qz6FOhWFvOUgHCM1a wPVarC2uSPraq8Y2BXUrlYfLhNzPfmRWuQHUm+ZDE0QlfK4ajWx003/AGNVypXvFIbVJ IkfdkyZQYNkx/w6kaRxaLerQiUee5QDfWXZXPniqGv/6XT1Fuia8zvZ/cC+i4biva8Za 6WwrlFx78CXBbv7rtdbf2eLsxyka2DlQEN3E6x5YrI8/GcDLofdB2A5pegz9vajacKaY fIMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Gw4W6SaK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 l15-20020a056a0016cf00b00563856be5a9si37814216pfc.351.2022.10.24.04.50.28; Mon, 24 Oct 2022 04:50: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=Gw4W6SaK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231812AbiJXLt7 (ORCPT + 99 others); Mon, 24 Oct 2022 07:49:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231469AbiJXLsD (ORCPT ); Mon, 24 Oct 2022 07:48:03 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBD3375498; Mon, 24 Oct 2022 04:43: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 0E7FDCE1347; Mon, 24 Oct 2022 11:41:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3213C433C1; Mon, 24 Oct 2022 11:41:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611684; bh=sqTMI2uzq+tJJsADyinqpqGIOCnAbBtqJym8Q4S4XDQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gw4W6SaKcWNLVVEsa/nFTC5CImbl4ubmYkNTNTVwANdV6rchnMns5Bs9+YBI1aNXp K3vmM9rMY/KJV1rGVn9HDpkq/zXaatQRzUgvQpmrv0BaqwdylyohE0tkqnU39CsZNd ZnDkQXQF8h26w5HZ2AjSVI/jqUc24bojIFgfHAMw= 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.9 071/159] net: fs_enet: Fix wrong check in do_pd_setup Date: Mon, 24 Oct 2022 13:30:25 +0200 Message-Id: <20221024112952.057380713@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569598412954435?= X-GMAIL-MSGID: =?utf-8?q?1747569598412954435?= 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 777beffa1e1e..7861a5025dfb 100644 --- a/drivers/net/ethernet/freescale/fs_enet/mac-fec.c +++ b/drivers/net/ethernet/freescale/fs_enet/mac-fec.c @@ -103,7 +103,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: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: 8437 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp401279wru; Mon, 24 Oct 2022 04:48:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM61pA3wG9ZibfoS4f7iS26MRDAMTM7MxJMlR6X1tYvl0oCyKTKOnrOk0i+0+QtIrcy7Nigk X-Received: by 2002:a17:907:728a:b0:78d:2b4b:e7f7 with SMTP id dt10-20020a170907728a00b0078d2b4be7f7mr26652165ejc.269.1666612103703; Mon, 24 Oct 2022 04:48:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612103; cv=none; d=google.com; s=arc-20160816; b=qyII+4O1SURDhJcyZj4TwahVpb3wCpTeqHNodx92P52YTVmo1wEyRMzboiPerOz2cl 8hvttSKE7WxZq+KdldN2pOnzzgBZtiPL57a4LRjhJZh+O5XgkDQhm8WSJ7oFYwxK1396 UfMqiXQD5Gwxz/1wOY13Eix/Z79yVN5CAau7UNHoWIljD6uBjhPkQSf++SkU91D0Gtwg RUp1NrWzNnA7HNwkNIFaptbiS3U7cs8TaopcBe71w9WjOtz1OgRdPYPlwT5M1uvQiZij wiEviUqFqfPCc/UtaEr2TKQ/udJYm9BMS4lZTnHKk56l6IyuNoP5FA1cCgFIv2ctUj/g 66Eg== 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=jEtRtel1Gs9jxAz3oWhQfflRbKJzi58viHWUquUDMLm40Sn2IasYTB1GtmjRyTxpzl B7oMgXLA5YA0Y08RH2N/t2q0iS0gdHobMg5nJ7R8b/7s00jjjQNuFXykucK/sBl6aU9R tMaLtkG4mHiXfy/5HuTAns1a1eOpvXVGw52tvnhTXFsvV34PYCLDI8DeioBjJsOdKekf nSPwPlKfqytMlBXvaKv/Cj3+lYfpAQ3MGBqschet3fT3SZD8KUvzFzpywulUUAfnwZX3 qQwM+bPCg8GRnIQilnBjmiuT/6sBFCGs3VfDlohUJZ039FFgSdFp7MkGu9rsecX5cOWr 2dPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZM6ZOvft; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 hq10-20020a1709073f0a00b0070fc7c9d71dsi29127423ejc.989.2022.10.24.04.47.59; Mon, 24 Oct 2022 04:48: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=ZM6ZOvft; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231684AbiJXLrR (ORCPT + 99 others); Mon, 24 Oct 2022 07:47:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231469AbiJXLpc (ORCPT ); Mon, 24 Oct 2022 07:45:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 136BC110D; Mon, 24 Oct 2022 04:42: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 7EF48612AC; Mon, 24 Oct 2022 11:41:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90EA8C433C1; Mon, 24 Oct 2022 11:41:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611686; bh=HCgnyLFXNJ666+RLJs53imFRVFNh+zNwO7IvWGDTFNk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZM6ZOvftI80SV9fqJBOpp2cPmsKFBC57aIUgBpMI+N73yGuCe/Ls/js/JD7yMDw+I mzbD/ltbfPo74o3f0C8Xwcac2GRBLUgyZD5kUslzioiVQxpLZymGL0oBzr1IdteExM /DoGMI936ryG6l/9HnXWfswcZ5fPF+ttolUBTRaI= 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.9 072/159] spi/omap100k:Fix PM disable depth imbalance in omap1_spi100k_probe Date: Mon, 24 Oct 2022 13:30:26 +0200 Message-Id: <20221024112952.087929715@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569453747382535?= X-GMAIL-MSGID: =?utf-8?q?1747569453747382535?= 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: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: 8613 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419964wru; Mon, 24 Oct 2022 05:17:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5QM0kJCcdUDVJJt5/Tthr1lRIhul5Xn08Nl5Wv0+jj9TJeWigVTHuzJJwryKvEXMKN+z4d X-Received: by 2002:a05:6402:3896:b0:45c:93c3:3569 with SMTP id fd22-20020a056402389600b0045c93c33569mr31220340edb.37.1666613838513; Mon, 24 Oct 2022 05:17:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613838; cv=none; d=google.com; s=arc-20160816; b=f3i7a4NRx0Wj/InqQcnVvu7/0SJtgge9SG1Tje9ZXl0KBCHZynssT5uLvjXKbtadH0 67rKsW/gsB+FTAqo10p8EjpYGm2BlWHdtFoFbf4/T8/IRhTtHM08mVuaFW7zWFsviVD7 osORl40hoepQExTRv5Xtr53QzNW61BU1Xl/SvYFnTmFT9wV9QA4MGuucG63YtQUz8RXN Bl4DFiL99hOV6FslO3f+3JjfZYI0ShTlBfK54WKjpSBcvT3ekoGRljYFPYTlpa7L0zC5 /VHanr94oSP2UY/OB35O2ZJpzSBhqk6LWtHKA4eUa2d7gSiJWzmP51I6mkxrV1jzvQ7D NcdQ== 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=KrbX/OPRqphmpftDH7BIqz93cnqMdLAmjN4ag+KsQ30=; b=UIBCgo97N9AkcuOIM0qDF01v2TmBxUF5ktdw/YwdBiX335aDukFeIH8vvA5nMW6Sd/ PQIw6F53s79LYgTR9Dp1aifqYkIAT/tcne1NIdoW8oEL1wMFb55eQ9nhTtZwI1AhhCpq agYxDo58y/Du2x7TNywV+gk8FLBvqD3SKdy086hVq3OD3ZPV22KHU3/NS9Uf9PkZOpkU 7gwJlnsgNRM+yZ1ksNQqeE9i1xdvlalhyA9peZXyncXlDJ5ly0+XQHLSXkUsERu2pVRt jmiOxlcyrTwGOItgI0rcSybuJmuPvbza0wiLvIDiQImsvmUloJ1xpRXZpaYZwgWqy/MA NytA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1P4yMeCq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 m22-20020a056402051600b0045bf7253827si24484991edv.67.2022.10.24.05.16.54; Mon, 24 Oct 2022 05:17: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=1P4yMeCq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232779AbiJXMKg (ORCPT + 99 others); Mon, 24 Oct 2022 08:10:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232892AbiJXMJH (ORCPT ); Mon, 24 Oct 2022 08:09: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 1AE5D7E30D; 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 D8592B81150; Mon, 24 Oct 2022 11:41:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35131C433C1; Mon, 24 Oct 2022 11:41:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611689; bh=4inlYOFl1eXSTajS6aRDIXXw7r7t8VLR/Qy2sCG58w8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1P4yMeCqtHXGaXwVO6HIPn3Sf+Sx/IPDN5bF9wI37FC8tcvh2ZP6Y9Ts8b93AolIX KPJnkcbU8oadLAttMdLvIMFZ6uwXwWVhgagCoGA50rpL2bvuO5J00dvBXtLARKCpqT 1+2IOXtXOqGALYCzssEn5Y8tg3YUD3/TecdZ6GWg= 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.9 073/159] mISDN: fix use-after-free bugs in l1oip timer handlers Date: Mon, 24 Oct 2022 13:30:27 +0200 Message-Id: <20221024112952.118608404@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747571272423809872?= X-GMAIL-MSGID: =?utf-8?q?1747571272423809872?= 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 661c060ada49..67d1a4762d56 100644 --- a/drivers/isdn/mISDN/l1oip.h +++ b/drivers/isdn/mISDN/l1oip.h @@ -58,6 +58,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 67c21876c35f..b77ae00a95a3 100644 --- a/drivers/isdn/mISDN/l1oip_core.c +++ b/drivers/isdn/mISDN/l1oip_core.c @@ -287,7 +287,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; @@ -619,7 +619,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 */ @@ -1246,11 +1248,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: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: 8440 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp401353wru; Mon, 24 Oct 2022 04:48:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7bWmVvmAo1R4ngjPSJAnxfjMcCmkG5Qam8NthIB696C9haeh4as4nrywNK/QXDAXpiLi4z X-Received: by 2002:a17:906:cc4a:b0:7a0:71f0:3b25 with SMTP id mm10-20020a170906cc4a00b007a071f03b25mr10511171ejb.595.1666612111918; Mon, 24 Oct 2022 04:48:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612111; cv=none; d=google.com; s=arc-20160816; b=Ipey1Vi4Firci1Bf7xzCZRM5tX1gS8gvHT3lS8xXUe2/3irthOJLUgDdRWaYMh17uo 2fGOxQJLVtNc6WNgotBjPMKz7ckdMdS0hgw+zeOGj3vRKOCVy3Mc0aC3PHoq8pYysH/t L2b1CguOruWDXmrr9eNJ/UqT+KTSdX24ckKr1OWlP8moUPzd5EGqrz/AP7FS3lRV2XaV TqnJSsDFJyNKiyWtHz/7dWiLzVZsh8sFhV2ZaHKAmADVLhCXuaBJDzXeaLB9NCCg7RT8 qoRa160MPeotsN4vFQxAF9tiJ4ryqpv1ioVU+oY3zcTzqepf8RuyzeEztjxoXNsarnCn cdLQ== 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=v1E+enEkIFN6Ygt4KGa+byFZTBOq1pD6jStkq7BEysw=; b=NLjGW6P7GXXAzaKihJn9tuurPF1cOiaoODKJx3SRe2SGdT4KamuvtgP9OchkKCzQQq E3MYnJGZjQrM8Ii1ivtXXha2WMKQJnQ+5O6k+zfsqO3WPeXFBHBV3MePltmzjPNsVZuy tL4MbBlAVSWD4OxUtIU6Ze4hJiBY0eacM2AhJdrk/L9vjeML/FJJpm+NRTepInw3N0Mg Arz+Fm9g9SVQVdAAWO8NoRr+4OtaMAuBD87J0dariNw5kEKdBl4urNcBGDI8EdevHzMr j3sl1xRA4gyHfJKwOQqzTnGMp6DMZOEqjgc+kA/tubKuvcgDeR7CNLWdaCUnEC/+c5En n1nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=L10FjKBK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 gs9-20020a170906f18900b0078dd7383ed8si23434730ejb.414.2022.10.24.04.48.07; Mon, 24 Oct 2022 04:48: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=L10FjKBK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231702AbiJXLre (ORCPT + 99 others); Mon, 24 Oct 2022 07:47:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231562AbiJXLqB (ORCPT ); Mon, 24 Oct 2022 07:46:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38FBC1B1DE; Mon, 24 Oct 2022 04:42: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 dfw.source.kernel.org (Postfix) with ESMTPS id BDB416125D; Mon, 24 Oct 2022 11:41:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0281C433D6; Mon, 24 Oct 2022 11:41:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611692; bh=qFP/1AGhh3EvAjHB4UAmxxcGINEmziLSlaPQu4au/f8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L10FjKBKxTMYeYqqjwYwbnMpndHv2fdqBr6Mqm+I7it1MrTWZkXb4PPr9cY212Cqm 1EDgdvXLNxUPg69L8PBqcWTDlHhCC7GkEONH2c2JUbrZh9ovoYs0T7LdbnTL9qPtMP tpkBzkdQnx48uhJldi8l6mUwK1+DQdHMIfei1bws= 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.9 074/159] tcp: fix tcp_cwnd_validate() to not forget is_cwnd_limited Date: Mon, 24 Oct 2022 13:30:28 +0200 Message-Id: <20221024112952.148211552@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569462072075827?= X-GMAIL-MSGID: =?utf-8?q?1747569462072075827?= 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 53eb9fecd263..e3e59a0ee16f 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h @@ -249,7 +249,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 164dc4f04d0f..80ef46dd4930 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -1155,11 +1155,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 6dfb964e1ad8..7a75eb177878 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -2299,6 +2299,8 @@ int tcp_disconnect(struct sock *sk, int flags) tp->packets_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 49061c3fc218..1acf67f0d3cf 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -1530,15 +1530,20 @@ static void tcp_cwnd_validate(struct sock *sk, bool is_cwnd_limited) { 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: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: 8488 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp403734wru; Mon, 24 Oct 2022 04:53:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4jrW0tHBUvov/Ly4qxqaZNSVASUBW7Uw58PUVhDjmO2SIAGTF7dsA2SA1OBwQ/OUPtui+K X-Received: by 2002:a17:90a:c24a:b0:213:13aa:3e2a with SMTP id d10-20020a17090ac24a00b0021313aa3e2amr4910345pjx.107.1666612390241; Mon, 24 Oct 2022 04:53:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612390; cv=none; d=google.com; s=arc-20160816; b=DPgtfVEfCq8TYpi5+ngff7Ej6N7pxDCJGJQO9U8ZBzzikWrkgvx8hbd7K0ckp4BOem BXLfM6GD5eq9DsW6AtiRNklB6m3qs574cIyKRb+IH+to3j/sQJII2J/OTXMVcx/fIJQq C8R5wKNm7i3VzuVuUHfBrHjmeXKKo/J5h0KhWIEnsCTpuVlfyNgKR8ndw2yG305FJBTc /1wcBPDeKfSk+iksOxLyGyENxg8kzWIQka6GAI4ad9b56uG06t3ceQgppOF8Rz8lYbms hK00y2PxT8rVzWj/BjdzLXmDkdrhA+abEfNvBHE8utFhHW5nG+Jl458DN8ModPHC9fBc kQEw== 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=6xjdksYVDOjZQMooDGWN07YoZT6IvePNB7jNY1ttePQ=; b=nOzpOIdehLa40I3W1TRlthqglmz1Esh4DLlsx9GFqiYUym2IIqTEJ4PsV1103FSyd4 85EDP04mnFU6lIzKgcpUwo3EdM+kJHs5KZ0C/T4e4z55ams5TcqfRo3Svx4qzc0CslQO aLPIeMPrudNu2P/Djl9fg3zC6uhoh3ktuz0eYxeljJX6kjD4c/Uzn0nFDZvrPO9aDdjG LPYRk60445T/lgot0iW71kQo+xNNR/0dgxnXwUn8LBs/olEg8MjP1LnvohrONq2B18T/ Vyoq/yQfq/mOfFitfyVf1bVdVEX+oFyuhTTkVqRZRbs7ex7E34TByRcU30/MqVdJzHWd /YLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NbwJnMEh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 mw10-20020a17090b4d0a00b00212e8cd5603si9001564pjb.114.2022.10.24.04.52.57; Mon, 24 Oct 2022 04:53: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=NbwJnMEh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232046AbiJXLw3 (ORCPT + 99 others); Mon, 24 Oct 2022 07:52:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231958AbiJXLvW (ORCPT ); Mon, 24 Oct 2022 07:51: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 20AA895AD; Mon, 24 Oct 2022 04:44: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 69F4561299; Mon, 24 Oct 2022 11:41:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8056AC433C1; Mon, 24 Oct 2022 11:41:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611694; bh=3+L8y4kFkn5/a3qQItXo/7vXBpgyjQqn0qkPphBHUe4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NbwJnMEhbNFGV1bSbKSfnku34oFyuNPXA0Fd6zPGwREhMhIFCQ45UlqaErJ4V3OvQ Z4Kw8al+r8I5zVZIbX+ZRaBc0rVTGWNnfkl3x4dtXt1rXHIDn7Xxuohz9pMkiwFnkd QNQjIoTAUoGzV3Fg6UGvEsgECvxfAd8SB/jnFdcg= 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.9 075/159] net: rds: dont hold sock lock when cancelling work from rds_tcp_reset_callbacks() Date: Mon, 24 Oct 2022 13:30:29 +0200 Message-Id: <20221024112952.179418878@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569753715379579?= X-GMAIL-MSGID: =?utf-8?q?1747569753715379579?= 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 192f932bce0d..d7c9576a1148 100644 --- a/net/rds/tcp.c +++ b/net/rds/tcp.c @@ -165,10 +165,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: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: 8489 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp403762wru; Mon, 24 Oct 2022 04:53:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Q0LddZNjBIHMoF07b8KIZ0cU85Gjw7ZP159ZxK2VxTqp0f4Ib6JiVpQOLGEpHlU9CUU/O X-Received: by 2002:a17:90b:4ac1:b0:20a:de32:3650 with SMTP id mh1-20020a17090b4ac100b0020ade323650mr72375185pjb.142.1666612384758; Mon, 24 Oct 2022 04:53:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612384; cv=none; d=google.com; s=arc-20160816; b=FHHk6hv9vVsNgpJ67Bf/B2eC1hSpvKjgsncLe/CZ01wjl41eXq6ySJTZM1kMYdbdX3 a0apBG8rSMiH62bwmX5ORTwbCtbqbgCI/bpHzqZGEsxtUficd1KAAfU/IILMWAjhIen3 qQ171PqzdB1GOIlE16v+EktVE5vfw4v5sxLIv/ugImvJAQ89brWzxtpuMTTF7p4BuxuW i4xEpilI3iEfAnovAY2pyVUR7KdbLrqpaZQf8fC7gWc2ZfvlECFxtIY3serou3l/8zev 12gR1tIaWq6b4QgNKzt+GtUg9NAVo0EVK6fxiGY+UHd8m0QKmIKooFTzi+YxUJG3ttaV +3EA== 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=dWVHjvEuc9j+T3D7oeXi7KXDPT+StQOcMW2g+lAAoSU=; b=ouBSKtNQqLEZZuQfjwKtA4iGfzacs5YGxKVW+q277BWMnN1P1jHO4Pv75byXqF1q7X 7qKFTKA6E31KlpCFGk2sll5BYfPUwZxkI/xz5QqUFD/fd7Lvv/QRgAERDHgKXl7zU730 kPBzJ0vy/hV7I9iSiAP4DwBf+5lF63zk5kvE+aXB8iU22XDdllbpfaNMbvQKOkZyT1ya ScjRkzYBmSkzg+H9eNb5HvVXk0USnOYJ1yT6gZtJasTNK06Avv6+L9ZIgLnk9EIq74mv R87R/RyPx6IfzVP/bARo1U7N53CQCZb8jOsHg17vdprvyhwN7F6v01VFKUMShKla0qL9 G3cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NvhLSXd2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020aa7948e000000b0056bb75c96d6si4832666pfk.227.2022.10.24.04.52.52; Mon, 24 Oct 2022 04:53: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=NvhLSXd2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231956AbiJXLwU (ORCPT + 99 others); Mon, 24 Oct 2022 07:52:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231880AbiJXLuq (ORCPT ); Mon, 24 Oct 2022 07:50: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 6B2122650; Mon, 24 Oct 2022 04:44: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 dfw.source.kernel.org (Postfix) with ESMTPS id 16FA6612B2; Mon, 24 Oct 2022 11:41:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23935C433D6; Mon, 24 Oct 2022 11:41:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611697; bh=urVshrq1xpz6FUZBSiBKF+RgEbQE/zAnNEppqo9COak=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NvhLSXd2dHNQCPDPMUYW9IOmkKlMAsYKpsAqA4FjcMtJg/H4COVDsAJrqZVB3TVV6 syAXvNAMFSbe30SfrvfFOZhz0sqfZGG9AdOrAln7175BG9CAprvxAO+aoeh4MQjt2N Xy/ZhHpCepDIra3s7K6eiISNHE4ZHQbG+uSakED4= 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.9 076/159] bnx2x: fix potential memory leak in bnx2x_tpa_stop() Date: Mon, 24 Oct 2022 13:30:30 +0200 Message-Id: <20221024112952.209197866@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569747631003593?= X-GMAIL-MSGID: =?utf-8?q?1747569747631003593?= 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 9d7f491931ce..36108b26d804 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c @@ -792,6 +792,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: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: 8438 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp401287wru; Mon, 24 Oct 2022 04:48:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7umwaxxBorfTaILnF95b1YyrWSjXd5VVgOSqZyEDZ98guAZMtQfXiBtF35Z5uPmAde5mHu X-Received: by 2002:a17:907:94c3:b0:78e:2866:f89f with SMTP id dn3-20020a17090794c300b0078e2866f89fmr26591051ejc.617.1666612104916; Mon, 24 Oct 2022 04:48:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612104; cv=none; d=google.com; s=arc-20160816; b=r3hvg0ZgVv9Se4Pfle91PbkmmogaiGAus+Gq7iwUSPFf0pKRHy1HqIBrn2SQhNXP4B t38rnC7iE+PCkTEBrLtwa2u45og/vbJfUoUyPB33bZsRZTsQOZH9EgAx6tB3lM/NsiBV GEbMAxtBIpvd3cLCvM7oFxHgvm2+xsCyiUhueNFH8QYl4m3jL+nczQXTdT0Y5q/xZht1 5dmRUTjfJXCLba0wNMvMCbI1Z07VzjkDY3k8hxtyW8gCirjXyRBC984NhYBjDPYR3sCE g2y+7N9EOi7Nbfds+wUUttjK+p0wqsiOyyruUegJnbzW3u1osqQVhWWvUtnzahSZPWM3 EVLA== 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=+F7npxiqhbpybcmHRqSAkOpBDwU/ymBdhoHhCjG2ma0=; b=BulapTnQR/FwSm0b4Ab318FhkHsOr6CXPuvy61v8fAxtfAHS3plINShQulTBXU/142 LHuDxkXwQVTxTiKKghqQaYRvz5MYmUZK4RtgrwckP2EyMphBe0evHglXXg4YmcPXzstr MhGcgKI/Bwxu4pANPI9IJNiFkqdGf+yHpOdibUdKDglTLoM3qUV1zasUmnS6oCIXYnW+ L9i4mChiI5yqCCg9M6A5zsJhDummGTwXtRpxsyC9smt+FpjdHo+Er6F5ZOuP0QMGlFTb PAIT2pwpV08qgF788JirpIJiKjKnYFzCU8mn0pQaAcTOoIAf7oFuoiQ6/M10GyoyBwN4 IHNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Bl5D71Ml; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a05640234d000b00459c73bd1c6si31128587edc.550.2022.10.24.04.48.01; Mon, 24 Oct 2022 04:48: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=Bl5D71Ml; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231690AbiJXLrY (ORCPT + 99 others); Mon, 24 Oct 2022 07:47:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231494AbiJXLpn (ORCPT ); Mon, 24 Oct 2022 07:45:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38BF31B1DC; Mon, 24 Oct 2022 04:42: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 dfw.source.kernel.org (Postfix) with ESMTPS id A100B612A0; Mon, 24 Oct 2022 11:41:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3D51C433D6; Mon, 24 Oct 2022 11:41:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611700; bh=HO5/Zmu9y+TNgQd34E0TWbyRFfogGohcSa82D9Hg1QE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bl5D71MlfOFf7/rNhLAlqccCSFIfBy6wngI2QJYMITGH6Eg4qwyX27hp0q8k8uzIO fZD2q042Kekhzjnh20Cbb5lTOQ0+gCnS6e9rISbXslECANZY4fo7Yt5nQzSQOiyY88 5agPgUFxxQyvdRKHDGo2fSXD2jBJ6hyM6zsVmuzI= 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.9 077/159] drm/mipi-dsi: Detach devices when removing the host Date: Mon, 24 Oct 2022 13:30:31 +0200 Message-Id: <20221024112952.247642767@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569454379135359?= X-GMAIL-MSGID: =?utf-8?q?1747569454379135359?= 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 99415808e9f9..af80cf8030b8 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: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: 8432 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp400966wru; Mon, 24 Oct 2022 04:47:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6hKTeY4dsNYsKAX1EznXdWkpPg3VHk0ZjSXk/yrE8zAb1xOR9vyvaFAnlC5BO4qtPKFKI7 X-Received: by 2002:a05:6402:194d:b0:461:8982:52b8 with SMTP id f13-20020a056402194d00b00461898252b8mr9261124edz.49.1666612078958; Mon, 24 Oct 2022 04:47:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612078; cv=none; d=google.com; s=arc-20160816; b=EVP6b+/+4FY0CqYTF/Gq+MIGBMt+QqHV8CLCMG4SDiTQMVqWqUjje3Zjvbmww20c1P gC981B5tL3Ls6T19iqqKo6gCF8HenKHwHLXm7dmCxJMsXoSWoWA6BzMa57fGhm0tCacd yB/nXpQSQmF4AIrbh4/ImmIjdzoIeopxPrXhoD435Tw8K5G+iGDVDPko/rsWibPrAZ68 KSfNuPPxjpB6DbsLZ4NbauJP9xmStmry9byhMwQVm1hRXHG9MUomuzHvTX344p1o18sU 4hU5uRpQNGB7jR923SaTML2yO8hJ9UpAvEy1U6SyB1qqeQ8m/MyqTYWJkvH1VK9oIjSh KtzA== 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=aOlNTta+M3HaDSe13gsWYSv6zoc9lJohil0oIgqayCI=; b=a6kBAEYVVx2zhWuzHiC8Ipbi6wHc4rGmK8qIqjZNOU8xr6NbGKRjGKVws2h0gQuWiq TYL5zezi10ML5IlOCU/mXF3ZIpAbQ+EDsb3PV8Kk7bPpB64gIOzLFPie2lS3A9Q7OPxZ H3EmCWVj2rmWrd8QeZAJYFXddmxug2diQ4Du3znbswWElvbvpM0+D/TvxOSZGAdJIw5g rH1utlnKCiK7+FybkFnxbrJcmCw6MqopiPwCUYEltboHiy6JcGlDK+oEooECpYbAyy3M qBeERgBe/znG/1KPWpcM1exC7OlVuCmdnUISik9FqKwy1aDF5HZeKlslg9ge3LBua6IX kLfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yO7jJeJl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 q6-20020a056402518600b00461ac01753fsi4390391edd.369.2022.10.24.04.47.35; Mon, 24 Oct 2022 04:47: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=yO7jJeJl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231217AbiJXLq7 (ORCPT + 99 others); Mon, 24 Oct 2022 07:46:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231266AbiJXLoz (ORCPT ); Mon, 24 Oct 2022 07:44: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 17C9E3B1; Mon, 24 Oct 2022 04:42: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 89DCDB81134; Mon, 24 Oct 2022 11:41:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E407BC433D6; Mon, 24 Oct 2022 11:41:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611705; bh=qazdIVwjniIPBxsCL1PrgzDj+HxpC6llmoILXcDM3WY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yO7jJeJlxdhIfVkS4hfXm3wKkSn1KnV4gT4aYhyloAd3kvFcoawNcHBC1kZT8Kx9j 7GNK4OkREIvBPDebsgtxrHvBxOr/AwvJA2B+PRVmQbB9Batf0Vu5dcZ8dkgTC6Nlcw HVoOYDaTdfRr2nBUSy66rFREQSATFgSvpADvFyGg= 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.9 078/159] platform/x86: msi-laptop: Fix old-ec check for backlight registering Date: Mon, 24 Oct 2022 13:30:32 +0200 Message-Id: <20221024112952.291810297@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569427372162296?= X-GMAIL-MSGID: =?utf-8?q?1747569427372162296?= 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 42317704629d..c2a1bc8e9fef 100644 --- a/drivers/platform/x86/msi-laptop.c +++ b/drivers/platform/x86/msi-laptop.c @@ -1069,8 +1069,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: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: 8620 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp420222wru; Mon, 24 Oct 2022 05:17:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM61miipiZia6VvMlakztGUCY2/RmPZ7/PEv8YUnGrQuUCDSzRcuT+QLFONuGQPqaDuFo3WM X-Received: by 2002:aa7:8011:0:b0:567:70cc:5b78 with SMTP id j17-20020aa78011000000b0056770cc5b78mr29208882pfi.29.1666613868342; Mon, 24 Oct 2022 05:17:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613868; cv=none; d=google.com; s=arc-20160816; b=aGE8XEYObXGfXhLYQN7qja47beyFVJ4WEArGUUpPzzmEMiOIt4lAvMdHdZGz9Ehd9M /9G5/O2Iy9podQREob9VvjnzZzKDDVXduSSCZ/lPaB+G4f7I8bGtdcDNiwIDml9Ry81O T1sWCLj9Su0ird7sJMDPOZY9rDLRQ31J7yK6ilFZ+diczE/uF2EEKP6w4r0GUBW5ULrv 0WRJ3sVFsHFzLqpdq5kReg/sVnieCvYOxXwfbZNXwbCWWmNyqhq0HOgdTWki0hWxS+PC 9auuCYkSv/5FnrNxYyemZ2/Lw5sGW0MwvSTAPNqNU5JVyLHzJvsy+QrorDAkz/hc5G3Y Gj4Q== 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=vtVOmdLDyRxK7X1zu4qebk44PKpjmvKgTvgy0B++yrminvSMqvDmgfo59VsvFNXf86 MOGnL7nmgLq4uOHCvkCHmgyHvXbBfk/1HNqiMaFGzlO7+tb9CFzEw5a8+Z/7lx1bSLil fPY3LOk6wHaSSOfs/D28Jyt4gOT3Sj83fxTQVIdiTa0galwnAbizp4Sq4FzJl6dQKjEv Ds0s8TtqRghIh+lMakUGoAV+2IDWhvz5iWS9zS0j2xRWKPWMVhgORzWMdK+mUdLxwdk3 yOKRtTAhp00BGvSEqGdieNE0ZFegodrIUAWO1dk1PgQ6A9Kg/zrvlhYlkR/3hsq4qgAZ +j0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WvxwOccx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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.17.35; Mon, 24 Oct 2022 05:17: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=WvxwOccx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230180AbiJXML3 (ORCPT + 99 others); Mon, 24 Oct 2022 08:11:29 -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 S233224AbiJXMKA (ORCPT ); Mon, 24 Oct 2022 08:10: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 E74408048B; Mon, 24 Oct 2022 04:53: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 6B8E4612A5; Mon, 24 Oct 2022 11:41:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B01CC433C1; Mon, 24 Oct 2022 11:41:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611707; bh=0uWZkCQZvSSzBLwJUw8HecZ+r/KnHBzmlr7A/oiemN8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WvxwOccx9LgSIeKXzrCOTOUd8IWGcHiLo68I2CWRqd95FDht2qRgvhuMm+eP3StH9 6mDtXi5i4oJoLYfQB8ysx/W4X8/Z9QZW35Vc1Z69w5FRKpS7aZfAzn1+Jp+lnpLP7f FHOogEP9B6nbgr8QyWszUGbS1FYgKztulLdG1QA8= 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.9 079/159] mmc: au1xmmc: Fix an error handling path in au1xmmc_probe() Date: Mon, 24 Oct 2022 13:30:33 +0200 Message-Id: <20221024112952.321846081@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747571303720265560?= X-GMAIL-MSGID: =?utf-8?q?1747571303720265560?= 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: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: 8475 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp403344wru; Mon, 24 Oct 2022 04:51:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6A9+8SByR1iuY/wiSDlfypAAiXl/45uo+K2/zV3FwDx7PQSKafEqizza7kW/sWVswSZVSv X-Received: by 2002:a17:903:258b:b0:186:8bb2:de32 with SMTP id jb11-20020a170903258b00b001868bb2de32mr11733186plb.63.1666612315922; Mon, 24 Oct 2022 04:51:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612315; cv=none; d=google.com; s=arc-20160816; b=dw4GT6W27Tdj4mhZN9Cd6rbKd/aGHG/Xvz5BHDEXzFJ1b2L8V5vNAg2ZgPWb6UbND5 uArvEFX0uvt698CWeZt9ODtQ2lMw6oe++CND04uOIpMK/CbCK3pFayZ+t+YP13Irk5C8 ouJpV3/YP4d9jmpL8rZo4D4mQ++FVcXmlTgmO4jVeHiDy08Zw1o/9TCMPRwmziZgpzvS dZ6M5a1wzDSCqVlzPYCv+OMczxpgGQWcukCtxv3FoO/fEXQJoqV8X07PCCDKQQFalXgY xT/SKappeKsWr6zw/+/tmE5fhJCI931dh6R6deNyS43xA9kbXjyZJLpsHclf9yW7T1TT eupw== 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=R9d+ZXhPD+95EHWUXoGMbH3w6QAxpRKEu+f2dcUdcAA=; b=Ikv0MfQ2bCyGGuRM/loVV52uMWsyBUzS92+jQvtl901IrJ06n5OXk4l9zE07MF9vmF wjFAVvBtzOxIsAl6+/uSjGYYuvXoB+c5e+fUdTApKKPRqOLBeV15/EQ0HdGApGoUJdKy 9pb5X32XPsPNrFnsmeh08G7llZFx3Z9mUYwbLWNyPJZv1J0r3RTFQKsS7S9zuxu/MH0I a7Oo5gkOvP3E/m7J61jt2nRhyFpKTVwylEIv9dnS7rWImvvO5oh2njDtTVs9QU6LKZPl x/xChaVhV0IyfwT+eBm2W8lWd2H8gyn+5IfPlb7beBUA2qUGzZZYzeCWIH4OgbxBcgXf Ad+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=F0KkNXYF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 w12-20020a056a0014cc00b0056befaa95a1si1939037pfu.50.2022.10.24.04.51.43; Mon, 24 Oct 2022 04:51: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=F0KkNXYF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230250AbiJXLvF (ORCPT + 99 others); Mon, 24 Oct 2022 07:51:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231913AbiJXLtN (ORCPT ); Mon, 24 Oct 2022 07:49:13 -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 140D36D877; Mon, 24 Oct 2022 04:43: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 CF9DDB81185; Mon, 24 Oct 2022 11:43:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3980FC433D6; Mon, 24 Oct 2022 11:43:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611812; bh=5dRIdOu21Z2t660M+e7TugsnjlgCx4ggxlqHzOl1Bis=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F0KkNXYFpoKiCUe8H1At6qUzcJB61OdbJ0l9THcv/8dOtRnYkuQn/C4G9R11LoqqK 5zrhxbrjdmo0ZtFTGLXPNiIaiuv91+gyDDvuaCivTxbeNvhkybRrTTeRpAnCwpPDiO L8v+oJ6LhgHtYtlaK2wEECwBDVDQkN/8r2K6Y0aM= 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.9 080/159] ASoC: eureka-tlv320: Hold reference returned from of_find_xxx API Date: Mon, 24 Oct 2022 13:30:34 +0200 Message-Id: <20221024112952.351647448@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569675981523975?= X-GMAIL-MSGID: =?utf-8?q?1747569675981523975?= 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 38132143b7d5..10da7fd2d054 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: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: 8619 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp420201wru; Mon, 24 Oct 2022 05:17:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5lUowZ3V0J3zNrKfzwETX1MYMRb/TBUcQuhaaKPsjpSkQADM+1J3ei4euTLMm/ln72DnR8 X-Received: by 2002:a17:906:401:b0:73d:af73:b78 with SMTP id d1-20020a170906040100b0073daf730b78mr27937181eja.122.1666613866061; Mon, 24 Oct 2022 05:17:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613866; cv=none; d=google.com; s=arc-20160816; b=NJ+BLSmDRb1kTutQgoUrIhb1zpH3rOvcQ7P1rRecfrpMc8qStU4Y0fEmSvuTRJeFee 60VZzTdjMqw9OTLHf8/RiHTVOXgQ9RaTVZoNduHp2igcrVc7H8hXUiEqYzIjnLMPJEfA pO3UbAyHQqc/sq7Ti1uMmzn8kfDxyy2OPpWkvHj881BE+5tDtaF+TuJ9xehB+FZO6tda RD453aWv3DlU+VpVyOvOQm1uR464SFAER8GK4nmnRbiURZbsznqBnjYrlkS0xSRc3eKE b3Ld9vZj0d1xdAMBX+YpNM8KJylO3DXnuYSHplSo9P5I7KIKzsp6u9nBwFXcdxIBCpBd ArSw== 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=HXxoA1nvlUwjt2oUgYIR5LRTP65iKWVnnCEvTOtLrYGEawtKnTf/ugLw9fK2wRY79F QGBxWe38QVAMbLL3LR3DkvD/U5C0Ed3tNbSUXAfneEBO0PWKSVuGkD+H/5S6TOLtgSiH oDlGiJunRY54VjXuNs+RNMoSaizAXQLqOiXO0fQ4Gvtg7Rkluw7KUTB76N96Rh+32OJH EOvpW6fRdO8cbBGja3fWvPx5kVoCSh2t9Ngzr/DUsxx9mAOxTURmjBEOjzgQG/auOrW3 B/N+iR+wBKgySo7DjrNn3fZtw4XZ9cocYQare1eIGTC53Pw9KU6vzzF+oO8eXN65SnRs T5TA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=REMtXv2z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 z20-20020a05640240d400b0045807f73ad5si3779739edb.570.2022.10.24.05.17.22; Mon, 24 Oct 2022 05:17: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=REMtXv2z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232797AbiJXMKk (ORCPT + 99 others); Mon, 24 Oct 2022 08:10:40 -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 S232929AbiJXMJM (ORCPT ); Mon, 24 Oct 2022 08:09: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 792D27F127; Mon, 24 Oct 2022 04:52: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 1B82EB81186; Mon, 24 Oct 2022 11:42:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6572DC43470; Mon, 24 Oct 2022 11:42:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611728; bh=bZwGPZDTogpLUxzxQ5yHMwfGBVlcNdR2myoMTG7FLZA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=REMtXv2zBbpO2bzvCRjMN0pPoFWnE9s11ctN5z+5Rr1FdWlVIwjHnQ5FTmDpBstu8 plG8mKpWDse6M3map0RW6zyw37ysRYh4bYmBqXihP7MfyoY8/tRKu6akXXqdTtMyuA m0/kpK3UtYTrtNuKM8xPYlJT7BkCFObEASKYXRNQ= 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.9 081/159] ALSA: dmaengine: increment buffer pointer atomically Date: Mon, 24 Oct 2022 13:30:35 +0200 Message-Id: <20221024112952.390218748@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747571301511230753?= X-GMAIL-MSGID: =?utf-8?q?1747571301511230753?= 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: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: 8909 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp434217wru; Mon, 24 Oct 2022 05:51:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5co/4DnfisnftK148wBXSZgBEd7cIr7UTQh1h1ZK8L6R9zFFiogTNx5lbJDPwu003Qks2E X-Received: by 2002:a17:907:a425:b0:78d:b3ce:1e43 with SMTP id sg37-20020a170907a42500b0078db3ce1e43mr27059860ejc.95.1666615901634; Mon, 24 Oct 2022 05:51:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615901; cv=none; d=google.com; s=arc-20160816; b=GfAbUdp8k6UDhtVepHOWkXYe5pD2k6YL3nJcnJuHlioPidway8vam0wsDZlhCXwmRp HLnqoCNGUPlQbWHkWLV/upQ/t6weHZrkWD81OxMhl7qjsnGQ5nFPhAyV7Iu4ts6LbwAH kD7td9QX3ioID32mX+VjKspUvva9ln09hg9LSKxqI73Eb3/3RfcWVLGeJN27STDiqWWz VAJjuE0e5rkwhCv9BDypoo9EjIKfs//IWqtE24tYENmp/dszAEzBMwWz302gY8FyZ4c3 MuoGDYP+gh7w3/Sh0vpO/fXwhN8KEAaQ4vKd1h4T/0/2e1emKbqJGYdsHdvCj1hmwQFb 7Hsw== 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=w9QJsvoBV1DXMzRnbFQip0hXgSOXCUDtag1s0npJAn/iiR8pNztvBpbblvKCq3nNAW 3sFsnM55eB2TdhNSHZ9A6zlmrk5Py7GAOkG/CahXGrmFtQEvDVLYxyRJlwpHYXepc5bA aGSfDkFvQKeVlHti2KDos4laFZyMdwR0ftuIWM83UosyNTmfSRVlpzpQR8omgiO4/cDB /nRQEDn2R8MnoWaosnzOw6O7vJQnRZoDThOxjIYY0J/mpVEsjdifPuURiWId9MHTwiYu /0OZhldmilpgNWqkgTAuh2B+fuusoijQD/xsN1/TinLqmUNMXRgmHHNpIm/LDtWVZYJv WNow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=P7bp++73; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 q25-20020a056402249900b00460f0c0c565si11917367eda.197.2022.10.24.05.51.08; Mon, 24 Oct 2022 05:51: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=P7bp++73; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234616AbiJXMtK (ORCPT + 99 others); Mon, 24 Oct 2022 08:49:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234403AbiJXMop (ORCPT ); Mon, 24 Oct 2022 08:44:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E15958D0F6; 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 36795612A3; Mon, 24 Oct 2022 11:42:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CF59C433D6; Mon, 24 Oct 2022 11:42:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611757; bh=EEFNLSb8iNcOZyiCRkJW9dNUJ383IzbjdI0YY57GVjc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P7bp++73voKOFI7GKENBJwVlGUDzdTpBv1McVWEUAGQSW6ZLkkxeJxMiw8ZCTIQQ2 Isxp2+pwlqhOzFEcHywZvz4Z+1awPiJZ9fCSjSSD1YdI1qSPuAIl87nkppWXlNWjVh dxuIqOa8cH3VlLb3Hwg7MXopkDmLFbFWy4BgQ+7Q= 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.9 082/159] memory: of: Fix refcount leak bug in of_get_ddr_timings() Date: Mon, 24 Oct 2022 13:30:36 +0200 Message-Id: <20221024112952.419317221@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747573435216609071?= X-GMAIL-MSGID: =?utf-8?q?1747573435216609071?= 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: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: 8491 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp403807wru; Mon, 24 Oct 2022 04:53:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM65eKGtaWqmzWXKyYB8f4AQyZZm5lyV1jrntLDj6Ukkf9WULXaWgdwM1PLXI9ghDLfh3hK1 X-Received: by 2002:a17:902:bd45:b0:186:9efb:71fe with SMTP id b5-20020a170902bd4500b001869efb71femr7229905plx.128.1666612405693; Mon, 24 Oct 2022 04:53:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612405; cv=none; d=google.com; s=arc-20160816; b=kz0Sd9bv6YeOwJihb9139/nCUsHhPsYjQlq1khX3k9JZhuJO6RfeY15O7seqnqu50W SF7CgaRfC87PWMBr6qjRiUMYMXepuISopfGy/Wo76lKI/Akli0SzGOprPF22wh2ZnoWx TT4SD3mbAQkdw2Klu5ZrHxxeR+QtD+KEF0Ht0yJDuMWTGWRitI3bLsO2SvGgchI+QT1Y gJ1tNa//uUwq3zikIHI89baysDJVaNzmqGUujB0TNScITOf/MAzveS/AsEn63VwqganQ bKIWseXF6mYKNP5hwZUdjL5GArFTsQcK2PpXQfbgGyahAr/wYEDZQfammnQetEwkgjzq tj1w== 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=K4+VndfIWmggfbtbdKj/IiplDjs0HJZUmty7SKKJxJI=; b=P5kHBj7GFQjy+PFqLrQI/DtYXr710u1CP5HdTX5znTQtBXcSXp7d1JXlALnEaok3u7 XMN7nnoZz9rXurk8m+sFOHXxD9AetgMnKWCA5r5vJNgWG3cT1WDtlFzcoaiIR/X2ieo8 cvH35SH1dRs+iMkZlFENaEGBs6kENRn01YP/Zg/0Sc6Qtrd5CNMNa/FoSarjnR6CiNHa A8ncuiJy6KmxD37AQQG51BggMbC4PVL2MGCDVC258DjTY/E5OSozseJ95DbzoykZFaNQ TkFKqfAS470js2NLEOQC8AkZfEJFegzepHxDe09NJD/b4GzcXYO7a/3HbtkbLtjSF7ZV a4mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=i3cI1W+8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 n5-20020aa79845000000b0053bafb8e916si32672820pfq.162.2022.10.24.04.53.13; Mon, 24 Oct 2022 04:53: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=i3cI1W+8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231969AbiJXLw7 (ORCPT + 99 others); Mon, 24 Oct 2022 07:52:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231922AbiJXLwO (ORCPT ); Mon, 24 Oct 2022 07:52:14 -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 1EB8C193CC; Mon, 24 Oct 2022 04:44: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 06D6461254; Mon, 24 Oct 2022 11:43:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A4C6C433C1; Mon, 24 Oct 2022 11:43:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611786; bh=+Ub/dlT9bc0ho4n4CTPaoj1vtKAy4tRTp1Z1r8ySh94=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i3cI1W+8+MacI7D8XIHvCV6w/IPmcuOy6YqbV2sSA7/w8Uwq/mw6Nw8Dk1c2rsTin jp2OpRk2a9L11Wzl/Qha0QSDBSMkzHV7dNddP1co6fAWQPF6gqpMA078hFokVipIfu RDmplrV3DuEk7Vm3+XvfciwHRfyU7aLXx1exifL4= 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.9 083/159] soc: qcom: smsm: Fix refcount leak bugs in qcom_smsm_probe() Date: Mon, 24 Oct 2022 13:30:37 +0200 Message-Id: <20221024112952.448915558@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569769921239929?= X-GMAIL-MSGID: =?utf-8?q?1747569769921239929?= 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 01bc8528f24d..87ab37807e3f 100644 --- a/drivers/soc/qcom/smsm.c +++ b/drivers/soc/qcom/smsm.c @@ -515,7 +515,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 */ @@ -523,13 +523,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 */ @@ -537,13 +538,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 */ @@ -554,7 +556,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. */ @@ -584,16 +587,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: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: 8497 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp404028wru; Mon, 24 Oct 2022 04:54:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ELOoRcq8R9KBC1Qq0WjbjIagM11dkDYo4g1NFlTdtQNRnzKQVef+23OHUJVoe14UllSBU X-Received: by 2002:a05:6a00:1a88:b0:566:8d0e:30eb with SMTP id e8-20020a056a001a8800b005668d0e30ebmr33500353pfv.13.1666612443661; Mon, 24 Oct 2022 04:54:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612443; cv=none; d=google.com; s=arc-20160816; b=i2h0RXJKipUK0P/evREtO8Dv6JOTOENV/8HR+BOj+czXyKusHFtZiATl4I4gomlyt+ /9DWXoSAWUXuVzJ/0Zyys2IqdM3QiCVNeiQUX5+6mlkrYJj3EEyF2jQ1pOvfBLEufuCY QyEvpQUqDzOvmGUYIkm5NrKMo6jWWlW38+a2mqpMKXHcQ3ZTbmBCVT9B5kJUIViXOyxl UyuaC4ON4egpUW+5Pvj37y91dJzwHx3n3pMc1wpLWI+PGmJaeyexamNwVSfNl9YQ5bp2 MpkXS7nmkIDkjlZcXxVDXQmEzZpfTK6yNN/WaexbHUrHNMwZbdEdlWBB6XeJbFhDdoxR AcrA== 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=nPM9iqWNU5vRQs9Tdo0GqFULEuMu1Du/hJPTdMIwpLdgDWt05I1t062lGZydc4zRc8 DsoIGE5dujOz7emrfasDcYVi7UwJEhUEFp+8A82K+dmK0wcw3Add1DOsHw87DVQvTVS4 nKsHvMnON4CIHm+1mylUh3Eb9XOU3nts6P6pL6TCXzXV1LLl2RAAQXWLwwViuUgxHaaU XAnOFInw47qm4LDUWZf5TaH9ldxu6WvXrZS4YyUTCT4pLZqm4QkGY9A1VUzoegP9wC04 zBoT/cFonQ995zrepbNUY6evRG+7txQDM1szc44U/orJka8HTioXWOfoXcraCPhgbYZ0 wn6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gzGvHiid; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 3-20020a17090a08c300b0020267707b1csi8072791pjn.59.2022.10.24.04.53.50; Mon, 24 Oct 2022 04:54: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=gzGvHiid; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232117AbiJXLxj (ORCPT + 99 others); Mon, 24 Oct 2022 07:53:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231696AbiJXLww (ORCPT ); Mon, 24 Oct 2022 07:52: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 6B4303CBFD; Mon, 24 Oct 2022 04:45: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 ams.source.kernel.org (Postfix) with ESMTPS id 3BDEAB8115E; Mon, 24 Oct 2022 11:43:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DA1BC433D6; Mon, 24 Oct 2022 11:43:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611796; bh=E6nMjH9elQkFPPehNJVGitkxW67b30EoBEbRIBxoJYw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gzGvHiidru9PRom2K0KsAKI7S8HmQ+i8tKvLoHiaZZm4wbPvVkis0eNoH/jVxu42b AfyHYpavQRfHcT6knY6eWo6HGOW4jdYXw3aKsg7uuu/p8kzsyNaawHH1zuq9wEUOuo HVZNrjGqlvkHNeV88Nfe+dt+nVfnuzd+T7GZ6Yys= 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.9 084/159] soc: qcom: smem_state: Add refcounting for the state->of_node Date: Mon, 24 Oct 2022 13:30:38 +0200 Message-Id: <20221024112952.486749575@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569809980866138?= X-GMAIL-MSGID: =?utf-8?q?1747569809980866138?= 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: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: 8462 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp402873wru; Mon, 24 Oct 2022 04:50:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4DOCqH4fYxvrkq7zIiCyQ0T2NDg8nhT/dpQHRk33CmvZ41ixGfiJ26B2G7T/X9rpl/ZEpz X-Received: by 2002:a17:902:be03:b0:178:6f5d:e979 with SMTP id r3-20020a170902be0300b001786f5de979mr32875682pls.163.1666612250944; Mon, 24 Oct 2022 04:50:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612250; cv=none; d=google.com; s=arc-20160816; b=BsvoWsG0qYyxGM7TW0/EW47jEZkLBLWnKPpN++JXiZhnnEHfhTkMSVBSo+fbbf1QHk agh1gdLheD1u/cLkzoiCPMqR9ou8FJRu03i/m36gYXh+sgVqaH840HIWM5f0CD+zO1Fc qrI4o5GPJXduMH8lzUc4GeFLUdq9xgy2zroGMGiuPmLdQIWgqhyWOH86DELmJ8tr0KiF AjxnsjVHxlChitkWJVKhY6hlYWQp9yuSvX/MgN+FF5cizKtrVWtCoR9eW71SGu3whbt8 nZPNzo5wYAdhIkh6TMiOozi83w1VM6uCw/TDxy58FXjIyeGA/36WU37YDMhB0K9Av8Yn uzhQ== 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=y+oCtFtFi0WzhYihPK0aU0nNhMIOz+FOn6RL+8dSlk8=; b=Rd54knhfo8GhlqGKB+4NNR2a8IAZkvKlegm74akGWKUps1AKy08IjWER8H17mtumKE AM6rVoqErUXe0/CuLVzHX/uaR2HFUsKc6Cbb2Q4tE79f+991+wUoP7NK0rI9kg1MF+Ww UvABNpFZDtX0bd3cV7D0Xe4yxVCysCsOYY2AJ4DZNWMRccaHSjvVlfFFaODwvhG6UCC9 jZWCu77gI4pVpBehcCOsDn2K4c6eXiRd09PIVqAsN+DCefhn901gkFh5dqDzrbzi1m1c 1tsAlLijbPiniqPKvVajs9lITziJKkcEK+Ii3BFLfNM9abPCmsU3zGgDlXAhw3rS/NDR X4Hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Zy68kJf2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 ck21-20020a17090afe1500b001fb1bec57casi7367991pjb.61.2022.10.24.04.50.37; Mon, 24 Oct 2022 04:50: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=Zy68kJf2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231820AbiJXLuM (ORCPT + 99 others); Mon, 24 Oct 2022 07:50:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231741AbiJXLsL (ORCPT ); Mon, 24 Oct 2022 07:48:11 -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 A4A2B4F399; Mon, 24 Oct 2022 04:43: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 CD51BB8118A; Mon, 24 Oct 2022 11:43:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26B36C433D6; Mon, 24 Oct 2022 11:43:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611799; bh=GYFw6f2lMLECNn5wQrg+c930rEEm1x0EpVlhsWmYeKs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zy68kJf2nC95F97D0CDaEuN6srxS/J5HS5ynapjH2b1P+RhqBN8QBM7pS1BpK2XAm s/Z8xos+KvS7VuMhK0cLnbJV5abtXj5T7prTPZyQFT9HnITd9sO6UPerpqxXP1NG5q ziIO9KjazSezbq9xsbuiSuYfTh0hnbomYydpw7t0= 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.9 085/159] ARM: dts: kirkwood: lsxl: fix serial line Date: Mon, 24 Oct 2022 13:30:39 +0200 Message-Id: <20221024112952.525032769@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569607553140697?= X-GMAIL-MSGID: =?utf-8?q?1747569607553140697?= 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 8b7c6ce79a41..c330d96cc023 100644 --- a/arch/arm/boot/dts/kirkwood-lsxl.dtsi +++ b/arch/arm/boot/dts/kirkwood-lsxl.dtsi @@ -9,6 +9,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: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: 8465 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp402996wru; Mon, 24 Oct 2022 04:51:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Ob0eH661lYjVpTLSPDgTY88QOBadGAjc0iXhyFwaAHitJ+vKxEgdJ2EZNneguToApp8sc X-Received: by 2002:a17:90b:4ac8:b0:213:1d63:2ed7 with SMTP id mh8-20020a17090b4ac800b002131d632ed7mr3362356pjb.178.1666612263249; Mon, 24 Oct 2022 04:51:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612263; cv=none; d=google.com; s=arc-20160816; b=MgBwwJZVSVs5SLnAbeqheqk0nmrx+kyxoxcsipLZ2U55QYQN8F1oU5GwX90ARm2Y17 LC5YGUyEa0a2f84PDQzWqRT0d/zEbmhiowaXkzdgtl73/R5mCGYb2lA0C/rvqX7yrKOP bQSVZfBxvAtFsmXZTK2A8Mwm7CYmqtMpEbPpPqpLYTreWpMRQAMFnZUnEXsx7UrYvcgK tbljR03rC+5c2GypZ/uKuhdvTCMXq4NEvOKz8L9RdMFvzfPBEj9xDt5b3jwWKL9F/8rG YTd0Ux5IW4wK4rHe6XVRPkg2gkvVWbX8cTQTsdPF/hdpz5erLC5epZ1sVSyQqu9UiIL8 mgJQ== 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=bLokUIh+vnGkDZLzBCsxvstEh2Nt+VuatYff2n7+JpQ=; b=q7tlVZ8yXWbSmkLAasaoTdsPLisER9neK060K2jiPQNQZih7/z+1PabSMasvY8huHd R//2+J1W+FEudncZOsOT3/uwAkP7rqCFkFM1E/zxa8hS52HXy3+ZY7aHfcH3vsu8ZLxo WK0V7OXjUoBU2HefBI1YQwnklzaFREqEYbWtf0qgfywrlCDMUjsVfytP2bNv80EP26qt oPEc1qFRyyol09wUyACKI6A0w/YWyIpajtYWITzeJjLabcGdyFIR4c2VmPtmHYK6lPyC p20vZCd1qH53r5CkuZVlcq4zig/ZdVHMpgWbzVIEWcNL95QjagRBvcE3FroQaxfEjINu i+Hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Aq8JY/eb"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 e24-20020a63e018000000b0043bdac2f05fsi35445203pgh.599.2022.10.24.04.50.49; Mon, 24 Oct 2022 04:51: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="Aq8JY/eb"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231797AbiJXLuc (ORCPT + 99 others); Mon, 24 Oct 2022 07:50:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231831AbiJXLtD (ORCPT ); Mon, 24 Oct 2022 07:49:03 -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 DA2AE7657F; Mon, 24 Oct 2022 04:43: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 6982AB8117E; Mon, 24 Oct 2022 11:43:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C589FC433C1; Mon, 24 Oct 2022 11:43:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611802; bh=FbCIVOBS4yjMt+pYH7E1lvJhPlO9LFcQzGKTMLuRKGc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Aq8JY/ebouHtoJ4PihmiFbUNep5PWftdugGohrYhaF9TU+BWuGZQrTHZ/vd7Hcq1h kocf3nDTysqWqolyPPBhWFmu+/BH0IB2p3rtIQSP2mqc1YKWVo3b8siOZ2UF3qTLco GJsNrC9eFHVg6wF5aJlNd3758JxHaZbJZoZUuQf4= 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.9 086/159] ARM: dts: kirkwood: lsxl: remove first ethernet port Date: Mon, 24 Oct 2022 13:30:40 +0200 Message-Id: <20221024112952.555535060@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569620480408188?= X-GMAIL-MSGID: =?utf-8?q?1747569620480408188?= 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 c330d96cc023..450b4de544e1 100644 --- a/arch/arm/boot/dts/kirkwood-lsxl.dtsi +++ b/arch/arm/boot/dts/kirkwood-lsxl.dtsi @@ -217,22 +217,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: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: 8456 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp402540wru; Mon, 24 Oct 2022 04:50:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6YLz4W7mKGXm7gXv5Aa9+hXF1m5FRrjPyu9dEK1WPoi0EPt3k+dsznfMQuFRvUK44JU+E/ X-Received: by 2002:a17:90b:3b86:b0:20c:705a:dcdf with SMTP id pc6-20020a17090b3b8600b0020c705adcdfmr71535119pjb.205.1666612214087; Mon, 24 Oct 2022 04:50:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612214; cv=none; d=google.com; s=arc-20160816; b=Yg3JQvIlflSvS3JpH+tZdFPSaB7/rHmumYo6gPF0VslyYGsJvmD0IgHd3qmFaX1GXS b0DNCToCbQQq9aWquBz4tuwNHUG3qahtvQzEvhk2AxUdYuKcziPQ8JmoJsTuKzcPO9VR b7lXIl7bRIAajL+j7MyimtN3rltQNWdgAFEdgz9HsCaLlECX3Dnx/u5GSPmp722f/RNN oOtYOm3f/p46q+mVoGrZJU9ZMgVwlnQNsDcm1+HM7rY1wyQ+fMHJ7kTjJvsYoSx/qn2Y edc1Uqrj+k8YvKcnTx5FCDyGt9HloxHuJ0b6stvIfFhYIxwvIFVwRVeWnABZ169AzkEg fyZA== 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=eusjjfHnf5xaAHXj3zvweC9FTfbjZ+Qo7UKVJt6+z0o=; b=va8jWQX6sMJgkXV2DW2am6AfbGPCNpRFwd274a6ns9e62pn7iYUwUdy8wiM3HiZDxH H4jWgY+7mQK9fzEd0F/IGOD/e7Q4ctA2RoYLLgpa2xG568iOPVkT7A3aHGO59Z3hcBh1 GOpNbuo6Pr2XXOYFlyh/oTFsF4X+Xmb5MbjWKX0wpBGBtpd9JflHRZHLGkFWEmkRSyCc v7ABVyyjXPOUuZ7r3DCLxKL91EMb+glN7eB0yppn/vbTduVkjZC8mNjM0I3k7IusEW4/ epvxNfmjH40JXQGxIQ+kx6z0lfb99KuTGjgs0X8K9HvMHQhqbFoSNZMSIaeVlvHhui6l CADQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cbukvFCz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 kb10-20020a17090ae7ca00b00200a43d4d58si11008739pjb.80.2022.10.24.04.50.00; Mon, 24 Oct 2022 04:50: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=cbukvFCz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231365AbiJXLtn (ORCPT + 99 others); Mon, 24 Oct 2022 07:49:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231640AbiJXLr4 (ORCPT ); Mon, 24 Oct 2022 07:47:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 041EB39113; Mon, 24 Oct 2022 04:43: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 55BA9612A1; Mon, 24 Oct 2022 11:43:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 645E7C433C1; Mon, 24 Oct 2022 11:43:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611804; bh=XANlg89LU61ZOChVCr9nFWhOtkDHXvdO19qftwk0xXM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cbukvFCzRaVz/ZBu6fvsXWBYXNH9LQsGxfXI298eNfU/AY6mn1By2vqaa1f26hDj4 nohhJQDSLGUt4ex4qKtdHypR9qqiIJwYQDXi9+9lCNMYc3Va6GdNyZm/7SEWUkc0LO 1N2AAda+1AaqG5gCIZz42BMPQ4z1Gj/75HaiXXRE= 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.9 087/159] ARM: Drop CMDLINE_* dependency on ATAGS Date: Mon, 24 Oct 2022 13:30:41 +0200 Message-Id: <20221024112952.585102228@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569569006221731?= X-GMAIL-MSGID: =?utf-8?q?1747569569006221731?= 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 0429d1d20393..25eaf3775904 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1961,7 +1961,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: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: 8514 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp405429wru; Mon, 24 Oct 2022 04:57:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4pYXfQxxG7FkAFMbZpPlaQ4g4v2VhZr64h1esq/BxFM2yYLF8iDE9AL4RKXhBfZ7VgB6x4 X-Received: by 2002:a17:90a:6c21:b0:212:f53b:fe22 with SMTP id x30-20020a17090a6c2100b00212f53bfe22mr10047973pjj.27.1666612620634; Mon, 24 Oct 2022 04:57:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612620; cv=none; d=google.com; s=arc-20160816; b=ep7FsijM+x3pmbya0OUhgEM67+ZkfmvtiWWF1W9h47xNiTtCQ+4lcpPMYMWyQJzY2G b1QQt+cLvJ7RG37To2CXW/UseHgPG988ySVtFHQGLJI/n2lG6XqKa0eUKBa3i2LmUK4F d9Jr3nvKU7ghnV2gTIlaEQzpfugnt+c3pytwxPkGkkcvZTzXUBF3GMO/mISZTxGj+8vE pPqHrUJTe32uwy8IthdMRVJWAWNZ4I80C4lgiptipP/AI6sWRcsUEb9el8lwrb9/WS15 95450QXaRWjnvfifX4lhqIkrU6H3tLP8+5eRHxBXmP2H7W/4p0nVWtvdOdLGT9iWZJx+ P2Ww== 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=iTrSIrx1eL90yx+++RizXfqHIhgC0m6x3nCJIZ7uhj8=; b=OW1UJf5q2a3o3/XyztR02+CdkP3mwgf/4JaUgnQHv2VHiW4OX0mA3ZjCJj+bQBzE+j w6f39MEHbk/L4ia2yc1wj632MXdUQsWSEsCXJSw3UfokVm+38MdvwyJHOr9tlyrJl0JA 0cdeTyTh6GfxcFSSHwp5gpQ4V1hVH/0d0e/Wn+nOd2t30X7f7hW1GIvgxjni93ZMNzNc mrE6Y7+VBoIb0kEPbraHSg2ocLGMXstLy+rlH1fqR3UC9C3kKPfhpSjavrCJBLUSlhAU UpuCaijJTe3zEnq/8Aih5LNx2BNkqmR6KxAVFEtd2fr4XDbpyBE9qeQoRwScoIy/wkCb p2rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FY92Yl9v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 q8-20020a654948000000b0045d1aa2a589si36352685pgs.840.2022.10.24.04.56.47; Mon, 24 Oct 2022 04:57: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=FY92Yl9v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232047AbiJXL4Y (ORCPT + 99 others); Mon, 24 Oct 2022 07:56:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232158AbiJXLyB (ORCPT ); Mon, 24 Oct 2022 07:54:01 -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 7F13E5E66C; Mon, 24 Oct 2022 04:45: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 97353B8113E; Mon, 24 Oct 2022 11:43:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F10C5C433D6; Mon, 24 Oct 2022 11:43:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611807; bh=zD0FwWMtuvEHwgXDG8EE8STBstU/5oT2fFFmNlKbN9M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FY92Yl9vif2DyIHpbRZsSgjoSA92Keufg01wZMTm4EpwGRj4m/lXuwFJyJdAB2LCy c5lawr8guJgrPjGohcgbf7IcEVbhhkLli40R2vYbpBO6vFlEb4StrJnOgJKTSghb1G jRBSAY1n49L4qRuYgTzXfzm//xZdY7jwE8QX9VFw= 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.9 088/159] ARM: dts: exynos: fix polarity of VBUS GPIO of Origen Date: Mon, 24 Oct 2022 13:30:42 +0200 Message-Id: <20221024112952.624832621@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569995162802679?= X-GMAIL-MSGID: =?utf-8?q?1747569995162802679?= 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 a1ab6f94bb64..62f9623d1fb1 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: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: 8504 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp404928wru; Mon, 24 Oct 2022 04:56:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ZLywBDgstf9Mza9Yg1tO8oNCg3Mhkr+3TIEhsXZ08zd1rPixRUuc+3nlMHXeV3nGqOFar X-Received: by 2002:a17:902:cccc:b0:178:a9b3:43e6 with SMTP id z12-20020a170902cccc00b00178a9b343e6mr32553462ple.92.1666612562577; Mon, 24 Oct 2022 04:56:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612562; cv=none; d=google.com; s=arc-20160816; b=RjLps0E8Y93e32W6DI491TawprMhrgTaPI9LH9MJVrUJzQwENSyAm2KXjFE666nJXN HUkxH1digoNGJtZvOWg2C3rf5UZkFEkpZMoqlvRa4/M3TrhoBqV8JkG6cEO9s+KtrnDe aQMk71pMd10j+qoV7DsJF3ePvwKA5zFyvRrYpRncdGpUtNWvXVfBDSYA0eAVuRcSPVgP LbimuSbA/zbh+IZuy2MJvplQpgm87TEZxI/iRVQ0u9pXWmpOZRB15G44AbVSWE0Ua0BT AeGrrdi+oSJQWJuJV4DFRc4FQSEmYqw9/gn9XzocH3JQPMf8KXZ+I0Ke3DgKCK+4x8D9 AaCg== 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=aZG+dusXFdgNinPfqfIzoEhniNljuwwxJ8ogsUuYONE=; b=U/XmpIM8kYdms9glJPj8hxoxU3zeolegLDcabw1UP6McrBypFarDQx4ui3SUWO75U/ PSpkgue2170LmS6Hyk5e1w3QvJfTNvs5QJyyWIFDdNyTeE7lZgRa/Q27OuwdPqoJ7Wsj NE33zhRXSkPAyMBTzsZDUDdNuooGqGgjCcagdoEE6hcXyOBPbAiU83wDaviYirO6pvzB HuDLF/uQFEGMZBFCTH8ksNtHnGewS4NDgZ4b3P744EhRYs/tyKBlKEocyd/OWSb+dQp1 mk2vL7ZJl6OYYQo++ZWymKkPjgCExyGw3aFGrqvAEV1BP+Bqj6nbU8c9U7aW0aY1i7Ug k3hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=czF2w1nF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 l62-20020a639141000000b0045ff2a2f569si34623564pge.808.2022.10.24.04.55.50; Mon, 24 Oct 2022 04:56: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=czF2w1nF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232142AbiJXLzg (ORCPT + 99 others); Mon, 24 Oct 2022 07:55:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232256AbiJXLyO (ORCPT ); Mon, 24 Oct 2022 07:54:14 -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 442BF6337A; Mon, 24 Oct 2022 04:45: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 8940561277; Mon, 24 Oct 2022 11:43:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97709C433D7; Mon, 24 Oct 2022 11:43:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611809; bh=c0s0ja+QDX4cRYUUkIw5w5hFFhP2+f+V3xC1yYuvbj0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=czF2w1nFVCgy8oy+MGztHsyUddGSp/XOneU7AeZkqCBKqHNPCsGgbb1ASTF23koiO LD7XgUwRkoF5hF0iwM6oQgAARzYWknYonKIzKXlZL9MhSibh+1McKYjf6ckZY7BKcV 2pH5Tu42kPqI6XgsJt+oxgZlm0Cz6WYeG+RqNwFw= 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.9 089/159] iio: adc: at91-sama5d2_adc: fix AT91_SAMA5D2_MR_TRACKTIM_MAX Date: Mon, 24 Oct 2022 13:30:43 +0200 Message-Id: <20221024112952.664114106@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569934537239585?= X-GMAIL-MSGID: =?utf-8?q?1747569934537239585?= 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 e10dca3ed74b..5a7f9120e13d 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -74,7 +74,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:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8433 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp400990wru; Mon, 24 Oct 2022 04:48:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5tguQOxfbGm8VYU4vHvQ5pM9kiq1HLWrafm+eFhzeFSKWe95DLYlbhfQJKtv5tGNDDX1mS X-Received: by 2002:a17:907:7e87:b0:78e:2dc3:945 with SMTP id qb7-20020a1709077e8700b0078e2dc30945mr27380135ejc.326.1666612080614; Mon, 24 Oct 2022 04:48:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612080; cv=none; d=google.com; s=arc-20160816; b=iLImX6goFPyJea8mv8ZMkgJj1KviPTWDn6lKlR7iy/NYY/eYLW5ANVKdYm+ZanBCkf F996bB7AwgITPamlwW7o77rHQmvoczsNSzXad8Rk4+Qkaeu/XuS6QrtCB+bfAngtnCeY fvXB9hV7v72Ty5TxxG0oq3f68cKbR9eQPSXjZFyDYCPyvr6xwP71+J8kXV+ccZDlU8Cr Ppjh9WDEGiypuT+Twb4DjN2xRNplyZJ6vOeqOGsGskqnQjVghT2/GWWgvPz4K9DFHrEi sldHnqTK2xVMr8EJFev5NWcK/jbQt0FRyzEvou47KZ8A05hPaKR8HJ+pwd5B8rWyoO/a 3Esw== 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=d23vvNpdgp5i/T7gptyao9Q8tmu8XcfgE2nNbUnfCMw=; b=kJ1ZqO/0klBz50rnxG7fhhSZ9ZzXFrwxLTmfnxgdsCben6MWZGYnPiuJocpI8NZh6p I1aNZyAUb5TdYeSCgJYV9fdZuJMPQt8BeFE1+UDJe2xsL7GxIgTw/mLlhXJ3BkqQ8sfx HIKpLsNJLHqw8CVVQYfpA0er4TfYhqDBwMPOpjwCA7t9R4Ac+NAwoHxpRFpmeEtK0wK/ 3GHa20PAVu2WMSuRCXMjve/FswJOWj60yvPAMovKNsU5NZoC/bmcMB5OpPOZf+574AW3 3sFOb8HikSbCQTP12X0R0hs3OOIwhcrBCFpXqtZtF6FUa2P/dNzF9EgQcn3x/HhukATW To4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uv7jn1bx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 q13-20020a056402518d00b0045e00384e8asi18925653edd.380.2022.10.24.04.47.37; Mon, 24 Oct 2022 04:48: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=uv7jn1bx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231660AbiJXLrD (ORCPT + 99 others); Mon, 24 Oct 2022 07:47:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230219AbiJXLpK (ORCPT ); Mon, 24 Oct 2022 07:45:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6726F1CB21; Mon, 24 Oct 2022 04:42: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 B005AB8115E; Mon, 24 Oct 2022 11:42:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12C3DC433C1; Mon, 24 Oct 2022 11:42:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611731; bh=K1rFR5/EOtnA9W1cWqlMP/EGYwolFkZjTI4Y9jSRlQc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uv7jn1bxZkk5IONjvbFm8tAomZzknAkiwIraEl9fFKGGDMHDRGV8X254MeCDABM/w 62BR8RA2lPeKNrs6YRwaNuUCfYlsWKzXJmhIU8/kdQJCzEkMmBvKSNz2tbicnx0FZK Y51FVgitOuoLE9X90KScH44IPfUIVW1bJz9m03t0= 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.9 090/159] iio: inkern: only release the device node when done with it Date: Mon, 24 Oct 2022 13:30:44 +0200 Message-Id: <20221024112952.701629645@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569428827843919?= X-GMAIL-MSGID: =?utf-8?q?1747569428827843919?= 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 218cf4567ab5..13be4c8d7fd3 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: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: 8442 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp401549wru; Mon, 24 Oct 2022 04:48:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4yJKLqcy+OrHxcygWjJFBgzyEnmcO3fek61WpYLmyp2VqUc6aTcZljTvV5CfcChUN+FJfb X-Received: by 2002:a17:906:5a4b:b0:78d:8790:d4a1 with SMTP id my11-20020a1709065a4b00b0078d8790d4a1mr27181841ejc.329.1666612128446; Mon, 24 Oct 2022 04:48:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612128; cv=none; d=google.com; s=arc-20160816; b=YkkaJ2Gv6Wi+xt3CZVrwzuAuPML/PgMGiUC4Rg9b+IaCLi7v1sjmGzQCdSxve6zkRM ZTpYNxNVLssg34H8HpoXWAYz5o9cHvovIi7oYO9sEFX0mbxgkCR5x8KBKuH0T8IDVUYO OmXX/zZ9jaqTM2PsFG/cG7RjeNINf5l0hcp1o4s+s3vhlGv3t9XjZhHOOtXWhsA9SZYo S9KbTCPTOsWacGX/VKIxlUH2p8FZ7Svk4EcGOp7cGk9lY1QdjHhReOhdXN93xJVKj9nn 1RVpoZgYutyAS7+bA9yDRile9OYj13vlBc9OF1ilBq8TbSAkyUetFdFsUgftuUuyhypM +MBg== 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=pcnDScChAbl+Wqz/p/M6/PXZ447ssVkI/1tABOnoazg=; b=knMPyM6DLhfOcwsYsEdkC1a5XTd52I0C+guU/dd4c7UzdBVHiz7uJNp2xHNm8GSqDI VuftcPIe8DwzcTcIws76gvTy+1lODpuYt61FOYePL7DDWncQF4FXpnQf2H4auHbYz2tb awXaxXh6nd5VkvgEZe0eBKS+TXhLJdi+Fope/38G7t8e5LHNLIpPYsvsoFGEWZSrSHyo zkbGL/KgWw4vK9w3eJ9Lf1uvGA0hG6ygSeFu98vuF/Meir8jhxuHl2zclABUQdkIoWVS +OEotzq5KsQVW13bF8MVGTBIOVLbeoCPMgnzH7oCtwj8lmRdP/iFFhUg6CXCh3htIYQk L2EA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Oz+wbK8k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 g9-20020a056402320900b00461a32e0e38si4100975eda.306.2022.10.24.04.48.24; Mon, 24 Oct 2022 04:48: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=Oz+wbK8k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231717AbiJXLrk (ORCPT + 99 others); Mon, 24 Oct 2022 07:47:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231570AbiJXLqD (ORCPT ); Mon, 24 Oct 2022 07:46:03 -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 B64E175FE6; Mon, 24 Oct 2022 04:42: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 ams.source.kernel.org (Postfix) with ESMTPS id 56127B81154; Mon, 24 Oct 2022 11:42:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ABC78C433D6; Mon, 24 Oct 2022 11:42:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611734; bh=mzKbFNi8EHzTsE2fJUo0M3C3UWp8OwL77S0isw+Km8w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Oz+wbK8kLsrbDRdigphMT0EJhK4pZNQhrnd3X2BQIl24Xc5Xe2SkCg0h6CvjnNmHt dLtXvoGdZa+NT3NiXIyNUlAtvgVs1ASvFtKT2OJgdsC8AolpZwyXdkCC4JEkoqThrH 5lJzEfGM/1/fuUDxDqZZMLJ6n5mzZnCmTaWACl14= 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.9 091/159] iio: ABI: Fix wrong format of differential capacitance channel ABI. Date: Mon, 24 Oct 2022 13:30:45 +0200 Message-Id: <20221024112952.741070579@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569479520106750?= X-GMAIL-MSGID: =?utf-8?q?1747569479520106750?= 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 743ffbcc6b5f..2d1f8f803fb2 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio +++ b/Documentation/ABI/testing/sysfs-bus-iio @@ -125,7 +125,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: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: 8439 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp401314wru; Mon, 24 Oct 2022 04:48:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5dMziaAag7lC0sd5azwkwtX0sfrBp36jeRvhn4G9vGXJRAA0nr2ecT6J2m80iQHYo7IbPY X-Received: by 2002:a17:907:272a:b0:791:994d:fb6a with SMTP id d10-20020a170907272a00b00791994dfb6amr27533866ejl.337.1666612107748; Mon, 24 Oct 2022 04:48:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612107; cv=none; d=google.com; s=arc-20160816; b=Qp9GzLQjUJf0K3/XtyhVkLI70w6Qn7spIDMPSI5oH01Ea6I43fAZy28saGQfkL/gMr +JiqNEiRUhiPaE0ngbWVVrTh0tidkkZm9s9VBlaUT67rpuUPaOW2cnd02R8x6PmExWih L1opV9jgov6+HeRX0Dgbgo+l0pdwWu/1gKR/j+nufuBY29jC+VXzkQ/5q3KZ7HnxMk3x 2hoDtN2+YIqQUryvBLgRPBLhL2/gvWfiE1GgA3HS7LR8rdImzo1xqgwcvMHKqgKA/64J yH5qOBvDua5K2pB7yK3Ofug2kmxzGY6kAS/dcjIiIlzW4mH67+dTlmkjB39a27mKGr5s FiYQ== 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=cs5tJDXEP89aZSi7DY0mX3HG7RYGnAhL+X7MivMUEHE=; b=f4sl1FcZMO6IkJY7dmhhLF26Qo/VpFimvIoDgpd/5DXM/tPmvE6UI7D8QA7BX6IElf 0taFe8QswpoePoUsphvnyCgBBTXaR9+cdoKOTgTkz8nWCjaaszS6LeN8EMncwHJ5GxvX NKMK720pse0E6kSVXP7XaFdmLr0BrpZ2dPFnufXSRy55skzzwDbgAWMFM2O2SIaYfHDC FoqRZEVF9P1kLHbSFXouueXfwPQIhk389SYL1mfGyyz6ajtPRJ1uTtokQpGRH5VWJsJG +fHg8rdSXOkHvyYOL3nXgDBud0+fO4DbFEqBPKts+VLqSRwJemn8AHsGQ/GaYs+j+xQZ hK9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WtacQ9ov; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 d6-20020a50ea86000000b0045c3592301dsi25399662edo.191.2022.10.24.04.48.03; Mon, 24 Oct 2022 04:48: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=WtacQ9ov; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231697AbiJXLr3 (ORCPT + 99 others); Mon, 24 Oct 2022 07:47:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231532AbiJXLp5 (ORCPT ); Mon, 24 Oct 2022 07:45:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6D0475FEE; Mon, 24 Oct 2022 04:42: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 ams.source.kernel.org (Postfix) with ESMTPS id E5A1CB8117E; Mon, 24 Oct 2022 11:42:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43C18C433D7; Mon, 24 Oct 2022 11:42:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611736; bh=65y9OxWLOZDKRavNVEMFCUaCmBhr7AWP+ncg6Ea8cpc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WtacQ9ovxKgoUqzVLS4WrpiuTDwZg9JzknYqHlYudoZoSKaHPh4g/qUJCjpJ3EjKo l1gjnvI1KGSv7RGV1RfGK2FhDvloK0kaGmVRhWZdrQfJzO+8EcOU2hvFPnWguKYKv3 OvBqH7B8DkZJW3jzKqyz0y8PMbrSSLkI71Kwn66g= 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.9 092/159] clk: tegra: Fix refcount leak in tegra210_clock_init Date: Mon, 24 Oct 2022 13:30:46 +0200 Message-Id: <20221024112952.789804054@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569457071087262?= X-GMAIL-MSGID: =?utf-8?q?1747569457071087262?= 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 2896d2e783ce..21b426d508aa 100644 --- a/drivers/clk/tegra/clk-tegra210.c +++ b/drivers/clk/tegra/clk-tegra210.c @@ -2706,6 +2706,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: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: 8743 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp427262wru; Mon, 24 Oct 2022 05:33:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7AN/uqZiJd+yna83A5h8EJIjEqJPI2xH5dyOQiDIzWfugZhrurwoIDfxRzs8uv96dK6Eml X-Received: by 2002:a17:907:75d4:b0:78d:efa7:f78c with SMTP id jl20-20020a17090775d400b0078defa7f78cmr26752016ejc.454.1666614783702; Mon, 24 Oct 2022 05:33:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614783; cv=none; d=google.com; s=arc-20160816; b=ARU+paGQcdw1WX3IpQqXefjTmfJQX0aZe97vYduOyyvCpEbfE8Y+AytJAUGQk2d4Wo bX5cG7/N/W5EjifFAehvDhpEw5u/NItXFcAZuKm0wTPIb3SRbck7vhkoj68mN5CnSnVt RXTo/6TQEq9NhLlBIW8on9wtSkVbf5GEtVFaLLtH0CYUgYNdwrjjt5AbZxbDgSblBLqY 8V1pjcJZk2FG6WH5O4KzsG7hrppgDPkWPEe6PZdVpK8dTgVuYfyNYMjs4r7wBEntoG21 DhN5Yb+0mL0aycH5r2g34E+yrGiuGqMppKMkRvXcW1kDXmigaNcPld2RaIPdZNTovqpI cUAQ== 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=7SqHZqaQTGbk/IExNnP6L9Jt+PYKLLDOuqhkchbUpWU=; b=LXz4pbeZR6tED5B5ZdVrA7+ps9A85u/rxOFYaNoDSXWwTLmcyjiKvwBNR8eKP/zSE2 awnD4Ab/mv1mk4YXVi2i3L2TxvNy+SaC4yVQeSvASSJqjR0iRCkesjbDBP6QAB+L2hWH 2/VtMO/TiQ9KDsvrStM6Ow/D3in1zvPlaHmNrKrgt9t3cuV1O62CByK6fdlHeySk0q2Q os2fr0Zqa5IWla1QdkzRSp5c8S3DRgrboirtfWXAoeaCF4VSPOzRNgyR0G3f23/kmQe5 9Mt/55FhFXPEBj8BA0uOr7CGyCI3m9DkqqBRqVZtKt57OdYhzbydzFU1w0mYusQtOigq eBLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CDZlYq0b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 gs41-20020a1709072d2900b0078de536a3cdsi28707371ejc.119.2022.10.24.05.32.32; Mon, 24 Oct 2022 05:33: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=CDZlYq0b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233702AbiJXM0P (ORCPT + 99 others); Mon, 24 Oct 2022 08:26:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233903AbiJXMYg (ORCPT ); Mon, 24 Oct 2022 08:24:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF9516417; Mon, 24 Oct 2022 05:00: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 8E604B81188; Mon, 24 Oct 2022 11:42:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDEBFC433D7; Mon, 24 Oct 2022 11:42:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611739; bh=DSWPBaupk1FspFM1N7wF80naJQX9dlmXeX1iHdvRU/Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CDZlYq0b7Iti1WqO9nH88wQesb155L2hw3cH6zPgtghQkfRErLME1tbYo6WtYwHVk ylB8Cx9fHUhE4tsE7dHptpyuhFVDwHVP1ItKGBifqCDSzRVGk9+XwKnXr+FZ7gkjjY Mc+oqAw3gfaoyJG5vvnUDiWV6fhXTp8f0IdACtuY= 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.9 093/159] clk: tegra: Fix refcount leak in tegra114_clock_init Date: Mon, 24 Oct 2022 13:30:47 +0200 Message-Id: <20221024112952.824833021@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747572263531934856?= X-GMAIL-MSGID: =?utf-8?q?1747572263531934856?= 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 933b5dd698b8..c92d8f36a00a 100644 --- a/drivers/clk/tegra/clk-tegra114.c +++ b/drivers/clk/tegra/clk-tegra114.c @@ -1342,6 +1342,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: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: 8443 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp401587wru; Mon, 24 Oct 2022 04:48:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Q80DA8ru+ciwNL+egYtsV941pnSGIuqY75lXz9bTEEM8E5lp4+k4jCNlt6TucnuToPXEi X-Received: by 2002:a17:90a:d390:b0:20d:3b10:3811 with SMTP id q16-20020a17090ad39000b0020d3b103811mr74769604pju.211.1666612131092; Mon, 24 Oct 2022 04:48:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612131; cv=none; d=google.com; s=arc-20160816; b=aT4FHFxpl8/5yz6jzdkH+lmDhudvi6FeaglfpysEJYJJbVEDQGhpcY5ICOWB1qa4nZ L11544fYodUznNgRvkN8Khcd9n4E3SvfqhAFpGWtcLF+7gfUOOLvMTsaPe70+EV+4i2Q mKgmQ7bz0ZM0mic57FvuJhJFQcHUtgryxFe1mYLJC9/FyUQ5qX9WUmDJ86CEKu9gJqPn 6S576Eu2mr1ZhVbqDOEuMVdQgAP8OB8VQ59fg8A0IoV1qDy/raOA7EwO26MdvznlgX1O kRgh+StNbGNVZkeq2wvJuStQuCLmtbp7TTmN/Xil64zK6pGuCJwEQTQUXDdKCU00vLM7 js3A== 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=sv6hmoiQbRk020SrHOQHVNlts2OXBnie+cxneJGFfT5aMOFoTZbfBuPRfhJ6D95Yu4 qUUZdg5EYOUoYA+c4Hp398DbnLP+Lwcs3C5/WDYh52x80xE1n6q+QGGL0pA621Ljjno+ /l9FCNxbOAJBySKp3svQuSGNjSDRJUg3/kjJh2x/RSL+99NBZEbaqhSvENefDDbERlBa WB+MzBgFDvJHRLKizKeVRODvEeyViwgIuQKlGDbieG1iu89tEFz7VQMCiuUc09kcbBhS +1QNHviLSnWeZBjYMyLTBoBJvz0EJl0rniAirCD3m5eEFkxU42DQYC6Fc3JrRF5KeIaC 3ZvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Yzobpuij; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 bc11-20020a656d8b000000b0042af7555d10si33289023pgb.862.2022.10.24.04.48.37; Mon, 24 Oct 2022 04:48: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=Yzobpuij; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231673AbiJXLsI (ORCPT + 99 others); Mon, 24 Oct 2022 07:48:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231678AbiJXLrP (ORCPT ); Mon, 24 Oct 2022 07:47:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60C4A26571; Mon, 24 Oct 2022 04:42: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 7606B61257; Mon, 24 Oct 2022 11:42:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83779C433D7; Mon, 24 Oct 2022 11:42:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611741; bh=g3xurf+26Zeho2T4obK1FAu9yl7PM0ykkt9q2gqZ0KA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YzobpuijF4ol/wBtCL9EXZyt6Ab4gVhLwBUVHHg1HkiPQcptIhxRsLjRhfEtY3L3R ZQmWQeIB5LsCu5DQ+VvLot2eA+LwfHCGkxLQW/dA0Zjb+Jk2BfFmrzIqMmDCnrXEF5 brJKxsW0sqIBMDU7Ho0xl2xBGdH4Ar6DaC3EGU0w= 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.9 094/159] clk: tegra20: Fix refcount leak in tegra20_clock_init Date: Mon, 24 Oct 2022 13:30:48 +0200 Message-Id: <20221024112952.857340828@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569482015092687?= X-GMAIL-MSGID: =?utf-8?q?1747569482015092687?= 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: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: 8452 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp402372wru; Mon, 24 Oct 2022 04:49:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4WYlcB9/p42+BNonexRQOrTPLLFTi29KwFTEw8O5cSOiTgq5nFJ/Mxez7is+voV2TzJ9Pb X-Received: by 2002:a63:2f82:0:b0:460:8786:5b91 with SMTP id v124-20020a632f82000000b0046087865b91mr27490788pgv.422.1666612197406; Mon, 24 Oct 2022 04:49:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612197; cv=none; d=google.com; s=arc-20160816; b=BnE2/TqtQqHyrsBQkHZs/zMOUTXCXA+6SGhK18/lCADTbDVwP5QUm5vqvMJUGMOVkd ZK8N4u2m8BH+FLfeFoqzJiJZa9SgGJnelSwIF/LWfrG1QV43gSRbd7yFTPAUwXhJFP+m J9o1dZSU+qQL4Q38q+ZjdZARFpTTUOR6hZ3liuVSW8Cb0IHy2iG/+1sjvsSj/bi/PeNk MU9ayjgaDR+varaIhPTKxFl/jAn8O5l8BVrWkQtosr9wlZLG/4tEzgFi0u3tT4USiyKc WUkYZZBQJLNCBCJJnr+eWwoh73cq/TeyEupUAj+loRO2EOwopNjTXXTC+1pskONkRgtW biJA== 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=5ZM/ZrpkdtSNcoORYLl9WbpBg6kYER3zoaOdoC1GzUI=; b=rTIwS2Bq5JNRfxkMaXmIxQ8ITHq0P/tP9YrcAbJjuH9j+dxTFZDNAkM7/+VVjCr7sE 2fbhdENlVXInMml27KFO3gqz656Xqdpll/ivcqaMUPQSvycVQPBij2BlCV3s+CO2vFVm K5NyWJ8bTbgt1MzoAyUgf0f54OcTX+gZCv72OoPgtcxOEKXD3xr1eAtuPTJPOhC93Lpm OYRtNt/JuxI7UoYlfjjhSKKyCwqw6JyfkzWNL6Y2SC74ZlYdWRSrehHAljgrHIrmijm7 v+ldk693Dc7IjdsIbVT4Yff3qDHwgoWvSztxsEbxwThpF4qW97vT3QmPxc1Nki+1ujuQ eqUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uMKGRpnV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 u18-20020a170902e5d200b0016f1c879eacsi39938822plf.109.2022.10.24.04.49.44; Mon, 24 Oct 2022 04:49: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=uMKGRpnV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231268AbiJXLsn (ORCPT + 99 others); Mon, 24 Oct 2022 07:48:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231601AbiJXLrw (ORCPT ); Mon, 24 Oct 2022 07:47:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87CD62E9EC; Mon, 24 Oct 2022 04:43: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 1D89161277; Mon, 24 Oct 2022 11:42:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BE85C433C1; Mon, 24 Oct 2022 11:42:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611744; bh=gVRxCi6HdZ+Y2hyxhs77KDg41vKK92c+2may0MmZ35Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uMKGRpnVtoz3nyRzROiWLnIAoJgctFNNqNcRcKrrh2LJf8W+PRS1Ccs7kJwxxX3XN zZoPX7K7kkLDJzjZqHe5LdqxPA6T3U+PuORp2MyWKLrOIvBApXwCBTySaW2+GkL3MP zjxDYBj+ZFb1xhv/MItaemkKSxC7jLHY5AtcbzQk= 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.9 095/159] HSI: omap_ssi: Fix refcount leak in ssi_probe Date: Mon, 24 Oct 2022 13:30:49 +0200 Message-Id: <20221024112952.897460797@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569551753274102?= X-GMAIL-MSGID: =?utf-8?q?1747569551753274102?= 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 22cd7169011d..56de30c25063 100644 --- a/drivers/hsi/controllers/omap_ssi_core.c +++ b/drivers/hsi/controllers/omap_ssi_core.c @@ -562,6 +562,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: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: 9640 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp532754wru; Mon, 24 Oct 2022 09:08:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6OAktlPvBpEwKtViYl5qzxLqFbDherEWCDLGoB62pT02QpUoFS0gPMKzYL7Vo8KqhjbY14 X-Received: by 2002:a17:907:c15:b0:78d:9c3c:fb8f with SMTP id ga21-20020a1709070c1500b0078d9c3cfb8fmr29283269ejc.347.1666627712901; Mon, 24 Oct 2022 09:08:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627712; cv=none; d=google.com; s=arc-20160816; b=BQcVyTwJ2w5r3e034kEpEtpM+TucQLuI4zODlKnRAa+UGc5gPEHAWjU7I6no8jVfJg YngvV0a7PPoie9dRZsYDA9RWW8BysSXoVNJ3PSjgamS3YaxMGfHZvpoq/ciDHHV5EX/b U2f2FHrpZmklIa+ux6yp1cT72Evjm2fIyiO8jnl0OcyJmf5Xs5VoNXwzTZoczCFJTOWM 52IgpS/3vbEXDx8SdPLTTOYYWCWB7ejC6swjcYeHE/X9DkMTUDtLEW/4Zvgu1+cpO11q aAQBQEg/gZDTCBuPQN7GN3BB5oCYXi2HBticXiPMmEujoZGYZrOrcOWML6f0bOKc3nW8 2trA== 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=i0/7tJwNsaLhvdh/JUDaxa21Lni8cgDAwEa3YUAOvjs6DONJrMXgaxpMHicg7O87+d s0RqmTgVQyoVb068hMW7kZ8X4IfuKOa/KxRmf5S2BIIEYcyuUln+rPMPUwVyQF23O8/S RN+zXfcZV1ELJyS8p31CrTHD8AqLdPbdTVu11dwM/m2xwU+FZOjzE9CLgwtPvG+tAUzq 36J8l82JZWUM2F6Kpkfg13n/3C1IpT9zr5CP2DplhyiQTZiH4Ocssp4j5aEo+M/J16/O CPe5ZZIYv9Vt9zslJK9vX9dQb1N3n2cXDFi0XRLeP6ewf2cOXfWvA0YSlYMbFVR1aKKI Ri9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="eU/ePzJ2"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 q5-20020a170906a08500b00780cb1272eesi97353ejy.466.2022.10.24.09.08.02; Mon, 24 Oct 2022 09:08:32 -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="eU/ePzJ2"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233170AbiJXQH2 (ORCPT + 99 others); Mon, 24 Oct 2022 12:07:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233157AbiJXQER (ORCPT ); Mon, 24 Oct 2022 12:04:17 -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 1683287687; Mon, 24 Oct 2022 07:56: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 6670AB81178; Mon, 24 Oct 2022 11:42:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BCDF5C433D6; Mon, 24 Oct 2022 11:42:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611747; bh=Jhmkst0PnxOYr9CFYZdLcK8CmYezRA+qQmUrSlsWzgY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eU/ePzJ2JjB8BTKEVWhjnGaSk0DowMr5JA4QGIwvZkt/HRSNKFIFDaJxlm1fmVx3o eC7XULm6eHsVWtQiw1+CPoS8DVxsuUQPzcWB9ZxtV7NtujJBXe6+QJXL2Mdv0NjZg2 LOoLBsVVYFyjw6U48XrjM+xTBd2j1rWi9vRaRZUo= 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.9 096/159] HSI: omap_ssi_port: Fix dma_map_sg error check Date: Mon, 24 Oct 2022 13:30:50 +0200 Message-Id: <20221024112952.934241502@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747585820496834419?= X-GMAIL-MSGID: =?utf-8?q?1747585820496834419?= 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: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: 8453 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp402401wru; Mon, 24 Oct 2022 04:50:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM51pqKAnVAAI+lU57a7ELj+hu4fveuwoCZOFFr6PUT9wrCD7/LmCu5SU35IOPB6nmMle1X0 X-Received: by 2002:a17:903:18d:b0:186:9862:d15f with SMTP id z13-20020a170903018d00b001869862d15fmr9032216plg.6.1666612199940; Mon, 24 Oct 2022 04:49:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612199; cv=none; d=google.com; s=arc-20160816; b=rabagoAEgN6t3wESaZj4mDcViBTm/xbLd7xRP3KU67sBs/YOMvAeGvOa7X+rsSs992 PwtgXp3xKpWpoaTwR2V4/qN01jUNo8Tg0ztQwWQ+LAXl+lKF4bCUUDFO5u8EjUAt9cPi 0xig2dTCullAMx/RihXh4hEaWzYCmUwCeAeex7SyKekNnHqN1RTimKP9od66MubFNxl1 akDx9Nky7ru/o9+atNCOYAl1UBnlbwyWhqjsE9O0RxYmrst/3a0GMeK7JoJEhqBgqIFS aHw/XiB+XAeNnf9G6k2fxVx327O4A+VqJk7FlBXHEfswlzMAVdm+VfVZn2XpcMJcBiHE MdyA== 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=gKBYz1ru6ufUYmfwBU02q/uuSAes05GmbIsON4Y3VWg=; b=WjyEQizX9R5zXp3OY8S9+CiXpMQIQDj/SACsvQesb4UkDn7CjjBNOqxL27HVZDzZyu JaXkQMORMXoZ/ohBTrk8CftC776hfr7cdPs/THFIx1qNwJrVNWVeE0GmHnD6W83EfnrE DIA04/wrmu0+vkWfic0eepEad7a9jf6PQ3mYGEcOU3RnvIGyxc4HAjRPXpS69RMoaxC+ k3GuE7hIz7qeWqPsTFAmX6LW910eeFIRW4SLRiTJzzMLkGYzgEe5pgW3I2zAVWHmytA8 rkit8pKJX6xHbXe9MMRgc+aHmSCLg0c5rS5dghTpswNlPHMY/ONZ757s5XrhytW1590r ICqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="NJh5aa/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 x12-20020a17090300cc00b00186ada43088si2237247plc.517.2022.10.24.04.49.46; Mon, 24 Oct 2022 04:49: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="NJh5aa/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 S231783AbiJXLsr (ORCPT + 99 others); Mon, 24 Oct 2022 07:48:47 -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 S231604AbiJXLrw (ORCPT ); Mon, 24 Oct 2022 07:47:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 382D21261A; Mon, 24 Oct 2022 04:43: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 5E8D161278; Mon, 24 Oct 2022 11:42:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C6B9C433C1; Mon, 24 Oct 2022 11:42:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611749; bh=sk3x7uu1L5IV9tqR+snSyHCHx5noWd6/RU5sXL/npTU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NJh5aa/pUVV8xR8UDfL5FhWwuU2ovopnSdtDcz16Wq7mQMWuSgvWcoEAHvwmRgCAS r06z9ycPr3l2eUSQsmt3B08/04kB00msfspsm2xOla11/19u0uIk6MP+CqTyXZ6OSg qapjngJ3mZ9tMCeSkyx1wv4VdWzJiPg+SY3c4RlY= 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.9 097/159] media: exynos4-is: fimc-is: Add of_node_put() when breaking out of loop Date: Mon, 24 Oct 2022 13:30:51 +0200 Message-Id: <20221024112952.974352930@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569554087769869?= X-GMAIL-MSGID: =?utf-8?q?1747569554087769869?= 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 590ec04de827..3a1311d572c2 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: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: 8494 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp403871wru; Mon, 24 Oct 2022 04:53:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6obTdIIcOIFnDwSMBKMbWr9ngDNPPEYSrsrWAqh3g22PB56xLty68TtRNIihORmXhiNs2+ X-Received: by 2002:a17:903:110f:b0:178:ae31:ab2 with SMTP id n15-20020a170903110f00b00178ae310ab2mr33381225plh.89.1666612419176; Mon, 24 Oct 2022 04:53:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612419; cv=none; d=google.com; s=arc-20160816; b=r/eyUhBtfYTNKlcZDVUUuKBZI5l3TXducw08olZMC7YjISKThtxZ2KPSLdliCq48UW Mraipv4m9q//o4oBusWjbP35fc/woLKmrRIZzzK1aTO6SaKrK/Sa43roMaKpYa2JOVOo nnhwUBwSWI3gA40WBqynfC9GAU+lc4UmVqmd9YsCZf7cJjfm76emrDrCsKqHSVfl58hx dQYrdZhXx6h+PRV8o+jkXRhOOgmrS8KbeUxpFSAJNKx6R9xh411up4f9cfUoA0gDliDr PtfjduWePJmdCUqIeEOqhMXuqbFBfXFqMi379cZ32bqRdhdRvA2jX/kp+aEMb9sex1sM v9iQ== 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=G8RCs1j8VCkNUUdTqiXmPzw/sUEtOCrxHD3Tt2Q6gWs=; b=O9K1FKxFG48440D8tXwYoy3nKCsTvVFadd3HCMCeJ8aQuD+NKzlx4wQEC5e+sLqhtY BJNgoB8gbNzMqQ3+DyAYBe5ajw9au96aBX+noH6quaDwObTEotJGuwzsOYwO7exly/YO hSBPCDxOTMesjQJHkcM9AVTqFc8ZJrV3tvU+gR7b+qmSQv3c2axAcLMk6lwXUcOjfij8 ub1dYsxXFrtzy2bA7Qx6pkj7QYTKVdYHSrmVkepiOR8ijzRD587OzUUvmsnjIMrNUWM9 isW4yPs769LpAfI0EIS7JC0g11Iu4xvVrXRqfXnkbrhHGZNzM6tvTJX2jTafZeZ4er8p FJWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IUFs9+Hy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 l5-20020a63f305000000b0045fdb4fca50si36949773pgh.330.2022.10.24.04.53.26; Mon, 24 Oct 2022 04:53: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=IUFs9+Hy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232089AbiJXLxK (ORCPT + 99 others); Mon, 24 Oct 2022 07:53:10 -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 S231570AbiJXLwe (ORCPT ); Mon, 24 Oct 2022 07:52: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 E418020BDC; Mon, 24 Oct 2022 04:44: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 EEC96612BF; Mon, 24 Oct 2022 11:42:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11543C433D6; Mon, 24 Oct 2022 11:42:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611752; bh=Vy69GDxqPG6S8USrgQGKNh1k8SXRIWO8A5b+jSFVqU0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IUFs9+Hydal/wHRmz5bbdWKZ2VIST+B11bUaY3fGtyvpVQ4sHxcr7cyycsqBCEufq pCxFGSPjxvZFVkLNLIQ39Hu96fzHUJVStz6hCRvRpDsDjWkK/tzqXqVTIenw0xxElQ sVVVGmght8mgPzGnsQ6F8N5g6SfMvIUjL/mRkg7s= 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.9 098/159] tty: xilinx_uartps: Fix the ignore_status Date: Mon, 24 Oct 2022 13:30:52 +0200 Message-Id: <20221024112953.013895835@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569784102890037?= X-GMAIL-MSGID: =?utf-8?q?1747569784102890037?= 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 b92700fdfd51..4fb040569194 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -363,6 +363,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: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: 8445 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp401658wru; Mon, 24 Oct 2022 04:48:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7I5dTwjWrkYUGa7WBTvx0WDMFSdgpEe4NQqaUrkF2iVgzNk9CM97UdnYO4xoAMfnvzxsTm X-Received: by 2002:a17:90b:1a84:b0:20d:5086:3694 with SMTP id ng4-20020a17090b1a8400b0020d50863694mr38883356pjb.74.1666612136561; Mon, 24 Oct 2022 04:48:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612136; cv=none; d=google.com; s=arc-20160816; b=Ccg5BasyPjwvpHz7bIMWOPrlA12vws4vnHZEYTOW37zkSMXQvwm1vPNBWMcrzWHpbT att1bERHmt04yKlLEecXt98Ud4O3cR0En7Dhu+6s/59CFBphgQcIH1+8B6zi+Z52Dx01 C9TcnwddV4G4JNPBez/jYkBHTYrQgQ1dg07DQgsnQyJ9Zh2Su+3mGa3QqTayGx+4CpiZ F8cqk562cKXwrf/PYZHxdY8Sj7TydovfYEdI9Uh3JP8Z8III9oksH9TZbUCm6E4my9q7 QyHifqPe+o1pVha5coz++m2h4pCo6mb4QideFRuGVXnAbHLqrQ9BURFhqIrToN80A56f PVpg== 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=j/xQ+GJKG00B4xU0/JcPSHoS8CpRNTbVYj6kSEcWFaQ=; b=UdLnQbyTYhbTgjMOdUG7gOxAX/aBk886ucnr+o2SibEU0Gy4pA54uhWJcCUkPGN9z9 W+/lAL3afts3bZ34B0YVI6dwtWsxE/ZkmzIwqPwq/TvLCZhw2KP0Ako3LYanB0djM6Rp Gs/B8TcoCZmRBc1n4X4er0hNzVaJ8GN59wM3S2rhrJ2oyfgf8PAy2m5Tl/Rooe2I+n1/ syvuTp49h3MS4ttICWYKWc/s3fYtEvEDoeLUpGABs/ldAn/hroItCoHZgUtheWZSXR2y tvTKkK6HfZdut9Q+IZfJeD+pNF03oEsGnBvLuDkMiHfgFCk3CtcGNBOcgZccK9z9ZnZV 1/tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pS66SZsW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a63b406000000b0043aa67c7d8esi32389344pgf.738.2022.10.24.04.48.43; Mon, 24 Oct 2022 04:48: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=pS66SZsW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231549AbiJXLsM (ORCPT + 99 others); Mon, 24 Oct 2022 07:48:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231687AbiJXLrU (ORCPT ); Mon, 24 Oct 2022 07:47:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8F7E6EF2B; Mon, 24 Oct 2022 04:42: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 5DA69B8113E; Mon, 24 Oct 2022 11:42:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA666C433C1; Mon, 24 Oct 2022 11:42:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611755; bh=//JnKSgNXoTTrTg8+1UvYR3LNAJAPNMWNCUL101lLtU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pS66SZsWho/Beon/docKm8TKVwjjORn5wrV1hUc0HqmQpfMKNoYwp93O3j2jH5yAF RgI5sDwIa1TA/jlsrfkoGNQ/bkXa/yNyFhpThuJIDtfvl8CaTZ1jfP0fef8jjQCBDh v69xZnlic19KmXS3D36xYM7jjc5xBtSbwIK3duPw= 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.9 099/159] media: xilinx: vipp: Fix refcount leak in xvip_graph_dma_init Date: Mon, 24 Oct 2022 13:30:53 +0200 Message-Id: <20221024112953.053104501@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569487760750006?= X-GMAIL-MSGID: =?utf-8?q?1747569487760750006?= 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 feb3b2f1d874..df21646ef9fa 100644 --- a/drivers/media/platform/xilinx/xilinx-vipp.c +++ b/drivers/media/platform/xilinx/xilinx-vipp.c @@ -462,7 +462,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) { @@ -472,13 +472,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: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: 8502 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp404883wru; Mon, 24 Oct 2022 04:55:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5wX32OhHcASS6GVQNNST9T12m0qmJYbMV6kctvyYgUdi9Mvoz0GyquoTA7Nfj4rtOmSy8L X-Received: by 2002:a17:90a:5915:b0:20a:d6d5:31bd with SMTP id k21-20020a17090a591500b0020ad6d531bdmr37715619pji.15.1666612544095; Mon, 24 Oct 2022 04:55:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612544; cv=none; d=google.com; s=arc-20160816; b=ney627y8wJQ6p8+ZS7tTiL+ngcNek4Uok4n4WbayyAKJx+7UyQjfLzAhkxhpcaeyq2 a+qk9CnVAcc/z/WoL1PK4bV9uBqfLn2wqNX4mOQ8NCoAR2G7RAmZEkh3Vq4SZNLi+5fW qQle4cQVQN8PMmRgEqSsXLNedzNlBFT8AAGbkXQmXZ1XkNoOmLzcSyY9jl97yFA9/gAN ew8oAE4Wm4DSNRCXd+ysX+1NkbEpL72rwB9dCf7jcS93bWzzrL3atd7k4ubvNqqUyBOG HtwpsAy04y6HN2E4AIleqxd2q+5EYOuZT84SAIrDSK8IdG8lFNc/WVLvIdOyQmtRbTfX etQQ== 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=xN9q8VfGLZX60AcXQPgh/FQZcXJGLaGKDBjrJHR585g=; b=EpOy67EdnAS38SiEFazKNF+KuzMHy95F0F7gFfag6w5OuSNhQR2Ej3QG6PysLPrsFY XeJMkhcVbiKwtGa6hR0vBW/RVDPJZzBrODB7mNZAYN7pnCnuLSDuhEpUBPyGUoZUgDEK +zV9u8broi/fXu19QOocld+UMvRs/8jqHXRYYf+qDibmuWXI4sf0dqMSTC8m/691J+3Q QhwbqcHtFNBaXGrH5eqojBdwVgbP/x5bqFHIfWWoUsiYZvwWKKVfJx9B8tPRvPSSaGF1 PT20CKdJ0ACLGArxC0/h7C/FYN/qNOLDezM+YC9okCs27H5LH9065f28tQep1R7rqZpV XQiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BH81XZ+G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 q11-20020a63504b000000b0046ade103855si34070180pgl.312.2022.10.24.04.55.30; Mon, 24 Oct 2022 04:55: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=BH81XZ+G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231965AbiJXLzW (ORCPT + 99 others); Mon, 24 Oct 2022 07:55:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232156AbiJXLyB (ORCPT ); Mon, 24 Oct 2022 07:54: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 801D65FDE8; Mon, 24 Oct 2022 04:45: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 sin.source.kernel.org (Postfix) with ESMTPS id E416ACE1349; Mon, 24 Oct 2022 11:42:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF854C433D6; Mon, 24 Oct 2022 11:42:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611760; bh=l6n/qFqqCSTBFLJCECF9BE32+/UL6/1RoyVyjBEIt1E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BH81XZ+GigZC27mPiRZlyFHXQ/anz0heuDryWrzzDyv4CG2mfnIHrKTyiaPs5+VVQ eR7zRcRg7XR1mV43anUL0xM1ctgNAroD0EBvxVlZODYKPjYDz8h4Pcyl5s/QRhEWN8 9ngDq/lWlCq3WyhWSAsJhl7l8df/xKkm44PvohXg= 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.9 100/159] RDMA/rxe: Fix "kernel NULL pointer dereference" error Date: Mon, 24 Oct 2022 13:30:54 +0200 Message-Id: <20221024112953.091682892@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569915342550949?= X-GMAIL-MSGID: =?utf-8?q?1747569915342550949?= 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 5fa1442fd4f1..d41728397bd2 100644 --- a/drivers/infiniband/sw/rxe/rxe_qp.c +++ b/drivers/infiniband/sw/rxe/rxe_qp.c @@ -825,7 +825,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: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: 8446 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp401666wru; Mon, 24 Oct 2022 04:48:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM528AqOn+iTNXuD49sCGRkfVQz03tX9cDHR2wbxzfi/s4ZLkJDC+A1OGab9dZLqU+D2hGps X-Received: by 2002:a17:907:318b:b0:740:33f2:9e8 with SMTP id xe11-20020a170907318b00b0074033f209e8mr81379ejb.138.1666612137883; Mon, 24 Oct 2022 04:48:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612137; cv=none; d=google.com; s=arc-20160816; b=JoG9kNehdEGiaYqBz1SP63HY4oKSrjY9MHywUb39vJyMx1e6E5W8TVeyv7Jfqux5Ab 4pAtW2xfHwap0tcctU+6bfF7/BhdHKM0AF0v3Q8o4GgyejI/izMoZhUujx1ZYos3NMih aJ+Js9bocytxpM+iaeXbQtM2G4uRpYge88nEAY7BZpAyMmQw9bMW5JzjRLBbkAX1ucuV bxZHt4lpXIhljSA8wKhlNWj1otOkyonMGVDEawYzlhJRQwSi4IY1GcPld86UbDjgEHQ1 9xBBxe0qwrMfLX+8Olp9cZcgr6jMReISiTkdBUe9idGuxj+8MW+4YJjIaH9/Sy6uyGyO bJfQ== 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=yRTMTqnu6TECaiJe/vHJXM//XQ7/1bsviV0C4HBTvOc=; b=bimxCBy9jtOVNHTnEbHDoAhf3p9xwOMVwTxGamiGx/7h/35hNxJp+mgcz/+SKxcZVP hU/Ixo9PdiaH1Sk03WySC1CTvuQ1rmZr/wqj8Q+IGf24GBqw+aEx/RpQvW3kkvX2yLFM hlpejyEOE9neRGuY0VzO5edpaILSure8IZt+c472btHBgtIDeqqt9axK5ME8vJESCRso eOIoUtYv70ri+XhvjkxZxE4HjbiNd/do72rfmNC00emXL2ypQtKKTLuizrl/WHOqV9wh FwUXfMwYECDNfRTVeOi97NeV2nyjKaBB3rQ5aorLw8dQl+J0q1wyRf/C2E71lvRn6fij yMlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=E4cZLlb+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170906fe4800b007aa0798e081si1315272ejb.394.2022.10.24.04.48.33; Mon, 24 Oct 2022 04:48: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=E4cZLlb+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231728AbiJXLsB (ORCPT + 99 others); Mon, 24 Oct 2022 07:48:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230402AbiJXLrI (ORCPT ); Mon, 24 Oct 2022 07:47: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 1355176546; Mon, 24 Oct 2022 04:42: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 3164FB8117B; Mon, 24 Oct 2022 11:42:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86282C433D6; Mon, 24 Oct 2022 11:42:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611762; bh=qYfc8472eOJ6mLmVF7VSLElhyX+9s5NbjPjxIy6+y+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E4cZLlb+1thyFfN0wHO464YRmUIXhAhhcqRbagzWd71d4bbjXNwltDGqVFKcuHgGc ghZfKXsqSm9k8mR23lALEZu/WCpR2aW0HxdmghXwpRM1VWUWYNNdBKjs0ZAUMe0lpo E1/ac1pHwLnzFXLRQvlzVExbaw4cze+81faYL3UE= 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.9 101/159] RDMA/rxe: Fix the error caused by qp->sk Date: Mon, 24 Oct 2022 13:30:55 +0200 Message-Id: <20221024112953.125890105@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569488700186198?= X-GMAIL-MSGID: =?utf-8?q?1747569488700186198?= 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 d41728397bd2..4c91062ff247 100644 --- a/drivers/infiniband/sw/rxe/rxe_qp.c +++ b/drivers/infiniband/sw/rxe/rxe_qp.c @@ -864,6 +864,8 @@ void rxe_qp_cleanup(void *arg) 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); + } } 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: 8464 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp402929wru; Mon, 24 Oct 2022 04:50:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Rs8HgietFhrs+wWzkrw0c9G6Fht19f8e/mZ9uRL0TIFZFMRG+vBID7WkadWdmiZ8jBHQS X-Received: by 2002:a05:6a00:24c2:b0:52e:7181:a8a0 with SMTP id d2-20020a056a0024c200b0052e7181a8a0mr33332989pfv.57.1666612256359; Mon, 24 Oct 2022 04:50:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612256; cv=none; d=google.com; s=arc-20160816; b=J3axKDAg7jLFmXlPROEEIjDK2tRcBX9o9oiV1uXBX70LQAGL+Z9vmSE0sZ1DFSsmIF hLCB8S0ebNOWWwr848+l9VWq1zGmBx/P0AWVYVjib2GS4Nyj0bhAhc+YILvc8pqaDsRR aAfWG3R9Lu29Illf6Hs9YD5RgFkfB4ATo331GKoEOFBhP3kBVdMOyWUO/RcZXRPl2b4L fUq8S3b9/LlHT3ktzRBO4HC7aNb2DVhYnxeXKzp79J6PmAgQkmTuh7l6H3E+mHTmSb4Y O3EmrWu6xt8fR3QP/auKl04ODuj8exGBlNXFgGiR4HgGIZPCT39G21K9TNir7Kjubl9a +boQ== 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=oXGqk/1JFVZBma2x97fNrJtyJ0Px+iCkt68LukTnPM8=; b=ybn50L00qbQIkY/PDV//nlsJ/1H+vz9/6qUpFIwprIEJfzDWKooVET+ziQoZ9y8+eR EwRSgOcHsuD+svOoLxcWctPwNWBT+3ftUM24Q4MSWTLhl+z6L9JyDCNcWafUp1n+zYAY n6kfigZ0tr0MpsrATU8YhM6HXNx7gvsUc6aQqeSWAEgAa5Qr4peECzn/b0Wn4DBU6S26 l/1PnIYQzuN4H0lS7Yyu4yxd41EexN5tNNdmBzm/l5s7eBTO7iT9AB7rPtfgJ3YrtpcB CI12MoXkfUm7QOuNodFov+p6rZ37nY34hPKpOktzod2XftB8BrmRux4zFnSogNDYnKrC Rq/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aKjs1SqS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 mw11-20020a17090b4d0b00b001fdcb564d73si10706079pjb.79.2022.10.24.04.50.43; Mon, 24 Oct 2022 04: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=aKjs1SqS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229865AbiJXLu2 (ORCPT + 99 others); Mon, 24 Oct 2022 07:50:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231819AbiJXLtB (ORCPT ); Mon, 24 Oct 2022 07:49:01 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD1B274E25; Mon, 24 Oct 2022 04:43: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 sin.source.kernel.org (Postfix) with ESMTPS id 31E8CCE1345; Mon, 24 Oct 2022 11:42:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23B42C433C1; Mon, 24 Oct 2022 11:42:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611765; bh=GCMxpoS+QE4tjPCCSDgrLpdROAxxNaAx6e6vdfdz/p8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aKjs1SqSoX8WueZ2hjriRQNfLYVekhCZUmbDmKmr8mG4FvfwMa2w/TKeOtSyEdP3W LPY+9EzWmbD8D9QYEO26a+mOfcVW1cXoVM7KhJbE1Hgo/VKSXVmgXEWGAroSKQ5cZm m4Da5+5E2HNXq4vkXGIxa6HbqXBGweGnPv/z8GQo= 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.9 102/159] dyndbg: fix module.dyndbg handling Date: Mon, 24 Oct 2022 13:30:56 +0200 Message-Id: <20221024112953.165529838@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569613720360711?= X-GMAIL-MSGID: =?utf-8?q?1747569613720360711?= 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 546d68057e3b..d8981b34d142 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h @@ -167,7 +167,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: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: 8461 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp402821wru; Mon, 24 Oct 2022 04:50:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6zMZAKIlJPm3bh84+xBXnkVExmZWAXJV6c8/a9jCpF/C/PNeWar6nltjW6SHq9lLndbRTm X-Received: by 2002:a63:234c:0:b0:46f:1b7:438b with SMTP id u12-20020a63234c000000b0046f01b7438bmr4745065pgm.516.1666612244768; Mon, 24 Oct 2022 04:50:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612244; cv=none; d=google.com; s=arc-20160816; b=jJn9o7k2+dfSVDpep2lqcJaWjQCtMZ7+1i0mQ+xfdJ2pBpQRF0XBhNmmopFS4pIwP6 tOdO/13JV9TzAaylrTp/aC6y/tmZxa6tLY67jRJYFFeAqQMY3M6f53s8NByJtegPYOtV skD1+TrYGsuylFuecpPen6QPTWRXZU9EMrAjsEQkP963W5zhufg+Auar30HXoYVI/3Tn yAgkK18X2SbOE9RvnEOfGrkmgtJ8Q1dj9G8YJCuQgLUgsRI+Z2cX+njRKJ+E+yxpLYU+ zj+Pu8QVDas4XZwNw/IEfPzKdx17M4JKkaqKpHPsh/4H+qr4kYRCAOExqyfBJc3JP6xn jTxw== 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=Iuwk/FWJrk87O7PLVmCRV8tD/Lc4P/9hfFMSu4TIZPr5gw/Yrj+Q3a/NNrc1fzsIza wZvN27v+WQmIvD53Kqb4xcIKrdCUrM2PEb8ppBQSPX3eFBmndc9wao7dswfLwmSt7U+B HuBJvrzhPmdZyFnH+fASjhlfmEKqTwHaLQaroVNbtmESGLQs0EmGRa1VpbmyBRJx+6co YNZXvCJRa9Z+EptgAM7rkE8KFjkuf0yX8r1zLSVqmcD8nqj6Mbu8QiaRudrPQDZ0MAVg K+OMHx+Rbo0ELXdyxW87vol994u/nGiRfIXlL/SswLiYy/NNRmZ5a+rb5rZLSKMQ0Ab1 QhSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JNG7aefQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 l6-20020a656806000000b0045f9f5763c4si35048239pgt.437.2022.10.24.04.50.32; Mon, 24 Oct 2022 04:50: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=JNG7aefQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231825AbiJXLuD (ORCPT + 99 others); Mon, 24 Oct 2022 07:50:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231733AbiJXLsB (ORCPT ); Mon, 24 Oct 2022 07:48:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AC033A161; Mon, 24 Oct 2022 04:43: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 A9383612A0; Mon, 24 Oct 2022 11:42:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B744DC433D6; Mon, 24 Oct 2022 11:42:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611768; bh=R2o+Cu2UAOttf3+FN46CvIfUeo5oZyZa9B5Y8e4wXF0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JNG7aefQfLXn9od6GWQWvgJY2AKw3MBmlmjHpBPr/T1ByszvXnAs5vWgBEkSE9eZw yhvQvSBtFR6KVUAdkgeJ25uHJZ7oNs8qGQ6cVs6HbTE1dtFgYRDM8EWLJ2JnC3bsE7 2xpndMXyNZWAZe/vZ2S0U4MIALHURf6+qEpxBnfw= 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.9 103/159] dyndbg: let query-modname override actual module name Date: Mon, 24 Oct 2022 13:30:57 +0200 Message-Id: <20221024112953.207373954@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569601054729669?= X-GMAIL-MSGID: =?utf-8?q?1747569601054729669?= 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: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: 8615 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp420000wru; Mon, 24 Oct 2022 05:17:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5GYwG72bfiWqdv5MlnVQHaK4iv4DCSsLft8yLcDZUBreatU6GhBKMQWZjNBEylfe9LIRtQ X-Received: by 2002:a05:6402:b0e:b0:461:f7a8:3e3a with SMTP id bm14-20020a0564020b0e00b00461f7a83e3amr631012edb.372.1666613842701; Mon, 24 Oct 2022 05:17:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613842; cv=none; d=google.com; s=arc-20160816; b=V/EtkdQvw1OqMd+Oq1sJuBrd/AsuZGSL32hNMgN7Mt5RlT2ZbqQ0nhTRiS07dDsGOs Clignfj2ytod74MhxzWCAeIzlGDmg+ELz/bIGckFo0wq33smSu/uQElW1f4G2Wb2/lPI saYmg7LMntcclkVWqAe5op9YpT2mIARsr38ABUh8HCeHWUfNQ9lpYvem1YLlvhWDAi+o VwjIDok/AC4C2w4jYAsxatrJj4TFjtMC6E6BP9POZyYnJbAztTfye3VkkKJk/ySQm4Y8 tNKZDBvQnkPtYwOS6ZJ31wG9/H7kJHviWuiqy82kwNoFgXANZ1ZYCLADQrICh0YeAIOj YWvw== 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=f7aEdXvFCefWhKhENrMMjLEDDdlLXufN3KF5n2hG8h8=; b=IrvSwrhI5WIwO8igySWsGU2r1vJG8l7LIJXxDNCtdfEn8/nw2GVMhuzy18Z1nNZsT4 /8YkTRzSfe/go9snME57v9R2ce/paHrfhVTqI4MXlwNqEdSVpLqpbx9up8vs4DPj9nOI nOtA7zPZKI4BTCt71PHF/VkpJ3IHtyQFYz+BDnr7A2Zm+NI8RAqqyerTdFC9CTinisF5 MS7UC33OhornjK4cQnzZrJWp4Koth+yDMmIbP7cBm/QN/ci+Han8U0NOR29Ned73nYM/ 2FQJn1rTJQwKypx5zuuTumh5YqB9UXHUnOPsklx7hp5lFvyK5WfuYoRVoiUEhqSfx3sm bt8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nG4Qrm3b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 gt32-20020a1709072da000b007919dbd3770si20434880ejc.485.2022.10.24.05.16.58; Mon, 24 Oct 2022 05:17: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=nG4Qrm3b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229993AbiJXMKp (ORCPT + 99 others); Mon, 24 Oct 2022 08:10:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232920AbiJXMJM (ORCPT ); Mon, 24 Oct 2022 08:09: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 2B73D7F103; Mon, 24 Oct 2022 04:52: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 0CD44B81189; Mon, 24 Oct 2022 11:42:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60902C433D6; Mon, 24 Oct 2022 11:42:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611770; bh=8H+uTc4E0K4J/eQoDSzzdT79Tzi3OZ89S9QhamJF0WY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nG4Qrm3bMwubZvW7CIGhm8j+ViS5IEg4ts2wTkUNNZsPQl7yK3j4Q87phVHGMZETy 5hgYpnjb31nA2CmOxwh7mYPD52R2kOgbm2VKrUTiMWPmH3/bljH+M2T5bDw8q3OuPM Z3yL34fCF96ep8B9xuUalFSlHVkitipGPFRunl+E= 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.9 104/159] ata: fix ata_id_sense_reporting_enabled() and ata_id_has_sense_reporting() Date: Mon, 24 Oct 2022 13:30:58 +0200 Message-Id: <20221024112953.236608165@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747571276549795189?= X-GMAIL-MSGID: =?utf-8?q?1747571276549795189?= 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 fdb180367ba1..8e5e7bf4a37f 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -777,16 +777,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: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: 8458 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp402609wru; Mon, 24 Oct 2022 04:50:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5inwQYMvvkdX0UgX3A7JWxEgkyHb3x4Lco1ZSqtHIkEcIXNqyGI+EF/dQCK8xB8n9WsP+m X-Received: by 2002:a17:90b:33cb:b0:212:f276:62ce with SMTP id lk11-20020a17090b33cb00b00212f27662cemr10791114pjb.149.1666612223639; Mon, 24 Oct 2022 04:50:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612223; cv=none; d=google.com; s=arc-20160816; b=eEmnU7GFP/tpsVVtd72TiHGHd1ZiOYZR2PTvtB+P4wkGFZl7v5+vpXXa1hlgQ84AQX cCZH3KRRcM5h/sFtOp5ZJVXGHu9gSr8kVRlNIBW0GFZSakU6LHYL57TWRA1hdTePahxk sgw/Jf/wdqyyGSBZ8IH8xPu9xDYFY9nsYz3km5kL8zDh9sJvYc/8fgaQtHNvDHUDq0X4 5mOaEDK1mcUnfvcAqMGiqDnDWJBdlKyEbFxOpfgGdp0tJ8um1G5t+jXiKawITV231DAs rPYMzbqZphYBcoF5lkgAo7OBnj78Zzez7CbJoq7keNy6JoGVyNcGdJwiTURJCCQ0gQdf BMfQ== 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=bU9QKpUp5Gxgei0gi8ChwW02dKFlqf/Zz35OxBTG70Q=; b=lBZGFXHVfNg0m+XKQzrhTUTp4RtOUPEbahzdHpYKaEw77VboCZb8TuSVHz9iZsQdQs XwF24UVIXLesleCLphhwq2XY5IWDhnE9gtGmPDLm396cR3R/wdhR4PjN6FIfjPKS5qXB YmB2D13gKPr8IElSFJNbV4zwMSeXfAKnkWOQGzKXQ9vqjb9WWH2WlHwkFtkY7ql2Pgdn JrvQnIGorklxrok1/RCco2a23saiQdADFQMijao4ElW/UVrAZxQ278YWIWi9x6feaiYM XSd04jGTaL14rnN0uA7Asz8FnA3ZiIdWhjCRnmddknvvdJyieJITw/N4FAD4nwcQi1Yp 7IwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=s44jVeZY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 z20-20020a170903409400b00186ac934b2dsi2222765plc.284.2022.10.24.04.50.11; Mon, 24 Oct 2022 04:50: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=s44jVeZY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231749AbiJXLtz (ORCPT + 99 others); Mon, 24 Oct 2022 07:49:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231731AbiJXLsB (ORCPT ); Mon, 24 Oct 2022 07:48: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 4AC9075FD7; Mon, 24 Oct 2022 04:43: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 E6F1A61298; Mon, 24 Oct 2022 11:42:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04D63C433D6; Mon, 24 Oct 2022 11:42:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611773; bh=6b9qQMB8K1T9HlZwNftxCzmN5s2QJzdCsETri9vqOrw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s44jVeZYHYkPpGLrHk9sUhELFEgG/BhPzgZN7jTFTPKLVX+Q40+v8Pat99QaS18e+ MHQZNz5w8PdP2D1qjfMR9R5S3eUXrjKQvm+Rk9sL9qOQNe+bjOHz4SCIdK2kpPH9S/ AlQRHdVecXsXdLpyRh8496SYtmnpF2mpAHZFF7NE= 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.9 105/159] ata: fix ata_id_has_devslp() Date: Mon, 24 Oct 2022 13:30:59 +0200 Message-Id: <20221024112953.276522056@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569579356001251?= X-GMAIL-MSGID: =?utf-8?q?1747569579356001251?= 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 8e5e7bf4a37f..315a7eaba655 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -572,6 +572,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) \ @@ -584,7 +588,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: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: 8493 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp403859wru; Mon, 24 Oct 2022 04:53:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7qYQwwzapxMEBCjZWNJTsiGaNP2Bfe/qFHlrBmvp+fmx4lCp2NR4sepRswuGvpTIEe7qU9 X-Received: by 2002:a17:902:edc3:b0:172:8ae3:9778 with SMTP id q3-20020a170902edc300b001728ae39778mr32992786plk.72.1666612417347; Mon, 24 Oct 2022 04:53:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612417; cv=none; d=google.com; s=arc-20160816; b=0brg/z3Q1kzeR5t9SHWaqb/ucgbSJMKfbg/S+oVBOVKwmWCuAy/Mg8mP9H8sDJ/ErQ j2E3QzJPeWy/jI3tLluqLv8dMxrfLybOIhHHv8W+PhHgusrOZ2SsogTmB/SeNx+gczOi XvA9nT/BRf3DusNYgyzcwI3UQo8ahXgYMuBXs0m0ADPlgtS8txj8XikOqwJ88kbMeYbz 26wL+twLWuxHshQx2xYhKrSLUswsSCO5PkBTcjiu4ybfjo2aXXx+g6K9qRVJBkmMxUgi hSqGYSCG6Lp85k8MSjn7g4V6koVz8/yM8yaHD8SSofXUQWQCVYctLmToT7fdYf0UEcOw q7OA== 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=w9v3w/M1R1qgCXE9OiKgsWEi6wTK+XTB31tAi6dxrOs=; b=aBXY73daSiAeGZsBUaFRT0Ck+JFdrwbMBCER8cIOwvLtyVt9TXpMMcTUK6ZW/FYgE6 HoHmBhJHbHmkyrZcf616MCHcOnzAWUEyqpXGmZ2EoofctUDmqzyTxlTMXcTe6QAyTRwA DKvDwfDr8E5Zr7P1gSyvx7asp9oN2jfueAJuwI5dRIHr8V6lr4C7HeuXDyXW4zK6hxjT pCH/CNaBCW4qYaMWHczoHuKfGutnOxmzqk2LrRZCupkAjeE7oSzvn+nnkp1nDluqUwzz rOGkGee4Cc4F5hjyuYXE4fjzZzKsj6ACgNXmokGymgHCV15ldHvCJqUU5j2UjVSyt3Q2 KgHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XBx9rBSB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 u20-20020a63b554000000b0046ec7b397e1si11381005pgo.759.2022.10.24.04.53.23; Mon, 24 Oct 2022 04:53: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=XBx9rBSB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232022AbiJXLw4 (ORCPT + 99 others); Mon, 24 Oct 2022 07:52:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231878AbiJXLwJ (ORCPT ); Mon, 24 Oct 2022 07:52:09 -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 89A62167DB; Mon, 24 Oct 2022 04:44: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 sin.source.kernel.org (Postfix) with ESMTPS id B4888CE134A; Mon, 24 Oct 2022 11:42:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3608C433C1; Mon, 24 Oct 2022 11:42:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611776; bh=TpwTRIOKomp6fLntnC/D7Ulvdbvpg63zN54xdtBFiGQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XBx9rBSBPIGsuTnnoIk4Yr6T/tce+kqk/+VVUfXZNFePMzv8VKChS8ox+y8AkVJbY uliqP6U1/z3FPKv9m1R8ISx9aoNQZjnTJI7jB1RSzWHedYKWycoWqedcPmoFFSzCzT spHO6wxu7ghCHbLRvacL0MH+9Zl3TxhfMoNJlsfY= 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.9 106/159] ata: fix ata_id_has_ncq_autosense() Date: Mon, 24 Oct 2022 13:31:00 +0200 Message-Id: <20221024112953.321733178@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569782142642340?= X-GMAIL-MSGID: =?utf-8?q?1747569782142642340?= 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 315a7eaba655..33e0786c3c51 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -576,6 +576,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) \ @@ -588,8 +592,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: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: 8466 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp403024wru; Mon, 24 Oct 2022 04:51:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7AMxNlyjfOWIppYOEP8AhBYlPjzVfvRIxjC1md02B+1b7777Otk4UaI2czGgYzgiDsKuMR X-Received: by 2002:aa7:864a:0:b0:53f:dcdf:4614 with SMTP id a10-20020aa7864a000000b0053fdcdf4614mr33520278pfo.38.1666612265704; Mon, 24 Oct 2022 04:51:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612265; cv=none; d=google.com; s=arc-20160816; b=PgJ3CJ9cX/gt/b8W/ZEWIOpyOjGawvvnzSPKP0RuJLCCX/usL7MV0zO/glqy+43f56 OZHundvyH+27wxW6R+/wTDf3O65fL8TqVnP8kVYpKrdCevn8Xj36/DC+TG/sjr/X8xcr 2vNpqN5NJU0Q2mDrR0wA4X9qQ6kjB7/XeS4UmIP/yzAmhYiUUwMEnJMxPCpbFdCwvbDO 1UWBlUTTMYbxJMlo/hnPnTNeLpz42Bh6Ir+I0wVuPM3c37W+PFq/a7elUliBJOfCYbFz tSKFFwTS4m4u8HjZxMkLga6e8aj9eFJuN1GlQNoZ/l/C4+3405B1EFwdHlYvfHEi/Y1Q UTIQ== 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=IUgRhL1RNHEodJ2mGvoAfE6vspIEFgS0Djj8ZsqkMGk=; b=hq+0JlfxtgCcRNeKmsRZCsTZuP0NRWenb8TomKSYa5ilBEjrsIYJtVMJ6hJahi9X/W PhBXbBnkRiLlCpUIurbESn+xLQS1vceCIq/Xzt6iZ7jHeDyjoZSYP/C9xaQex1O22aAu D0TUSjJbkOoL5UTQjJZylq6Q1zGB9+hMrqLq8sFX59SqDhrOoKYCnRmO/UASxdMRgu21 FINManMlVlw35bIyPLdGPiHXHLzxLes3IsG3M9BXpQjHoTQVC7jZThymYhZcZ6FvxiRp 7vXvF2vB4Q/jE1DMZe7oyMZRdfE/V+QPgchGsZ3FXx9JcDCr2HICbcjD4pEH9tG0Zqw4 uYVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MDFlIGO0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 d15-20020a170903230f00b0018695bddc4bsi7502099plh.470.2022.10.24.04.50.52; Mon, 24 Oct 2022 04:51: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=MDFlIGO0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229866AbiJXLuU (ORCPT + 99 others); Mon, 24 Oct 2022 07:50:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231696AbiJXLsL (ORCPT ); Mon, 24 Oct 2022 07:48: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 DAF1F50FB7; Mon, 24 Oct 2022 04:43: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 3061B612B1; Mon, 24 Oct 2022 11:42:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46CA2C433D6; Mon, 24 Oct 2022 11:42:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611778; bh=DwUTKTBu3Vkn1GKEsjPmURRnRrw+tMBZsDje3CH5GyU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MDFlIGO0hjjHDwmAHbb4G8GMHE1FzuYnXXPoqThutOSl7IZWlUIgeQ2K3W9DD270f j5oFppUgW0MiPzZWaW1L2eR64y6bSqVD2wVv/VZ+XoDRvnjo5Ve66P0S7Dk4iYiwyJ OYzTRKYj1DE7001GY5ztNWbmyyWtr9kFRSjD4VjI= 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.9 107/159] ata: fix ata_id_has_dipm() Date: Mon, 24 Oct 2022 13:31:01 +0200 Message-Id: <20221024112953.353582488@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569623146006632?= X-GMAIL-MSGID: =?utf-8?q?1747569623146006632?= 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 33e0786c3c51..33bee000ddab 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -580,6 +580,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) \ @@ -603,17 +607,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: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: 8485 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp403608wru; Mon, 24 Oct 2022 04:52:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM40n5h1sLUb7IyIYxQT157PfZOFult3LKU6SF9WSp/EFaROzPWMcz4PlQHcZQJjSPCiaZkP X-Received: by 2002:a17:90b:224d:b0:20d:8828:3051 with SMTP id hk13-20020a17090b224d00b0020d88283051mr37208808pjb.89.1666612366674; Mon, 24 Oct 2022 04:52:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612366; cv=none; d=google.com; s=arc-20160816; b=xsfWvylL/+qsgIU5fyYpa0BVVoqgxGvCsAbi9tnzZhoZrhjU0LJh9x4k4gAtPbLg2I 2agOLaFQXtJ7ybvqwSmdN/p9QHn6d1eM+7K56GI13hmY9KTBNNa1z+ckPBnXBkVLr54i a9+EhtN5P+iMhMvUR/eKcc41vVQ+pc9N1HRkqppd9Y/sryCXxc0lSWOl6AF7ASSauZ+3 FxVmmr+SnQlQi62vm22QuTLMwzj2jeSex9TcKRZ1bgi4YERQCOIFYWZFNZXFFRsjUPFO y++3UBv3ofFbR0sO8HGvVETEu01SM75Q8UsGiign+ND3Y0iI+sBMEAC3ziq/AzVUz02P FNmw== 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=S/l8vtVnTZEeeHK0MzYhcQOV+UCtJYCeqEKc+x8Pj4I=; b=0M4QntoYbTfYU+gIzyDYRBfSck+vrbGNm8wgNu0qv2MKFk8EibeZyNWjo8GNdxVw2e fSVO5MXtl47s/tOMO9NJKwjMKofNkSbxyyoVi5tjRimXa31SDcawKbqELdIwOstPDBvH hNyUUBEPaTVB8LCM9WFkIjhmTKyHgEfKAzUGQCRy0/y9l3ZIsgHvY4Oeokt7kmH5XMZz h9yezxJADghYYV7CNX/fRA73I5tkhE/a1CIpB2IqqnAaNmQHienxbRPYWJF3U0E2BObM +4vjHrXeLAj1bymuxQ5uW1EKyqP1BHEnnF1NdtN8doyRQCUKY9isDs6O4Vlt9C1HC1yK oQzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="t/bOnbj9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 y15-20020a1709027c8f00b00174eef66680si32351966pll.120.2022.10.24.04.52.33; Mon, 24 Oct 2022 04:52: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="t/bOnbj9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231928AbiJXLwP (ORCPT + 99 others); Mon, 24 Oct 2022 07:52:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231883AbiJXLus (ORCPT ); Mon, 24 Oct 2022 07:50: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 6A9192623; Mon, 24 Oct 2022 04:44:27 -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 833DEB81154; Mon, 24 Oct 2022 11:43:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBB7FC433D6; Mon, 24 Oct 2022 11:43:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611781; bh=+GjL2Rjrt+fxHkBg7wAqfLsMT5uaAxlKW2kUnp4VXCA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t/bOnbj9g9HE/GHzPMsMyeU04pFeCBTqREYbbAuQkusHLKoTd5JH4PMeLaSn66ajp EbRSXwljjK9AkB5qIBIy9NjNKTOEKwBKtxHdwj4iJwACBjRJNkV7wMg4Hi4b+kADDd YgiStnDKBShY/eurGCAtowuZfbkRoqZRrDT5hJOk= 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.9 108/159] drivers: serial: jsm: fix some leaks in probe Date: Mon, 24 Oct 2022 13:31:02 +0200 Message-Id: <20221024112953.395636233@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569728870230585?= X-GMAIL-MSGID: =?utf-8?q?1747569728870230585?= 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 a119f11bf2f4..3971abb0963c 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: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: 8472 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp403180wru; Mon, 24 Oct 2022 04:51:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7kO22Ov3LCCLHcdUZzJu+FP9uEkgCQmkb+RA8DmPktTJwQkBzUCEDIg1dWxrdLcwUq096J X-Received: by 2002:a17:902:a9c6:b0:178:b2d4:f8b2 with SMTP id b6-20020a170902a9c600b00178b2d4f8b2mr32862123plr.79.1666612289455; Mon, 24 Oct 2022 04:51:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612289; cv=none; d=google.com; s=arc-20160816; b=YltfCE7QCQ6gejUgV6XiZkLJuAe5bEwyNp1fELhCEZmkHUVqAYVsl4rPD+loeFMdQA GG8VmnDPqkQ8i5wzKoPnJs32swDyaU5AnaW0E3tlS+ranpOi/hyKLLRF3VpkBcy0rlhZ 8oLkutRSMPZiwhtUi9RD4GzcdGYXETWjow37qsetuO89bJU1VngX7gvrdORQMEJCT43A pGbJi1onUWKjZnaH4X4TogGnKWkLz9C8Q4ByqRsfhJt/AAEBzXMW8nljILWL9CWMvW5f 54D0qnlhTJge5s99ON8efShF44QlLH7JGmVMTm9AoL9jGjOfx4sH/MnN7fYONeiy8TOE RDXw== 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=mpyfel1ljPXv+mobuJDWpv8rRhG3juJokBrMBCiolr8=; b=SXrnPvlTSXB+ZmVQVmLWUyF8PDHLARsveJQtUnTV3YUXDPIyODPrJdnW0VSz+AT64N T297LP51IwxNQLKc2LoEssG18mrSEGl3hzUB6ASdAgI9XdJpMm3Z2kRViG9PG7ugL8bF MTGAKJqJkhnGZ1bWaKrZ5phQyRYjZ6ePq0V82MC64x9kZZyfcs1t3DsardRaTF0O8nba ltQAU/js869/W7BBtz6W6EiwQEeC3wTgcWqyREkMUqpSfn9/8mrNzqlJwvb6rbizL5qb qj9e/AuqC9ypRGwzBo2To5bXJhbXp4aoYHhbjNtWPYOjdGp1p2ePuObsM/h81C+VPMZP Hzvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xw1EX1wO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 j191-20020a6380c8000000b0046b454af0d6si23670150pgd.520.2022.10.24.04.51.16; Mon, 24 Oct 2022 04:51: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=xw1EX1wO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231868AbiJXLu7 (ORCPT + 99 others); Mon, 24 Oct 2022 07:50:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231889AbiJXLtK (ORCPT ); Mon, 24 Oct 2022 07:49:10 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B7DB4AD70; Mon, 24 Oct 2022 04:43: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 sin.source.kernel.org (Postfix) with ESMTPS id 90EFDCE134D; Mon, 24 Oct 2022 11:43:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F414C433D6; Mon, 24 Oct 2022 11:43:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611783; bh=oKN9viX4e06D0KhEWdRPQUYrtQaktvqyp40hiQNA+ZU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xw1EX1wOHZIB5Vf+6ViBi2BVT9Qotp/US00NdivGDvg8/+G+8Fs9zImBH7UdzKKaL 2+jYF90MwiicqLEQLy2frsHw4FMXGps7XU6w7BuGWB02sbYzJ17t8lH7UDxmHW2QjU 1xvVfuEsb8vPiR+FRvAU/un9WL9R8eLWwq4X0muY= 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.9 109/159] firmware: google: Test spinlock on panic path to avoid lockups Date: Mon, 24 Oct 2022 13:31:03 +0200 Message-Id: <20221024112953.430987428@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569647649681002?= X-GMAIL-MSGID: =?utf-8?q?1747569647649681002?= 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 98cdfc2ee0df..6fd5f6776735 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:31: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: 8455 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp402510wru; Mon, 24 Oct 2022 04:50:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5IVyXQxaAeQo78S/HhNf2B1tpVaSjwdQK7wyqcbMGmzrwOwHh2VL3Im12DXPkxQYSadYwP X-Received: by 2002:a63:4e66:0:b0:456:b3a7:7a80 with SMTP id o38-20020a634e66000000b00456b3a77a80mr27350262pgl.467.1666612210786; Mon, 24 Oct 2022 04:50:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612210; cv=none; d=google.com; s=arc-20160816; b=GGySjcS9IsNegN9scFrpOZEIk9NEDT14uoYcD5tG3zGgFrdjqx/dODvlqiG6K5VUXs LNbM4xCrg1Bq7bXmwaCrFWLqIcUDB2Sezu9HMGSZBqaTzPnnOuiAqp0HmPw1BpYDfj77 amtG4FEdqSOZ+PmnftPlZj3zvx2zhwFjNKOnM53OvSei5sqQsde4xxYv5lrmUs/ZKw5B njIqEL7FluSeh7ou67XbkMykm/i5jni+M35qURCuAmsCP/S9tFy3DDVYuVzrt5AuB47P RYjPuswy1KvH9CiPP7PgZFuCq9jg3vqF8u27CwJTLM/EZFjUmNNccGsj9JXwyXD/OgO2 izFA== 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=TYdLUnfCji5c02z+fBA5sBo555RNA8HXEQNBKAznWiE=; b=KUK0NroHu5Hk7enSdnWTLDTDEOv1jEArFcQk9KhUZgMGLCwaKT9NXdO72HWp4sfRVg h8d0FaGkWFxKRaHbCfVFi8ZLRPUFeqnF1oXdGJlREOlmyhDNAwGbXFRI78z9D1RSA14L oF1vihVWfWnjQ0U7qpgPII8mh8D/JVYpu4uVoena5b8w0OA4Td59tj8Dlm95kMvSGVxz /pqmHg2h0FcW4GeL5szrzqCbjKXYcQQcRxsgGvNEZGRGQBQQObOkpjFT3rezTnE/LphN AewZ20qJPLFkJLX7ilDDcbnWu/bWyPfDQvadyTLysq9qYILpSmDYbH7KZikPsOSm+zL6 KPeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qbsmyALE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 ob15-20020a17090b390f00b00205b268cd58si10103146pjb.181.2022.10.24.04.49.56; Mon, 24 Oct 2022 04:50: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=qbsmyALE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231793AbiJXLsw (ORCPT + 99 others); Mon, 24 Oct 2022 07:48:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231261AbiJXLrx (ORCPT ); Mon, 24 Oct 2022 07:47: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 6EB2B1706B; Mon, 24 Oct 2022 04:43: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 ams.source.kernel.org (Postfix) with ESMTPS id 5A666B81145; Mon, 24 Oct 2022 11:43:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0A5CC433D6; Mon, 24 Oct 2022 11:43:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611789; bh=SjBV13h7OzJpyXQwlSZnCR0qpzsc4VJNxnMghl2pOgU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qbsmyALEywJ1ky/zCVBXmgW/s3o/tvb4pQ1dI3EfWevsZmB5ql0XRIPn9XnNmGDaE nsLOsaKmWpZ0s3Dtn0Wq5D4Und+Bo1Hazyo6B9e+7GmP5COv2usnt1P7fkJw4FoAlK Pixu90uqza/p81fQ8W4T9uQrTf6mCdro6xgWxlCk= 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.9 110/159] serial: 8250: Fix restoring termios speed after suspend Date: Mon, 24 Oct 2022 13:31:04 +0200 Message-Id: <20221024112953.469428340@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569565619860078?= X-GMAIL-MSGID: =?utf-8?q?1747569565619860078?= 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 d337a6d02282..b461cf2cc2ca 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -3146,8 +3146,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: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: 8459 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp402801wru; Mon, 24 Oct 2022 04:50:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Ix7UO/DvixWU7bHvPJC74pYPbejy5qxKt8Yy54u04TJ3FDbvLQ3JkxwPxfdqHg8Zx53QR X-Received: by 2002:a17:902:748c:b0:186:6a25:b6a8 with SMTP id h12-20020a170902748c00b001866a25b6a8mr20384862pll.40.1666612242069; Mon, 24 Oct 2022 04:50:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612242; cv=none; d=google.com; s=arc-20160816; b=HXma2XgkhzNFWW54+ubbeEx9+SWTpVtl0KvA7Q6GZeAwIQFHr4iZOSXzeelZv9nNFQ DsXZCEmQaD/AL+RFdXK/hcXVEYyfnEsIi1oX/JjJ85BT9KZjj1w/rZEzSBQgU8o4YJEl m175nbkJ8sriR5x+EmhpHUsw7DLdgVEVyvSa7ifzYsopkgQDPQcoGFD+ZoVrCQVx+Q/D STHUdcEQwmnAUlFyNzhi9mWBRgfQVLUp/1D2AuKcZu4vv8didenVmFrT8mum2uuYc9Ib r/1em4p6/s3r5jgV935kxwc4FLP4eIEmQqN1h05npSxWdtX7s2o09+YZNyNz/7nqcdU8 kJww== 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=RN18VPapSo4RmrEqRNTZ521hopPHnIc8DvOFkR4c/ao=; b=JhAY7LPAKSB+rec6t567TmvvuObt9GvAXGVqgH53Qj64J98Xhqp72W8JNzSQg2fPBJ IQm1PhaFAsiisdquoGGB+l1l0uOD/XbpVKWIFpbrnDgZUnpycreRaQzysjFCqM6y5dGE h6vWr43Uu/DgmkG6xso2mUihjVijeyJHngSXS7NasF+tDGr5Kx/Vs9hjE/3NdXw8ySsr Oh2J5COv3OOf0oTSmeWvATloP3pjdxtHyXCkrc4mmucsiJOxz0cTh5+sxAy+QMEpSN73 QfOAYfR1lOrEgBcIYw3jAElQGeJRbQc8lG7d7NjQkzXQGIiq42dDtYr4DIjBi7X3EOiS O0bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="P+t/zJBh"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 o29-20020a635a1d000000b0043f06af773dsi34923113pgb.33.2022.10.24.04.50.26; Mon, 24 Oct 2022 04:50: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="P+t/zJBh"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231803AbiJXLuJ (ORCPT + 99 others); Mon, 24 Oct 2022 07:50:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231743AbiJXLsL (ORCPT ); Mon, 24 Oct 2022 07:48:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB33351414; Mon, 24 Oct 2022 04:43: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 386E3612B8; Mon, 24 Oct 2022 11:43:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D66EC433C1; Mon, 24 Oct 2022 11:43:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611791; bh=qyPKBhptZLK8DelWc0viy1Dy4e9UgeA6goOXR9m28iE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P+t/zJBhYbULSxjC3KA3tBWzKlxeHDrPfxkWmoqu3nV3uME3W/jXDfUt0UOQBlcBI m24NMl8ezZCZR7sUtK4Sp2JsAcq0GDhQ/zZy4lJ0evI03ZxKyTIPxlLlCCvFCkC28S QkmhbiSzQ/YPYYGtn/yxuveL0Y0aMSzRKlP/2gMo= 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.9 111/159] mfd: intel_soc_pmic: Fix an error handling path in intel_soc_pmic_i2c_probe() Date: Mon, 24 Oct 2022 13:31:05 +0200 Message-Id: <20221024112953.508551717@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569598292928077?= X-GMAIL-MSGID: =?utf-8?q?1747569598292928077?= 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 12d6ebb4ae5d..e233585645b9 100644 --- a/drivers/mfd/intel_soc_pmic_core.c +++ b/drivers/mfd/intel_soc_pmic_core.c @@ -118,6 +118,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: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: 8487 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp403724wru; Mon, 24 Oct 2022 04:53:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6neAGMJUERUnxXa7euQfl6xlaqwpDAAcTwtm6kPOKQktYZtQxrEj+HJl7q1PH43OOxTNv7 X-Received: by 2002:a63:e52:0:b0:438:ebec:363e with SMTP id 18-20020a630e52000000b00438ebec363emr28172224pgo.437.1666612389245; Mon, 24 Oct 2022 04:53:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612389; cv=none; d=google.com; s=arc-20160816; b=PST38xZmUC8goIotL8SRJmDZMky9F6ONfmOTD2tUgsHMPO0dUevSS0XATOnWhGtqnl w0vlAFJRjgGVcReKxccPYQi1YTHBBNuIdKkOK3UH92wCHwD/MxMj3NqXqR10H3FjXUPi COnNDJnCtZs7++2UcVMto4bb3hEZZse6M9GPb1hH+SnWjnxnBaZkJq+J8F2yGaptxyi0 bepRy3Df76OoJZxHj2r/iELB5wQ7lXva0Xsdqlv7QQbPj2FBl3wMeC0B+hHtBiqndWVK v1tRu+eZ4WOqql0GxAi9SwcdYlWc1KbHkI40n2k3KYv8COSJGRLFb1EyVm7mBFSuTqXn RfUw== 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=diOanVMf8fS7G+ZFHxh8IS2KMgD7SJbOACUwF+wMKeczj3bcRA3cxmOHsTUFZdZjbi fqcxeTaNb2lsvDuqZedBuopIbdttsknKpS0lk4mCqeomwohLc8JDICsVA++CnA1gDPrJ JcFob/KzQbNufoTnkeDsKc7b0ibyNDTM+WgffkC8vOmx4GuKnAGmY6DEVuk0oBPtKuFm UHwDFW6lIPum1550qExtFmAQq756x+GnboI4B112sMyj4BHFWRi37dOpiJ6/6F2V+IeH eQmy4omP7Y7ouLGJ7m2o7OI9VYnavhjENapgvoT3ggp/dGtlUR9j8wnUF1YC1pKdZ6Ru l8SA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=m3KbnQI6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 e23-20020a635017000000b0045a6c6c559bsi34566028pgb.305.2022.10.24.04.52.56; Mon, 24 Oct 2022 04:53: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=m3KbnQI6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232039AbiJXLwZ (ORCPT + 99 others); Mon, 24 Oct 2022 07:52:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231907AbiJXLvD (ORCPT ); Mon, 24 Oct 2022 07:51:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A14021A8; Mon, 24 Oct 2022 04:44:27 -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 8A62EB81151; Mon, 24 Oct 2022 11:43:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDEA1C433D6; Mon, 24 Oct 2022 11:43:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611794; bh=7Mf8pAymLKtC4kysmJdpY7SrgzbFoAL52CT2NFcnYPE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m3KbnQI60kOsMSBkPkEquHR2eTX3FcMN8fhDElSYGE3j5iH9+N9cqlpM0Wvixoo4s rmINt9CjBoZXdad9QYrCe9XK81fQitrCZ7nMYNNqftjnvyVh0dEHj0BWzUwBaEHhA4 R3ANZDA9oN9HdOWM1dSiZhsDJs5AJWkuCPULivCk= 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.9 112/159] mfd: lp8788: Fix an error handling path in lp8788_probe() Date: Mon, 24 Oct 2022 13:31:06 +0200 Message-Id: <20221024112953.555782463@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569752788295034?= X-GMAIL-MSGID: =?utf-8?q?1747569752788295034?= 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: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: 9584 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp528151wru; Mon, 24 Oct 2022 09:01:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4xBFS//x20FntgfZLV5XXmj39//ddgJ3TtKyoy/3oXXMHt0C6md6hAC4QdzQRYUioMLQLw X-Received: by 2002:a17:903:2d0:b0:183:ba7f:a67b with SMTP id s16-20020a17090302d000b00183ba7fa67bmr34336174plk.42.1666627308985; Mon, 24 Oct 2022 09:01:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627308; cv=none; d=google.com; s=arc-20160816; b=oZjrumpA43ecpRbqrN86e0kmNFjzMklkuIVzwaj8FMIpGjsFxqXRWN4TjWQX/Wo1cf ckuAC0jwcnKFCM8vyQ6LxONne0zG0bQt10LfoFSDXcqMJ/kGyyo3nx1oblaUT3FD74P4 WectEVhkigZFC3FFsUXMGyUinuS9ZLtwYvcZszMHIkMCZYMKNj+o0gW8+5+SYs86/lq9 YRGIlfFTp5jQYJDu/GSHzj+iHslS7MDCaYYEQ2kuOWpwHylUdcSJXzaWR3RQZ95+lziy FuoGqV8IqnQpwDSnOa9KsXS8Hog8FepNeNO8ogWwYGSPCdLp4jktByzaJog9h7RnrgRa 5b7A== 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=EmOL5Nq4DrKEVL/70AwzYIslWO4x3MHfOtHxytcn3uzVn3OsK3FGio3drFwRG37YEW IENPLCmQK902GGv3wyhAX/VaXsQh8Zpa0VDjX6qHNHbKXOLlZqL2cC3SqeR62lIHqzyr 88G64+9jcGVO91NNf2jV0geJd8ZODJxEalH8EqQwB2tavBvMHHqCl2Onj68se9n5qI9h AMMytH0mpjs/nrB9k4gPA6uRYT30bKX1HJN2eFEOUv4Y08iqzsqck0k54ciqQf+kh7Ol QT+jzSYITdsYY5R2dvIO6JdaqQNe25XpGSzCpykXgHlgqoCynvEXWtgZnj/XaPYSeG6b HwPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jHIstq0c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a638343000000b00460c07c5542si4143667pge.407.2022.10.24.09.01.33; Mon, 24 Oct 2022 09:01: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=jHIstq0c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231748AbiJXP6E (ORCPT + 99 others); Mon, 24 Oct 2022 11:58:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231642AbiJXP5Z (ORCPT ); Mon, 24 Oct 2022 11:57: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 AC3C1E26; Mon, 24 Oct 2022 07:52: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 ams.source.kernel.org (Postfix) with ESMTPS id 980EAB811A0; Mon, 24 Oct 2022 11:45:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E15F0C433C1; Mon, 24 Oct 2022 11:44:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611899; bh=+IJfdwQZHLdBxmVW+3yGX0T13fs3Qxpi0bql/8osMgE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jHIstq0cNdlnyTgeP6U2vXmE7B1vitDwKZwqa5S9HgGRG5ZHimQOgqrYnUQO9JLBM quQFz80skLh30mzSEvakGPZ4bvby6h28NHdz28hx81rTjGhaggIZJbgTfaTjJNLx24 UkUZmEOMSUPxacOsZLRX+/tOL0IF0/QpsG24qxyU= 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.9 113/159] mfd: lp8788: Fix an error handling path in lp8788_irq_init() and lp8788_irq_init() Date: Mon, 24 Oct 2022 13:31:07 +0200 Message-Id: <20221024112953.596139680@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747585397185447363?= X-GMAIL-MSGID: =?utf-8?q?1747585397185447363?= 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: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: 8474 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp403323wru; Mon, 24 Oct 2022 04:51:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6P2LinavnJ0mGWzcSI47VDsUpxkdDJW0RIz8bev0yzti5qPnc9Yv94uuPqMKZxmy3mypMd X-Received: by 2002:a17:90a:5892:b0:20a:9cf5:c13c with SMTP id j18-20020a17090a589200b0020a9cf5c13cmr73258917pji.63.1666612312161; Mon, 24 Oct 2022 04:51:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612312; cv=none; d=google.com; s=arc-20160816; b=jIOu/xFsehi7EoKfjA930iH/ECEgomhl5QQpYzagzWypncuCO66rtaLmRlu8QRWBJY w/8ndKr7JS5WJH3bZ2Y42tf+f9e2nRLOzYwjXRf3fw/ogaPBx6+FG8uwDVtj42it/7Y+ Z6YC1X0bRlmPcNi8CRyuLHo2sDt7TZj8bwFBjoymh+pUrT9fvLMUUuqfnISEyHliumZf 2Zm51P1noeQln56dQEyLsqq7lG5EuTBcUtLKKnmhLbMS/DomPGGjjf83z9REp4Gf/AEq Uyns+Nl03fA61Qc54/0nJQDkPWJYMDJRQBRX13oV1Z1R6S2goqKgNOwzoAXc2VOXkZSw buJg== 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=A0f3yCsuEuwWfNoh8rF3+i4LLapvzV3MtcLScraKou/npoImYi+EA4nifdfXSxE5zn MPnk82Rs5lfwPiH/TqQSBgAD51Twuhi46YT4x6ss2k92zPXIxjYPZtidfulXjSwhTI1p GlfayySpK3kHe9EqDSodi3xPIZeYmQfK5LKTXbToPautw4wgxHhPv75DvZn1yn25GRwK Pb2siDgrOw4vxFVem6p1LuXxTxxnc8o7z/XFnG4mhQcoKmlwIJHcSflifWah7Dn+IQqf jd3x1/CkTelzrp+wpqJIakBDZ9NVA3md5F1ty3i0LyXtvOc7Z1GYkDiMe3u6M0cUiU+m 6QMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dZpVN1oU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 m20-20020a17090aab1400b0020d48e8ecc5si14272905pjq.115.2022.10.24.04.51.39; Mon, 24 Oct 2022 04:51: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=dZpVN1oU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231934AbiJXLvI (ORCPT + 99 others); Mon, 24 Oct 2022 07:51:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231936AbiJXLtP (ORCPT ); Mon, 24 Oct 2022 07:49:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 697D439107; Mon, 24 Oct 2022 04:43: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 ams.source.kernel.org (Postfix) with ESMTPS id 75BBDB8118F; Mon, 24 Oct 2022 11:43:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1589C433C1; Mon, 24 Oct 2022 11:43:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611815; bh=BNOQsYZF/K2e4NRppXGPLidezNtKbq+7MS1OWtou5uY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dZpVN1oUDym7o2eBDli4jCycKo4QNjhPrJAbEDxR4MoyncI5eZ34VZM4n5dKLgpCk qc96e5VcMFHk6yO448N9TQwi8YyFaUyVgJFyaMCCV1sGFYmvCCc/0MzHAcjBX0K9cT fPaTxg+Pnta4BdcGkOd3+VUqv2tqCoU8BBSbtox4= 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.9 114/159] mfd: sm501: Add check for platform_driver_register() Date: Mon, 24 Oct 2022 13:31:08 +0200 Message-Id: <20221024112953.644066781@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569672174801463?= X-GMAIL-MSGID: =?utf-8?q?1747569672174801463?= 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: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: 8482 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp403503wru; Mon, 24 Oct 2022 04:52:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5T93n1IV0KiOcAnV/jFrQMe1I12BQZlTLBMDelzFTRO8mx8kuzAQqZeqhQ7UychytMfAOB X-Received: by 2002:a05:6a00:a96:b0:558:8915:2f0e with SMTP id b22-20020a056a000a9600b0055889152f0emr33088162pfl.38.1666612346576; Mon, 24 Oct 2022 04:52:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612346; cv=none; d=google.com; s=arc-20160816; b=OCBLZRC/pXVm3ifQhT9CR90QHx1spy/TET4Lpg9z8iVJ8LXg0TGA5nlOXOpk548a8H FbJg93jVxbKQL2WSi1POzWliu6ybkn8Evk/obwe71iZL1Ztho3ClH9ZP0FnDGKqtLiQS tdU1ur3PaotmtDNkwqr2OyM57/akKcDfNSLF2DebHrL+YAMmpGf2SYWjl1l6MzwNCOUq omjMTf0F7b2q1UL7uibWBZEXDRvAPhwMk6cy+vxQhI7BP7C0wMq08zXI2vS2Bdu9UVWU VNJ1n419hBqxQpZkGG4fP+GriZUClROru5vOifoQtR1CmVjChgQAKnNw5e+nHmEVtkhq mttg== 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=Ds4Q8tgJjQLjSGorEB1wtIaCs6yJcjGMTJK/AsJ5shg=; b=EfJee8RKQxF9R8Upgue63sl+K13OdgpPPtPKm0qoMHOtt50/99gSMe1VldayqoYNxT FS+fqy932Is0wyNY62NWkeRN3So5rxYmRiMnZhgq4JXKjmlxOfXxDlrIEK/7wyZbWZLp wnzN/yWATIYs91kS/jhq/5Dclbhxly+kF6uAn85wbHsxMVpK7iNrM7wb8au7ZYiHzZ3c iZqsSkI6kD5CKVsEN6kZIQGNQE+m2JG60E18cQ7+uVzSZIV9cgrDBwEOi4AKZBj8g4NI PeRlcvPdy9jGPNC11E2KPFOhZJxbLgQ1o3v1JTNyt2IhLQF3NPAtA0pxPCVQSBzXROgU 6bEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=scHvUF8p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 q85-20020a632a58000000b004394687b653si1961857pgq.253.2022.10.24.04.52.13; Mon, 24 Oct 2022 04:52: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=scHvUF8p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231992AbiJXLvt (ORCPT + 99 others); Mon, 24 Oct 2022 07:51:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231633AbiJXLts (ORCPT ); Mon, 24 Oct 2022 07:49:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 336AF6F26C; Mon, 24 Oct 2022 04:44: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 97488B8117E; Mon, 24 Oct 2022 11:44:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5723C433D6; Mon, 24 Oct 2022 11:44:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611844; bh=nKGmevzLQrtXkEM6g9KVEPyNFfuZdgp1sbhdc2Z129U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=scHvUF8plp3yE3SNN9RE4q9A6nEmmyyJikbU2RbGSGT1HXrb1jn4/3Nm3sU6h7TkW hhHLf/rVaO5SNXzDQbzbdgdYQLOzattgjbZsromtMw5cSRXOm+AmiUJ7duTevJofFG 4ciJrnL65R/h99cTuARMpmJdm2HpI6eOELbSmdBY= 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.9 115/159] dmaengine: ioat: stop mod_timer from resurrecting deleted timer in __cleanup() Date: Mon, 24 Oct 2022 13:31:09 +0200 Message-Id: <20221024112953.683101678@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569707860124394?= X-GMAIL-MSGID: =?utf-8?q?1747569707860124394?= 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 c5a45c57b8b8..36189a3337b1 100644 --- a/drivers/dma/ioat/dma.c +++ b/drivers/dma/ioat/dma.c @@ -663,7 +663,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); } /* 5 microsecond delay per pending descriptor */ @@ -685,7 +685,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); } } @@ -877,7 +877,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: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: 8511 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp405333wru; Mon, 24 Oct 2022 04:56:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4qQFDgSelnulrjBB6kmCS+Lt/zSip+2T0Bvglbwj2QUEVCuW9HpP3+tr8A/yTa5tr7w7Wj X-Received: by 2002:a17:902:6b0a:b0:178:9a17:5b89 with SMTP id o10-20020a1709026b0a00b001789a175b89mr32099014plk.113.1666612609602; Mon, 24 Oct 2022 04:56:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612609; cv=none; d=google.com; s=arc-20160816; b=DAygF90ymv67sIV5HT989nx7+I0KEqvaSqrz8Y3OcMdcoLgTYyOZoin1M64HzwXafG YeW5Ru/WR5F3QLHeoN9Kd1hftQ9oDMz3hWTvEIrzxe2Of0pD57Pqil0pNf7vPQVVjoBI 623ikX+G+eef8jdRSGDEdPugQ8T3HCK0YfKcK6l2HZllzf0lS9YMTnw/fjE8qyA2//ht qcREm3Bc8TFTU2MMQugGM+X/+Gt3epqY+FmN/mz94yXgvUPe4yYizAwjsIV/F6lPs2zS vwe1rg7riPxcqmIknohsI9WvVxhqlw+/NEDNjbpGq6VFz9iws3xlwIL9fgAMxuky38X9 gFsQ== 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=9jxBD9FpqrV0tGW5/OAZ/censysHy1gjWvhw/RwNWbk=; b=G+RrFURJfrTFu/qJZASR2e9wQk49sSl+We/9jTZcB5gWYo1Cu7+p9RQOpsrkJc8V/m LH04141xxTKIGc3BSitKYQkBRKUFQidDevTWbs4dgTRhS6VDSITnWG/DePHDDqax6b8g NyRt4nccDTyxGnfvX7NcxI3JpXo3lLwQ4rnOi/aKJE2u+b5MEHDy+pjznMG65UU1cJDr jx2TUw9taHzdf0Sh0KMMdJ4zph2sj93VojTMnLVkXW+g82cvXBPX3DSwfHojGOUVKp4Z 0laS4CRBEk/1BNmkPxElECAOKXTa11pmtqfWtS0zOobsUrPR0xqxjdoTgX4P+X4hJcqS mPuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dM8j2llw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 t27-20020a63225b000000b00464858cf6b1si35194545pgm.192.2022.10.24.04.56.36; Mon, 24 Oct 2022 04:56: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=dM8j2llw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232174AbiJXL4M (ORCPT + 99 others); Mon, 24 Oct 2022 07:56:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232526AbiJXLy4 (ORCPT ); Mon, 24 Oct 2022 07:54:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC56C77397; Mon, 24 Oct 2022 04:45: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 ams.source.kernel.org (Postfix) with ESMTPS id 49D9FB8117E; Mon, 24 Oct 2022 11:44:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97EF1C433D6; Mon, 24 Oct 2022 11:44:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611872; bh=y1wRZcbuvsbN8CUT6eBVlfuApor1uiSqqouwpoaDWTc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dM8j2llwR1gmiIDe2nBLjb2wYwq1x1O0s/z+SKoyh2NKILHwNZUR5N7OxlCfdd3RX KmdW66MBBtkIm8PYm/Y2JnN4zNJPbHsgqxFl6A9mxbwS32VzmDJ7Q2puIeY2ySjsm5 qA71d4KWOjyWkblZGHt3ZxGHLX5Ly2w/SB+EQXOc= 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.9 116/159] clk: bcm2835: fix bcm2835_clock_rate_from_divisor declaration Date: Mon, 24 Oct 2022 13:31:10 +0200 Message-Id: <20221024112953.723975632@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569983971521471?= X-GMAIL-MSGID: =?utf-8?q?1747569983971521471?= 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 3f16b553982d..87cd8fde3a02 100644 --- a/drivers/clk/bcm/clk-bcm2835.c +++ b/drivers/clk/bcm/clk-bcm2835.c @@ -902,9 +902,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: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: 9587 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp528596wru; Mon, 24 Oct 2022 09:02:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5WsraFuyRlS0vh0tRA6peTjDPBOkV8Ah22Jyy2o5MnZdWFq7CUFmYjI41NLLw2Ux+QSY2O X-Received: by 2002:a05:6a00:140d:b0:528:5a5a:d846 with SMTP id l13-20020a056a00140d00b005285a5ad846mr13180491pfu.9.1666627343358; Mon, 24 Oct 2022 09:02:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627343; cv=none; d=google.com; s=arc-20160816; b=ATI2QlGRQskJ7td4DSEvlsTykDKjw9WmJjjYuI0ISxQMFFOEPqmRplJ+/iqi9l+HtT 6emsLdxxtzMTmXueUCsLpzsLBBOx/FPKJqdLZsQg8p6AQ/guZ4/9qolrPkj+SCl4ZtS9 zmwRjjsSuqkc5yJDARQEUBn/b/hmNzhA5tQT4ZsxBzzFJLhsuyhCVnU7dDxrhXb7X7q8 +ra1szqZANyqwUXOYm+O5WS0Uy0FFjx1gZ+P64qu9ORUcx/mHaQKYh6q0HyfzdQg5unQ JZrGodCTKL6BIbyvoBbQu9xqGqAEPMOXlJSCdzK2m3XFLoUmRC9d4HAZ2kjVEaEOHXAe fd8A== 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=4DZ2sXle55rsbx9Pvh5pboZ3RE4XNALU9zscxcnPiWE=; b=UnBkGx47Vvcnau2SXcnqH88lMOKbBUU/PjdlYCuiI37FiVEwdliVWF7sm4+iBfVPcy DuBcbfB0wxb/0wqX5bF5SJ4naTIPe81+DULt/Zf54SxVKC52nSnC6z5Hw/JURCgWco0d qMDwkDf3J6CgopefusyTm+3182CirJ6eZ5KF9BtUAdS0t8ZDLUyLrfr0gOC0bb6bWTmi 8eWt5cCfnK7j/wUMTe9gYWPEug+/OsoO5lQY9Hnh06Zt1/U9/QW3VeNYN1CPklJODOvP zZUwKvduw8JwhLWI+OT+Z75yLaCP4DSis7dGZYSjnMzJVXeZP3t1cIeHRPNoAtDqXRoH /8Zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DIKO6Fwo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 g13-20020a170902d5cd00b0017889771a05si32362182plh.566.2022.10.24.09.02.05; Mon, 24 Oct 2022 09:02: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=DIKO6Fwo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231249AbiJXQAc (ORCPT + 99 others); Mon, 24 Oct 2022 12:00:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232452AbiJXP7E (ORCPT ); Mon, 24 Oct 2022 11:59: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 AB9F0AA372; Mon, 24 Oct 2022 07:54: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 BE072B8118D; Mon, 24 Oct 2022 11:44:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 235C1C433D6; Mon, 24 Oct 2022 11:44:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611883; bh=xnZ+hfZhsqsSL1RT5Zrzd/2FlzdEfr8WWwLO7c/CQn4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DIKO6FwotRjLlj69GGN/WJilr2Hcuijz7q8n2F7fCEBuqPv6WwhBPSIGXDFeaAiJ5 K3ZpPHYVio2xjMBdYiJd3WgrHsKA2W4gMJtHu1xHNjHtBkg2aiUAgaL3u6PmKk9WDE cwp115k31j6VJW5sYlVfrxfCPuKMCXTjvkrdaqjo= 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.9 117/159] clk: ti: dra7-atl: Fix reference leak in of_dra7_atl_clk_probe Date: Mon, 24 Oct 2022 13:31:11 +0200 Message-Id: <20221024112953.765014334@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747585433008133186?= X-GMAIL-MSGID: =?utf-8?q?1747585433008133186?= 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 7d060ffe8975..9b1f9af35a23 100644 --- a/drivers/clk/ti/clk-dra7-atl.c +++ b/drivers/clk/ti/clk-dra7-atl.c @@ -249,14 +249,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)); @@ -289,8 +291,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: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: 8526 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp405936wru; Mon, 24 Oct 2022 04:58:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7UUupb2myBm/MVyW0fBqRufrt4k9eTMgpl2JM3X5BEU8vgVziteBtnb32iiWvTPpNkbDv0 X-Received: by 2002:a17:902:c189:b0:186:88bd:42c4 with SMTP id d9-20020a170902c18900b0018688bd42c4mr12765305pld.0.1666612680424; Mon, 24 Oct 2022 04:58:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612680; cv=none; d=google.com; s=arc-20160816; b=oTior2Q7ratEEmLsQBPR+foxpXNY+tVxthiu6xhtpwtfGtvDP7Z3VxmSkkdhNDbEQq +MpzW2rAHKoV3Ntb1RWxRNAymCHZ4G26SXSV+cOTNmOGnqQqkTuWpeJgW4tF6PISE+Tk TJZBuX40jeED+uZRBdg3C8cRGY4E5Lll6Tkp4qnALKG8e6/5PpqakWruGFkukRRUMRBP kyIthCwY4MJtAOtJrrq9hHuy0ZvA1cozev0nlh9BMn04LSFQ3TIk7HUY4mHdKLetqRcc NJP5fCNYF+91UllUbrUdWal967uzpCH7d2q0A1LjIeHapq+/ESjrEqVqyXCzY3nxJ1u3 WoOQ== 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=YNu25u7q2VhL1zx8mWgF8l8MsjKRozPPznHk+McWQ7g=; b=U2vHzt5lSlug7c+1onCMReSAF0CeyWHLwv46dreGglRimU07sgIwdbS6VIE8qYBHDX 8LsBQDKg25b7ZZbW91bpxLtNa4tA21tUWPa0kO7NeXOOmXLlnQQeSyuLAmomjRzp7gqx scIP4cm6Ocv9fc346t7bt9K2nDURtk6hgrr2TVlrs/dlSjtvbgeN0RS0uX1RD7QEM2cD URK5FtkObqmlOPQEgbXQBfajzh/4YI1DOcXO7rBCj9gAGJ+cpZ/2iLHqp1rlpfoo0QhQ B1dwCA38p83tmGvVU/l8/ZsJuNEMGgNl++bkml+iZB75Gl1RIhKPFpM4j3zK86LimW/S Plvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=A68s4C+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 nm2-20020a17090b19c200b0020d3631f006si9025311pjb.161.2022.10.24.04.57.47; Mon, 24 Oct 2022 04:58: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=A68s4C+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 S232349AbiJXL5V (ORCPT + 99 others); Mon, 24 Oct 2022 07:57:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232186AbiJXLzr (ORCPT ); Mon, 24 Oct 2022 07:55:47 -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 A16A07AC09; Mon, 24 Oct 2022 04:46: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 A768161297; Mon, 24 Oct 2022 11:44:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BAE68C433D6; Mon, 24 Oct 2022 11:44:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611886; bh=bY8DNX8UOorDhqSkPBTMfcJA4H/jHKBSD5u9N8pqcX4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A68s4C+pHNVSTVf+hdfYonDyoea+og+D+PKuA15Mq89hm1l65KYurZvudGCrJE0Ez oUz5ITF+lA4cLHVXcj+4RFwvEvo9UWny/LStBdyq+X5vCOBVhewiHVdd666p5mjyLL ZcGa71DiLfdZIoV8bol5s39Pr/25nxto8BC6BRBQ= 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.9 118/159] powerpc/math_emu/efp: Include module.h Date: Mon, 24 Oct 2022 13:31:12 +0200 Message-Id: <20221024112953.804929755@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747570058235753737?= X-GMAIL-MSGID: =?utf-8?q?1747570058235753737?= 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 28337c9709ae..cc4bbc4f8169 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: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: 8833 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431432wru; Mon, 24 Oct 2022 05:43:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4fuSWG98QcSu1VlGu6JUHVW8WQ/CkeJUjLfu2KJuRwA/o5HcN4bjz54cNKmrM75Nh19z/5 X-Received: by 2002:a17:90b:2643:b0:205:bd0d:bdff with SMTP id pa3-20020a17090b264300b00205bd0dbdffmr37630438pjb.99.1666615425009; Mon, 24 Oct 2022 05:43:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615425; cv=none; d=google.com; s=arc-20160816; b=eQ2oQHP2sZqgh270qhd8UL8PSTgKsFY59PgnQOOvgbqGsg8WD1sczPy+bfRW5SRzzG VwHRIgu+RRTXsj4vHmdqQtTxC2Gdkute6g3oIgX+nJgGKGKrxQn8hb1iB4oaB5OQYOGE YwDuC34RFWzY9sUcy3r8CI+pGRrh8EuJM3QupGUP4Ggy3Ved2WIz3nbolSPULGqUCRtF h5qhija4RcrcW1OA7l1kHyLDYQMRzlbO0c8hnha8TeR4mDIcB/VlY6UUZR3oW7wW7JZP 11vTWYSpVMKz7Pvx0o5sfii1RHqSzY1EJ4pafvKvaB6uQUp7qj3P3LEWwREo8rp4mzNd PjzA== 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=VEb7XMVehScfgF2EVbSm8qjZcD4RAOy6GM4JdVGyq0o=; b=saI5kDM/EiSxcED+pSkjoaAUySlL74xRUOhVEFR84mmsK49s2zzR0wcePIoI9hZfyO ipMPubA6/QqP4bYqmkAKtUyCUF/zqVFd+kO/VAG1sQ179XKL9AcFunS4x6rH3ksQNfYq REUlm6PhpWy8gjUmdiW6LaBPfQYYCd34a6QMQEHSkrlC3sFh4qaQ9F3nTuNs3stbpt2V Xfpi/kcLow9i8UBdg0160q/MuK0PW6+laAPg7EHmnjMSD194dKRIfVYC5d9ikO3iKZWs /wKXMJPP/dzaxxQUzp5Lg0Yfgt5QJTCjRaW937gsjEgEZDNSFiclUc5juXhbNo2gC2HR NVFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="x5S1Ed/q"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 w8-20020a634908000000b0045f702aaec0si35467768pga.158.2022.10.24.05.43.29; Mon, 24 Oct 2022 05:43: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="x5S1Ed/q"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232016AbiJXMhU (ORCPT + 99 others); Mon, 24 Oct 2022 08:37:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234483AbiJXMa1 (ORCPT ); Mon, 24 Oct 2022 08:30:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C914038BE; 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 0D986B81154; Mon, 24 Oct 2022 11:44:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61EE2C433D7; Mon, 24 Oct 2022 11:44:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611888; bh=PafxsnHxx4dVwa3Z0lxLALA3Rw5PXommpfyQG/T/gxg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x5S1Ed/qZDU3RhqRdMbAohunG7U63GUW1TjivY/x1XmWPyJn1HQwZgUXSdM12TkFp joxucFO6/crF/6LGd6fiWesNIVReQbcR02wgWZfFD3CuZcG14/of9Tiz7J1RepmusU B2VSYZ3XjHSgr2VSUQIq3oFTff+RluYZXm9UcHww= 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.9 119/159] powerpc/pci_dn: Add missing of_node_put() Date: Mon, 24 Oct 2022 13:31:13 +0200 Message-Id: <20221024112953.844303100@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747572935724096221?= X-GMAIL-MSGID: =?utf-8?q?1747572935724096221?= 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 c8f1b78fbd0e..3954e3bb944b 100644 --- a/arch/powerpc/kernel/pci_dn.c +++ b/arch/powerpc/kernel/pci_dn.c @@ -355,6 +355,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:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8528 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp406011wru; Mon, 24 Oct 2022 04:58:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7uzxdV08K8tiLkoSZ+HIrmSF5OaL5F8XeEU5ncOV6QncvXdWNjcm1o1GT+TrL1AQjGM4Lr X-Received: by 2002:a65:42c7:0:b0:462:7158:c863 with SMTP id l7-20020a6542c7000000b004627158c863mr28480111pgp.590.1666612689182; Mon, 24 Oct 2022 04:58:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612689; cv=none; d=google.com; s=arc-20160816; b=DwWU+1VTqzQHz7w7l0k7LeGRbByFFmTC0sexCPc4HezeJjQdtgPkN/kQ8zFp/AWTh9 XrNOa0l3Vuu05du3KC3MDQ73Cz/yNsiRuvhW3E3JnBj1Y40rsbdQxO9C0cM5J08JSvqD TCPSyqprYk0MvSsSUZrSAhhxW5skTkRqE/whEL3D1vgw/nitcf4rvwArYOt8W0dZXo+Q H0bNlAw8OaR/sSshHeB5BGwrd0YJiC8ExH5zrf8KluCbPgQN69HXCDjaTbzZUyuPPcfN lxEt5+yknC/rcFGyVu/wF0VEqMzZMqQCL+CKQZdNf7DMprFjs8ZlvwEsCWGpCRCnIIQm Q7Ww== 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=wHW2KfkgNLLxF6ENbC2085WqxZCtnPGObH7IG0pfzM3+gP/wlQkiJRmNTXeYzMA6Cs iSigZQ6bDZUR+oKWRmeWKcmyZzvECxUDWqmv181SlgEhUO+tQhoyrIZ1BzyQEfLMx2l6 /a1+Lv+aG5b6hSejfGpaRM0Lc3hJhjjNEiaiBEm0Qovs02k3NPVw5JdBISufu+MJNf5Z l2Gx6ovucxq4P5rZesEALL2R40RBd+5H21qPYk48rt/ulpoh2Ozb/QUGTz9LeX8KibBX 7k+ZK9/xsL6pFkNH2ZTgI8IrwvAncARR8wMjNwysb5P+EY99zfQ9ESJUi0+hZNhOjHa5 /cwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XfykyGGz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 d16-20020a17090ad99000b002034e5450f0si7927873pjv.131.2022.10.24.04.57.56; Mon, 24 Oct 2022 04:58: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=XfykyGGz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232359AbiJXL52 (ORCPT + 99 others); Mon, 24 Oct 2022 07:57:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232144AbiJXLzz (ORCPT ); Mon, 24 Oct 2022 07:55:55 -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 D46727B1DC; 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 dfw.source.kernel.org (Postfix) with ESMTPS id E5BC661298; Mon, 24 Oct 2022 11:44:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03219C433C1; Mon, 24 Oct 2022 11:44:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611891; bh=b+dCW2i6SlbVAsvvFo6j2dv3TAz1oQHd4db67WosFHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XfykyGGzuEbEYg1bkXwfTCiyjA9L83NAPsXZfibDMxMonp3xA+GTOV90Uynfs2xqZ AfusgeM+cHIvg+7FxFjCOabXAv/6zQakyXyDV13Dm3+RVV2FGONdPR3SSZJUsxQ3Lr FH3PbGE730laqYThgDl9F/iNNw6q+OB+nhLF7nRQ= 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.9 120/159] powerpc: Fix SPE Power ISA properties for e500v1 platforms Date: Mon, 24 Oct 2022 13:31:14 +0200 Message-Id: <20221024112953.883507096@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747570067095678734?= X-GMAIL-MSGID: =?utf-8?q?1747570067095678734?= 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: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: 8498 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp404029wru; Mon, 24 Oct 2022 04:54:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4G7Zez0sqUFR3k/wF1saZrCrTIkTqEoFiFK9fWi0XHH1Q1cRuwqlDv234vxdGJF5dudEfw X-Received: by 2002:a05:6a00:a21:b0:562:99d6:c30a with SMTP id p33-20020a056a000a2100b0056299d6c30amr31874185pfh.35.1666612432980; Mon, 24 Oct 2022 04:53:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612432; cv=none; d=google.com; s=arc-20160816; b=B2B4/IHvoHtEviscy/aOC1FUpgvLMhUqeZjqeTbtL3YRwEZUtrfCKimz09+hUO8MMf 5S8JSTapiKQTqBA4t632koEj8/ZQ9oc0KIy3uZhs0vNoe6KfVgcbYIT8e4FOiZVoiH1+ VYbolVcftCdFaHNF6vdBvF6LYfItt91UBkTGAN4pkHBKmQmyv5pXUvJM7Ux1lluGHvdI XBUdj0nqHh7t1bne+AkKHTgZpQQmQHEl67shk/TzaFaqoIdsKpR60Ujv6XXojyRgz4MO H5oY9KKk8cnsuWojj09DmivqRlFvAPCIRdry4Fa25yPKtO5MCOEDYFoyw/3YvCTR9Kau dxcA== 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=BN9YKusNLyezuAEAqjpiHF3T+/kJ4VI+mBuv1xP0b1QPtuzXyXHZDZn95qAMmqrQbK 3nVVmjKz7JCET5rJdfk9R3Ed9rK0D0T5p7HVbPNcfcbBhbMiELpWputKKTeYbVC8wk4n KbOnk47dginP1UjWdoM6QfC0ju8BLbf1ASryuyn/24tw6//2zBTWRMy4cXlE7mgGhPou ce0mnJUx44Jo3CohT1FglODOkht4f84yAqulxUd/oJ4kGehk7t0UgAaMaq4I8jwbIcbA Br7HLmUhKfKz7opNLsJYwoNOSnyMj1lvPWJzBNpshXGfibI2VbddVBHcnGR+/uBAYXjD jK0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jZeVMXD8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 b2-20020a170902d40200b001868431ecdbsi7999690ple.20.2022.10.24.04.53.39; Mon, 24 Oct 2022 04:53: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=jZeVMXD8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232099AbiJXLxT (ORCPT + 99 others); Mon, 24 Oct 2022 07:53:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231983AbiJXLwi (ORCPT ); Mon, 24 Oct 2022 07:52: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 17DBE317FF; Mon, 24 Oct 2022 04:44: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 9533D61254; Mon, 24 Oct 2022 11:44:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8801C433D7; Mon, 24 Oct 2022 11:44:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611894; bh=oyLbuAvGHpzGiRHM5PDQER02O7OkAB/aDBnlGorzYC8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jZeVMXD8XRxbi/RBUKpplb+0/fo89KLU060cu/45Ly77tNLyLdo00oB55ZNs2kyou yOflB4flZSBBGNvcGf0Dsybk3m20zHT3b1VgKZiIm1PYKfluK+pGyOkhzU7gY18ug4 Ny7M2WyUPDKwD+vc+pvKKNyPorajuee+ZvMYYYEg= 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.9 121/159] iommu/omap: Fix buffer overflow in debugfs Date: Mon, 24 Oct 2022 13:31:15 +0200 Message-Id: <20221024112953.918265596@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569798888974988?= X-GMAIL-MSGID: =?utf-8?q?1747569798888974988?= 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: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: 8740 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp425278wru; Mon, 24 Oct 2022 05:29:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM76wH1klhHYzuXZe/QYxfW2zt6epUwCPO56l3B9o0bSRST8ieZAKlrKolDNjWzij1NdUpMq X-Received: by 2002:a17:90b:4f45:b0:20d:3282:e5e0 with SMTP id pj5-20020a17090b4f4500b0020d3282e5e0mr38576303pjb.8.1666614535437; Mon, 24 Oct 2022 05:28:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614535; cv=none; d=google.com; s=arc-20160816; b=hQ44Hk4vi0dUe+kQuE1uOPTeBLneFlsI88KUprApqNutZiFHyYDsOyMoZyj/Z/EFR0 HlEf6Obt/ymImYQ+D61+pPIlomuazBwkv6yaiETv8Dqfq72dAcafZSKH8C/rfvvEcLLY rAWxWABO5DmxACzYIoSY6BZX+rQ28bnxzDEPLy0e1AT+68iJ7L999Rx/YHivZ5q+NVa/ 3ducWG1CtiMnMntSWFQjZhGpLlUQz9Bvu/matUoaqDqn+g4xaANFrJT5hjzm0e3dX99K FNdB19JAZXb8EslPKhW6O2+XD68H/aF0ZdnglmBQrj03MWPsVNCobLLIwDHJtiBo/OUj CItA== 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=uC3wikS26ZIt7e4TppyOYkEGmmuXHsqQBq4NKPEpQhw=; b=TflSAWXi/mQBnOFirb3uJG/SIWx0xWe7/e7jF8M7UhORv24RXMdHnZ8W6RFpe1dwYV gR7UskvFF4T6EGJ9HHUMp2U7ZwUXsFSw8SZYwHnAf2cDfaotc/k0ZdkW3QbP3TEsiy9a BAiXfqbyKs/XcptSamsq5juX7ow9dabRCe/2VU3bkrDuCYaB9vjMLv5rC/Kw5a7coW8i 5i9qBvgyX7h+auzlj46IeByDWRwBktQpmvKYhYDyto7/7py1eUmgQaia+xbW9FELFN9y 7mWqRgQDuJlGGrgbXbR9d0DD5mkPZvQYD0FG0zgWmS8PMZOyslCxYjqqxIgdyRrOeqXr hK0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IcCFF40U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a63dc54000000b0043512d64885si35326968pgj.424.2022.10.24.05.28.40; Mon, 24 Oct 2022 05:28: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=IcCFF40U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231168AbiJXM1y (ORCPT + 99 others); Mon, 24 Oct 2022 08:27:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233722AbiJXM1D (ORCPT ); Mon, 24 Oct 2022 08:27:03 -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 BF434855BE; Mon, 24 Oct 2022 05:01: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 EF486B81185; Mon, 24 Oct 2022 11:44:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4920BC433C1; Mon, 24 Oct 2022 11:44:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611896; bh=fV9OYAn4uPLUfTAI0RPNnM65cKXMaGX+Gz+hE0+4RBw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IcCFF40UpsWCeCK2pI5q8vYzvaeyAPefVLGOyjzTTgjcVQeUVNAhlS7LephTFKRtA o3DfM+zck4RalD0DycPE7Lp5CHcsOusOsMTQ7SpfRNojxJVCMFBqRxF7GbLx71neV2 pxJy4zFgTAoreUaMIx+qivcnVB4Uwzk5tjMLS0xE= 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.9 122/159] f2fs: fix race condition on setting FI_NO_EXTENT flag Date: Mon, 24 Oct 2022 13:31:16 +0200 Message-Id: <20221024112953.958322926@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747572002884632722?= X-GMAIL-MSGID: =?utf-8?q?1747572002884632722?= 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 d7b8c8b5fc39..3f872145a988 100644 --- a/fs/f2fs/extent_cache.c +++ b/fs/f2fs/extent_cache.c @@ -650,9 +650,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: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: 8479 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp403403wru; Mon, 24 Oct 2022 04:52:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5C5ixqMjrcHuh0iwBlxobXOSWYvSziRhc66AbfOD4+PA9cQBXjEbzKDEBMzTtU/vo0e4Pn X-Received: by 2002:a17:90b:4a43:b0:212:fd76:be5d with SMTP id lb3-20020a17090b4a4300b00212fd76be5dmr8778629pjb.152.1666612325905; Mon, 24 Oct 2022 04:52:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612325; cv=none; d=google.com; s=arc-20160816; b=J+5Osl+fCxi9gFQWAPg/VT6ZNOB4kS5C+l/t2xJRSkeoCtXuyfRaoskrL8CaduRSzx rpPn6cgiv7TiIsLDi5RbuXIVx1z5FEJ202Npy1MTDK6atwtBzwRHtHu8uCFfsqO7RQF3 JVs4khxnT4Lqske1mTlXvnXRXz1H+9qgFS5dyRpy5m5k8OknPUpbpUguv6uMxTCoQUZA ccn8NY4UoOfa6Ehztx6Tak7n95p7TBzTfWwlJiNHWlFLpJF6hSQuqArZW52p8jWWhL/6 92S+YrT1MXjiZEmass6XO4qrwlnBijWdmhWaONrT27rUPL6ZEBNTdLLETRK+kOgMvGnx cWPw== 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=uDkOEeouvPFiUxdb6xLY9Pj5MKjrktk4PLkqK3GBm2k=; b=Vei1uo2eXYiITikyT4C1njRVlhWbKqBRrJ7D+JZ5dwomKLCt1OQZ0+PzZ4DXBT3LZS XeN6OBn0LQ4gdgE7IZCdQhutgxraAnZh7wYw8XpIf+omXBySPZDHvh0zpAT82ujPwz7v SxijtUHNXWjagNXE+VsZh1sfrO9F8d2TFN8UreP/M7Na/yJUqD173ClweixwnprLwVgT Ox8p5pL8eCdz/773HJ4kXOBnpFU4lEENJjEUQk65spqlV2osaoFXdGk7J12vWUBVZrtJ wcCRe/GEaB9fFG+jxqwQ7+2qHf87bMJS63/nhtQwoOdQXxQVS9eTA1TAdCgCAZEeJZab nQAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mLIQHt9K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 x33-20020a056a0018a100b00536f8a6acadsi39817871pfh.2.2022.10.24.04.51.52; Mon, 24 Oct 2022 04:52: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=mLIQHt9K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231478AbiJXLvj (ORCPT + 99 others); Mon, 24 Oct 2022 07:51:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231836AbiJXLtE (ORCPT ); Mon, 24 Oct 2022 07:49: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 DA25E4C61E; Mon, 24 Oct 2022 04:43: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 94B2961297; Mon, 24 Oct 2022 11:43:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7A48C433C1; Mon, 24 Oct 2022 11:43:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611818; bh=nMsxlgLRGEX0FtD0r/V/YW2d/mRCby5PdiPhCodz1Z4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mLIQHt9KZRLyIUsGg4b4oe2jQlWz4kAZ3rkpSEYACBNTAv29xZ7iNSldI5cuLqa+H DecT4MbdH14zZaWFx2Ilixo66AS7lyqQ7N+oxVzlJKRQXD9g9x+O+gLxr8zSLSfDnz RqxY37z8pM2+3F8ejrDlj2MvGbkgb1R4laTS9WPY= 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.9 123/159] ACPI: video: Add Toshiba Satellite/Portege Z830 quirk Date: Mon, 24 Oct 2022 13:31:17 +0200 Message-Id: <20221024112953.990430064@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569686539296418?= X-GMAIL-MSGID: =?utf-8?q?1747569686539296418?= 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 ea0573176894..209903c2ee85 100644 --- a/drivers/acpi/acpi_video.c +++ b/drivers/acpi/acpi_video.c @@ -485,6 +485,22 @@ static 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:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8500 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp404724wru; Mon, 24 Oct 2022 04:55:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM47nr/U7pYNaLZWSCV57pO4a+2ZFv2IKf69QLYml0O/TYev/mHmN9P3/b/40toqBhxoHAxJ X-Received: by 2002:a63:d008:0:b0:46e:c359:7fa2 with SMTP id z8-20020a63d008000000b0046ec3597fa2mr13343833pgf.285.1666612535022; Mon, 24 Oct 2022 04:55:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612535; cv=none; d=google.com; s=arc-20160816; b=a8Gti73yjco9et0jGyMlkzm+Vn9vJFEPp7S05+1x0bgTJMLvHd+0URXdLA9DDDKbwl Dj7D6NweC9Siv4Ix+DVxCkYtL+oOofURZsI7+AWtFktMRQ091EqzccJ914tZkTjQiz50 hdm14Dq4LuJppwkr1lCA7F5nZxWT00NwmT17KMVXztMAP6i0ksL7/+WxKbgBBIGrJTum o90xJYL2luzls66k4HuKq3k69nif/rg46j15zcM18aZOXlTWe6ck+gJ/yVVf8Lekg5V9 wLwZvk3am7ANaR0cX0N5whrexbeGWfRLAm62yirjtaffpS5KmuOMRCMZkpcVBe5zRP2h WZcA== 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=XUJZTv930jgNqJhbwTZKQ5+XptmfQ24d2UwtgRmZlN3ARB6qJWQQL1NfkPBR2DFmKy ZcbcOMU3PH+dsr1PlIDZpTpVAoG37FKPAGBoG0ErVhMjPHk6+fGYl92NwThxftbjKg1s ZqWlUkaiXkIE0oOL0Qv9N7Kttmnkbgr2nFpODTYlYKv4+D3Uj6zHHgOcWK/6wWLQv5Bt N1XGdmzZw5Ro1NCWxyYZeo0o+15uIjAuoCByww4dtgrDII/zBH6Hw6TnryVQytzossXf lq2P8nRNdm5vVvv5OGEiedQzosFhmCZ4gW+hVmOi+TOLJrsFzRGOvc1gKGqx6spyRUKR pgIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bX28EBxg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 p8-20020a170902e74800b001869fc56c40si5203586plf.103.2022.10.24.04.55.21; Mon, 24 Oct 2022 04:55: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=bX28EBxg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232132AbiJXLxp (ORCPT + 99 others); Mon, 24 Oct 2022 07:53:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232060AbiJXLwy (ORCPT ); Mon, 24 Oct 2022 07:52:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 174A014089; Mon, 24 Oct 2022 04:44: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 48B9361257; Mon, 24 Oct 2022 11:43:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 301D3C433D7; Mon, 24 Oct 2022 11:43:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611820; bh=7Biv/RB4g1yWRQ3Ir7P+DO9H5qF3EuPehLJSXWw6ecI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bX28EBxgBImVJu8b/SIlKVAxg2F6Jy56EWEaH03Wv8cV/mc+yFwrHQ25Z4gZtKNns gJ08HLBEWxwN6YDthQjzzh6OO2MzJCy5PBf+Xb4/De199ZwNd3Ebaak12B79KTTHwg hMLpDDNtGKsxDpZ87ZEis9ev15qHqU3Blc+mafMI= 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.9 124/159] MIPS: BCM47XX: Cast memcmp() of function to (void *) Date: Mon, 24 Oct 2022 13:31:18 +0200 Message-Id: <20221024112954.037994688@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569905662511697?= X-GMAIL-MSGID: =?utf-8?q?1747569905662511697?= 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: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: 8492 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp403836wru; Mon, 24 Oct 2022 04:53:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6JDaCyvbRRi4BdQnh/rfCbB8H6b71BPi+toStwfilQot6zx68lJkyLJoraef+tT5cKJlxo X-Received: by 2002:a17:902:9894:b0:186:a7d7:c56 with SMTP id s20-20020a170902989400b00186a7d70c56mr5239595plp.168.1666612413289; Mon, 24 Oct 2022 04:53:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612413; cv=none; d=google.com; s=arc-20160816; b=DXTiBJD8LIXapddJugWOE2Jos0SfsgVI9TWp9kYqMqMZgqUkw51aE+muWx885sNbJ2 62pIj1oEoGWsfqaqLZHeuDgfdY+J9/0gGsCOCjCBZltq2/86k1Bj6GUWAj3FUwzv15fk QE38orCcu3VGEWR+JUArBhhBLnCXQB5oEHkkGWkz94971lTTXVXMFPENCagjKY2AKHZQ JBPSSraPi7lEJwjVQUHHtqvs+w95YIa0CN2iyx+Dob+GJ3AmwsFot22U/myoCAdxTKy+ fJd50p2ofFWRHSBcWFUUO59fbffLGosw2dlLRBJtIYhkzHbD7//WpUPSREWS1JA6JGcL kzwg== 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=QlIHshfNukdvE1XouPowFBjw9RNdJp0LcBkowOyCS1k=; b=aJL3JA3bU7lN46lL0E4EzsVJJW6xDPeYaikItUYFv6woCkm/qhmvaJ4cU/D5KH/0PJ 8aM0VsFfDUMWRhn0okDTxT7ZCUo2AMOeL0dpQiPAjvQXozWu3kcgRH2g2BaqhnKvY5tU 5I113rFPtOhWX8cc03zDhRcCDJYHNFrAG0xAqldWyv8s4d2CfuVoKAsTr2CxtVFvq3l0 8JFis0lZGPFWW+uPfU9xXx/7XR70Ni87lPwUq7UAy/1x+xVxmIBjeEUgmvQaIraLaHZy G1r/2cjvjGnEVW3xaYkY0unAvv4ROe1TI1gEJ5zG9KI3LjKeBeOPJBHiakirFCTpam+6 VeUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wi9JG5UI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 bk13-20020a056a02028d00b0043087ac1272si32288198pgb.586.2022.10.24.04.53.19; Mon, 24 Oct 2022 04:53: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=wi9JG5UI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231259AbiJXLxH (ORCPT + 99 others); Mon, 24 Oct 2022 07:53:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232051AbiJXLwc (ORCPT ); Mon, 24 Oct 2022 07:52:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3C27209B9; Mon, 24 Oct 2022 04:44: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 ED28E61274; Mon, 24 Oct 2022 11:43:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AC02C433B5; Mon, 24 Oct 2022 11:43:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611823; bh=QXsB1UeFj8V1ql0mB2W4Auyo9lJtoymLc8ydxAXl2HQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wi9JG5UIfTVM6UlQ7eL1nnTdhknBslI7S49/jUBPR7+VFTY1W48RlPG8wphXbVIPy j3uxREB/lYeeLt6NOqJ7tdqC+E4chjBUJiZNi+wqaSx016UmsYnNv7Ro52Bufqrbts TVqwy3MBrZksGEWcnpCh7BENIOTPdJ9xy/R9yXRM= 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.9 125/159] powercap: intel_rapl: fix UBSAN shift-out-of-bounds issue Date: Mon, 24 Oct 2022 13:31:19 +0200 Message-Id: <20221024112954.072601249@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569777927464694?= X-GMAIL-MSGID: =?utf-8?q?1747569777927464694?= 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 8809c1a20bed..5f31606e1982 100644 --- a/drivers/powercap/intel_rapl.c +++ b/drivers/powercap/intel_rapl.c @@ -1080,6 +1080,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: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: 9577 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp527689wru; Mon, 24 Oct 2022 09:01:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4beMPa1ckm3PISI0p84hAxvRs5iJN9rykwoqwFqzK631rdnvPyPAU3AuCgftIhCidmwFAo X-Received: by 2002:a17:907:5ce:b0:730:bae0:deb with SMTP id wg14-20020a17090705ce00b00730bae00debmr29297591ejb.181.1666627272430; Mon, 24 Oct 2022 09:01:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627272; cv=none; d=google.com; s=arc-20160816; b=WdeaAYcSzQHu174JF5Y4TabsGwtlPpWB4nB17EXiY/LgEosfR5ZrB2i1a1aJU/apdB ePkJ7I+pjgVDpISVyNN7yznzcvvO8zx/0yqPm7ZgsCd2M8XX+vYwUQQH6qjc+NeXHb++ VYFC9vUAIatM0nItzjvm/x2G0yOqUe27ZkIm2PaswI3RklTGaB7n6GGp8yReg5y9I9cI R4AYlCwdbsgDDfWfTHUflwefBwh0DXTtlY51qgyau5VqIzBZf1+hAjxcptMKf59KgLdq HGfyyTVd1+4RGlh9e9pOfOI1Be4Uh+QmubSNuuEWcUY5vwQYourzUTXX0FAJt4puvSTw pqYA== 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=Qzo53QIVpXVFtL1ORHULqRih5y+ZkovW33Zxqt/oJOo=; b=CQBk+JBN/xq7vh6pw7rMKSG/z/Gi9OK01Yd4DpWlYqufxaTuFnGJKX6GtOxflPuCkO mUezB/sEjhUYeBX0eSgvRD9xf1iC2KXd1aRBaJgwwqdxu0F5DFnn1/cml6zM6ofoZ/4j nidA2OUQDqQspXQ+JQRqPSCyLJKP0kfhunINJn+yZbzPTYcuqYXlWurx5i+6I8SSc+wS /wlbw6RGnRmC/Bj0a9ivsBUxSTbveEdMMFzkoLeMbb1nNHEr6bzTKyKtRCDWdM7DKAv4 pVIw/CZ41mt4iHnQoj2sl3ybpLyxfCCHys1qkC3e11RPv3B3DrkqJgKs4wnaTXQ4V+rE MEIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=i+iSbkU3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 u18-20020a05640207d200b0045d4b7ad0e4si112572edy.400.2022.10.24.09.00.42; Mon, 24 Oct 2022 09:01: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=i+iSbkU3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231450AbiJXP6r (ORCPT + 99 others); Mon, 24 Oct 2022 11:58:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232168AbiJXP5x (ORCPT ); Mon, 24 Oct 2022 11:57: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 9ED4D12B373; Mon, 24 Oct 2022 07:52: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 482BEB81196; Mon, 24 Oct 2022 11:43:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 955EFC433C1; Mon, 24 Oct 2022 11:43:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611825; bh=9S9Jzqh/QQ0jJHUzmYwU6n8cgbVBAGr8mD+X8spS9Kk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i+iSbkU3HGTiE2kHg6lrAITkURIqG0fXrV9+VOi9m1Y9xoui+Q/TXEIeCzntmBw28 gTi1rTm0YuZozbfpniSScW8qjikn8GxpQWlNKQbKfst4nIDmipfxUQUqKr596yo3y/ qLlSYCdYq1AutglIhUoFR0pbSYzLLvRrbwi/+Gzk= 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.9 126/159] thermal: intel_powerclamp: Use get_cpu() instead of smp_processor_id() to avoid crash Date: Mon, 24 Oct 2022 13:31:20 +0200 Message-Id: <20221024112954.112545109@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747585358980753496?= X-GMAIL-MSGID: =?utf-8?q?1747585358980753496?= 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 afada655f861..492bb3ec6546 100644 --- a/drivers/thermal/intel_powerclamp.c +++ b/drivers/thermal/intel_powerclamp.c @@ -519,8 +519,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: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: 8507 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp405152wru; Mon, 24 Oct 2022 04:56:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6vsUUfY1qGeaEggwvqcKCct0CBSEdVSQlD7/PhybT2v7JQGiRzJ53nb9y/Fzk1GipY1Dkb X-Received: by 2002:a63:2a8b:0:b0:46e:9fda:2171 with SMTP id q133-20020a632a8b000000b0046e9fda2171mr18449222pgq.106.1666612587663; Mon, 24 Oct 2022 04:56:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612587; cv=none; d=google.com; s=arc-20160816; b=nGO8AgEbHNf9ZhWbG0ywFocc7y2f4fDgOyaOoMGjw7sv53/Z1PQsA55qSTZqQkaAtE OXbvo0mtJY/gacPxrQs+pt6hsgsiMf3xv9f65ltUL/czQRwh0dZCfSidAfeR9J9i0c5L TYTAAaXLedCD+gfH4E4KHxgoAk7UpUJc4ZNSd/nSV1F1byCAOtpbQOm3xvjihqasyktu wpig4MRLj9HAukDAHyuoT6op30tnvotQr/ZO9KqdSmjq03nAtPoxOKODXWaDohzFhO2Y 9a03XQBS9z7VwGUdzunJjqlCtbCNIZAXba5l41ydHTTag2P6hIFNj4GNnsTsmmXIM1kW Fm4w== 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=nodavt5HM21GwxkXp5a38ynfdrL/+8KQRo2sT2v1V7o=; b=ReJh2SHnqxOgIWT/xtR6smPWIe4If/aYbgkbV7PjNy18WmHvMqYN5NRm987JWF12He 4qTymP9lFKjijJF/B4yIUUUO/PaHxYDWTAeG2AAwAWdLP34oQF5bALr9RnHRy1xP79KS 4Ym/xZNppcVo8VAueNdXSoBfQzP/WmCbcDko32Cu5my6T2wFgAqQ/zqQSLJCZk/kmM9g Hx6QgqOaTpS+2OZswMSw5pDAQV09bkMvZjbJKfHMPPvqUs3FHpypAWiViygur13f29iq 7tMW0o8OspXtd/qN6u+OwAX3m1u7ZZBk4BNT9VTDfOsai3zeZkyt0jCRsr9g7DiNPvEW 5e4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Q3wOD8oA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 x12-20020a056a00188c00b005410d1ea0e5si41527564pfh.14.2022.10.24.04.56.14; Mon, 24 Oct 2022 04:56: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=Q3wOD8oA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232242AbiJXL4D (ORCPT + 99 others); Mon, 24 Oct 2022 07:56:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232336AbiJXLyZ (ORCPT ); Mon, 24 Oct 2022 07:54:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFF567674D; Mon, 24 Oct 2022 04:45:27 -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 E62E7B8119A; Mon, 24 Oct 2022 11:43:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A066C433D7; Mon, 24 Oct 2022 11:43:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611828; bh=0s+cvBR7eFaJ3V6V+p+oT1WB4JNdE2KcaYWAypo4Oqg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q3wOD8oA3UCWtlTg1CetNx5u+7ntfw2zkNccQqt+n+pXi9ZzzBZPjg/5YQyg9Ogq7 IOy+Hys44iTpYNpB/MNKha1dX4wdqHz6gvjI+FzdrLRDjy5I/0POhYIsqDyQ9a50Y0 MVYBbESRFwN7SRrPsklT29PTGUgbgzDSRghtX/WY= 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.9 127/159] openvswitch: Fix double reporting of drops in dropwatch Date: Mon, 24 Oct 2022 13:31:21 +0200 Message-Id: <20221024112954.142168057@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569960836490051?= X-GMAIL-MSGID: =?utf-8?q?1747569960836490051?= 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 c28f0e2a7c3c..ab318844a19b 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -278,10 +278,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: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: 8473 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp403234wru; Mon, 24 Oct 2022 04:51:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6cWf0WaswfngH6NaffPkPXwQs9pwdFaZyedVidDUx2Nl5/w3eWEaye/5vUl4AQF3hOYZz2 X-Received: by 2002:a17:90b:4b88:b0:20a:cbb0:3c86 with SMTP id lr8-20020a17090b4b8800b0020acbb03c86mr71263890pjb.207.1666612296958; Mon, 24 Oct 2022 04:51:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612296; cv=none; d=google.com; s=arc-20160816; b=0lhhbGaQyV9s9l/49gNV/9J3bN18nyLap/0bnJm0X2HBZ3M9GN6ru8f7n0gWLCstMZ i/Z2P027DipyXdxgcQVTa7PI6wcLDW8zTP+ElYNAbRL99LdNdq/osD+lAeMwwi/tAysK ULvcdmuJ31vh3aEDn0PCDcN+egSh0gG3D2HqXII8UOBm7r2Zr0+esnSLr84jByjXQXUd qL2bS9BLyrFOHlmWCINhILZqMrB72ZSVBb1rnSoK6usMOJeTD71kBgk0fjsYbOTV/xLe 8DOE2n2kPLd6qfP3B38BQIa2gml0TMLLdU8ZPBniaqkPRTWSSSZnIbdhSSuncc4D+wYE TsjQ== 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=9GTDI8cCfglyavCiVv9wJl4zf6CApydZg0cVG4sFHec=; b=kEAoRQ3/JgZn2nIR9EBgAdyIGP4CyCMZo0lZU/wlkUn3tMIFGjZNgFD31G0zlKdRs/ 4lwIRM8GynsdEXX5LWI5RHHY/9opYkS+EYEUVf2q13VEV/Sy6GYRZELglDIf5TWW71jW E4OhB9F7LDqiPnTK7HHbv2Jv0mefBLTneTMtZiwK73HUdVRK6v95nP8vJfCVs1CqW4p2 94l77DOXAdLCNmnsHlBHPWnUXznrXQW220g5SONjfrA6aFOOFX1BxpI5Lxo2ry4tq5Wa iIDGhEZC0bCERGEA24CyNXL6jJ8hUB6XXWoXKYUa1v6KVKdP0lN3Xg62JaDG/XCi0Ufq UHDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mFqP+1pG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 h9-20020a170902f70900b00186b46df624si1034397plo.424.2022.10.24.04.51.23; Mon, 24 Oct 2022 04:51: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=mFqP+1pG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231917AbiJXLvB (ORCPT + 99 others); Mon, 24 Oct 2022 07:51:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231907AbiJXLtM (ORCPT ); Mon, 24 Oct 2022 07:49:12 -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 142E96DAF5; Mon, 24 Oct 2022 04:43: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 C9A9B61297; Mon, 24 Oct 2022 11:43:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DFE0AC433D7; Mon, 24 Oct 2022 11:43:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611831; bh=s8XvSJ0CBvwlnj1YP3pu0XkLAMDkv8P0FO3gc3W4WDg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mFqP+1pGoT1KZyvJAPiu1AyjCVgwpXfjDJgcswYL/hn/6WR3d6uuxr1fbldycHuEX tcw32/ezHZGjPzl2jd4Rz1n/6Y7p6NPscvl9Gb+RXI8oNxePqC/wJkbe4zEowZsWDB cRb3egMvidEh7OpDb0P/zgh4oqfm97GFvqXrpEw8= 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.9 128/159] openvswitch: Fix overreporting of drops in dropwatch Date: Mon, 24 Oct 2022 13:31:22 +0200 Message-Id: <20221024112954.180634319@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569655702992889?= X-GMAIL-MSGID: =?utf-8?q?1747569655702992889?= 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 ab318844a19b..10423757e781 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -555,8 +555,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: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: 8476 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp403349wru; Mon, 24 Oct 2022 04:51:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6zQw8MH70zzgmRKB7e37frDanhDXFqxpre0tK6issBhpOumMJeYCxH8QosfsnDN255n/Lr X-Received: by 2002:a17:90b:60e:b0:212:d5cd:4e58 with SMTP id gb14-20020a17090b060e00b00212d5cd4e58mr18142476pjb.165.1666612316679; Mon, 24 Oct 2022 04:51:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612316; cv=none; d=google.com; s=arc-20160816; b=J8M9ACdGca4Z1WipVvvc3v7vFGU5xiM4LKv+/nh2QQlkUsHOl3INPEfx72uM3BIHgW 1vi/X4S1vPExxXUIZkk5KLU6X83u+WsQw3bES2XPcNriP9vmAr88gpkoDU8gUcLF5rna CZZmeF3g6/adgDpSlRggxNIlEppL0lUU+II0tJPCYScdYPeafM9uiuYiGD7ZPKNupGdV xn/Cpo8CiVzsPJEcY9V+J1jklg1Z/pTN7e2f5OQxHfdavfrYNQfXdzarjD6Lk/5u/MVn MPCePHNpvvYPMz6YmF/JN/hFI3QsUVoI64oWmHUj20UGD6PAWu2hx4FjUPeUnwvElTfu XG0Q== 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=/PTfo8uAFwIoD1qBHALEl45HRdvuseUEm2tYnYct2Yw=; b=WHQYuhUUiWK47X4FIh8aiA5/yzLsMUE1imBHD2NAvj5GWvZiLsyTKecIatUzXZgdaX G7kyg7isNaRVoUqHHafFfo7hdF5r3BuMz+EIJ9H0TIJsDhDjdZ8hHC5d4RJj3tYQ/01N r+P664bhYke3UKU1/nauHf/S7gg4MgmaCqVg8cDzWKiHjbNQHGBJT5MDGzyXQLtkZ1Fv nZUCSePiD0lASO839baOolXE8SxfJZ2L9PZ5rX9naXrl0nc4fHsVJp4lpYWodthjJQBA +nPo+psuU9a1uA2nLLBWWo0nerFEtRT6OVmBPJ7mQGLH4Uezz6BE4tpjZcaLtpdhv15m N3KQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=r7IWoNAQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a635641000000b0042b57d7bc14si33765886pgm.763.2022.10.24.04.51.43; Mon, 24 Oct 2022 04:51: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=r7IWoNAQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231940AbiJXLvO (ORCPT + 99 others); Mon, 24 Oct 2022 07:51:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231951AbiJXLtR (ORCPT ); Mon, 24 Oct 2022 07:49:17 -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 299591EEED; Mon, 24 Oct 2022 04:43: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 2FB70B8117A; Mon, 24 Oct 2022 11:43:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82E6EC433D6; Mon, 24 Oct 2022 11:43:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611833; bh=RwSqqccq5jb87gtkM0ArHecFwhThQMrjqBPPfIKVlKY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r7IWoNAQdI61cGbmY6MQbQPtX3z65BstWvaU5qM3UG2ZNS0ActKCh/9fo3xXNqOF8 eFZllitCGzfbnlkV5Ib/h4YElpqFhurgB1Muw8wgVgl43mCPeH6RbRd9+umEDnYeCv ib0ITE+HdRQYH7a5g/D98Nv8X/yr0n/DiFj1CtMk= 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.9 129/159] tcp: annotate data-race around tcp_md5sig_pool_populated Date: Mon, 24 Oct 2022 13:31:23 +0200 Message-Id: <20221024112954.216222112@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569676099243356?= X-GMAIL-MSGID: =?utf-8?q?1747569676099243356?= 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 7a75eb177878..4252aa0b5143 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -3131,12 +3131,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) @@ -3144,7 +3148,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); @@ -3160,7 +3165,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: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: 8480 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp403467wru; Mon, 24 Oct 2022 04:52:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4GsGf+x9SdP2fuAgoJjBq53RtV1spy3RhmWC/V0ijEu8z/IZyURfhZkStD9B+pvehGSZ3i X-Received: by 2002:a63:ed01:0:b0:445:4345:4a21 with SMTP id d1-20020a63ed01000000b0044543454a21mr28127276pgi.404.1666612339801; Mon, 24 Oct 2022 04:52:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612339; cv=none; d=google.com; s=arc-20160816; b=o/AYCyyucLg8K8bhAIH690FcXBvvU51DUfo9VGsGYtCQv0Tn3NxzRhuSItGBF6I+3n f1nQjSI49NnS/5usg5aHZbS20h1J/wjq4btBuc5EoKp++bYSV/dcrr9+Rx3aLMIVPN6b VDhQcaDbi5gORXKsI3WqXEg7ZYkf52IEqukJBEgn0lIPpABQVxz0OG7zSTwE0aiEw4T0 XqCnMZU1fBWZIfZcwfjuR+BJEJyNRa2glykO5t2iovUGhy4QHef1+IpfPEHx53io0+oY nQ9vZcTHsu9Pj6e8AOgse6cFcHLnUn2PS/GojbduV5j+dURREp2ALzkkEx7QccTSAHNr 7l6g== 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=t0njirli5cZgnpMDDJu5qgQlu2XbHnrTrBdawK4FBOWzUP4MSOBfEaJP3sJEW0yl/8 wlQmGB1tY85ZgwUoelbOEaY4BDWIg/Su3rSGmhFenpqiiBqPRwEpR2QocacNcGH59Es/ a6pBzp0IH7p7sriqZQpQqhSlXpcUmMXveYOr53E9WcVWGyFUh9r802EX4uWRMh/oJnPt 7hoLUvfh0UrrHNpTZXbbbJCx9gqUvZX4tT2+yu59bPzz3+3gHJNXJcOyvbOaoKvuYDst 5Hk7jbhHHHioR39RNRvxYDpI6mHvs055DUVoqq2W3FK4RNvJlg1+3k55iCEopm6VOp4T o7Gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lYsOZM3j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 ob2-20020a17090b390200b002131cee8cd2si2242600pjb.10.2022.10.24.04.52.06; Mon, 24 Oct 2022 04:52: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=lYsOZM3j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231836AbiJXLvl (ORCPT + 99 others); Mon, 24 Oct 2022 07:51:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232036AbiJXLta (ORCPT ); Mon, 24 Oct 2022 07:49:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EB256FA30; Mon, 24 Oct 2022 04:43: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 D0126B81181; Mon, 24 Oct 2022 11:43:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A021C433B5; Mon, 24 Oct 2022 11:43:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611836; bh=/XB4y2LpgVtKSLfj2FRGEXMsobFlbWAbbPzG5tqVxqA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lYsOZM3jHNAvVDZcmoE/rLep3/MynpDd3PnoPNeVrzKz39xDQZR6BiWLQYopsEnXf 6vXoPbH0XnWwnRF/3hROhMyI8mceTTNcW2NkoLf8XApkqWz4/jpL5ZMA+mSDK45fDI FdZEnnFZHf7nCouTMeglxydZCTHdoVHUKMy3aCMk= 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.9 130/159] xfrm: Update ipcomp_scratches with NULL when freed Date: Mon, 24 Oct 2022 13:31:24 +0200 Message-Id: <20221024112954.247344529@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569700752378105?= X-GMAIL-MSGID: =?utf-8?q?1747569700752378105?= 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: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: 8478 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp403389wru; Mon, 24 Oct 2022 04:52:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7bAYCGe00tCYZEIUs6UpR/I4Ah3xGH3NUZIUtk5LAbCvZv4teIt6gjWeGwWNRtvVEcNF7j X-Received: by 2002:a65:6e4a:0:b0:438:874c:53fd with SMTP id be10-20020a656e4a000000b00438874c53fdmr28754777pgb.355.1666612323574; Mon, 24 Oct 2022 04:52:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612323; cv=none; d=google.com; s=arc-20160816; b=KcgTUIouFx2Rsqdeeqlh4SmEhBSGsprG63Y+ZHB0eWmtV4jCL80SFahyTPecDqoc49 lR3FIy+Mgdh3rHNqoNSsiiF5dx1dfGY0+PB8Fn9nthi4zhKrC8hkKMMVluKe7DgWX8qB hneTTLutnLEvOgZI2Hj9u2bddMEoXDoeV6WexS70WPxP/Jjcv7PXs1au8hadVX66aVjQ vR5W/4KOPXWFQcOBzR6dOhIVlwg9PgunNJnfPAd55whr08CAJQwpf1Ts8l3UQsb+rscf qthd8cygjsfCOlGwvau00TgeARvTdGZwOekcwMf1O/U5Wabhetkz7yLVdb5Dnif9KMvU 6mIw== 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=WfkgfQ/Mq6YaK7xYeqPJDMt3ce2bmeCRUE0zSv49W8A=; b=MvUWFdny2P7e+vodIsBk6faRpJr6I3yuVW+8sNuIOmoglwLYetno5EkXB5Lwk76+We GGXPa26HfIs8mMYgYmjU8DBZwlmsDqAnrRiWfKnzqX5sgGMpeQlQTW+DPTnz+HYWyBzb KTPbdJlS/EPKx4isT2cebit0J7IaRgMDpdgUR5PkG5cjUICAo2KBauCNIhF5wOy3G7e6 y9y9Wh2o4GPThWRo2KXZ+8l44NIDn4E06uFqw9CsRXOHIXv8w7dpOv70TQjmW/x5TCh5 Z5pS94lbMNPRKJB2WmH/Jo6PRssLNdHufp4qiuKYMUilx2kv+2Q1AUKz9gLwCDs0wbd4 Xpew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gJktJQ6G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 bm10-20020a656e8a000000b0046afc3948c4si37436711pgb.707.2022.10.24.04.51.50; Mon, 24 Oct 2022 04:52: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=gJktJQ6G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231960AbiJXLvY (ORCPT + 99 others); Mon, 24 Oct 2022 07:51:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232033AbiJXLta (ORCPT ); Mon, 24 Oct 2022 07:49:30 -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 16F1132A8C; Mon, 24 Oct 2022 04:43: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 A8CC961298; Mon, 24 Oct 2022 11:43:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB708C433C1; Mon, 24 Oct 2022 11:43:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611839; bh=jDqRMbQbaSbrI2c3vmSx9JMuLozVwMwqOIKtbEI0MY4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gJktJQ6GEEsAidl8w8GmU7t76gM5Yrc9TuELBzzySeYzu69B2rpN2FzNOBc8qWSJ4 DiYSE9EG6LMDOudIH0Ya/ePOxe6nTUw0+P+W6TkfSuTm/W3P5IwXjDOaR5D+LSf+H+ Y5sCSLdMct2EmgL/2QTwkkVtgrKMhZROfNx4Qv+0= 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.9 131/159] Bluetooth: L2CAP: initialize delayed works at l2cap_chan_create() Date: Mon, 24 Oct 2022 13:31:25 +0200 Message-Id: <20221024112954.276967267@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569683946025347?= X-GMAIL-MSGID: =?utf-8?q?1747569683946025347?= 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 474c12d4f8ba..42df17fa7f16 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; @@ -3144,10 +3150,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: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: 8483 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp403512wru; Mon, 24 Oct 2022 04:52:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM47onYhCoRG08C57o2ffSUiI2uWMHwItIv1SycVTntKACB8Bzfcup/q7g4awvQ8f+j64Syb X-Received: by 2002:aa7:8ec1:0:b0:56b:fa67:1f6c with SMTP id b1-20020aa78ec1000000b0056bfa671f6cmr1592712pfr.69.1666612350357; Mon, 24 Oct 2022 04:52:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612350; cv=none; d=google.com; s=arc-20160816; b=sMDjVksFqJGKGLm03pHAKkrLdlunisNew+TyDH+rhtInK7oZv0WGd4dPunjxnYfLV/ rTxFxhmbVvWJl4EIyqUD+fo7sS7zx/+vFvEDDEPbm+qnsQCYklZtxzVVwzzhACm8iHZo uUFAhS/zjmqrylQoZ4TVsjYIynCUvWJs3VWObNlAfCpNIWxpCZ2aTChjfhaIuxFtarSF JWJ1DxsMUhiWvqVgkj8LEu9gFxzpzYR11J3LkZ7gREptMGMHx/eFI+cv9jw0Hso5bc8k rsb4hyDpJrLqARk5f+oK87FuvHAG/s64OSPhRl5OTsgNYlPjiUS/0pg/z1BBRnQ1F9Zc 8A3Q== 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=LtX7XxFZejl6XxXQ/7HOQ5pQBFAyD2bBulfL114Z+AQ=; b=bFJaEzbVJivhq0WjPi65ma+dTQQQwNXde249X8cAT5a7TRHmIJoRXNO5/MnkaRenms ASKM9Lh8hfKKr8OWLl+BLIl9ijl8KRXeDHqeJgHRzH1HNcYJC0ypafDIoPZZbPi6x1IK MAA9ppmqqLgvPY2exYit9xTi+LFe4FzykXI180uVn/UIPQtXM98JlHZ7wYvk4qi/JUOv pB54Mdv+5qyMnrcX9HWBeacIPRYthFZHWMAsi9Onq0PKVe80yFfz5ElOOLAlXqrnTQDt EbG7g0ISu4hVsXFxil5GJT8KgFsfrsNxNRRZz28G1fniprVSb8bl7yzsc82jNRJEM+EK 6vrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="rbL/kkTd"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 b13-20020a6541cd000000b00439ce36e9d3si34901406pgq.570.2022.10.24.04.52.17; Mon, 24 Oct 2022 04:52: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="rbL/kkTd"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231727AbiJXLvw (ORCPT + 99 others); Mon, 24 Oct 2022 07:51:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231668AbiJXLtt (ORCPT ); Mon, 24 Oct 2022 07:49: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 A1EAF112E; Mon, 24 Oct 2022 04:44: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 429A261297; Mon, 24 Oct 2022 11:44:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A9E9C433D6; Mon, 24 Oct 2022 11:44:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611841; bh=52nmRZeL7C7bPE7/IWT/n7ZtPwpOmsvK1hGhDod0Wuo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rbL/kkTdc34oIX4TU+IQrny08WnWWy+sb2XWZ8JcCCF4Y4gw8fGySI2A23Red/CIz S9tDseqVI/W1CPJ9kSpKImOUuXgL1L195JZ8lM92CSr4Fl2U5lWlyvMGA8BoRbB0tg lBQ/c3oXyRxkf1Pn8ysU3cfNTCeumq6VB8IN5FUw= 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.9 132/159] Bluetooth: hci_sysfs: Fix attempting to call device_add multiple times Date: Mon, 24 Oct 2022 13:31:26 +0200 Message-Id: <20221024112954.305843640@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569711520878901?= X-GMAIL-MSGID: =?utf-8?q?1747569711520878901?= 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 cb7d06bb0243..37ec675b7bee 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c @@ -47,6 +47,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: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: 8686 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422451wru; Mon, 24 Oct 2022 05:22:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7PuknPI5KJeNwyWlbPG/ySYZvuwNvx0dmYTUOcT6JMTe0yzA6271u4Ej80UQMQSoTSRHVs X-Received: by 2002:a17:907:3f96:b0:7ab:34aa:9094 with SMTP id hr22-20020a1709073f9600b007ab34aa9094mr111639ejc.85.1666614163718; Mon, 24 Oct 2022 05:22:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614163; cv=none; d=google.com; s=arc-20160816; b=mEu4lzvZXcvK492q0ZcrV6FxzgAMZLnMsCeunY8nhkIS5LB0yWiKqfgSAtlQqlzcLd 0KMr8zPtSXqEUNe4VQJAgzthcGpMfE97puxQin0kIwltxH0megcykNvsx7ErfV5TqCRz RHlb0xUyL37FUE5G8KO/PfcYt0B0m+4NuhuUQON0kidDJRpRrREQiW7gujKeTfybc1wJ PXUuqNI15DoxDNL9yDEOqSBN4lB9VDzga4EWUQHI50082ImJKxS9LB7yqM0neUWyb8Qa 6t0G1kWLMGQ7HzOC3Ri/yb/9MocIMkexCd7rgxtAlWWiHIo5d7nXUclQz8aKcKO7Eux2 co8A== 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=rkDWj4WcO0BpgN7NQzjQ82CmB/EHfFEqCMmRkbTngzU=; b=yuru68BSX+oHiMbJDgsU8lXTw0SyzrMFXaGbnK1WCIGbuO2y1c36f0YEdZWNo8z4UF LpjRgFuPxTQWRtO8gcRiHfwhTyWczFOsAPl0zaQCwWFPICqO0m+o8Wk8iOhb4t2YMwLp wvR6X0rUUOG6YhzXx2OI3UCrIaPcHGPC4xZkklmA3mHIffuF3L2FVtZeMzRrRMrG5qia E0fLIX8GibPaBq+J+e7j+AxoQwBL4MsKuTeTKFyiNksNIiuGOBVCKeqWYvNhEJSH+G8r sArMeNcquGh/kUdl/lIhnvOnxKvjpoyjnbi+EZEKGYTasaCJ93zQhkgrp7yVxRcvIMYM Ieqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TutMja1F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 jz4-20020a170906bb0400b0078dd73ae297si24670864ejb.172.2022.10.24.05.22.19; Mon, 24 Oct 2022 05:22: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=TutMja1F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233279AbiJXMVG (ORCPT + 99 others); Mon, 24 Oct 2022 08:21:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233404AbiJXMTW (ORCPT ); Mon, 24 Oct 2022 08:19: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 2AED982775; Mon, 24 Oct 2022 04:58: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 6E574612A0; Mon, 24 Oct 2022 11:44:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81B20C433C1; Mon, 24 Oct 2022 11:44:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611846; bh=ZM8KwLzQMU6Z+0eJcv/Gy/7anpAdhPECPWXhIWxPZPQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TutMja1FKraUaEqw/6lgjY1zVXghJvHmZJaxEMlh6zC6xAqMooETO8iR8+vArGAJY FZkchDehEsI+Cnba2s1JQhxKejua0J4t78zrI/CUqx0MTqnxH73oiRVjwnC8SaA5tW 9wE7NC6tirggYfTd9kIIjJD9hm+AwJXfq3xxShaE= 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.9 133/159] can: bcm: check the result of can_send() in bcm_can_tx() Date: Mon, 24 Oct 2022 13:31:27 +0200 Message-Id: <20221024112954.335214620@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747571613551211271?= X-GMAIL-MSGID: =?utf-8?q?1747571613551211271?= 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 bfb507223468..ece04ad50348 100644 --- a/net/can/bcm.c +++ b/net/can/bcm.c @@ -285,6 +285,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) @@ -309,11 +310,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: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: 8506 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp405143wru; Mon, 24 Oct 2022 04:56:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4sPVc7ZedX/ji5evUxr759b8SUw8yaFi53wClEOU7u7c7cuGu9TYOCHc+K1HV7IElgGa2f X-Received: by 2002:a65:6cc4:0:b0:412:35fa:5bce with SMTP id g4-20020a656cc4000000b0041235fa5bcemr27303131pgw.466.1666612586610; Mon, 24 Oct 2022 04:56:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612586; cv=none; d=google.com; s=arc-20160816; b=qGpdBctvUqI09+bswGTGftscV+5TptRWbjUOh/DVH8BeJXzW5zdUFpeULdDeSQtL13 +Ko6Ou9H/xG1pydEUke0FIsKhz7bcRrtUlYur1QffjgYd7R0VxSJ3HLU1vCQJjL4OxBm 4dSf0ZsVjW5GUdutRJG1suyeUilgeYWxvqV/zRTd4lCy4uVawy5x7SaXyi/vd4p22s7V bOhHPTk/36CvX2dxdGIq5/37EyNs7NiADoIdByAre9pD+lGaYI+AkJXb7hTnP7fb0aXl u1+sNyfOZCbaemhb9aX1IAv9tClyegzbc1MucFx/uJXj0ZKplyXFWunVKGu860TmNMDJ FbbQ== 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=h+FiXORyv21SbCGiaDXQXMPodRpp/CqpsR6aAwcvVn4=; b=AyySA0dk7astpbBWURtRv7ehLK2nECuX85jVx0Zq5Z0yxxxhJr7t0AAzL1CSUW+axl iQaUoXEWCnq+UQjY/xOyXdrPfa4weOgHV5rfAO6ywjlIrDMxY/R20QzRTZyDJtLY0C5d 00M3g8FRPZuV4bWWvGiOKwGTfYaWuT4v2bCzIjfuUaFNlfjgj1k3gO79gkECKjPdYjCj +9aMMdLbP7KbmWSE24cJbLJJ0dAupP40n7VTl/sbmDsALmA7Q9wUw7RQqIoo8f/4XPO3 kyNKl6r8QyNQArHPUGvaRbPHlLXLw25/e2xyJzhrCp0KL9Yn7VDE/WUXeKcATORfAMG0 7o8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bp37qtT7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 j7-20020a170902da8700b001768b832a41si39846078plx.584.2022.10.24.04.56.13; Mon, 24 Oct 2022 04:56: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=bp37qtT7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232222AbiJXLz5 (ORCPT + 99 others); Mon, 24 Oct 2022 07:55:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231977AbiJXLxI (ORCPT ); Mon, 24 Oct 2022 07:53:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A84984F664; Mon, 24 Oct 2022 04:45: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 0C84F612A1; Mon, 24 Oct 2022 11:44:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D12DC433D6; Mon, 24 Oct 2022 11:44:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611849; bh=f3Kl8PSdbHZnVxN8KcE0aLttwySrFMb8eFbb3/cb1cc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bp37qtT7eqIdnHqh2iYMWuO/rNRDXcvPyH+x46vSs5VkZGiS/tVH8cMIGkrGLemiy AKAgChGNQSpckIRZUloHtq9XSeb62WdSolZ1gl2qgQ0fvchApBf7XoLQkcaptES/jL U64zuGlkjDW8xs5cUw/DNDuSWjB0uQ6xkpZtVR9U= 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.9 134/159] wifi: rt2x00: dont run Rt5592 IQ calibration on MT7620 Date: Mon, 24 Oct 2022 13:31:28 +0200 Message-Id: <20221024112954.365662772@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569959990430632?= X-GMAIL-MSGID: =?utf-8?q?1747569959990430632?= 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 9fc6f1615343..079611ff8def 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c @@ -3386,7 +3386,8 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev, reg = (rf->channel <= 14 ? 0x1c : 0x24) + 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); } rt2800_bbp_read(rt2x00dev, 4, &bbp); 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: 8702 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422800wru; Mon, 24 Oct 2022 05:23:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5AiFfMqb/Nibcvp9cBVAoLIvro55qtp1614/pa32BWB6y/SaA8bmfDTaiYDs5Vl6u/nvJ9 X-Received: by 2002:a17:906:fe45:b0:791:9624:9ea4 with SMTP id wz5-20020a170906fe4500b0079196249ea4mr27586267ejb.147.1666614192885; Mon, 24 Oct 2022 05:23:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614192; cv=none; d=google.com; s=arc-20160816; b=1LXdtVdG+Btw/TMBkJ7YXGm49vvZXRvENcWQ2jy763Iu4FctE41VsR9UzbTlwIUCgX NPgOGT4Tb3zfZub9FAalvVA3sjAJjji2mJIzlqwfSZKD4o/vux/TJ6OfxbaYYKp6HkYd GyY/k4Dbt85z0G8PFadTNi5AritiaBVAB9l6NhMdsNduUsXOGi+q2jFB7ZtfU+ugRl92 +lZBVqJmQDH/bvwXn4tQm+EOygZcZfkKl5ldoqd1o5AZQ9pUWteSzoJz+Cnv4+UvdMwC WFHRz62oOzHq0nC7ni9PLMv4ZQRUUu3nNitwj1LA+K72z6catuKTaaj8aFsql8CnIzo1 u9zQ== 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=/YpQ7s4G/E1tLtWoceL1+Bh1rczCTw/qrCJmv6ax4bw=; b=BekuDwa1VJlf0UW8jbh1VA6rx8q6yZJWEwRbCvEQ+G7awwFPHDA+6ZAAW3zxeLqX8S J8TN1hsQt9tcMDAqhDEqZytFvKq5Sbr4xkYhKqSQ9Fs5CTvsBNYQVd3tiAQIYb5sP/Xj EzK0ceaUHmQLe7/M0EDsVLosQ7d++R55RRZVhtOPtdT5Tuo+4qSTn0mlMKp4ADGVuHhg Btmp7mq3BbgA+1apxCckDgV6Lz1WGHEm3i49rDlVTE0k/kQpaUGQJ/fdRQRU8em07Jrs IopHxzYpeR3X2UC9zGzXoAyzMEHmndYuuLHWO6EWjuQAEMRH8Fa910w/VUIgLBTeHMGe zPgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IBbSC5Rv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a1709065d1000b007a6384d506csi3242724ejt.643.2022.10.24.05.22.49; Mon, 24 Oct 2022 05:23: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=IBbSC5Rv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233444AbiJXMV4 (ORCPT + 99 others); Mon, 24 Oct 2022 08:21:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233541AbiJXMTq (ORCPT ); Mon, 24 Oct 2022 08:19:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB40F753B9; Mon, 24 Oct 2022 04:58: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 A71A461278; Mon, 24 Oct 2022 11:44:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6F60C433D6; Mon, 24 Oct 2022 11:44:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611852; bh=5Iqm60SwyyyRfJTCk22dEZia1Xh8h760FMFhJi50/Ik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IBbSC5Rv6funo+s+4ddbfw5c8SixcdkAs8OtTpaVZpQqaNWxdqIKkk4hHzvu0BLxL znLS0VBPeQiKOk7UhGgbOSw6zh0eoNcs+/p2WiRieJgCQvbP1j7lf7J56LnFhl78Wb tzrenB2p7VW6shm9RveEwP0h9Q2sce4rvdz2MM9o= 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.9 135/159] Bluetooth: L2CAP: Fix user-after-free Date: Mon, 24 Oct 2022 13:31:29 +0200 Message-Id: <20221024112954.396342352@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747571643839406283?= X-GMAIL-MSGID: =?utf-8?q?1747571643839406283?= 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 42df17fa7f16..ec04a7ea5537 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -4039,6 +4039,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); @@ -4068,6 +4074,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: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: 8517 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp405587wru; Mon, 24 Oct 2022 04:57:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM442p1TVLT85bvSxO3RtG8qU9btp2vmC/KAgQCoiLhuDgs2hN2GYX63qKVyBgn37reJkBKb X-Received: by 2002:a63:8942:0:b0:46e:c02e:2eb5 with SMTP id v63-20020a638942000000b0046ec02e2eb5mr13656421pgd.141.1666612639177; Mon, 24 Oct 2022 04:57:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612639; cv=none; d=google.com; s=arc-20160816; b=nSphqsuTsywsZX1rbXZXH4Hiooloanz0jxWHYV+5oU6SnRU1tT7QyOKxOt8SCqlKbj 8445ZyB72eAM3A/MMABnAjSOLjvDfKv7b/yicse0TsjquLV77iPxLGxUPSBEJ7wqd/+S M+TUjev/bgUcwbD0XlqWTnBj6GUV3ud9RaT7M7jcp8qE7bUvUAOipsCrtsZoamYMEnKd 6vphTZDDgMGlvGqBUz5UHM0M4TD9bD8EPq0sOlvegwgOsN8PS/vnSmcZ4YqTEhkln55k vLnJgBElVU3hGTLIoSebfhWWxikUSMTp/oBuExggOiAkeeitSgQh5V9fulIt/kguj4pX hx7g== 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=rg0OXQnS+Rtpph8AqWPzdqM3xa8dPCi0IuZwOcV/bO8=; b=Bwu4WDNH3+eN5jbiwJrail2hL2iSPZ8bSZABDSHmRlO1GGb9xQlB9At3V5qtZbHYa8 xdl2hksGyrWUcp++BzgOUEEp9pKhwZxDHkrXvhiZBNMgDEt6JClXEhQwyMaSJsl6fZo5 TCNKiRJCTX8dSYAagqMJvqjFkBai65bdD6L/JCNQcY3JQ2gPzBRsfh/T11t37ka52yab UJdvf41UfdVx3oRA91VHgAByjVynkC2U4xZriN+STRP3VgAQcse3y0C/TlTm7kNu8tGl 0OpAUMn+a1plEwqcYw2TqVzLZW3BBAhGFy2svogiUd5S7EqmfVGkFBNN7s8S3HhdeK22 Ryhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fnLcPRFU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 u16-20020a170903125000b0017a8a84a3b6si40591382plh.106.2022.10.24.04.57.05; Mon, 24 Oct 2022 04:57: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=fnLcPRFU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232292AbiJXL4n (ORCPT + 99 others); Mon, 24 Oct 2022 07:56:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232559AbiJXLzA (ORCPT ); Mon, 24 Oct 2022 07:55:00 -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 7319379624; 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 sin.source.kernel.org (Postfix) with ESMTPS id 64876CE1333; Mon, 24 Oct 2022 11:44:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5604BC433D7; Mon, 24 Oct 2022 11:44:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611854; bh=/DR/Pm6olMKD07sZdtTxvKVfY++LskMxUDTIWs68pxo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fnLcPRFUSrmCFitQQFknzjDRzEIhl+aJkUdMpOyu3uMkroY2q2/Z+EaoIzmaVM3Wf J3PWIPCBXUQ5/tanqTwiQNQodgucnB2qype7kdODHAFWCYACRbGUGaFCWlbNTJgMh4 vYrb73fq8F3AF1xhjRe8SrRp607/U+7FWELLep6Y= 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.9 136/159] r8152: Rate limit overflow messages Date: Mon, 24 Oct 2022 13:31:30 +0200 Message-Id: <20221024112954.430967872@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747570014275487433?= X-GMAIL-MSGID: =?utf-8?q?1747570014275487433?= 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 96f6edcb0062..a354695a22a9 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -1282,7 +1282,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: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: 8503 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp404896wru; Mon, 24 Oct 2022 04:55:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5S0Pgz6xGGC4bZvhHCvaib66QEuqS9DtLhoJv3fNkWihzHCCYHW5Uj9F1XFGUzby5dq2/5 X-Received: by 2002:a17:903:32cd:b0:185:5421:a5d6 with SMTP id i13-20020a17090332cd00b001855421a5d6mr33305582plr.99.1666612556876; Mon, 24 Oct 2022 04:55:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612556; cv=none; d=google.com; s=arc-20160816; b=I/4kojYnLyIRX74nfZf4lYBNBKmMs7sXi8OElCh776Qa4MznpG+MwiKWPKlakfD1Xc QjQYh+70or1wNZ4r82GoOi+gKp6SFyizEM0qKqHc93lCaj94ZFQ8gm8P8CLq9mXHZzx7 cfez1ZsF8rV78kMHxwYwOmHLMv+CWFrRg3AuK8ri31kVegO80Pf9/DzSqpqFcmygLHx2 mZSGMJnhZCFNm8WR+2jUts64hDEfECdTlIzIhiXJPwOkWixDEPrKaeLC0y2cPcnGgi2x 9DJhzFUTaSB0W1KondzUoB60xL1ihryCppz/nvkzM80c+S2A0fFNHLZyXqTZL56XEwfN 6rLA== 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=xKmn+I4iZsYUw1MgnWedPYUzhNvWOBKnALtoYlLcf5c=; b=FCT/xDqec4Is/SQS5PXjVzJQUYP2f0Mxlc6smyOfDU1Q3/cTxUEPpiNFnRNAhWx5rQ 03pYlmiJC3adDunzW8dNQN/McK/VC/+kljSospRNJbyk++CIw4gx4UdUEjAeNb5N5omv xT9lAvyOfFcrktk23UzojksqJRrMa9TX5LSEalB/o70Cnya/onQxecDCtHukr6N8uxOu R9D4vIwKRhuO3yWgVK4ZnkBgU8wdFXwhL4hW7w6AkDKYqFIfRETH+lKrbvkDneJC0XvO YKeOitBtBELgtcEWoA6pbKX09fNOiMI5Nits7eR0V2Mm/yimaRgmAL9p2VgejkOBJ+dU A3Dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Xt4U7kpM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 192-20020a6301c9000000b0044bf53e335dsi34289996pgb.767.2022.10.24.04.55.43; Mon, 24 Oct 2022 04:55: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=Xt4U7kpM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232113AbiJXLza (ORCPT + 99 others); Mon, 24 Oct 2022 07:55:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232366AbiJXLya (ORCPT ); Mon, 24 Oct 2022 07:54:30 -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 0CDAE78224; Mon, 24 Oct 2022 04:45: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 D84F26129E; Mon, 24 Oct 2022 11:44:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC95CC433D6; Mon, 24 Oct 2022 11:44:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611857; bh=pM5RMo4uAMiKF6X+4lf7+U0OlbszhbcSfGki5iniq/c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xt4U7kpMSjBq+ebNe0qaeKY0Nnf0DTVRS5vgxwA2gqqhU7IBdVp6duQqnAtL0CFB9 B/9pZ9YgHJFSYwUuzcobxS/xtHK1p4TZbMkZqnBl8fm1QvO1MmCmFwcp8pBtd4GlBz 5AYYF/XcX+VZ34DHPetmnynIdRNftnEFwd2SZ2/w= 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.9 137/159] drm: Use size_t type for len variable in drm_copy_field() Date: Mon, 24 Oct 2022 13:31:31 +0200 Message-Id: <20221024112954.471188121@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569928753465785?= X-GMAIL-MSGID: =?utf-8?q?1747569928753465785?= 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 04b26ca06180..faa084ff4f17 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -419,7 +419,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: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: 8610 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp419828wru; Mon, 24 Oct 2022 05:17:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ZfU03/dMPAvOhdCxCUubZ1rIemZGPLj/q6Mv+qvJapWCcrZkcL4pOyf5ka4nrsZuW+Xny X-Received: by 2002:a17:906:9bc3:b0:78d:816f:3743 with SMTP id de3-20020a1709069bc300b0078d816f3743mr27718069ejc.380.1666613822137; Mon, 24 Oct 2022 05:17:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613822; cv=none; d=google.com; s=arc-20160816; b=tD5Lz2bdcIEVVzVnB5RkrRAM2omOQI4LPQPlu9BTCKTL7kq1sYIAo65VjYg06KvtYR GKNbivR1nA4x7+NaPYtHVTLc+QlMV3BJNgHfs3YdpGWvDm6q8zRMo7xHutyZTM76HKQ/ zFy0e18YOyNfhW/ZjfVgH6f+iaZhtDtc8QMaLvTjZmrW3AQwIYSCyjKFtD363eERkA+z oTbNZtD1oskk0syqfAHElfcLTfc6bdPBb6XlvzeRrGSCMRQnpZkXa9djb5nFSlFClyHM S5ZxiIhF0I2o9G+MoMmzrVRb/tydP9fzSf28to7j5/trKp7F4KyoQgadL6hkwPLqHz6f zIqw== 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=DOFRO/bWH+KKwPoc+IH7uhzoLTyA4ofbMTkpY/Wpsbs=; b=sHEKLD/nQ2HlgTA8GK7KvuvRyyW4v6AJ1YnLu85/hD+HD98HM9uXdcg67oW3x1hf6h yv2brs21gYyQ4hKA0b5UVMHBlscW6auJxIzkuEWwq3HzmmNVyGvTZ4KmaneskZHcHC49 ImalJbYJ+lTk1R6SQA6OuI1kCKcCL3lwyFneiScLAOe4YFMUZgEXCbyTslbY5+VxPZz5 LgpJ+dRmA5HVgwFpNaEGSpumKc/HiKiv4hmxrOZfbrQJADNzfeQvXxWdnA0Q4x3Mfh4q fZMSIj1ZICiucvNUIjp1ktcAYRuEshuPeKULSh8fBC1UVYotkoZlOgLEGK8mQD9Gc6Q1 Ln0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=w+H08Hg7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 hb7-20020a170907160700b0078decbc3f73si29815517ejc.460.2022.10.24.05.16.38; Mon, 24 Oct 2022 05:17: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=w+H08Hg7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232675AbiJXMKK (ORCPT + 99 others); Mon, 24 Oct 2022 08:10:10 -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 S232810AbiJXMIz (ORCPT ); Mon, 24 Oct 2022 08:08: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 C4E2A7F090; Mon, 24 Oct 2022 04:52: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 38FE1B81144; Mon, 24 Oct 2022 11:44:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9096FC433D6; Mon, 24 Oct 2022 11:44:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611859; bh=X/yaVTCsd4HiFHtbdFJlQ8rZWp6RFAEMkVoWeuW8S4A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w+H08Hg77RY56cqTPTZFQ0SdKyDy688E3p/WeKjOJq+sOgU8UPvkCrPDIYdsyt9GQ JS9eKJoNJJF95Z4sXfBvR0BGYkI4GsWaY8CzeFJw8tWkPEHLORC1qnNblvNtuFzGNV O0/KWR5tguzfi2I2cN+1K6+TvbdOAFN+T0tr1Nxc= 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.9 138/159] drm: Prevent drm_copy_field() to attempt copying a NULL pointer Date: Mon, 24 Oct 2022 13:31:32 +0200 Message-Id: <20221024112954.507005242@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747571255379494320?= X-GMAIL-MSGID: =?utf-8?q?1747571255379494320?= 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 faa084ff4f17..ec505929cae7 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -421,6 +421,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: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: 8523 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp405846wru; Mon, 24 Oct 2022 04:57:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6pQQ/kIlXG2e+sPlMMqWbqIrAkZhMS/KJ+zujJcX7Bg3lQIAdL+BoN0julCDAmIRf8pDt1 X-Received: by 2002:a63:2c90:0:b0:439:ee2c:ab2f with SMTP id s138-20020a632c90000000b00439ee2cab2fmr29055303pgs.2.1666612667451; Mon, 24 Oct 2022 04:57:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612667; cv=none; d=google.com; s=arc-20160816; b=GbTWU3FDybEwX3qIMZG9LLR8ujWnirJq1eePbjFBrYFVj+8vinPZISa77P0rCIlaRZ 6qh/e72RQDpMHxmibb2OjHa73/cFw/NhPXyNWZFrP3GvJUxZlaMUkzAKme5CP9BTAJMd joVceNFZbtzn3iHAnkRZtgw1wkDTSE7lef5/HJpYoh0SPE4pSD+rgAlTO+U9gw3iah93 lDmPrRtLpGfeZRFTLz2J+F2VEo6I5BPIZSLZVu0oGXpP8uMiMGlmx4VZxqvXkhligJco JqlIGOmA9kYSBhJlkP0DP/QeVSKa3XcYO9hOOB9JF/2fblzFAKDFV9rn3JueZW/nKWUV CuAA== 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=OElQLt3L0RqtRAbte7JCQCD93m9hcRdmRY/WHh6gWRs=; b=jSmV01a6e4hqe886JLu9e1Tvz8taq58Nzl1Pt8iqUq5tAMpklZ5yYHx/ViTEOYcCjC GkuIF00CSE/mtjwyrghhKWB+luTOsnOiEw9tJyD2pZi6/Nt/e6Hxs6pHPIN3T9UhNbya qGgWqK0FJncJxN8JFsqIsFzE3ga8PFvhcERCPNNQ7iXD/u4ZcukIhZ4dF8zqcK2pEsSG cCmme0klKofnLJrv5asjgRGZ7gdzK1mg9AqCPESulH1Ve4EK4m+y1uSctjLgzGp8MCzx T+qb3zgvckK7DptNU5X2lloooYIjbzJ4LJ9SR+q+LqmqD/XqTZMSI0/GqN6qZ0wTwCXr Fo6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Mvu5rjvw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 n24-20020a17090ade9800b0020db7d975ecsi8293165pjv.176.2022.10.24.04.57.34; Mon, 24 Oct 2022 04:57: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=Mvu5rjvw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232339AbiJXL5L (ORCPT + 99 others); Mon, 24 Oct 2022 07:57:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232094AbiJXLz3 (ORCPT ); Mon, 24 Oct 2022 07:55:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3B097A77E; Mon, 24 Oct 2022 04:46: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 ams.source.kernel.org (Postfix) with ESMTPS id C9DF3B81181; Mon, 24 Oct 2022 11:44:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2EC05C433D7; Mon, 24 Oct 2022 11:44:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611862; bh=DlZ1qlhuvU0M2fmOjGTSsN/rid3kjJxd5Kr7o+fWS5s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mvu5rjvwU1toowyCbZyIWoMB4PDHO7gUBoUt/R+nFODljD+j7RFSc6VMyCUIhO4Qt IibS+my/bCYzUwYnFTfwlzXu164ZVBq2TXgwYy2nbWZ02AqPEBoz6qhhjo4xA/tLU+ 9vMmrzdohav6a4m23B1U013UqQJrNandc1mrZyhY= 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.9 139/159] platform/x86: msi-laptop: Change DMI match / alias strings to fix module autoloading Date: Mon, 24 Oct 2022 13:31:33 +0200 Message-Id: <20221024112954.546646685@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747570044449463681?= X-GMAIL-MSGID: =?utf-8?q?1747570044449463681?= 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 c2a1bc8e9fef..4ae2287ce262 100644 --- a/drivers/platform/x86/msi-laptop.c +++ b/drivers/platform/x86/msi-laptop.c @@ -609,11 +609,10 @@ static struct dmi_system_id __initdata msi_dmi_table[] = { { .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 struct dmi_system_id __initdata msi_dmi_table[] = { 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: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: 8510 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp405266wru; Mon, 24 Oct 2022 04:56:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7ioo5CZ0j4wJvf83SyEhWOu6ZHk02Uw61hnIFJhx/N3ZIwMHCDlAptRK7qjz8PLWozehXj X-Received: by 2002:a05:6a02:207:b0:46f:1a92:9474 with SMTP id bh7-20020a056a02020700b0046f1a929474mr1581388pgb.344.1666612601973; Mon, 24 Oct 2022 04:56:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612601; cv=none; d=google.com; s=arc-20160816; b=aoqHDcNKXFF7jW1vkzjaXoVF5+uXlKUh1Ycz+NlsFYMzhi9/t1DFL0Jp8SujXcUBJV UbDaH1ZVEQXg13cgFwTzmdwMYinBYM9C89l46/stQ05ERbEhn0yGXWbkb2gTmYAvmhZl lOZ2hK72ZGR5i8S0GgvGClWrU13WUq4MDJy9nE6o7MgRrHf3KEEexkKg9T7J9f7M9yYI r2nXxnQg4+arsk5EgDnL291Z5AQKRBkZkqa8rycKn8cmvuXbR5j8gth2kXPTaHZ9/78j wr7lNwtuAIjZ+1Xx0a+jxLVSCNR4MIxqxdBh+ETGK131tK1Lw2tAwPwot46hJzCG8iuS 9Ckg== 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=dam38o7rU473gQuap5rU51Rbv2u0ljSDJ68MlizsPAk=; b=ytQtlKAmrOnBLVoFMQOGEQl/iO6LFLnX/wWK6DaxI2is7woLpjopJjfu2mvQQ93iWS FwVbVeuj3k/ccryAHg4qMiRx8dfXDTLUN/eXRn+jgg/vkuf1Clw2ikUmexN9L5WQJUus kPfF5eohNwasbVeowg6d3b7aCLDdpo25JPEExSBDJW6BNPowu2tX88OUXNpzzLrNmzbt +nw0wj+K0Y5Bjs6wLhlHgC/yuZYSSq1XZDzXsm4hqPPhqvsq93DFzOfythF+MdoWWznU JwIcb22FazkbeWLpctHv2bUddd9Ccrsuy8g/SJfrK/dG1peNRE2aNHGbNDZ48NdqIVo3 QdZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZL6l034V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 e3-20020a17090301c300b0018537cc29f9si6599861plh.15.2022.10.24.04.56.27; Mon, 24 Oct 2022 04:56: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=ZL6l034V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232258AbiJXL4J (ORCPT + 99 others); Mon, 24 Oct 2022 07:56:09 -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 S232226AbiJXLyJ (ORCPT ); Mon, 24 Oct 2022 07:54: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 987C9399FE; Mon, 24 Oct 2022 04:45: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 6839AB8117D; Mon, 24 Oct 2022 11:44:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C240AC433D7; Mon, 24 Oct 2022 11:44:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611865; bh=91Cs5LiCxsUxrtJkM/+UxL67qhxRWjuYTje3L63IUJ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZL6l034V3x1b5N75G7/cLMlV3DrkQ/7aAStgNmxvnqAyYrxlophMxTB86X8CGPV01 QieW48uLgIImLlIcJ7y+Uu1Bgrla3JSpf2B4tJe+iO+LOwDIEjH4BWXvv3S5JGN99W xpTY1Ht3HU2F92WNdONjPNuRr9hDzlvfQXXF18EI= 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.9 140/159] drm/amdgpu: fix initial connector audio value Date: Mon, 24 Oct 2022 13:31:34 +0200 Message-Id: <20221024112954.576372053@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569975909824077?= X-GMAIL-MSGID: =?utf-8?q?1747569975909824077?= 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 7264169d5f2a..7c266dbb88a1 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c @@ -1760,10 +1760,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; @@ -1868,6 +1870,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, @@ -1916,6 +1919,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, @@ -1961,6 +1965,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: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: 10144 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp638376wru; Mon, 24 Oct 2022 13:26:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6E5L3t+U8v7jP+UAC0xND0JmARfGjDSx+8XD/oKc2F2vM4UAyTD44mC5I1i+kfgEQPdceD X-Received: by 2002:a05:6402:f0e:b0:461:aaa3:a11c with SMTP id i14-20020a0564020f0e00b00461aaa3a11cmr8409752eda.53.1666643205698; Mon, 24 Oct 2022 13:26:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643205; cv=none; d=google.com; s=arc-20160816; b=SXXcUve8ZQjCZ42Gu2zbPZ5AWxoUwato9E4Ez2dfj8g5yH22nlqWr2L2Q/BmshHQ6U lQ2jiYkhvrOrhFsobpsJgi9velWExcwUcwC6TkkWfRFsg+BHfPl8yY5iqQT7KoKepA0s iyqRx8AS9H6Dd4Cx/jfJcjbo8oMZuEVX5a+I4TqJj9wUANCjZ0/Lnlww/8vog22f9KXE suju78sRMiZb6nwU+bBJLZcf6eKdFmpq5LlmKeY45ZY1hcaYpMazIvqxfc4EEtXBCvYe 3Tk70nNj2hDFM/HHfXCtEMo6t2INhC+9G9uNS4deHHpoiu9KW32O7N6v3NzTsob1Wn0g XfrQ== 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=hz4PTiB7UpMxLhqMdsIEqu0y1+HBa3CTkbo9Tabif/Y=; b=cCn2XRfkHY+CsRHCfGoJfUCrYslmZLDDbqFQ9QUEGTSZa4SS+SQNS7jdfh6el/wuf6 RXL3vJa1pCsFDBTqd6U39jf9SUifrWjrxqcTEGDYCg6unBgn8w+vN//WsQkKq5IKKEMS GntTKOU8XxHLeCPbh3VJBZxxztR45j6G+83+rC7ykH0FweWoNyOG6jTNH1scU6M8Y6za 5M28NFLol61swkxBn3jgsgYO6c2D+LLo41Ka+zEMecjwItN0HzJfTWePy35YIdh7ZvHe tjJ9a2Bnifdazt5WndmfXeSk3wwcd6jr8IIyVSZphiK8qe+XBBynn/uPoojkoEEiG7zF dYmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lgX8DkCK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 qw5-20020a1709066a0500b00780636887fesi684846ejc.797.2022.10.24.13.26.21; Mon, 24 Oct 2022 13:26: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=lgX8DkCK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233482AbiJXUQ3 (ORCPT + 99 others); Mon, 24 Oct 2022 16:16:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233342AbiJXUQC (ORCPT ); Mon, 24 Oct 2022 16:16:02 -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 48F1D963BB; Mon, 24 Oct 2022 11:33: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 ams.source.kernel.org (Postfix) with ESMTPS id 15271B81145; Mon, 24 Oct 2022 11:44:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63989C433C1; Mon, 24 Oct 2022 11:44:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611867; bh=X12gymILKrBqN2UagWsYOuLELZwdwf54zxIm9HZty9Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lgX8DkCK23UCn7qWWCv68BuQCeHxFwLH9X1qJuSYy39eZQOHN7KrmBSQyssPRNVEV e8LKblkM96qmLMIbtxuK9zSAv46A3GUk5RFHLbhxay8eRfmS48OAjcj3YHbfmXoKOG 5fSwSLU0mqO1G0wdU7WndHf+Pl1yc2s5munCdWKM= 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.9 141/159] ARM: dts: imx7d-sdb: config the max pressure for tsc2046 Date: Mon, 24 Oct 2022 13:31:35 +0200 Message-Id: <20221024112954.607235171@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747602066362775343?= X-GMAIL-MSGID: =?utf-8?q?1747602066362775343?= 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 2f33c463cbce..83867357f135 100644 --- a/arch/arm/boot/dts/imx7d-sdb.dts +++ b/arch/arm/boot/dts/imx7d-sdb.dts @@ -126,12 +126,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: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: 8484 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp403536wru; Mon, 24 Oct 2022 04:52:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM77UBJmsLTdGyzR3c3kS/Vo5DOIlJyIZf7m4oYp/h4DD0XU2BiU5qR6+tC2RohgkRR5673Q X-Received: by 2002:a17:902:d503:b0:185:457a:9325 with SMTP id b3-20020a170902d50300b00185457a9325mr33402186plg.140.1666612356458; Mon, 24 Oct 2022 04:52:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612356; cv=none; d=google.com; s=arc-20160816; b=vOQqv5v59APdXM7A2leVAkrAUMXffaLSKKR1wMEicQv9OktOO4vB23L76MXFv0tv1j W6rZ+JArWaPWQ2HRSJb9XNHnJEcRknMaRVxasK7Ti2eku69bvJFzB/i1bxDRDbfbRErE pFxSQKk8LN/Z1P2aD8huwoeKOl6bI6hzfhrChD26Ht4k6cy9dGlI9UgWZNhZJIQwSecM UDSjNhQ+t1VvcFFWGrngIp/IUwkyTUQsfUFWEo3aiybW0jvxWkJGuKZT/HYdtqKg8E9V hvECYTUbbR9N2BDKq6OEp9x33SYhl6pMy4aai0l8ta0QCVAsuHF+s0o37LTjk99nyp6v t7iA== 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=sFMFwqLJsgoLUzSF2OsEp+b0JfPZo3V9FEmP6n3t48Y=; b=ROHH4l2SVDy2DaumXuQ5RIz1BdRVrO6lDSp08aRrqmMHTd/fIF/OwcBQTpI/M/Kuvr /TXDAIAeggngnIE9nPvOcg+tk6Q3KX6BR5vUu13Lg0DLWyncS0ZVn76nkvsi+nEEsXZa 0YAku9MQ9iHFkodppaemsbrRaIh3bIIrRU7oVFQNfbeIc/WC7t9/F59HrRJGu6UJRe9w kg63B183+icuTecnkJFDLomg7SPowy1ZQqHsRYQ7/NeGJp15SmA8xcaB0YvQDT6+Xz7i 3cGYSUNHfxSTNzjwxOjSzoDlEOhjrETphyRU4eNh5cZo5TiGt2JR8SZICFeb6alzyM0X hADw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Xom1rmQE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 d8-20020a056a00244800b005624037d3efsi36651528pfj.295.2022.10.24.04.52.21; Mon, 24 Oct 2022 04:52: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=Xom1rmQE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232007AbiJXLwG (ORCPT + 99 others); Mon, 24 Oct 2022 07:52:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231846AbiJXLuK (ORCPT ); Mon, 24 Oct 2022 07:50:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DD6164FC; Mon, 24 Oct 2022 04:44: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 E4CF4612B8; Mon, 24 Oct 2022 11:44:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01ABDC433D6; Mon, 24 Oct 2022 11:44:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611870; bh=d4BqT0foyNTkikvIXAvWhBjvL5do5M3do2PBAoW3L0o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xom1rmQEzqnrGoQRo+hNC2e1ZQlggrmEcvnegtglwy1MhGzVNH6FDG8E4POr95SaU 3AU9gwCB6zugMoPRr02SKGlNu+Ag6uwXv/uodCUVjG1q3SRGp568e+hu5SpKjBtlyC weO4G6v3rKxGR8lW+sAreLN/gkUAIlzMgMgLlkS4= 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.9 142/159] ARM: dts: imx6q: add missing properties for sram Date: Mon, 24 Oct 2022 13:31:36 +0200 Message-Id: <20221024112954.650513546@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569718003042465?= X-GMAIL-MSGID: =?utf-8?q?1747569718003042465?= 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 908b269a016b..692afd2f5dd4 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: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: 8513 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp405385wru; Mon, 24 Oct 2022 04:56:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5xJ7gODFVm3gBvn+HcHDaA+17RLWdHTM/WMwnp/VLYFhgUut6qTBL6+mKwyBfCBCbLdgzb X-Received: by 2002:a17:90b:4c45:b0:20d:4ead:6e3b with SMTP id np5-20020a17090b4c4500b0020d4ead6e3bmr38961901pjb.76.1666612616188; Mon, 24 Oct 2022 04:56:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612616; cv=none; d=google.com; s=arc-20160816; b=g6Qysl8fkIqNEvfHsTSVkDm4bO2tFUc5yErp5TpkxamDgIGGiK/JpvNJNc48GloYhR pbNxkBMk7tdAaY/vuxp83jSjJ8HaDFv2tm/fWRkOeQJ+NleZvI9PxLWKoIexnfvm3ADw 6vX38wT7udkPAUoOTKTuFjR0jJr0JzntMmoRqoh0VnF/HaIY3W03NM/BPYAo005/CnY1 Vm4kW4H5yfFt/TQnqPTg46hwSWiCQ6BNJOpRi4bow0CpAH+tk+PDYf3YPmMV/7J6vAN2 G7Yy8obZ+wu0Gfj8KaObMPW+Bl6Wnt4htEM/y5vgYB0/brjwfUjE67042NRnzQzjLEOl 4aRw== 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=N/2G4YLHuYC3A1mpBE2WIpeyXFlA1/ZMXVIlqmbKe6k=; b=uJVkLdBXUMgpwqz7RWv+2rbTbxrWnz5VN1MQ7UY7Po0jkKrOspkw380hWYv/to9V5d NCPSify43wRp5PcDEWEFmDMLHan3SypFvPQ01T3rt6znwofl3pQ7lvken39YT7Mp4N8g c4XaNV6dvY7rj25iOUPACUrr5YAW5/pOP3nkUjAYU9NEe/3PcPZ0x4sa2wYS33O+h8jj Q+TmuZ0cJUJXgRZVjTbtXUCvetAMT0vimXHr5PCHOcPU26cZHQunbysz7GZwMVBJ7u9h +eqiCeum+uiRS+uflHKE5ZefvXNFmrSHrG1IF5l3T73Ri7vVSBm5UZw/DFYQgD42siAt 4GBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Av0nNMk4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 x6-20020a170902ec8600b0016efde92292si40552172plg.255.2022.10.24.04.56.43; Mon, 24 Oct 2022 04:56: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=Av0nNMk4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231971AbiJXL4U (ORCPT + 99 others); Mon, 24 Oct 2022 07:56:20 -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 S232416AbiJXLym (ORCPT ); Mon, 24 Oct 2022 07:54:42 -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 7E9F3786E2; Mon, 24 Oct 2022 04:45: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 25B1C6125D; Mon, 24 Oct 2022 11:44:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E428C433C1; Mon, 24 Oct 2022 11:44:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611875; bh=dt5QEEQ8AgZ/PQvoRr932qcyW4+huOVECm7UcPq0Jus=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Av0nNMk4eJLolncZM8Yzmo81XbhCOz5l+7P9xnRXdmKkU/eS3qvYjZZOkR4Lx6G3Z D2rClkRhkaPc8OuUDXlgUnqQ9KWhQLqmM38k39Oa0/Jm6ZTZj4ZY4xh8Mn7z2VKkBt YeJOmFYsasQDYj65VX1uSP/53QlJr+3LWtUJZ3Ck= 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.9 143/159] ARM: dts: imx6dl: add missing properties for sram Date: Mon, 24 Oct 2022 13:31:37 +0200 Message-Id: <20221024112954.680725090@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569990528583041?= X-GMAIL-MSGID: =?utf-8?q?1747569990528583041?= 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 7aa120fbdc71..82a7d5b68da7 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: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: 8508 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp405203wru; Mon, 24 Oct 2022 04:56:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7diNsfNu1aWjgxDW9iSHU/4h1Ec6FXRpY3UzGvAM3eEzfXWawzlnbnOG5oLEzJuXOfXMAA X-Received: by 2002:a17:903:124e:b0:179:da2f:244e with SMTP id u14-20020a170903124e00b00179da2f244emr33237980plh.169.1666612583968; Mon, 24 Oct 2022 04:56:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612583; cv=none; d=google.com; s=arc-20160816; b=FXXIGeHuNN5Ph2fAir1Gu2X+9NB8Ubsrx3/q6kDPms5hT526JIO0+agYBUi+ULryxo mXEuB1FpJogc292SmQftyuF5v94aKBIIukffVM6AZklN3cqYwSLyPLk29msj1ws7easX b3KVSCGtNiBoOsS57mrbMTHFQbN22GRjYAivkZhoa/JTeslBeE27mNGn/d9tt5KOdM/N OucF/MsTS/4osVjICf7vMFhu1eFVj5y04SxMmMgfRnFVrTl9PKQsOFKIbdnozlg9jynn RRDPa9fkbIFhWOv/w0eiOiFs9qXocIqvYBjwHQpiQawm062KzMtfPxHW+JgkF2guse6h 6gnQ== 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=VHlm1hYhNPwhwtR03ZvREOEHXUf6j94aBaQsUUyk60o=; b=XRO/Qd6g6RgiocNEx4oOsnyotXIKyrMXh9KB5gf9HBvBTi+glD1/3wQUEidR6GJHoF itKGKIxIjyT3T0M66h+if37dfaEiLz2Ic2+h7bpCzCMFs+oqrjJ6ybLEm6QOq1YZ2it8 L5YMytVxZurkpInP5XD2FMAKjASEX1HenK7hjo2ViiFLy/nUW6BjNUCIBJMzsALAfg92 MIpTJEewhhTRSBfQUtKiDZi0/Oxy5uEI3XMpEmUUdbSwKxuSR1dSQXhBfj5K2iMYB/qE s+efttnGRPen5B3QiT3qn+42y8FZ2psZh7VgCfrTMLlS9sOCyqQLaUYd8xuTmoCrcWrO prGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=z4skdc77; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 mi12-20020a17090b4b4c00b0020befc1a93asi17913054pjb.100.2022.10.24.04.56.09; Mon, 24 Oct 2022 04:56: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=z4skdc77; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232204AbiJXLzs (ORCPT + 99 others); Mon, 24 Oct 2022 07:55:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232418AbiJXLym (ORCPT ); Mon, 24 Oct 2022 07:54:42 -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 DA82678BD9; Mon, 24 Oct 2022 04:45: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 8A807B8118A; Mon, 24 Oct 2022 11:44:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4F3AC433D6; Mon, 24 Oct 2022 11:44:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611878; bh=WjWo9gp8nfhaYDWBZT3Dn6995qdxKtSxZ3nJSPucSpw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z4skdc770+/jFdroQL66wsoewlbMAAEeGaqsI1W2Q4hQveXFa4l/4FuPKrXE+bKZp vDvMo8ZPRQAUdoMH3cabhF5kc5FsW9fjP0o8HpmTXXtFgy2lm+WIByk88hQn7hthYR Y+K2cW0vCAWvn61qMIOE+PydsL43CP1Lmk0ZZjTg= 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.9 144/159] ARM: dts: imx6qp: add missing properties for sram Date: Mon, 24 Oct 2022 13:31:38 +0200 Message-Id: <20221024112954.709877631@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569957266547344?= X-GMAIL-MSGID: =?utf-8?q?1747569957266547344?= 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 886dbf2eca49..711ab061c81d 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: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: 8509 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp405233wru; Mon, 24 Oct 2022 04:56:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5jqp7am+9R6wy3a7xdcctdmaUEBNwRqVuxoC8wP+bAnrV3j0K9Ah7Bh/njHMW+ZdR/D1Wf X-Received: by 2002:a17:90a:4216:b0:20d:2891:157 with SMTP id o22-20020a17090a421600b0020d28910157mr74965156pjg.47.1666612596990; Mon, 24 Oct 2022 04:56:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612596; cv=none; d=google.com; s=arc-20160816; b=gHbf38Jnju80c4WM3L+RONbggQ7Yy0RBO3fV3IRnoAKcJ5E3QjtOCwJtdwaHiFEomi gb+dxc8hndsuVXlvSKCSy/y5no8nNLOIVLLrSUcwehrZPhZ0LiEayEzYYwt22zW/sl6H vWfjm//K6rRnKpfghuITvvNuNwwF4uHuZsA8Tvet1nfApGj+IPt4LAYwLP5Xd0+ciX2l VesoZb06316WMLH3PGwkdy7dpkF/HATwb1NaRUnZguXp5pfozLWzqhn94KQFTj95oS0T SSmCwwbhTq7FmjxuelUZkLadQaL9ru2Xqgrb5rwKIzYKcBc4JFhBxhHw1EN2ExEc7tgl NdDA== 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=hkfU54f79IdXdkFIrRrVkKxJN+MAeeUT3Wk9bUEtOhw=; b=Etpg+aL2zfBzz6spIbVuyaS5je7d0H8AJAbyYwqBVAjfd15W8T1ZkvcRTB1uh0bJw8 d+A/MQBebfRoV10TnwNll8DT0PlPZZhYo5CTN9DCE2N4BjoqdS2aQRqZuPi88YhyI+hW RFQ0w3O9eul9x2ayCH0p5gwKNCjFcp+2Q3WhrAhVNyXNg1KHT+rNX2HU0D/FBAvlcKRq Xi34DDxyDc6+LBKWW5DJjwPFN8zzNliSqkyg24CIaqUVubRKDk4rp/qaeJfVI5Ewb4w+ n4h9c7PWae0cAE20e0PiB8/HBQe6IOx4kBy91B/bewc+MYGgyibV5epFD9E8IlMAEfBf YQ9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nig1tnSj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 145-20020a621497000000b005631aaf81f2si30570234pfu.183.2022.10.24.04.56.22; Mon, 24 Oct 2022 04:56: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=nig1tnSj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232253AbiJXL4G (ORCPT + 99 others); Mon, 24 Oct 2022 07:56:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232400AbiJXLym (ORCPT ); Mon, 24 Oct 2022 07:54:42 -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 1CBA1792CC; Mon, 24 Oct 2022 04:45: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 74F2D612B2; Mon, 24 Oct 2022 11:44:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85C14C433D6; Mon, 24 Oct 2022 11:44:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611880; bh=aTmeUz92y5D3Wshw+csWV7rUsqv8RnRLn52S0qRdtUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nig1tnSjmEvTejpHYyoJlSjBvtm3juii2qORWNQC9uMXbyNLuWtKrBfTvKEpwKMjX xzccLNVogDhsMKgTFHzENgEp6LiIra2bfMgi2MNJlgq372wqY5A6ZVjEoj08tInsk7 C6wPNqOirxgBdEzzQlAilExxRAM4BKncfCZiJg1c= 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.9 145/159] ARM: dts: imx6sl: add missing properties for sram Date: Mon, 24 Oct 2022 13:31:39 +0200 Message-Id: <20221024112954.739429530@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569970642096358?= X-GMAIL-MSGID: =?utf-8?q?1747569970642096358?= 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 a2c76797e871..a9a53a78de03 100644 --- a/arch/arm/boot/dts/imx6sl.dtsi +++ b/arch/arm/boot/dts/imx6sl.dtsi @@ -102,6 +102,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: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: 8515 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp405502wru; Mon, 24 Oct 2022 04:57:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM66yB5lCUDmP06TzNZQHzkwK7Lzqk8APUA/Kp6kMC/V0av1zN2OXtc+f1LiNV6Km+vCKo8T X-Received: by 2002:a17:90b:1b0f:b0:212:9b7e:82b2 with SMTP id nu15-20020a17090b1b0f00b002129b7e82b2mr23872654pjb.199.1666612628612; Mon, 24 Oct 2022 04:57:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612628; cv=none; d=google.com; s=arc-20160816; b=x2tF0gxP3+9rxsmfWeU4Dl1UjYdysjiy9Kyb9KvqKdhBeUEpbULGvB1+U3SW90tijD LuAMaSJ/r5gW2wLOHZWLJcdE8yFmJd4TjwGKM9i9jF6MtbT4uh0V/ELZOnm0s0C2Anbu ccikmqdUTO5nFFfX4U10UoXhl6mzAj4eRkREzhgddqzKmyAaF7TQ8me/yEthZyf4f/+w j2ZTStpvapWT2spklmoYWP1d0VEQP4vruPLTXEHA1RPq/6++QXMfH8sUh6T2e/votNg0 jie1aygEPQcALgLozUWcUYA8Kw+T79YAhVqDBJ1XY3QpwLTXn52H/vE4GawY7VOXOfwl PR2Q== 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=6vdtdtkpyJpiYZEGpmE6rR5NSomwQXqySe4gmwMW7Ug=; b=kT6YvdlGZHq0pwT1y/KWv9kz5uJutB77VYlqWhNJnmx4yKJ29aFsCBid//xtmeIFPX SVNj39VFXAoSpnHzdashq9gV6IKztUeQHtih0g3yHhzUisNAcA/M14LBCGu/ToLgWvAD V93RajmDTbL2JEEU/XJxCAdQ/Zn+ivJ4Yv4fhT5bnSe3MbHfetz7Lzv8FNqv1zEJrSnn gXKUPDxsLLBpcIT1y4VCdeg1fr1zqHCOrvmhtRajRf7tJpASySXVljPaHwL+VkPVcNiY xNf3qxb3iLbJ28dyDYVVKFNpL3XBPSaGkJKOGjLc0vzFbnExySCv0u2VBEOLnV9+7owj n5sA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PTMsouUV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 131-20020a621789000000b00561a2341e81si30208202pfx.125.2022.10.24.04.56.55; Mon, 24 Oct 2022 04:57: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=PTMsouUV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232278AbiJXL4f (ORCPT + 99 others); Mon, 24 Oct 2022 07:56:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232357AbiJXLy3 (ORCPT ); Mon, 24 Oct 2022 07:54: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 D7BAE77EB2; Mon, 24 Oct 2022 04:45: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 ams.source.kernel.org (Postfix) with ESMTPS id 4A4CFB8117D; Mon, 24 Oct 2022 11:45:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A65BC433D6; Mon, 24 Oct 2022 11:45:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611936; bh=I8ezokeOvdwxeajGpOMcd4rVTOREH+HgaSV+jFScXJk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PTMsouUVqxmiViz5oQnyM0qPRZGc7tOls2HhYpTw9i1vpx1bJC5SH/6AHViRnZENT AUjEsvCOB5n0E9SBjAGuVbW20bP/xk6LuzupNAWCivC/+cpakVuvHQTYT9ARt4v0XS 22lh+izlUFVZ0BfVG2uNvIUL597S8DijPqzvlKv8= 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.9 146/159] media: cx88: Fix a null-ptr-deref bug in buffer_prepare() Date: Mon, 24 Oct 2022 13:31:40 +0200 Message-Id: <20221024112954.768957578@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747570003695833331?= X-GMAIL-MSGID: =?utf-8?q?1747570003695833331?= 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 d3237cf8ffa3..78d78b7c974c 100644 --- a/drivers/media/pci/cx88/cx88-vbi.c +++ b/drivers/media/pci/cx88/cx88-vbi.c @@ -140,11 +140,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 3b140ad598de..0ad0f4ab6c4b 100644 --- a/drivers/media/pci/cx88/cx88-video.c +++ b/drivers/media/pci/cx88/cx88-video.c @@ -443,6 +443,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; @@ -457,42 +458,42 @@ 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,"[%p/%d] buffer_prepare - %dx%d %dbpp \"%s\" - dma=0x%08lx\n", 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: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: 8531 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp407729wru; Mon, 24 Oct 2022 05:01:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6lWPEYY+EJRaSv57zGDJF6rrElk9bQqYtP31ouM1hhGbG247UDwYQawt+MElSrMc2m7RJB X-Received: by 2002:a65:6d93:0:b0:42c:50ec:8025 with SMTP id bc19-20020a656d93000000b0042c50ec8025mr27243852pgb.62.1666612898110; Mon, 24 Oct 2022 05:01:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612898; cv=none; d=google.com; s=arc-20160816; b=SUPR69DQtYcBGEhlbDfAqFwbcw1+I0ZkyTTiOqrgrNSj1gG6fD35SmNQ+CCVG3M4aR p/LJZMYG0UJzGfKTZQJmjpwWXHC885TOkx15IgNCEBGSuVj8JCWA5cUi37FJ55AC7TpO PDBnzM7IDKEbJD4GgZO+CwiTYHdADb3YBTNBEmILVT7Bf3A0srcUr4YnwLjFAlQv2mML A1SgoO0BOOYhobCtCC12Q375N5FD9Y9W4T6w7rO7P+DmXw7O6d3KM/k6zr6jrLXBAqEB 7fYN8euPZqghELYqb+uWeUHKT01bdALXNsDV964eDstirKyMfIXjr+cieMN6Vy/tZpnz MiLQ== 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=ZfzToXs+xg4VYGjrdT49FsXUbgOEv8ZlgcKeGAb1D10=; b=AzNt+YcJx3U+6FFMCCDDGZn+o8+3PqQF5EvKhKbR1RZkYYWwOYFo4N+V2kvwpiZy8j 7X4H3nMjC5awOgGCzgXiU3zwbfN2GcrXqJ5BW4EWengecxDfQ7Mm7XvTrnjC2diI2cHo jfteOr/xbLanOYxvGA1UH3ioQ73BevCfB5i7EgIXs5sWpROtrwCu+ADnx+V+sjh6gxN4 NMz4to22SGL9tVs9VxKgo8q2Sk9qFbyhycwGNKmGMDLvt+AjkAMIebXIXruRYMocZAW4 rMrcE2cWLCaGGqQc91HXUs2MHiZS3VWFkN6u+rRcyLKu4m7XgxpVuLx5FShHLm+1Ielk VC3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qQZwLal0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 x2-20020a170902b40200b00186abd0dc61si2564744plr.386.2022.10.24.05.01.22; Mon, 24 Oct 2022 05:01: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=qQZwLal0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232364AbiJXL5e (ORCPT + 99 others); Mon, 24 Oct 2022 07:57:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232218AbiJXLz4 (ORCPT ); Mon, 24 Oct 2022 07:55:56 -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 2B6E179604; Mon, 24 Oct 2022 04:46: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 2EE57B81199; Mon, 24 Oct 2022 11:45:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8076FC433C1; Mon, 24 Oct 2022 11:45:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611901; bh=Nr5t4iCikBHX1YYkYi3yjnB3SitGSSUtsTQsdlXTOmo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qQZwLal02ypnSz/Ese7WEZAKWRRGxFm4Jg8Hbn4zS0P3j6HjYOj7vYvQ02mxDhCeS WbIH4QkyYidk0kokTuzeedf6T+pUG3ydYElApGJq+T86zpL1NN2+POn2PtvoPj8RKW INjLEvxBIQ4wXLSoaAqUwpwSDJLX2NSHGiQPSP/I= 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.9 147/159] scsi: 3w-9xxx: Avoid disabling device if failing to enable it Date: Mon, 24 Oct 2022 13:31:41 +0200 Message-Id: <20221024112954.798605506@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747570286184749186?= X-GMAIL-MSGID: =?utf-8?q?1747570286184749186?= 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 b78a2f3745f2..9c2edd9b66d1 100644 --- a/drivers/scsi/3w-9xxx.c +++ b/drivers/scsi/3w-9xxx.c @@ -2016,7 +2016,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: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: 10307 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp656135wru; Mon, 24 Oct 2022 14:17:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4MXdtWexFsHGHleIPA8uTTnkjlSWeBZnjr/S5g/ULN6jo5QR/vYHeYOBxirs9W/dzi0V2h X-Received: by 2002:a17:90a:d390:b0:20d:3b10:3811 with SMTP id q16-20020a17090ad39000b0020d3b103811mr77317854pju.211.1666646239484; Mon, 24 Oct 2022 14:17:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666646239; cv=none; d=google.com; s=arc-20160816; b=o4gCSE5VqyW3Owxbkb8FBSEP/nxTxKEPEofJhqalzk+eTsnGpzjo+2vu4zFsLg0uSQ 8915DXdKj1JIFjyHYQh8C6COn9gjwi+BeeAWFGvWwUQxs7M958G03MCsfsdH5UPwHTkp zEreQAQZTgwey3ajEz2AThfG4RuSOoBpoEU7IcgYhM9juwJQdChfpjbuLxx/8Kv3oX0B tEBXA14C/nyhdQqdHgrEjFdoctauxeV39ocjq2NKx4K6+kHjHCwe3Y66goyvyefJEkZ1 ZJmTNtDte/uEX8CkJLHcO/aHdeRbgK3VkH92LCP/6N/tQo6yS5P4Wsp0l+jrAKHNPc2E zxsg== 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=bxTDcXKS0pn9tZJwiRUKP1WfQQsP4TK02gOlpRaE0fs=; b=0TQQHNO1bp4xgPzRDqVdGKqPyO6zDfVct8RooDqc6SqH60wvbJijfs5JY/acurVmbe af83JBOrrgU5eZonjaX9LxeK+gsxEc6JLbtp6C0D0kp0ru8jsRmHyB8IlZLt5PPAHAGM YQhM/KVQckjJE100/I7ka+lq5sxLiJO7wuzBLtOzkW1ssF+K3vm35uKE9m4nIEoR4Sme uLE99MZPLt9AZ0UWgmzFvNJHRAIg1qgMN10ZZamuJTRqZ71rv8CxS3gQELCQuy5z74c8 uYXTys/PIZymZS/g36XExHZtXTTzVg1ldIIbJXIzPbwTkk+PqfmsTqGM4mjca4djr7k3 qXVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pTmFyIGq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 z17-20020a170902ccd100b001755f43df36si617859ple.479.2022.10.24.14.17.05; Mon, 24 Oct 2022 14: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=pTmFyIGq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233783AbiJXVQP (ORCPT + 99 others); Mon, 24 Oct 2022 17:16:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230199AbiJXVPt (ORCPT ); Mon, 24 Oct 2022 17:15:49 -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 1178626479D; Mon, 24 Oct 2022 12:21: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 sin.source.kernel.org (Postfix) with ESMTPS id C2322CE1337; Mon, 24 Oct 2022 11:45:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C28FC433D6; Mon, 24 Oct 2022 11:45:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611915; bh=rWO+9/X2dtZ3MO2fo4XjnIoOCDwe2h4UACGfZFSVtEA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pTmFyIGqjStufbMVfAg53CH8fLetVzxVl4kqWQcNRDW//aExbx98pw7y6GZz4PCYw PC6uDXY7V7Iy5PYHHcVspvud04nXgMx4EmkFTDvVv77cOdfF1eUiUpLxRR+SM7DJ5e tDmoSyJSqnMHJF7fSlpiP8cIRD9iLtRn7ivgJ3JI= 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.9 148/159] HID: roccat: Fix use-after-free in roccat_read() Date: Mon, 24 Oct 2022 13:31:42 +0200 Message-Id: <20221024112954.829525975@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747605247463523064?= X-GMAIL-MSGID: =?utf-8?q?1747605247463523064?= 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 76d06cf87b2a..36eee9663962 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: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: 8534 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp416556wru; Mon, 24 Oct 2022 05:11:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7fJowvWlnDAcno0iGhHw0v4T5kshiZmntG0z1/ngZafbFdwIqBH52CWOxmmZ1s31jDEW0j X-Received: by 2002:a05:6402:5406:b0:452:1560:f9d4 with SMTP id ev6-20020a056402540600b004521560f9d4mr30719715edb.333.1666613513058; 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=PFxTDcp4nC/iw0j3N1DsLjGc2YBhQ0A1P368J0O2ZAgLP2Xa5f1svw9pEEHamn0Mxi apb3sv4tLiOnfLzUT92Oq4atf4+9H6ihppFnPbQg/XItP//f5VvKakNzP/eG3SLAHAZH x/iGHhTRVPrCrUvDysuH257xK2QadRrQ0nrWh3ZHfHpVLOkQRL3xguwPbdsqfZW/T51w UpEVMuJnXw2XW/9Qby4S9BeEwBGIgvXMoowQPLvAJDEZ/3pWLAWGWK3nXgyhDazYy4bb trd0JVIqo9z8YsEB7YPQcSg3Y4cuVFbMWbDh8S06kfXdCs4DD5eXoWJBqq2ksroBs9fC ayfg== 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=AEfKijShn3do2z+a7+bXLdnXu21SC7EAU5eSsLTLwFA=; b=OS9kC0SKuTAhN35odUnDLgFY3DWX7o3h+KmiKIiSmhd312KLaTj/4wt6VkPqfpowTd 0tsSdepfF0nccoKSMK0Ht6GQbl+9pAoiyZtX0OB70X8yt6qk8aYhQOHfaGRNDn3pv3UW 0nGgQ8GM5kQ8rRWVuUTo+iv+ekIUbQOIvnDhC7wDsEgxHRz1luLTL6CLRH6gunkrTRJX S+/A5bkVJ8neuF12XBB1sjzlpTYeZAG0ufFnKVpX1EiK9gp31THac1peD1CNYvYEKBXU uim3hYACCrqHkpYgTI0YkablxJInYDWfmx5lSIzlfOK6l38xDoEhpWisDRYRRlGWOkf7 f3vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tJUjH0FP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 d22-20020a50fe96000000b0045beaf03ddesi23272216edt.411.2022.10.24.05.11.26; 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=tJUjH0FP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232206AbiJXL6c (ORCPT + 99 others); Mon, 24 Oct 2022 07:58:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232321AbiJXL47 (ORCPT ); Mon, 24 Oct 2022 07:56: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 DFA267B581; Mon, 24 Oct 2022 04:47: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 2FE66612B1; Mon, 24 Oct 2022 11:45:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F25AC433D7; Mon, 24 Oct 2022 11:45:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611917; bh=Xzjr1c31nVklNKmxLuRkYMncuBbqb1/Fpk/i6gX/Q0Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tJUjH0FP+59CCxLyU51fCfpEt5t1FcSwm+8JHURrND3aEP7CpZ1tRckyQ5Za0nxay 2B+MiwvhVvcDCi9N66iDBV9XoX0Mmh2PBVRBjAUwFEJM+UfQGjgB0I8hPm5bb55P4U nLIk348eUrTwiQ5hFqMh+jj/t31Ik19vh1Vd3/20= 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.9 149/159] usb: host: xhci: Fix potential memory leak in xhci_alloc_stream_info() Date: Mon, 24 Oct 2022 13:31:43 +0200 Message-Id: <20221024112954.860673461@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747570930842794689?= X-GMAIL-MSGID: =?utf-8?q?1747570930842794689?= 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 9b30936904da..0850d587683a 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -703,7 +703,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); @@ -764,6 +764,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: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: 8524 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp405890wru; Mon, 24 Oct 2022 04:57:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5i2yMzJDYTuQ0TkJuVWf1bkJoCb9Wo5AlOc7zOVpnJzsktITmS15nYn4EkSptbgTugUlhS X-Received: by 2002:a17:903:247:b0:179:b5e1:54b7 with SMTP id j7-20020a170903024700b00179b5e154b7mr33023008plh.84.1666612661169; Mon, 24 Oct 2022 04:57:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612661; cv=none; d=google.com; s=arc-20160816; b=fsSkpi6JVPd22sPJQdZ4S73S80Qv5VbyARsxgGsQY9cw+FAlS8+dpqk/0COC5U076U tklodbPa8EEPLngiVO81w8Db2uxqGLi/ndo7eH1puJXkGZ5a1BlGLTbeNkxqUsZ/6p/1 ERuvK+y+t2N5XogSRNnMEYaHH+FBdF7jLctnn9mwNQVqD+ywR+eFTg0uV1iLcatisrM2 +iLDbl1qgsPY1Vl3fxjEJzP8tzWn2BQTSORJ7B8jMXbO/tx3bI6JZOYoCz7vLfjF51kj /qjQ7EN7ghyL/s/oN9Jrby/MPc2MHQv6UKXNmXIqn/dArX/HRWZraIJDodhtg/C0iOyd pzlA== 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=oalOrpyosbir6jPMiBqj2HaU6sqdyvuiQeVCe6HiCnI=; b=jUJUu8mRjOinU+EML8Wsxta0TXa+3A5NGGY2E/M3gcZZHJ9v8ER66h04tbbEC5kaI5 IVGL5LVSMOl1k+pv4Ud58YEOj805blPpy9FAFzwDYGi8K3eKjLHyTtl/dD0XBrgSup1b nCl6z304IZoi8BkG5I9oeRDiKVWuyjyyjL0zb2R443X/C2kbZQVdbwvZDBIzWlmJQNVI G9chttnznmQ/3waPilkk4rZfOvmDyuUp6bd6gmPza8uiSQN+LkTByOBV5H5vRh05eC6v rhvN/k6xrsucHo/SrPgAMomD+fWXLg4zQ/zoVt2djCE3rC3T606X6y2bXeTTahH0o+Vt QqIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EPqg7JzD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a170902f54d00b0017e22aeca47si36276842plf.552.2022.10.24.04.57.26; Mon, 24 Oct 2022 04:57: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=EPqg7JzD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232331AbiJXL5I (ORCPT + 99 others); Mon, 24 Oct 2022 07:57:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232086AbiJXLz2 (ORCPT ); Mon, 24 Oct 2022 07:55: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 99BBB74CE1; Mon, 24 Oct 2022 04:46: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 76A5EB810F5; Mon, 24 Oct 2022 11:45:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE5FDC43148; Mon, 24 Oct 2022 11:45:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611920; bh=bhDouuUflupWGGnjEU3vG613jCzS1Gy6Wbou3SeQ8uk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EPqg7JzDya3b98rA+aPcRkDIGMHJLRTvudZ1aMHHohvlNpAQnx6nnaFDpv98AdHct rbpEtZ3xxxjvsLwcEmhzw0cluc1p1UC1/FUz2pyN9oGSx8FKm3ToFX2qaSzR/K5u+z z3hoiWVSw6n1bROrDm/ewAo2An1WReCivcIUazi8= 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.9 150/159] usb: musb: Fix musb_gadget.c rxstate overflow bug Date: Mon, 24 Oct 2022 13:31:44 +0200 Message-Id: <20221024112954.898484057@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747570037636267445?= X-GMAIL-MSGID: =?utf-8?q?1747570037636267445?= 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 8eb3a291ca9d..02ec84ce5ab9 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: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: 8518 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp405625wru; Mon, 24 Oct 2022 04:57:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4h5jxNDicAdYWPkB7S5o3kKUwZ07/l1YknSJ0/amGLG2XxRq6O9/BUIazlTfbWKSiv6Rfi X-Received: by 2002:a17:90b:17ca:b0:20d:76bb:3f8c with SMTP id me10-20020a17090b17ca00b0020d76bb3f8cmr71862887pjb.28.1666612631826; Mon, 24 Oct 2022 04:57:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612631; cv=none; d=google.com; s=arc-20160816; b=wQp1OCjsUdXPYIeWDSL6eLBJgL5OmOEO/RTd95H93crEAxcW9V2R/jXIhtXNBDTb7D YZ8JRq4GGJ1t1II0ZVs+nCpXXSF71jM/sZrLSMtwAVzZ3nFvfu5TG4q8oiFSyOYWkjXi OVfMDoJk5Hu8q/WjRkYgBZSze5J07I/lihBUWICcfsCI0y7MiZOGPZlYTh9rI8RnTkhJ bxvAB32rqjXjLlYkh+K7SCiNr5DsnhUWKKaTInxb4vU2wHIKe6quajyxbhHQ7WyMjQNC 959QCS9yzDYnKYmyJY7ilvWeEpC2YdKC0LtSVkdnzS1GR0aGEZbTI96vbBeqkGNFnytZ 1dqQ== 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=De2Hw+cMRcAxJBxximsSc5Ym2DiT4zWZYtAMocw3X10=; b=gN4Aorck6ylppG4IiJMCoQt6rvI8jzYbG30SVzCpIsNinm/GD50wBgYdt9mAGP5Gls qsk+exOun/1aEqXIHNG6FX2H2K2u0dL/6nGKRknxPkWsiykF6Y8vha1VTqRajSNog1lQ f4dHJWUqVNrhF1Dui7+/KzDaUhVRgNPABU89NS1yDKIwAOoobvGfBL89Dc2hX1F8rOph p0xG3/tpMlBRtSIX2boSf1eijRYo4yYjfHcRYZhT3DG3goa09N1LO42XtcGDmD5+5ROZ JbxUx3kSjI63L2rZGp++HCLxljNrX8G/yQZOzCLHqWfnU7dDcnKOI2jjsbz3m6bkJpXH qDcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uBEgwsJe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 m18-20020a6562d2000000b00439494dfd20si34744490pgv.202.2022.10.24.04.56.58; Mon, 24 Oct 2022 04:57: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=uBEgwsJe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232284AbiJXL4i (ORCPT + 99 others); Mon, 24 Oct 2022 07:56:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232178AbiJXLyE (ORCPT ); Mon, 24 Oct 2022 07:54: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 9E71474BBD; Mon, 24 Oct 2022 04:45: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 237B5B81151; Mon, 24 Oct 2022 11:45:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72B60C433D6; Mon, 24 Oct 2022 11:45:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611922; bh=X/cIJmrKiiqRqx/BcVynhDgyBSUjjuc0ViUWGM72QBM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uBEgwsJeM657bkm5Zzllr7qcN4rgIZV8tLWGFAMJxAO4od/n8PAy/UyzNjL+9epy9 TR+eSS/cn64Zmzynj4dcM3M0y5sUcbcfMHm9Pt8AAm0if2KR7JGe9EPOyzgeWfgevQ wPhZt0UBvxbbg5X03GdvNBr95GBhSvXG0YvT5J24= 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.9 151/159] Revert "usb: storage: Add quirk for Samsung Fit flash" Date: Mon, 24 Oct 2022 13:31:45 +0200 Message-Id: <20221024112954.937926881@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747570006834762027?= X-GMAIL-MSGID: =?utf-8?q?1747570006834762027?= 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 5a6ca1460711..8c51bb66f16f 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: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: 8838 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431558wru; Mon, 24 Oct 2022 05:44:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM79u8NOkTYBG34Uj2syKZQUMTmgyRT71NZCeXvmK5aRCzJnCtRjQUnif80F6IBiGsyj4as1 X-Received: by 2002:a17:903:3011:b0:186:892d:1c4c with SMTP id o17-20020a170903301100b00186892d1c4cmr12407819pla.152.1666615450691; Mon, 24 Oct 2022 05:44:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615450; cv=none; d=google.com; s=arc-20160816; b=nePbiimgIe+Yxs1fz3lqze9GE55eLR57K+Vo42hR2OAGYtLcP+85ZztBIb3zgmC5ef qReGyTiPr5T0OXfyZXaKDWqveyyx9FcQgNz0FmU7DrdfGdoKABsdInu+M57mLhXm1M84 UGhyIDz2cfsSvsOyvBoaxajnGZ2TUNPPV82zZWTVCsm66/D6PGVwHDpnfoPZdyC5Bc3p gGkiIu3kN7tdlBNiTGXTcMgtL8w7D83cdfiZy/d9GI6GhkfPr5cl7CIktM59XLZgi/be A3aWT7vMOijm/uP6pHyj6lOAiYr1fFhU3azI/HG0GumLmk3qm0ewMGyJnozCvi1lN3ms aO/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=hA6+ohBTG+rRER4WNI0emvGPoBr2lMDjPZwMQNWLX6Y=; b=vMT66XxuMyjX0hkuBJvdHRl2t/cPxbpmOOJ/i0YRc/Y0F4/Wl5D0bUrWOdgotRy4zx mR0eM4XIhwmB+AxuQzhWhnMmUQdj2nvmw4PF+fD9umNxgqm/L1pvCP2Pg6cjwWTGf8Vt q2ea3UTZDQ5lkIZ70B7q4ZY3Rc+sQJdgDIpNAU2tDCkQJVKq8LU/rE/OI/lI/pDF9oSg HEjnOguMF9+y11Fz2GyqerKsdEaZ0ISZl5E0RZ6xDftHR+SRgjHEXYz6GI2nRAsWzUEE OKO9XrT59cFtmpfAkKeWCE1VMMRfnn3UHySEd9rjqty4tyJknwUV5mCPXFiog+93VUK/ NDWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GJUtFvGJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 bk13-20020a056a02028d00b0045fe55a7d06si34542239pgb.377.2022.10.24.05.43.56; Mon, 24 Oct 2022 05:44: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=GJUtFvGJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234530AbiJXMfY (ORCPT + 99 others); Mon, 24 Oct 2022 08:35:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234247AbiJXM3u (ORCPT ); Mon, 24 Oct 2022 08:29:50 -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 9AF2A3334D; Mon, 24 Oct 2022 05:03: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 B700EB81195; Mon, 24 Oct 2022 11:45:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E3F2C433D6; Mon, 24 Oct 2022 11:45:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611925; bh=Mj21hyBrDjmSdd2jWfMhrCp60Lexb3CWLmw3cQrt69Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GJUtFvGJwGS8BLBZUndiGOpb1Y1LF/b4v5yXFm7yN8gjvAA5SdgEX+qbtp0VGVczX +BShqVyllmwPuPKp+ya/u+vbTNfZagAtdHOOpeJ8or+OhRfibzAZVqdV9NwuQ1vIxg 92H5jydW5wHEBTuqikJJvsqcqy6sV12TlXQ+1tmI= 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.9 152/159] usb: idmouse: fix an uninit-value in idmouse_open Date: Mon, 24 Oct 2022 13:31:46 +0200 Message-Id: <20221024112954.968123565@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747572963206165274?= X-GMAIL-MSGID: =?utf-8?q?1747572963206165274?= 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 9cf8a9b16336..51f5cee880b2 100644 --- a/drivers/usb/misc/idmouse.c +++ b/drivers/usb/misc/idmouse.c @@ -183,10 +183,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) @@ -198,6 +194,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: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: 8545 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp416951wru; Mon, 24 Oct 2022 05:12:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Wm3IVvjBMuXZSUUf8mzx/0hcdMvaizX38xBxbbJwaH35TbwZHN9a7/Iiu/yHchsXpy4JP X-Received: by 2002:aa7:ce8d:0:b0:461:50fd:e358 with SMTP id y13-20020aa7ce8d000000b0046150fde358mr15300348edv.194.1666613547074; Mon, 24 Oct 2022 05:12:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613547; cv=none; d=google.com; s=arc-20160816; b=Xk89WT5o3PqAAzQZeZPandFjF6q9JuPA778/d8GACa3z8CHI+2yqYLErxGDLPwhPqt FlptWZQFbCZd9FbM0PMgbnqiYRtFFrB7IzGLPrCjW+IlEmR0bVmdU8MKnYGw4jN3n2xG zvpDKx3kItvZioXOwpVSHntjvA6dOZi1igUiKf8cEasnzKjUxnIzzTfqbCmoRMPBHhma vD01oPSpAP5bdVtFP9JbxpRG9ud+JXfDhQgiBIdF+tgVYgxejPNxGSLtfkMWEAieVSpk inwcDnoxExpfwhZrJ+A2amY3pc8ZIYht5DOaGsaSlGFzEgBf10PblEEl3UMBXdhMQb/5 zjqg== 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=XosWSMrVhCgCEY5S25EeVp5xVe3pPLVFCjKJQVEk5EM=; b=hyDCqbNARfZxmBk3Nzmqcn0i3RYwOABiUs6LvIIww0hoLorei9IAnJhhDcbqoNjtKl BzEVwTslot0Vjn9LR9VCwsxnhzcEVtcjatifMHb+XjCmOPOMO8T8kuFcoa/SrQAbAxng sQfCrwJZQ5yMusXwAI2qtGdkBOC8/2AW1bP5Hvh089x/FTD60H+bvJeryTDsD0+lfkfZ sQRoNUOUhLOd9U2ZOe31wDmYbsi6H6EI1hYucCMMoUNKPh2IMi+LgOG4pWy0e00+Q9wo cs0OdN1T8a03pKT6fgYft6V/+VdmAbTqWIOeJhtw5RieLlIeKBZAzhltHtl5lyRUD+Vi fRzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EgEHscso; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 i19-20020a05640242d300b0045bd55b122fsi34053344edc.57.2022.10.24.05.12.01; Mon, 24 Oct 2022 05:12: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=EgEHscso; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230149AbiJXMAi (ORCPT + 99 others); Mon, 24 Oct 2022 08:00:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230003AbiJXL6f (ORCPT ); Mon, 24 Oct 2022 07:58: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 C10DE2B1A6; Mon, 24 Oct 2022 04:47: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 sin.source.kernel.org (Postfix) with ESMTPS id B855DCE12CF; Mon, 24 Oct 2022 11:45:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B294AC433C1; Mon, 24 Oct 2022 11:45:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611928; bh=UE6C/YunwoRMuPQGwLI+pqaEFufW26X4AEXY60j0vS0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EgEHscsoJSqI9zC9vJTC9uD3a1jKtL7xIwyQuR9/8YoQv2vgz9pwKxVkAN1AK7zOs qrNBOk966QC0v0sfxzwbKoh/nqrFPS7+uO+C9qGTJoT8iOf7gLP6hxK4gx82TJEiNf UScXv6VbzaYZ3Pb6iB8Gbgm7TBWIWCaBdwrpUyQI= 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.9 153/159] perf intel-pt: Fix segfault in intel_pt_print_info() with uClibc Date: Mon, 24 Oct 2022 13:31:47 +0200 Message-Id: <20221024112955.006882965@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747570967154090710?= X-GMAIL-MSGID: =?utf-8?q?1747570967154090710?= 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 @@ -2124,6 +2124,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", @@ -2138,8 +2139,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: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: 9278 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp462692wru; Mon, 24 Oct 2022 06:46:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7TX0qfIbZBUXo2oXIC8N2A48g7RpY9u1BS0UP3fBZXJkeNzxDtxraANtbQpEPrkk5gWwGu X-Received: by 2002:a17:907:3f94:b0:78d:9d2f:3002 with SMTP id hr20-20020a1709073f9400b0078d9d2f3002mr27376193ejc.40.1666619183601; Mon, 24 Oct 2022 06:46:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619183; cv=none; d=google.com; s=arc-20160816; b=bj/3PEy11GSfRGl6coW4d34ii0q0hu7DNiOUHIpc8WU3DTPEWaJGC+c3JzxTcHhsjx Im3aWejEPr57GnOIWdENnQ0NwxkoNxCu/Z3BUswmRD/Yz7ki5UIODs4iXSPyEkAem8RI Vk/JbNN38EYGFsmDyFNwdv/uZfx+3sVB1MLUxy6Dv5Kye9aPrE31bRvPT/Q3jX2U2iZ9 6jfGGBZFYMnjYmIIrbdDx0P5/xwk2pkUyljJkTDS+ZWpRAXwOfM46KeqKGGuzFBOUphz fCQUdKsJQiCABS8YzBv34iPyUYZ6wCllH5Nc/Ukv50g3jTlUO0socQFxUmj1dsgOLXCw GU8A== 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=BvtVQr84VyaXXoAs2ol+XxWN5Maf5bKlk67++3iUQWKptS3xbIoN0VycV2HAsQBkEE 1nK3J/GU4XmDcfbjLy7asWeFE31LBg1rSXgPBQpTx54lmbeiiw8UKIdSaUivgqxmVoy4 RM7t2raFRmCBCkIX4HIWNwriOGiHUoxhp1Mhh2gMKLni+KCpQZXoC0yM/OBHDPinsGm3 lhWF/pQalYKsF8B5kQAN0iwGXGxgjb5QCUPSY3mGuCZisoy6M6Xmvt6us1LnJL9AGVMU zLjdDAqzYWq3zVyACgt3U5IbGQEpGZD4VK8fNDAZTbTymA4YkyM0XC+Au6LLmHk0+iIP Nh+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wBBMmZAC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 xg11-20020a170907320b00b0073d92f673f8si26780852ejb.937.2022.10.24.06.45.59; Mon, 24 Oct 2022 06:46: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=wBBMmZAC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S236316AbiJXNnk (ORCPT + 99 others); Mon, 24 Oct 2022 09:43:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236826AbiJXNlV (ORCPT ); Mon, 24 Oct 2022 09:41: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 ABE4EB48B6; Mon, 24 Oct 2022 05:38: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 41EAE61299; Mon, 24 Oct 2022 11:45:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57170C433C1; Mon, 24 Oct 2022 11:45:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611930; bh=nU5shlmlTDL+WA15wXTBEMZOu70bg3gompzMDfGsWu8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wBBMmZAClAvStybg8EWqZr3VQXhudbj0/92XzjkvqVJRNsiuT35wmzbwYv2BQWsm2 oxMCv1UOS/dtmx1MqcsPYndQPodqC0tO29Re/ZIJXPIGComaOgAfqgZxY+g+X9rn/q rFNNtcwO+8ZvifOx6pRTmCDoXSGTlHBafn/QceZI= 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.9 154/159] net: ieee802154: return -EINVAL for unknown addr type Date: Mon, 24 Oct 2022 13:31:48 +0200 Message-Id: <20221024112955.046094901@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747576876940503346?= X-GMAIL-MSGID: =?utf-8?q?1747576876940503346?= 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: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: 8541 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp416858wru; Mon, 24 Oct 2022 05:12:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5uzwIHcHF+dXFv9QUBs3KNJdT32ApkATxJOUbupsmJElbimMhi64fnsnwHF9vK4v/4mS3B X-Received: by 2002:a17:907:983:b0:77b:6e40:8435 with SMTP id bf3-20020a170907098300b0077b6e408435mr26012862ejc.570.1666613539717; Mon, 24 Oct 2022 05:12:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613539; cv=none; d=google.com; s=arc-20160816; b=A2RSVuH9IunlvhK3X+6Z0gujfzBl3kX4XI6AGkJk3PtMastskSb+IYeaC06i/HLJzH jNDbRhsXdid12JubsUSdOi0lREEI49yvPda3U/hw6MkCb/T2OAAVOWRYeK5yEWAWT6Qb eG+QzAxWCJTTL/59T5bcfCKOzeXzdzAtkLnAfVyNV88giWJXGnPokbHD0Vw6DAvJDp5o mc13mQr3wRO53ezzq2BoVVinbm2pMRQTE1heyXDl5StxO7q5ft6Bcyketgycgck1ruRb Zs3dcACXU5lk2CKr+sAdaTHY2SzNymm85bip5o5sFDBqSsrcRC6cbdBmovHlRTzoe8Oc Ff/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=1BZa5pg8ez/v1arBqntjsbw9ELfkZlHaXsZ5+RKp3A4=; b=BPJiWcm1kAk6BaiXBYslI8Cc17tLy6XxtnVYbHWWJ4p6hu/ngxD2akKW/HqRFmy0f2 eivHgQNx68ql4amRhnPed1o7DtTcnMnZS5yMNgvbegntQq4PMYwPT+VuLQl3F+BNwhE8 qtCqWuXg7V67VlcpH/ATknZkCxN2CldUYBkIKU74TmgVnKEf0D6pwlsMGrvg88G/SXe/ WDodZ8X4yZsIDBa/B1/02W7brXN7AKnlhgRQBk8QmEFuCxisso2V1lv6IbsHa69on4hX xvKJTGctmoxAsGTZGptbqGPdAIyG/+jX1B4XfPc6qH4XoZ0au+0aG2/p1KiV/+JftR90 9xCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=18MiyHvn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 e26-20020a170906c01a00b007826cb6f57csi24203317ejz.407.2022.10.24.05.11.55; Mon, 24 Oct 2022 05:12: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=18MiyHvn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232382AbiJXMA1 (ORCPT + 99 others); Mon, 24 Oct 2022 08:00:27 -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 S232399AbiJXL63 (ORCPT ); Mon, 24 Oct 2022 07:58: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 BD8EC7B78F; 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 9E013B8118F; Mon, 24 Oct 2022 11:45:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F15E8C433C1; Mon, 24 Oct 2022 11:45:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611933; bh=nv0Xta5zNXOXSNDgY+pzkso/6hKXbxPTC/9RJLP/Unc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=18MiyHvnmxzh46IAsYawy+hDkVrH0rb4Nee9hHKFH6WK3sUNGX8BA2fxgmSbZcRI3 LOkeKEkcvt7v/WWpL+cpX4Zf+IhlzCbvbQfgYJijgDHxVgXsLaR9y1muOCjYwixTEp j9AKYwsV9uZM88W20+/hbZTZ5jQIOWNXAIrCPJGg= 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.9 155/159] net/ieee802154: dont warn zero-sized raw_sendmsg() Date: Mon, 24 Oct 2022 13:31:49 +0200 Message-Id: <20221024112955.076463623@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747570958784086527?= X-GMAIL-MSGID: =?utf-8?q?1747570958784086527?= 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 c624a54502f3..aadd445ea88a 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:31:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8521 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp405721wru; Mon, 24 Oct 2022 04:57:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6dBe7vy0D/Z6Qg+N2eil9g+bK7Dw9HqXfErozNiwfIZWCRzsODQb4G1azBWmOFDdl+QUV7 X-Received: by 2002:a17:90b:3886:b0:213:1e8:b8a6 with SMTP id mu6-20020a17090b388600b0021301e8b8a6mr7496960pjb.225.1666612653207; Mon, 24 Oct 2022 04:57:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612653; cv=none; d=google.com; s=arc-20160816; b=CmfUFr6+OhFK7h9m/xsVdZ2nL4Pp1ls0QuEj+BD1YTo0Jvh4nCbH9TbxyzXyzA+FGM EFYXNp2pSEuFc1qgUazlZf2cX0IsBjuV3e01vUBj5ZVPnZ0OiqyzfGyp0PsP6iNF2V9t TQ0PG+auGHg/AorozjFJK6/QzJZgkMBINLq2qxFwbU2nmhmUDwOPf4xTfjro1M3pMhXz O7Zvakk8ozFChXVm0TwkkCerY99xsLBqdEL4An5IR7aSGyentj5L5052JYE7/U/uh7tI Kxi5z8s//ZGt/wRuOQON8UeRoC+aRP+Occ6IQDOeKSUk/SJ/FFBtR9EtXsEl9ZVyJJYY a5gw== 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=w6qPuczSZA+2tLBcf7LsZTKCN8DxgDfCsp7CnyJVHZE=; b=dfGgCF7Ct7QUJCpvlhPrDywoNM8ryg/VQ+Bu2fr00nVZ8x4W67mCUK9Myi7R3U4C14 mN0sjglFapiVIkQnyxL8dwI1vWRqQZ15Tg5XOik0ESk98X5+CyxE6B2tbg97wC9+fJp2 AeNu/Z00+t5fZFlf9Eof/QIZR1V3fCZ7kJuHnK4mCPkzXXcyCgtmPFG/4oU9bdNhuXyT QaPGvy+2cr6VBNPsUEsKc7QHXhZFrUHdhK1hcUh554rXU2Rrc/H1oGYIzulj19l24bee d4tfS8sh7Yb0lQ+5tYgzLIHSgUml0wz0uY/x10dV8bGNQsHWE+zolJ39aCfdi4OhT2Fu NjbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sFYITeeR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 p16-20020a170902e75000b00161739962ffsi37217564plf.163.2022.10.24.04.57.19; Mon, 24 Oct 2022 04:57: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=sFYITeeR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232317AbiJXL46 (ORCPT + 99 others); Mon, 24 Oct 2022 07:56:58 -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 S232000AbiJXLzX (ORCPT ); Mon, 24 Oct 2022 07:55:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C19707A75B; Mon, 24 Oct 2022 04:46: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 C4629B81132; Mon, 24 Oct 2022 11:45:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C13CC433B5; Mon, 24 Oct 2022 11:45:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611904; bh=V2A0lr4jHL9OZAP7cunvIWhKWNM2ZkrfNMR7FENe1qY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sFYITeeR+7g8g7AxQoFN2YPWd8X6oLJ1xQFUsLhDnZNzC0NwygBhx2hMdPQf3RKvE Il24qjQ1VnoCFFdRun3TdXhv/nxwNfQOk79WN7IjvE8E9QkHUl2MXhcx2wYcNGyodf R73YlhKl6NvyLwe4CM0M2WA915VJF9vima8oAuNU= 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.9 156/159] ext4: continue to expand file system when the target size doesnt reach Date: Mon, 24 Oct 2022 13:31:50 +0200 Message-Id: <20221024112955.116553012@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747570029697318449?= X-GMAIL-MSGID: =?utf-8?q?1747570029697318449?= 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 @@ -2052,7 +2052,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: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: 8697 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp422664wru; Mon, 24 Oct 2022 05:23:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Hbe8tF/iXs8vlwUxy0nAABXgRmLChWEF3XLoqzA2e766UpkO3rTZtjCzyjXP/dNY7/oM3 X-Received: by 2002:a17:907:a47:b0:79e:56dc:5373 with SMTP id be7-20020a1709070a4700b0079e56dc5373mr12799682ejc.148.1666614190210; Mon, 24 Oct 2022 05:23:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614190; cv=none; d=google.com; s=arc-20160816; b=RH+KyXGkg6RG31Iy7GdJakReZyBtJSX96Md8vf5qw3h2qavHfCQZZ2YsyfHYbY0Up3 2ID+KvyZkhTMerb5fXQ6Bi5czRSrA3hfQCZZqWdjP2CfkJqzEQ7bM88NokLx3q1/F+Vk FZwfMR68d2z8cL4voe70Mt64oImcbpK4+xdIXNmiz59S2ZB2x8SF8mDkHY02zfcpY6Mx 2zAq25nDoAfheeGxGc6xotqmHwyrTnx0oQou2vxAh6vAcWEh2Ij4inAKvkW68QJHRoL7 KXX54ZXOAWjgcZ4cQsQKoczJThhiaVcGuGYEsr8mHtFFPpNaD8lz2oU2t/nebKAC46iz vHHw== 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=WdeFWjy5xLfv4jargwQ+ncFhcw8A/dGuNRBjvhVPfyw=; b=xLJoOSPQE8kxOAPjMgKIMwPD2LHGd8xqMx1Fxjq3PkDqkzDyZ4cZRTpoaHDM0VT7zE hwIsNmgkTGLs/TZuTlwx3cDxKBDIl93+pSWx31fpTC/fgK/ALw/vT3jiNpjMpXALHLSV WI4zBlcQyBi/8AFqehTi8zlvXd/fja0kHJpu1QJYblxYqdCo/xXYSU4r6gaIhtgfC8e+ j/nMozfDJpgef50JBhGk7dQ1ngIXQIRC6LuIG2tNhwgapHk9MWEY3x2EagBwHFQw7ebu fyKMTmTfc24Dd7HE/WOAE746ah2iNSXcFcWqwbkreIj8cf7NHyg74ImTt4eAsw2n1Of8 B1XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DYz2OnYS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 n11-20020a05640205cb00b00452697eda4csi31729151edx.58.2022.10.24.05.22.46; Mon, 24 Oct 2022 05:23: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=DYz2OnYS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233020AbiJXMVv (ORCPT + 99 others); Mon, 24 Oct 2022 08:21:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233526AbiJXMTo (ORCPT ); Mon, 24 Oct 2022 08:19:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 353F383075; Mon, 24 Oct 2022 04:58:27 -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 9E0296129B; Mon, 24 Oct 2022 11:45:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE5D3C433D6; Mon, 24 Oct 2022 11:45:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611907; bh=sGAGA+LKRSe/LbxLiyskpqsdoOJ8ByaNBWB/B+l28S0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DYz2OnYSA/HSNPZF0cyNqaNy+U2hiV5b+UMmF9dp1XpgswDoTjNHa64eFSJ4vKbif 8y20CTLMrLM28SzDoAv3tmK9ZYzX/08xZyoDu+ppEPWc2ew1I8fA8qxcKRXkE/ag1g /Fy9STXgjoIQqrVFML9McrNo5aM07vmUtY9hwQ/A= 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.9 157/159] inet: fully convert sk->sk_rx_dst to RCU rules Date: Mon, 24 Oct 2022 13:31:51 +0200 Message-Id: <20221024112955.155883288@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747571641161071765?= X-GMAIL-MSGID: =?utf-8?q?1747571641161071765?= 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: backported to 4.9; dropped irrelevant hunks in ipv6/udp.c; added rcu_access_pointer(sk->sk_rx_dst) in tcp_prequeue().] 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 | 13 ++++++++----- net/ipv4/udp.c | 6 +++--- net/ipv6/tcp_ipv6.c | 11 +++++++---- 7 files changed, 22 insertions(+), 17 deletions(-) --- a/include/net/sock.h +++ b/include/net/sock.h @@ -378,7 +378,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; /* Note: 32bit hole on 64bit arches */ atomic_t sk_wmem_alloc; --- 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 @@ -2318,8 +2318,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 @@ -5481,7 +5481,7 @@ void tcp_rcv_established(struct sock *sk { struct tcp_sock *tp = tcp_sk(sk); - 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 @@ -1404,15 +1404,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), skb->len); @@ -1489,7 +1492,7 @@ void tcp_v4_early_demux(struct sk_buff * 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); @@ -1524,7 +1527,7 @@ bool tcp_prequeue(struct sock *sk, struc * Instead of doing full sk_rx_dst validity here, let's perform * an optimistic check. */ - if (likely(sk->sk_rx_dst)) + if (likely(rcu_access_pointer(sk->sk_rx_dst))) skb_dst_drop(skb); else skb_dst_force_safe(skb); @@ -1818,7 +1821,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 @@ -1630,7 +1630,7 @@ static void udp_sk_rx_dst_set(struct soc struct dst_entry *old; dst_hold(dst); - old = xchg(&sk->sk_rx_dst, dst); + old = xchg((__force struct dst_entry **)&sk->sk_rx_dst, dst); dst_release(old); } @@ -1815,7 +1815,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); @@ -1974,7 +1974,7 @@ void udp_v4_early_demux(struct sk_buff * 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); } @@ -1285,15 +1285,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; } } @@ -1621,7 +1624,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); 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: 8519 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp405642wru; Mon, 24 Oct 2022 04:57:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM70lcYC20Ca5UndJev/YULtoO/ZgqATX3hZPDZ+WSwsGP3DgpMISgDN7JVKnFWiDC59AYDn X-Received: by 2002:a17:90a:8c8e:b0:202:883b:2644 with SMTP id b14-20020a17090a8c8e00b00202883b2644mr73105728pjo.89.1666612644325; Mon, 24 Oct 2022 04:57:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612644; cv=none; d=google.com; s=arc-20160816; b=kly3/nRrSFsvn8SHQ1QLGCCED3WzOQ5/PMIOp7HITzTo84cLSMeBvPdGULavJG2+LC am0RmME7T9JWz2A3NNLHRzOZYRGCFzc1/MzvFQGSSshnFnUvz3VNu4tuGm17s5iw/4HT 5D67m/IDS6xcnovlJuybVoVZS/JQK8gX5FP9jLZikm1op6r2HKWcwRaU3gpwd/49dFFt fsjDHMU0uZaeGBEgRUfwEcBRrpqOpC4TcvBhEKKe10hrMipCoq7oj03ee8SH/g7epReq yQmRrB1IzfKOtPBfkNmYeNJbaV2weyiWEN//d51AmkLfWJcZpwLfd4vqIbDQ/xN3Rhqq QkXA== 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=JpkkXNZ7midOyzE1bcQKPW5GsKxAuyADv/2FoRofPYE=; b=PaH3A+mHzSPz3Or/Wvx4QrgasLK1IGe54v5UJ13KoAcuqAcn23v0QCk/uJ4Qwml+As Whh0Uw8ZJqh4TaQEjtP3STckHT2A+9axrDuIGIMe/stwqpOfiGFc/x3heqD0UAHKrWTq uyY8PSetHxh0TtA6tHj5AjFutLImhfJv6RsFPU9OKXj+SPhnQF3cCvw8+MlLyGuQjmaE Vyj38OEaUNRcd4LgSvSeLeS8D0z46rYgTMTNDkgwzY8d7HWIoNQRVa4kk5UHT2o+GXoH ruG5Nu9dc0v9/3xDcE32wUEwPmAmFJgt+yNAZT/Ac1l89YohzciFQA/hiCMsrCUwwD/M RUXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="X1b/xuyX"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 v20-20020a17090a459400b0020b127afe7dsi7925603pjg.70.2022.10.24.04.57.11; Mon, 24 Oct 2022 04:57: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="X1b/xuyX"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232306AbiJXL4r (ORCPT + 99 others); Mon, 24 Oct 2022 07:56:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232586AbiJXLzF (ORCPT ); Mon, 24 Oct 2022 07:55: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 1299279693; Mon, 24 Oct 2022 04:46:20 -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 4C04061257; Mon, 24 Oct 2022 11:45:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60D9EC433D7; Mon, 24 Oct 2022 11:45:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611909; bh=UfvIfSLODXePD49Dd2Op7D60wEFjswYaD9hDwYKdrLQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X1b/xuyX2qeIdyN8SFUUU8a4kHPJl7WkkOMMJRtXUCvqnLhX/98Z3FfZNn2LxWi7K m9T1xPJ7J5fR5CnhnPQng59zxkU9BwhngR/zFKNvOuqzo/R7Ys6S8tp/IFpHXgC176 qI2Q0KI57AcSD3g1/xauABrrtXbSQ0gv5+zGsHRA= 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.9 158/159] thermal: intel_powerclamp: Use first online CPU as control_cpu Date: Mon, 24 Oct 2022 13:31:52 +0200 Message-Id: <20221024112955.194790075@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747570020066342687?= X-GMAIL-MSGID: =?utf-8?q?1747570020066342687?= 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 @@ -518,11 +518,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); 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: 8538 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp416607wru; Mon, 24 Oct 2022 05:11:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7v/KG71rgOpm0pQPhtmeWnfRaKCLFzEuZsHPggyefZIxsIUL3zKm6sbNwSyHDPLNcfeg/m X-Received: by 2002:a17:906:db0d:b0:77b:a7cd:8396 with SMTP id xj13-20020a170906db0d00b0077ba7cd8396mr28599529ejb.264.1666613519015; Mon, 24 Oct 2022 05:11:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666613519; cv=none; d=google.com; s=arc-20160816; b=pIaeK52Jj0lrSwYgyN/fAY2C9w06kkqtmpI4fJtb/O0DRCke/+Rx32m5eeSAJR8puv s6ZiYt/MEmoWFP6wU8EnXHy7GMj9Ph6xKXU93CGBksQjg/k2YRoE5a4uJA4jHyHGaTSj w1dGvWnB7tV+1cGFOzzixNPn6xViaotyVIotOwz4CGiKmUZ4/5I9TYwlUFMVCKjL1GPh 8tk+jckGw56rpR4pK9UhipBIwFh4xxQN2YD2Gprku7rLnGvLJZeNLFim8Hqn0err2VQh Wlr5Kp4FpLjA0C2Sa6LAIieF0LrgHMZaCf33JtZIpTdOsH7SmdlabBD81AgFxze1TYY8 KqRw== 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=vd9AWRVrDUxjGVmdblt7FLEdVhzmOX6Z0FhsZlpK7Vk=; b=kWUkEwUogaGDsvPkX1ikg/FWwBa69Y+ZDaVryEbx+S0t1/ula+gAn4KzWXru7Wckkw XvlrhmAbKIzsv7/XX3E6wTzpParUcVFU8YC9ivc2F9rXJyCEYAHqZgLxbA+ELquUrfiO z5C7aAnzboFWC0lyZNfC1OunjCkQD+ovhdX0NyzPpDS0DMbxPzYWceSCCvrTvLKGGnnP V3zFMvwI/Q9QxR5LYDMHuIqQyBq/4Acy3uCpwMgpJKZZwweE+T29YdLN9NMd8Wh4/mNN JsagsFHNdo2PACTbCb6JNfuoCg10YUgzxjjRh/uKeHdjcfRuGyBBPysg9klGEkDGkLxt pu7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MFrplSOM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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-20020a0564020d0d00b0044611122003si35631269edb.599.2022.10.24.05.11.34; Mon, 24 Oct 2022 05:11: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=MFrplSOM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232424AbiJXL6v (ORCPT + 99 others); Mon, 24 Oct 2022 07:58:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232266AbiJXL5t (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 D36FC7B79F; Mon, 24 Oct 2022 04:47: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 EC35A612B4; Mon, 24 Oct 2022 11:45:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06E34C433D6; Mon, 24 Oct 2022 11:45:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611912; bh=gpFlxMFq9z9WFf3Ip2j0XYJri/W568vOh5sGgcJ2nzo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MFrplSOM3KDZK9pDy5Vpo8ozP3Bx8KhyjCWzDPegjMf1QKMn0RRrac7dis6TLBnIV ynpMoPM58sSdECZavIiVc8SR32+OfU/X2BUi1gPGkLjYcyQVgXMWmvCijyYVLqkwG7 VLyAFMh/jaVDZT3jhYWItL2DdVm/OucsBHAkNtik= 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.9 159/159] gcov: support GCC 12.1 and newer compilers Date: Mon, 24 Oct 2022 13:31:53 +0200 Message-Id: <20221024112955.234880986@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747570937173983017?= X-GMAIL-MSGID: =?utf-8?q?1747570937173983017?= 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 @@ -32,6 +32,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; /** @@ -438,12 +445,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); @@ -457,7 +470,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,